/* Generated by Cython 0.29.15 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "cypari/cypari.h",
            "cypari/implementation.c",
            "cypari/long_hack.h",
            "cypari/struct_signals.h"
        ],
        "include_dirs": [
            "cypari",
            "./cypari"
        ],
        "libraries": [
            "gmp",
            "pari"
        ],
        "name": "cypari._pari",
        "sources": [
            "cypari/_pari.pyx"
        ]
    },
    "module_name": "cypari._pari"
}
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_15"
#define CYTHON_HEX_VERSION 0x001D0FF0
#define CYTHON_FUTURE_DIVISION 0
#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 CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#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)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#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
  #define PyObject_Unicode             PyObject_Str
#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 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   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#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_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; 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__cypari___pari
#define __PYX_HAVE_API__cypari___pari
/* Early includes */
#include "pari/pari.h"
#include "cypari.h"
#include "struct_signals.h"
#include <string.h>
#include <stdio.h>
#include "pari/paripriv.h"
#include "pari/anal.h"
#include "long_hack.h"
#include <stdlib.h>
#include <signal.h>
#include "implementation.c"
#include <limits.h>
#include "longintrepr.h"
#include "pythread.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 1
#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);
#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[] = {
  "cypari/signals.pyx",
  "cypari/handle_error.pyx",
  "cypari/_pari.pyx",
  "cypari/pari_instance.pyx",
  "cypari/auto_instance.pxi",
  "cypari/convert.pyx",
  "cypari/gen.pyx",
  "cypari/stack.pyx",
  "stringsource",
  "cypari/closure.pyx",
  "cypari/auto_gen.pxi",
  "cypari/paridecl.pxd",
  "cypari/memory.pxd",
  "cypari/_pari.pxd",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};
/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()


/* "cypari/pari_long.pxi":1
 * ctypedef long pari_longword             # <<<<<<<<<<<<<<
 * ctypedef unsigned long pari_ulongword
 * 
 */
typedef long __pyx_t_6cypari_8paridecl_pari_longword;

/* "cypari/pari_long.pxi":2
 * ctypedef long pari_longword
 * ctypedef unsigned long pari_ulongword             # <<<<<<<<<<<<<<
 * 
 * 
 */
typedef unsigned long __pyx_t_6cypari_8paridecl_pari_ulongword;

/*--- Type declarations ---*/
struct __pyx_obj_6cypari_5_pari_RingElement;
struct __pyx_obj_6cypari_5_pari_Gen_base;
struct __pyx_obj_6cypari_5_pari_Gen;
struct __pyx_obj_6cypari_5_pari_Pari_auto;
struct __pyx_obj_6cypari_5_pari_Pari;
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__;
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr;
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr;
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__;
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr;

/* "libc/signal.pxd":3
 * # 7.14 Signal handling <signal.h>
 * 
 * ctypedef void (*sighandler_t)(int SIGNUM) nogil             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "<signal.h>" nogil:
 */
typedef void (*__pyx_t_4libc_6signal_sighandler_t)(int);
struct __pyx_opt_args_6cypari_5_pari_default_bitprec;

/* "cypari/_pari.pxd":26
 * cpdef long prec_bits_to_words(unsigned long prec_in_bits)
 * cpdef long prec_words_to_bits(long prec_in_words)
 * cpdef long default_bitprec(long bitprec=*)             # <<<<<<<<<<<<<<
 * 
 * cdef class Pari_auto:
 */
struct __pyx_opt_args_6cypari_5_pari_default_bitprec {
  int __pyx_n;
  long bitprec;
};

/* "cypari/_pari.pxd":6
 * include "sage.pxi"
 * 
 * cdef class RingElement:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_6cypari_5_pari_RingElement {
  PyObject_HEAD
};


/* "cypari/_pari.pxd":9
 *     pass
 * 
 * cdef class Gen_base(RingElement):             # <<<<<<<<<<<<<<
 *     cdef GEN g
 *     cdef pari_sp b
 */
struct __pyx_obj_6cypari_5_pari_Gen_base {
  struct __pyx_obj_6cypari_5_pari_RingElement __pyx_base;
  GEN g;
  pari_sp b;
  PyObject *refers_to;
};


/* "cypari/_pari.pxd":15
 * 
 * @cython.final
 * cdef class Gen(Gen_base):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_6cypari_5_pari_Gen {
  struct __pyx_obj_6cypari_5_pari_Gen_base __pyx_base;
};


/* "cypari/_pari.pxd":28
 * cpdef long default_bitprec(long bitprec=*)
 * 
 * cdef class Pari_auto:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
struct __pyx_obj_6cypari_5_pari_Pari_auto {
  PyObject_HEAD
};


/* "cypari/_pari.pxd":32
 * 
 * @cython.final
 * cdef class Pari(Pari_auto):             # <<<<<<<<<<<<<<
 *     cdef long _real_precision
 *     cdef readonly Gen PARI_ZERO, PARI_ONE, PARI_TWO
 */
struct __pyx_obj_6cypari_5_pari_Pari {
  struct __pyx_obj_6cypari_5_pari_Pari_auto __pyx_base;
  struct __pyx_vtabstruct_6cypari_5_pari_Pari *__pyx_vtab;
  long _real_precision;
  struct __pyx_obj_6cypari_5_pari_Gen *PARI_ZERO;
  struct __pyx_obj_6cypari_5_pari_Gen *PARI_ONE;
  struct __pyx_obj_6cypari_5_pari_Gen *PARI_TWO;
  PyObject *_UI_callback;
};


/* "cypari/gen.pyx":170
 *         return h
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Iterate over the components of ``self``.
 */
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ {
  PyObject_HEAD
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_v;
  GEN __pyx_v_x;
};


/* "cypari/gen.pyx":282
 *             # Special case: items of type int
 *             x = self.g
 *             return (x[i] for i in range(1, lg(x)))             # <<<<<<<<<<<<<<
 *         elif t == t_STR:
 *             # Special case: convert to str
 */
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *__pyx_outer_scope;
  long __pyx_v_i;
  long __pyx_t_0;
  long __pyx_t_1;
  long __pyx_t_2;
};


/* "cypari/gen.pyx":291
 *         # Now iterate over the vector v
 *         x = v.g
 *         return (new_ref(gel(x, i), v) for i in range(1, lg(x)))             # <<<<<<<<<<<<<<
 * 
 *     def list(self):
 */
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *__pyx_outer_scope;
  long __pyx_v_i;
  long __pyx_t_0;
  long __pyx_t_1;
  long __pyx_t_2;
};


/* "cypari/gen.pyx":937
 *         return new_gen(bid_get_gen(self.g))
 * 
 *     def __getitem__(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the nth entry of self. The indexing is 0-based, like in
 */
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ {
  PyObject_HEAD
  PyObject *__pyx_v_inds;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self;
};


/* "cypari/gen.pyx":1079
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop+2)+'"')
 *                 # slow call
 *                 return objtogen(self[i] for i in inds)             # <<<<<<<<<<<<<<
 * 
 *         if pari_type == t_POL:
 */
struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *__pyx_outer_scope;
  PyObject *__pyx_v_i;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};



/* "cypari/pari_instance.pyx":488
 * 
 * @cython.final
 * cdef class Pari(Pari_auto):             # <<<<<<<<<<<<<<
 *     def __cinit__(self):
 *         r"""
 */

struct __pyx_vtabstruct_6cypari_5_pari_Pari {
  struct __pyx_obj_6cypari_5_pari_Gen *(*zero)(struct __pyx_obj_6cypari_5_pari_Pari *, int __pyx_skip_dispatch);
  struct __pyx_obj_6cypari_5_pari_Gen *(*one)(struct __pyx_obj_6cypari_5_pari_Pari *, int __pyx_skip_dispatch);
  struct __pyx_obj_6cypari_5_pari_Gen *(*_empty_vector)(struct __pyx_obj_6cypari_5_pari_Pari *, long);
  PyObject *(*_real_coerced_to_bits_prec)(struct __pyx_obj_6cypari_5_pari_Pari *, double, long, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6cypari_5_pari_Pari *__pyx_vtabptr_6cypari_5_pari_Pari;
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari_zero(struct __pyx_obj_6cypari_5_pari_Pari *, int __pyx_skip_dispatch);
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari_one(struct __pyx_obj_6cypari_5_pari_Pari *, int __pyx_skip_dispatch);
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari__empty_vector(struct __pyx_obj_6cypari_5_pari_Pari *, long);
static PyObject *__pyx_f_6cypari_5_pari_4Pari__real_coerced_to_bits_prec(struct __pyx_obj_6cypari_5_pari_Pari *, double, long, int __pyx_skip_dispatch);

/* --- 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);

/* 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);

/* 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

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

/* IncludeStringH.proto */
#include <string.h>

/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* 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

/* 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);

/* 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);

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

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

/* 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

/* 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);

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* PyObjectFormatSimple.proto */
#if CYTHON_COMPILING_IN_PYPY
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#elif PY_MAJOR_VERSION < 3
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
        PyObject_Format(s, f))
#elif CYTHON_USE_TYPE_SLOTS
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_str(s) :\
        likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_str(s) :\
        PyObject_Format(s, f))
#else
    #define __Pyx_PyObject_FormatSimple(s, f) (\
        likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
        PyObject_Format(s, f))
#endif

/* PyIntFromDouble.proto */
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value);
#else
#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value)
#endif

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

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

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* KeywordStringCheck.proto */
static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

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

/* 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

/* 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);

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(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);

/* None.proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

/* 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);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* 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

/* pyobject_as_double.proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj);
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_AsDouble(obj)\
(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
 likely(PyInt_CheckExact(obj)) ?\
 PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
#else
#define __Pyx_PyObject_AsDouble(obj)\
((likely(PyFloat_CheckExact(obj))) ?\
 PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
#endif

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

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

/* JoinPyUnicode.proto */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      Py_UCS4 max_char);

/* PyObjectLookupSpecial.proto */
#if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) {
    PyObject *res;
    PyTypeObject *tp = Py_TYPE(obj);
#if PY_MAJOR_VERSION < 3
    if (unlikely(PyInstance_Check(obj)))
        return __Pyx_PyObject_GetAttrStr(obj, attr_name);
#endif
    res = _PyType_Lookup(tp, attr_name);
    if (likely(res)) {
        descrgetfunc f = Py_TYPE(res)->tp_descr_get;
        if (!f) {
            Py_INCREF(res);
        } else {
            res = f(res, obj, (PyObject *)tp);
        }
    } else {
        PyErr_SetObject(PyExc_AttributeError, attr_name);
    }
    return res;
}
#else
#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
#endif

/* 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

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

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* 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);

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* CallableCheck.proto */
#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
#define __Pyx_PyCallable_Check(obj)   ((obj)->ob_type->tp_call != NULL)
#else
#define __Pyx_PyCallable_Check(obj)   PyCallable_Check(obj)
#endif

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* CallNextTpTraverse.proto */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);

/* CallNextTpClear.proto */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* 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

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* 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_int(int value);

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

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

/* Print.proto */
static int __Pyx_Print(PyObject*, PyObject *, int);
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value);

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

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

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

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* PrintOne.proto */
static int __Pyx_PrintOne(PyObject* stream, PyObject *o);

/* 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)

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

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    PyObject *gi_code;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name);
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
static int __Pyx_Coroutine_clear(PyObject *self);
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
static PyObject *__Pyx_Coroutine_Close(PyObject *self);
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_Coroutine_SwapException(self)
#define __Pyx_Coroutine_ResetAndClearException(self)  __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
#else
#define __Pyx_Coroutine_SwapException(self) {\
    __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
    __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
    }
#define __Pyx_Coroutine_ResetAndClearException(self) {\
    __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
    (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
    }
#endif
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
#endif
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

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

/* VoidPtrExport.proto */
static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

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

static PyObject *__pyx_f_6cypari_5_pari_4Pari__real_coerced_to_bits_prec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, double __pyx_v_x, long __pyx_v_bits, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari_zero(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari_one(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch); /* proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari__empty_vector(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n); /* proto*/

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

/* Module declarations from 'cython' */

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

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

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

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

/* Module declarations from '__builtin__' */

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from 'cpython' */

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

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

/* Module declarations from 'cypari.auto_paridecl' */

/* Module declarations from 'cypari.paridecl' */

/* Module declarations from 'cypari.paripriv' */

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

/* Module declarations from 'libc' */

/* Module declarations from 'cypari.memory' */
static CYTHON_INLINE void *sig_malloc(size_t); /*proto*/
static CYTHON_INLINE void *sig_realloc(void *, size_t); /*proto*/
static CYTHON_INLINE void *sig_calloc(size_t, size_t); /*proto*/
static CYTHON_INLINE void sig_free(void *); /*proto*/
static CYTHON_INLINE size_t __pyx_f_6cypari_6memory_mul_overflowcheck(size_t, size_t); /*proto*/
static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_allocarray(size_t, size_t); /*proto*/
static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_reallocarray(void *, size_t, size_t); /*proto*/
static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_malloc(size_t); /*proto*/
static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_realloc(void *, size_t); /*proto*/
static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_calloc(size_t, size_t); /*proto*/

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

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

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.longintrepr' */
static PyTypeObject *__pyx_ptype_7cpython_11longintrepr_py_long = 0;

/* Module declarations from 'cypari._pari' */
static PyTypeObject *__pyx_ptype_6cypari_5_pari_RingElement = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari_Gen_base = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari_Gen = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari_Pari_auto = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari_Pari = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari___pyx_scope_struct____iter__ = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari___pyx_scope_struct_1_genexpr = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari___pyx_scope_struct_2_genexpr = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari___pyx_scope_struct_3___getitem__ = 0;
static PyTypeObject *__pyx_ptype_6cypari_5_pari___pyx_scope_struct_4_genexpr = 0;
static struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_6cypari_5_pari_pari_instance = 0;
static cysigs_t __pyx_v_6cypari_5_pari_cysigs;
static long __pyx_v_6cypari_5_pari_prec;
static struct PariOUT __pyx_v_6cypari_5_pari_sage_pariOut;
static entree *__pyx_v_6cypari_5_pari_ep_call_python;
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_objtogen(PyObject *, int __pyx_skip_dispatch); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_gen_from_double(double); /*proto*/
static long __pyx_f_6cypari_5_pari_prec_bits_to_words(unsigned long, int __pyx_skip_dispatch); /*proto*/
static long __pyx_f_6cypari_5_pari_prec_words_to_bits(long, int __pyx_skip_dispatch); /*proto*/
static long __pyx_f_6cypari_5_pari_default_bitprec(int __pyx_skip_dispatch, struct __pyx_opt_args_6cypari_5_pari_default_bitprec *__pyx_optional_args); /*proto*/
static long __pyx_f_6cypari_5_pari_get_var(PyObject *); /*proto*/
static CYTHON_INLINE GEN __pyx_f_6cypari_5_pari_deepcopy_to_python_heap(GEN, pari_sp *); /*proto*/
static CYTHON_INLINE struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_gen(GEN); /*proto*/
static CYTHON_INLINE struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_gen_noclear(GEN); /*proto*/
static CYTHON_INLINE void __pyx_f_6cypari_5_pari_clear_stack(void); /*proto*/
static void __pyx_f_6cypari_5_pari__pari_init_error_handling(void); /*proto*/
static int __pyx_f_6cypari_5_pari__pari_err_handle(GEN); /*proto*/
static void __pyx_f_6cypari_5_pari__pari_err_recover(long); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_String(PyObject *); /*proto*/
__PYX_EXTERN_C int sig_raise_exception(int, char const *); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_to_bytes(PyObject *); /*proto*/
static void __pyx_f_6cypari_5_pari_sage_putchar(char); /*proto*/
static void __pyx_f_6cypari_5_pari_sage_puts(char const *); /*proto*/
static void __pyx_f_6cypari_5_pari_sage_flush(void); /*proto*/
static void __pyx_f_6cypari_5_pari_swallow_ch(char); /*proto*/
static void __pyx_f_6cypari_5_pari_swallow_s(char const *); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_integer_to_gen(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_PyLong_FromINT(GEN); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_gen_to_integer(struct __pyx_obj_6cypari_5_pari_Gen *, int __pyx_skip_dispatch); /*proto*/
static GEN __pyx_f_6cypari_5_pari_gtoi(GEN); /*proto*/
static GEN __pyx_f_6cypari_5_pari_PyLong_AsGEN(PyObject *); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_t_COMPLEX_from_double(double, double); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_gen_to_python(struct __pyx_obj_6cypari_5_pari_Gen *, int __pyx_skip_dispatch); /*proto*/
static GEN __pyx_f_6cypari_5_pari_call_python(GEN, GEN, GEN, GEN, GEN, pari_ulong); /*proto*/
static void __pyx_f_6cypari_5_pari__pari_init_closure(void); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_objtoclosure(PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_pari_longword_to_int(__pyx_t_6cypari_8paridecl_pari_longword); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_ref(GEN, struct __pyx_obj_6cypari_5_pari_Gen *); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_list_of_Gens_to_Gen(PyObject *); /*proto*/
static GEN __pyx_f_6cypari_5_pari__Vec_append(GEN, GEN, long); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari___pyx_unpickle_Pari_auto__set_state(struct __pyx_obj_6cypari_5_pari_Pari_auto *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "cypari._pari"
extern int __pyx_module_is_main_cypari___pari;
int __pyx_module_is_main_cypari___pari = 0;

/* Implementation of 'cypari._pari' */
static PyObject *__pyx_builtin_KeyboardInterrupt;
static PyObject *__pyx_builtin_BaseException;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_SystemExit;
static PyObject *__pyx_builtin_FloatingPointError;
static PyObject *__pyx_builtin_SystemError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_AssertionError;
static PyObject *__pyx_builtin_DeprecationWarning;
static PyObject *__pyx_builtin_OverflowError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_NotImplementedError;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_chr;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_MemoryError;
static const char __pyx_k_0[] = "0";
static const char __pyx_k_A[] = "A";
static const char __pyx_k_B[] = "B";
static const char __pyx_k_C[] = "C";
static const char __pyx_k_D[] = "D";
static const char __pyx_k_E[] = "E";
static const char __pyx_k_F[] = "F";
static const char __pyx_k_G[] = "G";
static const char __pyx_k_H[] = "H";
static const char __pyx_k_I[] = "I";
static const char __pyx_k_L[] = "L";
static const char __pyx_k_M[] = "M";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_P[] = "P";
static const char __pyx_k_Q[] = "Q";
static const char __pyx_k_S[] = "S";
static const char __pyx_k_T[] = "T";
static const char __pyx_k_V[] = "V";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_Y[] = "Y";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_b[] = "b";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_e[] = "e";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_g[] = "g";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_o[] = "o";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_q[] = "q";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_u[] = "u";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_z[] = "z";
static const char __pyx_k_AP[] = "AP";
static const char __pyx_k_CF[] = "CF";
static const char __pyx_k_FS[] = "FS";
static const char __pyx_k_L1[] = "L1";
static const char __pyx_k_L2[] = "L2";
static const char __pyx_k_Ld[] = "Ld";
static const char __pyx_k_Mp[] = "Mp";
static const char __pyx_k_NK[] = "NK";
static const char __pyx_k_P0[] = "P0";
static const char __pyx_k_PQ[] = "PQ";
static const char __pyx_k_Pi[] = "Pi";
static const char __pyx_k_ab[] = "ab";
static const char __pyx_k_al[] = "al";
static const char __pyx_k_c1[] = "c1";
static const char __pyx_k_dx[] = "dx";
static const char __pyx_k_dy[] = "dy";
static const char __pyx_k_fa[] = "fa";
static const char __pyx_k_fl[] = "fl";
static const char __pyx_k_fs[] = "fs";
static const char __pyx_k_ga[] = "ga";
static const char __pyx_k_gs[] = "gs";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_im[] = "im";
static const char __pyx_k_ix[] = "ix";
static const char __pyx_k_mf[] = "mf";
static const char __pyx_k_mt[] = "mt";
static const char __pyx_k_mu[] = "mu";
static const char __pyx_k_n0[] = "n0";
static const char __pyx_k_nf[] = "nf";
static const char __pyx_k_nu[] = "nu";
static const char __pyx_k_pi[] = "pi";
static const char __pyx_k_pl[] = "pl";
static const char __pyx_k_pr[] = "pr";
static const char __pyx_k_re[] = "re";
static const char __pyx_k_sd[] = "sd";
static const char __pyx_k_ss[] = "ss";
static const char __pyx_k_tb[] = "tb";
static const char __pyx_k_vF[] = "vF";
static const char __pyx_k_x0[] = "x0";
static const char __pyx_k_x1[] = "x1";
static const char __pyx_k_x2[] = "x2";
static const char __pyx_k_y1[] = "y1";
static const char __pyx_k_y2[] = "y2";
static const char __pyx_k_ya[] = "ya";
static const char __pyx_k_z1[] = "z1";
static const char __pyx_k_z2[] = "z2";
static const char __pyx_k_Gen[] = "Gen";
static const char __pyx_k_Lpr[] = "Lpr";
static const char __pyx_k_Mat[] = "Mat";
static const char __pyx_k_Mod[] = "Mod";
static const char __pyx_k_ORD[] = "ORD";
static const char __pyx_k_PHI[] = "PHI";
static const char __pyx_k_Vec[] = "Vec";
static const char __pyx_k__46[] = " .:";
static const char __pyx_k__47[] = ": ";
static const char __pyx_k__83[] = "_.";
static const char __pyx_k__90[] = "\"";
static const char __pyx_k__91[] = "..";
static const char __pyx_k_abs[] = "abs";
static const char __pyx_k_al1[] = "al1";
static const char __pyx_k_al2[] = "al2";
static const char __pyx_k_aut[] = "aut";
static const char __pyx_k_bid[] = "bid";
static const char __pyx_k_bij[] = "bij";
static const char __pyx_k_bnf[] = "bnf";
static const char __pyx_k_bnr[] = "bnr";
static const char __pyx_k_chi[] = "chi";
static const char __pyx_k_chr[] = "chr";
static const char __pyx_k_cyc[] = "cyc";
static const char __pyx_k_den[] = "den";
static const char __pyx_k_der[] = "der";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_eps[] = "eps";
static const char __pyx_k_eta[] = "eta";
static const char __pyx_k_fmt[] = "fmt";
static const char __pyx_k_gal[] = "gal";
static const char __pyx_k_grp[] = "grp";
static const char __pyx_k_inf[] = "inf";
static const char __pyx_k_inv[] = "inv";
static const char __pyx_k_isd[] = "isd";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_lat[] = "lat";
static const char __pyx_k_lib[] = "lib";
static const char __pyx_k_lim[] = "lim";
static const char __pyx_k_mat[] = "mat";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_old[] = "old";
static const char __pyx_k_phi[] = "phi";
static const char __pyx_k_pol[] = "pol";
static const char __pyx_k_psi[] = "psi";
static const char __pyx_k_qfa[] = "qfa";
static const char __pyx_k_rho[] = "rho";
static const char __pyx_k_rnf[] = "rnf";
static const char __pyx_k_sfu[] = "sfu";
static const char __pyx_k_sig[] = "sig";
static const char __pyx_k_sol[] = "sol";
static const char __pyx_k_str[] = "str";
static const char __pyx_k_sym[] = "sym";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_tab[] = "tab";
static const char __pyx_k_tau[] = "tau";
static const char __pyx_k_tnf[] = "tnf";
static const char __pyx_k_typ[] = "typ";
static const char __pyx_k_val[] = "val";
static const char __pyx_k_var[] = "var";
static const char __pyx_k_CHI1[] = "CHI1";
static const char __pyx_k_CHI2[] = "CHI2";
static const char __pyx_k_Pari[] = "Pari";
static const char __pyx_k_arch[] = "arch";
static const char __pyx_k_arg2[] = "_arg2";
static const char __pyx_k_arg3[] = "_arg3";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_bits[] = "bits";
static const char __pyx_k_bnfK[] = "bnfK";
static const char __pyx_k_bnfL[] = "bnfL";
static const char __pyx_k_cert[] = "cert";
static const char __pyx_k_cmpf[] = "cmpf";
static const char __pyx_k_code[] = "code";
static const char __pyx_k_cusp[] = "cusp";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_detx[] = "detx";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_divz[] = "divz";
static const char __pyx_k_eval[] = "eval";
static const char __pyx_k_exit[] = "__exit__";
static const char __pyx_k_expr[] = "expr";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_flag[] = "flag";
static const char __pyx_k_imag[] = "imag";
static const char __pyx_k_lat1[] = "lat1";
static const char __pyx_k_lat2[] = "lat2";
static const char __pyx_k_list[] = "list";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_maps[] = "maps";
static const char __pyx_k_maxw[] = "maxw";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_nmax[] = "nmax";
static const char __pyx_k_pari[] = "_pari_";
static const char __pyx_k_path[] = "path";
static const char __pyx_k_perm[] = "perm";
static const char __pyx_k_real[] = "real";
static const char __pyx_k_repr[] = "__repr__";
static const char __pyx_k_sdom[] = "sdom";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_sign[] = "sign";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_tdom[] = "tdom";
static const char __pyx_k_tech[] = "tech";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_tors[] = "tors";
static const char __pyx_k_type[] = "type";
static const char __pyx_k_vdir[] = "vdir";
static const char __pyx_k_vecn[] = "vecn";
static const char __pyx_k_vtau[] = "vtau";
static const char __pyx_k_warn[] = "warn";
static const char __pyx_k_32bit[] = "32bit";
static const char __pyx_k_64bit[] = "64bit";
static const char __pyx_k_Euler[] = "Euler";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_ascii[] = "ascii";
static const char __pyx_k_asymp[] = "asymp";
static const char __pyx_k_bound[] = "bound";
static const char __pyx_k_chain[] = "chain";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_debug[] = "debug";
static const char __pyx_k_depth[] = "depth";
static const char __pyx_k_destw[] = "destw";
static const char __pyx_k_enter[] = "__enter__";
static const char __pyx_k_euler[] = "euler";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_flush[] = "flush";
static const char __pyx_k_frame[] = "frame";
static const char __pyx_k_limit[] = "limit";
static const char __pyx_k_listx[] = "listx";
static const char __pyx_k_listy[] = "listy";
static const char __pyx_k_major[] = "major";
static const char __pyx_k_mfatk[] = "mfatk";
static const char __pyx_k_ncols[] = "ncols";
static const char __pyx_k_nrows[] = "nrows";
static const char __pyx_k_order[] = "order";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_projH[] = "projH";
static const char __pyx_k_proof[] = "proof";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_rootT[] = "rootT";
static const char __pyx_k_space[] = "space";
static const char __pyx_k_str_2[] = "__str__";
static const char __pyx_k_subgp[] = "subgp";
static const char __pyx_k_super[] = "super";
static const char __pyx_k_t_COL[] = "t_COL";
static const char __pyx_k_t_INT[] = "t_INT";
static const char __pyx_k_t_MAT[] = "t_MAT";
static const char __pyx_k_t_POL[] = "t_POL";
static const char __pyx_k_t_QFI[] = "t_QFI";
static const char __pyx_k_t_QFR[] = "t_QFR";
static const char __pyx_k_t_SER[] = "t_SER";
static const char __pyx_k_t_STR[] = "t_STR";
static const char __pyx_k_t_VEC[] = "t_VEC";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_types[] = "types";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_SIGINT[] = "SIGINT";
static const char __pyx_k_Vecrev[] = "Vecrev";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_derivs[] = "derivs";
static const char __pyx_k_dimlim[] = "dimlim";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_errnum[] = "errnum";
static const char __pyx_k_filled[] = "filled";
static const char __pyx_k_flreal[] = "flreal";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_gpname[] = "gpname";
static const char __pyx_k_ignore[] = "ignore";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_log_10[] = "log_10";
static const char __pyx_k_maxord[] = "maxord";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_pari_2[] = "pari";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_polred[] = "polred";
static const char __pyx_k_polrel[] = "polrel";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_rstrip[] = "rstrip";
static const char __pyx_k_signal[] = "signal";
static const char __pyx_k_silent[] = "silent";
static const char __pyx_k_stdout[] = "stdout";
static const char __pyx_k_subgrp[] = "subgrp";
static const char __pyx_k_t_FRAC[] = "t_FRAC";
static const char __pyx_k_t_LIST[] = "t_LIST";
static const char __pyx_k_t_QUAD[] = "t_QUAD";
static const char __pyx_k_t_REAL[] = "t_REAL";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_vector[] = "vector";
static const char __pyx_k_xrange[] = "xrange";
static const char __pyx_k_Aborted[] = "Aborted";
static const char __pyx_k_Lcosets[] = "Lcosets";
static const char __pyx_k_SIGSEGV[] = "SIGSEGV";
static const char __pyx_k_add_one[] = "add_one";
static const char __pyx_k_bitprec[] = "bitprec";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_entries[] = "entries";
static const char __pyx_k_errdata[] = "errdata";
static const char __pyx_k_errtext[] = "errtext";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_indices[] = "indices";
static const char __pyx_k_lngamma[] = "lngamma";
static const char __pyx_k_maxsize[] = "maxsize";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_serprec[] = "serprec";
static const char __pyx_k_sizemax[] = "sizemax";
static const char __pyx_k_sourcew[] = "sourcew";
static const char __pyx_k_t_FFELT[] = "t_FFELT";
static const char __pyx_k_t_PADIC[] = "t_PADIC";
static const char __pyx_k_t_RFRAC[] = "t_RFRAC";
static const char __pyx_k_znorder[] = "znorder";
static const char __pyx_k_Fraction[] = "Fraction";
static const char __pyx_k_Gen_base[] = "Gen_base";
static const char __pyx_k_encoding[] = "encoding";
static const char __pyx_k_estimate[] = "estimate";
static const char __pyx_k_exc_info[] = "exc_info";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_maxprime[] = "maxprime";
static const char __pyx_k_objtogen[] = "objtogen";
static const char __pyx_k_polcoeff[] = "polcoeff";
static const char __pyx_k_pyx_capi[] = "__pyx_capi__";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_subgroup[] = "subgroup";
static const char __pyx_k_t_INTMOD[] = "t_INTMOD";
static const char __pyx_k_t_POLMOD[] = "t_POLMOD";
static const char __pyx_k_variable[] = "variable";
static const char __pyx_k_warnings[] = "warnings";
static const char __pyx_k_Bus_error[] = "Bus error";
static const char __pyx_k_PariError[] = "PariError";
static const char __pyx_k_Pari_auto[] = "Pari_auto";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_component[] = "component";
static const char __pyx_k_cpu_width[] = "cpu_width";
static const char __pyx_k_ellaplist[] = "ellaplist";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_find_root[] = "find_root";
static const char __pyx_k_fractions[] = "fractions";
static const char __pyx_k_log_gamma[] = "log_gamma";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_numerator[] = "numerator";
static const char __pyx_k_precision[] = "precision";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_qflllgram[] = "qflllgram";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_stacksize[] = "stacksize";
static const char __pyx_k_t_CLOSURE[] = "t_CLOSURE";
static const char __pyx_k_t_COMPLEX[] = "t_COMPLEX";
static const char __pyx_k_traceback[] = "traceback";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_SystemExit[] = "SystemExit";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_XRangeType[] = "XRangeType";
static const char __pyx_k_centerlift[] = "centerlift";
static const char __pyx_k_only_image[] = "only_image";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_t_INFINITY[] = "t_INFINITY";
static const char __pyx_k_t_VECSMALL[] = "t_VECSMALL";
static const char __pyx_k_vecextract[] = "vecextract";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PariError_d[] = "PariError(%d)";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_RingElement[] = "RingElement";
static const char __pyx_k_SignalError[] = "SignalError";
static const char __pyx_k_SystemError[] = "SystemError";
static const char __pyx_k_denominator[] = "denominator";
static const char __pyx_k_init_primes[] = "init_primes";
static const char __pyx_k_prec_in_dec[] = "prec_in_dec";
static const char __pyx_k_python_ints[] = "python_ints";
static const char __pyx_k_python_list[] = "python_list";
static const char __pyx_k_test_signal[] = "test_signal";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_cypari__pari[] = "cypari._pari";
static const char __pyx_k_prec_in_bits[] = "prec_in_bits";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_sig_on_reset[] = "sig_on_reset";
static const char __pyx_k_simplefilter[] = "simplefilter";
static const char __pyx_k_stacksizemax[] = "stacksizemax";
static const char __pyx_k_str_returned[] = "str() returned ";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_version_info[] = "version_info";
static const char __pyx_k_BaseException[] = "BaseException";
static const char __pyx_k_GeneratorType[] = "GeneratorType";
static const char __pyx_k_OverflowError[] = "OverflowError";
static const char __pyx_k_is_deprecated[] = " is deprecated";
static const char __pyx_k_lift_centered[] = "lift_centered";
static const char __pyx_k_pari_instance[] = "pari_instance";
static const char __pyx_k_prec_in_words[] = "prec_in_words";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_AlarmInterrupt[] = "AlarmInterrupt";
static const char __pyx_k_AssertionError[] = "AssertionError";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_catch_warnings[] = "catch_warnings";
static const char __pyx_k_init_cysignals[] = "init_cysignals";
static const char __pyx_k_iterable_types[] = "iterable_types";
static const char __pyx_k_PariError___str[] = "PariError.__str__";
static const char __pyx_k_is_not_iterable[] = " is not iterable";
static const char __pyx_k_print_exception[] = "print_exception";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_PariError___repr[] = "PariError.__repr__";
static const char __pyx_k_PariError_errnum[] = "PariError.errnum";
static const char __pyx_k_iterating_a_PARI[] = "iterating a PARI ";
static const char __pyx_k_prec_bits_to_dec[] = "prec_bits_to_dec";
static const char __pyx_k_prec_dec_to_bits[] = "prec_dec_to_bits";
static const char __pyx_k_KeyboardInterrupt[] = "KeyboardInterrupt";
static const char __pyx_k_PariError_errdata[] = "PariError.errdata";
static const char __pyx_k_PariError_errtext[] = "PariError.errtext";
static const char __pyx_k_prec_dec_to_words[] = "prec_dec_to_words";
static const char __pyx_k_prec_words_to_dec[] = "prec_words_to_dec";
static const char __pyx_k_python_list_small[] = "python_list_small";
static const char __pyx_k_DeprecationWarning[] = "DeprecationWarning";
static const char __pyx_k_FloatingPointError[] = "FloatingPointError";
static const char __pyx_k_Segmentation_fault[] = "Segmentation fault";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_cypari_signals_pyx[] = "cypari/signals.pyx";
static const char __pyx_k_get_real_precision[] = "get_real_precision";
static const char __pyx_k_index_out_of_range[] = "index out of range";
static const char __pyx_k_set_real_precision[] = "set_real_precision";
static const char __pyx_k_Illegal_instruction[] = "Illegal instruction";
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
static const char __pyx_k_PARI_object_of_type[] = "PARI object of type ";
static const char __pyx_k_Unknown_PARI_type_s[] = "Unknown PARI type: %s";
static const char __pyx_k_sig_print_exception[] = "sig_print_exception";
static const char __pyx_k_Error_raised_by_PARI[] = "\n    Error raised by PARI\n    ";
static const char __pyx_k_multiplicative_order[] = "multiplicative_order";
static const char __pyx_k_test_signal_line_232[] = "test_signal (line 232)";
static const char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
static const char __pyx_k_iter___locals_genexpr[] = "__iter__.<locals>.genexpr";
static const char __pyx_k_python_check_interrupt[] = "python_check_interrupt";
static const char __pyx_k_pyx_unpickle_Pari_auto[] = "__pyx_unpickle_Pari_auto";
static const char __pyx_k_row_index_out_of_range[] = "row index out of range";
static const char __pyx_k_Gen___index___line_1551[] = "Gen.__index__ (line 1551)";
static const char __pyx_k_cypari_handle_error_pyx[] = "cypari/handle_error.pyx";
static const char __pyx_k_init_cysignals_line_172[] = "init_cysignals (line 172)";
static const char __pyx_k_set_real_precision_bits[] = "set_real_precision_bits";
static const char __pyx_k_unknown_signal_number_s[] = "unknown signal number %s";
static const char __pyx_k_Floating_point_exception[] = "Floating point exception";
static const char __pyx_k_cannot_double_stack_size[] = "cannot double stack size";
static const char __pyx_k_cypari_pari_instance_pyx[] = "cypari/pari_instance.pyx";
static const char __pyx_k_getitem___locals_genexpr[] = "__getitem__.<locals>.genexpr";
static const char __pyx_k_column_index_out_of_range[] = "column index out of range";
static const char __pyx_k_failed_to_allocate_s_bytes[] = "failed to allocate %s bytes";
static const char __pyx_k_s_is_not_a_square_modulo_s[] = "%s is not a square modulo %s";
static const char __pyx_k_Cannot_convert_None_to_pari[] = "Cannot convert None to pari";
static const char __pyx_k_missing_required_argument_N[] = "missing required argument: 'N'";
static const char __pyx_k_missing_required_argument_x[] = "missing required argument: 'x'";
static const char __pyx_k_failed_to_allocate_s_s_bytes[] = "failed to allocate %s * %s bytes";
static const char __pyx_k_sig_print_exception_line_117[] = "sig_print_exception (line 117)";
static const char __pyx_k_missing_required_argument_bid[] = "missing required argument: 'bid'";
static const char __pyx_k_Exception_class_for_func_alarm[] = "\n    Exception class for :func:`alarm` timeouts.\n\n    EXAMPLES::\n\n        XXX from cysignals import AlarmInterrupt\n        XXX from signal import alarm\n        XXX try:\n        ...     _ = alarm(1)\n        ...     while True:\n        ...         pass\n        ... except AlarmInterrupt:\n        ...     print(\"alarm!\")\n        alarm!\n        XXX from cysignals.signals import sig_print_exception\n        XXX import signal\n        XXX sig_print_exception(signal.SIGALRM)\n        AlarmInterrupt\n\n    ";
static const char __pyx_k_Gen_must_be_of_PARI_type_t_INT[] = "Gen must be of PARI type t_INT";
static const char __pyx_k_Not_an_INTMOD_or_POLMOD_in_mod[] = "Not an INTMOD or POLMOD in mod()";
static const char __pyx_k_Sage_class_for_PARI_s_GEN_type[] = "\nSage class for PARI's GEN type\n\nSee the ``Pari`` class for documentation and examples.\n\nAUTHORS:\n\n- William Stein (2006-03-01): updated to work with PARI 2.2.12-beta\n\n- William Stein (2006-03-06): added newtonpoly\n\n- Justin Walker: contributed some of the function definitions\n\n- Gonzalo Tornaria: improvements to conversions; much better error\n  handling.\n\n- Robert Bradshaw, Jeroen Demeyer, William Stein (2010-08-15):\n  Upgrade to PARI 2.4.3 (:trac:`9343`)\n\n- Jeroen Demeyer (2011-11-12): rewrite various conversion routines\n  (:trac:`11611`, :trac:`11854`, :trac:`11952`)\n\n- Peter Bruin (2013-11-17): move Pari to a separate file\n  (:trac:`15185`)\n\n- Jeroen Demeyer (2014-02-09): upgrade to PARI 2.7 (:trac:`15767`)\n\n- Martin von Gagern (2014-12-17): Added some Galois functions (:trac:`17519`)\n\n- Jeroen Demeyer (2015-01-12): upgrade to PARI 2.8 (:trac:`16997`)\n\n- Jeroen Demeyer (2015-03-17): automatically generate methods from\n  ``pari.desc`` (:trac:`17631` and :trac:`17860`)\n\n- Kiran Kedlaya (2016-03-23): implement infinity type\n\n- Luca De Feo (2016-09-06): Separate Sage-specific components from\n  generic C-interface in ``Pari`` (:trac:`20241`)\n\n- Marc Culler and Nathan Dunfield (2016): adaptation for the standalone\n  CyPari module.\n\n";
static const char __pyx_k_conversion_not_implemented_for[] = "conversion not implemented for ";
static const char __pyx_k_len_of_entries_s_must_be_s_s_s[] = "len of entries (=%s) must be %s*%s=%s";
static const char __pyx_k_Coerce_self_which_must_be_a_cla[] = "\n        Coerce ``self`` (which must be a :class:`Gen` of type\n        ``t_INT``) to a Python integer.\n\n        EXAMPLES::\n \n            >>> from operator import index\n            >>> i = pari(2)\n            >>> i.__index__()\n            2\n            >>> L = [0, 1, 2, 3, 4]\n            >>> L[i]\n            2\n            >>> pari(\"2^100\").__index__() == 1267650600228229401496703205376\n            True\n            >>> pari(\"2.5\").__index__()\n            Traceback (most recent call last):\n            ...\n            TypeError: cannot coerce 2.50000000000000 (type t_REAL) to integer\n        ";
static const char __pyx_k_Creates_a_PARI_t_REAL_with_valu[] = " \n        Creates a PARI t_REAL with value given by the float x, coerced\n        to at least the given precision.  The resulting gen object\n        will have word length (not including codewords) which is large\n        enough to provide the requested number of bits, but no larger.\n\n        >>> from cypari._pari import prec_bits_to_words\n        >>> old_precision = pari.set_real_precision(64)\n        >>> x = pari._real_coerced_to_bits_prec(1.23456789012345678, 100)\n        >>> x\n        1.23456789012345669043213547411141917109\n        >>> x.length() == prec_bits_to_words(100) - 2\n        True\n        >>> pari.set_real_precision(old_precision)\n        64\n\n        Here the pari Gen uses two 64 bit words to provide at least\n        100 bits of precision.  This can be used, for example, to convert\n        quad-double numbers to pari numbers.\n        ";
static const char __pyx_k_Exception_class_for_critical_si[] = "\n    Exception class for critical signals such as ``SIGSEGV``. Inherits\n    from ``BaseException`` because these normally should not be handled.\n\n    EXAMPLES::\n\n        >>> import signal\n        >>> sig_print_exception(signal.SIGSEGV)\n        SignalError: Segmentation fault\n\n    ";
static const char __pyx_k_Initialize_cysignals_This_is_no[] = "\n    Initialize ``cysignals``.\n\n    This is normally done exactly once, namely when importing\n    ``cysignals``. However, it is legal to call this multiple times,\n    for example when switching between the ``cysignals`` interrupt\n    handler and a different interrupt handler.\n\n    OUTPUT: the old Python-level interrupt handler\n\n    EXAMPLES::\n\n        XXX from cysignals.signals import init_cysignals\n        >>> init_cysignals()\n        <built-in function python_check_interrupt>\n\n    ";
static const char __pyx_k_Interface_to_the_PARI_C_library[] = "Interface to the PARI C library";
static const char __pyx_k_PARI_object_of_type_r_cannot_be[] = "PARI object of type %r cannot be indexed";
static const char __pyx_k_Pari__real_coerced_to_bits_prec[] = "Pari._real_coerced_to_bits_prec (line 895)";
static const char __pyx_k_Python_version_of_func_sig_rais[] = "\n    Python version of :func:`sig_raise_exception` which prints the\n    exception instead of raising it. This is just for doctesting.\n\n    EXAMPLES::\n\n        XXX from cysignals.signals import sig_print_exception\n        >>> import signal\n        >>> sig_print_exception(signal.SIGFPE)\n        FloatingPointError: Floating point exception\n\n        XXX sig_print_exception(signal.SIGBUS, \"CUSTOM MESSAGE\")\n        SignalError: CUSTOM MESSAGE\n        >>> sig_print_exception(0)\n        SystemError: unknown signal number 0\n\n    For interrupts, the message is ignored::\n\n        >>> sig_print_exception(signal.SIGINT, \"ignored\")\n        KeyboardInterrupt\n\n        XXX sig_print_exception(signal.SIGALRM, \"ignored\")\n        AlarmInterrupt\n\n    ";
static const char __pyx_k_Set_the_default_bit_precision_f[] = "\n        Set the default bit precision for real and complex gens.\n\n        >>> pari.get_default_bit_precision()\n        64\n        >>> pari.pi()\n        3.14159265358979\n        >>> pari.pi().precision()\n        3  # 64-bit\n        4  # 32-bit\n        >>> pari.set_default_bit_precision(212)\n        64\n        >>> pari.get_default_bit_precision()\n        256 # 64-bit\n        224 # 32-bit\n        >>> pari.pi()\n        3.14159265358979\n        >>> pari.pi().precision()\n        6  # 64-bit\n        9  # 32-bit\n        >>> old_real_precision = pari.set_real_precision(50)\n        >>> pari.pi()\n        3.1415926535897932384626433832795028841971693993751\n        >>> pari.set_default_bit_precision(64)\n        256 # 64-bit\n        224 # 32-bit\n        >>> pari.pi()\n        3.141592653589793239\n        >>> pari.set_real_precision(old_real_precision)\n        50\n        >>> pari.pi()\n        3.14159265358979\n        ";
static const char __pyx_k_Test_whether_critical_signals_c[] = "\n    Test whether critical signals can be handled within a sig_on-sig_off\n    block.\n\n    >>> from signal import *\n    >>> from cypari._pari import test_signal\n    >>> test_signal(SIGFPE)\n    Traceback (most recent call last):\n        ...\n    FloatingPointError: Floating point exception\n    >>> test_signal(SIGSEGV)\n    Traceback (most recent call last):\n        ...\n    SignalError: Segmentation fault\n    ";
static const char __pyx_k_You_can_use_pari_allocatemem_to[] = "You can use pari.allocatemem() to change the stack size and try again";
static const char __pyx_k_evaluating_PARI_s_takes_exactly[] = "evaluating PARI %s takes exactly 1 argument (%d given)";
static const char __pyx_k_index_must_be_an_integer_or_a_2[] = "index must be an integer or a 2-tuple (i,j)";
static const char __pyx_k_index_s_must_be_between_0_and_s[] = "index (%s) must be between 0 and %s";
static const char __pyx_k_row_i_s_must_be_between_0_and_s[] = "row i(=%s) must be between 0 and %s";
static const char __pyx_k_self_g_cannot_be_converted_to_a[] = "self.g cannot be converted to a Python object for pickling";
static const char __pyx_k_self_must_be_of_pari_type_t_MAT[] = "self must be of pari type t_MAT";
static const char __pyx_k_the_PARI_GP_function_bernvec_is[] = "the PARI/GP function bernvec is obsolete (2007-03-30)";
static const char __pyx_k_the_PARI_GP_function_elllseries[] = "the PARI/GP function elllseries is obsolete (2016-08-08)";
static const char __pyx_k_the_PARI_GP_function_nfkermodpr[] = "the PARI/GP function nfkermodpr is obsolete (2016-08-09)";
static const char __pyx_k_the_PARI_GP_function_polrootsff[] = "the PARI/GP function polrootsff is obsolete (2018-03-11)";
static const char __pyx_k_the_PARI_GP_function_psplothraw[] = "the PARI/GP function psplothraw is obsolete (2018-02-01)";
static const char __pyx_k_Cannot_compute_primes_beyond_436[] = "Cannot compute primes beyond 436273290";
static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())";
static const char __pyx_k_Neither_a_str_nor_a_bytes_object[] = "Neither a str nor a bytes object.";
static const char __pyx_k_Object_s_must_be_of_type_t_VECSM[] = "Object (=%s) must be of type t_VECSMALL.";
static const char __pyx_k_Object_s_must_be_of_type_t_VEC_o[] = "Object (=%s) must be of type t_VEC or t_COL.";
static const char __pyx_k_PARI_object_in_unused_part_of_PA[] = "PARI object in unused part of PARI stack";
static const char __pyx_k_PARI_objects_cannot_be_instantia[] = "PARI objects cannot be instantiated directly; use pari(x) to convert x to PARI";
static const char __pyx_k_PARI_stack_size_set_to_bytes_max[] = "PARI stack size set to {} bytes, maximum size set to {}";
static const char __pyx_k_Pari_set_default_bit_precision_l[] = "Pari.set_default_bit_precision (line 833)";
static const char __pyx_k_argument_2_of_the_PARI_GP_functi[] = "argument 2 of the PARI/GP function polred is undocumented and deprecated";
static const char __pyx_k_argument_3_of_the_PARI_GP_functi[] = "argument 3 of the PARI/GP function polred is undocumented and deprecated";
static const char __pyx_k_attempt_to_assign_sequence_of_si[] = "attempt to assign sequence of size %s to slice of size %s";
static const char __pyx_k_calling_list_on_scalar_PARI_type[] = "calling list() on scalar PARI types is deprecated";
static const char __pyx_k_cannot_coerce_0_r_type_1_to_inte[] = "cannot coerce {0!r} (type {1}) to integer";
static const char __pyx_k_cannot_evaluate_PARI_s_using_unn[] = "cannot evaluate PARI %s using unnamed arguments";
static const char __pyx_k_cannot_evaluate_a_PARI_closure_u[] = "cannot evaluate a PARI closure using keyword arguments";
static const char __pyx_k_cannot_index_PARI_type_s_by_tupl[] = "cannot index PARI type %s by tuple";
static const char __pyx_k_column_j_s_must_be_between_0_and[] = "column j(=%s) must be between 0 and %s";
static const char __pyx_k_integer_to_gen_needs_an_int_or_l[] = "integer_to_gen() needs an int or long argument, not ";
static const char __pyx_k_length_of_entries_s_must_equal_n[] = "length of entries (=%s) must equal n (=%s)";
static const char __pyx_k_matrix_index_must_be_of_the_form[] = "matrix index must be of the form [row, column]";
static const char __pyx_k_mixing_unnamed_and_keyword_argum[] = "mixing unnamed and keyword arguments not allowed when evaluating a PARI object";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_pari_double_to_gen_x_is_deprecat[] = "pari.double_to_gen(x) is deprecated, use pari(x) instead";
static const char __pyx_k_set_variable_only_works_for_poly[] = "set_variable() only works for polynomials or power series";
static const char __pyx_k_the_PARI_GP_function_bezout_is_o[] = "the PARI/GP function bezout is obsolete (2013-04-03)";
static const char __pyx_k_the_PARI_GP_function_bezoutres_i[] = "the PARI/GP function bezoutres is obsolete (2015-01-13)";
static const char __pyx_k_the_PARI_GP_function_bnrconducto[] = "the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)";
static const char __pyx_k_the_PARI_GP_function_ellbil_is_o[] = "the PARI/GP function ellbil is obsolete (2014-05-21)";
static const char __pyx_k_the_PARI_GP_function_ellpow_is_o[] = "the PARI/GP function ellpow is obsolete (2012-06-06)";
static const char __pyx_k_the_PARI_GP_function_factorcanto[] = "the PARI/GP function factorcantor is obsolete (2018-02-28)";
static const char __pyx_k_the_PARI_GP_function_factorff_is[] = "the PARI/GP function factorff is obsolete (2018-03-11)";
static const char __pyx_k_the_PARI_GP_function_factornf_is[] = "the PARI/GP function factornf is obsolete (2016-08-08)";
static const char __pyx_k_the_PARI_GP_function_listkill_is[] = "the PARI/GP function listkill is obsolete (2007-08-10)";
static const char __pyx_k_the_PARI_GP_function_matalgtobas[] = "the PARI/GP function matalgtobasis is obsolete (2016-08-08)";
static const char __pyx_k_the_PARI_GP_function_matbasistoa[] = "the PARI/GP function matbasistoalg is obsolete (2016-08-08)";
static const char __pyx_k_the_PARI_GP_function_nfeltdivmod[] = "the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)";
static const char __pyx_k_the_PARI_GP_function_nfeltmulmod[] = "the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)";
static const char __pyx_k_the_PARI_GP_function_nfeltpowmod[] = "the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)";
static const char __pyx_k_the_PARI_GP_function_nfeltreduce[] = "the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)";
static const char __pyx_k_the_PARI_GP_function_nffactormod[] = "the PARI/GP function nffactormod is obsolete (2016-09-18)";
static const char __pyx_k_the_PARI_GP_function_nfsolvemodp[] = "the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)";
static const char __pyx_k_the_PARI_GP_function_plotlinetyp[] = "the PARI/GP function plotlinetype is obsolete (2007-05-11)";
static const char __pyx_k_the_PARI_GP_function_plotpointsi[] = "the PARI/GP function plotpointsize is obsolete (2007-05-11)";
static const char __pyx_k_the_PARI_GP_function_plotpointty[] = "the PARI/GP function plotpointtype is obsolete (2007-05-11)";
static const char __pyx_k_the_PARI_GP_function_polcoeff_is[] = "the PARI/GP function polcoeff is obsolete (2018-05-14)";
static const char __pyx_k_the_PARI_GP_function_polred_is_o[] = "the PARI/GP function polred is obsolete (2013-03-27)";
static const char __pyx_k_the_PARI_GP_function_polredord_i[] = "the PARI/GP function polredord is obsolete (2008-07-20)";
static const char __pyx_k_the_PARI_GP_function_poltchebi_i[] = "the PARI/GP function poltchebi is obsolete (2013-04-03)";
static const char __pyx_k_the_PARI_GP_function_psdraw_is_o[] = "the PARI/GP function psdraw is obsolete (2018-02-01)";
static const char __pyx_k_the_PARI_GP_function_qfbil_is_ob[] = "the PARI/GP function qfbil is obsolete (2016-08-08)";
static const char __pyx_k_the_PARI_GP_function_qfnorm_is_o[] = "the PARI/GP function qfnorm is obsolete (2016-08-08)";
static const char __pyx_k_the_PARI_GP_function_rnfpolred_i[] = "the PARI/GP function rnfpolred is obsolete (2013-12-28)";
static const char __pyx_k_the_PARI_GP_function_sizedigit_i[] = "the PARI/GP function sizedigit is obsolete (2015-01-13)";
static const char __pyx_k_the_PARI_stack_overflows_current[] = "the PARI stack overflows (current size: {}; maximum size: {})\n";
static const char __pyx_k_the_flag_argument_of_the_PARI_GP[] = "the 'flag' argument of the PARI/GP function matkerint is obsolete";
static const char __pyx_k_the_maximum_size_should_be_at_le[] = "the maximum size ({}) should be at least the stack size ({})";
static const char __pyx_k_the_method_allocatemem_should_no[] = "the method allocatemem() should not be used; use pari.allocatemem() instead";
static const char __pyx_k_the_PARI_GP_function_bernvec_is_2[] = "the PARI/GP function bernvec() is obsolete: use repeated calls to bernfrac() instead";
static const char __pyx_k_argument_2_of_the_PARI_GP_functi_2[] = "argument 2 of the PARI/GP function polsturm is undocumented and deprecated";
static const char __pyx_k_argument_3_of_the_PARI_GP_functi_2[] = "argument 3 of the PARI/GP function polsturm is undocumented and deprecated";
static PyObject *__pyx_kp_s_0;
static PyObject *__pyx_kp_s_32bit;
static PyObject *__pyx_kp_s_64bit;
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_AP;
static PyObject *__pyx_n_s_Aborted;
static PyObject *__pyx_n_s_AlarmInterrupt;
static PyObject *__pyx_n_s_AssertionError;
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_B;
static PyObject *__pyx_n_s_BaseException;
static PyObject *__pyx_kp_s_Bus_error;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_CF;
static PyObject *__pyx_n_s_CHI1;
static PyObject *__pyx_n_s_CHI2;
static PyObject *__pyx_kp_s_Cannot_compute_primes_beyond_436;
static PyObject *__pyx_kp_s_Cannot_convert_None_to_pari;
static PyObject *__pyx_kp_u_Coerce_self_which_must_be_a_cla;
static PyObject *__pyx_kp_u_Creates_a_PARI_t_REAL_with_valu;
static PyObject *__pyx_n_s_D;
static PyObject *__pyx_n_s_DeprecationWarning;
static PyObject *__pyx_n_s_E;
static PyObject *__pyx_kp_s_Error_raised_by_PARI;
static PyObject *__pyx_n_s_Euler;
static PyObject *__pyx_kp_s_Exception_class_for_critical_si;
static PyObject *__pyx_kp_s_Exception_class_for_func_alarm;
static PyObject *__pyx_n_s_F;
static PyObject *__pyx_n_s_FS;
static PyObject *__pyx_n_s_FloatingPointError;
static PyObject *__pyx_kp_s_Floating_point_exception;
static PyObject *__pyx_n_s_Fraction;
static PyObject *__pyx_n_s_G;
static PyObject *__pyx_n_s_Gen;
static PyObject *__pyx_kp_u_Gen___index___line_1551;
static PyObject *__pyx_n_s_Gen_base;
static PyObject *__pyx_kp_s_Gen_must_be_of_PARI_type_t_INT;
static PyObject *__pyx_n_s_GeneratorType;
static PyObject *__pyx_n_s_H;
static PyObject *__pyx_n_s_I;
static PyObject *__pyx_kp_s_Illegal_instruction;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_kp_u_Initialize_cysignals_This_is_no;
static PyObject *__pyx_kp_s_Interface_to_the_PARI_C_library;
static PyObject *__pyx_n_s_KeyboardInterrupt;
static PyObject *__pyx_n_s_L;
static PyObject *__pyx_n_s_L1;
static PyObject *__pyx_n_s_L2;
static PyObject *__pyx_n_s_Lcosets;
static PyObject *__pyx_n_s_Ld;
static PyObject *__pyx_n_s_Lpr;
static PyObject *__pyx_n_s_M;
static PyObject *__pyx_n_s_Mat;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_n_s_Mod;
static PyObject *__pyx_n_s_Mp;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_s_NK;
static PyObject *__pyx_kp_s_Neither_a_str_nor_a_bytes_object;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_NotImplementedError;
static PyObject *__pyx_kp_s_Not_an_INTMOD_or_POLMOD_in_mod;
static PyObject *__pyx_n_s_ORD;
static PyObject *__pyx_kp_s_Object_s_must_be_of_type_t_VECSM;
static PyObject *__pyx_kp_s_Object_s_must_be_of_type_t_VEC_o;
static PyObject *__pyx_n_s_OverflowError;
static PyObject *__pyx_n_s_P;
static PyObject *__pyx_n_s_P0;
static PyObject *__pyx_kp_s_PARI_object_in_unused_part_of_PA;
static PyObject *__pyx_kp_u_PARI_object_of_type;
static PyObject *__pyx_kp_s_PARI_object_of_type_r_cannot_be;
static PyObject *__pyx_kp_s_PARI_objects_cannot_be_instantia;
static PyObject *__pyx_kp_s_PARI_stack_size_set_to_bytes_max;
static PyObject *__pyx_n_s_PHI;
static PyObject *__pyx_n_s_PQ;
static PyObject *__pyx_n_s_Pari;
static PyObject *__pyx_n_s_PariError;
static PyObject *__pyx_n_s_PariError___repr;
static PyObject *__pyx_n_s_PariError___str;
static PyObject *__pyx_kp_s_PariError_d;
static PyObject *__pyx_n_s_PariError_errdata;
static PyObject *__pyx_n_s_PariError_errnum;
static PyObject *__pyx_n_s_PariError_errtext;
static PyObject *__pyx_kp_u_Pari__real_coerced_to_bits_prec;
static PyObject *__pyx_n_s_Pari_auto;
static PyObject *__pyx_kp_u_Pari_set_default_bit_precision_l;
static PyObject *__pyx_n_s_Pi;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_kp_u_Python_version_of_func_sig_rais;
static PyObject *__pyx_n_s_Q;
static PyObject *__pyx_n_s_RingElement;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_S;
static PyObject *__pyx_n_s_SIGINT;
static PyObject *__pyx_n_s_SIGSEGV;
static PyObject *__pyx_kp_s_Segmentation_fault;
static PyObject *__pyx_kp_u_Set_the_default_bit_precision_f;
static PyObject *__pyx_n_s_SignalError;
static PyObject *__pyx_n_s_SystemError;
static PyObject *__pyx_n_s_SystemExit;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_kp_u_Test_whether_critical_signals_c;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Unknown_PARI_type_s;
static PyObject *__pyx_n_s_V;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_Vec;
static PyObject *__pyx_n_s_Vecrev;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_n_s_XRangeType;
static PyObject *__pyx_n_s_Y;
static PyObject *__pyx_kp_s_You_can_use_pari_allocatemem_to;
static PyObject *__pyx_kp_s__46;
static PyObject *__pyx_kp_s__47;
static PyObject *__pyx_kp_s__83;
static PyObject *__pyx_kp_s__90;
static PyObject *__pyx_kp_s__91;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_ab;
static PyObject *__pyx_n_s_abs;
static PyObject *__pyx_n_s_add_one;
static PyObject *__pyx_n_s_al;
static PyObject *__pyx_n_s_al1;
static PyObject *__pyx_n_s_al2;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_arch;
static PyObject *__pyx_n_s_arg2;
static PyObject *__pyx_n_s_arg3;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_kp_s_argument_2_of_the_PARI_GP_functi;
static PyObject *__pyx_kp_s_argument_2_of_the_PARI_GP_functi_2;
static PyObject *__pyx_kp_s_argument_3_of_the_PARI_GP_functi;
static PyObject *__pyx_kp_s_argument_3_of_the_PARI_GP_functi_2;
static PyObject *__pyx_n_s_ascii;
static PyObject *__pyx_n_s_asymp;
static PyObject *__pyx_kp_s_attempt_to_assign_sequence_of_si;
static PyObject *__pyx_n_s_aut;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_bid;
static PyObject *__pyx_n_s_bij;
static PyObject *__pyx_n_s_bitprec;
static PyObject *__pyx_n_s_bits;
static PyObject *__pyx_n_s_bnf;
static PyObject *__pyx_n_s_bnfK;
static PyObject *__pyx_n_s_bnfL;
static PyObject *__pyx_n_s_bnr;
static PyObject *__pyx_n_s_bound;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_s_c1;
static PyObject *__pyx_kp_s_calling_list_on_scalar_PARI_type;
static PyObject *__pyx_kp_s_cannot_coerce_0_r_type_1_to_inte;
static PyObject *__pyx_kp_s_cannot_double_stack_size;
static PyObject *__pyx_kp_s_cannot_evaluate_PARI_s_using_unn;
static PyObject *__pyx_kp_s_cannot_evaluate_a_PARI_closure_u;
static PyObject *__pyx_kp_s_cannot_index_PARI_type_s_by_tupl;
static PyObject *__pyx_n_s_catch_warnings;
static PyObject *__pyx_n_s_centerlift;
static PyObject *__pyx_n_s_cert;
static PyObject *__pyx_n_s_chain;
static PyObject *__pyx_n_s_chi;
static PyObject *__pyx_n_s_chr;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_cmpf;
static PyObject *__pyx_n_s_code;
static PyObject *__pyx_kp_s_column_index_out_of_range;
static PyObject *__pyx_kp_s_column_j_s_must_be_between_0_and;
static PyObject *__pyx_n_s_component;
static PyObject *__pyx_kp_u_conversion_not_implemented_for;
static PyObject *__pyx_n_s_cpu_width;
static PyObject *__pyx_n_s_cusp;
static PyObject *__pyx_n_s_cyc;
static PyObject *__pyx_n_s_cypari__pari;
static PyObject *__pyx_kp_s_cypari_handle_error_pyx;
static PyObject *__pyx_kp_s_cypari_pari_instance_pyx;
static PyObject *__pyx_kp_s_cypari_signals_pyx;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_n_s_den;
static PyObject *__pyx_n_s_denominator;
static PyObject *__pyx_n_s_depth;
static PyObject *__pyx_n_s_der;
static PyObject *__pyx_n_s_derivs;
static PyObject *__pyx_n_s_destw;
static PyObject *__pyx_n_s_detx;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_dimlim;
static PyObject *__pyx_n_s_divz;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dx;
static PyObject *__pyx_n_s_dy;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_ellaplist;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encoding;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_enter;
static PyObject *__pyx_n_s_entries;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_eps;
static PyObject *__pyx_n_s_errdata;
static PyObject *__pyx_n_s_errnum;
static PyObject *__pyx_n_s_errtext;
static PyObject *__pyx_n_s_estimate;
static PyObject *__pyx_n_s_eta;
static PyObject *__pyx_n_s_euler;
static PyObject *__pyx_n_s_eval;
static PyObject *__pyx_kp_s_evaluating_PARI_s_takes_exactly;
static PyObject *__pyx_n_s_exc_info;
static PyObject *__pyx_n_s_exit;
static PyObject *__pyx_n_s_expr;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_fa;
static PyObject *__pyx_kp_s_failed_to_allocate_s_bytes;
static PyObject *__pyx_kp_s_failed_to_allocate_s_s_bytes;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_n_s_filename;
static PyObject *__pyx_n_s_filled;
static PyObject *__pyx_n_s_find_root;
static PyObject *__pyx_n_s_fl;
static PyObject *__pyx_n_s_flag;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_flreal;
static PyObject *__pyx_n_s_flush;
static PyObject *__pyx_n_s_fmt;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fractions;
static PyObject *__pyx_n_s_frame;
static PyObject *__pyx_n_s_fs;
static PyObject *__pyx_n_s_g;
static PyObject *__pyx_n_s_ga;
static PyObject *__pyx_n_s_gal;
static PyObject *__pyx_n_s_genexpr;
static PyObject *__pyx_n_s_get_real_precision;
static PyObject *__pyx_n_s_getfilesystemencoding;
static PyObject *__pyx_n_s_getitem___locals_genexpr;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_gpname;
static PyObject *__pyx_n_s_grp;
static PyObject *__pyx_n_s_gs;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_ignore;
static PyObject *__pyx_n_s_im;
static PyObject *__pyx_n_s_imag;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_kp_s_index_must_be_an_integer_or_a_2;
static PyObject *__pyx_kp_s_index_out_of_range;
static PyObject *__pyx_kp_s_index_s_must_be_between_0_and_s;
static PyObject *__pyx_n_s_indices;
static PyObject *__pyx_n_s_inf;
static PyObject *__pyx_n_s_init_cysignals;
static PyObject *__pyx_kp_u_init_cysignals_line_172;
static PyObject *__pyx_n_s_init_primes;
static PyObject *__pyx_kp_u_integer_to_gen_needs_an_int_or_l;
static PyObject *__pyx_n_s_inv;
static PyObject *__pyx_kp_u_is_deprecated;
static PyObject *__pyx_kp_u_is_not_iterable;
static PyObject *__pyx_n_s_isd;
static PyObject *__pyx_n_s_iter___locals_genexpr;
static PyObject *__pyx_n_s_iterable_types;
static PyObject *__pyx_kp_u_iterating_a_PARI;
static PyObject *__pyx_n_s_ix;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_lat;
static PyObject *__pyx_n_s_lat1;
static PyObject *__pyx_n_s_lat2;
static PyObject *__pyx_kp_s_len_of_entries_s_must_be_s_s_s;
static PyObject *__pyx_kp_s_length_of_entries_s_must_equal_n;
static PyObject *__pyx_n_s_lib;
static PyObject *__pyx_n_s_lift_centered;
static PyObject *__pyx_n_s_lim;
static PyObject *__pyx_n_s_limit;
static PyObject *__pyx_n_s_list;
static PyObject *__pyx_n_s_listx;
static PyObject *__pyx_n_s_listy;
static PyObject *__pyx_n_s_lngamma;
static PyObject *__pyx_n_s_log_10;
static PyObject *__pyx_n_s_log_gamma;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_major;
static PyObject *__pyx_n_s_maps;
static PyObject *__pyx_n_s_mat;
static PyObject *__pyx_kp_s_matrix_index_must_be_of_the_form;
static PyObject *__pyx_n_s_maxord;
static PyObject *__pyx_n_s_maxprime;
static PyObject *__pyx_n_s_maxsize;
static PyObject *__pyx_n_s_maxw;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_mf;
static PyObject *__pyx_n_s_mfatk;
static PyObject *__pyx_kp_s_missing_required_argument_N;
static PyObject *__pyx_kp_s_missing_required_argument_bid;
static PyObject *__pyx_kp_s_missing_required_argument_x;
static PyObject *__pyx_kp_s_mixing_unnamed_and_keyword_argum;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_msg;
static PyObject *__pyx_n_s_mt;
static PyObject *__pyx_n_s_mu;
static PyObject *__pyx_n_s_multiplicative_order;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_n0;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_ncols;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_nf;
static PyObject *__pyx_n_s_nmax;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_nrows;
static PyObject *__pyx_n_s_nu;
static PyObject *__pyx_n_s_numerator;
static PyObject *__pyx_n_s_o;
static PyObject *__pyx_n_s_objtogen;
static PyObject *__pyx_n_s_old;
static PyObject *__pyx_n_s_only_image;
static PyObject *__pyx_n_s_order;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_pari;
static PyObject *__pyx_n_s_pari_2;
static PyObject *__pyx_kp_s_pari_double_to_gen_x_is_deprecat;
static PyObject *__pyx_n_s_pari_instance;
static PyObject *__pyx_n_s_path;
static PyObject *__pyx_n_s_perm;
static PyObject *__pyx_n_s_phi;
static PyObject *__pyx_n_s_pi;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_pl;
static PyObject *__pyx_n_s_pol;
static PyObject *__pyx_n_s_polcoeff;
static PyObject *__pyx_n_s_polred;
static PyObject *__pyx_n_s_polrel;
static PyObject *__pyx_n_s_pr;
static PyObject *__pyx_n_s_prec_bits_to_dec;
static PyObject *__pyx_n_s_prec_dec_to_bits;
static PyObject *__pyx_n_s_prec_dec_to_words;
static PyObject *__pyx_n_s_prec_in_bits;
static PyObject *__pyx_n_s_prec_in_dec;
static PyObject *__pyx_n_s_prec_in_words;
static PyObject *__pyx_n_s_prec_words_to_dec;
static PyObject *__pyx_n_s_precision;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_print_exception;
static PyObject *__pyx_n_s_projH;
static PyObject *__pyx_n_s_proof;
static PyObject *__pyx_n_s_psi;
static PyObject *__pyx_n_s_python_check_interrupt;
static PyObject *__pyx_n_s_python_ints;
static PyObject *__pyx_n_s_python_list;
static PyObject *__pyx_n_s_python_list_small;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_capi;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Pari_auto;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_q;
static PyObject *__pyx_n_s_qfa;
static PyObject *__pyx_n_s_qflllgram;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_re;
static PyObject *__pyx_n_s_real;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_repr;
static PyObject *__pyx_n_s_rho;
static PyObject *__pyx_n_s_rnf;
static PyObject *__pyx_n_s_rootT;
static PyObject *__pyx_kp_s_row_i_s_must_be_between_0_and_s;
static PyObject *__pyx_kp_s_row_index_out_of_range;
static PyObject *__pyx_n_s_rstrip;
static PyObject *__pyx_n_s_s;
static PyObject *__pyx_kp_s_s_is_not_a_square_modulo_s;
static PyObject *__pyx_n_s_sd;
static PyObject *__pyx_n_s_sdom;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_kp_s_self_g_cannot_be_converted_to_a;
static PyObject *__pyx_kp_s_self_must_be_of_pari_type_t_MAT;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_serprec;
static PyObject *__pyx_n_s_set_real_precision;
static PyObject *__pyx_n_s_set_real_precision_bits;
static PyObject *__pyx_kp_s_set_variable_only_works_for_poly;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_sfu;
static PyObject *__pyx_n_s_sig;
static PyObject *__pyx_n_s_sig_on_reset;
static PyObject *__pyx_n_s_sig_print_exception;
static PyObject *__pyx_kp_u_sig_print_exception_line_117;
static PyObject *__pyx_n_s_sign;
static PyObject *__pyx_n_s_signal;
static PyObject *__pyx_n_s_silent;
static PyObject *__pyx_n_s_simplefilter;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_sizemax;
static PyObject *__pyx_n_s_sol;
static PyObject *__pyx_n_s_sourcew;
static PyObject *__pyx_n_s_space;
static PyObject *__pyx_n_s_ss;
static PyObject *__pyx_n_s_stacksize;
static PyObject *__pyx_n_s_stacksizemax;
static PyObject *__pyx_n_s_stdout;
static PyObject *__pyx_n_s_str;
static PyObject *__pyx_n_s_str_2;
static PyObject *__pyx_kp_u_str_returned;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_subgp;
static PyObject *__pyx_n_s_subgroup;
static PyObject *__pyx_n_s_subgrp;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_sym;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_t_CLOSURE;
static PyObject *__pyx_n_s_t_COL;
static PyObject *__pyx_n_s_t_COMPLEX;
static PyObject *__pyx_n_s_t_FFELT;
static PyObject *__pyx_n_s_t_FRAC;
static PyObject *__pyx_n_s_t_INFINITY;
static PyObject *__pyx_n_s_t_INT;
static PyObject *__pyx_n_s_t_INTMOD;
static PyObject *__pyx_n_s_t_LIST;
static PyObject *__pyx_n_s_t_MAT;
static PyObject *__pyx_n_s_t_PADIC;
static PyObject *__pyx_n_s_t_POL;
static PyObject *__pyx_n_s_t_POLMOD;
static PyObject *__pyx_n_s_t_QFI;
static PyObject *__pyx_n_s_t_QFR;
static PyObject *__pyx_n_s_t_QUAD;
static PyObject *__pyx_n_s_t_REAL;
static PyObject *__pyx_n_s_t_RFRAC;
static PyObject *__pyx_n_s_t_SER;
static PyObject *__pyx_n_s_t_STR;
static PyObject *__pyx_n_s_t_VEC;
static PyObject *__pyx_n_s_t_VECSMALL;
static PyObject *__pyx_n_s_tab;
static PyObject *__pyx_n_s_tau;
static PyObject *__pyx_n_s_tb;
static PyObject *__pyx_n_s_tdom;
static PyObject *__pyx_n_s_tech;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_test_signal;
static PyObject *__pyx_kp_u_test_signal_line_232;
static PyObject *__pyx_kp_s_the_PARI_GP_function_bernvec_is;
static PyObject *__pyx_kp_s_the_PARI_GP_function_bernvec_is_2;
static PyObject *__pyx_kp_s_the_PARI_GP_function_bezout_is_o;
static PyObject *__pyx_kp_s_the_PARI_GP_function_bezoutres_i;
static PyObject *__pyx_kp_s_the_PARI_GP_function_bnrconducto;
static PyObject *__pyx_kp_s_the_PARI_GP_function_ellbil_is_o;
static PyObject *__pyx_kp_s_the_PARI_GP_function_elllseries;
static PyObject *__pyx_kp_s_the_PARI_GP_function_ellpow_is_o;
static PyObject *__pyx_kp_s_the_PARI_GP_function_factorcanto;
static PyObject *__pyx_kp_s_the_PARI_GP_function_factorff_is;
static PyObject *__pyx_kp_s_the_PARI_GP_function_factornf_is;
static PyObject *__pyx_kp_s_the_PARI_GP_function_listkill_is;
static PyObject *__pyx_kp_s_the_PARI_GP_function_matalgtobas;
static PyObject *__pyx_kp_s_the_PARI_GP_function_matbasistoa;
static PyObject *__pyx_kp_s_the_PARI_GP_function_nfeltdivmod;
static PyObject *__pyx_kp_s_the_PARI_GP_function_nfeltmulmod;
static PyObject *__pyx_kp_s_the_PARI_GP_function_nfeltpowmod;
static PyObject *__pyx_kp_s_the_PARI_GP_function_nfeltreduce;
static PyObject *__pyx_kp_s_the_PARI_GP_function_nffactormod;
static PyObject *__pyx_kp_s_the_PARI_GP_function_nfkermodpr;
static PyObject *__pyx_kp_s_the_PARI_GP_function_nfsolvemodp;
static PyObject *__pyx_kp_s_the_PARI_GP_function_plotlinetyp;
static PyObject *__pyx_kp_s_the_PARI_GP_function_plotpointsi;
static PyObject *__pyx_kp_s_the_PARI_GP_function_plotpointty;
static PyObject *__pyx_kp_s_the_PARI_GP_function_polcoeff_is;
static PyObject *__pyx_kp_s_the_PARI_GP_function_polred_is_o;
static PyObject *__pyx_kp_s_the_PARI_GP_function_polredord_i;
static PyObject *__pyx_kp_s_the_PARI_GP_function_polrootsff;
static PyObject *__pyx_kp_s_the_PARI_GP_function_poltchebi_i;
static PyObject *__pyx_kp_s_the_PARI_GP_function_psdraw_is_o;
static PyObject *__pyx_kp_s_the_PARI_GP_function_psplothraw;
static PyObject *__pyx_kp_s_the_PARI_GP_function_qfbil_is_ob;
static PyObject *__pyx_kp_s_the_PARI_GP_function_qfnorm_is_o;
static PyObject *__pyx_kp_s_the_PARI_GP_function_rnfpolred_i;
static PyObject *__pyx_kp_s_the_PARI_GP_function_sizedigit_i;
static PyObject *__pyx_kp_s_the_PARI_stack_overflows_current;
static PyObject *__pyx_kp_s_the_flag_argument_of_the_PARI_GP;
static PyObject *__pyx_kp_s_the_maximum_size_should_be_at_le;
static PyObject *__pyx_kp_s_the_method_allocatemem_should_no;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_tnf;
static PyObject *__pyx_n_s_tors;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_n_s_typ;
static PyObject *__pyx_n_s_type;
static PyObject *__pyx_n_s_types;
static PyObject *__pyx_n_s_u;
static PyObject *__pyx_kp_s_unknown_signal_number_s;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_kp_s_utf_8;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_vF;
static PyObject *__pyx_n_s_val;
static PyObject *__pyx_n_s_var;
static PyObject *__pyx_n_s_variable;
static PyObject *__pyx_n_s_vdir;
static PyObject *__pyx_n_s_vecextract;
static PyObject *__pyx_n_s_vecn;
static PyObject *__pyx_n_s_vector;
static PyObject *__pyx_n_s_version_info;
static PyObject *__pyx_n_s_vtau;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_warn;
static PyObject *__pyx_n_s_warnings;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_x0;
static PyObject *__pyx_n_s_x1;
static PyObject *__pyx_n_s_x2;
static PyObject *__pyx_n_s_xrange;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_y1;
static PyObject *__pyx_n_s_y2;
static PyObject *__pyx_n_s_ya;
static PyObject *__pyx_n_s_z;
static PyObject *__pyx_n_s_z1;
static PyObject *__pyx_n_s_z2;
static PyObject *__pyx_n_s_znorder;
static PyObject *__pyx_pf_6cypari_5_pari_sig_print_exception(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sig, PyObject *__pyx_v_msg); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_2init_cysignals(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4sig_on_reset(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_6python_check_interrupt(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_sig, CYTHON_UNUSED PyObject *__pyx_v_frame); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8test_signal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_sig); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_10prec_bits_to_dec(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_bits); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_12prec_dec_to_bits(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_dec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_14prec_bits_to_words(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_prec_in_bits); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_16prec_words_to_bits(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_words); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_18default_bitprec(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_bitprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_20prec_dec_to_words(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_dec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_22prec_words_to_dec(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_words); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_Catalan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_2Col(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_4Colrev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_6Euler(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_8I(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_10List(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_12Map(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_14Mat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_16Mod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_18Pi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_20Pol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_22Polrev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_24Qfb(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_26Ser(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_28Set(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_30Strchr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_32Vec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_34Vecrev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_36Vecsmall(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_38abs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_40acos(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_42acosh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_44addhelp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_sym, PyObject *__pyx_v_str); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_46addprimes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_48agm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_50algadd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_52algalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_54algaut(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_56algb(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_58algbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_60algbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_62algcenter(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_64algcentralproj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_z, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_66algchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_68algcharpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_b, PyObject *__pyx_v_v, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_70algdegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_72algdep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_k, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_74algdim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_76algdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_78algdivl(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_80algdivr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_82alggroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_84alghasse(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_86alghassef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_88alghassei(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_90algindex(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_92alginit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_v, long __pyx_v_maxord); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_94alginv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_96alginvbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_98algisassociative(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mt, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_100algiscommutative(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_102algisdivision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_104algisramified(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_106algissemisimple(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_108algissimple(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, long __pyx_v_ss); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_110algissplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_112alglatelement(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat, PyObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_114alglathnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_m, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_116alglatindex(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_118alglatlefttransporter(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_120alglatmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_122alglatrighttransporter(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_124algmakeintegral(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mt, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_126algmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_128algmultable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_130algneg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_132algnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_134algpoleval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_T, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_136algpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_138algprimesubalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_140algquotient(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_I, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_142algradical(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_144algramifiedplaces(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_146algrandom(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_148algrelmultable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_150algsimpledec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_152algsplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_154algsplittingdata(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_156algsplittingfield(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_158algsqr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_160algsub(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_162algsubalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_164algtableinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mt, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_166algtensor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al1, PyObject *__pyx_v_al2, long __pyx_v_maxord); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_168algtomatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_170algtrace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_172algtype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_174apply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_176arg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_178asin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_180asinh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_182asympnum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_184atan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_186atanh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_188bernfrac(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_190bernpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_192bernreal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_194bernvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_196besselh1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_198besselh2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_200besseli(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_202besselj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_204besseljh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_206besselk(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_208besseln(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_210bestappr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_212bestapprPade(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_214bestapprnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_V, PyObject *__pyx_v_T, PyObject *__pyx_v_rootT, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_216bezout(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_218bezoutres(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_220bigomega(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_222binary(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_224binomial(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_226bitand(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_228bitneg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_230bitnegimply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_232bitor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_234bitprecision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_236bittest(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_238bitxor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_240bnfcertify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_242bnfcompress(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_244bnfdecodemodule(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_246bnfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_248bnfisintnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_250bnfisnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_252bnfisprincipal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_254bnfissunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_sfu, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_256bnfisunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_258bnflog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_l); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_260bnflogdegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_l); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_262bnflogef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_264bnfnarrow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_266bnfsignunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_268bnfsunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_S, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_270bnrL1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_H, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_272bnrchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_g, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_274bnrclassno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_276bnrclassnolist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_list); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_278bnrconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_280bnrconductorofchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_282bnrdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_284bnrdisclist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_bound, PyObject *__pyx_v_arch); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_286bnrgaloisapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_mat, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_288bnrgaloismatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_aut); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_290bnrinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_f, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_292bnrisconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_294bnrisgalois(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_gal, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_296bnrisprincipal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_298bnrrootnumber(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_chi, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_300bnrstark(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_subgroup, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_302call(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_304ceil(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_306centerlift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_308characteristic(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_310charconj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_312chardiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_314chareval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_x, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_316chargalois(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_ORD); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_318charker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_320charmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_322charorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_324charpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_v, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_326charpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_328chinese(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_330cmp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_332component(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_334concat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_336conj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_338conjvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_340content(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_342contfrac(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b, long __pyx_v_nmax); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_344contfraceval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_CF, PyObject *__pyx_v_t, long __pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_346contfracinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_348contfracpnqn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_350core(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_352coredisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_354cos(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_356cosh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_358cotan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_360cotanh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_362default(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_val); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_364denominator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_366deriv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_368diffop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_370digits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_372dilog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_374dirdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_376dirmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_378dirzetak(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_380divisors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_382divisorslenstra(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_r, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_384divrem(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_386eint1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_388ellL1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_r, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_390elladd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_392ellak(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_394ellan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_396ellanalyticrank(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_eps, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_398ellap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_400ellbil(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_402ellbsd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_404ellcard(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_406ellchangecurve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_408ellchangepoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_410ellchangepointinv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_412ellconvertname(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_414elldivpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_416elleisnum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_k, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_418elleta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_420ellformaldifferential(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_422ellformalexp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_424ellformallog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_426ellformalpoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_428ellformalw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_430ellfromeqn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_432ellfromj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_j); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_434ellgenerators(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_436ellglobalred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_438ellgroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_440ellheegner(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_442ellheight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_444ellheightmatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_446ellidentify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_448ellinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_450ellisogeny(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_G, long __pyx_v_only_image, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_452ellisogenyapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_454ellisomat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_p, long __pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_456ellisoncurve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_458ellisotree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_460ellissupersingular(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_462ellj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_464elllocalred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_466elllog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_G, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_468elllseries(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_s, PyObject *__pyx_v_A, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_470ellminimaldisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_472ellminimaltwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_474ellmoddegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_476ellmodulareqn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_N, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_478ellmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_480ellneg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_482ellnonsingularmultiple(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_484ellorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_486ellordinate(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_488ellpadicL(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_s, long __pyx_v_r, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_490ellpadicbsd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_492ellpadicfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_p, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_494ellpadicheight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P, PyObject *__pyx_v_Q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_496ellpadicheightmatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_Q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_498ellpadiclog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_500ellpadicregulator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_S); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_502ellpadics2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_504ellperiods(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_506ellpointtoz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_508ellpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_510ellratpoints(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_h, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_512ellrootno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_514ellsea(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_tors); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_516ellsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_518ellsigma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_520ellsub(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_522elltamagawa(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_524elltaniyama(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_526elltatepairing(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_528elltors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_530elltwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_532ellweilpairing(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_534ellwp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_536ellxn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_538ellzeta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_540ellztopoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_542erfc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_544errname(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_546eta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_548eulerphi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_550exp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_552expm1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_554exponent(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_556extern(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_558externstr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_560factor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_562factorback(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_564factorcantor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_566factorff(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_568factorial(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_570factorint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_572factormod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_574factormodDDF(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_576factormodSQF(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_578factornf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_580factorpadic(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_p, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_582ffcompomap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_584ffembed(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_586ffextend(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_P, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_588fffrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_m, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_590ffgen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_592ffinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_594ffinvmap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_596fflog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_598ffmap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_m, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_600ffnbirred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, long __pyx_v_n, long __pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_602fforder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_604fibonacci(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_606fileclose(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_608fileextern(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_610fileflush(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_612fileopen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_mode); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_614fileread(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_616filereadstr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_618filewrite(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_620filewrite1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_622floor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_624fold(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_626frac(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_628fromdigits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_630galoischardet(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_632galoischarpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_634galoischartable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_636galoisconjclasses(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_638galoisexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_640galoisfixedfield(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_perm, long __pyx_v_flag, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_642galoisgetgroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_a, long __pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_644galoisgetname(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_a, long __pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_646galoisgetpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_a, long __pyx_v_b, long __pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_648galoisidentify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_650galoisinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_den); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_652galoisisabelian(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_654galoisisnormal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_subgrp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_656galoispermtopol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_perm); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_658galoissubcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_H, long __pyx_v_fl, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_660galoissubfields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, long __pyx_v_flag, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_662galoissubgroups(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_664gamma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_666gammah(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_668gammamellininv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_670gammamellininvasymp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, long __pyx_v_serprec, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_672gammamellininvinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_674gcd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_676gcdext(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_678genus2red(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_PQ, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_680getabstime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_682getcache(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_684getenv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_686getheap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_688getrand(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_690getstack(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_692gettime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_694getwalltime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_696hammingweight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_698hilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_700hyperellcharpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_702hyperellpadicfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, unsigned long __pyx_v_p, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_704hyperellratpoints(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_h, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_706hyperu(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_708idealadd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_710idealaddtoone(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_712idealappr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_714idealchinese(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_716idealcoprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_718idealdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_720idealfactor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_722idealfactorback(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_724idealfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_726idealhnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_u, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_728idealintersect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_730idealinv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_732ideallist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, long __pyx_v_bound, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_734ideallistarch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_list, PyObject *__pyx_v_arch); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_736ideallog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_bid); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_738idealmin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_ix, PyObject *__pyx_v_vdir); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_740idealmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_742idealnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_744idealnumden(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_746idealpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_748idealprimedec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_p, long __pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_750idealprincipalunits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr, long __pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_752idealramgroups(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_754idealred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_I, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_756idealredmodpower(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, unsigned long __pyx_v_n, unsigned long __pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_758idealstar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_N, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_760idealtwoelt(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_762idealval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_764imag(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_766incgam(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_x, PyObject *__pyx_v_g, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_768incgamc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_770input(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_772install(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_code, PyObject *__pyx_v_gpname, PyObject *__pyx_v_lib); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_774intformal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_776intnumgaussinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_778intnuminit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_780isfundamental(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_782ispowerful(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_784isprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_786ispseudoprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_788issquarefree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_790kill(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_sym); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_792kronecker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_794lambertw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_y, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_796laurentseries(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, long __pyx_v_serprec, PyObject *__pyx_v_M, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_798lcm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_800length(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_802lex(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_804lfun(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_806lfunabelianrelinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnfL, PyObject *__pyx_v_bnfK, PyObject *__pyx_v_polrel, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_808lfunan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_810lfunartin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_rho, long __pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_812lfuncheckfeq(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_814lfunconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_ab, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_816lfuncost(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_818lfuncreate(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_820lfundiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_822lfunetaquo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_824lfungenus2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_826lfunhardy(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_828lfuninit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_830lfunlambda(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_832lfunmf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_834lfunmfspec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_836lfunmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_838lfunorderzero(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_840lfunqf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_842lfunrootres(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_data, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_844lfunsympow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, unsigned long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_846lfuntheta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_848lfunthetacost(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_850lfunthetainit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_852lfuntwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_854lfunzeros(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_lim, long __pyx_v_divz, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_856lift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_858liftall(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_860liftint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_862liftpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_864limitnum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_866lindep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_868listinsert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_870listkill(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_872listpop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_list, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_874listput(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_list, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_876listsort(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_878lngamma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_880localbitprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_882localprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_884log(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_886log1p(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_888mapdelete(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_890mapget(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_892mapput(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_894matadjoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_896matalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_898matbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_900matcompanion(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_902matconcat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_904matdet(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_906matdetint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_908matdetmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_910matdiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_912mateigen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_914matfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_916mathess(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_918mathilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_920mathnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_922mathnfmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_924mathnfmodid(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_926mathouseholder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_928matid(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_930matimage(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_932matimagecompl(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_934matindexrank(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_936matintersect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_938matinverseimage(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_940matinvmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_942matisdiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_944matker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_946matkerint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_948matmuldiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_950matmultodiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_952matpascal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_954matpermanent(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_956matqr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_958matrank(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_960matrixqz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_962matsize(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_964matsnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_966matsolve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_968matsolvemod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_D, PyObject *__pyx_v_B, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_970matsupplement(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_972mattranspose(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_974max(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_976mfDelta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_978mfEH(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_980mfEk(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_982mfTheta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_psi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_984mfatkin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mfatk, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_986mfatkineigenvalues(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_988mfatkininit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_990mfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_992mfbd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_994mfbracket(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_996mfcoef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_998mfcoefs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n, long __pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1000mfconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1002mfcosets(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1004mfcuspisregular(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_cusp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1006mfcusps(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1008mfcuspval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_cusp, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1010mfcuspwidth(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_cusp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1012mfderiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1014mfderivE2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1016mfdim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1018mfdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1020mfeigenbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1022mfeigensearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_AP); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1024mfeisenstein(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k, PyObject *__pyx_v_CHI1, PyObject *__pyx_v_CHI2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1026mfembed(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_v, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1028mfeval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_vtau, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1030mffields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1032mffromell(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1034mffrometaquo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_eta, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1036mffromlfun(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1038mffromqf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1040mfgaloistype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1042mfhecke(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1044mfheckemat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_vecn); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1046mfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1048mfisCM(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1050mfisequal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1052mfkohnenbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1054mfkohnenbijection(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1056mfkohneneigenbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_bij); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1058mflinear(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_vF, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1060mfmanin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_FS, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1062mfmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1064mfnumcusps(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1066mfparams(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1068mfperiodpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1070mfperiodpolbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1072mfpetersson(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fs, PyObject *__pyx_v_gs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1074mfpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1076mfsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_V, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1078mfshift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1080mfshimura(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1082mfspace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1084mfsplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, long __pyx_v_dimlim, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1086mfsturm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1088mfsymbol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1090mfsymboleval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fs, PyObject *__pyx_v_path, PyObject *__pyx_v_ga, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1092mftaylor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n, long __pyx_v_flreal, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1094mftobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1096mftocoset(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_N, PyObject *__pyx_v_M, PyObject *__pyx_v_Lcosets); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1098mftonew(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1100mftraceform(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1102mftwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1104min(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1106minpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1108modreverse(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1110moebius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1112msatkinlehner(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_Q, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1114mscuspidal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1116msdim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1118mseisenstein(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1120mseval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_s, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1122msfromcusp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1124msfromell(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_sign); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1126msfromhecke(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_v, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1128msgetlevel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1130msgetsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1132msgetweight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1134mshecke(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_p, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1136msinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_V, long __pyx_v_sign); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1138msissymbol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1140mslattice(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1142msnew(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1144msomseval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Mp, PyObject *__pyx_v_PHI, PyObject *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1146mspadicL(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mu, PyObject *__pyx_v_s, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1148mspadicinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_p, long __pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1150mspadicmoments(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Mp, PyObject *__pyx_v_PHI, long __pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1152mspadicseries(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mu, long __pyx_v_i); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1154mspathgens(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1156mspathlog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1158mspetersson(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_F, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1160mspolygon(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1162msqexpansion(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_projH, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1164mssplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_H, long __pyx_v_dimlim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1166msstar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1168mstooms(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Mp, PyObject *__pyx_v_phi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1170newtonpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1172nextprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1174nfalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1176nfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1178nfbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1180nfcertify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1182nfcompositum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1184nfdetint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1186nfdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1188nfeltadd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1190nfeltdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1192nfeltdiveuc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1194nfeltdivmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1196nfeltdivrem(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1198nfeltembed(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1200nfeltmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1202nfeltmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1204nfeltmulmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1206nfeltnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1208nfeltpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1210nfeltpowmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1212nfeltreduce(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_id); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1214nfeltreducemodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1216nfeltsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1218nfelttrace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1220nffactor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1222nffactorback(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1224nffactormod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_Q, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1226nfgaloisapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_aut, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1228nfgaloisconj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, long __pyx_v_flag, PyObject *__pyx_v_d, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1230nfgrunwaldwang(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_Lpr, PyObject *__pyx_v_Ld, PyObject *__pyx_v_pl, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1232nfhilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1234nfhnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1236nfhnfmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_detx); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1238nfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1240nfisideal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1242nfisincl(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1244nfisisom(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1246nfislocalpower(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr, PyObject *__pyx_v_a, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1248nfkermodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1250nfmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1252nfmodprinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1254nfmodprlift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1256nfnewprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1258nfpolsturm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1260nfroots(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1262nfrootsof1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1264nfsnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1266nfsolvemodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1268nfsplitting(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1270nfsubfields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, long __pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1272norm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1274norml2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1276normlp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1278numbpart(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1280numdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1282numerator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1284numtoperm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1286omega(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1288oo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1290padicappr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1292padicfields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_N, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1294padicprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1296parapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1298pareval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1300parselect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1302partitions(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k, PyObject *__pyx_v_a, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1304permorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1306permsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1308permtonum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1310plotbox(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x2, PyObject *__pyx_v_y2, long __pyx_v_filled); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1312plotclip(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1314plotcolor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1316plotcopy(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_sourcew, long __pyx_v_destw, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1318plotcursor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1320plotdraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1322plotexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_list, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1324plothraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1326plothrawexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1328plothsizes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1330plotinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1332plotkill(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1334plotlines(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1336plotlinetype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, long __pyx_v_type); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1338plotmove(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1340plotpoints(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1342plotpointsize(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1344plotpointtype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, long __pyx_v_type); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1346plotrbox(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy, long __pyx_v_filled); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1348plotrecthraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_data, long __pyx_v_flags); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1350plotrline(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1352plotrmove(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1354plotrpoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1356plotscale(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x1, PyObject *__pyx_v_x2, PyObject *__pyx_v_y1, PyObject *__pyx_v_y2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1358plotstring(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x, long __pyx_v_flags); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1360polchebyshev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_flag, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1362polclass(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_inv, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1364polcoef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1366polcoeff(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1368polcompositum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1370polcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1372polcyclofactors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1374poldegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1376poldisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1378poldiscfactors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1380poldiscreduced(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1382polgalois(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1384polgraeffe(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1386polhensellift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_p, long __pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1388polhermite(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1390poliscyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1392poliscycloprod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1394polisirreducible(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1396pollead(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1398pollegendre(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1400polmodular(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_L, long __pyx_v_inv, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_derivs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1402polrecip(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1404polred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag, PyObject *__pyx_v__arg3); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1406polredabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1408polredbest(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1410polredord(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1412polresultant(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1414polresultantext(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1416polroots(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1418polrootsbound(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_tau); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1420polrootsff(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1422polrootsmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1424polrootspadic(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1426polrootsreal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_ab, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1428polsturm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_ab, PyObject *__pyx_v__arg3); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1430polsubcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_d, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1432polsylvestermatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1434polsym(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1436poltchebi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1438poltschirnhaus(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1440polylog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_m, PyObject *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1442polzagier(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1444powers(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_x0); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1446precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1448precprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1450prime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1452primecert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1454primecertexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cert, long __pyx_v_format); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1456primecertisvalid(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cert); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1458primepi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1460primes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1462prodeulerrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1464prodnumrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1466psdraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_list, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1468psi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1470psplothraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_listx, PyObject *__pyx_v_listy, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1472qfauto(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1474qfautoexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_qfa, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1476qfbclassno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1478qfbcompraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1480qfbhclassno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1482qfbil(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1484qfbnucomp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_L); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1486qfbnupow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_n, PyObject *__pyx_v_L); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1488qfbpowraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1490qfbprimeform(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1492qfbred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag, PyObject *__pyx_v_d, PyObject *__pyx_v_isd, PyObject *__pyx_v_sd); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1494qfbredsl2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1496qfbsolve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1498qfeval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1500qfgaussred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1502qfisom(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_H, PyObject *__pyx_v_fl, PyObject *__pyx_v_grp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1504qfisominit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_fl, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1506qfjacobi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1508qflll(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1510qflllgram(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1512qfminim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b, PyObject *__pyx_v_m, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1514qfnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1516qforbits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_V); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1518qfparam(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_sol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1520qfperfection(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1522qfrep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, PyObject *__pyx_v_B, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1524qfsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1526qfsolve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1528quadclassunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1530quaddisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1532quadgen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1534quadhilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1536quadpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1538quadray(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_f, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1540quadregulator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1542quadunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1544ramanujantau(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1546random(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1548randomprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1550read(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1552readstr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1554readvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1556real(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1558removeprimes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1560rnfalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1562rnfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1564rnfbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1566rnfcharpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_a, PyObject *__pyx_v_var); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1568rnfconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1570rnfdedekind(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_pr, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1572rnfdet(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1574rnfdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1576rnfeltabstorel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1578rnfeltdown(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1580rnfeltnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1582rnfeltreltoabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1584rnfelttrace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1586rnfeltup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1588rnfequation(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1590rnfhnfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1592rnfidealabstorel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1594rnfidealdown(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1596rnfidealfactor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1598rnfidealhnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1600rnfidealmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1602rnfidealnormabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1604rnfidealnormrel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1606rnfidealprimedec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1608rnfidealreltoabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1610rnfidealtwoelt(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1612rnfidealup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1614rnfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1616rnfisabelian(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1618rnfisfree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1620rnfislocalcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1622rnfisnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_a, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1624rnfisnorminit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_polrel, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1626rnfkummer(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_subgp, long __pyx_v_d, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1628rnflllgram(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_order, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1630rnfnormgroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_pol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1632rnfpolred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1634rnfpolredabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1636rnfpolredbest(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1638rnfpseudobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1640rnfsteinitz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1642select(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1644self(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1646seralgdep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_p, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1648serchop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1650serconvol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1652serlaplace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1654serprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1656serreverse(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1658setbinop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1660setintersect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1662setisset(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1664setminus(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1666setrand(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1668setsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_S, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1670setunion(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1672shift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1674shiftmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1676sigma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1678sign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1680simplify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1682sin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1684sinc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1686sinh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1688sizebyte(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1690sizedigit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1692sqr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1694sqrt(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1696sqrtint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1698sqrtnint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1700stirling(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_k, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1702subgrouplist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_bound, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1704subst(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1706substpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1708substvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_w); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1710sumdedekind(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_h, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1712sumdigits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1714sumeulerrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1716sumformal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1718sumnumapinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1720sumnuminit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1722sumnumlagrangeinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, PyObject *__pyx_v_c1, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1724sumnummonieninit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, PyObject *__pyx_v_w, PyObject *__pyx_v_n0, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1726sumnumrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1728system(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1730tan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1732tanh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1734taylor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_t, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1736teichmuller(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_tab); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1738theta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, PyObject *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1740thetanullk(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, long __pyx_v_k, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1742thue(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_tnf, PyObject *__pyx_v_a, PyObject *__pyx_v_sol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1744thueinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1746trace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1748type(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1750valuation(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1752varhigher(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1754variable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1756variables(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1758varlower(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1760vecextract(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1762vecprod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1764vecsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v, PyObject *__pyx_v_x, PyObject *__pyx_v_cmpf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1766vecsort(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_cmpf, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1768vecsum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1770version(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1772weber(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1774writebin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1776zeta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1778zetahurwitz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1780zetamult(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_T, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1782zetamultall(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1784zetamultconvert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, long __pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1786zetamultinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_maxw, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1788znchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1790zncharconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1792znchardecompose(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_Q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1794znchargauss(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1796zncharinduce(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1798zncharisodd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1800znchartokronecker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1802znchartoprimitive(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1804znconreychar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1806znconreyexp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1808znconreylog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1810zncoppersmith(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_N, PyObject *__pyx_v_X, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1812znlog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1814znorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1816znprimroot(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1818znstar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1820__reduce_cython__(struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1822__setstate_cython__(struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6cypari_5_pari_4Pari___cinit__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static int __pyx_pf_6cypari_5_pari_4Pari_2__init__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, size_t __pyx_v_size, size_t __pyx_v_sizemax, unsigned long __pyx_v_maxprime); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_4_close(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_6shut_up(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_8speak_up(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_11UI_callback___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static int __pyx_pf_6cypari_5_pari_4Pari_11UI_callback_2__set__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_callback); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_10debugstack(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_12__repr__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static Py_hash_t __pyx_pf_6cypari_5_pari_4Pari_14__hash__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_16set_debug_level(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_level); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_18get_debug_level(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_20set_real_precision_bits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_22get_real_precision_bits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_24set_real_precision(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_26get_real_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_28set_series_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_30get_default_bit_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_32set_default_bit_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, int __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_34get_series_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_36double_to_gen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_38_real_coerced_to_bits_prec(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, double __pyx_v_x, long __pyx_v_bits); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_40complex(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_re, PyObject *__pyx_v_im); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_42__call__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_44zero(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_46one(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_48new_with_bits_prec(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_50stacksize(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_52stacksizemax(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_54allocatemem(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, size_t __pyx_v_s, size_t __pyx_v_sizemax, PyObject *__pyx_v_silent); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_56pari_version(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_58init_primes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, unsigned long __pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_60primes(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_end); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_62polchebyshev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_64factorial(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_66polsubcyclo(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n, long __pyx_v_d, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_68setrand(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_seed); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_70vector(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_entries); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_72matrix(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_m, long __pyx_v_n, PyObject *__pyx_v_entries); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_74genus2red(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_P0); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_76List(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_9PARI_ZERO___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_8PARI_ONE___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_8PARI_TWO___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_78__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_4Pari_80__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_24integer_to_gen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_26gen_to_integer(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_28gen_to_python(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9PariError_errnum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9PariError_2errtext(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9PariError_4errdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9PariError_6__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_9PariError_8__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_30objtoclosure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_Col(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_2Colrev(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_4List(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_6Map(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_8Mat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_10Mod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_12Pol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_t, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_14Polrev(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_t, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_16Qfb(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_18Ser(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_20Set(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_22Strchr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_24Vec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_26Vecrev(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_28Vecsmall(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_30abs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_32acos(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_34acosh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_36addprimes(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_38agm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_40algadd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_42algalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_44algaut(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_46algb(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_48algbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_50algbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_52algcenter(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_54algcentralproj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_z, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_56algchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_58algcharpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_b, PyObject *__pyx_v_v, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_60algdegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_62algdep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z, long __pyx_v_k, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_64algdim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_66algdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_68algdivl(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_70algdivr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_72alggroup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_74alghasse(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_76alghassef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_78alghassei(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_80algindex(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_82alginit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_v, long __pyx_v_maxord); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_84alginv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_86alginvbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_88algisassociative(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mt, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_90algiscommutative(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_92algisdivision(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_94algisramified(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_96algissemisimple(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_98algissimple(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, long __pyx_v_ss); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_100algissplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_102alglatelement(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat, PyObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_104alglathnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_m, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_106alglatindex(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_108alglatlefttransporter(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_110alglatmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_112alglatrighttransporter(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_114algmakeintegral(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mt, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_116algmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_118algmultable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_120algneg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_122algnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_124algpoleval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_T, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_126algpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_128algprimesubalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_130algquotient(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_I, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_132algradical(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_134algramifiedplaces(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_136algrandom(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_138algrelmultable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_140algsimpledec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, long __pyx_v_maps); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_142algsplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_144algsplittingdata(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_146algsplittingfield(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_148algsqr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_150algsub(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_152algsubalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_154algtableinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mt, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_156algtensor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al1, PyObject *__pyx_v_al2, long __pyx_v_maxord); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_158algtomatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_160algtrace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_162algtype(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_164apply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_166arg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_168asin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_170asinh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_172asympnum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_174atan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_176atanh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_178besselh1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_180besselh2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_182besseli(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_184besselj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_186besseljh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_188besselk(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_190besseln(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_192bestappr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_194bestapprPade(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_196bestapprnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_V, PyObject *__pyx_v_T, PyObject *__pyx_v_rootT, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_198bezout(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_200bezoutres(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_202bigomega(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_204binary(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_206binomial(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_208bitand(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_210bitneg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_212bitnegimply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_214bitor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_216bitprecision(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_218bittest(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_220bitxor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_222bnfcertify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_224bnfcompress(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_226bnfdecodemodule(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_228bnfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_230bnfisintnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_232bnfisnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_234bnfisprincipal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_236bnfissunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_sfu, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_238bnfisunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_240bnflog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_l); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_242bnflogdegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_l); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_244bnflogef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_246bnfnarrow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_248bnfsignunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_250bnfsunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_S, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_252bnrL1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_H, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_254bnrchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_g, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_256bnrclassno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_258bnrclassnolist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_list); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_260bnrconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_262bnrconductorofchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_264bnrdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_266bnrdisclist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_bound, PyObject *__pyx_v_arch); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_268bnrgaloisapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_mat, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_270bnrgaloismatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_aut); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_272bnrinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_f, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_274bnrisconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_276bnrisgalois(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_gal, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_278bnrisprincipal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_280bnrrootnumber(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_chi, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_282bnrstark(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_subgroup, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_284call(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_286ceil(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_288centerlift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_290characteristic(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_292charconj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_294chardiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_296chareval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_x, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_298chargalois(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_ORD); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_300charker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_302charmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_304charorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_306charpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_v, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_308charpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_310chinese(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_312cmp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_314component(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_316concat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_318conj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_320conjvec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_322content(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_324contfrac(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b, long __pyx_v_nmax); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_326contfraceval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_CF, PyObject *__pyx_v_t, long __pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_328contfracinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_330contfracpnqn(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_332core(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_334coredisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_336cos(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_338cosh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_340cotan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_342cotanh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_344denominator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_346deriv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_348diffop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_350digits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_352dilog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_354dirdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_356dirmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_358dirzetak(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_360divisors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_362divisorslenstra(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, PyObject *__pyx_v_r, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_364divrem(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_366eint1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_368ellL1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_r, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_370elladd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_372ellak(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_374ellan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_376ellanalyticrank(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_eps, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_378ellap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_380ellbil(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_382ellbsd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_384ellcard(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_386ellchangecurve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_388ellchangepoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_390ellchangepointinv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_392ellconvertname(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_394elldivpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_396elleisnum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_k, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_398elleta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_400ellformaldifferential(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_402ellformalexp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_404ellformallog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_406ellformalpoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_408ellformalw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_410ellfromeqn(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_412ellfromj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_j); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_414ellgenerators(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_416ellglobalred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_418ellgroup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_420ellheegner(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_422ellheight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_424ellheightmatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_426ellidentify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_428ellinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_430ellisogeny(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_G, long __pyx_v_only_image, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_432ellisogenyapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_434ellisomat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_p, long __pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_436ellisoncurve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_438ellisotree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_440ellissupersingular(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_442ellj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_444elllocalred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_446elllog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_G, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_448elllseries(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_s, PyObject *__pyx_v_A, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_450ellminimaldisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_452ellminimaltwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_454ellmoddegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_456ellmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_458ellneg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_460ellnonsingularmultiple(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_462ellorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_464ellordinate(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_466ellpadicL(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_s, long __pyx_v_r, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_468ellpadicbsd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_470ellpadicfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_p, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_472ellpadicheight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P, PyObject *__pyx_v_Q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_474ellpadicheightmatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_Q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_476ellpadiclog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_478ellpadicregulator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_S); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_480ellpadics2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_482ellperiods(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_484ellpointtoz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_486ellpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_488ellratpoints(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_h, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_490ellrootno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_492ellsea(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_tors); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_494ellsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_496ellsigma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_498ellsub(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_500elltamagawa(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_502elltaniyama(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_504elltatepairing(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_506elltors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_508elltwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_510ellweilpairing(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_512ellwp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_514ellxn(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_516ellzeta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_518ellztopoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_520erfc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_522errname(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_524eta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_526eulerphi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_528exp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_530expm1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_532exponent(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_534factor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_536factorback(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_538factorcantor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_540factorff(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_542factorint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_544factormod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_546factormodDDF(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_548factormodSQF(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_550factornf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_t); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_552factorpadic(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_p, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_554ffcompomap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_556ffembed(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_558ffextend(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_P, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_560fffrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_m, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_562ffgen(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_k, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_564ffinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_566ffinvmap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_568fflog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_570ffmap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_m, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_572ffnbirred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, long __pyx_v_n, long __pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_574fforder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_576fileflush(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_578floor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_580fold(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_582frac(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_584fromdigits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_586galoischardet(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_588galoischarpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_590galoischartable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_592galoisconjclasses(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_594galoisexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_596galoisfixedfield(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_perm, long __pyx_v_flag, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_598galoisidentify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_600galoisinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_den); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_602galoisisabelian(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_604galoisisnormal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_subgrp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_606galoispermtopol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_perm); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_608galoissubcyclo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, PyObject *__pyx_v_H, long __pyx_v_fl, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_610galoissubfields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, long __pyx_v_flag, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_612galoissubgroups(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_614gamma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_616gammah(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_618gammamellininv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_620gammamellininvasymp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, long __pyx_v_serprec, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_622gammamellininvinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_624gcd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_626gcdext(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_628genus2red(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_PQ, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_630hammingweight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_632hilbert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_634hyperellcharpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_636hyperellpadicfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, unsigned long __pyx_v_p, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_638hyperellratpoints(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X, PyObject *__pyx_v_h, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_640hyperu(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_642idealadd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_644idealaddtoone(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_646idealappr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_648idealchinese(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_650idealcoprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_652idealdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_654idealfactor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_656idealfactorback(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_658idealfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_660idealhnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_u, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_662idealintersect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_664idealinv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_666ideallist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, long __pyx_v_bound, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_668ideallistarch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_list, PyObject *__pyx_v_arch); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_670ideallog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_bid); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_672idealmin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_ix, PyObject *__pyx_v_vdir); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_674idealmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_676idealnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_678idealnumden(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_680idealpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_682idealprimedec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_p, long __pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_684idealprincipalunits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr, long __pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_686idealramgroups(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_688idealred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_I, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_690idealredmodpower(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, unsigned long __pyx_v_n, unsigned long __pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_692idealstar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_N, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_694idealtwoelt(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_696idealval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_698imag(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_700incgam(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_x, PyObject *__pyx_v_g, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_702incgamc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_704intformal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_706intnuminit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_708isfundamental(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_710ispowerful(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_712isprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_714ispseudoprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_716issquarefree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_718kronecker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_720lambertw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_y, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_722laurentseries(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, long __pyx_v_serprec, PyObject *__pyx_v_M, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_724lcm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_726length(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_728lex(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_730lfun(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_732lfunabelianrelinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnfL, PyObject *__pyx_v_bnfK, PyObject *__pyx_v_polrel, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_734lfunan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_736lfunartin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_rho, long __pyx_v_n, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_738lfuncheckfeq(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_740lfunconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_ab, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_742lfuncost(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_744lfuncreate(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_746lfundiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_748lfunetaquo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_750lfungenus2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_752lfunhardy(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_754lfuninit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_756lfunlambda(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_758lfunmf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_760lfunmfspec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_762lfunmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_764lfunorderzero(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_766lfunqf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_768lfunrootres(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_data, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_770lfunsympow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, unsigned long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_772lfuntheta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_data, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_774lfunthetacost(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_776lfunthetainit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_778lfuntwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_780lfunzeros(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_lim, long __pyx_v_divz, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_782lift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_784liftall(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_786liftint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_788liftpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_790limitnum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_792lindep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_794listinsert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_796listkill(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_798listpop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_list, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_800listput(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_list, PyObject *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_802listsort(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_804lngamma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_806log(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_808log1p(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_810mapdelete(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_812mapget(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_814mapput(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_816matadjoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_818matalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_820matbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_822matcompanion(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_824matconcat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_826matdet(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_828matdetint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_830matdetmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_832matdiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_834mateigen(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_836matfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_838mathess(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_840mathnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_842mathnfmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_844mathnfmodid(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_846mathouseholder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_848matimage(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_850matimagecompl(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_852matindexrank(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_854matintersect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_856matinverseimage(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_858matinvmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_860matisdiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_862matker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_864matkerint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_866matmuldiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_868matmultodiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_870matpermanent(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_872matqr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_874matrank(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_876matrixqz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_878matsize(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_880matsnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_882matsolve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_884matsolvemod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_D, PyObject *__pyx_v_B, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_886matsupplement(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_888mattranspose(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_890max(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_892mfEH(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_894mfTheta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_psi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_896mfatkin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mfatk, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_898mfatkineigenvalues(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_900mfatkininit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_902mfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_904mfbd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_906mfbracket(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_908mfcoef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_910mfcoefs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n, long __pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_912mfconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_914mfcosets(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_916mfcuspisregular(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_cusp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_918mfcusps(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_920mfcuspval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_cusp, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_922mfcuspwidth(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, PyObject *__pyx_v_cusp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_924mfderiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_926mfderivE2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_928mfdim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_930mfdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_932mfeigenbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_934mfeigensearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_AP); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_936mfembed(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_v, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_938mfeval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_vtau, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_940mffields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_942mffromell(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_944mffrometaquo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_eta, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_946mffromlfun(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_948mffromqf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_950mfgaloistype(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_952mfhecke(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_954mfheckemat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_vecn); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_956mfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_958mfisCM(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_960mfisequal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_lim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_962mfkohnenbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_964mfkohnenbijection(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_966mfkohneneigenbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_bij); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_968mflinear(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_vF, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_970mfmanin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_FS, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_972mfmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_974mfnumcusps(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_976mfparams(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_978mfperiodpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_980mfpetersson(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fs, PyObject *__pyx_v_gs); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_982mfpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_984mfsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_V, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_986mfshift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_988mfshimura(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_990mfspace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_992mfsplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, long __pyx_v_dimlim, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_994mfsturm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_996mfsymbol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_998mfsymboleval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fs, PyObject *__pyx_v_path, PyObject *__pyx_v_ga, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1000mftaylor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n, long __pyx_v_flreal, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1002mftobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1004mftonew(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1006mftraceform(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1008mftwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1010min(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1012minpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1014modreverse(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1016moebius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1018msatkinlehner(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_Q, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1020mscuspidal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1022msdim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1024mseisenstein(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1026mseval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_s, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1028msfromcusp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_c); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1030msfromell(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_sign); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1032msfromhecke(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_v, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1034msgetlevel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1036msgetsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1038msgetweight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1040mshecke(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_p, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1042msinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_V, long __pyx_v_sign); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1044msissymbol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1046mslattice(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1048msnew(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1050msomseval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Mp, PyObject *__pyx_v_PHI, PyObject *__pyx_v_path); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1052mspadicL(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mu, PyObject *__pyx_v_s, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1054mspadicinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_p, long __pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1056mspadicmoments(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Mp, PyObject *__pyx_v_PHI, long __pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1058mspadicseries(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mu, long __pyx_v_i); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1060mspathgens(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1062mspathlog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1064mspetersson(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_F, PyObject *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1066mspolygon(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1068msqexpansion(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_projH, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1070mssplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_H, long __pyx_v_dimlim); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1072msstar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_H); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1074mstooms(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Mp, PyObject *__pyx_v_phi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1076newtonpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1078nextprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1080nfalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1082nfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1084nfbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1086nfcertify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1088nfcompositum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1090nfdetint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1092nfdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1094nfeltadd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1096nfeltdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1098nfeltdiveuc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1100nfeltdivmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1102nfeltdivrem(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1104nfeltembed(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1106nfeltmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1108nfeltmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1110nfeltmulmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1112nfeltnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1114nfeltpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1116nfeltpowmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1118nfeltreduce(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_id); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1120nfeltreducemodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1122nfeltsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1124nfelttrace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1126nffactor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1128nffactorback(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1130nffactormod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_Q, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1132nfgaloisapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_aut, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1134nfgaloisconj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, long __pyx_v_flag, PyObject *__pyx_v_d, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1136nfgrunwaldwang(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_Lpr, PyObject *__pyx_v_Ld, PyObject *__pyx_v_pl, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1138nfhilbert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1140nfhnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1142nfhnfmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_detx); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1144nfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1146nfisideal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1148nfisincl(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1150nfisisom(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1152nfislocalpower(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr, PyObject *__pyx_v_a, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1154nfkermodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1156nfmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1158nfmodprinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1160nfmodprlift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1162nfnewprec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1164nfpolsturm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_pl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1166nfroots(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1168nfrootsof1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1170nfsnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1172nfsolvemodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_P); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1174nfsplitting(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1176nfsubfields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, long __pyx_v_d); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1178norm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1180norml2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1182normlp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1184numbpart(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1186numdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1188numerator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1190omega(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1192padicappr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1194padicfields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_p, PyObject *__pyx_v_N, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1196padicprec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1198parapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1200pareval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1202parselect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1204permorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1206permsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1208permtonum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1210plotdraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1212plotexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fmt, PyObject *__pyx_v_list, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1214plothraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1216plothrawexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fmt, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1218polclass(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_inv, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1220polcoef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1222polcoeff(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1224polcompositum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1226polcyclofactors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1228poldegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1230poldisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1232poldiscfactors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1234poldiscreduced(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1236polgalois(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1238polgraeffe(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1240polhensellift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_p, long __pyx_v_e); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1242poliscyclo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1244poliscycloprod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1246polisirreducible(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1248pollead(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1250polrecip(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1252polred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag, PyObject *__pyx_v__arg2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1254polredabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1256polredbest(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1258polredord(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1260polresultant(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1262polresultantext(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1264polroots(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1266polrootsbound(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_tau); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1268polrootsff(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1270polrootsmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1272polrootspadic(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1274polrootsreal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_ab, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1276polsturm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_ab, PyObject *__pyx_v__arg2); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1278polsylvestermatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1280polsym(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1282poltschirnhaus(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1284powers(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_x0); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1286precision(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1288precprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1290primecert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1292primecertexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cert, long __pyx_v_format); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1294primecertisvalid(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cert); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1296primepi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1298primes(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1300prodeulerrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1302prodnumrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1304psdraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_list, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1306psi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1308psplothraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_listx, PyObject *__pyx_v_listy, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1310qfauto(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1312qfautoexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_qfa, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1314qfbclassno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1316qfbcompraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1318qfbhclassno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1320qfbil(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1322qfbnucomp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_L); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1324qfbnupow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_n, PyObject *__pyx_v_L); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1326qfbpowraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1328qfbprimeform(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1330qfbred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag, PyObject *__pyx_v_d, PyObject *__pyx_v_isd, PyObject *__pyx_v_sd); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1332qfbredsl2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1334qfbsolve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1336qfeval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1338qfgaussred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1340qfisom(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_H, PyObject *__pyx_v_fl, PyObject *__pyx_v_grp); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1342qfisominit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_fl, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1344qfjacobi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1346qflll(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1348qflllgram(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1350qfminim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b, PyObject *__pyx_v_m, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1352qfnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1354qforbits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_V); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1356qfparam(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_sol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1358qfperfection(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1360qfrep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, PyObject *__pyx_v_B, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1362qfsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1364qfsolve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1366quadclassunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1368quaddisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1370quadgen(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1372quadhilbert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1374quadpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1376quadray(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_f, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1378quadregulator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1380quadunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1382ramanujantau(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1384random(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1386randomprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1388real(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1390removeprimes(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1392rnfalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1394rnfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1396rnfbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1398rnfcharpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_a, PyObject *__pyx_v_var); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1400rnfconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1402rnfdedekind(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_pr, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1404rnfdet(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_M); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1406rnfdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1408rnfeltabstorel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1410rnfeltdown(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1412rnfeltnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1414rnfeltreltoabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1416rnfelttrace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1418rnfeltup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1420rnfequation(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1422rnfhnfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1424rnfidealabstorel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1426rnfidealdown(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1428rnfidealfactor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1430rnfidealhnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1432rnfidealmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1434rnfidealnormabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1436rnfidealnormrel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1438rnfidealprimedec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_pr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1440rnfidealreltoabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1442rnfidealtwoelt(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1444rnfidealup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1446rnfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1448rnfisabelian(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1450rnfisfree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1452rnfislocalcyclo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1454rnfisnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_a, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1456rnfisnorminit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_polrel, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1458rnfkummer(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_subgp, long __pyx_v_d, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1460rnflllgram(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_order, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1462rnfnormgroup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_pol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1464rnfpolred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1466rnfpolredabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1468rnfpolredbest(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1470rnfpseudobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1472rnfsteinitz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1474select(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1476seralgdep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_p, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1478serchop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1480serconvol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1482serlaplace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1484serprec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1486serreverse(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1488setbinop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1490setintersect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1492setisset(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1494setminus(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1496setrand(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1498setsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_S, PyObject *__pyx_v_x, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1500setunion(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1502shift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1504shiftmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1506sigma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1508sign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1510simplify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1512sin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1514sinc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1516sinh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1518sizebyte(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1520sizedigit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1522sqr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1524sqrt(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1526sqrtint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1528sqrtnint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1530subgrouplist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_bound, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1532subst(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1534substpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1536substvec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_w); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1538sumdedekind(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_h, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1540sumdigits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1542sumeulerrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1544sumformal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1546sumnumapinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1548sumnuminit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1550sumnumlagrangeinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, PyObject *__pyx_v_c1, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1552sumnummonieninit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, PyObject *__pyx_v_w, PyObject *__pyx_v_n0, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1554sumnumrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1556tan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1558tanh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1560taylor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_t, long __pyx_v_serprec); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1562teichmuller(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_tab); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1564theta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, PyObject *__pyx_v_z, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1566thetanullk(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, long __pyx_v_k, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1568thue(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_tnf, PyObject *__pyx_v_a, PyObject *__pyx_v_sol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1570thueinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1572trace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1574type(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1576valuation(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1578variable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1580variables(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1582vecextract(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1584vecprod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1586vecsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v, PyObject *__pyx_v_x, PyObject *__pyx_v_cmpf); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1588vecsort(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_cmpf, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1590vecsum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1592weber(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1594zeta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1596zetahurwitz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_der, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1598zetamult(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_T, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1600zetamultconvert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, long __pyx_v_fl); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1602znchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1604zncharconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1606znchardecompose(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_Q); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1608znchargauss(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_a, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1610zncharinduce(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_N); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1612zncharisodd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1614znchartokronecker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1616znchartoprimitive(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1618znconreychar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1620znconreyexp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1622znconreylog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1624zncoppersmith(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, PyObject *__pyx_v_N, PyObject *__pyx_v_X, PyObject *__pyx_v_B); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1626znlog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1628znorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_o); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1630znprimroot(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1632znstar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1634__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1636__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_6cypari_5_pari_3Gen___init__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static void __pyx_pf_6cypari_5_pari_3Gen_2__dealloc__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_4__repr__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_6__str__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static Py_hash_t __pyx_pf_6cypari_5_pari_3Gen_8__hash__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_8__iter___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_8__iter___3genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_10__iter__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_12list(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_14__reduce__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_16__add__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_18__sub__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_20__mul__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_22__div__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
#endif
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_24__truediv__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_26_add_one(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_28__mod__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_30__pow__(PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_m); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_32__neg__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_34__rshift__(PyObject *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_36__lshift__(PyObject *__pyx_v_self, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_38__invert__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_40getattr(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_42mod(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_44polred(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwds); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_46nf_get_pol(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_48nf_get_diff(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_50nf_get_sign(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_52nf_get_zk(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_54bnf_get_no(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_56bnf_get_cyc(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_58bnf_get_gen(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_60bnf_get_reg(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_62bnfunit(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_64pr_get_p(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_66pr_get_e(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_68pr_get_f(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_70pr_get_gen(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_72bid_get_cyc(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_74bid_get_gen(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_11__getitem___genexpr(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_76__getitem__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static int __pyx_pf_6cypari_5_pari_3Gen_78__setitem__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_y); /* proto */
static Py_ssize_t __pyx_pf_6cypari_5_pari_3Gen_80__len__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_82__richcmp__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_left, PyObject *__pyx_v_right, int __pyx_v_op); /* proto */
#if PY_MAJOR_VERSION < 3
static int __pyx_pf_6cypari_5_pari_3Gen_84__cmp__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_other); /* proto */
#endif
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_86cmp_universal(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_88__copy__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_90__hex__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
#endif
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_92__int__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_94__index__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_96python_list_small(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_98python_list(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_100python(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_102__long__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
#endif
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_104__float__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_106__complex__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static int __pyx_pf_6cypari_5_pari_3Gen_108__nonzero__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_110gequal(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_a, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_112gequal0(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_114gequal_long(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_a, long __pyx_v_b); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_116isprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_118ispseudoprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_120ispower(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_122isprimepower(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_124ispseudoprimepower(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_126vecmax(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_128vecmin(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_130Col(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_132Colrev(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_134Ser(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_f, PyObject *__pyx_v_v, long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_136Str(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_138Strexpand(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_140Strtex(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_142Vec(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_144Vecrev(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_146Vecsmall(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_148bittest(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_150padicprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_152precision(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_154round(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_estimate); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_156sizeword(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_158sizebyte(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_160truncate(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_estimate); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_162_valp(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_164bernfrac(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_166bernreal(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_168besselk(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_nu, PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_flag, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_170eint1(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_172polylog(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_m, long __pyx_v_flag, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_174sqrtn(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_n, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_176ffprimroot(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_178fibonacci(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_180issquare(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_find_root); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_182issquarefree(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_184sumdiv(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_186sumdivk(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_n, long __pyx_v_k); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_188Zn_issquare(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_190Zn_sqrt(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_192ellan(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_python_ints); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_194ellaplist(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_python_ints); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_196ellisoncurve(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_198ellminimalmodel(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_200elltors(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_202omega(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_204disc(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_206j(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_208_eltabstorel(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_210_eltabstorel_lift(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_212_eltreltoabs(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_214galoissubfields(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag, PyObject *__pyx_v_v); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_216nfeltval(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_218nfbasis(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag, PyObject *__pyx_v_fa); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_220nfbasis_d(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag, PyObject *__pyx_v_fa); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_222nfbasistoalg_lift(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_nf, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_224nfgenerator(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_226_nf_rnfeq(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_relpol); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_228eval(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwds); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_230__call__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwds); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_232factorpadic(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_p, long __pyx_v_r); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_234poldegree(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_var); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_236polisirreducible(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_238polroots(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_240rnfisnorm(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_242ncols(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_244nrows(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_246mattranspose(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_248lllgram(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_250lllgramint(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_252qfrep(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_B, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_254matkerint(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_256factor(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_limit, PyObject *__pyx_v_proof); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_258__abs__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_260nextprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, int __pyx_v_add_one); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_262change_variable_name(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_var); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_264nf_subst(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_z); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_266type(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_268polinterpolate(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_ya, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_270ellwp(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_n, long __pyx_v_flag, unsigned long __pyx_v_precision); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_272debug(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_depth); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_274bernvec(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_276allocatemem(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_32objtogen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s); /* proto */
static PyObject *__pyx_pf_6cypari_5_pari_34__pyx_unpickle_Pari_auto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_6cypari_5_pari_RingElement(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari_Gen_base(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari_Gen(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari_Pari_auto(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari_Pari(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_3___getitem__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_53;
static PyObject *__pyx_int_222419149;
static PyObject *__pyx_int_4294967296;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__86;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__92;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_tuple__100;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__106;
static PyObject *__pyx_tuple__108;
static PyObject *__pyx_tuple__110;
static PyObject *__pyx_tuple__112;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__125;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__129;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_codeobj__107;
static PyObject *__pyx_codeobj__109;
static PyObject *__pyx_codeobj__111;
static PyObject *__pyx_codeobj__113;
static PyObject *__pyx_codeobj__115;
static PyObject *__pyx_codeobj__117;
static PyObject *__pyx_codeobj__119;
static PyObject *__pyx_codeobj__121;
static PyObject *__pyx_codeobj__123;
static PyObject *__pyx_codeobj__126;
static PyObject *__pyx_codeobj__128;
static PyObject *__pyx_codeobj__130;
static PyObject *__pyx_codeobj__132;
static PyObject *__pyx_codeobj__134;
static PyObject *__pyx_codeobj__136;
/* Late includes */

/* "cypari/_pari.pyx":82
 * from libc.stdio cimport *
 * 
 * cdef String(x):             # <<<<<<<<<<<<<<
 *     """
 *     Return a string from either a string or bytes object, using ascii.
 */

static PyObject *__pyx_f_6cypari_5_pari_String(PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("String", 0);

  /* "cypari/_pari.pyx":86
 *     Return a string from either a string or bytes object, using ascii.
 *     """
 *     if isinstance(x, str):             # <<<<<<<<<<<<<<
 *         return x
 *     elif isinstance(x, bytes):
 */
  __pyx_t_1 = PyString_Check(__pyx_v_x); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/_pari.pyx":87
 *     """
 *     if isinstance(x, str):
 *         return x             # <<<<<<<<<<<<<<
 *     elif isinstance(x, bytes):
 *         return x.decode('ascii')
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_x);
    __pyx_r = __pyx_v_x;
    goto __pyx_L0;

    /* "cypari/_pari.pyx":86
 *     Return a string from either a string or bytes object, using ascii.
 *     """
 *     if isinstance(x, str):             # <<<<<<<<<<<<<<
 *         return x
 *     elif isinstance(x, bytes):
 */
  }

  /* "cypari/_pari.pyx":88
 *     if isinstance(x, str):
 *         return x
 *     elif isinstance(x, bytes):             # <<<<<<<<<<<<<<
 *         return x.decode('ascii')
 *     else:
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_x); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (likely(__pyx_t_1)) {

    /* "cypari/_pari.pyx":89
 *         return x
 *     elif isinstance(x, bytes):
 *         return x.decode('ascii')             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('Neither a str nor a bytes object.')
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_n_s_ascii);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 89, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/_pari.pyx":88
 *     if isinstance(x, str):
 *         return x
 *     elif isinstance(x, bytes):             # <<<<<<<<<<<<<<
 *         return x.decode('ascii')
 *     else:
 */
  }

  /* "cypari/_pari.pyx":91
 *         return x.decode('ascii')
 *     else:
 *         raise ValueError('Neither a str nor a bytes object.')             # <<<<<<<<<<<<<<
 * 
 * cpu_width = '64bit' if sys.maxsize > 2**32 else '32bit'
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 91, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 91, __pyx_L1_error)
  }

  /* "cypari/_pari.pyx":82
 * from libc.stdio cimport *
 * 
 * cdef String(x):             # <<<<<<<<<<<<<<
 *     """
 *     Return a string from either a string or bytes object, using ascii.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.String", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/signals.pyx":76
 * 
 * 
 * cdef public int sig_raise_exception "sig_raise_exception"(int sig, const char* msg) except 0 with gil:             # <<<<<<<<<<<<<<
 *     """
 *     Raise an exception for signal number ``sig`` with message ``msg``
 */

int sig_raise_exception(int __pyx_v_sig, char const *__pyx_v_msg) {
  PyObject *__pyx_v_s = NULL;
  CYTHON_UNUSED FILE *__pyx_v__;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("sig_raise_exception", 0);

  /* "cypari/signals.pyx":82
 *     """
 *     # Do not raise an exception if an exception is already pending
 *     if PyErr_Occurred():             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = (PyErr_Occurred() != 0);
  if (__pyx_t_1) {

    /* "cypari/signals.pyx":83
 *     # Do not raise an exception if an exception is already pending
 *     if PyErr_Occurred():
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     # Convert msg to Python string, assuming UTF-8 encoding
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "cypari/signals.pyx":82
 *     """
 *     # Do not raise an exception if an exception is already pending
 *     if PyErr_Occurred():             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "cypari/signals.pyx":86
 * 
 *     # Convert msg to Python string, assuming UTF-8 encoding
 *     s = msg.decode("utf-8") if msg is not NULL else None             # <<<<<<<<<<<<<<
 * 
 *     if sig == SIGTERM:
 */
  if (((__pyx_v_msg != NULL) != 0)) {
    __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_v_s = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cypari/signals.pyx":88
 *     s = msg.decode("utf-8") if msg is not NULL else None
 * 
 *     if sig == SIGTERM:             # <<<<<<<<<<<<<<
 *         # Redirect stdin from /dev/null to close interactive sessions
 *         _ = freopen("/dev/null", "r", stdin)
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGTERM) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":90
 *     if sig == SIGTERM:
 *         # Redirect stdin from /dev/null to close interactive sessions
 *         _ = freopen("/dev/null", "r", stdin)             # <<<<<<<<<<<<<<
 *         # This causes Python to exit
 *         raise SystemExit
 */
    __pyx_v__ = freopen(((char const *)"/dev/null"), ((char const *)"r"), stdin);

    /* "cypari/signals.pyx":92
 *         _ = freopen("/dev/null", "r", stdin)
 *         # This causes Python to exit
 *         raise SystemExit             # <<<<<<<<<<<<<<
 *     if sig == SIGINT:
 *         raise KeyboardInterrupt
 */
    __Pyx_Raise(__pyx_builtin_SystemExit, 0, 0, 0);
    __PYX_ERR(0, 92, __pyx_L1_error)

    /* "cypari/signals.pyx":88
 *     s = msg.decode("utf-8") if msg is not NULL else None
 * 
 *     if sig == SIGTERM:             # <<<<<<<<<<<<<<
 *         # Redirect stdin from /dev/null to close interactive sessions
 *         _ = freopen("/dev/null", "r", stdin)
 */
  }

  /* "cypari/signals.pyx":93
 *         # This causes Python to exit
 *         raise SystemExit
 *     if sig == SIGINT:             # <<<<<<<<<<<<<<
 *         raise KeyboardInterrupt
 *     if sig == SIGILL:
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGINT) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":94
 *         raise SystemExit
 *     if sig == SIGINT:
 *         raise KeyboardInterrupt             # <<<<<<<<<<<<<<
 *     if sig == SIGILL:
 *         raise SignalError(s or "Illegal instruction")
 */
    __Pyx_Raise(__pyx_builtin_KeyboardInterrupt, 0, 0, 0);
    __PYX_ERR(0, 94, __pyx_L1_error)

    /* "cypari/signals.pyx":93
 *         # This causes Python to exit
 *         raise SystemExit
 *     if sig == SIGINT:             # <<<<<<<<<<<<<<
 *         raise KeyboardInterrupt
 *     if sig == SIGILL:
 */
  }

  /* "cypari/signals.pyx":95
 *     if sig == SIGINT:
 *         raise KeyboardInterrupt
 *     if sig == SIGILL:             # <<<<<<<<<<<<<<
 *         raise SignalError(s or "Illegal instruction")
 *     if sig == SIGABRT:
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGILL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":96
 *         raise KeyboardInterrupt
 *     if sig == SIGILL:
 *         raise SignalError(s or "Illegal instruction")             # <<<<<<<<<<<<<<
 *     if sig == SIGABRT:
 *         raise RuntimeError(s or "Aborted")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SignalError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 96, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __Pyx_INCREF(__pyx_v_s);
      __pyx_t_4 = __pyx_v_s;
      goto __pyx_L7_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_kp_s_Illegal_instruction);
    __pyx_t_4 = __pyx_kp_s_Illegal_instruction;
    __pyx_L7_bool_binop_done:;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 96, __pyx_L1_error)

    /* "cypari/signals.pyx":95
 *     if sig == SIGINT:
 *         raise KeyboardInterrupt
 *     if sig == SIGILL:             # <<<<<<<<<<<<<<
 *         raise SignalError(s or "Illegal instruction")
 *     if sig == SIGABRT:
 */
  }

  /* "cypari/signals.pyx":97
 *     if sig == SIGILL:
 *         raise SignalError(s or "Illegal instruction")
 *     if sig == SIGABRT:             # <<<<<<<<<<<<<<
 *         raise RuntimeError(s or "Aborted")
 *     if sig == SIGFPE:
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGABRT) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":98
 *         raise SignalError(s or "Illegal instruction")
 *     if sig == SIGABRT:
 *         raise RuntimeError(s or "Aborted")             # <<<<<<<<<<<<<<
 *     if sig == SIGFPE:
 *         raise FloatingPointError(s or "Floating point exception")
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __Pyx_INCREF(__pyx_v_s);
      __pyx_t_2 = __pyx_v_s;
      goto __pyx_L10_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_n_s_Aborted);
    __pyx_t_2 = __pyx_n_s_Aborted;
    __pyx_L10_bool_binop_done:;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 98, __pyx_L1_error)

    /* "cypari/signals.pyx":97
 *     if sig == SIGILL:
 *         raise SignalError(s or "Illegal instruction")
 *     if sig == SIGABRT:             # <<<<<<<<<<<<<<
 *         raise RuntimeError(s or "Aborted")
 *     if sig == SIGFPE:
 */
  }

  /* "cypari/signals.pyx":99
 *     if sig == SIGABRT:
 *         raise RuntimeError(s or "Aborted")
 *     if sig == SIGFPE:             # <<<<<<<<<<<<<<
 *         raise FloatingPointError(s or "Floating point exception")
 *     if sig == SIGSEGV:
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGFPE) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":100
 *         raise RuntimeError(s or "Aborted")
 *     if sig == SIGFPE:
 *         raise FloatingPointError(s or "Floating point exception")             # <<<<<<<<<<<<<<
 *     if sig == SIGSEGV:
 *         raise SignalError(s or "Segmentation fault")
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 100, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __Pyx_INCREF(__pyx_v_s);
      __pyx_t_3 = __pyx_v_s;
      goto __pyx_L13_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_kp_s_Floating_point_exception);
    __pyx_t_3 = __pyx_kp_s_Floating_point_exception;
    __pyx_L13_bool_binop_done:;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_FloatingPointError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 100, __pyx_L1_error)

    /* "cypari/signals.pyx":99
 *     if sig == SIGABRT:
 *         raise RuntimeError(s or "Aborted")
 *     if sig == SIGFPE:             # <<<<<<<<<<<<<<
 *         raise FloatingPointError(s or "Floating point exception")
 *     if sig == SIGSEGV:
 */
  }

  /* "cypari/signals.pyx":101
 *     if sig == SIGFPE:
 *         raise FloatingPointError(s or "Floating point exception")
 *     if sig == SIGSEGV:             # <<<<<<<<<<<<<<
 *         raise SignalError(s or "Segmentation fault")
 *     IF UNAME_SYSNAME != 'Windows':
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGSEGV) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":102
 *         raise FloatingPointError(s or "Floating point exception")
 *     if sig == SIGSEGV:
 *         raise SignalError(s or "Segmentation fault")             # <<<<<<<<<<<<<<
 *     IF UNAME_SYSNAME != 'Windows':
 *         if sig == SIGHUP:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SignalError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 102, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __Pyx_INCREF(__pyx_v_s);
      __pyx_t_4 = __pyx_v_s;
      goto __pyx_L16_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_kp_s_Segmentation_fault);
    __pyx_t_4 = __pyx_kp_s_Segmentation_fault;
    __pyx_L16_bool_binop_done:;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 102, __pyx_L1_error)

    /* "cypari/signals.pyx":101
 *     if sig == SIGFPE:
 *         raise FloatingPointError(s or "Floating point exception")
 *     if sig == SIGSEGV:             # <<<<<<<<<<<<<<
 *         raise SignalError(s or "Segmentation fault")
 *     IF UNAME_SYSNAME != 'Windows':
 */
  }

  /* "cypari/signals.pyx":104
 *         raise SignalError(s or "Segmentation fault")
 *     IF UNAME_SYSNAME != 'Windows':
 *         if sig == SIGHUP:             # <<<<<<<<<<<<<<
 *             _ = freopen("/dev/null", "r", stdin)
 *             raise SystemExit
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGHUP) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":105
 *     IF UNAME_SYSNAME != 'Windows':
 *         if sig == SIGHUP:
 *             _ = freopen("/dev/null", "r", stdin)             # <<<<<<<<<<<<<<
 *             raise SystemExit
 *         if sig == SIGALRM:
 */
    __pyx_v__ = freopen(((char const *)"/dev/null"), ((char const *)"r"), stdin);

    /* "cypari/signals.pyx":106
 *         if sig == SIGHUP:
 *             _ = freopen("/dev/null", "r", stdin)
 *             raise SystemExit             # <<<<<<<<<<<<<<
 *         if sig == SIGALRM:
 *             raise AlarmInterrupt
 */
    __Pyx_Raise(__pyx_builtin_SystemExit, 0, 0, 0);
    __PYX_ERR(0, 106, __pyx_L1_error)

    /* "cypari/signals.pyx":104
 *         raise SignalError(s or "Segmentation fault")
 *     IF UNAME_SYSNAME != 'Windows':
 *         if sig == SIGHUP:             # <<<<<<<<<<<<<<
 *             _ = freopen("/dev/null", "r", stdin)
 *             raise SystemExit
 */
  }

  /* "cypari/signals.pyx":107
 *             _ = freopen("/dev/null", "r", stdin)
 *             raise SystemExit
 *         if sig == SIGALRM:             # <<<<<<<<<<<<<<
 *             raise AlarmInterrupt
 *         if sig == SIGBUS:
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGALRM) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":108
 *             raise SystemExit
 *         if sig == SIGALRM:
 *             raise AlarmInterrupt             # <<<<<<<<<<<<<<
 *         if sig == SIGBUS:
 *             raise SignalError(s or "Bus error")
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_AlarmInterrupt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 108, __pyx_L1_error)

    /* "cypari/signals.pyx":107
 *             _ = freopen("/dev/null", "r", stdin)
 *             raise SystemExit
 *         if sig == SIGALRM:             # <<<<<<<<<<<<<<
 *             raise AlarmInterrupt
 *         if sig == SIGBUS:
 */
  }

  /* "cypari/signals.pyx":109
 *         if sig == SIGALRM:
 *             raise AlarmInterrupt
 *         if sig == SIGBUS:             # <<<<<<<<<<<<<<
 *             raise SignalError(s or "Bus error")
 *     ELSE:
 */
  __pyx_t_1 = ((__pyx_v_sig == SIGBUS) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/signals.pyx":110
 *             raise AlarmInterrupt
 *         if sig == SIGBUS:
 *             raise SignalError(s or "Bus error")             # <<<<<<<<<<<<<<
 *     ELSE:
 *         if sig == 128:  # Used for signals that map to FPE
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_SignalError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_s); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __Pyx_INCREF(__pyx_v_s);
      __pyx_t_4 = __pyx_v_s;
      goto __pyx_L21_bool_binop_done;
    }
    __Pyx_INCREF(__pyx_kp_s_Bus_error);
    __pyx_t_4 = __pyx_kp_s_Bus_error;
    __pyx_L21_bool_binop_done:;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 110, __pyx_L1_error)

    /* "cypari/signals.pyx":109
 *         if sig == SIGALRM:
 *             raise AlarmInterrupt
 *         if sig == SIGBUS:             # <<<<<<<<<<<<<<
 *             raise SignalError(s or "Bus error")
 *     ELSE:
 */
  }

  /* "cypari/signals.pyx":114
 *         if sig == 128:  # Used for signals that map to FPE
 *             raise RuntimeError(s or "Pari Error")
 *     raise SystemError("unknown signal number %s"%sig)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_sig); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unknown_signal_number_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_SystemError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 114, __pyx_L1_error)

  /* "cypari/signals.pyx":76
 * 
 * 
 * cdef public int sig_raise_exception "sig_raise_exception"(int sig, const char* msg) except 0 with gil:             # <<<<<<<<<<<<<<
 *     """
 *     Raise an exception for signal number ``sig`` with message ``msg``
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.sig_raise_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "cypari/signals.pyx":117
 * 
 * 
 * def sig_print_exception(sig, msg=None):             # <<<<<<<<<<<<<<
 *     """
 *     Python version of :func:`sig_raise_exception` which prints the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_1sig_print_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_sig_print_exception[] = "\n    Python version of :func:`sig_raise_exception` which prints the\n    exception instead of raising it. This is just for doctesting.\n\n    EXAMPLES::\n\n        XXX from cysignals.signals import sig_print_exception\n        >>> import signal\n        >>> sig_print_exception(signal.SIGFPE)\n        FloatingPointError: Floating point exception\n\n        XXX sig_print_exception(signal.SIGBUS, \"CUSTOM MESSAGE\")\n        SignalError: CUSTOM MESSAGE\n        >>> sig_print_exception(0)\n        SystemError: unknown signal number 0\n\n    For interrupts, the message is ignored::\n\n        >>> sig_print_exception(signal.SIGINT, \"ignored\")\n        KeyboardInterrupt\n\n        XXX sig_print_exception(signal.SIGALRM, \"ignored\")\n        AlarmInterrupt\n\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_1sig_print_exception = {"sig_print_exception", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_1sig_print_exception, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_sig_print_exception};
static PyObject *__pyx_pw_6cypari_5_pari_1sig_print_exception(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sig = 0;
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sig_print_exception (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sig,&__pyx_n_s_msg,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_sig)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_msg);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sig_print_exception") < 0)) __PYX_ERR(0, 117, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sig = values[0];
    __pyx_v_msg = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sig_print_exception", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 117, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.sig_print_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_sig_print_exception(__pyx_self, __pyx_v_sig, __pyx_v_msg);

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

static PyObject *__pyx_pf_6cypari_5_pari_sig_print_exception(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sig, PyObject *__pyx_v_msg) {
  char const *__pyx_v_m;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_sys = NULL;
  PyObject *__pyx_v_traceback = NULL;
  PyObject *__pyx_v_typ = NULL;
  PyObject *__pyx_v_val = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_tb = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *(*__pyx_t_17)(PyObject *);
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  __Pyx_RefNannySetupContext("sig_print_exception", 0);
  __Pyx_INCREF(__pyx_v_msg);

  /* "cypari/signals.pyx":144
 *     """
 *     cdef const char* m
 *     if msg is None:             # <<<<<<<<<<<<<<
 *         m = NULL
 *     else:
 */
  __pyx_t_1 = (__pyx_v_msg == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/signals.pyx":145
 *     cdef const char* m
 *     if msg is None:
 *         m = NULL             # <<<<<<<<<<<<<<
 *     else:
 *         m = msg = msg.encode("utf-8")
 */
    __pyx_v_m = NULL;

    /* "cypari/signals.pyx":144
 *     """
 *     cdef const char* m
 *     if msg is None:             # <<<<<<<<<<<<<<
 *         m = NULL
 *     else:
 */
    goto __pyx_L3;
  }

  /* "cypari/signals.pyx":147
 *         m = NULL
 *     else:
 *         m = msg = msg.encode("utf-8")             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_msg, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_kp_s_utf_8) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_utf_8);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L1_error)
    __pyx_v_m = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "cypari/signals.pyx":149
 *         m = msg = msg.encode("utf-8")
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         sig_raise_exception(sig, m)
 *     except BaseException as e:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "cypari/signals.pyx":150
 * 
 *     try:
 *         sig_raise_exception(sig, m)             # <<<<<<<<<<<<<<
 *     except BaseException as e:
 *         # Print exception to stdout without traceback
 */
      __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_sig); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L4_error)
      __pyx_t_11 = sig_raise_exception(__pyx_t_10, __pyx_v_m); if (unlikely(__pyx_t_11 == ((int)0))) __PYX_ERR(0, 150, __pyx_L4_error)

      /* "cypari/signals.pyx":149
 *         m = msg = msg.encode("utf-8")
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         sig_raise_exception(sig, m)
 *     except BaseException as e:
 */
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "cypari/signals.pyx":151
 *     try:
 *         sig_raise_exception(sig, m)
 *     except BaseException as e:             # <<<<<<<<<<<<<<
 *         # Print exception to stdout without traceback
 *         import sys, traceback
 */
    __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_BaseException);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("cypari._pari.sig_print_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 151, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_e = __pyx_t_4;

      /* "cypari/signals.pyx":153
 *     except BaseException as e:
 *         # Print exception to stdout without traceback
 *         import sys, traceback             # <<<<<<<<<<<<<<
 *         typ, val, tb = sys.exc_info()
 *         try:
 */
      __pyx_t_12 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 153, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_v_sys = __pyx_t_12;
      __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 153, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_v_traceback = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "cypari/signals.pyx":154
 *         # Print exception to stdout without traceback
 *         import sys, traceback
 *         typ, val, tb = sys.exc_info()             # <<<<<<<<<<<<<<
 *         try:
 *             # For doctests, we want exceptions to look the same,
 */
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sys, __pyx_n_s_exc_info); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 154, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
        }
      }
      __pyx_t_12 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 154, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) {
        PyObject* sequence = __pyx_t_12;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 154, __pyx_L6_except_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_13 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_15 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_15);
        #else
        __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 154, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 154, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_15 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 154, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_15);
        #endif
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_16 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 154, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
        index = 0; __pyx_t_13 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_13)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_14);
        index = 2; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_15);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 3) < 0) __PYX_ERR(0, 154, __pyx_L6_except_error)
        __pyx_t_17 = NULL;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        goto __pyx_L13_unpacking_done;
        __pyx_L12_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_17 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 154, __pyx_L6_except_error)
        __pyx_L13_unpacking_done:;
      }
      __pyx_v_typ = __pyx_t_13;
      __pyx_t_13 = 0;
      __pyx_v_val = __pyx_t_14;
      __pyx_t_14 = 0;
      __pyx_v_tb = __pyx_t_15;
      __pyx_t_15 = 0;

      /* "cypari/signals.pyx":155
 *         import sys, traceback
 *         typ, val, tb = sys.exc_info()
 *         try:             # <<<<<<<<<<<<<<
 *             # For doctests, we want exceptions to look the same,
 *             # regardless of the Python version. Python 3 will put the
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_18);
        __Pyx_XGOTREF(__pyx_t_19);
        __Pyx_XGOTREF(__pyx_t_20);
        /*try:*/ {

          /* "cypari/signals.pyx":160
 *             # module name in the traceback, which we avoid by faking
 *             # the module to be __main__.
 *             typ.__module__ = "__main__"             # <<<<<<<<<<<<<<
 *         except TypeError:
 *             pass
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_typ, __pyx_n_s_module, __pyx_n_s_main) < 0) __PYX_ERR(0, 160, __pyx_L14_error)

          /* "cypari/signals.pyx":155
 *         import sys, traceback
 *         typ, val, tb = sys.exc_info()
 *         try:             # <<<<<<<<<<<<<<
 *             # For doctests, we want exceptions to look the same,
 *             # regardless of the Python version. Python 3 will put the
 */
        }
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        goto __pyx_L21_try_end;
        __pyx_L14_error:;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;

        /* "cypari/signals.pyx":161
 *             # the module to be __main__.
 *             typ.__module__ = "__main__"
 *         except TypeError:             # <<<<<<<<<<<<<<
 *             pass
 *         try:
 */
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
        if (__pyx_t_11) {
          __Pyx_ErrRestore(0,0,0);
          goto __pyx_L15_exception_handled;
        }
        goto __pyx_L16_except_error;
        __pyx_L16_except_error:;

        /* "cypari/signals.pyx":155
 *         import sys, traceback
 *         typ, val, tb = sys.exc_info()
 *         try:             # <<<<<<<<<<<<<<
 *             # For doctests, we want exceptions to look the same,
 *             # regardless of the Python version. Python 3 will put the
 */
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
        goto __pyx_L6_except_error;
        __pyx_L15_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
        __pyx_L21_try_end:;
      }

      /* "cypari/signals.pyx":163
 *         except TypeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             # Python 3
 *             traceback.print_exception(typ, val, None, file=sys.stdout, chain=False)
 */
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_20, &__pyx_t_19, &__pyx_t_18);
        __Pyx_XGOTREF(__pyx_t_20);
        __Pyx_XGOTREF(__pyx_t_19);
        __Pyx_XGOTREF(__pyx_t_18);
        /*try:*/ {

          /* "cypari/signals.pyx":165
 *         try:
 *             # Python 3
 *             traceback.print_exception(typ, val, None, file=sys.stdout, chain=False)             # <<<<<<<<<<<<<<
 *         except TypeError:
 *             # Python 2
 */
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_traceback, __pyx_n_s_print_exception); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 165, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 165, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_v_typ);
          __Pyx_GIVEREF(__pyx_v_typ);
          PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_typ);
          __Pyx_INCREF(__pyx_v_val);
          __Pyx_GIVEREF(__pyx_v_val);
          PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_val);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyTuple_SET_ITEM(__pyx_t_15, 2, Py_None);
          __pyx_t_14 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 165, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_sys, __pyx_n_s_stdout); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 165, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_13);
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_file, __pyx_t_13) < 0) __PYX_ERR(0, 165, __pyx_L22_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_chain, Py_False) < 0) __PYX_ERR(0, 165, __pyx_L22_error)
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 165, __pyx_L22_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

          /* "cypari/signals.pyx":163
 *         except TypeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             # Python 3
 *             traceback.print_exception(typ, val, None, file=sys.stdout, chain=False)
 */
        }
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
        goto __pyx_L29_try_end;
        __pyx_L22_error:;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;

        /* "cypari/signals.pyx":166
 *             # Python 3
 *             traceback.print_exception(typ, val, None, file=sys.stdout, chain=False)
 *         except TypeError:             # <<<<<<<<<<<<<<
 *             # Python 2
 *             traceback.print_exception(typ, val, None, file=sys.stdout)
 */
        __pyx_t_11 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
        if (__pyx_t_11) {
          __Pyx_AddTraceback("cypari._pari.sig_print_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0) __PYX_ERR(0, 166, __pyx_L24_except_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_GOTREF(__pyx_t_15);

          /* "cypari/signals.pyx":168
 *         except TypeError:
 *             # Python 2
 *             traceback.print_exception(typ, val, None, file=sys.stdout)             # <<<<<<<<<<<<<<
 * 
 * cdef cysigs_t cysigs
 */
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_traceback, __pyx_n_s_print_exception); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 168, __pyx_L24_except_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 168, __pyx_L24_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_INCREF(__pyx_v_typ);
          __Pyx_GIVEREF(__pyx_v_typ);
          PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_typ);
          __Pyx_INCREF(__pyx_v_val);
          __Pyx_GIVEREF(__pyx_v_val);
          PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_val);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyTuple_SET_ITEM(__pyx_t_16, 2, Py_None);
          __pyx_t_21 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 168, __pyx_L24_except_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_sys, __pyx_n_s_stdout); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 168, __pyx_L24_except_error)
          __Pyx_GOTREF(__pyx_t_22);
          if (PyDict_SetItem(__pyx_t_21, __pyx_n_s_file, __pyx_t_22) < 0) __PYX_ERR(0, 168, __pyx_L24_except_error)
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_16, __pyx_t_21); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 168, __pyx_L24_except_error)
          __Pyx_GOTREF(__pyx_t_22);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          goto __pyx_L23_exception_handled;
        }
        goto __pyx_L24_except_error;
        __pyx_L24_except_error:;

        /* "cypari/signals.pyx":163
 *         except TypeError:
 *             pass
 *         try:             # <<<<<<<<<<<<<<
 *             # Python 3
 *             traceback.print_exception(typ, val, None, file=sys.stdout, chain=False)
 */
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18);
        goto __pyx_L6_except_error;
        __pyx_L23_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_20, __pyx_t_19, __pyx_t_18);
        __pyx_L29_try_end:;
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "cypari/signals.pyx":149
 *         m = msg = msg.encode("utf-8")
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         sig_raise_exception(sig, m)
 *     except BaseException as e:
 */
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L9_try_end:;
  }

  /* "cypari/signals.pyx":117
 * 
 * 
 * def sig_print_exception(sig, msg=None):             # <<<<<<<<<<<<<<
 *     """
 *     Python version of :func:`sig_raise_exception` which prints the
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_AddTraceback("cypari._pari.sig_print_exception", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_sys);
  __Pyx_XDECREF(__pyx_v_traceback);
  __Pyx_XDECREF(__pyx_v_typ);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_tb);
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/signals.pyx":172
 * cdef cysigs_t cysigs
 * 
 * def init_cysignals():             # <<<<<<<<<<<<<<
 *     """
 *     Initialize ``cysignals``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3init_cysignals(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_2init_cysignals[] = "\n    Initialize ``cysignals``.\n\n    This is normally done exactly once, namely when importing\n    ``cysignals``. However, it is legal to call this multiple times,\n    for example when switching between the ``cysignals`` interrupt\n    handler and a different interrupt handler.\n\n    OUTPUT: the old Python-level interrupt handler\n\n    EXAMPLES::\n\n        XXX from cysignals.signals import init_cysignals\n        >>> init_cysignals()\n        <built-in function python_check_interrupt>\n\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_3init_cysignals = {"init_cysignals", (PyCFunction)__pyx_pw_6cypari_5_pari_3init_cysignals, METH_NOARGS, __pyx_doc_6cypari_5_pari_2init_cysignals};
static PyObject *__pyx_pw_6cypari_5_pari_3init_cysignals(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_cysignals (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_2init_cysignals(__pyx_self);

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

static PyObject *__pyx_pf_6cypari_5_pari_2init_cysignals(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_signal = NULL;
  PyObject *__pyx_v_old = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("init_cysignals", 0);

  /* "cypari/signals.pyx":198
 *     # now). This handler issues a sig_check() which finally raises the
 *     # KeyboardInterrupt exception.
 *     import signal             # <<<<<<<<<<<<<<
 *     old = signal.signal(signal.SIGINT, python_check_interrupt)
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_signal, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_signal = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/signals.pyx":199
 *     # KeyboardInterrupt exception.
 *     import signal
 *     old = signal.signal(signal.SIGINT, python_check_interrupt)             # <<<<<<<<<<<<<<
 * 
 *     setup_cysignals_handlers()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_signal, __pyx_n_s_signal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_signal, __pyx_n_s_SIGINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_python_check_interrupt); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_old = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/signals.pyx":201
 *     old = signal.signal(signal.SIGINT, python_check_interrupt)
 * 
 *     setup_cysignals_handlers()             # <<<<<<<<<<<<<<
 *     return old
 * 
 */
  setup_cysignals_handlers();

  /* "cypari/signals.pyx":202
 * 
 *     setup_cysignals_handlers()
 *     return old             # <<<<<<<<<<<<<<
 * 
 * def sig_on_reset():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_old);
  __pyx_r = __pyx_v_old;
  goto __pyx_L0;

  /* "cypari/signals.pyx":172
 * cdef cysigs_t cysigs
 * 
 * def init_cysignals():             # <<<<<<<<<<<<<<
 *     """
 *     Initialize ``cysignals``.
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.init_cysignals", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_signal);
  __Pyx_XDECREF(__pyx_v_old);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/signals.pyx":204
 *     return old
 * 
 * def sig_on_reset():             # <<<<<<<<<<<<<<
 *     """
 *     Return the current value of ``cysigs.sig_on_count`` and set its
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_5sig_on_reset(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4sig_on_reset[] = "\n    Return the current value of ``cysigs.sig_on_count`` and set its\n    value to zero. This is used by the SageMath doctesting framework.\n\n    EXAMPLES::\n\n        XXX from cysignals.signals import sig_on_reset\n        XXX from cysignals.tests import _sig_on\n        XXX _sig_on(); sig_on_reset()\n        1\n        XXX sig_on_reset()\n        0\n\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_5sig_on_reset = {"sig_on_reset", (PyCFunction)__pyx_pw_6cypari_5_pari_5sig_on_reset, METH_NOARGS, __pyx_doc_6cypari_5_pari_4sig_on_reset};
static PyObject *__pyx_pw_6cypari_5_pari_5sig_on_reset(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sig_on_reset (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4sig_on_reset(__pyx_self);

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

static PyObject *__pyx_pf_6cypari_5_pari_4sig_on_reset(CYTHON_UNUSED PyObject *__pyx_self) {
  int __pyx_v_s;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("sig_on_reset", 0);

  /* "cypari/signals.pyx":219
 * 
 *     """
 *     cdef int s = cysigs.sig_on_count             # <<<<<<<<<<<<<<
 *     cysigs.sig_on_count = 0
 *     return s
 */
  __pyx_t_1 = __pyx_v_6cypari_5_pari_cysigs.sig_on_count;
  __pyx_v_s = __pyx_t_1;

  /* "cypari/signals.pyx":220
 *     """
 *     cdef int s = cysigs.sig_on_count
 *     cysigs.sig_on_count = 0             # <<<<<<<<<<<<<<
 *     return s
 * 
 */
  __pyx_v_6cypari_5_pari_cysigs.sig_on_count = 0;

  /* "cypari/signals.pyx":221
 *     cdef int s = cysigs.sig_on_count
 *     cysigs.sig_on_count = 0
 *     return s             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/signals.pyx":204
 *     return old
 * 
 * def sig_on_reset():             # <<<<<<<<<<<<<<
 *     """
 *     Return the current value of ``cysigs.sig_on_count`` and set its
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.sig_on_reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/signals.pyx":224
 * 
 * 
 * def python_check_interrupt(sig, frame):             # <<<<<<<<<<<<<<
 *     """
 *     Python-level interrupt handler for interrupts raised in Python
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_7python_check_interrupt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_6python_check_interrupt[] = "\n    Python-level interrupt handler for interrupts raised in Python\n    code. This simply delegates to the interrupt handling code in\n    ``implementation.c``.\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_7python_check_interrupt = {"python_check_interrupt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_7python_check_interrupt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_6python_check_interrupt};
static PyObject *__pyx_pw_6cypari_5_pari_7python_check_interrupt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_sig = 0;
  CYTHON_UNUSED PyObject *__pyx_v_frame = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("python_check_interrupt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sig,&__pyx_n_s_frame,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_sig)) != 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_frame)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("python_check_interrupt", 1, 2, 2, 1); __PYX_ERR(0, 224, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "python_check_interrupt") < 0)) __PYX_ERR(0, 224, __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_sig = values[0];
    __pyx_v_frame = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("python_check_interrupt", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 224, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.python_check_interrupt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_6python_check_interrupt(__pyx_self, __pyx_v_sig, __pyx_v_frame);

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

static PyObject *__pyx_pf_6cypari_5_pari_6python_check_interrupt(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_sig, CYTHON_UNUSED PyObject *__pyx_v_frame) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("python_check_interrupt", 0);

  /* "cypari/signals.pyx":230
 *     ``implementation.c``.
 *     """
 *     sig_check()             # <<<<<<<<<<<<<<
 * 
 * def test_signal(int sig):
 */
  __pyx_t_1 = sig_check(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(0, 230, __pyx_L1_error)

  /* "cypari/signals.pyx":224
 * 
 * 
 * def python_check_interrupt(sig, frame):             # <<<<<<<<<<<<<<
 *     """
 *     Python-level interrupt handler for interrupts raised in Python
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.python_check_interrupt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/signals.pyx":232
 *     sig_check()
 * 
 * def test_signal(int sig):             # <<<<<<<<<<<<<<
 *     """
 *     Test whether critical signals can be handled within a sig_on-sig_off
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9test_signal(PyObject *__pyx_self, PyObject *__pyx_arg_sig); /*proto*/
static char __pyx_doc_6cypari_5_pari_8test_signal[] = "\n    Test whether critical signals can be handled within a sig_on-sig_off\n    block.\n\n    >>> from signal import *\n    >>> from cypari._pari import test_signal\n    >>> test_signal(SIGFPE)\n    Traceback (most recent call last):\n        ...\n    FloatingPointError: Floating point exception\n    >>> test_signal(SIGSEGV)\n    Traceback (most recent call last):\n        ...\n    SignalError: Segmentation fault\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_9test_signal = {"test_signal", (PyCFunction)__pyx_pw_6cypari_5_pari_9test_signal, METH_O, __pyx_doc_6cypari_5_pari_8test_signal};
static PyObject *__pyx_pw_6cypari_5_pari_9test_signal(PyObject *__pyx_self, PyObject *__pyx_arg_sig) {
  int __pyx_v_sig;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("test_signal (wrapper)", 0);
  assert(__pyx_arg_sig); {
    __pyx_v_sig = __Pyx_PyInt_As_int(__pyx_arg_sig); if (unlikely((__pyx_v_sig == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.test_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8test_signal(__pyx_self, ((int)__pyx_v_sig));

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

static PyObject *__pyx_pf_6cypari_5_pari_8test_signal(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_sig) {
  PyObject *__pyx_v_signal = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("test_signal", 0);

  /* "cypari/signals.pyx":248
 *     SignalError: Segmentation fault
 *     """
 *     import signal             # <<<<<<<<<<<<<<
 *     if sig == signal.SIGSEGV:
 *         sig_on()
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_signal, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_signal = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/signals.pyx":249
 *     """
 *     import signal
 *     if sig == signal.SIGSEGV:             # <<<<<<<<<<<<<<
 *         sig_on()
 *         test_sigsegv()
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_sig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_signal, __pyx_n_s_SIGSEGV); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 249, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "cypari/signals.pyx":250
 *     import signal
 *     if sig == signal.SIGSEGV:
 *         sig_on()             # <<<<<<<<<<<<<<
 *         test_sigsegv()
 *         sig_off()
 */
    __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(0, 250, __pyx_L1_error)

    /* "cypari/signals.pyx":251
 *     if sig == signal.SIGSEGV:
 *         sig_on()
 *         test_sigsegv()             # <<<<<<<<<<<<<<
 *         sig_off()
 *     else:
 */
    test_sigsegv();

    /* "cypari/signals.pyx":252
 *         sig_on()
 *         test_sigsegv()
 *         sig_off()             # <<<<<<<<<<<<<<
 *     else:
 *         sig_on()
 */
    sig_off();

    /* "cypari/signals.pyx":249
 *     """
 *     import signal
 *     if sig == signal.SIGSEGV:             # <<<<<<<<<<<<<<
 *         sig_on()
 *         test_sigsegv()
 */
    goto __pyx_L3;
  }

  /* "cypari/signals.pyx":254
 *         sig_off()
 *     else:
 *         sig_on()             # <<<<<<<<<<<<<<
 *         send_signal(sig)
 *         sig_off()
 */
  /*else*/ {
    __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(0, 254, __pyx_L1_error)

    /* "cypari/signals.pyx":255
 *     else:
 *         sig_on()
 *         send_signal(sig)             # <<<<<<<<<<<<<<
 *         sig_off()
 */
    send_signal(__pyx_v_sig);

    /* "cypari/signals.pyx":256
 *         sig_on()
 *         send_signal(sig)
 *         sig_off()             # <<<<<<<<<<<<<<
 */
    sig_off();
  }
  __pyx_L3:;

  /* "cypari/signals.pyx":232
 *     sig_check()
 * 
 * def test_signal(int sig):             # <<<<<<<<<<<<<<
 *     """
 *     Test whether critical signals can be handled within a sig_on-sig_off
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.test_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_signal);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/stack.pyx":26
 * # from .paridecl cimport pari_mainstack, avma, paristack_setsize, gsizebyte, gcopy_avma, gnil
 * 
 * cdef inline void clear_stack():             # <<<<<<<<<<<<<<
 *     """
 *     Call ``sig_off()``. If we are leaving the outermost
 */

static CYTHON_INLINE void __pyx_f_6cypari_5_pari_clear_stack(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  pari_sp __pyx_t_2;
  __Pyx_RefNannySetupContext("clear_stack", 0);

  /* "cypari/stack.pyx":32
 *     """
 *     global avma
 *     if sig_on_count <= 1:             # <<<<<<<<<<<<<<
 *         avma = pari_mainstack.top
 *     sig_off()
 */
  __pyx_t_1 = ((cysigs.sig_on_count <= 1) != 0);
  if (__pyx_t_1) {

    /* "cypari/stack.pyx":33
 *     global avma
 *     if sig_on_count <= 1:
 *         avma = pari_mainstack.top             # <<<<<<<<<<<<<<
 *     sig_off()
 * 
 */
    __pyx_t_2 = pari_mainstack->top;
    avma = __pyx_t_2;

    /* "cypari/stack.pyx":32
 *     """
 *     global avma
 *     if sig_on_count <= 1:             # <<<<<<<<<<<<<<
 *         avma = pari_mainstack.top
 *     sig_off()
 */
  }

  /* "cypari/stack.pyx":34
 *     if sig_on_count <= 1:
 *         avma = pari_mainstack.top
 *     sig_off()             # <<<<<<<<<<<<<<
 * 
 * cdef inline GEN deepcopy_to_python_heap(GEN x, pari_sp* address):
 */
  sig_off();

  /* "cypari/stack.pyx":26
 * # from .paridecl cimport pari_mainstack, avma, paristack_setsize, gsizebyte, gcopy_avma, gnil
 * 
 * cdef inline void clear_stack():             # <<<<<<<<<<<<<<
 *     """
 *     Call ``sig_off()``. If we are leaving the outermost
 */

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

/* "cypari/stack.pyx":36
 *     sig_off()
 * 
 * cdef inline GEN deepcopy_to_python_heap(GEN x, pari_sp* address):             # <<<<<<<<<<<<<<
 *     cdef size_t s = <size_t> gsizebyte(x)
 *     cdef pari_sp tmp_bot = <pari_sp> sig_malloc(s)
 */

static CYTHON_INLINE GEN __pyx_f_6cypari_5_pari_deepcopy_to_python_heap(GEN __pyx_v_x, pari_sp *__pyx_v_address) {
  size_t __pyx_v_s;
  pari_sp __pyx_v_tmp_bot;
  pari_sp __pyx_v_tmp_top;
  GEN __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deepcopy_to_python_heap", 0);

  /* "cypari/stack.pyx":37
 * 
 * cdef inline GEN deepcopy_to_python_heap(GEN x, pari_sp* address):
 *     cdef size_t s = <size_t> gsizebyte(x)             # <<<<<<<<<<<<<<
 *     cdef pari_sp tmp_bot = <pari_sp> sig_malloc(s)
 *     cdef pari_sp tmp_top = tmp_bot + s
 */
  __pyx_v_s = ((size_t)gsizebyte(__pyx_v_x));

  /* "cypari/stack.pyx":38
 * cdef inline GEN deepcopy_to_python_heap(GEN x, pari_sp* address):
 *     cdef size_t s = <size_t> gsizebyte(x)
 *     cdef pari_sp tmp_bot = <pari_sp> sig_malloc(s)             # <<<<<<<<<<<<<<
 *     cdef pari_sp tmp_top = tmp_bot + s
 *     address[0] = tmp_bot
 */
  __pyx_v_tmp_bot = ((pari_sp)sig_malloc(__pyx_v_s));

  /* "cypari/stack.pyx":39
 *     cdef size_t s = <size_t> gsizebyte(x)
 *     cdef pari_sp tmp_bot = <pari_sp> sig_malloc(s)
 *     cdef pari_sp tmp_top = tmp_bot + s             # <<<<<<<<<<<<<<
 *     address[0] = tmp_bot
 *     return gcopy_avma(x, &tmp_top)
 */
  __pyx_v_tmp_top = (__pyx_v_tmp_bot + __pyx_v_s);

  /* "cypari/stack.pyx":40
 *     cdef pari_sp tmp_bot = <pari_sp> sig_malloc(s)
 *     cdef pari_sp tmp_top = tmp_bot + s
 *     address[0] = tmp_bot             # <<<<<<<<<<<<<<
 *     return gcopy_avma(x, &tmp_top)
 * 
 */
  (__pyx_v_address[0]) = __pyx_v_tmp_bot;

  /* "cypari/stack.pyx":41
 *     cdef pari_sp tmp_top = tmp_bot + s
 *     address[0] = tmp_bot
 *     return gcopy_avma(x, &tmp_top)             # <<<<<<<<<<<<<<
 * 
 * cdef inline Gen new_gen(GEN x):
 */
  __pyx_r = gcopy_avma(__pyx_v_x, (&__pyx_v_tmp_top));
  goto __pyx_L0;

  /* "cypari/stack.pyx":36
 *     sig_off()
 * 
 * cdef inline GEN deepcopy_to_python_heap(GEN x, pari_sp* address):             # <<<<<<<<<<<<<<
 *     cdef size_t s = <size_t> gsizebyte(x)
 *     cdef pari_sp tmp_bot = <pari_sp> sig_malloc(s)
 */

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

/* "cypari/stack.pyx":43
 *     return gcopy_avma(x, &tmp_top)
 * 
 * cdef inline Gen new_gen(GEN x):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new Gen wrapping `x`, then call ``clear_stack()``.
 */

static CYTHON_INLINE struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_gen(GEN __pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_g = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("new_gen", 0);

  /* "cypari/stack.pyx":49
 *     """
 *     cdef Gen g
 *     if x is gnil:             # <<<<<<<<<<<<<<
 *         g = None
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_x == gnil) != 0);
  if (__pyx_t_1) {

    /* "cypari/stack.pyx":50
 *     cdef Gen g
 *     if x is gnil:
 *         g = None             # <<<<<<<<<<<<<<
 *     else:
 *         g = new_gen_noclear(x)
 */
    __Pyx_INCREF(Py_None);
    __pyx_v_g = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None);

    /* "cypari/stack.pyx":49
 *     """
 *     cdef Gen g
 *     if x is gnil:             # <<<<<<<<<<<<<<
 *         g = None
 *     else:
 */
    goto __pyx_L3;
  }

  /* "cypari/stack.pyx":52
 *         g = None
 *     else:
 *         g = new_gen_noclear(x)             # <<<<<<<<<<<<<<
 *     clear_stack()
 *     return g
 */
  /*else*/ {
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(__pyx_v_x)); if (unlikely(!__pyx_t_2)) __PYX_ERR(7, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_g = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "cypari/stack.pyx":53
 *     else:
 *         g = new_gen_noclear(x)
 *     clear_stack()             # <<<<<<<<<<<<<<
 *     return g
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/stack.pyx":54
 *         g = new_gen_noclear(x)
 *     clear_stack()
 *     return g             # <<<<<<<<<<<<<<
 * 
 * cdef inline Gen new_gen_noclear(GEN x):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_g));
  __pyx_r = __pyx_v_g;
  goto __pyx_L0;

  /* "cypari/stack.pyx":43
 *     return gcopy_avma(x, &tmp_top)
 * 
 * cdef inline Gen new_gen(GEN x):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new Gen wrapping `x`, then call ``clear_stack()``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.new_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_g);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/stack.pyx":56
 *     return g
 * 
 * cdef inline Gen new_gen_noclear(GEN x):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new gen, but don't free any memory on the stack and don't
 */

static CYTHON_INLINE struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_gen_noclear(GEN __pyx_v_x) {
  pari_sp __pyx_v_address;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_y = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("new_gen_noclear", 0);

  /* "cypari/stack.pyx":62
 *     """
 *     cdef pari_sp address
 *     cdef Gen y = Gen.__new__(Gen)             # <<<<<<<<<<<<<<
 *     y.g = deepcopy_to_python_heap(x, &address)
 *     y.b = address
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6cypari_5_pari_Gen(((PyTypeObject *)__pyx_ptype_6cypari_5_pari_Gen), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 62, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_y = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/stack.pyx":63
 *     cdef pari_sp address
 *     cdef Gen y = Gen.__new__(Gen)
 *     y.g = deepcopy_to_python_heap(x, &address)             # <<<<<<<<<<<<<<
 *     y.b = address
 *     # y.refers_to (a dict which is None now) is initialised as needed
 */
  __pyx_v_y->__pyx_base.g = __pyx_f_6cypari_5_pari_deepcopy_to_python_heap(__pyx_v_x, (&__pyx_v_address));

  /* "cypari/stack.pyx":64
 *     cdef Gen y = Gen.__new__(Gen)
 *     y.g = deepcopy_to_python_heap(x, &address)
 *     y.b = address             # <<<<<<<<<<<<<<
 *     # y.refers_to (a dict which is None now) is initialised as needed
 *     return y
 */
  __pyx_v_y->__pyx_base.b = __pyx_v_address;

  /* "cypari/stack.pyx":66
 *     y.b = address
 *     # y.refers_to (a dict which is None now) is initialised as needed
 *     return y             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_y));
  __pyx_r = __pyx_v_y;
  goto __pyx_L0;

  /* "cypari/stack.pyx":56
 *     return g
 * 
 * cdef inline Gen new_gen_noclear(GEN x):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new gen, but don't free any memory on the stack and don't
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.new_gen_noclear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":302
 * encoding = sys.getfilesystemencoding()
 * 
 * cdef bytes to_bytes(s):             # <<<<<<<<<<<<<<
 *     """
 *     Converts bytes and unicode ``s`` to bytes.
 */

static PyObject *__pyx_f_6cypari_5_pari_to_bytes(PyObject *__pyx_v_s) {
  int __pyx_v_convert;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("to_bytes", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/pari_instance.pyx":307
 *     """
 *     cdef int convert
 *     for convert in range(2):             # <<<<<<<<<<<<<<
 *         if convert:
 *             s = str(s)
 */
  for (__pyx_t_1 = 0; __pyx_t_1 < 2; __pyx_t_1+=1) {
    __pyx_v_convert = __pyx_t_1;

    /* "cypari/pari_instance.pyx":308
 *     cdef int convert
 *     for convert in range(2):
 *         if convert:             # <<<<<<<<<<<<<<
 *             s = str(s)
 *         if isinstance(s, bytes):
 */
    __pyx_t_2 = (__pyx_v_convert != 0);
    if (__pyx_t_2) {

      /* "cypari/pari_instance.pyx":309
 *     for convert in range(2):
 *         if convert:
 *             s = str(s)             # <<<<<<<<<<<<<<
 *         if isinstance(s, bytes):
 *             return <bytes> s
 */
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 309, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "cypari/pari_instance.pyx":308
 *     cdef int convert
 *     for convert in range(2):
 *         if convert:             # <<<<<<<<<<<<<<
 *             s = str(s)
 *         if isinstance(s, bytes):
 */
    }

    /* "cypari/pari_instance.pyx":310
 *         if convert:
 *             s = str(s)
 *         if isinstance(s, bytes):             # <<<<<<<<<<<<<<
 *             return <bytes> s
 *         elif isinstance(s, unicode):
 */
    __pyx_t_2 = PyBytes_Check(__pyx_v_s); 
    __pyx_t_4 = (__pyx_t_2 != 0);
    if (__pyx_t_4) {

      /* "cypari/pari_instance.pyx":311
 *             s = str(s)
 *         if isinstance(s, bytes):
 *             return <bytes> s             # <<<<<<<<<<<<<<
 *         elif isinstance(s, unicode):
 *             return (<unicode> s).encode(encoding)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject*)__pyx_v_s));
      __pyx_r = ((PyObject*)__pyx_v_s);
      goto __pyx_L0;

      /* "cypari/pari_instance.pyx":310
 *         if convert:
 *             s = str(s)
 *         if isinstance(s, bytes):             # <<<<<<<<<<<<<<
 *             return <bytes> s
 *         elif isinstance(s, unicode):
 */
    }

    /* "cypari/pari_instance.pyx":312
 *         if isinstance(s, bytes):
 *             return <bytes> s
 *         elif isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *             return (<unicode> s).encode(encoding)
 *     raise AssertionError(f"str() returned {type(s)}")
 */
    __pyx_t_4 = PyUnicode_Check(__pyx_v_s); 
    __pyx_t_2 = (__pyx_t_4 != 0);
    if (__pyx_t_2) {

      /* "cypari/pari_instance.pyx":313
 *             return <bytes> s
 *         elif isinstance(s, unicode):
 *             return (<unicode> s).encode(encoding)             # <<<<<<<<<<<<<<
 *     raise AssertionError(f"str() returned {type(s)}")
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_encoding); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 313, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(3, 313, __pyx_L1_error)
      __pyx_r = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* "cypari/pari_instance.pyx":312
 *         if isinstance(s, bytes):
 *             return <bytes> s
 *         elif isinstance(s, unicode):             # <<<<<<<<<<<<<<
 *             return (<unicode> s).encode(encoding)
 *     raise AssertionError(f"str() returned {type(s)}")
 */
    }
  }

  /* "cypari/pari_instance.pyx":314
 *         elif isinstance(s, unicode):
 *             return (<unicode> s).encode(encoding)
 *     raise AssertionError(f"str() returned {type(s)}")             # <<<<<<<<<<<<<<
 * 
 * cdef extern from *:
 */
  __pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_s)), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_str_returned, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AssertionError, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 314, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(3, 314, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":302
 * encoding = sys.getfilesystemencoding()
 * 
 * cdef bytes to_bytes(s):             # <<<<<<<<<<<<<<
 *     """
 *     Converts bytes and unicode ``s`` to bytes.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":327
 * #################################################################
 * 
 * def prec_bits_to_dec(long prec_in_bits):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in bits to precision expressed in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_11prec_bits_to_dec(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_bits); /*proto*/
static char __pyx_doc_6cypari_5_pari_10prec_bits_to_dec[] = "\n    Convert from precision expressed in bits to precision expressed in\n    decimal.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import prec_bits_to_dec\n        sage: prec_bits_to_dec(53)\n        15\n        sage: [prec_bits_to_dec(32*n) for n in range(1, 9)]\n        [9, 19, 28, 38, 48, 57, 67, 77]\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_11prec_bits_to_dec = {"prec_bits_to_dec", (PyCFunction)__pyx_pw_6cypari_5_pari_11prec_bits_to_dec, METH_O, __pyx_doc_6cypari_5_pari_10prec_bits_to_dec};
static PyObject *__pyx_pw_6cypari_5_pari_11prec_bits_to_dec(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_bits) {
  long __pyx_v_prec_in_bits;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prec_bits_to_dec (wrapper)", 0);
  assert(__pyx_arg_prec_in_bits); {
    __pyx_v_prec_in_bits = __Pyx_PyInt_As_long(__pyx_arg_prec_in_bits); if (unlikely((__pyx_v_prec_in_bits == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 327, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.prec_bits_to_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_10prec_bits_to_dec(__pyx_self, ((long)__pyx_v_prec_in_bits));

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

static PyObject *__pyx_pf_6cypari_5_pari_10prec_bits_to_dec(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_bits) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("prec_bits_to_dec", 0);

  /* "cypari/pari_instance.pyx":340
 *         [9, 19, 28, 38, 48, 57, 67, 77]
 *     """
 *     return <long>nbits2ndec(prec_in_bits)             # <<<<<<<<<<<<<<
 * 
 * def prec_dec_to_bits(long prec_in_dec):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(((long)nbits2ndec(__pyx_v_prec_in_bits))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":327
 * #################################################################
 * 
 * def prec_bits_to_dec(long prec_in_bits):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in bits to precision expressed in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.prec_bits_to_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":342
 *     return <long>nbits2ndec(prec_in_bits)
 * 
 * def prec_dec_to_bits(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_13prec_dec_to_bits(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_dec); /*proto*/
static char __pyx_doc_6cypari_5_pari_12prec_dec_to_bits[] = "\n    Convert from precision expressed in decimal to precision expressed\n    in bits.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import prec_dec_to_bits\n        sage: prec_dec_to_bits(15)\n        50\n        sage: [prec_dec_to_bits(n) for n in range(10, 100, 10)]\n        [34, 67, 100, 133, 167, 200, 233, 266, 299]\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_13prec_dec_to_bits = {"prec_dec_to_bits", (PyCFunction)__pyx_pw_6cypari_5_pari_13prec_dec_to_bits, METH_O, __pyx_doc_6cypari_5_pari_12prec_dec_to_bits};
static PyObject *__pyx_pw_6cypari_5_pari_13prec_dec_to_bits(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_dec) {
  long __pyx_v_prec_in_dec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prec_dec_to_bits (wrapper)", 0);
  assert(__pyx_arg_prec_in_dec); {
    __pyx_v_prec_in_dec = __Pyx_PyInt_As_long(__pyx_arg_prec_in_dec); if (unlikely((__pyx_v_prec_in_dec == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 342, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.prec_dec_to_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_12prec_dec_to_bits(__pyx_self, ((long)__pyx_v_prec_in_dec));

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

static PyObject *__pyx_pf_6cypari_5_pari_12prec_dec_to_bits(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_dec) {
  double __pyx_v_log_10;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("prec_dec_to_bits", 0);

  /* "cypari/pari_instance.pyx":355
 *         [34, 67, 100, 133, 167, 200, 233, 266, 299]
 *     """
 *     cdef double log_10 = 3.32192809488736             # <<<<<<<<<<<<<<
 *     return int(prec_in_dec*log_10 + 1.0)  # Add one to round up
 * 
 */
  __pyx_v_log_10 = 3.32192809488736;

  /* "cypari/pari_instance.pyx":356
 *     """
 *     cdef double log_10 = 3.32192809488736
 *     return int(prec_in_dec*log_10 + 1.0)  # Add one to round up             # <<<<<<<<<<<<<<
 * 
 * cpdef long prec_bits_to_words(unsigned long prec_in_bits):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromDouble(((__pyx_v_prec_in_dec * __pyx_v_log_10) + 1.0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":342
 *     return <long>nbits2ndec(prec_in_bits)
 * 
 * def prec_dec_to_bits(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.prec_dec_to_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":358
 *     return int(prec_in_dec*log_10 + 1.0)  # Add one to round up
 * 
 * cpdef long prec_bits_to_words(unsigned long prec_in_bits):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in bits to pari real precision
 */

static PyObject *__pyx_pw_6cypari_5_pari_15prec_bits_to_words(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_bits); /*proto*/
static long __pyx_f_6cypari_5_pari_prec_bits_to_words(unsigned long __pyx_v_prec_in_bits, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_wordsize;
  long __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  unsigned long __pyx_t_2;
  __Pyx_RefNannySetupContext("prec_bits_to_words", 0);

  /* "cypari/pari_instance.pyx":378
 *         [(32, 3), (64, 3), (96, 4), (128, 4), (160, 5), (192, 5), (224, 6), (256, 6)] # 64-bit
 *     """
 *     if not prec_in_bits:             # <<<<<<<<<<<<<<
 *         return prec
 *     cdef unsigned long wordsize = BITS_IN_LONG
 */
  __pyx_t_1 = ((!(__pyx_v_prec_in_bits != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":379
 *     """
 *     if not prec_in_bits:
 *         return prec             # <<<<<<<<<<<<<<
 *     cdef unsigned long wordsize = BITS_IN_LONG
 * 
 */
    __pyx_r = __pyx_v_6cypari_5_pari_prec;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":378
 *         [(32, 3), (64, 3), (96, 4), (128, 4), (160, 5), (192, 5), (224, 6), (256, 6)] # 64-bit
 *     """
 *     if not prec_in_bits:             # <<<<<<<<<<<<<<
 *         return prec
 *     cdef unsigned long wordsize = BITS_IN_LONG
 */
  }

  /* "cypari/pari_instance.pyx":380
 *     if not prec_in_bits:
 *         return prec
 *     cdef unsigned long wordsize = BITS_IN_LONG             # <<<<<<<<<<<<<<
 * 
 *     # This equals ceil(prec_in_bits/wordsize) + 2
 */
  __pyx_v_wordsize = BITS_IN_LONG;

  /* "cypari/pari_instance.pyx":383
 * 
 *     # This equals ceil(prec_in_bits/wordsize) + 2
 *     return (prec_in_bits - 1)//wordsize + 3             # <<<<<<<<<<<<<<
 * 
 * cpdef long prec_words_to_bits(long prec_in_words):
 */
  __pyx_t_2 = (__pyx_v_prec_in_bits - 1);
  if (unlikely(__pyx_v_wordsize == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(3, 383, __pyx_L1_error)
  }
  __pyx_r = ((__pyx_t_2 / __pyx_v_wordsize) + 3);
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":358
 *     return int(prec_in_dec*log_10 + 1.0)  # Add one to round up
 * 
 * cpdef long prec_bits_to_words(unsigned long prec_in_bits):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in bits to pari real precision
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("cypari._pari.prec_bits_to_words", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_15prec_bits_to_words(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_bits); /*proto*/
static char __pyx_doc_6cypari_5_pari_14prec_bits_to_words[] = "\n    Convert from precision expressed in bits to pari real precision\n    expressed in words. Note: this rounds up to the nearest word,\n    adjusts for the two codewords of a pari real, and is\n    architecture-dependent.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import prec_bits_to_words\n        sage: prec_bits_to_words(70)\n        5   # 32-bit\n        4   # 64-bit\n\n    ::\n\n        sage: [(32*n, prec_bits_to_words(32*n)) for n in range(1, 9)]\n        [(32, 3), (64, 4), (96, 5), (128, 6), (160, 7), (192, 8), (224, 9), (256, 10)] # 32-bit\n        [(32, 3), (64, 3), (96, 4), (128, 4), (160, 5), (192, 5), (224, 6), (256, 6)] # 64-bit\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_15prec_bits_to_words(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_bits) {
  unsigned long __pyx_v_prec_in_bits;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prec_bits_to_words (wrapper)", 0);
  assert(__pyx_arg_prec_in_bits); {
    __pyx_v_prec_in_bits = __Pyx_PyInt_As_unsigned_long(__pyx_arg_prec_in_bits); if (unlikely((__pyx_v_prec_in_bits == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(3, 358, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.prec_bits_to_words", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_14prec_bits_to_words(__pyx_self, ((unsigned long)__pyx_v_prec_in_bits));

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

static PyObject *__pyx_pf_6cypari_5_pari_14prec_bits_to_words(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_prec_in_bits) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("prec_bits_to_words", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_prec_in_bits, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 358, __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("cypari._pari.prec_bits_to_words", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":385
 *     return (prec_in_bits - 1)//wordsize + 3
 * 
 * cpdef long prec_words_to_bits(long prec_in_words):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from pari real precision expressed in words to precision
 */

static PyObject *__pyx_pw_6cypari_5_pari_17prec_words_to_bits(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_words); /*proto*/
static long __pyx_f_6cypari_5_pari_prec_words_to_bits(long __pyx_v_prec_in_words, CYTHON_UNUSED int __pyx_skip_dispatch) {
  long __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prec_words_to_bits", 0);

  /* "cypari/pari_instance.pyx":402
 *     """
 *     # see user's guide to the pari library, page 10
 *     return (prec_in_words - 2) * BITS_IN_LONG             # <<<<<<<<<<<<<<
 * 
 * cpdef long default_bitprec(long bitprec=-1):
 */
  __pyx_r = ((__pyx_v_prec_in_words - 2) * BITS_IN_LONG);
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":385
 *     return (prec_in_bits - 1)//wordsize + 3
 * 
 * cpdef long prec_words_to_bits(long prec_in_words):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from pari real precision expressed in words to precision
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_17prec_words_to_bits(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_words); /*proto*/
static char __pyx_doc_6cypari_5_pari_16prec_words_to_bits[] = "\n    Convert from pari real precision expressed in words to precision\n    expressed in bits. Note: this adjusts for the two codewords of a\n    pari real, and is architecture-dependent.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import prec_words_to_bits\n        sage: prec_words_to_bits(10)\n        256   # 32-bit\n        512   # 64-bit\n        sage: [(n, prec_words_to_bits(n)) for n in range(3, 10)]\n        [(3, 32), (4, 64), (5, 96), (6, 128), (7, 160), (8, 192), (9, 224)]  # 32-bit\n        [(3, 64), (4, 128), (5, 192), (6, 256), (7, 320), (8, 384), (9, 448)] # 64-bit\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_17prec_words_to_bits(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_words) {
  long __pyx_v_prec_in_words;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prec_words_to_bits (wrapper)", 0);
  assert(__pyx_arg_prec_in_words); {
    __pyx_v_prec_in_words = __Pyx_PyInt_As_long(__pyx_arg_prec_in_words); if (unlikely((__pyx_v_prec_in_words == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 385, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.prec_words_to_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_16prec_words_to_bits(__pyx_self, ((long)__pyx_v_prec_in_words));

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

static PyObject *__pyx_pf_6cypari_5_pari_16prec_words_to_bits(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_words) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("prec_words_to_bits", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_6cypari_5_pari_prec_words_to_bits(__pyx_v_prec_in_words, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 385, __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("cypari._pari.prec_words_to_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":404
 *     return (prec_in_words - 2) * BITS_IN_LONG
 * 
 * cpdef long default_bitprec(long bitprec=-1):             # <<<<<<<<<<<<<<
 *     r"""
 *     Set the default precision in bits, or return the current value if no argument is
 */

static PyObject *__pyx_pw_6cypari_5_pari_19default_bitprec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static long __pyx_f_6cypari_5_pari_default_bitprec(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_6cypari_5_pari_default_bitprec *__pyx_optional_args) {
  long __pyx_v_bitprec = ((long)-1L);
  long __pyx_v_old_prec;
  long __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("default_bitprec", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_bitprec = __pyx_optional_args->bitprec;
    }
  }

  /* "cypari/pari_instance.pyx":417
 *     """
 *     global prec
 *     cdef long old_prec = prec             # <<<<<<<<<<<<<<
 *     if bitprec >= 0:
 *         prec = prec_bits_to_words(bitprec)
 */
  __pyx_v_old_prec = __pyx_v_6cypari_5_pari_prec;

  /* "cypari/pari_instance.pyx":418
 *     global prec
 *     cdef long old_prec = prec
 *     if bitprec >= 0:             # <<<<<<<<<<<<<<
 *         prec = prec_bits_to_words(bitprec)
 *     return (old_prec - 2) * BITS_IN_LONG
 */
  __pyx_t_1 = ((__pyx_v_bitprec >= 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":419
 *     cdef long old_prec = prec
 *     if bitprec >= 0:
 *         prec = prec_bits_to_words(bitprec)             # <<<<<<<<<<<<<<
 *     return (old_prec - 2) * BITS_IN_LONG
 * 
 */
    __pyx_v_6cypari_5_pari_prec = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_bitprec, 0);

    /* "cypari/pari_instance.pyx":418
 *     global prec
 *     cdef long old_prec = prec
 *     if bitprec >= 0:             # <<<<<<<<<<<<<<
 *         prec = prec_bits_to_words(bitprec)
 *     return (old_prec - 2) * BITS_IN_LONG
 */
  }

  /* "cypari/pari_instance.pyx":420
 *     if bitprec >= 0:
 *         prec = prec_bits_to_words(bitprec)
 *     return (old_prec - 2) * BITS_IN_LONG             # <<<<<<<<<<<<<<
 * 
 * def prec_dec_to_words(long prec_in_dec):
 */
  __pyx_r = ((__pyx_v_old_prec - 2) * BITS_IN_LONG);
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":404
 *     return (prec_in_words - 2) * BITS_IN_LONG
 * 
 * cpdef long default_bitprec(long bitprec=-1):             # <<<<<<<<<<<<<<
 *     r"""
 *     Set the default precision in bits, or return the current value if no argument is
 */

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

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_19default_bitprec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_18default_bitprec[] = "\n    Set the default precision in bits, or return the current value if no argument is\n    supplied.  WARNING: The value will be rounded up to the nearest multiple of the\n    pari word size (32 or 64 bits).\n\n    EXAMPLES::\n\n        sage: from cypari._pari import default_bitprec\n        sage: default_bitprec()\n        64\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_19default_bitprec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_bitprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default_bitprec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bitprec,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bitprec);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default_bitprec") < 0)) __PYX_ERR(3, 404, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_bitprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_bitprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 404, __pyx_L3_error)
    } else {
      __pyx_v_bitprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default_bitprec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 404, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.default_bitprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_18default_bitprec(__pyx_self, __pyx_v_bitprec);

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

static PyObject *__pyx_pf_6cypari_5_pari_18default_bitprec(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_bitprec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  struct __pyx_opt_args_6cypari_5_pari_default_bitprec __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("default_bitprec", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.bitprec = __pyx_v_bitprec;
  __pyx_t_1 = __pyx_f_6cypari_5_pari_default_bitprec(0, &__pyx_t_2); 
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.default_bitprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":422
 *     return (old_prec - 2) * BITS_IN_LONG
 * 
 * def prec_dec_to_words(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_21prec_dec_to_words(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_dec); /*proto*/
static char __pyx_doc_6cypari_5_pari_20prec_dec_to_words[] = "\n    Convert from precision expressed in decimal to precision expressed\n    in words. Note: this rounds up to the nearest word, adjusts for the\n    two codewords of a pari real, and is architecture-dependent.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import prec_dec_to_words\n        sage: prec_dec_to_words(38)\n        6   # 32-bit\n        4   # 64-bit\n        sage: [(n, prec_dec_to_words(n)) for n in range(10, 90, 10)]\n        [(10, 4), (20, 5), (30, 6), (40, 7), (50, 8), (60, 9), (70, 10), (80, 11)] # 32-bit\n        [(10, 3), (20, 4), (30, 4), (40, 5), (50, 5), (60, 6), (70, 6), (80, 7)] # 64-bit\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_21prec_dec_to_words = {"prec_dec_to_words", (PyCFunction)__pyx_pw_6cypari_5_pari_21prec_dec_to_words, METH_O, __pyx_doc_6cypari_5_pari_20prec_dec_to_words};
static PyObject *__pyx_pw_6cypari_5_pari_21prec_dec_to_words(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_dec) {
  long __pyx_v_prec_in_dec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prec_dec_to_words (wrapper)", 0);
  assert(__pyx_arg_prec_in_dec); {
    __pyx_v_prec_in_dec = __Pyx_PyInt_As_long(__pyx_arg_prec_in_dec); if (unlikely((__pyx_v_prec_in_dec == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 422, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.prec_dec_to_words", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_20prec_dec_to_words(__pyx_self, ((long)__pyx_v_prec_in_dec));

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

static PyObject *__pyx_pf_6cypari_5_pari_20prec_dec_to_words(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_dec) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned long __pyx_t_5;
  __Pyx_RefNannySetupContext("prec_dec_to_words", 0);

  /* "cypari/pari_instance.pyx":438
 *         [(10, 3), (20, 4), (30, 4), (40, 5), (50, 5), (60, 6), (70, 6), (80, 7)] # 64-bit
 *     """
 *     return prec_bits_to_words(prec_dec_to_bits(prec_in_dec))             # <<<<<<<<<<<<<<
 * 
 * def prec_words_to_dec(long prec_in_words):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prec_dec_to_bits); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_prec_in_dec); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_unsigned_long(__pyx_t_1); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(3, 438, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":422
 *     return (old_prec - 2) * BITS_IN_LONG
 * 
 * def prec_dec_to_words(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */

  /* 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("cypari._pari.prec_dec_to_words", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":440
 *     return prec_bits_to_words(prec_dec_to_bits(prec_in_dec))
 * 
 * def prec_words_to_dec(long prec_in_words):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in words to precision expressed in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_23prec_words_to_dec(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_words); /*proto*/
static char __pyx_doc_6cypari_5_pari_22prec_words_to_dec[] = "\n    Convert from precision expressed in words to precision expressed in\n    decimal. Note: this adjusts for the two codewords of a pari real,\n    and is architecture-dependent.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import prec_words_to_dec\n        sage: prec_words_to_dec(5)\n        28   # 32-bit\n        57   # 64-bit\n        sage: [(n, prec_words_to_dec(n)) for n in range(3, 10)]\n        [(3, 9), (4, 19), (5, 28), (6, 38), (7, 48), (8, 57), (9, 67)] # 32-bit\n        [(3, 19), (4, 38), (5, 57), (6, 77), (7, 96), (8, 115), (9, 134)] # 64-bit\n    ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_23prec_words_to_dec = {"prec_words_to_dec", (PyCFunction)__pyx_pw_6cypari_5_pari_23prec_words_to_dec, METH_O, __pyx_doc_6cypari_5_pari_22prec_words_to_dec};
static PyObject *__pyx_pw_6cypari_5_pari_23prec_words_to_dec(PyObject *__pyx_self, PyObject *__pyx_arg_prec_in_words) {
  long __pyx_v_prec_in_words;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prec_words_to_dec (wrapper)", 0);
  assert(__pyx_arg_prec_in_words); {
    __pyx_v_prec_in_words = __Pyx_PyInt_As_long(__pyx_arg_prec_in_words); if (unlikely((__pyx_v_prec_in_words == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 440, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.prec_words_to_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_22prec_words_to_dec(__pyx_self, ((long)__pyx_v_prec_in_words));

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

static PyObject *__pyx_pf_6cypari_5_pari_22prec_words_to_dec(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_prec_in_words) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("prec_words_to_dec", 0);

  /* "cypari/pari_instance.pyx":456
 *         [(3, 19), (4, 38), (5, 57), (6, 77), (7, 96), (8, 115), (9, 134)] # 64-bit
 *     """
 *     return prec_bits_to_dec(prec_words_to_bits(prec_in_words))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prec_bits_to_dec); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_f_6cypari_5_pari_prec_words_to_bits(__pyx_v_prec_in_words, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":440
 *     return prec_bits_to_words(prec_dec_to_bits(prec_in_dec))
 * 
 * def prec_words_to_dec(long prec_in_words):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in words to precision expressed in
 */

  /* 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("cypari._pari.prec_words_to_dec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":463
 * cdef PariOUT sage_pariOut
 * 
 * cdef void sage_putchar(char c):             # <<<<<<<<<<<<<<
 *     cdef char s[2]
 *     s[0] = c
 */

static void __pyx_f_6cypari_5_pari_sage_putchar(char __pyx_v_c) {
  char __pyx_v_s[2];
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("sage_putchar", 0);

  /* "cypari/pari_instance.pyx":465
 * cdef void sage_putchar(char c):
 *     cdef char s[2]
 *     s[0] = c             # <<<<<<<<<<<<<<
 *     s[1] = 0
 *     sys.stdout.write(String(s))
 */
  (__pyx_v_s[0]) = __pyx_v_c;

  /* "cypari/pari_instance.pyx":466
 *     cdef char s[2]
 *     s[0] = c
 *     s[1] = 0             # <<<<<<<<<<<<<<
 *     sys.stdout.write(String(s))
 *     # Let PARI think the last character was a newline,
 */
  (__pyx_v_s[1]) = 0;

  /* "cypari/pari_instance.pyx":467
 *     s[0] = c
 *     s[1] = 0
 *     sys.stdout.write(String(s))             # <<<<<<<<<<<<<<
 *     # Let PARI think the last character was a newline,
 *     # so it doesn't print one when an error occurs.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_6cypari_5_pari_String(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":470
 *     # Let PARI think the last character was a newline,
 *     # so it doesn't print one when an error occurs.
 *     pari_set_last_newline(1)             # <<<<<<<<<<<<<<
 * 
 * cdef void sage_puts(const char* s):
 */
  pari_set_last_newline(1);

  /* "cypari/pari_instance.pyx":463
 * cdef PariOUT sage_pariOut
 * 
 * cdef void sage_putchar(char c):             # <<<<<<<<<<<<<<
 *     cdef char s[2]
 *     s[0] = c
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("cypari._pari.sage_putchar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "cypari/pari_instance.pyx":472
 *     pari_set_last_newline(1)
 * 
 * cdef void sage_puts(const char* s):             # <<<<<<<<<<<<<<
 *     sys.stdout.write(String(s))
 *     pari_set_last_newline(1)
 */

static void __pyx_f_6cypari_5_pari_sage_puts(char const *__pyx_v_s) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("sage_puts", 0);

  /* "cypari/pari_instance.pyx":473
 * 
 * cdef void sage_puts(const char* s):
 *     sys.stdout.write(String(s))             # <<<<<<<<<<<<<<
 *     pari_set_last_newline(1)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __pyx_f_6cypari_5_pari_String(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":474
 * cdef void sage_puts(const char* s):
 *     sys.stdout.write(String(s))
 *     pari_set_last_newline(1)             # <<<<<<<<<<<<<<
 * 
 * cdef void sage_flush():
 */
  pari_set_last_newline(1);

  /* "cypari/pari_instance.pyx":472
 *     pari_set_last_newline(1)
 * 
 * cdef void sage_puts(const char* s):             # <<<<<<<<<<<<<<
 *     sys.stdout.write(String(s))
 *     pari_set_last_newline(1)
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("cypari._pari.sage_puts", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "cypari/pari_instance.pyx":476
 *     pari_set_last_newline(1)
 * 
 * cdef void sage_flush():             # <<<<<<<<<<<<<<
 *     sys.stdout.flush()
 * 
 */

static void __pyx_f_6cypari_5_pari_sage_flush(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sage_flush", 0);

  /* "cypari/pari_instance.pyx":477
 * 
 * cdef void sage_flush():
 *     sys.stdout.flush()             # <<<<<<<<<<<<<<
 * 
 * cdef void swallow_ch(char ch):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stdout); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_flush); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 477, __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_1 = (__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_1)) __PYX_ERR(3, 477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":476
 *     pari_set_last_newline(1)
 * 
 * cdef void sage_flush():             # <<<<<<<<<<<<<<
 *     sys.stdout.flush()
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("cypari._pari.sage_flush", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "cypari/pari_instance.pyx":479
 *     sys.stdout.flush()
 * 
 * cdef void swallow_ch(char ch):             # <<<<<<<<<<<<<<
 *     return
 * 
 */

static void __pyx_f_6cypari_5_pari_swallow_ch(CYTHON_UNUSED char __pyx_v_ch) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("swallow_ch", 0);

  /* "cypari/pari_instance.pyx":480
 * 
 * cdef void swallow_ch(char ch):
 *     return             # <<<<<<<<<<<<<<
 * 
 * cdef void swallow_s(const char* s):
 */
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":479
 *     sys.stdout.flush()
 * 
 * cdef void swallow_ch(char ch):             # <<<<<<<<<<<<<<
 *     return
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "cypari/pari_instance.pyx":482
 *     return
 * 
 * cdef void swallow_s(const char* s):             # <<<<<<<<<<<<<<
 *     return
 * 
 */

static void __pyx_f_6cypari_5_pari_swallow_s(CYTHON_UNUSED char const *__pyx_v_s) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("swallow_s", 0);

  /* "cypari/pari_instance.pyx":483
 * 
 * cdef void swallow_s(const char* s):
 *     return             # <<<<<<<<<<<<<<
 * 
 * include 'auto_instance.pxi'
 */
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":482
 *     return
 * 
 * cdef void swallow_s(const char* s):             # <<<<<<<<<<<<<<
 *     return
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "cypari/auto_instance.pxi":10
 *     if you do), use the derived class :class:`Pari` instead.
 *     """
 *     def Catalan(self, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Catalan's constant :math:`G = \sum_{n >= 0}((-1)^n)/((2n+1)^2) = 0.91596...`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1Catalan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_Catalan[] = "\n        Catalan's constant :math:`G = \\sum_{n >= 0}((-1)^n)/((2n+1)^2) = 0.91596...`.\n        Note that :literal:`Catalan` is one of the few reserved names which cannot be\n        used for user variables.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1Catalan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Catalan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Catalan") < 0)) __PYX_ERR(4, 10, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Catalan", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Catalan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_Catalan(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_Catalan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Catalan", 0);

  /* "cypari/auto_instance.pxi":16
 *         used for user variables.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpcatalan(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 16, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mpcatalan(precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":18
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpcatalan(precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mpcatalan(__pyx_v_precision);

  /* "cypari/auto_instance.pxi":19
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpcatalan(precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Col(self, x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10
 *     if you do), use the derived class :class:`Pari` instead.
 *     """
 *     def Catalan(self, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Catalan's constant :math:`G = \sum_{n >= 0}((-1)^n)/((2n+1)^2) = 0.91596...`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Catalan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21
 *         return new_gen(_ret)
 * 
 *     def Col(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a column vector. The dimension of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_3Col(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_2Col[] = "\n        Transforms the object :math:`x` into a column vector. The dimension of the\n        resulting vector can be optionally specified via the extra parameter :math:`n`.\n        \n        If :math:`n` is omitted or :math:`0`, the dimension depends on the type of :math:`x`; the\n        vector has a single component, except when :math:`x` is\n        \n        - a vector or a quadratic form (in which case the resulting vector\n          is simply the initial object considered as a row vector),\n        \n        - a polynomial or a power series. In the case of a polynomial, the\n          coefficients of the vector start with the leading coefficient of the\n          polynomial, while for power series only the significant coefficients are\n          taken into account, but this time by increasing order of degree.\n          In this last case, :literal:`Vec` is the reciprocal function of :literal:`Pol` and\n          :literal:`Ser` respectively,\n        \n        - a matrix (the column of row vector comprising the matrix is returned),\n        \n        - a character string (a vector of individual characters is returned).\n        \n        In the last two cases (matrix and character string), :math:`n` is meaningless and\n        must be omitted or an error is raised. Otherwise, if :math:`n` is given, :math:`0`\n        entries are appended at the end of the vector if :math:`n > 0`, and prepended at\n        the beginning if :math:`n < 0`. The dimension of the resulting vector is :math:`\\|n\\|`.\n        \n        See \077\077Vec for examples.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_3Col(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Col (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Col") < 0)) __PYX_ERR(4, 21, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 21, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Col", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Col", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_2Col(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_2Col(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Col", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":50
 *         See ??Vec for examples.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":51
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocol0(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 51, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":52
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtocol0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":53
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocol0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtocol0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":54
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocol0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Colrev(self, x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21
 *         return new_gen(_ret)
 * 
 *     def Col(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a column vector. The dimension of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Col", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":56
 *         return new_gen(_ret)
 * 
 *     def Colrev(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Col (x, -n)`, then reverse the result. In particular,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_5Colrev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_4Colrev[] = "\n        As :math:`Col (x, -n)`, then reverse the result. In particular,\n        :literal:`Colrev` is the reciprocal function of :literal:`Polrev`: the\n        coefficients of the vector start with the constant coefficient of the\n        polynomial and the others follow by increasing degree.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_5Colrev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Colrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Colrev") < 0)) __PYX_ERR(4, 56, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 56, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Colrev", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 56, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Colrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_4Colrev(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_4Colrev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Colrev", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":63
 *         polynomial and the others follow by increasing degree.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":64
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocolrev0(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 64, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":65
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtocolrev0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":66
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocolrev0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtocolrev0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":67
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocolrev0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Euler(self, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":56
 *         return new_gen(_ret)
 * 
 *     def Colrev(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Col (x, -n)`, then reverse the result. In particular,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Colrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":69
 *         return new_gen(_ret)
 * 
 *     def Euler(self, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Euler's constant :math:`\gamma = 0.57721...`. Note that
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_7Euler(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_6Euler[] = "\n        Euler's constant :math:`\\gamma = 0.57721...`. Note that\n        :literal:`Euler` is one of the few reserved names which cannot be used for\n        user variables.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_7Euler(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Euler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Euler") < 0)) __PYX_ERR(4, 69, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 69, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Euler", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 69, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Euler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_6Euler(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_6Euler(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Euler", 0);

  /* "cypari/auto_instance.pxi":75
 *         user variables.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpeuler(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 75, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":76
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mpeuler(precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":77
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpeuler(precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mpeuler(__pyx_v_precision);

  /* "cypari/auto_instance.pxi":78
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpeuler(precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def I(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":69
 *         return new_gen(_ret)
 * 
 *     def Euler(self, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Euler's constant :math:`\gamma = 0.57721...`. Note that
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Euler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":80
 *         return new_gen(_ret)
 * 
 *     def I(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         The complex number :math:`\sqrt{-1}`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_9I(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_8I[] = "\n        The complex number :math:`\\sqrt{-1}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_9I(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("I (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_8I(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_8I(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("I", 0);

  /* "cypari/auto_instance.pxi":84
 *         The complex number :math:`\sqrt{-1}`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gen_I()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 84, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":85
 *         '''
 *         sig_on()
 *         cdef GEN _ret = gen_I()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gen_I();

  /* "cypari/auto_instance.pxi":86
 *         sig_on()
 *         cdef GEN _ret = gen_I()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def List(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":80
 *         return new_gen(_ret)
 * 
 *     def I(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         The complex number :math:`\sqrt{-1}`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.I", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":88
 *         return new_gen(_ret)
 * 
 *     def List(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms a (row or column) vector :math:`x` into a list, whose components are
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_11List(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_10List[] = "\n        Transforms a (row or column) vector :math:`x` into a list, whose components are\n        the entries of :math:`x`. Similarly for a list, but rather useless in this case.\n        For other types, creates a list with the single element :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_11List(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("List (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "List") < 0)) __PYX_ERR(4, 88, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("List", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 88, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.List", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_10List(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_10List(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("List", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":94
 *         For other types, creates a list with the single element :math:`x`.
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":95
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":96
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":95
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":97
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 97, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":98
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":99
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtolist(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":100
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtolist(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":99
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtolist(_x)
 */
  }

  /* "cypari/auto_instance.pxi":101
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtolist(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtolist(__pyx_v__x);

  /* "cypari/auto_instance.pxi":102
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtolist(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Map(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":88
 *         return new_gen(_ret)
 * 
 *     def List(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms a (row or column) vector :math:`x` into a list, whose components are
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.List", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":104
 *         return new_gen(_ret)
 * 
 *     def Map(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         A "Map" is an associative array, or dictionary: a data
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_13Map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_12Map[] = "\n        A \"Map\" is an associative array, or dictionary: a data\n        type composed of a collection of (:emphasis:`key`, :emphasis:`value`) pairs, such that\n        each key appears just once in the collection. This function\n        converts the matrix :math:`[a_1,b_1;a_2,b_2;...;a_n,b_n]` to the map :math:`a_i:--->\n        b_i`.\n        \n        ::\n        \n            ? M = Map(factor(13!));\n            ? mapget(M,3)\n            %2 = 5\n        \n        If the argument :math:`x` is omitted, creates an empty map, which\n        may be filled later via :literal:`mapput`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_13Map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Map (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Map") < 0)) __PYX_ERR(4, 104, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Map", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 104, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_12Map(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_12Map(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("Map", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":121
 *         may be filled later via :literal:`mapput`.
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":122
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":123
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":122
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":124
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 124, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":125
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":126
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomap(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":127
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtomap(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":126
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomap(_x)
 */
  }

  /* "cypari/auto_instance.pxi":128
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomap(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtomap(__pyx_v__x);

  /* "cypari/auto_instance.pxi":129
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomap(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Mat(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":104
 *         return new_gen(_ret)
 * 
 *     def Map(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         A "Map" is an associative array, or dictionary: a data
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":131
 *         return new_gen(_ret)
 * 
 *     def Mat(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_15Mat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_14Mat[] = "\n        Transforms the object :math:`x` into a matrix.\n        If :math:`x` is already a matrix, a copy of :math:`x` is created.\n        If :math:`x` is a row (resp. column) vector, this creates a 1-row (resp.\n        1-column) matrix, :emphasis:`unless` all elements are column (resp.\302\240row) vectors\n        of the same length, in which case the vectors are concatenated sideways\n        and the attached big matrix is returned.\n        If :math:`x` is a binary quadratic form, creates the attached :math:`2 x 2`\n        matrix. Otherwise, this creates a :math:`1 x 1` matrix containing :math:`x`.\n        \n        ::\n        \n            ? Mat(x + 1)\n            %1 =\n            [x + 1]\n            ? Vec( matid(3) )\n            %2 = [[1, 0, 0]~, [0, 1, 0]~, [0, 0, 1]~]\n            ? Mat(%)\n            %3 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? Col( [1,2; 3,4] )\n            %4 = [[1, 2], [3, 4]]~\n            ? Mat(%)\n            %5 =\n            [1 2]\n            \n            [3 4]\n            ? Mat(Qfb(1,2,3))\n            %6 =\n            [1 1]\n            \n            [1 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_15Mat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Mat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Mat") < 0)) __PYX_ERR(4, 131, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Mat", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 131, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Mat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_14Mat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_14Mat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("Mat", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":169
 *             [1 3]
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":170
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":171
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 171, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":170
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":172
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 172, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":173
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":174
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomat(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":175
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtomat(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":174
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomat(_x)
 */
  }

  /* "cypari/auto_instance.pxi":176
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomat(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtomat(__pyx_v__x);

  /* "cypari/auto_instance.pxi":177
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtomat(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Mod(self, a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":131
 *         return new_gen(_ret)
 * 
 *     def Mat(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Mat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":179
 *         return new_gen(_ret)
 * 
 *     def Mod(self, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         In its basic form, creates an intmod or a polmod :math:`(a mod b)`; :math:`b` must
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_17Mod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_16Mod[] = "\n        In its basic form, creates an intmod or a polmod :math:`(a mod b)`; :math:`b` must\n        be an integer or a polynomial. We then obtain a :literal:`t_INTMOD` and a\n        :literal:`t_POLMOD` respectively:\n        \n        ::\n        \n            ? t = Mod(2,17); t^8\n            %1 = Mod(1, 17)\n            ? t = Mod(x,x^2+1); t^2\n            %2 = Mod(-1, x^2+1)\n        \n        If :math:`a \\% b` makes sense and yields a result of the\n        appropriate type (:literal:`t_INT` or scalar/:literal:`t_POL`), the operation succeeds as\n        well:\n        \n        ::\n        \n            ? Mod(1/2, 5)\n            %3 = Mod(3, 5)\n            ? Mod(7 + O(3^6), 3)\n            %4 = Mod(1, 3)\n            ? Mod(Mod(1,12), 9)\n            %5 = Mod(1, 3)\n            ? Mod(1/x, x^2+1)\n            %6 = Mod(-1, x^2+1)\n            ? Mod(exp(x), x^4)\n            %7 = Mod(1/6*x^3 + 1/2*x^2 + x + 1, x^4)\n        \n        If :math:`a` is a complex object, \"base change\" it to :math:`\\mathbb{Z}/b\\mathbb{Z}` or :math:`K[x]/(b)`,\n        which is equivalent to, but faster than, multiplying it by :literal:`Mod(1,b)`:\n        \n        ::\n        \n            ? Mod([1,2;3,4], 2)\n            %8 =\n            [Mod(1, 2) Mod(0, 2)]\n            \n            [Mod(1, 2) Mod(0, 2)]\n            ? Mod(3*x+5, 2)\n            %9 = Mod(1, 2)*x + Mod(1, 2)\n            ? Mod(x^2 + y*x + y^3, y^2+1)\n            %10 = Mod(1, y^2 + 1)*x^2 + Mod(y, y^2 + 1)*x + Mod(-y, y^2 + 1)\n        \n        This function is not the same as :math:`x` :literal:`\\%` :math:`y`, the result of which\n        has no knowledge of the intended modulus :math:`y`. Compare\n        \n        ::\n        \n            ? x = 4 % 5; x + 1\n            %1 = 5\n            ? x = Mod(4,5); x + 1\n            %2 = Mod(0,5)\n        \n        Note that such \"modular\" objects can be lifted via :literal:`lift` or\n        :literal:`centerlift`. The modulus of a :literal:`t_INTMOD` or :l""iteral:`t_POLMOD` :math:`z` can\n        be recovered via :literal:`:math:`z`.mod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_17Mod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Mod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Mod", 1, 2, 2, 1); __PYX_ERR(4, 179, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Mod") < 0)) __PYX_ERR(4, 179, __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_a = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Mod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 179, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Mod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_16Mod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_16Mod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Mod", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":238
 *         be recovered via :literal:`:math:`z`.mod`.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":239
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":240
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 240, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":241
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = gmodulo(_a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":242
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmodulo(_a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":243
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = gmodulo(_a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmodulo(__pyx_v__a, __pyx_v__b);

  /* "cypari/auto_instance.pxi":244
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = gmodulo(_a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Pi(self, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":179
 *         return new_gen(_ret)
 * 
 *     def Mod(self, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         In its basic form, creates an intmod or a polmod :math:`(a mod b)`; :math:`b` must
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Mod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":246
 *         return new_gen(_ret)
 * 
 *     def Pi(self, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The constant :math:`\pi` (:math:`3.14159...`). Note that :literal:`Pi` is one of the few
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_19Pi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_18Pi[] = "\n        The constant :math:`\\pi` (:math:`3.14159...`). Note that :literal:`Pi` is one of the few\n        reserved names which cannot be used for user variables.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_19Pi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Pi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Pi") < 0)) __PYX_ERR(4, 246, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 246, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Pi", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 246, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_18Pi(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_18Pi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Pi", 0);

  /* "cypari/auto_instance.pxi":251
 *         reserved names which cannot be used for user variables.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mppi(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 251, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":252
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mppi(precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":253
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mppi(precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mppi(__pyx_v_precision);

  /* "cypari/auto_instance.pxi":254
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mppi(precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Pol(self, t, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":246
 *         return new_gen(_ret)
 * 
 *     def Pi(self, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The constant :math:`\pi` (:math:`3.14159...`). Note that :literal:`Pi` is one of the few
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Pi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":256
 *         return new_gen(_ret)
 * 
 *     def Pol(self, t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`t` into a polynomial with main variable :math:`v`. If :math:`t`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_21Pol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_20Pol[] = "\n        Transforms the object :math:`t` into a polynomial with main variable :math:`v`. If :math:`t`\n        is a scalar, this gives a constant polynomial. If :math:`t` is a power series with\n        non-negative valuation or a rational function, the effect is similar to\n        :literal:`truncate`, i.e.\302\240we chop off the :math:`O(X^k)` or compute the Euclidean\n        quotient of the numerator by the denominator, then change the main variable\n        of the result to :math:`v`.\n        \n        The main use of this function is when :math:`t` is a vector: it creates the\n        polynomial whose coefficients are given by :math:`t`, with :math:`t[1]` being the leading\n        coefficient (which can be zero). It is much faster to evaluate\n        :literal:`Pol` on a vector of coefficients in this way, than the corresponding\n        formal expression :math:`a_n X^n +...+ a_0`, which is evaluated naively exactly\n        as written (linear versus quadratic time in :math:`n`). :literal:`Polrev` can be used if\n        one wants :math:`x[1]` to be the constant coefficient:\n        \n        ::\n        \n            ? Pol([1,2,3])\n            %1 = x^2 + 2*x + 3\n            ? Polrev([1,2,3])\n            %2 = 3*x^2 + 2*x + 1\n        \n        The reciprocal function of :literal:`Pol` (resp.\302\240:literal:`Polrev`) is :literal:`Vec` (resp.\302\240\n        :literal:`Vecrev`).\n        \n        ::\n        \n            ? Vec(Pol([1,2,3]))\n            %1 = [1, 2, 3]\n            ? Vecrev( Polrev([1,2,3]) )\n            %2 = [1, 2, 3]\n        \n        :strong:`Warning.` This is :emphasis:`not` a substitution function. It will not\n        transform an object containing variables of higher priority than\302\240:math:`v`.\n        \n        ::\n        \n            ? Pol(x + y, y)\n             *** at top-level: Pol(x+y,y)\n             *** ^----------\n             *** Pol: variable must have higher priority in gtopoly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_21Pol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Pol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Pol") < 0)) __PYX_ERR(4, 256, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_t = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Pol", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Pol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_20Pol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_t, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_20Pol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("Pol", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":300
 *              *** Pol: variable must have higher priority in gtopoly.
 *         '''
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":301
 *         '''
 *         t = objtogen(t)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":302
 *         t = objtogen(t)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":303
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 303, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":302
 *         t = objtogen(t)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":304
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopoly(_t, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 304, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":305
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtopoly(_t, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_6;

  /* "cypari/auto_instance.pxi":306
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopoly(_t, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtopoly(__pyx_v__t, __pyx_v__v);

  /* "cypari/auto_instance.pxi":307
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopoly(_t, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Polrev(self, t, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":256
 *         return new_gen(_ret)
 * 
 *     def Pol(self, t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`t` into a polynomial with main variable :math:`v`. If :math:`t`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Pol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":309
 *         return new_gen(_ret)
 * 
 *     def Polrev(self, t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transform the object :math:`t` into a polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_23Polrev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_22Polrev[] = "\n        Transform the object :math:`t` into a polynomial\n        with main variable :math:`v`. If :math:`t` is a scalar, this gives a constant polynomial.\n        If :math:`t` is a power series, the effect is identical to :literal:`truncate`, i.e.\302\240it\n        chops off the :math:`O(X^k)`.\n        \n        The main use of this function is when :math:`t` is a vector: it creates the\n        polynomial whose coefficients are given by :math:`t`, with :math:`t[1]` being the\n        constant term. :literal:`Pol` can be used if one wants :math:`t[1]` to be the leading\n        coefficient:\n        \n        ::\n        \n            ? Polrev([1,2,3])\n            %1 = 3*x^2 + 2*x + 1\n            ? Pol([1,2,3])\n            %2 = x^2 + 2*x + 3\n        \n        The reciprocal function of :literal:`Pol` (resp.\302\240:literal:`Polrev`) is :literal:`Vec` (resp.\302\240\n        :literal:`Vecrev`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_23Polrev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Polrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Polrev") < 0)) __PYX_ERR(4, 309, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_t = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Polrev", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 309, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Polrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_22Polrev(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_t, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_22Polrev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_t, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("Polrev", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":331
 *         :literal:`Vecrev`).
 *         '''
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":332
 *         '''
 *         t = objtogen(t)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":333
 *         t = objtogen(t)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":334
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 334, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":333
 *         t = objtogen(t)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":335
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopolyrev(_t, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 335, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":336
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtopolyrev(_t, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_6;

  /* "cypari/auto_instance.pxi":337
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopolyrev(_t, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtopolyrev(__pyx_v__t, __pyx_v__v);

  /* "cypari/auto_instance.pxi":338
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopolyrev(_t, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Qfb(self, a, b, c, D=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":309
 *         return new_gen(_ret)
 * 
 *     def Polrev(self, t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transform the object :math:`t` into a polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Polrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":340
 *         return new_gen(_ret)
 * 
 *     def Qfb(self, a, b, c, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the binary quadratic form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_25Qfb(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_24Qfb[] = "\n        Creates the binary quadratic form\n        :math:`ax^2+bxy+cy^2`. If :math:`b^2-4ac > 0`, initialize Shanks' distance\n        function to :math:`D`. Negative definite forms are not implemented,\n        use their positive definite counterpart instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_25Qfb(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_c = 0;
  PyObject *__pyx_v_D = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Qfb (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_c,&__pyx_n_s_D,&__pyx_n_s_precision,0};
    PyObject* values[5] = {0,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  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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Qfb", 0, 3, 5, 1); __PYX_ERR(4, 340, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Qfb", 0, 3, 5, 2); __PYX_ERR(4, 340, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          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_precision);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Qfb") < 0)) __PYX_ERR(4, 340, __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);
        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_a = values[0];
    __pyx_v_b = values[1];
    __pyx_v_c = values[2];
    __pyx_v_D = values[3];
    if (values[4]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 340, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Qfb", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 340, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Qfb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_24Qfb(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_D, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_24Qfb(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_D, long __pyx_v_precision) {
  int __pyx_v__have_D;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__c;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("Qfb", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_c);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":347
 *         use their positive definite counterpart instead.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         c = objtogen(c)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":348
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":349
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         c = objtogen(c)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":350
 *         b = objtogen(b)
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":351
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":352
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":351
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":353
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 353, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":354
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _c = (<Gen>c).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_instance.pxi":355
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_4;

  /* "cypari/auto_instance.pxi":356
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _c = (<Gen>c).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c)->__pyx_base.g;
  __pyx_v__c = __pyx_t_4;

  /* "cypari/auto_instance.pxi":357
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":358
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":359
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":358
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":360
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":361
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = Qfb0(__pyx_v__a, __pyx_v__b, __pyx_v__c, __pyx_v__D, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":362
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Ser(self, s, v=None, d=None, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":340
 *         return new_gen(_ret)
 * 
 *     def Qfb(self, a, b, c, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the binary quadratic form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Qfb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":364
 *         return new_gen(_ret)
 * 
 *     def Ser(self, s, v=None, d=None, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`s` into a power series with main variable :math:`v`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_27Ser(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_26Ser[] = "\n        Transforms the object :math:`s` into a power series with main variable :math:`v`\n        (:math:`x` by default) and precision (number of significant terms) equal to\n        :math:`d >= 0` (:math:`d = seriesprecision` by default). If :math:`s` is a\n        scalar, this gives a constant power series in :math:`v` with precision :literal:`d`.\n        If :math:`s` is a polynomial, the polynomial is truncated to :math:`d` terms if needed\n        \n        ::\n        \n            ? \\ps\n             seriesprecision = 16 significant terms\n            ? Ser(1) \\\\ 16 terms by default\n            %1 = 1 + O(x^16)\n            ? Ser(1, 'y, 5)\n            %2 = 1 + O(y^5)\n            ? Ser(x^2,, 5)\n            %3 = x^2 + O(x^7)\n            ? T = polcyclo(100)\n            %4 = x^40 - x^30 + x^20 - x^10 + 1\n            ? Ser(T, 'x, 11)\n            %5 = 1 - x^10 + O(x^11)\n        \n        The function is more or less equivalent with multiplication by\n        :math:`1 + O(v^d)` in theses cases, only faster.\n        \n        For the remaining types, vectors and power series, we first explain what\n        occurs if :math:`d` is omitted. In this case, the function uses exactly the amount\n        of information given in the input:\n        \n        - If :math:`s` is already a power series in :math:`v`, we return it verbatim;\n        \n        - If :math:`s` is a vector, the coefficients of the vector are\n          understood to be the coefficients of the power series starting from the\n          constant term (as in :literal:`Polrev`:math:`(x)`); in other words we convert\n          :literal:`t_VEC` / :literal:`t_COL` to the power series whose significant terms are exactly\n          given by the vector entries.\n        \n        On the other hand, if :math:`d` is explicitly given, we abide by its value\n        and return a series, truncated or extended with zeros as needed, with\n        :math:`d` significant terms.\n        \n        ::\n       "" \n            ? v = [1,2,3];\n            ? Ser(v, t) \\\\ 3 terms: seriesprecision is ignored!\n            %7 = 1 + 2*t + 3*t^2 + O(t^3)\n            ? Ser(v, t, 7) \\\\ 7 terms as explicitly requested\n            %8 = 1 + 2*t + 3*t^2 + O(t^7)\n            ? s = 1+x+O(x^2);\n            ? Ser(s)\n            %10 = 1 + x + O(x^2) \\\\ 2 terms: seriesprecision is ignored\n            ? Ser(s, x, 7) \\\\ extend to 7 terms\n            %11 = 1 + x + O(x^7)\n            ? Ser(s, x, 1) \\\\ truncate to 1 term\n            %12 = 1 + O(x)\n        \n        The warning given for :literal:`Pol` also applies here: this is not a substitution\n        function.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_27Ser(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_d = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Ser (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_v,&__pyx_n_s_d,&__pyx_n_s_serprec,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          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_serprec);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Ser") < 0)) __PYX_ERR(4, 364, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_v = values[1];
    __pyx_v_d = values[2];
    if (values[3]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 364, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Ser", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 364, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Ser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_26Ser(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_v, __pyx_v_d, __pyx_v_serprec);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_26Ser(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_serprec) {
  long __pyx_v__v;
  int __pyx_v__have_d;
  GEN __pyx_v__s;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("Ser", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":424
 *         function.
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":425
 *         '''
 *         s = objtogen(s)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":426
 *         s = objtogen(s)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":427
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 427, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":426
 *         s = objtogen(s)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 */
  }

  /* "cypari/auto_instance.pxi":428
 *         if v is not None:
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_3 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_3;

  /* "cypari/auto_instance.pxi":429
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_d != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":430
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 430, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":429
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":431
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 431, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":432
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_6;

  /* "cypari/auto_instance.pxi":433
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_instance.pxi":434
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         if serprec < 0:
 */
  __pyx_t_3 = (__pyx_v__have_d != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":435
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_6;

    /* "cypari/auto_instance.pxi":434
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         if serprec < 0:
 */
  }

  /* "cypari/auto_instance.pxi":436
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":437
 *             _d = (<Gen>d).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":436
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 */
  }

  /* "cypari/auto_instance.pxi":438
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = Ser0(__pyx_v__s, __pyx_v__v, __pyx_v__d, __pyx_v_serprec);

  /* "cypari/auto_instance.pxi":439
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Set(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":364
 *         return new_gen(_ret)
 * 
 *     def Ser(self, s, v=None, d=None, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`s` into a power series with main variable :math:`v`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Ser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":441
 *         return new_gen(_ret)
 * 
 *     def Set(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` into a set, i.e.into a row vector, with strictly increasing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_29Set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_28Set[] = "\n        Converts :math:`x` into a set, i.e.\302\240into a row vector, with strictly increasing\n        entries with respect to the (somewhat arbitrary) universal comparison function\n        :literal:`cmp`. Standard container types :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_LIST` and\n        :literal:`t_VECSMALL` are converted to the set with corresponding elements. All\n        others are converted to a set with one element.\n        \n        ::\n        \n            ? Set([1,2,4,2,1,3])\n            %1 = [1, 2, 3, 4]\n            ? Set(x)\n            %2 = [x]\n            ? Set(Vecsmall([1,3,2,1,3]))\n            %3 = [1, 2, 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_29Set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Set (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Set") < 0)) __PYX_ERR(4, 441, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Set", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 441, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_28Set(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_28Set(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("Set", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":458
 *             %3 = [1, 2, 3]
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":459
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":460
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":459
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":461
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 461, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":462
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":463
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtoset(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":464
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtoset(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":463
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtoset(_x)
 */
  }

  /* "cypari/auto_instance.pxi":465
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtoset(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtoset(__pyx_v__x);

  /* "cypari/auto_instance.pxi":466
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gtoset(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Strchr(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":441
 *         return new_gen(_ret)
 * 
 *     def Set(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` into a set, i.e.into a row vector, with strictly increasing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":468
 *         return new_gen(_ret)
 * 
 *     def Strchr(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` to a string, translating each integer
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_31Strchr(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_30Strchr[] = "\n        Converts :math:`x` to a string, translating each integer\n        into a character.\n        \n        ::\n        \n            ? Strchr(97)\n            %1 = \"a\"\n            ? Vecsmall(\"hello world\")\n            %2 = Vecsmall([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])\n            ? Strchr(%)\n            %3 = \"hello world\"\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_31Strchr(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Strchr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_30Strchr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_30Strchr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Strchr", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":482
 *             %3 = "hello world"
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":483
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = Strchr(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 483, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":484
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = Strchr(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":485
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = Strchr(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = Strchr(__pyx_v__x);

  /* "cypari/auto_instance.pxi":486
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = Strchr(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Vec(self, x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":468
 *         return new_gen(_ret)
 * 
 *     def Strchr(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` to a string, translating each integer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Strchr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":488
 *         return new_gen(_ret)
 * 
 *     def Vec(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector. The dimension of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_33Vec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_32Vec[] = "\n        Transforms the object :math:`x` into a row vector. The dimension of the\n        resulting vector can be optionally specified via the extra parameter :math:`n`.\n        If :math:`n` is omitted or :math:`0`, the dimension depends on the type of :math:`x`; the\n        vector has a single component, except when :math:`x` is\n        \n        - a vector or a quadratic form: returns the initial object considered as a\n          row vector,\n        \n        - a polynomial or a power series: returns a vector consisting of the\n          coefficients. In the case of a polynomial, the coefficients of the vector\n          start with the leading coefficient of the polynomial, while for power series\n          only the significant coefficients are taken into account, but this time by\n          increasing order of degree. In particular the valuation is ignored\n          (which makes the function useful for series of negative valuation):\n        \n        ::\n        \n            ? Vec(3*x^2 + x)\n            %1 = [3, 1, 0]\n            ? Vec(x^2 + 3*x^3 + O(x^5))\n            %2 = [1, 3, 0]\n            ? Vec(x^-2 + 3*x^-1 + O(x))\n            %3 = [1, 3, 0]\n        \n        :literal:`Vec` is the reciprocal function of :literal:`Pol` for a\n        polynomial and of :literal:`Ser` for power series of valuation :math:`0`.\n        \n        - a matrix: returns the vector of columns comprising the matrix,\n        \n        ::\n        \n            ? m = [1,2,3;4,5,6]\n            %4 =\n            [1 2 3]\n            \n            [4 5 6]\n            ? Vec(m)\n            %5 = [[1, 4]~, [2, 5]~, [3, 6]~]\n        \n        - a character string: returns the vector of individual characters,\n        \n        ::\n        \n            ? Vec(\"PARI\")\n            %6 = [\"P\", \"A\", \"R\", \"I\"]\n        \n        - a map: returns the vector of the domain of the map,\n        \n        - an error context (:literal:`t_ERROR`): returns the error components, ""see\n          :literal:`iferr`.\n        \n        In the last four cases (matrix, character string, map, error), :math:`n` is\n        meaningless and must be omitted or an error is raised. Otherwise, if :math:`n` is\n        given, :math:`0` entries are appended at the end of the vector if :math:`n > 0`, and\n        prepended at the beginning if :math:`n < 0`. The dimension of the resulting vector\n        is :math:`\\|n\\|`. This allows to write a conversion function for series that\n        takes positive valuations into account:\n        \n        ::\n        \n            ? serVec(s) = Vec(s, -serprec(s,variable(s)));\n            ? Vec(x^2 + 3*x^3 + O(x^5))\n            %2 = [0, 0, 1, 3, 0]\n        \n        (That function is not intended for series of negative valuation.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_33Vec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vec") < 0)) __PYX_ERR(4, 488, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 488, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vec", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 488, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Vec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_32Vec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_32Vec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Vec", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":556
 *         (That function is not intended for series of negative valuation.)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":557
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovec0(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 557, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":558
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtovec0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":559
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovec0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtovec0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":560
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovec0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Vecrev(self, x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":488
 *         return new_gen(_ret)
 * 
 *     def Vec(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector. The dimension of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Vec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":562
 *         return new_gen(_ret)
 * 
 *     def Vecrev(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Vec (x, -n)`, then reverse the result. In particular,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_35Vecrev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_34Vecrev[] = "\n        As :math:`Vec (x, -n)`, then reverse the result. In particular,\n        :literal:`Vecrev` is the reciprocal function of :literal:`Polrev`: the\n        coefficients of the vector start with the constant coefficient of the\n        polynomial and the others follow by increasing degree.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_35Vecrev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vecrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vecrev") < 0)) __PYX_ERR(4, 562, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 562, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vecrev", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 562, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Vecrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_34Vecrev(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_34Vecrev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Vecrev", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":569
 *         polynomial and the others follow by increasing degree.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":570
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecrev0(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 570, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":571
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtovecrev0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":572
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecrev0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtovecrev0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":573
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecrev0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Vecsmall(self, x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":562
 *         return new_gen(_ret)
 * 
 *     def Vecrev(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Vec (x, -n)`, then reverse the result. In particular,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Vecrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":575
 *         return new_gen(_ret)
 * 
 *     def Vecsmall(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector of type :literal:`t_VECSMALL`. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_37Vecsmall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_36Vecsmall[] = "\n        Transforms the object :math:`x` into a row vector of type :literal:`t_VECSMALL`. The\n        dimension of the resulting vector can be optionally specified via the extra\n        parameter :math:`n`.\n        \n        This acts as :literal:`Vec`:math:`(x,n)`, but only on a limited set of objects:\n        the result must be representable as a vector of small integers.\n        If :math:`x` is a character string, a vector of individual characters in ASCII\n        encoding is returned (:literal:`Strchr` yields back the character string).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_37Vecsmall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vecsmall (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vecsmall") < 0)) __PYX_ERR(4, 575, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 575, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vecsmall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 575, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Vecsmall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_36Vecsmall(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_36Vecsmall(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Vecsmall", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":586
 *         encoding is returned (:literal:`Strchr` yields back the character string).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":587
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecsmall0(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 587, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":588
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtovecsmall0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":589
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecsmall0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtovecsmall0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":590
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecsmall0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def abs(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":575
 *         return new_gen(_ret)
 * 
 *     def Vecsmall(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector of type :literal:`t_VECSMALL`. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.Vecsmall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":592
 *         return new_gen(_ret)
 * 
 *     def abs(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Absolute value of :math:`x` (modulus if :math:`x` is complex).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_39abs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_38abs[] = "\n        Absolute value of :math:`x` (modulus if :math:`x` is complex).\n        Rational functions are not allowed. Contrary to most transcendental\n        functions, an exact argument is :emphasis:`not` converted to a real number before\n        applying :literal:`abs` and an exact result is returned if possible.\n        \n        ::\n        \n            ? abs(-1)\n            %1 = 1\n            ? abs(3/7 + 4/7*I)\n            %2 = 5/7\n            ? abs(1 + I)\n            %3 = 1.414213562373095048801688724\n        \n        If :math:`x` is a polynomial, returns :math:`-x` if the leading coefficient is\n        real and negative else returns :math:`x`. For a power series, the constant\n        coefficient is considered instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_39abs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("abs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "abs") < 0)) __PYX_ERR(4, 592, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 592, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("abs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 592, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.abs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_38abs(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_38abs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("abs", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":612
 *         coefficient is considered instead.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":613
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 613, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":614
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gabs(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":615
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gabs(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":616
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gabs(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gabs(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":617
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gabs(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def acos(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":592
 *         return new_gen(_ret)
 * 
 *     def abs(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Absolute value of :math:`x` (modulus if :math:`x` is complex).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.abs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":619
 *         return new_gen(_ret)
 * 
 *     def acos(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cos^{-1}(x) = -i \log (x + i\sqrt{1-x^2})`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_41acos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_40acos[] = "\n        Principal branch of :math:`\\cos^{-1}(x) = -i \\log (x + i\\sqrt{1-x^2})`.\n        In particular, :math:`\\Re (acos(x))\\in [0,\\pi]` and if :math:`x\\in \\mathbb{R}` and :math:`\\|x\\| > 1`,\n        then :math:`acos(x)` is complex. The branch cut is in two pieces:\n        :math:`]- oo ,-1]` , continuous with quadrant II, and :math:`[1,+ oo [`, continuous\n        with quadrant IV. We have :math:`acos(x) = \\pi/2 - asin(x)` for all\n        :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_41acos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("acos (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "acos") < 0)) __PYX_ERR(4, 619, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 619, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("acos", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 619, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.acos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_40acos(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_40acos(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("acos", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":628
 *         :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":629
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 629, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":630
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacos(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":631
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gacos(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":632
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacos(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gacos(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":633
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacos(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def acosh(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":619
 *         return new_gen(_ret)
 * 
 *     def acos(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cos^{-1}(x) = -i \log (x + i\sqrt{1-x^2})`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.acos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":635
 *         return new_gen(_ret)
 * 
 *     def acosh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cosh^{-1}(x) = 2
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_43acosh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_42acosh[] = "\n        Principal branch of :math:`\\cosh^{-1}(x) = 2\n        \\log (\\sqrt{(x+1)/2} + \\sqrt{(x-1)/2})`. In particular,\n        :math:`\\Re (acosh(x)) >= 0` and\n        :math:`\\Im (acosh(x))\\in ]-\\pi,\\pi]`; if :math:`x\\in \\mathbb{R}` and :math:`x < 1`, then\n        :math:`acosh(x)` is complex.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_43acosh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("acosh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "acosh") < 0)) __PYX_ERR(4, 635, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 635, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("acosh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 635, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.acosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_42acosh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_42acosh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("acosh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":643
 *         :math:`acosh(x)` is complex.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":644
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 644, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":645
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacosh(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":646
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gacosh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":647
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacosh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gacosh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":648
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacosh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def addhelp(self, sym, str):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":635
 *         return new_gen(_ret)
 * 
 *     def acosh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cosh^{-1}(x) = 2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.acosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":650
 *         return new_gen(_ret)
 * 
 *     def addhelp(self, sym, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the help message for the symbol :literal:`sym`. The string :emphasis:`str`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_45addhelp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_44addhelp[] = "\n        Changes the help message for the symbol :literal:`sym`. The string :emphasis:`str`\n        is expanded on the spot and stored as the online help for :literal:`sym`. It is\n        recommended to document global variables and user functions in this way,\n        although :literal:`gp` will not protest if you don't.\n        \n        You can attach a help text to an alias, but it will never be\n        shown: aliases are expanded by the :literal:`?` help operator and we get the help\n        of the symbol the alias points to. Nothing prevents you from modifying the\n        help of built-in PARI functions. But if you do, we would like to hear why you\n        needed it!\n        \n        Without :literal:`addhelp`, the standard help for user functions consists of its\n        name and definition.\n        \n        ::\n        \n            gp> f(x) = x^2;\n            gp> ?f\n            f =\n             (x)->x^2\n            \n        \n        Once addhelp is applied to :math:`f`, the function code is no\n        longer included. It can still be consulted by typing the function name:\n        \n        ::\n        \n            gp> addhelp(f, \"Square\")\n            gp> ?f\n            Square\n            \n            gp> f\n            %2 = (x)->x^2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_45addhelp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sym = 0;
  PyObject *__pyx_v_str = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addhelp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sym,&__pyx_n_s_str,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_sym)) != 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_str)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("addhelp", 1, 2, 2, 1); __PYX_ERR(4, 650, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addhelp") < 0)) __PYX_ERR(4, 650, __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_sym = values[0];
    __pyx_v_str = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addhelp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 650, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.addhelp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_44addhelp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_sym, __pyx_v_str);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_44addhelp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_sym, PyObject *__pyx_v_str) {
  char *__pyx_v__sym;
  char *__pyx_v__str;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("addhelp", 0);
  __Pyx_INCREF(__pyx_v_sym);
  __Pyx_INCREF(__pyx_v_str);

  /* "cypari/auto_instance.pxi":686
 *             %2 = (x)->x^2
 *         '''
 *         sym = to_bytes(sym)             # <<<<<<<<<<<<<<
 *         cdef char* _sym = <bytes>sym
 *         str = to_bytes(str)
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_sym); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sym, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":687
 *         '''
 *         sym = to_bytes(sym)
 *         cdef char* _sym = <bytes>sym             # <<<<<<<<<<<<<<
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str
 */
  if (unlikely(__pyx_v_sym == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 687, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_sym); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 687, __pyx_L1_error)
  __pyx_v__sym = __pyx_t_2;

  /* "cypari/auto_instance.pxi":688
 *         sym = to_bytes(sym)
 *         cdef char* _sym = <bytes>sym
 *         str = to_bytes(str)             # <<<<<<<<<<<<<<
 *         cdef char* _str = <bytes>str
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_str, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":689
 *         cdef char* _sym = <bytes>sym
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str             # <<<<<<<<<<<<<<
 *         sig_on()
 *         addhelp(_sym, _str)
 */
  if (unlikely(__pyx_v_str == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 689, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_str); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 689, __pyx_L1_error)
  __pyx_v__str = __pyx_t_2;

  /* "cypari/auto_instance.pxi":690
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str
 *         sig_on()             # <<<<<<<<<<<<<<
 *         addhelp(_sym, _str)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 690, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":691
 *         cdef char* _str = <bytes>str
 *         sig_on()
 *         addhelp(_sym, _str)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  addhelp(__pyx_v__sym, __pyx_v__str);

  /* "cypari/auto_instance.pxi":692
 *         sig_on()
 *         addhelp(_sym, _str)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def addprimes(self, x=None):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":650
 *         return new_gen(_ret)
 * 
 *     def addhelp(self, sym, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the help message for the symbol :literal:`sym`. The string :emphasis:`str`
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.addhelp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sym);
  __Pyx_XDECREF(__pyx_v_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":694
 *         clear_stack()
 * 
 *     def addprimes(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Adds the integers contained in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_47addprimes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_46addprimes[] = "\n        Adds the integers contained in the\n        vector :math:`x` (or the single integer :math:`x`) to a special table of\n        \"user-defined primes\", and returns that table. Whenever :literal:`factor` is\n        subsequently called, it will trial divide by the elements in this table.\n        If :math:`x` is empty or omitted, just returns the current list of extra\n        primes.\n        \n        The entries in :math:`x` must be primes: there is no internal check, even if\n        the :literal:`factor_proven` default is set. To remove primes from the list use\n        :literal:`removeprimes`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_47addprimes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addprimes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "addprimes") < 0)) __PYX_ERR(4, 694, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("addprimes", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 694, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.addprimes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_46addprimes(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_46addprimes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("addprimes", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":707
 *         :literal:`removeprimes`.
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":708
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":709
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 709, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":708
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":710
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 710, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":711
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":712
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = addprimes(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":713
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = addprimes(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":712
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = addprimes(_x)
 */
  }

  /* "cypari/auto_instance.pxi":714
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = addprimes(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = addprimes(__pyx_v__x);

  /* "cypari/auto_instance.pxi":715
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = addprimes(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def agm(self, x, y, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":694
 *         clear_stack()
 * 
 *     def addprimes(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Adds the integers contained in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.addprimes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":717
 *         return new_gen(_ret)
 * 
 *     def agm(self, x, y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Arithmetic-geometric mean of :math:`x` and :math:`y`. In the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_49agm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_48agm[] = "\n        Arithmetic-geometric mean of :math:`x` and :math:`y`. In the\n        case of complex or negative numbers, the optimal AGM is returned\n        (the largest in absolute value over all choices of the signs of the square\n        roots). :math:`p`-adic or power series arguments are also allowed. Note that\n        a :math:`p`-adic agm exists only if :math:`x/y` is congruent to 1 modulo :math:`p` (modulo\n        16 for :math:`p = 2`). :math:`x` and :math:`y` cannot both be vectors or matrices.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_49agm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("agm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("agm", 0, 2, 3, 1); __PYX_ERR(4, 717, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "agm") < 0)) __PYX_ERR(4, 717, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_y = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 717, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("agm", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 717, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.agm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_48agm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_48agm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("agm", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":726
 *         16 for :math:`p = 2`). :math:`x` and :math:`y` cannot both be vectors or matrices.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":727
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":728
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 728, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":729
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":730
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = agm(_x, _y, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":731
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = agm(_x, _y, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":732
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = agm(_x, _y, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = agm(__pyx_v__x, __pyx_v__y, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":733
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = agm(_x, _y, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algadd(self, al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":717
 *         return new_gen(_ret)
 * 
 *     def agm(self, x, y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Arithmetic-geometric mean of :math:`x` and :math:`y`. In the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.agm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":735
 *         return new_gen(_ret)
 * 
 *     def algadd(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their sum :math:`x+y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_51algadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_50algadd[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their sum :math:`x+y` in\n        the algebra\302\240:emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y),[-1,1]);\n            ? algadd(A,[1,0]~,[1,2]~)\n            %2 = [2, 2]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_51algadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algadd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algadd", 1, 3, 3, 1); __PYX_ERR(4, 735, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algadd", 1, 3, 3, 2); __PYX_ERR(4, 735, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algadd") < 0)) __PYX_ERR(4, 735, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algadd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 735, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_50algadd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_50algadd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algadd", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":748
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":749
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":750
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":751
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 751, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":752
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":753
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algadd(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":754
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algadd(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":755
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algadd(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algadd(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":756
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algadd(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algalgtobasis(self, al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":735
 *         return new_gen(_ret)
 * 
 *     def algadd(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their sum :math:`x+y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":758
 *         return new_gen(_ret)
 * 
 *     def algalgtobasis(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_53algalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_52algalgtobasis[] = "\n        Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output\n        by :literal:`alginit`, transforms it to a column vector on the integral basis of\n        :emphasis:`al`. This is the inverse function of :literal:`algbasistoalg`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y^2-5),[2,y]);\n            ? algalgtobasis(A,[y,1]~)\n            %2 = [0, 2, 0, -1, 2, 0, 0, 0]~\n            ? algbasistoalg(A,algalgtobasis(A,[y,1]~))\n            %3 = [Mod(Mod(y, y^2 - 5), x^2 - 2), 1]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_53algalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algalgtobasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,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_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algalgtobasis", 1, 2, 2, 1); __PYX_ERR(4, 758, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algalgtobasis") < 0)) __PYX_ERR(4, 758, __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_al = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algalgtobasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 758, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_52algalgtobasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_52algalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":772
 *             %3 = [Mod(Mod(y, y^2 - 5), x^2 - 2), 1]~
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":773
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":774
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 774, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":775
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algalgtobasis(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":776
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algalgtobasis(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":777
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algalgtobasis(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algalgtobasis(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_instance.pxi":778
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algalgtobasis(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algaut(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":758
 *         return new_gen(_ret)
 * 
 *     def algalgtobasis(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":780
 *         return new_gen(_ret)
 * 
 *     def algaut(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_55algaut(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_54algaut[] = "\n        Given a cyclic algebra :math:`al = (L/K,\\sigma,b)` output by\n        :literal:`alginit`, returns the automorphism :math:`\\sigma`.\n        \n        ::\n        \n            ? nf = nfinit(y);\n            ? p = idealprimedec(nf,7)[1];\n            ? p2 = idealprimedec(nf,11)[1];\n            ? A = alginit(nf,[3,[[p,p2],[1/3,2/3]],[0]]);\n            ? algaut(A)\n            %5 = -1/3*x^2 + 1/3*x + 26/3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_55algaut(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algaut (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_54algaut(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_54algaut(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algaut", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":794
 *             %5 = -1/3*x^2 + 1/3*x + 26/3
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":795
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algaut(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 795, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":796
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algaut(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":797
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algaut(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algaut(__pyx_v__al);

  /* "cypari/auto_instance.pxi":798
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algaut(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algb(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":780
 *         return new_gen(_ret)
 * 
 *     def algaut(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algaut", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":800
 *         return new_gen(_ret)
 * 
 *     def algb(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_57algb(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_56algb[] = "\n        Given a cyclic algebra :math:`al = (L/K,\\sigma,b)` output by\n        :literal:`alginit`, returns the element :math:`b\\in K`.\n        \n        ::\n        \n            nf = nfinit(y);\n            ? p = idealprimedec(nf,7)[1];\n            ? p2 = idealprimedec(nf,11)[1];\n            ? A = alginit(nf,[3,[[p,p2],[1/3,2/3]],[0]]);\n            ? algb(A)\n            %5 = Mod(-77, y)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_57algb(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algb (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_56algb(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_56algb(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algb", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":814
 *             %5 = Mod(-77, y)
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":815
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algb(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 815, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":816
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algb(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":817
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algb(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algb(__pyx_v__al);

  /* "cypari/auto_instance.pxi":818
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algb(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algbasis(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":800
 *         return new_gen(_ret)
 * 
 *     def algb(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":820
 *         return new_gen(_ret)
 * 
 *     def algbasis(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_59algbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_58algbasis[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :math:`\\mathbb{Z}`-basis of the order\302\240:math:`O_0` stored in :emphasis:`al` with respect to the\n        natural order in :emphasis:`al`. It is a maximal order if one has been computed.\n        \n        ::\n        \n            A = alginit(nfinit(y), [-1,-1]);\n            ? algbasis(A)\n            %2 =\n            [1 0 0 1/2]\n            \n            [0 1 0 1/2]\n            \n            [0 0 1 1/2]\n            \n            [0 0 0 1/2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_59algbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_58algbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_58algbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algbasis", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":839
 *             [0 0 0 1/2]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":840
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algbasis(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 840, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":841
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algbasis(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":842
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algbasis(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algbasis(__pyx_v__al);

  /* "cypari/auto_instance.pxi":843
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algbasis(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algbasistoalg(self, al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":820
 *         return new_gen(_ret)
 * 
 *     def algbasis(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":845
 *         return new_gen(_ret)
 * 
 *     def algbasistoalg(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_61algbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_60algbasistoalg[] = "\n        Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output\n        by :literal:`alginit`, transforms it to its algebraic representation in :emphasis:`al`.\n        This is the inverse function of :literal:`algalgtobasis`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y^2-5),[2,y]);\n            ? z = algbasistoalg(A,[0,1,0,0,2,-3,0,0]~);\n            ? liftall(z)\n            %3 = [(-1/2*y - 2)*x + (-1/4*y + 5/4), -3/4*y + 7/4]~\n            ? algalgtobasis(A,z)\n            %4 = [0, 1, 0, 0, 2, -3, 0, 0]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_61algbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algbasistoalg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,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_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algbasistoalg", 1, 2, 2, 1); __PYX_ERR(4, 845, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algbasistoalg") < 0)) __PYX_ERR(4, 845, __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_al = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algbasistoalg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 845, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_60algbasistoalg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_60algbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":860
 *             %4 = [0, 1, 0, 0, 2, -3, 0, 0]~
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":861
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":862
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 862, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":863
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algbasistoalg(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":864
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algbasistoalg(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":865
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algbasistoalg(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algbasistoalg(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_instance.pxi":866
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algbasistoalg(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algcenter(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":845
 *         return new_gen(_ret)
 * 
 *     def algbasistoalg(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":868
 *         return new_gen(_ret)
 * 
 *     def algcenter(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit`, returns a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_63algcenter(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_62algcenter[] = "\n        If :emphasis:`al` is a table algebra output by :literal:`algtableinit`, returns a\n        basis of the center of the algebra\302\240:emphasis:`al` over its prime field (:math:`\\mathbb{Q}` or\n        :math:`\\mathbb{F}_p`). If :emphasis:`al` is a central simple algebra output by :literal:`alginit`,\n        returns the center of\302\240:emphasis:`al`, which is stored in :emphasis:`al`.\n        \n        A simple example: the :math:`2 x 2` upper triangular matrices over :math:`\\mathbb{Q}`,\n        generated by :math:`I_2`, :math:`a = [0,1;0,0]` and :math:`b = [0,0;0,1]`,\n        such that :math:`a^2 = 0`, :math:`ab = a`, :math:`ba = 0`, :math:`b^2 = b`: the diagonal matrices\n        form the center.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algcenter(A) \\\\ = (I_2)\n            %3 =\n            [1]\n            \n            [0]\n            \n            [0]\n        \n        An example in the central simple case:\n        \n        ::\n        \n            ? nf = nfinit(y^3-y+1);\n            ? A = alginit(nf, [-1,-1]);\n            ? algcenter(A).pol\n            %3 = y^3 - y + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_63algcenter(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algcenter (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_62algcenter(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_62algcenter(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algcenter", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":901
 *             %3 = y^3 - y + 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":902
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algcenter(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 902, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":903
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algcenter(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":904
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algcenter(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algcenter(__pyx_v__al);

  /* "cypari/auto_instance.pxi":905
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algcenter(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algcentralproj(self, al, z, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":868
 *         return new_gen(_ret)
 * 
 *     def algcenter(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit`, returns a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algcenter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":907
 *         return new_gen(_ret)
 * 
 *     def algcentralproj(self, al, z, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a table algebra :emphasis:`al` output by :literal:`algtableinit` and a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_65algcentralproj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_64algcentralproj[] = "\n        Given a table algebra :emphasis:`al` output by :literal:`algtableinit` and a\n        :literal:`t_VEC` :math:`z = [z_1,...,z_n]` of orthogonal central idempotents,\n        returns a :literal:`t_VEC` :math:`[al_1,...,al_n]` of algebras such that\n        :math:`al_i = z_i al`. If :math:`maps = 1`, each :math:`al_i` is a :literal:`t_VEC`\n        :math:`[quo,proj,lift]` where :emphasis:`quo` is the quotient algebra, :emphasis:`proj` is a\n        :literal:`t_MAT` representing the projection onto this quotient and :emphasis:`lift` is a\n        :literal:`t_MAT` representing a lift.\n        \n        A simple example: :math:`\\mathbb{F}_2 x \\mathbb{F}_4`, generated by\302\240:math:`1 = (1,1)`, :math:`e = (1,0)`\n        and\302\240:math:`x` such that\302\240:math:`x^2+x+1 = 0`. We have\302\240:math:`e^2 = e`, :math:`x^2 = x+1` and\302\240:math:`ex = 0`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? e = [0,1,0]~;\n            ? e2 = algsub(A,[1,0,0]~,e);\n            ? [a,a2] = algcentralproj(A,[e,e2]);\n            ? algdim(a)\n            %6 = 1\n            ? algdim(a2)\n            %7 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_65algcentralproj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_z = 0;
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algcentralproj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_z,&__pyx_n_s_maps,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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("algcentralproj", 0, 2, 3, 1); __PYX_ERR(4, 907, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algcentralproj") < 0)) __PYX_ERR(4, 907, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_al = values[0];
    __pyx_v_z = values[1];
    if (values[2]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 907, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algcentralproj", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 907, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algcentralproj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_64algcentralproj(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_z, __pyx_v_maps);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_64algcentralproj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_z, long __pyx_v_maps) {
  GEN __pyx_v__al;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algcentralproj", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":932
 *             %7 = 2
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":933
 *         '''
 *         al = objtogen(al)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":934
 *         al = objtogen(al)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 934, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":935
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":936
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":937
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alg_centralproj(__pyx_v__al, __pyx_v__z, __pyx_v_maps);

  /* "cypari/auto_instance.pxi":938
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algchar(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":907
 *         return new_gen(_ret)
 * 
 *     def algcentralproj(self, al, z, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a table algebra :emphasis:`al` output by :literal:`algtableinit` and a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algcentralproj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":940
 *         return new_gen(_ret)
 * 
 *     def algchar(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or :literal:`algtableinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_67algchar(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_66algchar[] = "\n        Given an algebra :emphasis:`al` output by :literal:`alginit` or :literal:`algtableinit`,\n        returns the characteristic of :emphasis:`al`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,13);\n            ? algchar(A)\n            %3 = 13\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_67algchar(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algchar (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_66algchar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_66algchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algchar", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":952
 *             %3 = 13
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":953
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algchar(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 953, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":954
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algchar(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":955
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algchar(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algchar(__pyx_v__al);

  /* "cypari/auto_instance.pxi":956
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algchar(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algcharpoly(self, al, b, v=None, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":940
 *         return new_gen(_ret)
 * 
 *     def algchar(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or :literal:`algtableinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":958
 *         return new_gen(_ret)
 * 
 *     def algcharpoly(self, al, b, v=None, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al`, returns its characteristic polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_69algcharpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_68algcharpoly[] = "\n        Given an element :math:`b` in :emphasis:`al`, returns its characteristic polynomial\n        as a polynomial in the variable :math:`v`. If :emphasis:`al` is a table algebra output\n        by :literal:`algtableinit` or if :math:`abs = 1`, returns the absolute characteristic\n        polynomial of :emphasis:`b`, which is an element of :math:`\\mathbb{F}_p[v]` or\302\240:math:`\\mathbb{Q}[v]`; if :emphasis:`al`\n        is a central simple algebra output by :literal:`alginit` and :math:`abs = 0`, returns the\n        reduced characteristic polynomial of :emphasis:`b`, which is an element of\302\240:math:`K[v]`\n        where\302\240:math:`K` is the center of :emphasis:`al`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y), [-1,-1]); \\\\ (-1,-1)_Q\n            ? algcharpoly(al, [0,1]~)\n            %2 = x^2 + 1\n            ? algcharpoly(al, [0,1]~,,1)\n            %3 = x^4 + 2*x^2 + 1\n            ? nf = nfinit(y^2-5);\n            ? al = alginit(nf,[-1,y]);\n            ? a = [y,1+x]~*Mod(1,y^2-5)*Mod(1,x^2+1);\n            ? P = lift(algcharpoly(al,a))\n            %7 = x^2 - 2*y*x + (-2*y + 5)\n            ? algcharpoly(al,a,,1)\n            %8 = x^8 - 20*x^6 - 80*x^5 + 110*x^4 + 800*x^3 + 1500*x^2 - 400*x + 25\n            ? lift(P*subst(P,y,-y)*Mod(1,y^2-5))^2\n            %9 = x^8 - 20*x^6 - 80*x^5 + 110*x^4 + 800*x^3 + 1500*x^2 - 400*x + 25\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_69algcharpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algcharpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_b,&__pyx_n_s_v,&__pyx_n_s_abs,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_al)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algcharpoly", 0, 2, 4, 1); __PYX_ERR(4, 958, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          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_abs);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algcharpoly") < 0)) __PYX_ERR(4, 958, __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);
        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_al = values[0];
    __pyx_v_b = values[1];
    __pyx_v_v = values[2];
    if (values[3]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 958, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algcharpoly", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 958, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_68algcharpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_b, __pyx_v_v, __pyx_v_abs);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_68algcharpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_b, PyObject *__pyx_v_v, long __pyx_v_abs) {
  long __pyx_v__v;
  GEN __pyx_v__al;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("algcharpoly", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":987
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":988
 *         '''
 *         al = objtogen(al)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":989
 *         al = objtogen(al)
 *         b = objtogen(b)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":990
 *         b = objtogen(b)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":991
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 991, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":990
 *         b = objtogen(b)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":992
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 992, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":993
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_6;

  /* "cypari/auto_instance.pxi":994
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_6;

  /* "cypari/auto_instance.pxi":995
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algcharpoly(__pyx_v__al, __pyx_v__b, __pyx_v__v, __pyx_v_abs);

  /* "cypari/auto_instance.pxi":996
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdegree(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":958
 *         return new_gen(_ret)
 * 
 *     def algcharpoly(self, al, b, v=None, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al`, returns its characteristic polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":998
 *         return new_gen(_ret)
 * 
 *     def algdegree(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_71algdegree(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_70algdegree[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        the degree of :emphasis:`al`.\n        \n        ::\n        \n            ? nf = nfinit(y^3-y+1);\n            ? A = alginit(nf, [-1,-1]);\n            ? algdegree(A)\n            %3 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_71algdegree(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdegree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_70algdegree(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_70algdegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdegree", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1010
 *             %3 = 2
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1011
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdegree(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1011, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1012
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algdegree(_al)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1013
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdegree(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algdegree(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1014
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdegree(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1015
 *         cdef long _ret = algdegree(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algdep(self, z, long k, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":998
 *         return new_gen(_ret)
 * 
 *     def algdegree(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1017
 *         return _ret
 * 
 *     def algdep(self, z, long k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`z` being real/complex, or :math:`p`-adic, finds a polynomial (in the variable
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_73algdep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_72algdep[] = "\n        :math:`z` being real/complex, or :math:`p`-adic, finds a polynomial (in the variable\n        :literal:`'x`) of degree at most\n        :math:`k`, with integer coefficients, having :math:`z` as approximate root. Note that the\n        polynomial which is obtained is not necessarily the \"correct\" one. In fact\n        it is not even guaranteed to be irreducible. One can check the closeness\n        either by a polynomial evaluation (use :literal:`subst`), or by computing the\n        roots of the polynomial given by :literal:`algdep` (use :literal:`polroots` or\n        :literal:`polrootspadic`).\n        \n        Internally, :literal:`lindep`:math:`([1,z,...,z^k], flag)` is used. A non-zero value of\n        :math:`flag` may improve on the default behavior if the input number is known to a\n        :emphasis:`huge` accuracy, and you suspect the last bits are incorrect: if :math:`flag > 0`\n        the computation is done with an accuracy of :math:`flag` decimal digits; to get\n        meaningful results, the parameter :math:`flag` should be smaller than the number of\n        correct decimal digits in the input.\n        But default values are usually sufficient, so try without :math:`flag` first:\n        \n        ::\n        \n            ? \\p200\n            ? z = 2^(1/6)+3^(1/5);\n            ? algdep(z, 30); \\\\ right in 280ms\n            ? algdep(z, 30, 100); \\\\ wrong in 169ms\n            ? algdep(z, 30, 170); \\\\ right in 288ms\n            ? algdep(z, 30, 200); \\\\ wrong in 320ms\n            ? \\p250\n            ? z = 2^(1/6)+3^(1/5); \\\\ recompute to new, higher, accuracy !\n            ? algdep(z, 30); \\\\ right in 329ms\n            ? algdep(z, 30, 200); \\\\ right in 324ms\n            ? \\p500\n            ? algdep(2^(1/6)+3^(1/5), 30); \\\\ right in 677ms\n            ? \\p1000\n            ? algdep(2^(1/6)+3^(1/5), 30); \\\\ right in 1.5s\n        \n        The changes in :literal:`realprecision` only affect the quality of th""e\n        initial approximation to :math:`2^{1/6} + 3^{1/5}`, :literal:`algdep` itself uses\n        exact operations. The size of its operands depend on the accuracy of the\n        input of course: more accurate input means slower operations.\n        \n        Proceeding by increments of 5 digits of accuracy, :literal:`algdep` with default\n        flag produces its first correct result at 195 digits, and from then on a\n        steady stream of correct results:\n        \n        ::\n        \n             \\\\ assume T contains the correct result, for comparison\n             forstep(d=100, 250, 5, localprec(d);\\\n             print(d, \" \", algdep(2^(1/6)+3^(1/5),30) == T))\n        \n        The above example is the test case studied in a 2000 paper by Borwein and\n        Lisonek: Applications of integer relation algorithms, :emphasis:`Discrete Math.`,\n        :strong:`217`, p.\302\24065--82. The version of PARI tested there was 1.39, which\n        succeeded reliably from precision 265 on, in about 200 as much time as the\n        current version.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_73algdep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_k;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_k,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 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_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algdep", 0, 2, 3, 1); __PYX_ERR(4, 1017, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdep") < 0)) __PYX_ERR(4, 1017, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_z = values[0];
    __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 1017, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 1017, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdep", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1017, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_72algdep(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_z, __pyx_v_k, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_72algdep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_k, long __pyx_v_flag) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdep", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":1074
 *         current version.
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1075
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = algdep0(_z, k, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1075, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1076
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdep0(_z, k, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1077
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = algdep0(_z, k, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdep0(__pyx_v__z, __pyx_v_k, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":1078
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = algdep0(_z, k, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdim(self, al, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1017
 *         return _ret
 * 
 *     def algdep(self, z, long k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`z` being real/complex, or :math:`p`-adic, finds a polynomial (in the variable
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1080
 *         return new_gen(_ret)
 * 
 *     def algdim(self, al, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit` or if:math:`abs = 1`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_75algdim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_74algdim[] = "\n        If :emphasis:`al` is a table algebra output by :literal:`algtableinit` or if\302\240:math:`abs = 1`,\n        returns the dimension of :emphasis:`al` over its prime subfield (:math:`\\mathbb{Q}` or :math:`\\mathbb{F}_p`).\n        If\302\240:emphasis:`al` is a central simple algebra output by :literal:`alginit` and\302\240:math:`abs = 0`,\n        returns the dimension of :emphasis:`al` over its center.\n        \n        ::\n        \n            ? nf = nfinit(y^3-y+1);\n            ? A = alginit(nf, [-1,-1]);\n            ? algdim(A)\n            %3 = 4\n            ? algdim(A,1)\n            %4 = 12\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_75algdim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdim (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_abs,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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdim") < 0)) __PYX_ERR(4, 1080, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    if (values[1]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 1080, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdim", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1080, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_74algdim(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_abs);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_74algdim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, long __pyx_v_abs) {
  GEN __pyx_v__al;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdim", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1096
 *             %4 = 12
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1097
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdim(_al, abs)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1097, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1098
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algdim(_al, abs)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1099
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdim(_al, abs)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algdim(__pyx_v__al, __pyx_v_abs);

  /* "cypari/auto_instance.pxi":1100
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdim(_al, abs)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1101
 *         cdef long _ret = algdim(_al, abs)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algdisc(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1080
 *         return new_gen(_ret)
 * 
 *     def algdim(self, al, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit` or if:math:`abs = 1`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1103
 *         return _ret
 * 
 *     def algdisc(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, computes
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_77algdisc(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_76algdisc[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, computes\n        the discriminant of the order :math:`O_0` stored in :emphasis:`al`, that is the\n        determinant of the trace form :math:`\\rm{Tr} : O_0 x O_0 \\to \\mathbb{Z}`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-3,1-y]);\n            ? [PR,h] = alghassef(A)\n            %3 = [[[2, [2, 0]~, 1, 2, 1], [3, [3, 0]~, 1, 2, 1]], Vecsmall([0, 1])]\n            ? n = algdegree(A);\n            ? D = algdim(A,1);\n            ? h = vector(#h, i, n - gcd(n,h[i]));\n            ? n^D * nf.disc^(n^2) * idealnorm(nf, idealfactorback(nf,PR,h))^n\n            %4 = 12960000\n            ? algdisc(A)\n            %5 = 12960000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_77algdisc(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_76algdisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_76algdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdisc", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1123
 *             %5 = 12960000
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1124
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algdisc(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1124, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1125
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdisc(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1126
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algdisc(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdisc(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1127
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algdisc(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdivl(self, al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1103
 *         return _ret
 * 
 *     def algdisc(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, computes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1129
 *         return new_gen(_ret)
 * 
 *     def algdivl(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their left quotient
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_79algdivl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_78algdivl[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their left quotient\n        :math:`x\\backslash y` in the algebra :emphasis:`al`: an element :math:`z` such that :math:`xz = y` (such\n        an element is not unique when :math:`x` is a zerodivisor). If\302\240:math:`x` is invertible, this\n        is the same as :math:`x^{-1}y`. Assumes that :math:`y` is left divisible by :math:`x` (i.e. that\n        :math:`z` exists). Also accepts matrices with coefficients in\302\240:emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_79algdivl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdivl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algdivl", 1, 3, 3, 1); __PYX_ERR(4, 1129, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algdivl", 1, 3, 3, 2); __PYX_ERR(4, 1129, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdivl") < 0)) __PYX_ERR(4, 1129, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdivl", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1129, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdivl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_78algdivl(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_78algdivl(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdivl", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":1137
 *         :math:`z` exists). Also accepts matrices with coefficients in:emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1138
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1139
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1140
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1140, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1141
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1142
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivl(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1143
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdivl(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1144
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivl(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdivl(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":1145
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivl(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdivr(self, al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1129
 *         return new_gen(_ret)
 * 
 *     def algdivl(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their left quotient
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdivl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1147
 *         return new_gen(_ret)
 * 
 *     def algdivr(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, returns :math:`xy^{-1}`. Also accepts
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_81algdivr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_80algdivr[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, returns :math:`xy^{-1}`. Also accepts\n        matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_81algdivr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdivr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algdivr", 1, 3, 3, 1); __PYX_ERR(4, 1147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algdivr", 1, 3, 3, 2); __PYX_ERR(4, 1147, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdivr") < 0)) __PYX_ERR(4, 1147, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdivr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdivr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_80algdivr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_80algdivr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdivr", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":1152
 *         matrices with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1153
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1154
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1155
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1155, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1156
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1157
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivr(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1158
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdivr(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1159
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivr(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdivr(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":1160
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivr(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alggroup(self, gal, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1147
 *         return new_gen(_ret)
 * 
 *     def algdivr(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, returns :math:`xy^{-1}`. Also accepts
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algdivr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1162
 *         return new_gen(_ret)
 * 
 *     def alggroup(self, gal, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the group algebra:math:`K[G]` over:math:`K = \mathbb{Q}` (:math:`p` omitted) or:math:`\mathbb{F}_p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_83alggroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_82alggroup[] = "\n        Initializes the group algebra\302\240:math:`K[G]` over\302\240:math:`K = \\mathbb{Q}` (:math:`p` omitted) or\302\240:math:`\\mathbb{F}_p`\n        where\302\240:math:`G` is the underlying group of the :literal:`galoisinit` structure\302\240:emphasis:`gal`.\n        The input\302\240:emphasis:`gal` is also allowed to be a :literal:`t_VEC` of permutations that is\n        closed under products.\n        \n        Example:\n        \n        ::\n        \n            ? K = nfsplitting(x^3-x+1);\n            ? gal = galoisinit(K);\n            ? al = alggroup(gal);\n            ? algissemisimple(al)\n            %4 = 1\n            ? G = [Vecsmall([1,2,3]), Vecsmall([1,3,2])];\n            ? al2 = alggroup(G, 2);\n            ? algissemisimple(al2)\n            %8 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_83alggroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alggroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_gal)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alggroup") < 0)) __PYX_ERR(4, 1162, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gal = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alggroup", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1162, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alggroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_82alggroup(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_82alggroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__gal;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("alggroup", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":1183
 *             %8 = 0
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1184
 *         '''
 *         gal = objtogen(gal)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":1185
 *         gal = objtogen(gal)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1186
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":1185
 *         gal = objtogen(gal)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1187
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 1187, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1188
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1189
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":1190
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1191
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alggroup(_gal, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1190
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)
 */
  }

  /* "cypari/auto_instance.pxi":1192
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alggroup(__pyx_v__gal, __pyx_v__p);

  /* "cypari/auto_instance.pxi":1193
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alghasse(self, al, pl):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1162
 *         return new_gen(_ret)
 * 
 *     def alggroup(self, gal, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the group algebra:math:`K[G]` over:math:`K = \mathbb{Q}` (:math:`p` omitted) or:math:`\mathbb{F}_p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alggroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1195
 *         return new_gen(_ret)
 * 
 *     def alghasse(self, al, pl):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` and a prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_85alghasse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_84alghasse[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit` and a prime\n        ideal or an integer between :math:`1` and :math:`r_1+r_2`, returns a :literal:`t_FRAC` :math:`h` : the\n        local Hasse invariant of :emphasis:`al` at the place specified by :emphasis:`pl`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? alghasse(A, 1)\n            %3 = 1/2\n            ? alghasse(A, 2)\n            %4 = 0\n            ? alghasse(A, idealprimedec(nf,2)[1])\n            %5 = 1/2\n            ? alghasse(A, idealprimedec(nf,5)[1])\n            %6 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_85alghasse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alghasse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_pl,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_al)) != 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_pl)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alghasse", 1, 2, 2, 1); __PYX_ERR(4, 1195, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alghasse") < 0)) __PYX_ERR(4, 1195, __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_al = values[0];
    __pyx_v_pl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alghasse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1195, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alghasse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_84alghasse(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_pl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_84alghasse(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl) {
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alghasse", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":1214
 *             %6 = 0
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1215
 *         '''
 *         al = objtogen(al)
 *         pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1216
 *         al = objtogen(al)
 *         pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = (<Gen>pl).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1216, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1217
 *         pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = alghasse(_al, _pl)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1218
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alghasse(_al, _pl)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
  __pyx_v__pl = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1219
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = alghasse(_al, _pl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alghasse(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_instance.pxi":1220
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = alghasse(_al, _pl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alghassef(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1195
 *         return new_gen(_ret)
 * 
 *     def alghasse(self, al, pl):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` and a prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alghasse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1222
 *         return new_gen(_ret)
 * 
 *     def alghassef(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_87alghassef(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_86alghassef[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :literal:`t_VEC` :math:`[PR, h_f]` describing the local Hasse invariants at the\n        finite places of the center: :literal:`PR` is a :literal:`t_VEC` of primes and :math:`h_f` is a\n        :literal:`t_VECSMALL` of integers modulo the degree :math:`d` of :emphasis:`al`. The Hasse\n        invariant of\302\240:emphasis:`al` at the primes outside\302\240:literal:`PR` is\302\240:math:`0`, but\302\240:literal:`PR` can\n        include primes at which the Hasse invariant is\302\240:math:`0`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,2*y-1]);\n            ? [PR,hf] = alghassef(A);\n            ? PR\n            %4 = [[19, [10, 2]~, 1, 1, [-8, 2; 2, -10]], [2, [2, 0]~, 1, 2, 1]]\n            ? hf\n            %5 = Vecsmall([1, 0])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_87alghassef(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alghassef (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_86alghassef(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_86alghassef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alghassef", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1241
 *             %5 = Vecsmall([1, 0])
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1242
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassef(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1242, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1243
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alghassef(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1244
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassef(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alghassef(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1245
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassef(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alghassei(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1222
 *         return new_gen(_ret)
 * 
 *     def alghassef(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alghassef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1247
 *         return new_gen(_ret)
 * 
 *     def alghassei(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_89alghassei(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_88alghassei[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :literal:`t_VECSMALL` :math:`h_i` of :math:`r_1` integers modulo the degree :math:`d` of :emphasis:`al`,\n        where :math:`r_1` is the number of real places of the center: the local Hasse\n        invariants of :emphasis:`al` at infinite places.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? alghassei(A)\n            %3 = Vecsmall([1, 0])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_89alghassei(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alghassei (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_88alghassei(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_88alghassei(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alghassei", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1261
 *             %3 = Vecsmall([1, 0])
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1262
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassei(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1262, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1263
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alghassei(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1264
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassei(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alghassei(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1265
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassei(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algindex(self, al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1247
 *         return new_gen(_ret)
 * 
 *     def alghassei(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alghassei", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1267
 *         return new_gen(_ret)
 * 
 *     def algindex(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the index of the central simple algebra:math:`A` over:math:`K` (as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_91algindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_90algindex[] = "\n        Returns the index of the central simple algebra\302\240:math:`A` over\302\240:math:`K` (as output by\n        alginit), that is the degree\302\240:math:`e` of the unique central division algebra\302\240:math:`D`\n        over :math:`K` such that\302\240:math:`A` is isomorphic to some matrix algebra\302\240:math:`M_k(D)`. If\n        :emphasis:`pl` is set, it should be a prime ideal of\302\240:math:`K` or an integer between\302\240:math:`1`\n        and\302\240:math:`r_1+r_2`, and in that case return the local index at the place :emphasis:`pl`\n        instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algindex(A, 1)\n            %3 = 2\n            ? algindex(A, 2)\n            %4 = 1\n            ? algindex(A, idealprimedec(nf,2)[1])\n            %5 = 2\n            ? algindex(A, idealprimedec(nf,5)[1])\n            %6 = 1\n            ? algindex(A)\n            %7 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_91algindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algindex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_pl,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algindex") < 0)) __PYX_ERR(4, 1267, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    __pyx_v_pl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algindex", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1267, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_90algindex(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_pl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_90algindex(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algindex", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":1291
 *             %7 = 2
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1292
 *         '''
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":1293
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1294
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1294, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":1293
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1295
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 1295, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1296
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1297
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_instance.pxi":1298
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1299
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algindex(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1298
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)
 */
  }

  /* "cypari/auto_instance.pxi":1300
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algindex(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_instance.pxi":1301
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1302
 *         cdef long _ret = algindex(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def alginit(self, B, C, v=None, long maxord=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1267
 *         return new_gen(_ret)
 * 
 *     def algindex(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the index of the central simple algebra:math:`A` over:math:`K` (as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1304
 *         return _ret
 * 
 *     def alginit(self, B, C, v=None, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the central simple algebra defined by data :math:`B`, :math:`C` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_93alginit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_92alginit[] = "\n        Initializes the central simple algebra defined by data :math:`B`, :math:`C` and\n        variable :math:`v`, as follows.\n        \n        - (multiplication table) :math:`B` is the base number field :math:`K` in :literal:`nfinit`\n          form, :math:`C` is a \"multiplication table\" over :math:`K`.\n          As a :math:`K`-vector space, the algebra is generated by a basis\n          :math:`(e_1 = 1,..., e_n)`; the table is given as a :literal:`t_VEC` of :math:`n` matrices in\n          :math:`M_n(K)`, giving the left multiplication by the basis elements\302\240:math:`e_i`, in the\n          given basis.\n          Assumes that :math:`e_1 = 1`, that the multiplication table is integral, and that\n          :math:`(\\bigoplus_{i = 1}^nK e_i,C)` describes a central simple algebra over :math:`K`.\n        \n        ::\n        \n            { mi = [0,-1,0, 0;\n             1, 0,0, 0;\n             0, 0,0,-1;\n             0, 0,1, 0];\n             mj = [0, 0,-1,0;\n             0, 0, 0,1;\n             1, 0, 0,0;\n             0,-1, 0,0];\n             mk = [0, 0, 0, 0;\n             0, 0,-1, 0;\n             0, 1, 0, 0;\n             1, 0, 0,-1];\n             A = alginit(nfinit(y), [matid(4), mi,mj,mk], 0); }\n        \n        represents (in a complicated way) the quaternion algebra :math:`(-1,-1)_\\mathbb{Q}`.\n        See below for a simpler solution.\n        \n        - (cyclic algebra) :math:`B` is an :literal:`rnf` structure attached to a cyclic\n          number field extension :math:`L/K` of degree :math:`d`, :math:`C` is a :literal:`t_VEC`\n          :literal:`[sigma,b]` with 2 components: :literal:`sigma` is a :literal:`t_POLMOD` representing\n          an automorphism generating :math:`Gal(L/K)`, :math:`b` is an element in :math:`K^*`. This\n          represents the cyclic algebra\302\240:math:`(L/K,\\sigma,b)`. Currently the element :math:`b` has\n          to be integral.\n        \n        ::\n        \n             ? Q = nfinit(y); T = p""olcyclo(5, 'x); F = rnfinit(Q, T);\n             ? A = alginit(F, [Mod(x^2,T), 3]);\n        \n        defines the cyclic algebra :math:`(L/\\mathbb{Q}, \\sigma, 3)`, where\n        :math:`L = \\mathbb{Q} (\\zeta_5)` and :math:`\\sigma:\\zeta:--->\\zeta^2` generates\n        :math:`Gal(L/\\mathbb{Q})`.\n        \n        - (quaternion algebra, special case of the above) :math:`B` is an :literal:`nf`\n          structure attached to a number field :math:`K`, :math:`C = [a,b]` is a vector\n          containing two elements of :math:`K^*` with :math:`a` not a square in :math:`K`, returns the quaternion algebra :math:`(a,b)_K`.\n          The variable :math:`v` (:literal:`'x` by default) must have higher priority than the\n          variable of :math:`K`:literal:`.pol` and is used to represent elements in the splitting\n          field :math:`L = K[x]/(x^2-a)`.\n        \n        ::\n        \n             ? Q = nfinit(y); A = alginit(Q, [-1,-1]); \\\\ (-1,-1)_Q\n        \n        - (algebra/:math:`K` defined by local Hasse invariants)\n          :math:`B` is an :literal:`nf` structure attached to a number field :math:`K`,\n          :math:`C = [d, [PR,h_f], h_i]` is a triple\n          containing an integer :math:`d > 1`, a pair :math:`[PR, h_f]` describing the\n          Hasse invariants at finite places, and :math:`h_i` the Hasse invariants\n          at archimedean (real) places. A local Hasse invariant belongs to :math:`(1/d)\\mathbb{Z}/\\mathbb{Z}\n          \\subset \\mathbb{Q}/\\mathbb{Z}`, and is given either as a :literal:`t_FRAC` (lift to :math:`(1/d)\\mathbb{Z}`),\n          a :literal:`t_INT` or :literal:`t_INTMOD` modulo :math:`d` (lift to :math:`\\mathbb{Z}/d\\mathbb{Z}`); a whole vector\n          of local invariants can also be given as a :literal:`t_VECSMALL`, whose\n          entries are handled as :literal:`t_INT`\302\240s. :literal:`PR` is a list of prime ideals\n          (:literal:`prid` structures), and :math:`h_f` is a vector of the same length ""giving the\n          local invariants at those maximal ideals. The invariants at infinite real\n          places are indexed by the real roots :math:`K`:literal:`.roots`: if the Archimedean\n          place :math:`v` is attached to the :math:`j`-th root, the value of\n          :math:`h_v` is given by :math:`h_i[j]`, must be :math:`0` or :math:`1/2` (or\302\240:math:`d/2` modulo\302\240:math:`d`), and\n          can be nonzero only if\302\240:math:`d` is even.\n        \n        By class field theory, provided the local invariants :math:`h_v` sum to :math:`0`, up\n        to Brauer equivalence, there is a unique central simple algebra over :math:`K`\n        with given local invariants and trivial invariant elsewhere. In particular,\n        up to isomorphism, there is a unique such algebra :math:`A` of degree :math:`d`.\n        \n        We realize :math:`A` as a cyclic algebra through class field theory. The variable :math:`v`\n        (:literal:`'x` by default) must have higher priority than the variable of\n        :math:`K`:literal:`.pol` and is used to represent elements in the (cyclic) splitting\n        field extension :math:`L/K` for :math:`A`.\n        \n        ::\n        \n             ? nf = nfinit(y^2+1);\n             ? PR = idealprimedec(nf,5); #PR\n             %2 = 2\n             ? hi = [];\n             ? hf = [PR, [1/3,-1/3]];\n             ? A = alginit(nf, [3,hf,hi]);\n             ? algsplittingfield(A).pol\n             %6 = x^3 - 21*x + 7\n        \n        - (matrix algebra, toy example) :math:`B` is an :literal:`nf` structure attached\n          to a number field :math:`K`, :math:`C = d` is a positive integer. Returns a cyclic\n          algebra isomorphic to the matrix algebra :math:`M_d(K)`.\n        \n        In all cases, this function computes a maximal order for the algebra by default,\n        which may require a lot of time. Setting :math:`maxord = 0` prevents this computation.\n        \n        The pari object representing su""ch an algebra :math:`A` is a :literal:`t_VEC` with the\n        following data:\n        \n        - A splitting field :math:`L` of :math:`A` of the same degree over :math:`K` as :math:`A`, in\n          :literal:`rnfinit` format, accessed with :literal:`algsplittingfield`.\n        \n        - The Hasse invariants at the real places of :math:`K`, accessed with\n          :literal:`alghassei`.\n        \n        - The Hasse invariants of :math:`A` at the finite primes of :math:`K` that ramify in\n          the natural order of :math:`A`, accessed with :literal:`alghassef`.\n        \n        - A basis of an order :math:`O_0` expressed on the basis of the natural\n          order, accessed with :literal:`algbasis`.\n        \n        - A basis of the natural order expressed on the basis of :math:`O_0`,\n          accessed with :literal:`alginvbasis`.\n        \n        - The left multiplication table of :math:`O_0` on the previous basis,\n          accessed with :literal:`algmultable`.\n        \n        - The characteristic of :math:`A` (always :math:`0`), accessed with :literal:`algchar`.\n        \n        - The absolute traces of the elements of the basis of :math:`O_0`.\n        \n        - If :math:`A` was constructed as a cyclic algebra\302\240:math:`(L/K,\\sigma,b)` of degree\n          :math:`d`, a :literal:`t_VEC` :math:`[\\sigma,\\sigma^2,...,\\sigma^{d-1}]`. The function\n          :literal:`algaut` returns :math:`\\sigma`.\n        \n        - If :math:`A` was constructed as a cyclic algebra\302\240:math:`(L/K,\\sigma,b)`, the\n          element :math:`b`, accessed with :literal:`algb`.\n        \n        - If :math:`A` was constructed with its multiplication table :math:`mt` over :math:`K`,\n          the :literal:`t_VEC` of :literal:`t_MAT` :math:`mt`, accessed with :literal:`algrelmultable`.\n        \n        - If :math:`A` was constructed with its multiplication table :math:`mt` over :math:`K`,\n          a :literal:`t_VEC` with three components: a "":literal:`t_COL` representing an element of :math:`A`\n          generating the splitting field :math:`L` as a maximal subfield of :math:`A`, a :literal:`t_MAT`\n          representing an :math:`L`-basis :math:`B` of :math:`A` expressed on the :math:`\\mathbb{Z}`-basis of\n          :math:`O_0`, and a :literal:`t_MAT` representing the :math:`\\mathbb{Z}`-basis of :math:`O_0`\n          expressed on :math:`B`. This data is accessed with :literal:`algsplittingdata`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_93alginit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_maxord;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alginit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_v,&__pyx_n_s_maxord,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_B)) != 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_C)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alginit", 0, 2, 4, 1); __PYX_ERR(4, 1304, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          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_maxord);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alginit") < 0)) __PYX_ERR(4, 1304, __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);
        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_B = values[0];
    __pyx_v_C = values[1];
    __pyx_v_v = values[2];
    if (values[3]) {
      __pyx_v_maxord = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_maxord == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 1304, __pyx_L3_error)
    } else {
      __pyx_v_maxord = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alginit", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1304, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alginit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_92alginit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_B, __pyx_v_C, __pyx_v_v, __pyx_v_maxord);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_92alginit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_v, long __pyx_v_maxord) {
  long __pyx_v__v;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("alginit", 0);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_instance.pxi":1451
 *           expressed on :math:`B`. This data is accessed with :literal:`algsplittingdata`.
 *         '''
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         C = objtogen(C)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1452
 *         '''
 *         B = objtogen(B)
 *         C = objtogen(C)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1453
 *         B = objtogen(B)
 *         C = objtogen(C)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":1454
 *         C = objtogen(C)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":1455
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 1455, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1454
 *         C = objtogen(C)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1456
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _C = (<Gen>C).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 1456, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1457
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = (<Gen>C).g
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_6;

  /* "cypari/auto_instance.pxi":1458
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
  __pyx_v__C = __pyx_t_6;

  /* "cypari/auto_instance.pxi":1459
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _C = (<Gen>C).g
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alginit(__pyx_v__B, __pyx_v__C, __pyx_v__v, __pyx_v_maxord);

  /* "cypari/auto_instance.pxi":1460
 *         cdef GEN _C = (<Gen>C).g
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alginv(self, al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1304
 *         return _ret
 * 
 *     def alginit(self, B, C, v=None, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the central simple algebra defined by data :math:`B`, :math:`C` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alginit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1462
 *         return new_gen(_ret)
 * 
 *     def alginv(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its inverse :math:`x^{-1}` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_95alginv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_94alginv[] = "\n        Given an element :math:`x` in :emphasis:`al`, computes its inverse :math:`x^{-1}` in the\n        algebra :emphasis:`al`. Assumes that :math:`x` is invertible.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? alginv(A,[1,1,0,0]~)\n            %2 = [1/2, 1/2, 0, 0]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_95alginv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alginv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,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_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alginv", 1, 2, 2, 1); __PYX_ERR(4, 1462, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alginv") < 0)) __PYX_ERR(4, 1462, __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_al = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alginv", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alginv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_94alginv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_94alginv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alginv", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":1475
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1476
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1477
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1477, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1478
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = alginv(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1479
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alginv(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1480
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = alginv(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alginv(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_instance.pxi":1481
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = alginv(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alginvbasis(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1462
 *         return new_gen(_ret)
 * 
 *     def alginv(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its inverse :math:`x^{-1}` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alginv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1483
 *         return new_gen(_ret)
 * 
 *     def alginvbasis(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_97alginvbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_96alginvbasis[] = "\n        Given an central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :math:`\\mathbb{Z}`-basis of the natural order in :emphasis:`al` with respect to the\n        order\302\240:math:`O_0` stored in :emphasis:`al`.\n        \n        ::\n        \n            A = alginit(nfinit(y), [-1,-1]);\n            ? alginvbasis(A)\n            %2 =\n            [1 0 0 -1]\n            \n            [0 1 0 -1]\n            \n            [0 0 1 -1]\n            \n            [0 0 0 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_97alginvbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alginvbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_96alginvbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_96alginvbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alginvbasis", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1502
 *             [0 0 0 2]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1503
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alginvbasis(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1503, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1504
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alginvbasis(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1505
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alginvbasis(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alginvbasis(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1506
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alginvbasis(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algisassociative(self, mt, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1483
 *         return new_gen(_ret)
 * 
 *     def alginvbasis(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alginvbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1508
 *         return new_gen(_ret)
 * 
 *     def algisassociative(self, mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if the multiplication table :literal:`mt` is suitable for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_99algisassociative(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_98algisassociative[] = "\n        Returns 1 if the multiplication table :literal:`mt` is suitable for\n        :literal:`algtableinit(mt,p)`, 0 otherwise. More precisely, :literal:`mt` should be\n        a :literal:`t_VEC` of :math:`n` matrices in :math:`M_n(K)`, giving the left multiplications\n        by the basis elements :math:`e_1,..., e_n` (structure constants).\n        We check whether the first basis element :math:`e_1` is :math:`1` and :math:`e_i(e_je_k) =\n        (e_ie_j)e_k` for all :math:`i,j,k`.\n        \n        ::\n        \n             ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n             ? algisassociative(mt)\n             %2 = 1\n        \n        May be used to check a posteriori an algebra: we also allow :literal:`mt` as\n        output by :literal:`algtableinit` (:math:`p` is ignored in this case).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_99algisassociative(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mt = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algisassociative (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_mt)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algisassociative") < 0)) __PYX_ERR(4, 1508, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mt = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algisassociative", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1508, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algisassociative", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_98algisassociative(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mt, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_98algisassociative(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mt, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__mt;
  GEN __pyx_v__p;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algisassociative", 0);
  __Pyx_INCREF(__pyx_v_mt);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":1526
 *         output by :literal:`algtableinit` (:math:`p` is ignored in this case).
 *         '''
 *         mt = objtogen(mt)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mt, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mt, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1527
 *         '''
 *         mt = objtogen(mt)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":1528
 *         mt = objtogen(mt)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1529
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1529, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":1528
 *         mt = objtogen(mt)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1530
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 1530, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1531
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = gen_0
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mt)->__pyx_base.g;
  __pyx_v__mt = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1532
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = gen_0;

  /* "cypari/auto_instance.pxi":1533
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1534
 *         cdef GEN _p = gen_0
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algisassociative(_mt, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1533
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)
 */
  }

  /* "cypari/auto_instance.pxi":1535
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algisassociative(__pyx_v__mt, __pyx_v__p);

  /* "cypari/auto_instance.pxi":1536
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1537
 *         cdef int _ret = algisassociative(_mt, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algiscommutative(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1508
 *         return new_gen(_ret)
 * 
 *     def algisassociative(self, mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if the multiplication table :literal:`mt` is suitable for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algisassociative", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mt);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1539
 *         return _ret
 * 
 *     def algiscommutative(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_101algiscommutative(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_100algiscommutative[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central\n        simple algebra output by :literal:`alginit`, tests whether the algebra :emphasis:`al` is\n        commutative.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algiscommutative(A)\n            %3 = 0\n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? algiscommutative(A)\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_101algiscommutative(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algiscommutative (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_100algiscommutative(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_100algiscommutative(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algiscommutative", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1556
 *             %6 = 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1557
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algiscommutative(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1557, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1558
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algiscommutative(_al)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1559
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algiscommutative(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algiscommutative(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1560
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algiscommutative(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1561
 *         cdef int _ret = algiscommutative(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algisdivision(self, al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1539
 *         return _ret
 * 
 *     def algiscommutative(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algiscommutative", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1563
 *         return _ret
 * 
 *     def algisdivision(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_103algisdivision(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_102algisdivision[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests\n        whether :emphasis:`al` is a division algebra. If :emphasis:`pl` is set, it should be a\n        prime ideal of\302\240:math:`K` or an integer between\302\240:math:`1` and\302\240:math:`r_1+r_2`, and in that case\n        tests whether :emphasis:`al` is locally a division algebra at the place :emphasis:`pl`\n        instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algisdivision(A, 1)\n            %3 = 1\n            ? algisdivision(A, 2)\n            %4 = 0\n            ? algisdivision(A, idealprimedec(nf,2)[1])\n            %5 = 1\n            ? algisdivision(A, idealprimedec(nf,5)[1])\n            %6 = 0\n            ? algisdivision(A)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_103algisdivision(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algisdivision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_pl,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algisdivision") < 0)) __PYX_ERR(4, 1563, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    __pyx_v_pl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algisdivision", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1563, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algisdivision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_102algisdivision(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_pl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_102algisdivision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algisdivision", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":1586
 *             %7 = 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1587
 *         '''
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":1588
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1589
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":1588
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1590
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 1590, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1591
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1592
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_instance.pxi":1593
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1594
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algisdivision(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1593
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)
 */
  }

  /* "cypari/auto_instance.pxi":1595
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algisdivision(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_instance.pxi":1596
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1597
 *         cdef int _ret = algisdivision(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algisramified(self, al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1563
 *         return _ret
 * 
 *     def algisdivision(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algisdivision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1599
 *         return _ret
 * 
 *     def algisramified(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_105algisramified(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_104algisramified[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests\n        whether :emphasis:`al` is ramified, i.e. not isomorphic to a matrix algebra over its\n        center. If :emphasis:`pl` is set, it should be a prime ideal of\302\240:math:`K` or an integer\n        between\302\240:math:`1` and\302\240:math:`r_1+r_2`, and in that case tests whether :emphasis:`al` is locally\n        ramified at the place :emphasis:`pl` instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algisramified(A, 1)\n            %3 = 1\n            ? algisramified(A, 2)\n            %4 = 0\n            ? algisramified(A, idealprimedec(nf,2)[1])\n            %5 = 1\n            ? algisramified(A, idealprimedec(nf,5)[1])\n            %6 = 0\n            ? algisramified(A)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_105algisramified(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algisramified (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_pl,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algisramified") < 0)) __PYX_ERR(4, 1599, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    __pyx_v_pl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algisramified", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1599, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algisramified", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_104algisramified(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_pl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_104algisramified(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algisramified", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":1622
 *             %7 = 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1623
 *         '''
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":1624
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1625
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":1624
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1626
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 1626, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1627
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1628
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_instance.pxi":1629
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1630
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algisramified(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1629
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)
 */
  }

  /* "cypari/auto_instance.pxi":1631
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algisramified(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_instance.pxi":1632
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1633
 *         cdef int _ret = algisramified(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algissemisimple(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1599
 *         return _ret
 * 
 *     def algisramified(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algisramified", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1635
 *         return _ret
 * 
 *     def algissemisimple(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_107algissemisimple(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_106algissemisimple[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central\n        simple algebra output by :literal:`alginit`, tests whether the algebra :emphasis:`al` is\n        semisimple.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algissemisimple(A)\n            %3 = 0\n            ? m_i=[0,-1,0,0;1,0,0,0;0,0,0,-1;0,0,1,0]; \\\\ quaternion algebra (-1,-1)\n            ? m_j=[0,0,-1,0;0,0,0,1;1,0,0,0;0,-1,0,0];\n            ? m_k=[0,0,0,-1;0,0,-1,0;0,1,0,0;1,0,0,0];\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = algtableinit(mt);\n            ? algissemisimple(A)\n            %9 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_107algissemisimple(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algissemisimple (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_106algissemisimple(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_106algissemisimple(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algissemisimple", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1655
 *             %9 = 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1656
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissemisimple(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1656, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1657
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algissemisimple(_al)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1658
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissemisimple(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algissemisimple(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1659
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissemisimple(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1660
 *         cdef int _ret = algissemisimple(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algissimple(self, al, long ss=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1635
 *         return _ret
 * 
 *     def algissemisimple(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algissemisimple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1662
 *         return _ret
 * 
 *     def algissimple(self, al, long ss=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_109algissimple(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_108algissimple[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central\n        simple algebra output by :literal:`alginit`, tests whether the algebra :emphasis:`al` is\n        simple. If :math:`ss = 1`, assumes that the algebra\302\240:emphasis:`al` is semisimple\n        without testing it.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt); \\\\ matrices [*,*; 0,*]\n            ? algissimple(A)\n            %3 = 0\n            ? algissimple(A,1) \\\\ incorrectly assume that A is semisimple\n            %4 = 1\n            ? m_i=[0,-1,0,0;1,0,0,0;0,0,0,-1;0,0,1,0];\n            ? m_j=[0,0,-1,0;0,0,0,1;1,0,0,0;0,-1,0,0];\n            ? m_k=[0,0,0,-1;0,0,b,0;0,1,0,0;1,0,0,0];\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = algtableinit(mt); \\\\ quaternion algebra (-1,-1)\n            ? algissimple(A)\n            %10 = 1\n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2); \\\\ direct product F_4 x F_2\n            ? algissimple(A)\n            %13 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_109algissimple(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  long __pyx_v_ss;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algissimple (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_ss,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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ss);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algissimple") < 0)) __PYX_ERR(4, 1662, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    if (values[1]) {
      __pyx_v_ss = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_ss == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 1662, __pyx_L3_error)
    } else {
      __pyx_v_ss = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algissimple", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1662, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algissimple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_108algissimple(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_ss);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_108algissimple(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, long __pyx_v_ss) {
  GEN __pyx_v__al;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algissimple", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1689
 *             %13 = 0
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1690
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissimple(_al, ss)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1690, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1691
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algissimple(_al, ss)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1692
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissimple(_al, ss)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algissimple(__pyx_v__al, __pyx_v_ss);

  /* "cypari/auto_instance.pxi":1693
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissimple(_al, ss)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1694
 *         cdef int _ret = algissimple(_al, ss)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algissplit(self, al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1662
 *         return _ret
 * 
 *     def algissimple(self, al, long ss=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algissimple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1696
 *         return _ret
 * 
 *     def algissplit(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_111algissplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_110algissplit[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests\n        whether\302\240:emphasis:`al` is split, i.e. isomorphic to a matrix algebra over its center.\n        If :emphasis:`pl` is set, it should be a prime ideal of\302\240:math:`K` or an integer between\302\240:math:`1`\n        and\302\240:math:`r_1+r_2`, and in that case tests whether :emphasis:`al` is locally split at the\n        place :emphasis:`pl` instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algissplit(A, 1)\n            %3 = 0\n            ? algissplit(A, 2)\n            %4 = 1\n            ? algissplit(A, idealprimedec(nf,2)[1])\n            %5 = 0\n            ? algissplit(A, idealprimedec(nf,5)[1])\n            %6 = 1\n            ? algissplit(A)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_111algissplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algissplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_pl,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algissplit") < 0)) __PYX_ERR(4, 1696, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    __pyx_v_pl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algissplit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1696, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algissplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_110algissplit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_pl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_110algissplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algissplit", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":1719
 *             %7 = 0
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1720
 *         '''
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":1721
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1722
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":1721
 *         al = objtogen(al)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1723
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 1723, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1724
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1725
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_instance.pxi":1726
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1727
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algissplit(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1726
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)
 */
  }

  /* "cypari/auto_instance.pxi":1728
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algissplit(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_instance.pxi":1729
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":1730
 *         cdef int _ret = algissplit(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def alglatelement(self, al, lat, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1696
 *         return _ret
 * 
 *     def algissplit(self, al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algissplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1732
 *         return _ret
 * 
 *     def alglatelement(self, al, lat, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al`, a lattice :emphasis:`lat` and a:literal:`t_COL`:emphasis:`c`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_113alglatelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_112alglatelement[] = "\n        Given an algebra :emphasis:`al`, a lattice :emphasis:`lat` and a\302\240:literal:`t_COL`\302\240:emphasis:`c`,\n        returns the element of\302\240:emphasis:`al` whose coordinates on the \\mathbb{Z}-basis of\302\240:emphasis:`lat`\n        are given by\302\240:emphasis:`c`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? a1 = [1,-1,0,1,2,0,1,2]~;\n            ? lat1 = alglathnf(al,a1);\n            ? c = [1..8]~;\n            ? elt = alglatelement(al,lat1,c);\n            ? alglatcontains(al,lat1,elt,&c2)\n            %6 = 1\n            ? c==c2\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_113alglatelement(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_lat = 0;
  PyObject *__pyx_v_c = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatelement (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_lat,&__pyx_n_s_c,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_lat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatelement", 1, 3, 3, 1); __PYX_ERR(4, 1732, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatelement", 1, 3, 3, 2); __PYX_ERR(4, 1732, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatelement") < 0)) __PYX_ERR(4, 1732, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_lat = values[1];
    __pyx_v_c = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatelement", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1732, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_112alglatelement(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_lat, __pyx_v_c);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_112alglatelement(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat, PyObject *__pyx_v_c) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat;
  GEN __pyx_v__c;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatelement", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_lat);
  __Pyx_INCREF(__pyx_v_c);

  /* "cypari/auto_instance.pxi":1750
 *             %7 = 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         lat = objtogen(lat)
 *         c = objtogen(c)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1751
 *         '''
 *         al = objtogen(al)
 *         lat = objtogen(lat)             # <<<<<<<<<<<<<<
 *         c = objtogen(c)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1752
 *         al = objtogen(al)
 *         lat = objtogen(lat)
 *         c = objtogen(c)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1753
 *         lat = objtogen(lat)
 *         c = objtogen(c)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat = (<Gen>lat).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1753, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1754
 *         c = objtogen(c)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat = (<Gen>lat).g
 *         cdef GEN _c = (<Gen>c).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1755
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat = (<Gen>lat).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat)->__pyx_base.g;
  __pyx_v__lat = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1756
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat = (<Gen>lat).g
 *         cdef GEN _c = (<Gen>c).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c)->__pyx_base.g;
  __pyx_v__c = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1757
 *         cdef GEN _lat = (<Gen>lat).g
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatelement(__pyx_v__al, __pyx_v__lat, __pyx_v__c);

  /* "cypari/auto_instance.pxi":1758
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglathnf(self, al, m, d=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1732
 *         return _ret
 * 
 *     def alglatelement(self, al, lat, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al`, a lattice :emphasis:`lat` and a:literal:`t_COL`:emphasis:`c`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_lat);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1760
 *         return new_gen(_ret)
 * 
 *     def alglathnf(self, al, m, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and a matrix :emphasis:`m` with columns representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_115alglathnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_114alglathnf[] = "\n        Given an algebra :emphasis:`al` and a matrix :emphasis:`m` with columns representing\n        elements of :emphasis:`al`, returns the lattice :math:`L` generated by the columns of\n        :emphasis:`m`. If provided, :emphasis:`d` must be a rational number such that :math:`L` contains\n        :emphasis:`d` times the natural basis of\302\240:emphasis:`al`. The argument :emphasis:`m` is also\n        allowed to be a :literal:`t_VEC` of :literal:`t_MAT`, in which case :emphasis:`m` is replaced by\n        the concatenation of the matrices, or a :literal:`t_COL`, in which case :emphasis:`m` is\n        replaced by its left multiplication table as an element of :emphasis:`al`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? a = [1,1,-1/2,1,1/3,-1,1,1]~;\n            ? mt = algtomatrix(al,a,1);\n            ? lat = alglathnf(al,mt);\n            ? lat[2]\n            %5 = 1/6\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_115alglathnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglathnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_m,&__pyx_n_s_d,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_al)) != 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_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglathnf", 0, 2, 3, 1); __PYX_ERR(4, 1760, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglathnf") < 0)) __PYX_ERR(4, 1760, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_al = values[0];
    __pyx_v_m = values[1];
    __pyx_v_d = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglathnf", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1760, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_114alglathnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_m, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_114alglathnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_m, PyObject *__pyx_v_d) {
  int __pyx_v__have_d;
  GEN __pyx_v__al;
  GEN __pyx_v__m;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("alglathnf", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_m);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":1779
 *             %5 = 1/6
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         cdef bint _have_d = (d is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1780
 *         '''
 *         al = objtogen(al)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1781
 *         al = objtogen(al)
 *         m = objtogen(m)
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_2 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_2;

  /* "cypari/auto_instance.pxi":1782
 *         m = objtogen(m)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1783
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":1782
 *         m = objtogen(m)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":1784
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 1784, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1785
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1786
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = gen_0
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_4;

  /* "cypari/auto_instance.pxi":1787
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = gen_0;

  /* "cypari/auto_instance.pxi":1788
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":1789
 *         cdef GEN _d = gen_0
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_instance.pxi":1788
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 */
  }

  /* "cypari/auto_instance.pxi":1790
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglathnf(__pyx_v__al, __pyx_v__m, __pyx_v__d);

  /* "cypari/auto_instance.pxi":1791
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatindex(self, al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1760
 *         return new_gen(_ret)
 * 
 *     def alglathnf(self, al, m, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and a matrix :emphasis:`m` with columns representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1793
 *         return new_gen(_ret)
 * 
 *     def alglatindex(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra:emphasis:`al` and two lattices:emphasis:`lat1` and:emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_117alglatindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_116alglatindex[] = "\n        Given an algebra\302\240:emphasis:`al` and two lattices\302\240:emphasis:`lat1` and\302\240:emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the generalized index of\302\240:emphasis:`lat1` relative\n        to\302\240:emphasis:`lat2`, i.e.\302\240:math:`\\|lat2/lat1\\cap lat2\\|/\\|lat1/lat1\\cap lat2\\|`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? lat1 = alglathnf(al,[1,1,0,0,0,0,0,0]~);\n            ? lat2 = alglathnf(al,[1,0,1,0,0,0,0,0]~);\n            ? alglatindex(al,lat1,lat2)\n            %4 = 1\n            ? lat1==lat2\n            %5 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_117alglatindex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatindex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_lat1,&__pyx_n_s_lat2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_lat1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatindex", 1, 3, 3, 1); __PYX_ERR(4, 1793, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatindex", 1, 3, 3, 2); __PYX_ERR(4, 1793, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatindex") < 0)) __PYX_ERR(4, 1793, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_lat1 = values[1];
    __pyx_v_lat2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatindex", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1793, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_116alglatindex(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_lat1, __pyx_v_lat2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_116alglatindex(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatindex", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_instance.pxi":1809
 *             %5 = 0
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1810
 *         '''
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1811
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1812
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1812, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1813
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1814
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1815
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1816
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatindex(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_instance.pxi":1817
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatlefttransporter(self, al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1793
 *         return new_gen(_ret)
 * 
 *     def alglatindex(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra:emphasis:`al` and two lattices:emphasis:`lat1` and:emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1819
 *         return new_gen(_ret)
 * 
 *     def alglatlefttransporter(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_119alglatlefttransporter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_118alglatlefttransporter[] = "\n        Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the left transporter from :emphasis:`lat1` to\302\240:emphasis:`lat2`, i.e.\n        the set of\302\240:math:`x\\in al` such that\302\240:math:`x.lat1 \\subset lat2`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? lat1 = alglathnf(al,[1,-1,0,1,2,0,5,2]~);\n            ? lat2 = alglathnf(al,[0,1,-2,-1,0,0,3,1]~);\n            ? tr = alglatlefttransporter(al,lat1,lat2);\n            ? a = alglatelement(al,tr,[0,0,0,0,0,0,1,0]~);\n            ? alglatsubset(al,alglatmul(al,a,lat1),lat2)\n            %6 = 1\n            ? alglatsubset(al,alglatmul(al,lat1,a),lat2)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_119alglatlefttransporter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatlefttransporter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_lat1,&__pyx_n_s_lat2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_lat1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatlefttransporter", 1, 3, 3, 1); __PYX_ERR(4, 1819, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatlefttransporter", 1, 3, 3, 2); __PYX_ERR(4, 1819, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatlefttransporter") < 0)) __PYX_ERR(4, 1819, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_lat1 = values[1];
    __pyx_v_lat2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatlefttransporter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1819, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatlefttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_118alglatlefttransporter(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_lat1, __pyx_v_lat2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_118alglatlefttransporter(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatlefttransporter", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_instance.pxi":1837
 *             %7 = 0
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1838
 *         '''
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1839
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1840
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1840, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1841
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1842
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1843
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1844
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatlefttransporter(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_instance.pxi":1845
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatmul(self, al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1819
 *         return new_gen(_ret)
 * 
 *     def alglatlefttransporter(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatlefttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1847
 *         return new_gen(_ret)
 * 
 *     def alglatmul(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_121alglatmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_120alglatmul[] = "\n        Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the lattice generated by the products of elements\n        of\302\240:emphasis:`lat1` and\302\240:emphasis:`lat2`.\n        One of :emphasis:`lat1` and :emphasis:`lat2` is also allowed to be an element of\302\240:emphasis:`al`;\n        in this case, computes the product of the element and the lattice.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? a1 = [1,-1,0,1,2,0,1,2]~;\n            ? a2 = [0,1,2,-1,0,0,3,1]~;\n            ? lat1 = alglathnf(al,a1);\n            ? lat2 = alglathnf(al,a2);\n            ? lat3 = alglatmul(al,lat1,lat2);\n            ? matdet(lat3[1])\n            %7 = 29584\n            ? lat3 == alglathnf(al, algmul(al,a1,a2))\n            %8 = 0\n            ? lat3 == alglatmul(al, lat1, a2)\n            %9 = 0\n            ? lat3 == alglatmul(al, a1, lat2)\n            %10 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_121alglatmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_lat1,&__pyx_n_s_lat2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_lat1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatmul", 1, 3, 3, 1); __PYX_ERR(4, 1847, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatmul", 1, 3, 3, 2); __PYX_ERR(4, 1847, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatmul") < 0)) __PYX_ERR(4, 1847, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_lat1 = values[1];
    __pyx_v_lat2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatmul", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1847, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_120alglatmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_lat1, __pyx_v_lat2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_120alglatmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatmul", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_instance.pxi":1872
 *             %10 = 0
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1873
 *         '''
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1874
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1875
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1875, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1876
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1877
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1878
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1879
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatmul(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_instance.pxi":1880
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatrighttransporter(self, al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1847
 *         return new_gen(_ret)
 * 
 *     def alglatmul(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1882
 *         return new_gen(_ret)
 * 
 *     def alglatrighttransporter(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_123alglatrighttransporter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_122alglatrighttransporter[] = "\n        Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the right transporter from :emphasis:`lat1` to\302\240:emphasis:`lat2`, i.e.\n        the set of\302\240:math:`x\\in al` such that\302\240:math:`lat1.x \\subset lat2`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? lat1 = alglathnf(al,matdiagonal([1,3,7,1,2,8,5,2]));\n            ? lat2 = alglathnf(al,matdiagonal([5,3,8,1,9,8,7,1]));\n            ? tr = alglatrighttransporter(al,lat1,lat2);\n            ? a = alglatelement(al,tr,[0,0,0,0,0,0,0,1]~);\n            ? alglatsubset(al,alglatmul(al,lat1,a),lat2)\n            %6 = 1\n            ? alglatsubset(al,alglatmul(al,a,lat1),lat2)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_123alglatrighttransporter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatrighttransporter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_lat1,&__pyx_n_s_lat2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_lat1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatrighttransporter", 1, 3, 3, 1); __PYX_ERR(4, 1882, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatrighttransporter", 1, 3, 3, 2); __PYX_ERR(4, 1882, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatrighttransporter") < 0)) __PYX_ERR(4, 1882, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_lat1 = values[1];
    __pyx_v_lat2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatrighttransporter", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1882, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatrighttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_122alglatrighttransporter(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_lat1, __pyx_v_lat2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_122alglatrighttransporter(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatrighttransporter", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_instance.pxi":1900
 *             %7 = 0
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1901
 *         '''
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1902
 *         al = objtogen(al)
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1903
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1903, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1904
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1905
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1906
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1907
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatrighttransporter(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_instance.pxi":1908
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algmakeintegral(self, mt, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1882
 *         return new_gen(_ret)
 * 
 *     def alglatrighttransporter(self, al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.alglatrighttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1910
 *         return new_gen(_ret)
 * 
 *     def algmakeintegral(self, mt, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`mt` being a multiplication table over :math:`\mathbb{Q}` in the same format as the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_125algmakeintegral(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_124algmakeintegral[] = "\n        :emphasis:`mt` being a multiplication table over :math:`\\mathbb{Q}` in the same format as the\n        input of :literal:`algtableinit`, computes an integral multiplication table for an\n        isomorphic algebra. When :math:`maps = 1`, returns a :literal:`t_VEC`\n        :math:`[mt2,S,T]` where :emphasis:`S` and :emphasis:`T` are matrices\n        respectively representing the map from the algebra defined by :emphasis:`mt` to the\n        one defined by :emphasis:`mt2` and its inverse.\n        \n        ::\n        \n            ? mt = [matid(2),[0,-1/4;1,0]];\n            ? algtableinit(mt);\n             *** at top-level: algtableinit(mt)\n             *** ^----------------\n             *** algtableinit: domain error in algtableinit: denominator(mt) != 1\n            ? mt2 = algmakeintegral(mt);\n            ? al = algtableinit(mt2);\n            ? algisassociative(al)\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_125algmakeintegral(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mt = 0;
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algmakeintegral (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_maps,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_mt)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algmakeintegral") < 0)) __PYX_ERR(4, 1910, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mt = values[0];
    if (values[1]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 1910, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algmakeintegral", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1910, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algmakeintegral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_124algmakeintegral(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mt, __pyx_v_maps);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_124algmakeintegral(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mt, long __pyx_v_maps) {
  GEN __pyx_v__mt;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algmakeintegral", 0);
  __Pyx_INCREF(__pyx_v_mt);

  /* "cypari/auto_instance.pxi":1931
 *             %4 = 1
 *         '''
 *         mt = objtogen(mt)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mt, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mt, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1932
 *         '''
 *         mt = objtogen(mt)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _ret = algmakeintegral(_mt, maps)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1932, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1933
 *         mt = objtogen(mt)
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algmakeintegral(_mt, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mt)->__pyx_base.g;
  __pyx_v__mt = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1934
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _ret = algmakeintegral(_mt, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algmakeintegral(__pyx_v__mt, __pyx_v_maps);

  /* "cypari/auto_instance.pxi":1935
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _ret = algmakeintegral(_mt, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algmul(self, al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1910
 *         return new_gen(_ret)
 * 
 *     def algmakeintegral(self, mt, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`mt` being a multiplication table over :math:`\mathbb{Q}` in the same format as the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algmakeintegral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mt);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1937
 *         return new_gen(_ret)
 * 
 *     def algmul(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their product :math:`xy`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_127algmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_126algmul[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their product :math:`xy`\n        in the algebra\302\240:emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algmul(A,[1,1,0,0]~,[0,0,2,1]~)\n            %2 = [2, 3, 5, -4]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_127algmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algmul", 1, 3, 3, 1); __PYX_ERR(4, 1937, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algmul", 1, 3, 3, 2); __PYX_ERR(4, 1937, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algmul") < 0)) __PYX_ERR(4, 1937, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algmul", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 1937, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_126algmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_126algmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algmul", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":1950
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1951
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1952
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1953
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1953, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1954
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1955
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algmul(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1956
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algmul(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1957
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algmul(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algmul(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":1958
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algmul(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algmultable(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1937
 *         return new_gen(_ret)
 * 
 *     def algmul(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their product :math:`xy`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":1960
 *         return new_gen(_ret)
 * 
 *     def algmultable(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a multiplication table of :emphasis:`al` over its
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_129algmultable(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_128algmultable[] = "\n        Returns a multiplication table of :emphasis:`al` over its\n        prime subfield (:math:`\\mathbb{Q}` or :math:`\\mathbb{F}_p`), as a :literal:`t_VEC` of :literal:`t_MAT`: the left\n        multiplication tables of basis elements. If :emphasis:`al` was output by\n        :literal:`algtableinit`, returns the multiplication table used to define :emphasis:`al`.\n        If :emphasis:`al` was output by :literal:`alginit`, returns the multiplication table of\n        the order\302\240:math:`O_0` stored in :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? M = algmultable(A);\n            ? #M\n            %3 = 4\n            ? M[1] \\\\ multiplication by e_1 = 1\n            %4 =\n            [1 0 0 0]\n            \n            [0 1 0 0]\n            \n            [0 0 1 0]\n            \n            [0 0 0 1]\n            \n            ? M[2]\n            %5 =\n            [0 -1 1 0]\n            \n            [1 0 1 1]\n            \n            [0 0 1 1]\n            \n            [0 0 -2 -1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_129algmultable(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algmultable (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_128algmultable(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_128algmultable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algmultable", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":1995
 *             [0 0 -2 -1]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":1996
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algmultable(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 1996, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":1997
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algmultable(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":1998
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algmultable(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algmultable(__pyx_v__al);

  /* "cypari/auto_instance.pxi":1999
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algmultable(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algneg(self, al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 1999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":1960
 *         return new_gen(_ret)
 * 
 *     def algmultable(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a multiplication table of :emphasis:`al` over its
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algmultable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2001
 *         return new_gen(_ret)
 * 
 *     def algneg(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its opposite :math:`-x` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_131algneg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_130algneg[] = "\n        Given an element :math:`x` in :emphasis:`al`, computes its opposite :math:`-x` in the\n        algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algneg(A,[1,1,0,0]~)\n            %2 = [-1, -1, 0, 0]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_131algneg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algneg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,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_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algneg", 1, 2, 2, 1); __PYX_ERR(4, 2001, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algneg") < 0)) __PYX_ERR(4, 2001, __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_al = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algneg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2001, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_130algneg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_130algneg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algneg", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2014
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2015
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2016
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2016, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2017
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algneg(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2018
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algneg(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2019
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algneg(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algneg(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_instance.pxi":2020
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algneg(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algnorm(self, al, x, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2001
 *         return new_gen(_ret)
 * 
 *     def algneg(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its opposite :math:`-x` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2022
 *         return new_gen(_ret)
 * 
 *     def algnorm(self, al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its norm. If :emphasis:`al` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_133algnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_132algnorm[] = "\n        Given an element :emphasis:`x` in :emphasis:`al`, computes its norm. If :emphasis:`al` is\n        a table algebra output by :literal:`algtableinit` or if :math:`abs = 1`, returns the\n        absolute norm of :emphasis:`x`, which is an element of :math:`\\mathbb{F}_p` of\302\240:math:`\\mathbb{Q}`; if :emphasis:`al` is\n        a central simple algebra output by :literal:`alginit` and :math:`abs = 0` (default), returns\n        the reduced norm of :emphasis:`x`, which is an element of the center of :emphasis:`al`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,19);\n            ? algnorm(A,[0,-2,3]~)\n            %3 = 18\n            ? nf = nfinit(y^2-5);\n            ? B = alginit(nf,[-1,y]);\n            ? b = [x,1]~;\n            ? n = algnorm(B,b)\n            %7 = Mod(-y + 1, y^2 - 5)\n            ? algnorm(B,b,1)\n            %8 = 16\n            ? nfeltnorm(nf,n)^algdegree(B)\n            %9 = 16\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_133algnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_abs,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algnorm", 0, 2, 3, 1); __PYX_ERR(4, 2022, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algnorm") < 0)) __PYX_ERR(4, 2022, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_al = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2022, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algnorm", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2022, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_132algnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_abs);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_132algnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algnorm", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2048
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2049
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2050
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2050, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2051
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algnorm(_al, _x, abs)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2052
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algnorm(_al, _x, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2053
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algnorm(_al, _x, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algnorm(__pyx_v__al, __pyx_v__x, __pyx_v_abs);

  /* "cypari/auto_instance.pxi":2054
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algnorm(_al, _x, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algpoleval(self, al, T, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2022
 *         return new_gen(_ret)
 * 
 *     def algnorm(self, al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its norm. If :emphasis:`al` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2056
 *         return new_gen(_ret)
 * 
 *     def algpoleval(self, al, T, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al` and a polynomial :math:`T` in :math:`K[X]`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_135algpoleval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_134algpoleval[] = "\n        Given an element :math:`b` in :emphasis:`al` and a polynomial :math:`T` in :math:`K[X]`,\n        computes\302\240:math:`T(b)` in\302\240:emphasis:`al`. Also accepts as input a :literal:`t_VEC`\302\240:math:`[b,mb]`\n        where\302\240:math:`mb` is the left multiplication table of\302\240:math:`b`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? al = alginit(nf,[y,-1]);\n            ? b = [1..8]~;\n            ? pol = algcharpoly(al,b,,1);\n            ? algpoleval(al,pol,b)==0\n            %5 = 1\n            ? mb = algtomatrix(al,b,1);\n            ? algpoleval(al,pol,[b,mb])==0\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_135algpoleval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algpoleval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_T,&__pyx_n_s_b,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algpoleval", 1, 3, 3, 1); __PYX_ERR(4, 2056, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algpoleval", 1, 3, 3, 2); __PYX_ERR(4, 2056, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algpoleval") < 0)) __PYX_ERR(4, 2056, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_T = values[1];
    __pyx_v_b = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algpoleval", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2056, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algpoleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_134algpoleval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_T, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_134algpoleval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_T, PyObject *__pyx_v_b) {
  GEN __pyx_v__al;
  GEN __pyx_v__T;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algpoleval", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":2074
 *             %7 = 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         b = objtogen(b)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2075
 *         '''
 *         al = objtogen(al)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2076
 *         al = objtogen(al)
 *         T = objtogen(T)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2077
 *         T = objtogen(T)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2077, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2078
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2079
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algpoleval(_al, _T, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2080
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algpoleval(_al, _T, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2081
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algpoleval(_al, _T, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algpoleval(__pyx_v__al, __pyx_v__T, __pyx_v__b);

  /* "cypari/auto_instance.pxi":2082
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algpoleval(_al, _T, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algpow(self, al, x, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2056
 *         return new_gen(_ret)
 * 
 *     def algpoleval(self, al, T, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al` and a polynomial :math:`T` in :math:`K[X]`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algpoleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2084
 *         return new_gen(_ret)
 * 
 *     def algpow(self, al, x, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al` and an integer :math:`n`, computes the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_137algpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_136algpow[] = "\n        Given an element :math:`x` in :emphasis:`al` and an integer :math:`n`, computes the\n        power :math:`x^n` in the algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algpow(A,[1,1,0,0]~,7)\n            %2 = [8, -8, 0, 0]~\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_137algpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algpow", 1, 3, 3, 1); __PYX_ERR(4, 2084, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algpow", 1, 3, 3, 2); __PYX_ERR(4, 2084, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algpow") < 0)) __PYX_ERR(4, 2084, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_x = values[1];
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algpow", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2084, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_136algpow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_136algpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_n) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algpow", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":2097
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         n = objtogen(n)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2098
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2099
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2100
 *         x = objtogen(x)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2100, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2101
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2102
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = algpow(_al, _x, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2103
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algpow(_al, _x, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2104
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = algpow(_al, _x, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algpow(__pyx_v__al, __pyx_v__x, __pyx_v__n);

  /* "cypari/auto_instance.pxi":2105
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = algpow(_al, _x, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algprimesubalg(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2084
 *         return new_gen(_ret)
 * 
 *     def algpow(self, al, x, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al` and an integer :math:`n`, computes the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2107
 *         return new_gen(_ret)
 * 
 *     def algprimesubalg(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit` representing a semisimple
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_139algprimesubalg(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_138algprimesubalg[] = "\n        :emphasis:`al` being the output of :literal:`algtableinit` representing a semisimple\n        algebra of positive characteristic, returns a basis of the prime subalgebra\n        of\302\240:emphasis:`al`. The prime subalgebra of\302\240:emphasis:`al` is the subalgebra fixed by the\n        Frobenius automorphism of the center of :emphasis:`al`. It is abstractly isomorphic\n        to a product of copies of :math:`\\mathbb{F}_p`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? algprimesubalg(A)\n            %3 =\n            [1 0]\n            \n            [0 1]\n            \n            [0 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_139algprimesubalg(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algprimesubalg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_138algprimesubalg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_138algprimesubalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algprimesubalg", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2127
 *             [0 0]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2128
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algprimesubalg(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2128, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2129
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algprimesubalg(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2130
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algprimesubalg(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algprimesubalg(__pyx_v__al);

  /* "cypari/auto_instance.pxi":2131
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algprimesubalg(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algquotient(self, al, I, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2107
 *         return new_gen(_ret)
 * 
 *     def algprimesubalg(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit` representing a semisimple
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algprimesubalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2133
 *         return new_gen(_ret)
 * 
 *     def algquotient(self, al, I, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`I`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_141algquotient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_140algquotient[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`I`\n        being a basis of a two-sided ideal of :emphasis:`al` represented by a matrix,\n        returns the quotient :math:`al/I`. When :math:`maps = 1`, returns a\n        :literal:`t_VEC` :math:`[al/I,proj,lift]` where :emphasis:`proj` and\n        :emphasis:`lift` are matrices respectively representing the projection map and a\n        section of it.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? AQ = algquotient(A,[0;1;0]);\n            ? algdim(AQ)\n            %4 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_141algquotient(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_I = 0;
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algquotient (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_I,&__pyx_n_s_maps,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_I)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algquotient", 0, 2, 3, 1); __PYX_ERR(4, 2133, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algquotient") < 0)) __PYX_ERR(4, 2133, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_al = values[0];
    __pyx_v_I = values[1];
    if (values[2]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2133, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algquotient", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algquotient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_140algquotient(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_I, __pyx_v_maps);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_140algquotient(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_I, long __pyx_v_maps) {
  GEN __pyx_v__al;
  GEN __pyx_v__I;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algquotient", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_I);

  /* "cypari/auto_instance.pxi":2150
 *             %4 = 2
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         I = objtogen(I)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2151
 *         '''
 *         al = objtogen(al)
 *         I = objtogen(I)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_I, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_I, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2152
 *         al = objtogen(al)
 *         I = objtogen(I)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _I = (<Gen>I).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2152, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2153
 *         I = objtogen(I)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2154
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _I = (<Gen>I).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_I)->__pyx_base.g;
  __pyx_v__I = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2155
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alg_quotient(__pyx_v__al, __pyx_v__I, __pyx_v_maps);

  /* "cypari/auto_instance.pxi":2156
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algradical(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2156, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2133
 *         return new_gen(_ret)
 * 
 *     def algquotient(self, al, I, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`I`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algquotient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_I);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2158
 *         return new_gen(_ret)
 * 
 *     def algradical(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit`, returns a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_143algradical(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_142algradical[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit`, returns a\n        basis of the Jacobson radical of the algebra :emphasis:`al` over its prime field\n        (:math:`\\mathbb{Q}` or :math:`\\mathbb{F}_p`).\n        \n        Here is an example with :math:`A = \\mathbb{Q}[x]/(x^2)`, with the basis\302\240:math:`(1,x)`:\n        \n        ::\n        \n            ? mt = [matid(2),[0,0;1,0]];\n            ? A = algtableinit(mt);\n            ? algradical(A) \\\\ = (x)\n            %3 =\n            [0]\n            \n            [1]\n        \n        Another one with :math:`2 x 2` upper triangular matrices over :math:`\\mathbb{Q}`, with basis\n        :math:`I_2`, :math:`a = [0,1;0,0]` and :math:`b = [0,0;0,1]`, such that :math:`a^2 =\n        0`, :math:`ab = a`, :math:`ba = 0`, :math:`b^2 = b`:\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algradical(A) \\\\ = (a)\n            %6 =\n            [0]\n            \n            [1]\n            \n            [0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_143algradical(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algradical (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_142algradical(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_142algradical(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algradical", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2192
 *             [0]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2193
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algradical(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2193, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2194
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algradical(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2195
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algradical(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algradical(__pyx_v__al);

  /* "cypari/auto_instance.pxi":2196
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algradical(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algramifiedplaces(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2158
 *         return new_gen(_ret)
 * 
 *     def algradical(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit`, returns a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algradical", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2198
 *         return new_gen(_ret)
 * 
 *     def algramifiedplaces(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_145algramifiedplaces(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_144algramifiedplaces[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns a\n        :literal:`t_VEC` containing the list of places of the center of :emphasis:`al` that are\n        ramified in :emphasis:`al`. Each place is described as an integer between\302\240:math:`1`\n        and\302\240:math:`r_1` or as a prime ideal.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algramifiedplaces(A)\n            %3 = [1, [2, [2, 0]~, 1, 2, 1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_145algramifiedplaces(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algramifiedplaces (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_144algramifiedplaces(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_144algramifiedplaces(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algramifiedplaces", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2212
 *             %3 = [1, [2, [2, 0]~, 1, 2, 1]]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2213
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algramifiedplaces(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2213, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2214
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algramifiedplaces(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2215
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algramifiedplaces(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algramifiedplaces(__pyx_v__al);

  /* "cypari/auto_instance.pxi":2216
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algramifiedplaces(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algrandom(self, al, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2198
 *         return new_gen(_ret)
 * 
 *     def algramifiedplaces(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algramifiedplaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2218
 *         return new_gen(_ret)
 * 
 *     def algrandom(self, al, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and an integer :emphasis:`b`, returns a random
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_147algrandom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_146algrandom[] = "\n        Given an algebra :emphasis:`al` and an integer :emphasis:`b`, returns a random\n        element in :emphasis:`al` with coefficients in\302\240:math:`[-b,b]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_147algrandom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algrandom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_b,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_al)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algrandom", 1, 2, 2, 1); __PYX_ERR(4, 2218, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algrandom") < 0)) __PYX_ERR(4, 2218, __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_al = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algrandom", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2218, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algrandom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_146algrandom(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_146algrandom(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_b) {
  GEN __pyx_v__al;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algrandom", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":2223
 *         element in :emphasis:`al` with coefficients in:math:`[-b,b]`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2224
 *         '''
 *         al = objtogen(al)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2225
 *         al = objtogen(al)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2225, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2226
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algrandom(_al, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2227
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algrandom(_al, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2228
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algrandom(_al, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algrandom(__pyx_v__al, __pyx_v__b);

  /* "cypari/auto_instance.pxi":2229
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algrandom(_al, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algrelmultable(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2218
 *         return new_gen(_ret)
 * 
 *     def algrandom(self, al, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and an integer :emphasis:`b`, returns a random
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algrandom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2231
 *         return new_gen(_ret)
 * 
 *     def algrelmultable(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined by a multiplication table over its center (a number field), returns this multiplication table.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_149algrelmultable(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_148algrelmultable[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined by a multiplication table over its center (a number field), returns this multiplication table.\n        \n        ::\n        \n            ? nf = nfinit(y^3-5); a = y; b = y^2;\n            ? {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            ? {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            ? {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = alginit(nf,mt,'x);\n            ? M = algrelmultable(A);\n            ? M[2] == m_i\n            %8 = 1\n            ? M[3] == m_j\n            %9 = 1\n            ? M[4] == m_k\n            %10 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_149algrelmultable(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algrelmultable (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_148algrelmultable(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_148algrelmultable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algrelmultable", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2260
 *             %10 = 1
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2261
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algrelmultable(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2261, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2262
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algrelmultable(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2263
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algrelmultable(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algrelmultable(__pyx_v__al);

  /* "cypari/auto_instance.pxi":2264
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algrelmultable(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsimpledec(self, al, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2231
 *         return new_gen(_ret)
 * 
 *     def algrelmultable(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined by a multiplication table over its center (a number field), returns this multiplication table.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algrelmultable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2266
 *         return new_gen(_ret)
 * 
 *     def algsimpledec(self, al, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit`, returns a :literal:`t_VEC`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_151algsimpledec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_150algsimpledec[] = "\n        :emphasis:`al` being the output of :literal:`algtableinit`, returns a :literal:`t_VEC`\n        :math:`[J,[al_1,al_2,...,al_n]]` where :math:`J` is a basis of the\n        Jacobson radical of :emphasis:`al` and\302\240:math:`al/J` is isomorphic to the direct\n        product of the simple algebras\302\240:math:`al_i`. When :math:`maps = 1`,\n        each\302\240:math:`al_i` is replaced with a :literal:`t_VEC`\n        :math:`[al_i,proj_i,lift_i]` where :math:`proj_i` and\302\240:math:`lift_i`\n        are matrices respectively representing the projection map\302\240:math:`al \\to\n        al_i` and a section of it. Modulo\302\240:math:`J`, the images of the :math:`lift_i`\n        form a direct sum in\302\240:math:`al/J`, so that the images of\302\240:math:`1\\inal_i`\n        under\302\240:math:`lift_i` are central primitive idempotents of\302\240:math:`al/J`. The\n        factors are sorted by increasing dimension, then increasing dimension of the\n        center. This ensures that the ordering of the isomorphism classes of the\n        factors is deterministic over finite fields, but not necessarily over\302\240:math:`\\mathbb{Q}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_151algsimpledec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsimpledec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_maps,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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsimpledec") < 0)) __PYX_ERR(4, 2266, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    if (values[1]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2266, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsimpledec", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2266, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsimpledec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_150algsimpledec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_maps);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_150algsimpledec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, long __pyx_v_maps) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsimpledec", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2282
 *         factors is deterministic over finite fields, but not necessarily over:math:`\mathbb{Q}`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2283
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsimpledec(_al, maps)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2283, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2284
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsimpledec(_al, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2285
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsimpledec(_al, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsimpledec(__pyx_v__al, __pyx_v_maps);

  /* "cypari/auto_instance.pxi":2286
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsimpledec(_al, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsplit(self, al, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2266
 *         return new_gen(_ret)
 * 
 *     def algsimpledec(self, al, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit`, returns a :literal:`t_VEC`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsimpledec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2288
 *         return new_gen(_ret)
 * 
 *     def algsplit(self, al, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra over:math:`\mathbb{F}_p` output by :literal:`algtableinit`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_153algsplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_152algsplit[] = "\n        If :emphasis:`al` is a table algebra over\302\240:math:`\\mathbb{F}_p` output by :literal:`algtableinit`\n        that represents a simple algebra, computes an isomorphism between :emphasis:`al` and\n        a matrix algebra\302\240:math:`M_d(\\mathbb{F}_{p^n})` where\302\240:math:`N = nd^2` is the dimension of\302\240:emphasis:`al`.\n        Returns a :literal:`t_VEC`\302\240:math:`[map,mapi]`, where:\n        \n        - :emphasis:`map` is a :literal:`t_VEC` of\302\240:math:`N` matrices of size\302\240:math:`d x d` with\n          :literal:`t_FFELT` coefficients using the variable\302\240:emphasis:`v`, representing the image of\n          the basis of\302\240:emphasis:`al` under the isomorphism.\n        \n        - :emphasis:`mapi` is an\302\240:math:`N x N` matrix with :literal:`t_INT` coefficients,\n          representing the image in :emphasis:`al` by the inverse isomorphism of the\n          basis\302\240:math:`(b_i)` of\302\240:math:`M_d(\\mathbb{F}_p[\\alpha])` (where\302\240:math:`\\alpha` has degree\302\240:math:`n`\n          over\302\240:math:`\\mathbb{F}_p`) defined as follows:\n          let\302\240:math:`E_{i,j}` be the matrix having all coefficients\302\240:math:`0` except the\302\240:math:`(i,j)`-th\n          coefficient equal to\302\240:math:`1`, and define\n          \n        \n        .. MATH::\n        \n            b_i = E_{((i-1)/nd)+1, ((i-1)/n mod d)+1} \\alpha^{(i-1) mod n}.\n        \n        Example:\n        \n        ::\n        \n            ? al0 = alginit(nfinit(y^2+7), [-1,-1]);\n            ? al = algtableinit(algmultable(al0), 3); \\\\ isomorphic to M_2(F_9)\n            ? [map,mapi] = algsplit(al, 'a);\n            ? x = [1,2,1,0,0,0,0,0]~; fx = map*x\n            %4 =\n            [2*a 0]\n            \n            [ 0 2]\n            ? y = [0,0,0,0,1,0,0,1]~; fy = map*y\n            %5 =\n            [1 2*a]\n            \n            [2 a + 2]\n            ? map*algmul(al,x,y) == fx*fy\n            %6 = 1\n       ""     ? map*mapi[,6]\n            %7 =\n            [0 0]\n            \n            [a 0]\n        \n        :strong:`Warning.` If\302\240:emphasis:`al` is not simple, :literal:`algsplit(al)` can trigger\n        an error, but can also run into an infinite loop. Example:\n        \n        ::\n        \n            ? al = alginit(nfinit(y),[-1,-1]); \\\\ ramified at 2\n            ? al2 = algtableinit(algmultable(al),2); \\\\ maximal order modulo 2\n            ? algsplit(al2); \\\\ not semisimple, infinite loop\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_153algsplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_al)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsplit") < 0)) __PYX_ERR(4, 2288, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsplit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2288, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_152algsplit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_152algsplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("algsplit", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2345
 *             ? algsplit(al2); \\ not semisimple, infinite loop
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2346
 *         '''
 *         al = objtogen(al)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":2347
 *         al = objtogen(al)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":2348
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 2348, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":2347
 *         al = objtogen(al)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":2349
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplit(_al, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 2349, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2350
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsplit(_al, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_6;

  /* "cypari/auto_instance.pxi":2351
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplit(_al, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsplit(__pyx_v__al, __pyx_v__v);

  /* "cypari/auto_instance.pxi":2352
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplit(_al, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsplittingdata(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2288
 *         return new_gen(_ret)
 * 
 *     def algsplit(self, al, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra over:math:`\mathbb{F}_p` output by :literal:`algtableinit`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2354
 *         return new_gen(_ret)
 * 
 *     def algsplittingdata(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_155algsplittingdata(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_154algsplittingdata[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined\n        by a multiplication table over its center\302\240:math:`K` (a number field), returns data\n        stored to compute a splitting of :emphasis:`al` over an extension. This data is a\n        :literal:`t_VEC` :literal:`[t,Lbas,Lbasinv]` with :math:`3` components:\n        \n        - an element :math:`t` of :emphasis:`al` such that :math:`L = K(t)` is a maximal subfield\n          of :emphasis:`al`;\n        \n        - a matrix :literal:`Lbas` expressing a :math:`L`-basis of :emphasis:`al` (given an\n          :math:`L`-vector space structure by multiplication on the right) on the integral\n          basis of :emphasis:`al`;\n        \n        - a matrix :literal:`Lbasinv` expressing the integral basis of :emphasis:`al` on\n          the previous :math:`L`-basis.\n        \n        ::\n        \n            ? nf = nfinit(y^3-5); a = y; b = y^2;\n            ? {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            ? {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            ? {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = alginit(nf,mt,'x);\n            ? [t,Lb,Lbi] = algsplittingdata(A);\n            ? t\n            %8 = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]~;\n            ? matsize(Lb)\n            %9 = [12, 2]\n            ? matsize(Lbi)\n            %10 = [2, 12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_155algsplittingdata(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsplittingdata (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_154algsplittingdata(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_154algsplittingdata(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsplittingdata", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2396
 *             %10 = [2, 12]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2397
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingdata(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2397, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2398
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsplittingdata(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2399
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingdata(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsplittingdata(__pyx_v__al);

  /* "cypari/auto_instance.pxi":2400
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingdata(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsplittingfield(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2354
 *         return new_gen(_ret)
 * 
 *     def algsplittingdata(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsplittingdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2402
 *         return new_gen(_ret)
 * 
 *     def algsplittingfield(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_157algsplittingfield(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_156algsplittingfield[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        an :literal:`rnf` structure: the splitting field of :emphasis:`al` that is stored in\n        :emphasis:`al`, as a relative extension of the center.\n        \n        ::\n        \n            nf = nfinit(y^3-5);\n            a = y; b = y^2;\n            {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            mt = [matid(4), m_i, m_j, m_k];\n            A = alginit(nf,mt,'x);\n            algsplittingfield(A).pol\n            %8 = x^2 - y\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_157algsplittingfield(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsplittingfield (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_156algsplittingfield(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_156algsplittingfield(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsplittingfield", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2429
 *             %8 = x^2 - y
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2430
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingfield(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2430, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2431
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsplittingfield(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2432
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingfield(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsplittingfield(__pyx_v__al);

  /* "cypari/auto_instance.pxi":2433
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingfield(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsqr(self, al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2402
 *         return new_gen(_ret)
 * 
 *     def algsplittingfield(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsplittingfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2435
 *         return new_gen(_ret)
 * 
 *     def algsqr(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its square :math:`x^2` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_159algsqr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_158algsqr[] = "\n        Given an element :math:`x` in :emphasis:`al`, computes its square :math:`x^2` in the\n        algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algsqr(A,[1,0,2,0]~)\n            %2 = [-3, 0, 4, 0]~\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_159algsqr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsqr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,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_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algsqr", 1, 2, 2, 1); __PYX_ERR(4, 2435, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsqr") < 0)) __PYX_ERR(4, 2435, __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_al = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsqr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2435, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_158algsqr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_158algsqr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsqr", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2448
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2449
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2450
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2450, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2451
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algsqr(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2452
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsqr(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2453
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algsqr(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsqr(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_instance.pxi":2454
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algsqr(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsub(self, al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2435
 *         return new_gen(_ret)
 * 
 *     def algsqr(self, al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its square :math:`x^2` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2456
 *         return new_gen(_ret)
 * 
 *     def algsub(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their difference
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_161algsub(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_160algsub[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their difference\n        :math:`x-y` in the algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algsub(A,[1,1,0,0]~,[1,0,1,0]~)\n            %2 = [0, 1, -1, 0]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_161algsub(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsub (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algsub", 1, 3, 3, 1); __PYX_ERR(4, 2456, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algsub", 1, 3, 3, 2); __PYX_ERR(4, 2456, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsub") < 0)) __PYX_ERR(4, 2456, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_al = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsub", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2456, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_160algsub(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_160algsub(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsub", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":2469
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2470
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2471
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2472
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2472, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2473
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2474
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algsub(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2475
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsub(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2476
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algsub(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsub(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":2477
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algsub(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsubalg(self, al, B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2456
 *         return new_gen(_ret)
 * 
 *     def algsub(self, al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their difference
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2479
 *         return new_gen(_ret)
 * 
 *     def algsubalg(self, al, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`B`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_163algsubalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_162algsubalg[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`B`\n        being a basis of a subalgebra of\302\240:emphasis:`al` represented by a matrix, computes an\n        algebra\302\240:emphasis:`al2` isomorphic to :emphasis:`B`.\n        \n        Returns :math:`[al2,B2]` where :emphasis:`B2` is a possibly different basis of\n        the subalgebra :emphasis:`al2`, with respect to which the multiplication table of\n        :emphasis:`al2` is defined.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? B = algsubalg(A,[1,0; 0,0; 0,1]);\n            ? algdim(A)\n            %4 = 3\n            ? algdim(B[1])\n            %5 = 2\n            ? m = matcompanion(x^4+1);\n            ? mt = [m^i | i <- [0..3]];\n            ? al = algtableinit(mt);\n            ? B = [1,0;0,0;0,1/2;0,0];\n            ? al2 = algsubalg(al,B);\n            ? algdim(al2[1])\n            ? al2[2]\n            %13 =\n            [1 0]\n            \n            [0 0]\n            \n            [0 1]\n            \n            [0 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_163algsubalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsubalg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_B,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_al)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algsubalg", 1, 2, 2, 1); __PYX_ERR(4, 2479, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsubalg") < 0)) __PYX_ERR(4, 2479, __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_al = values[0];
    __pyx_v_B = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsubalg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2479, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsubalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_162algsubalg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_B);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_162algsubalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_B) {
  GEN __pyx_v__al;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsubalg", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":2514
 *             [0 0]
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2515
 *         '''
 *         al = objtogen(al)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2516
 *         al = objtogen(al)
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2516, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2517
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = algsubalg(_al, _B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2518
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsubalg(_al, _B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2519
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = algsubalg(_al, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsubalg(__pyx_v__al, __pyx_v__B);

  /* "cypari/auto_instance.pxi":2520
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = algsubalg(_al, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtableinit(self, mt, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2479
 *         return new_gen(_ret)
 * 
 *     def algsubalg(self, al, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`B`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algsubalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2522
 *         return new_gen(_ret)
 * 
 *     def algtableinit(self, mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the associative algebra over :math:`K = \mathbb{Q}` (:math:`p` omitted) or :math:`\mathbb{F}_p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_165algtableinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_164algtableinit[] = "\n        Initializes the associative algebra over :math:`K = \\mathbb{Q}` (:math:`p` omitted) or :math:`\\mathbb{F}_p`\n        defined by the multiplication table :emphasis:`mt`.\n        As a :math:`K`-vector space, the algebra is generated by a basis\n        :math:`(e_1 = 1, e_2,..., e_n)`; the table is given as a :literal:`t_VEC` of :math:`n` matrices in\n        :math:`M_n(K)`, giving the left multiplication by the basis elements :math:`e_i`, in the\n        given basis.\n        Assumes that :math:`e_1 = 1`, that :math:`K e_1\\oplus...\\oplus K e_n]` describes an\n        associative algebra over :math:`K`, and in the case :math:`K = \\mathbb{Q}` that the multiplication\n        table is integral. If the algebra is already known to be central\n        and simple, then the case :math:`K = \\mathbb{F}_p` is useless, and one should use\n        :literal:`alginit` directly.\n        \n        The point of this function is to input a finite dimensional :math:`K`-algebra, so\n        as to later compute its radical, then to split the quotient algebra as a\n        product of simple algebras over :math:`K`.\n        \n        The pari object representing such an algebra :math:`A` is a :literal:`t_VEC` with the\n        following data:\n        \n        - The characteristic of :math:`A`, accessed with :literal:`algchar`.\n        \n        - The multiplication table of :math:`A`, accessed with :literal:`algmultable`.\n        \n        - The traces of the elements of the basis.\n        \n        A simple example: the :math:`2 x 2` upper triangular matrices over :math:`\\mathbb{Q}`,\n        generated by :math:`I_2`, :math:`a = [0,1;0,0]` and :math:`b = [0,0;0,1]`,\n        such that :math:`a^2 = 0`, :math:`ab = a`, :math:`ba = 0`, :math:`b^2 = b`:\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algradical(A) \\\\ = (a)\n            %6 =\n            [0]\n   ""         \n            [1]\n            \n            [0]\n            ? algcenter(A) \\\\ = (I_2)\n            %7 =\n            [1]\n            \n            [0]\n            \n            [0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_165algtableinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mt = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtableinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_mt)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtableinit") < 0)) __PYX_ERR(4, 2522, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mt = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtableinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtableinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_164algtableinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mt, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_164algtableinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mt, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__mt;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algtableinit", 0);
  __Pyx_INCREF(__pyx_v_mt);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":2572
 *             [0]
 *         '''
 *         mt = objtogen(mt)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mt, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mt, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2573
 *         '''
 *         mt = objtogen(mt)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":2574
 *         mt = objtogen(mt)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":2575
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2575, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":2574
 *         mt = objtogen(mt)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":2576
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 2576, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2577
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mt)->__pyx_base.g;
  __pyx_v__mt = __pyx_t_4;

  /* "cypari/auto_instance.pxi":2578
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":2579
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":2580
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtableinit(_mt, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":2579
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)
 */
  }

  /* "cypari/auto_instance.pxi":2581
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtableinit(__pyx_v__mt, __pyx_v__p);

  /* "cypari/auto_instance.pxi":2582
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtensor(self, al1, al2, long maxord=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2522
 *         return new_gen(_ret)
 * 
 *     def algtableinit(self, mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the associative algebra over :math:`K = \mathbb{Q}` (:math:`p` omitted) or :math:`\mathbb{F}_p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtableinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mt);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2584
 *         return new_gen(_ret)
 * 
 *     def algtensor(self, al1, al2, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two algebras :emphasis:`al1` and :emphasis:`al2`, computes their tensor
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_167algtensor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_166algtensor[] = "\n        Given two algebras :emphasis:`al1` and :emphasis:`al2`, computes their tensor\n        product. Computes a maximal order by default. Prevent this computation by\n        setting :math:`maxord = 0`.\n        \n        Currently only implemented for cyclic algebras of coprime degree over the same\n        center\302\240:math:`K`, and the tensor product is over\302\240:math:`K`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_167algtensor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al1 = 0;
  PyObject *__pyx_v_al2 = 0;
  long __pyx_v_maxord;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtensor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al1,&__pyx_n_s_al2,&__pyx_n_s_maxord,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al1)) != 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_al2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algtensor", 0, 2, 3, 1); __PYX_ERR(4, 2584, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxord);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtensor") < 0)) __PYX_ERR(4, 2584, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_al1 = values[0];
    __pyx_v_al2 = values[1];
    if (values[2]) {
      __pyx_v_maxord = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_maxord == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2584, __pyx_L3_error)
    } else {
      __pyx_v_maxord = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtensor", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2584, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_166algtensor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al1, __pyx_v_al2, __pyx_v_maxord);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_166algtensor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al1, PyObject *__pyx_v_al2, long __pyx_v_maxord) {
  GEN __pyx_v__al1;
  GEN __pyx_v__al2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algtensor", 0);
  __Pyx_INCREF(__pyx_v_al1);
  __Pyx_INCREF(__pyx_v_al2);

  /* "cypari/auto_instance.pxi":2593
 *         center:math:`K`, and the tensor product is over:math:`K`.
 *         '''
 *         al1 = objtogen(al1)             # <<<<<<<<<<<<<<
 *         al2 = objtogen(al2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2594
 *         '''
 *         al1 = objtogen(al1)
 *         al2 = objtogen(al2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al1 = (<Gen>al1).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2595
 *         al1 = objtogen(al1)
 *         al2 = objtogen(al2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al1 = (<Gen>al1).g
 *         cdef GEN _al2 = (<Gen>al2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2595, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2596
 *         al2 = objtogen(al2)
 *         sig_on()
 *         cdef GEN _al1 = (<Gen>al1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _al2 = (<Gen>al2).g
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al1)->__pyx_base.g;
  __pyx_v__al1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2597
 *         sig_on()
 *         cdef GEN _al1 = (<Gen>al1).g
 *         cdef GEN _al2 = (<Gen>al2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al2)->__pyx_base.g;
  __pyx_v__al2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2598
 *         cdef GEN _al1 = (<Gen>al1).g
 *         cdef GEN _al2 = (<Gen>al2).g
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtensor(__pyx_v__al1, __pyx_v__al2, __pyx_v_maxord);

  /* "cypari/auto_instance.pxi":2599
 *         cdef GEN _al2 = (<Gen>al2).g
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtomatrix(self, al, x, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2584
 *         return new_gen(_ret)
 * 
 *     def algtensor(self, al1, al2, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two algebras :emphasis:`al1` and :emphasis:`al2`, computes their tensor
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al1);
  __Pyx_XDECREF(__pyx_v_al2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2601
 *         return new_gen(_ret)
 * 
 *     def algtomatrix(self, al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, returns the image of :emphasis:`x` under a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_169algtomatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_168algtomatrix[] = "\n        Given an element :emphasis:`x` in :emphasis:`al`, returns the image of :emphasis:`x` under a\n        homomorphism to a matrix algebra. If :emphasis:`al` is a table algebra output by\n        :literal:`algtableinit` or if\302\240:math:`abs = 1`, returns the left multiplication table on the\n        integral basis; if :emphasis:`al` is a central simple algebra and\302\240:math:`abs = 0`,\n        returns\302\240:math:`\\phi (x)` where\302\240:math:`\\phi : A\\otimes_K L \\to M_d(L)` (where :math:`d` is the\n        degree of the algebra and :math:`L` is an extension of :math:`L` with\302\240:math:`[L:K] = d`) is an\n        isomorphism stored in\302\240:emphasis:`al`. Also accepts a square matrix with coefficients\n        in\302\240:emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algtomatrix(A,[0,0,0,2]~)\n            %2 =\n            [Mod(x + 1, x^2 + 1) Mod(Mod(1, y)*x + Mod(-1, y), x^2 + 1)]\n            \n            [Mod(x + 1, x^2 + 1) Mod(-x + 1, x^2 + 1)]\n            ? algtomatrix(A,[0,1,0,0]~,1)\n            %2 =\n            [0 -1 1 0]\n            \n            [1 0 1 1]\n            \n            [0 0 1 1]\n            \n            [0 0 -2 -1]\n            ? algtomatrix(A,[0,x]~,1)\n            %3 =\n            [-1 0 0 -1]\n            \n            [-1 0 1 0]\n            \n            [-1 -1 0 -1]\n            \n            [ 2 0 0 1]\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_169algtomatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtomatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_abs,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algtomatrix", 0, 2, 3, 1); __PYX_ERR(4, 2601, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtomatrix") < 0)) __PYX_ERR(4, 2601, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_al = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2601, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtomatrix", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2601, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtomatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_168algtomatrix(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_abs);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_168algtomatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algtomatrix", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2641
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2642
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2643
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2643, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2644
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2645
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2646
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtomatrix(__pyx_v__al, __pyx_v__x, __pyx_v_abs);

  /* "cypari/auto_instance.pxi":2647
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtrace(self, al, x, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2601
 *         return new_gen(_ret)
 * 
 *     def algtomatrix(self, al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, returns the image of :emphasis:`x` under a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtomatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2649
 *         return new_gen(_ret)
 * 
 *     def algtrace(self, al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its trace. If :emphasis:`al` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_171algtrace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_170algtrace[] = "\n        Given an element :emphasis:`x` in :emphasis:`al`, computes its trace. If :emphasis:`al` is\n        a table algebra output by :literal:`algtableinit` or if :math:`abs = 1`, returns the\n        absolute trace of :emphasis:`x`, which is an element of :math:`\\mathbb{F}_p` or\302\240:math:`\\mathbb{Q}`; if :emphasis:`al`\n        is the output of :literal:`alginit` and :math:`abs = 0` (default), returns the reduced trace\n        of :emphasis:`x`, which is an element of the center of :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algtrace(A,[5,0,0,1]~)\n            %2 = 11\n            ? algtrace(A,[5,0,0,1]~,1)\n            %3 = 22\n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf,[-1,y]);\n            ? a = [1+x+y,2*y]~*Mod(1,y^2-5)*Mod(1,x^2+1);\n            ? t = algtrace(A,a)\n            %7 = Mod(2*y + 2, y^2 - 5)\n            ? algtrace(A,a,1)\n            %8 = 8\n            ? algdegree(A)*nfelttrace(nf,t)\n            %9 = 8\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_171algtrace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtrace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al,&__pyx_n_s_x,&__pyx_n_s_abs,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_al)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algtrace", 0, 2, 3, 1); __PYX_ERR(4, 2649, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtrace") < 0)) __PYX_ERR(4, 2649, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_al = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2649, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtrace", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2649, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_170algtrace(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_al, __pyx_v_x, __pyx_v_abs);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_170algtrace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algtrace", 0);
  __Pyx_INCREF(__pyx_v_al);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2676
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2677
 *         '''
 *         al = objtogen(al)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2678
 *         al = objtogen(al)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2678, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2679
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtrace(_al, _x, abs)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2680
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtrace(_al, _x, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2681
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtrace(_al, _x, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtrace(__pyx_v__al, __pyx_v__x, __pyx_v_abs);

  /* "cypari/auto_instance.pxi":2682
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtrace(_al, _x, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtype(self, al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2649
 *         return new_gen(_ret)
 * 
 *     def algtrace(self, al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its trace. If :emphasis:`al` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2684
 *         return new_gen(_ret)
 * 
 *     def algtype(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or by :literal:`algtableinit`, returns an integer indicating the type of algebra:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_173algtype(PyObject *__pyx_v_self, PyObject *__pyx_v_al); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_172algtype[] = "\n        Given an algebra :emphasis:`al` output by :literal:`alginit` or by :literal:`algtableinit`, returns an integer indicating the type of algebra:\n        \n        - :math:`0`: not a valid algebra.\n        \n        - :math:`1`: table algebra output by :literal:`algtableinit`.\n        \n        - :math:`2`: central simple algebra output by :literal:`alginit` and represented by\n          a multiplication table over its center.\n        \n        - :math:`3`: central simple algebra output by :literal:`alginit` and represented by\n          a cyclic algebra.\n        \n        ::\n        \n            ? algtype([])\n            %1 = 0\n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? algtype(A)\n            %4 = 1\n            ? nf = nfinit(y^3-5);\n            ? a = y; b = y^2;\n            ? {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            ? {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            ? {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = alginit(nf,mt,'x);\n            ? algtype(A)\n            %12 = 2\n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algtype(A)\n            %14 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_173algtype(PyObject *__pyx_v_self, PyObject *__pyx_v_al) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtype (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_172algtype(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_al));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_172algtype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_al) {
  GEN __pyx_v__al;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algtype", 0);
  __Pyx_INCREF(__pyx_v_al);

  /* "cypari/auto_instance.pxi":2728
 *             %14 = 3
 *         '''
 *         al = objtogen(al)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2729
 *         '''
 *         al = objtogen(al)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algtype(_al)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2729, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2730
 *         al = objtogen(al)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algtype(_al)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2731
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algtype(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algtype(__pyx_v__al);

  /* "cypari/auto_instance.pxi":2732
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algtype(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":2733
 *         cdef long _ret = algtype(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def apply(self, f, A):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2684
 *         return new_gen(_ret)
 * 
 *     def algtype(self, al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or by :literal:`algtableinit`, returns an integer indicating the type of algebra:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.algtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2735
 *         return _ret
 * 
 *     def apply(self, f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` to the entries of :literal:`A`. If :literal:`A`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_175apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_174apply[] = "\n        Apply the :literal:`t_CLOSURE` :literal:`f` to the entries of :literal:`A`. If :literal:`A`\n        is a scalar, return :literal:`f(A)`. If :literal:`A` is a polynomial or power series,\n        apply :literal:`f` on all coefficients. If :literal:`A` is a vector or list, return\n        the elements :math:`f(x)` where :math:`x` runs through :literal:`A`. If :literal:`A` is a matrix,\n        return the matrix whose entries are the :math:`f(A[i,j])`.\n        \n        ::\n        \n            ? apply(x->x^2, [1,2,3,4])\n            %1 = [1, 4, 9, 16]\n            ? apply(x->x^2, [1,2;3,4])\n            %2 =\n            [1 4]\n            \n            [9 16]\n            ? apply(x->x^2, 4*x^2 + 3*x+ 2)\n            %3 = 16*x^2 + 9*x + 4\n        \n        Note that many functions already act componentwise on\n        vectors or matrices, but they almost never act on lists; in this\n        case, :literal:`apply` is a good solution:\n        \n        ::\n        \n            ? L = List([Mod(1,3), Mod(2,4)]);\n            ? lift(L)\n             *** at top-level: lift(L)\n             *** ^-------\n             *** lift: incorrect type in lift.\n            ? apply(lift, L);\n            %2 = List([1, 2])\n        \n        :strong:`Remark.` For :math:`v` a :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_LIST` or :literal:`t_MAT`,\n        the alternative set-notations\n        \n        ::\n        \n            [g(x) | x <- v, f(x)]\n            [x | x <- v, f(x)]\n            [g(x) | x <- v]\n        \n        are available as shortcuts for\n        \n        ::\n        \n            apply(g, select(f, Vec(v)))\n            select(f, Vec(v))\n            apply(g, Vec(v))\n        \n        respectively:\n        \n        ::\n        \n            ? L = List([Mod(1,3), Mod(2,4)]);\n            ? [ lift(x) | x<-L ]\n            %2 = [1, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_175apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_A,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_f)) != 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_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("apply", 1, 2, 2, 1); __PYX_ERR(4, 2735, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) __PYX_ERR(4, 2735, __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_f = values[0];
    __pyx_v_A = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("apply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2735, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_174apply(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_A);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_174apply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("apply", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":2794
 *             %2 = [1, 2]
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2795
 *         '''
 *         f = objtogen(f)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2796
 *         f = objtogen(f)
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2796, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2797
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = apply0(_f, _A)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2798
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = apply0(_f, _A)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2799
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = apply0(_f, _A)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = apply0(__pyx_v__f, __pyx_v__A);

  /* "cypari/auto_instance.pxi":2800
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = apply0(_f, _A)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def arg(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2735
 *         return _ret
 * 
 *     def apply(self, f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` to the entries of :literal:`A`. If :literal:`A`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2802
 *         return new_gen(_ret)
 * 
 *     def arg(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Argument of the complex number :math:`x`, such that :math:`-\pi < \arg (x) <= \pi`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_177arg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_176arg[] = "\n        Argument of the complex number :math:`x`, such that :math:`-\\pi < \\arg (x) <= \\pi`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_177arg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arg") < 0)) __PYX_ERR(4, 2802, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2802, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arg", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2802, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.arg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_176arg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_176arg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("arg", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2806
 *         Argument of the complex number :math:`x`, such that :math:`-\pi < \arg (x) <= \pi`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2807
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2807, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2808
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = garg(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2809
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = garg(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2810
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = garg(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = garg(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2811
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = garg(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def asin(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2802
 *         return new_gen(_ret)
 * 
 *     def arg(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Argument of the complex number :math:`x`, such that :math:`-\pi < \arg (x) <= \pi`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.arg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2813
 *         return new_gen(_ret)
 * 
 *     def asin(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sin^{-1}(x) = -i \log (ix + \sqrt{1 - x^2})`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_179asin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_178asin[] = "\n        Principal branch of :math:`\\sin^{-1}(x) = -i \\log (ix + \\sqrt{1 - x^2})`.\n        In particular, :math:`\\Re (asin(x))\\in [-\\pi/2,\\pi/2]` and if :math:`x\\in \\mathbb{R}` and\n        :math:`\\|x\\| > 1` then :math:`asin(x)` is complex. The branch cut is in two pieces:\n        :math:`]- oo ,-1]`, continuous with quadrant II, and :math:`[1,+ oo [` continuous\n        with quadrant IV. The function satisfies :math:`i asin(x) =\n        asinh(ix)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_179asin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("asin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "asin") < 0)) __PYX_ERR(4, 2813, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2813, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("asin", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2813, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.asin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_178asin(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_178asin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("asin", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2822
 *         asinh(ix)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2823
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2823, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2824
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasin(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2825
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gasin(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2826
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasin(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gasin(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2827
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasin(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def asinh(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2813
 *         return new_gen(_ret)
 * 
 *     def asin(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sin^{-1}(x) = -i \log (ix + \sqrt{1 - x^2})`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.asin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2829
 *         return new_gen(_ret)
 * 
 *     def asinh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sinh^{-1}(x) = \log (x + \sqrt{1+x^2})`. In
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_181asinh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_180asinh[] = "\n        Principal branch of :math:`\\sinh^{-1}(x) = \\log (x + \\sqrt{1+x^2})`. In\n        particular :math:`\\Im (asinh(x))\\in [-\\pi/2,\\pi/2]`.\n        The branch cut is in two pieces: :math:`]-i oo ,-i]`, continuous with quadrant\n        III and :math:`[+i,+i oo [`, continuous with quadrant I.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_181asinh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("asinh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "asinh") < 0)) __PYX_ERR(4, 2829, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2829, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("asinh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2829, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.asinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_180asinh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_180asinh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("asinh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2836
 *         III and :math:`[+i,+i oo [`, continuous with quadrant I.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2837
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2837, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2838
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasinh(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2839
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gasinh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2840
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasinh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gasinh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2841
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasinh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def asympnum(self, expr, long k=0, alpha=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2829
 *         return new_gen(_ret)
 * 
 *     def asinh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sinh^{-1}(x) = \log (x + \sqrt{1+x^2})`. In
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.asinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2843
 *         return new_gen(_ret)
 * 
 *     def asympnum(self, expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Asymptotic expansion of :emphasis:`expr`, corresponding to a sequence :math:`u(n)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_183asympnum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_182asympnum[] = "\n        Asymptotic expansion of :emphasis:`expr`, corresponding to a sequence :math:`u(n)`,\n        assuming it has the shape\n        \n        .. MATH::\n        \n            u(n) ~ \\sum_{i >= 0} a_i n^{-i\\alpha}\n        \n        with rational coefficients :math:`a_i` with reasonable height; the algorithm\n        is heuristic and performs repeated calls to limitnum, with\n        :literal:`k` and :literal:`alpha` are as in :literal:`limitnum`\n        \n        ::\n        \n            ? f(n) = n! / (n^n*exp(-n)*sqrt(n));\n            ? asympnum(f)\n            %2 = [] \\\\ failure !\n            ? l = limitnum(f)\n            %3 = 2.5066282746310005024157652848110452530\n            ? asympnum(n->f(n)/l) \\\\ normalize\n            %4 = [1, 1/12, 1/288, -139/51840]\n        \n        and we indeed get a few terms of Stirling's expansion. Note\n        that it helps to normalize with a limit computed to higher accuracy:\n        \n        ::\n        \n            ? \\p100\n            ? L = limitnum(f)\n            ? \\p38\n            ? asympnum(n->f(n)/L) \\\\ we get more terms!\n            %6 = [1, 1/12, 1/288, -139/51840, -571/2488320, 163879/209018880,\\\n             5246819/75246796800, -534703531/902961561600]\n        \n        If :literal:`alpha` is not an integer, loss of accuracy is\n        expected, so it should be precomputed to double accuracy, say:\n        \n        ::\n        \n            ? \\p38\n            ? asympnum(n->-log(1-1/n^Pi),,Pi)\n            %1 = [0, 1, 1/2, 1/3]\n            ? asympnum(n->-log(1-1/sqrt(n)),,1/2)\n            %2 = [0, 1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, \\\n             1/13, 1/14, 1/15, 1/16, 1/17, 1/18, 1/19, 1/20, 1/21, 1/22]\n            \n            ? localprec(100); a = Pi;\n            ? asympnum(n->-log(1-1/n^a),,a) \\\\ better !\n            %4 = [0, 1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_183asympnum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_expr = 0;
  long __pyx_v_k;
  PyObject *__pyx_v_alpha = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("asympnum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_expr,&__pyx_n_s_k,&__pyx_n_s_alpha,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_expr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "asympnum") < 0)) __PYX_ERR(4, 2843, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_expr = values[0];
    if (values[1]) {
      __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2843, __pyx_L3_error)
    } else {
      __pyx_v_k = ((long)0);
    }
    __pyx_v_alpha = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2843, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("asympnum", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.asympnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_182asympnum(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_expr, __pyx_v_k, __pyx_v_alpha, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_182asympnum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision) {
  int __pyx_v__have_alpha;
  GEN __pyx_v__expr;
  GEN __pyx_v__alpha;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("asympnum", 0);
  __Pyx_INCREF(__pyx_v_expr);
  __Pyx_INCREF(__pyx_v_alpha);

  /* "cypari/auto_instance.pxi":2894
 *             %4 = [0, 1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12]
 *         '''
 *         expr = objtogen(expr)             # <<<<<<<<<<<<<<
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_expr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2895
 *         '''
 *         expr = objtogen(expr)
 *         cdef bint _have_alpha = (alpha is not None)             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 */
  __pyx_t_2 = (__pyx_v_alpha != Py_None);
  __pyx_v__have_alpha = __pyx_t_2;

  /* "cypari/auto_instance.pxi":2896
 *         expr = objtogen(expr)
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":2897
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:
 *             alpha = objtogen(alpha)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_alpha, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2897, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":2896
 *         expr = objtogen(expr)
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":2898
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 2898, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2899
 *             alpha = objtogen(alpha)
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_expr)->__pyx_base.g;
  __pyx_v__expr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":2900
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 */
  __pyx_v__alpha = NULL;

  /* "cypari/auto_instance.pxi":2901
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":2902
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_alpha)->__pyx_base.g;
    __pyx_v__alpha = __pyx_t_4;

    /* "cypari/auto_instance.pxi":2901
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":2903
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2904
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = asympnum0(__pyx_v__expr, __pyx_v_k, __pyx_v__alpha, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2905
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def atan(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2843
 *         return new_gen(_ret)
 * 
 *     def asympnum(self, expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Asymptotic expansion of :emphasis:`expr`, corresponding to a sequence :math:`u(n)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.asympnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2907
 *         return new_gen(_ret)
 * 
 *     def atan(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tan^{-1}(x) = \log ((1+ix)/(1-ix)) /
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_185atan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_184atan[] = "\n        Principal branch of :math:`tan^{-1}(x) = \\log ((1+ix)/(1-ix)) /\n        2i`. In particular the real part of :math:`atan(x)` belongs to\n        :math:`]-\\pi/2,\\pi/2[`.\n        The branch cut is in two pieces:\n        :math:`]-i oo ,-i[`, continuous with quadrant IV, and :math:`]i,+i oo [` continuous\n        with quadrant II. The function satisfies :math:`atan(x) =\n        -iatanh(ix)` for all :math:`x != \302\261 i`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_185atan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atan") < 0)) __PYX_ERR(4, 2907, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2907, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atan", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2907, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.atan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_184atan(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_184atan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("atan", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2917
 *         -iatanh(ix)` for all :math:`x !=  i`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2918
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2918, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2919
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatan(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2920
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gatan(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2921
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatan(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gatan(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2922
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatan(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def atanh(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2907
 *         return new_gen(_ret)
 * 
 *     def atan(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tan^{-1}(x) = \log ((1+ix)/(1-ix)) /
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.atan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2924
 *         return new_gen(_ret)
 * 
 *     def atanh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tanh^{-1}(x) = \log ((1+x)/(1-x)) / 2`. In
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_187atanh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_186atanh[] = "\n        Principal branch of :math:`tanh^{-1}(x) = \\log ((1+x)/(1-x)) / 2`. In\n        particular the imaginary part of :math:`atanh(x)` belongs to\n        :math:`[-\\pi/2,\\pi/2]`; if :math:`x\\in \\mathbb{R}` and :math:`\\|x\\| > 1` then :math:`atanh(x)` is complex.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_187atanh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atanh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atanh") < 0)) __PYX_ERR(4, 2924, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2924, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atanh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2924, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.atanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_186atanh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_186atanh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("atanh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2930
 *         :math:`[-\pi/2,\pi/2]`; if :math:`x\in \mathbb{R}` and :math:`\|x\| > 1` then :math:`atanh(x)` is complex.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2931
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2931, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2932
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatanh(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2933
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gatanh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2934
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatanh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gatanh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2935
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatanh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bernfrac(self, long x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2924
 *         return new_gen(_ret)
 * 
 *     def atanh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tanh^{-1}(x) = \log ((1+x)/(1-x)) / 2`. In
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.atanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2937
 *         return new_gen(_ret)
 * 
 *     def bernfrac(self, long x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bernoulli number :math:`B_x`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_189bernfrac(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_188bernfrac[] = "\n        Bernoulli number :math:`B_x`,\n        where :math:`B_0 = 1`, :math:`B_1 = -1/2`, :math:`B_2 = 1/6`,..., expressed as a rational number.\n        The argument :math:`x` should be of type integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_189bernfrac(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
  long __pyx_v_x;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bernfrac (wrapper)", 0);
  assert(__pyx_arg_x); {
    __pyx_v_x = __Pyx_PyInt_As_long(__pyx_arg_x); if (unlikely((__pyx_v_x == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2937, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernfrac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_188bernfrac(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_188bernfrac(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bernfrac", 0);

  /* "cypari/auto_instance.pxi":2943
 *         The argument :math:`x` should be of type integer.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bernfrac(x)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 2943, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2944
 *         '''
 *         sig_on()
 *         cdef GEN _ret = bernfrac(x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bernfrac(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2945
 *         sig_on()
 *         cdef GEN _ret = bernfrac(x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bernpol(self, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 2945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2937
 *         return new_gen(_ret)
 * 
 *     def bernfrac(self, long x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bernoulli number :math:`B_x`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernfrac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2947
 *         return new_gen(_ret)
 * 
 *     def bernpol(self, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bernoulli polynomial :math:`B_n` in variable :math:`v`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_191bernpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_190bernpol[] = "\n        Bernoulli polynomial :math:`B_n` in variable :math:`v`.\n        \n        ::\n        \n            ? bernpol(1)\n            %1 = x - 1/2\n            ? bernpol(3)\n            %2 = x^3 - 3/2*x^2 + 1/2*x\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_191bernpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bernpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bernpol") < 0)) __PYX_ERR(4, 2947, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2947, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bernpol", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2947, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_190bernpol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_190bernpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("bernpol", 0);

  /* "cypari/auto_instance.pxi":2958
 *             %2 = x^3 - 3/2*x^2 + 1/2*x
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":2959
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":2960
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = bernpol(n, _v)
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(4, 2960, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_instance.pxi":2959
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":2961
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bernpol(n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 2961, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2962
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _ret = bernpol(n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bernpol(__pyx_v_n, __pyx_v__v);

  /* "cypari/auto_instance.pxi":2963
 *         sig_on()
 *         cdef GEN _ret = bernpol(n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bernreal(self, long x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 2963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2947
 *         return new_gen(_ret)
 * 
 *     def bernpol(self, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bernoulli polynomial :math:`B_n` in variable :math:`v`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2965
 *         return new_gen(_ret)
 * 
 *     def bernreal(self, long x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bernoulli number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_193bernreal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_192bernreal[] = "\n        Bernoulli number\n        :math:`B_x`, as :literal:`bernfrac`, but :math:`B_x` is returned as a real number\n        (with the current precision).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_193bernreal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_x;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bernreal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bernreal") < 0)) __PYX_ERR(4, 2965, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_x == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2965, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2965, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bernreal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2965, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_192bernreal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_192bernreal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bernreal", 0);

  /* "cypari/auto_instance.pxi":2971
 *         (with the current precision).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bernreal(x, precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 2971, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2972
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bernreal(x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2973
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bernreal(x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bernreal(__pyx_v_x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2974
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bernreal(x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bernvec(self, long x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 2974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2965
 *         return new_gen(_ret)
 * 
 *     def bernreal(self, long x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bernoulli number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2976
 *         return new_gen(_ret)
 * 
 *     def bernvec(self, long x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This routine is obsolete, kept for backward compatibility only.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_195bernvec(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_194bernvec[] = "\n        This routine is obsolete, kept for backward compatibility only.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_195bernvec(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
  long __pyx_v_x;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bernvec (wrapper)", 0);
  assert(__pyx_arg_x); {
    __pyx_v_x = __Pyx_PyInt_As_long(__pyx_arg_x); if (unlikely((__pyx_v_x == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2976, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_194bernvec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_194bernvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("bernvec", 0);

  /* "cypari/auto_instance.pxi":2980
 *         This routine is obsolete, kept for backward compatibility only.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bernvec is obsolete (2007-03-30)', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 2980, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":2981
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bernvec is obsolete (2007-03-30)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = bernvec(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 2981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":2982
 *         from warnings import warn
 *         warn('the PARI/GP function bernvec is obsolete (2007-03-30)', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bernvec(x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 2982, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2983
 *         warn('the PARI/GP function bernvec is obsolete (2007-03-30)', DeprecationWarning)
 *         sig_on()
 *         cdef GEN _ret = bernvec(x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bernvec(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2984
 *         sig_on()
 *         cdef GEN _ret = bernvec(x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselh1(self, nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 2984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2976
 *         return new_gen(_ret)
 * 
 *     def bernvec(self, long x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This routine is obsolete, kept for backward compatibility only.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bernvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2986
 *         return new_gen(_ret)
 * 
 *     def besselh1(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_197besselh1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_196besselh1[] = "\n        :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_197besselh1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nu = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselh1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nu,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("besselh1", 0, 2, 3, 1); __PYX_ERR(4, 2986, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselh1") < 0)) __PYX_ERR(4, 2986, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nu = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2986, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselh1", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2986, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselh1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_196besselh1(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nu, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_196besselh1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselh1", 0);
  __Pyx_INCREF(__pyx_v_nu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":2990
 *         :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         nu = objtogen(nu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2991
 *         '''
 *         nu = objtogen(nu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":2992
 *         nu = objtogen(nu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 2992, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":2993
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2994
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":2995
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":2996
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hbessel1(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":2997
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselh2(self, nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2986
 *         return new_gen(_ret)
 * 
 *     def besselh1(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselh1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":2999
 *         return new_gen(_ret)
 * 
 *     def besselh2(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_199besselh2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_198besselh2[] = "\n        :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_199besselh2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nu = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselh2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nu,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("besselh2", 0, 2, 3, 1); __PYX_ERR(4, 2999, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselh2") < 0)) __PYX_ERR(4, 2999, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nu = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 2999, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselh2", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 2999, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselh2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_198besselh2(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nu, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_198besselh2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselh2", 0);
  __Pyx_INCREF(__pyx_v_nu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3003
 *         :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         nu = objtogen(nu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3004
 *         '''
 *         nu = objtogen(nu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3005
 *         nu = objtogen(nu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3005, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3006
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3007
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3008
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3009
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hbessel2(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3010
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besseli(self, nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":2999
 *         return new_gen(_ret)
 * 
 *     def besselh2(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselh2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3012
 *         return new_gen(_ret)
 * 
 *     def besseli(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`I`-Bessel function of index :emphasis:`nu` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_201besseli(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_200besseli[] = "\n        :math:`I`-Bessel function of index :emphasis:`nu` and\n        argument :math:`x`. If :math:`x` converts to a power series, the initial factor\n        :math:`(x/2)^\\nu/\\Gamma (\\nu+1)` is omitted (since it cannot be represented in PARI\n        when :math:`\\nu` is not integral).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_201besseli(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nu = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besseli (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nu,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("besseli", 0, 2, 3, 1); __PYX_ERR(4, 3012, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besseli") < 0)) __PYX_ERR(4, 3012, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nu = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3012, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besseli", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3012, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besseli", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_200besseli(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nu, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_200besseli(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besseli", 0);
  __Pyx_INCREF(__pyx_v_nu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3019
 *         when :math:`\nu` is not integral).
 *         '''
 *         nu = objtogen(nu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3020
 *         '''
 *         nu = objtogen(nu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3021
 *         nu = objtogen(nu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3021, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3022
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3023
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ibessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3024
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ibessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3025
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ibessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ibessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3026
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ibessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselj(self, nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3012
 *         return new_gen(_ret)
 * 
 *     def besseli(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`I`-Bessel function of index :emphasis:`nu` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besseli", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3028
 *         return new_gen(_ret)
 * 
 *     def besselj(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of index :emphasis:`nu` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_203besselj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_202besselj[] = "\n        :math:`J`-Bessel function of index :emphasis:`nu` and\n        argument :math:`x`. If :math:`x` converts to a power series, the initial factor\n        :math:`(x/2)^\\nu/\\Gamma (\\nu+1)` is omitted (since it cannot be represented in PARI\n        when :math:`\\nu` is not integral).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_203besselj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nu = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nu,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("besselj", 0, 2, 3, 1); __PYX_ERR(4, 3028, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselj") < 0)) __PYX_ERR(4, 3028, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nu = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3028, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselj", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3028, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_202besselj(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nu, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_202besselj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselj", 0);
  __Pyx_INCREF(__pyx_v_nu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3035
 *         when :math:`\nu` is not integral).
 *         '''
 *         nu = objtogen(nu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3036
 *         '''
 *         nu = objtogen(nu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3037
 *         nu = objtogen(nu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3037, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3038
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3039
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3040
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jbessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3041
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jbessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3042
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besseljh(self, n, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3028
 *         return new_gen(_ret)
 * 
 *     def besselj(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of index :emphasis:`nu` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3044
 *         return new_gen(_ret)
 * 
 *     def besseljh(self, n, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of half integral index.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_205besseljh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_204besseljh[] = "\n        :math:`J`-Bessel function of half integral index.\n        More precisely, :math:`besseljh (n,x)` computes :math:`J_{n+1/2}(x)` where :math:`n`\n        must be of type integer, and :math:`x` is any element of :math:`\\mathbb{C}`. In the\n        present version :strong:`2.11.3`, this function is not very accurate when :math:`x` is small.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_205besseljh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besseljh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("besseljh", 0, 2, 3, 1); __PYX_ERR(4, 3044, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besseljh") < 0)) __PYX_ERR(4, 3044, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_n = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3044, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besseljh", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3044, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besseljh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_204besseljh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_204besseljh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__n;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besseljh", 0);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3051
 *         present version :strong:`2.11.3`, this function is not very accurate when :math:`x` is small.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3052
 *         '''
 *         n = objtogen(n)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3052, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3053
 *         n = objtogen(n)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3053, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3054
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3055
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbesselh(_n, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3056
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jbesselh(_n, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3057
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbesselh(_n, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jbesselh(__pyx_v__n, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3058
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbesselh(_n, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselk(self, nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3044
 *         return new_gen(_ret)
 * 
 *     def besseljh(self, n, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of half integral index.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besseljh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3060
 *         return new_gen(_ret)
 * 
 *     def besselk(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_207besselk(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_206besselk[] = "\n        :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_207besselk(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nu = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nu,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("besselk", 0, 2, 3, 1); __PYX_ERR(4, 3060, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselk") < 0)) __PYX_ERR(4, 3060, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nu = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3060, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselk", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3060, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_206besselk(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nu, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_206besselk(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselk", 0);
  __Pyx_INCREF(__pyx_v_nu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3064
 *         :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         nu = objtogen(nu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3065
 *         '''
 *         nu = objtogen(nu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3066
 *         nu = objtogen(nu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3066, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3067
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3068
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = kbessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3069
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = kbessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3070
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = kbessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = kbessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3071
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = kbessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besseln(self, nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3060
 *         return new_gen(_ret)
 * 
 *     def besselk(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besselk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3073
 *         return new_gen(_ret)
 * 
 *     def besseln(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_209besseln(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_208besseln[] = "\n        :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_209besseln(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nu = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besseln (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nu,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nu)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("besseln", 0, 2, 3, 1); __PYX_ERR(4, 3073, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besseln") < 0)) __PYX_ERR(4, 3073, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nu = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3073, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besseln", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3073, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besseln", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_208besseln(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nu, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_208besseln(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besseln", 0);
  __Pyx_INCREF(__pyx_v_nu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3077
 *         :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         nu = objtogen(nu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3078
 *         '''
 *         nu = objtogen(nu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3079
 *         nu = objtogen(nu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3079, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3080
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3081
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nbessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3082
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nbessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3083
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nbessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nbessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3084
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nbessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bestappr(self, x, B=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3073
 *         return new_gen(_ret)
 * 
 *     def besseln(self, nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.besseln", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3086
 *         return new_gen(_ret)
 * 
 *     def bestappr(self, x, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm, returns a rational
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_211bestappr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_210bestappr[] = "\n        Using variants of the extended Euclidean algorithm, returns a rational\n        approximation :math:`a/b` to :math:`x`, whose denominator is limited\n        by :math:`B`, if present. If :math:`B` is omitted, return the best approximation\n        affordable given the input accuracy; if you are looking for true rational\n        numbers, presumably approximated to sufficient accuracy, you should first\n        try that option. Otherwise, :math:`B` must be a positive real scalar (impose\n        :math:`0 < b <= B`).\n        \n        - If :math:`x` is a :literal:`t_REAL` or a :literal:`t_FRAC`, this function uses continued\n          fractions.\n        \n        ::\n        \n            ? bestappr(Pi, 100)\n            %1 = 22/7\n            ? bestappr(0.1428571428571428571428571429)\n            %2 = 1/7\n            ? bestappr([Pi, sqrt(2) + 'x], 10^3)\n            %3 = [355/113, x + 1393/985]\n        \n        By definition, :math:`a/b` is the best rational approximation to :math:`x` if\n        :math:`\\|b x - a\\| < \\|v x - u\\|` for all integers :math:`(u,v)` with :math:`0 < v <= B`.\n        (Which implies that :math:`n/d` is a convergent of the continued fraction of :math:`x`.)\n        \n        - If :math:`x` is a :literal:`t_INTMOD` modulo :math:`N` or a :literal:`t_PADIC` of precision :math:`N =\n          p^k`, this function performs rational modular reconstruction modulo :math:`N`. The\n          routine then returns the unique rational number :math:`a/b` in coprime integers\n          :math:`\\|a\\| < N/2B` and :math:`b <= B` which is congruent to :math:`x` modulo :math:`N`. Omitting\n          :math:`B` amounts to choosing it of the order of :math:`\\sqrt{N/2}`. If rational\n          reconstruction is not possible (no suitable :math:`a/b` exists), returns :math:`[]`.\n        \n        ::\n        \n            ? bestappr(Mod(18526731858, 11^10))\n            %1 = 1/7\n            ? bestappr(Mod(18526731858, 11^20))\n            %2 = [""]\n            ? bestappr(3 + 5 + 3*5^2 + 5^3 + 3*5^4 + 5^5 + 3*5^6 + O(5^7))\n            %2 = -1/3\n        \n        In most concrete uses, :math:`B` is a prime power and we performed\n        Hensel lifting to obtain :math:`x`.\n        \n        The function applies recursively to components of complex objects\n        (polynomials, vectors,...). If rational reconstruction fails for even a\n        single entry, return :math:`[]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_211bestappr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bestappr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_B,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bestappr") < 0)) __PYX_ERR(4, 3086, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_B = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bestappr", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3086, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bestappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_210bestappr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_B);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_210bestappr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_B) {
  int __pyx_v__have_B;
  GEN __pyx_v__x;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bestappr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":3135
 *         single entry, return :math:`[]`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3136
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_instance.pxi":3137
 *         x = objtogen(x)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3138
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":3137
 *         x = objtogen(x)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":3139
 *         if _have_B:
 *             B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 3139, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3140
 *             B = objtogen(B)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":3141
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_instance.pxi":3142
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3143
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bestappr(_x, _B)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_instance.pxi":3142
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)
 */
  }

  /* "cypari/auto_instance.pxi":3144
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bestappr(__pyx_v__x, __pyx_v__B);

  /* "cypari/auto_instance.pxi":3145
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bestapprPade(self, x, long B=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3086
 *         return new_gen(_ret)
 * 
 *     def bestappr(self, x, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm, returns a rational
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bestappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3147
 *         return new_gen(_ret)
 * 
 *     def bestapprPade(self, x, long B=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm (Pad
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_213bestapprPade(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_212bestapprPade[] = "\n        Using variants of the extended Euclidean algorithm (Pad\303\251\n        approximants), returns a rational\n        function approximation :math:`a/b` to :math:`x`, whose denominator is limited\n        by :math:`B`, if present. If :math:`B` is omitted, return the best approximation\n        affordable given the input accuracy; if you are looking for true rational\n        functions, presumably approximated to sufficient accuracy, you should first\n        try that option. Otherwise, :math:`B` must be a non-negative real\n        (impose :math:`0 <= degree(b) <= B`).\n        \n        - If :math:`x` is a :literal:`t_POLMOD` modulo :math:`N` this function performs rational\n          modular reconstruction modulo :math:`N`. The routine then returns the unique\n          rational function :math:`a/b` in coprime polynomials, with :math:`degree(b) <= B`\n          and :math:`degree(a)` minimal, which is congruent to :math:`x` modulo :math:`N`.\n          Omitting :math:`B` amounts to choosing it equal to the floor of\n          :math:`degree(N) / 2`. If rational reconstruction is not possible (no\n          suitable :math:`a/b` exists), returns :math:`[]`.\n        \n        ::\n        \n            ? T = Mod(x^3 + x^2 + x + 3, x^4 - 2);\n            ? bestapprPade(T)\n            %2 = (2*x - 1)/(x - 1)\n            ? U = Mod(1 + x + x^2 + x^3 + x^5, x^9);\n            ? bestapprPade(U) \\\\ internally chooses B = 4\n            %3 = []\n            ? bestapprPade(U, 5) \\\\ with B = 5, a solution exists\n            %4 = (2*x^4 + x^3 - x - 1)/(-x^5 + x^3 + x^2 - 1)\n        \n        - If :math:`x` is a :literal:`t_SER`, we implicitly\n          convert the input to a :literal:`t_POLMOD` modulo :math:`N = t^k` where :math:`k` is the\n          series absolute precision.\n        \n        ::\n        \n            ? T = 1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + O(t^7); \\\\ mod t^7\n            ? bestapprPade(T)\n            %1 = 1/(-t + 1)\n        \n        -"" If :math:`x` is a :literal:`t_RFRAC`, we implicitly convert the input to a\n          :literal:`t_POLMOD` modulo :math:`N = t^k` where :math:`k = 2B + 1`. If :math:`B` was omitted,\n          we return :math:`x`:\n        \n        ::\n        \n            ? T = (4*t^2 + 2*t + 3)/(t+1)^10;\n            ? bestapprPade(T,1)\n            %2 = [] \\\\ impossible\n            ? bestapprPade(T,2)\n            %3 = 27/(337*t^2 + 84*t + 9)\n            ? bestapprPade(T,3)\n            %4 = (4253*t - 3345)/(-39007*t^3 - 28519*t^2 - 8989*t - 1115)\n        \n        The function applies recursively to components of complex objects\n        (polynomials, vectors,...). If rational reconstruction fails for even a\n        single entry, return :math:`[]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_213bestapprPade(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_B;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bestapprPade (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_B,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bestapprPade") < 0)) __PYX_ERR(4, 3147, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_B = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_B == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3147, __pyx_L3_error)
    } else {
      __pyx_v_B = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bestapprPade", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bestapprPade", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_212bestapprPade(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_B);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_212bestapprPade(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_B) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bestapprPade", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3205
 *         single entry, return :math:`[]`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3206
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bestapprPade(_x, B)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3206, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3207
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bestapprPade(_x, B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3208
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bestapprPade(_x, B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bestapprPade(__pyx_v__x, __pyx_v_B);

  /* "cypari/auto_instance.pxi":3209
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bestapprPade(_x, B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bestapprnf(self, V, T, rootT=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3147
 *         return new_gen(_ret)
 * 
 *     def bestapprPade(self, x, long B=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm (Pad
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bestapprPade", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3211
 *         return new_gen(_ret)
 * 
 *     def bestapprnf(self, V, T, rootT=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being an integral polynomial and :math:`V` being a scalar, vector, or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_215bestapprnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_214bestapprnf[] = "\n        :math:`T` being an integral polynomial and :math:`V` being a scalar, vector, or\n        matrix with complex coefficients, return a reasonable approximation of :math:`V`\n        with polmods modulo :math:`T`. :math:`T` can also be any number field structure, in which\n        case the minimal polynomial attached to the structure (:literal:`:math:`T``.pol) is\n        used. The :emphasis:`rootT` argument, if present, must be an element of\n        :literal:`polroots(:math:`T`)` (or :literal:`:math:`T``.pol), i.e.\302\240a complex root of :math:`T` fixing an embedding of\n        :math:`\\mathbb{Q}[x]/(T)` into :math:`\\mathbb{C}`.\n        \n        ::\n        \n            ? bestapprnf(sqrt(5), polcyclo(5))\n            %1 = Mod(-2*x^3 - 2*x^2 - 1, x^4 + x^3 + x^2 + x + 1)\n            ? bestapprnf(sqrt(5), polcyclo(5), exp(4*I*Pi/5))\n            %2 = Mod(2*x^3 + 2*x^2 + 1, x^4 + x^3 + x^2 + x + 1)\n        \n        When the output has huge rational coefficients, try to\n        increase the working :literal:`realbitprecision`: if the answer does not\n        stabilize, consider that the reconstruction failed.\n        Beware that if :math:`T` is not Galois over :math:`\\mathbb{Q}`, some embeddings\n        may not allow to reconstruct :math:`V`:\n        \n        ::\n        \n            ? T = x^3-2; vT = polroots(T); z = 3*2^(1/3)+1;\n            ? bestapprnf(z, T, vT[1])\n            %2 = Mod(3*x + 1, x^3 - 2)\n            ? bestapprnf(z, T, vT[2])\n            %3 = 4213714286230872/186454048314072 \\\\ close to 3*2^(1/3) + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_215bestapprnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_rootT = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bestapprnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_V,&__pyx_n_s_T,&__pyx_n_s_rootT,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_V)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bestapprnf", 0, 2, 4, 1); __PYX_ERR(4, 3211, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rootT);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bestapprnf") < 0)) __PYX_ERR(4, 3211, __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);
        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_V = values[0];
    __pyx_v_T = values[1];
    __pyx_v_rootT = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3211, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bestapprnf", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3211, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bestapprnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_214bestapprnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_V, __pyx_v_T, __pyx_v_rootT, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_214bestapprnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_V, PyObject *__pyx_v_T, PyObject *__pyx_v_rootT, long __pyx_v_precision) {
  int __pyx_v__have_rootT;
  GEN __pyx_v__V;
  GEN __pyx_v__T;
  GEN __pyx_v__rootT;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bestapprnf", 0);
  __Pyx_INCREF(__pyx_v_V);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_rootT);

  /* "cypari/auto_instance.pxi":3242
 *             %3 = 4213714286230872/186454048314072 \\ close to 3*2^(1/3) + 1
 *         '''
 *         V = objtogen(V)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         cdef bint _have_rootT = (rootT is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_V, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_V, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3243
 *         '''
 *         V = objtogen(V)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3244
 *         V = objtogen(V)
 *         T = objtogen(T)
 *         cdef bint _have_rootT = (rootT is not None)             # <<<<<<<<<<<<<<
 *         if _have_rootT:
 *             rootT = objtogen(rootT)
 */
  __pyx_t_2 = (__pyx_v_rootT != Py_None);
  __pyx_v__have_rootT = __pyx_t_2;

  /* "cypari/auto_instance.pxi":3245
 *         T = objtogen(T)
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             rootT = objtogen(rootT)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_rootT != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3246
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:
 *             rootT = objtogen(rootT)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _V = (<Gen>V).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rootT, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_rootT, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":3245
 *         T = objtogen(T)
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             rootT = objtogen(rootT)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":3247
 *         if _have_rootT:
 *             rootT = objtogen(rootT)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 3247, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3248
 *             rootT = objtogen(rootT)
 *         sig_on()
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_4;

  /* "cypari/auto_instance.pxi":3249
 *         sig_on()
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_instance.pxi":3250
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL             # <<<<<<<<<<<<<<
 *         if _have_rootT:
 *             _rootT = (<Gen>rootT).g
 */
  __pyx_v__rootT = NULL;

  /* "cypari/auto_instance.pxi":3251
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_rootT != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3252
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:
 *             _rootT = (<Gen>rootT).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rootT)->__pyx_base.g;
    __pyx_v__rootT = __pyx_t_4;

    /* "cypari/auto_instance.pxi":3251
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":3253
 *         if _have_rootT:
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3254
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bestapprnf(__pyx_v__V, __pyx_v__T, __pyx_v__rootT, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3255
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bezout(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3211
 *         return new_gen(_ret)
 * 
 *     def bestapprnf(self, V, T, rootT=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being an integral polynomial and :math:`V` being a scalar, vector, or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bestapprnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_rootT);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3257
 *         return new_gen(_ret)
 * 
 *     def bezout(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`gcdext`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_217bezout(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_216bezout[] = "\n        Deprecated alias for :literal:`gcdext`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_217bezout(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bezout (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bezout", 1, 2, 2, 1); __PYX_ERR(4, 3257, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bezout") < 0)) __PYX_ERR(4, 3257, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bezout", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3257, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bezout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_216bezout(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_216bezout(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bezout", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":3261
 *         Deprecated alias for :literal:`gcdext`
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3261, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3262
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3263
 *         from warnings import warn
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3264
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3265
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 3265, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3266
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":3267
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_instance.pxi":3268
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcdext0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":3269
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bezoutres(self, A, B, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3257
 *         return new_gen(_ret)
 * 
 *     def bezout(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`gcdext`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bezout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3271
 *         return new_gen(_ret)
 * 
 *     def bezoutres(self, A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`polresultantext`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_219bezoutres(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_218bezoutres[] = "\n        Deprecated alias for :literal:`polresultantext`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_219bezoutres(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bezoutres (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_A)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bezoutres", 0, 2, 3, 1); __PYX_ERR(4, 3271, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bezoutres") < 0)) __PYX_ERR(4, 3271, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_A = values[0];
    __pyx_v_B = values[1];
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bezoutres", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bezoutres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_218bezoutres(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_218bezoutres(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v) {
  PyObject *__pyx_v_warn = NULL;
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  GEN __pyx_t_7;
  __Pyx_RefNannySetupContext("bezoutres", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":3275
 *         Deprecated alias for :literal:`polresultantext`
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)
 *         A = objtogen(A)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3275, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3276
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         B = objtogen(B)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3277
 *         from warnings import warn
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         cdef long _v = -1
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3278
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)
 *         A = objtogen(A)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":3279
 *         A = objtogen(A)
 *         B = objtogen(B)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":3280
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_v != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":3281
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_5 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_5 == ((long)-2L))) __PYX_ERR(4, 3281, __pyx_L1_error)
    __pyx_v__v = __pyx_t_5;

    /* "cypari/auto_instance.pxi":3280
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":3282
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(4, 3282, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3283
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 */
  __pyx_t_7 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_7;

  /* "cypari/auto_instance.pxi":3284
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_7 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_7;

  /* "cypari/auto_instance.pxi":3285
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polresultantext0(__pyx_v__A, __pyx_v__B, __pyx_v__v);

  /* "cypari/auto_instance.pxi":3286
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bigomega(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 3286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3271
 *         return new_gen(_ret)
 * 
 *     def bezoutres(self, A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`polresultantext`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bezoutres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3288
 *         return new_gen(_ret)
 * 
 *     def bigomega(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of prime divisors of the integer :math:`\|x\|` counted with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_221bigomega(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_220bigomega[] = "\n        Number of prime divisors of the integer :math:`\\|x\\|` counted with\n        multiplicity:\n        \n        ::\n        \n            ? factor(392)\n            %1 =\n            [2 3]\n            \n            [7 2]\n            \n            ? bigomega(392)\n            %2 = 5; \\\\ = 3+2\n            ? omega(392)\n            %3 = 2; \\\\ without multiplicity\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_221bigomega(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bigomega (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_220bigomega(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_220bigomega(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bigomega", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3306
 *             %3 = 2; \\ without multiplicity
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3307
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = bigomega(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3307, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3308
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bigomega(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3309
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = bigomega(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bigomega(__pyx_v__x);

  /* "cypari/auto_instance.pxi":3310
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = bigomega(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":3311
 *         cdef long _ret = bigomega(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def binary(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3288
 *         return new_gen(_ret)
 * 
 *     def bigomega(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of prime divisors of the integer :math:`\|x\|` counted with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bigomega", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3313
 *         return _ret
 * 
 *     def binary(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the binary digits of :math:`\|x\|`. Here :math:`x` can be an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_223binary(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_222binary[] = "\n        Outputs the vector of the binary digits of :math:`\\|x\\|`. Here :math:`x` can be an\n        integer, a real number (in which case the result has two components, one for\n        the integer part, one for the fractional part) or a vector/matrix.\n        \n        ::\n        \n            ? binary(10)\n            %1 = [1, 0, 1, 0]\n            \n            ? binary(3.14)\n            %2 = [[1, 1], [0, 0, 1, 0, 0, 0, [...]]\n            \n            ? binary([1,2])\n            %3 = [[1], [1, 0]]\n        \n        By convention, :math:`0` has no digits:\n        \n        ::\n        \n            ? binary(0)\n            %4 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_223binary(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("binary (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_222binary(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_222binary(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("binary", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3337
 *             %4 = []
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3337, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3338
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = binaire(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3338, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3339
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = binaire(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3340
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = binaire(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = binaire(__pyx_v__x);

  /* "cypari/auto_instance.pxi":3341
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = binaire(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def binomial(self, x, k=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3313
 *         return _ret
 * 
 *     def binary(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the binary digits of :math:`\|x\|`. Here :math:`x` can be an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.binary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3343
 *         return new_gen(_ret)
 * 
 *     def binomial(self, x, k=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         binomial coefficient :math:`binom{x}{k}`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_225binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_224binomial[] = "\n        binomial coefficient :math:`binom{x}{k}`.\n        Here :math:`k` must be an integer, but :math:`x` can be any PARI object.\n        \n        ::\n        \n            ? binomial(4,2)\n            %1 = 6\n            ? n = 4; vector(n+1, k, binomial(n,k-1))\n            %2 = [1, 4, 6, 4, 1]\n        \n        The argument :math:`k` may be omitted if :math:`x = n` is a\n        non-negative integer; in this case, return the vector with :math:`n+1`\n        components whose :math:`k+1`-th entry is :literal:`binomial`:math:`(n,k)`\n        \n        ::\n        \n            ? binomial(4)\n            %3 = [1, 4, 6, 4, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_225binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("binomial (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_k,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "binomial") < 0)) __PYX_ERR(4, 3343, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_k = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("binomial", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3343, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.binomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_224binomial(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_k);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_224binomial(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_k) {
  int __pyx_v__have_k;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("binomial", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_instance.pxi":3364
 *             %3 = [1, 4, 6, 4, 1]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_k = (k is not None)
 *         if _have_k:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3365
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_k = (k is not None)             # <<<<<<<<<<<<<<
 *         if _have_k:
 *             k = objtogen(k)
 */
  __pyx_t_2 = (__pyx_v_k != Py_None);
  __pyx_v__have_k = __pyx_t_2;

  /* "cypari/auto_instance.pxi":3366
 *         x = objtogen(x)
 *         cdef bint _have_k = (k is not None)
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             k = objtogen(k)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_k != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3367
 *         cdef bint _have_k = (k is not None)
 *         if _have_k:
 *             k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":3366
 *         x = objtogen(x)
 *         cdef bint _have_k = (k is not None)
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             k = objtogen(k)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":3368
 *         if _have_k:
 *             k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 3368, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3369
 *             k = objtogen(k)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = NULL
 *         if _have_k:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":3370
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL             # <<<<<<<<<<<<<<
 *         if _have_k:
 *             _k = (<Gen>k).g
 */
  __pyx_v__k = NULL;

  /* "cypari/auto_instance.pxi":3371
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)
 */
  __pyx_t_2 = (__pyx_v__have_k != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3372
 *         cdef GEN _k = NULL
 *         if _have_k:
 *             _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = binomial0(_x, _k)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
    __pyx_v__k = __pyx_t_4;

    /* "cypari/auto_instance.pxi":3371
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)
 */
  }

  /* "cypari/auto_instance.pxi":3373
 *         if _have_k:
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = binomial0(__pyx_v__x, __pyx_v__k);

  /* "cypari/auto_instance.pxi":3374
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitand(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3374, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3343
 *         return new_gen(_ret)
 * 
 *     def binomial(self, x, k=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         binomial coefficient :math:`binom{x}{k}`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.binomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3376
 *         return new_gen(_ret)
 * 
 *     def bitand(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise :literal:`and`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_227bitand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_226bitand[] = "\n        Bitwise :literal:`and`\n        of two integers :math:`x` and :math:`y`, that is the integer\n        \n        .. MATH::\n        \n            \\sum_i (x_i\302\240and\302\240y_i) 2^i\n        \n        Negative numbers behave :math:`2`-adically, i.e.\302\240the result is the :math:`2`-adic limit\n        of :literal:`bitand`:math:`(x_n,y_n)`, where :math:`x_n` and :math:`y_n` are non-negative integers\n        tending to :math:`x` and :math:`y` respectively. (The result is an ordinary integer,\n        possibly negative.)\n        \n        ::\n        \n            ? bitand(5, 3)\n            %1 = 1\n            ? bitand(-5, 3)\n            %2 = 3\n            ? bitand(-5, -3)\n            %3 = -7\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_227bitand(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitand (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bitand", 1, 2, 2, 1); __PYX_ERR(4, 3376, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitand") < 0)) __PYX_ERR(4, 3376, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitand", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3376, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_226bitand(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_226bitand(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitand", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":3399
 *             %3 = -7
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3400
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3401
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3401, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3402
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitand(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3403
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitand(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3404
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitand(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitand(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":3405
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitand(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitneg(self, x, long n=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3376
 *         return new_gen(_ret)
 * 
 *     def bitand(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise :literal:`and`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3407
 *         return new_gen(_ret)
 * 
 *     def bitneg(self, x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise negation of an integer :math:`x`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_229bitneg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_228bitneg[] = "\n        bitwise negation of an integer :math:`x`,\n        truncated to :math:`n` bits, :math:`n >= 0`, that is the integer\n        \n        .. MATH::\n        \n            \\sum_{i = 0}^{n-1} not (x_i) 2^i.\n        \n        The special case :math:`n = -1` means no truncation: an infinite sequence of\n        leading :math:`1` is then represented as a negative number.\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_229bitneg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitneg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitneg") < 0)) __PYX_ERR(4, 3407, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3407, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitneg", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3407, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_228bitneg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_228bitneg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitneg", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3421
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3422
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbitneg(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3422, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3423
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitneg(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3424
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbitneg(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitneg(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":3425
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbitneg(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitnegimply(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3407
 *         return new_gen(_ret)
 * 
 *     def bitneg(self, x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise negation of an integer :math:`x`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3427
 *         return new_gen(_ret)
 * 
 *     def bitnegimply(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise negated imply of two integers :math:`x` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_231bitnegimply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_230bitnegimply[] = "\n        Bitwise negated imply of two integers :math:`x` and\n        :math:`y` (or :literal:`not` :math:`(x ==> y)`), that is the integer \n        \n        .. MATH::\n        \n            \\sum\n            (x_i\302\240and not (y_i)) 2^i\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_231bitnegimply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitnegimply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bitnegimply", 1, 2, 2, 1); __PYX_ERR(4, 3427, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitnegimply") < 0)) __PYX_ERR(4, 3427, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitnegimply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3427, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitnegimply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_230bitnegimply(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_230bitnegimply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitnegimply", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":3439
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3440
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3441
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3441, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3442
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitnegimply(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3443
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitnegimply(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3444
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitnegimply(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitnegimply(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":3445
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitnegimply(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitor(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3427
 *         return new_gen(_ret)
 * 
 *     def bitnegimply(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise negated imply of two integers :math:`x` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitnegimply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3447
 *         return new_gen(_ret)
 * 
 *     def bitor(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise (inclusive)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_233bitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_232bitor[] = "\n        bitwise (inclusive)\n        :literal:`or` of two integers :math:`x` and :math:`y`, that is the integer \n        \n        .. MATH::\n        \n            \\sum\n            (x_i\302\240or\302\240y_i) 2^i\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_233bitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bitor", 1, 2, 2, 1); __PYX_ERR(4, 3447, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitor") < 0)) __PYX_ERR(4, 3447, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3447, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_232bitor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_232bitor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitor", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":3459
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3460
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3461
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3461, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3462
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitor(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3463
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitor(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3464
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitor(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitor(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":3465
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitor(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitprecision(self, x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3447
 *         return new_gen(_ret)
 * 
 *     def bitor(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise (inclusive)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3467
 *         return new_gen(_ret)
 * 
 *     def bitprecision(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_235bitprecision(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_234bitprecision[] = "\n        The function behaves differently according to whether :math:`n` is\n        present and positive or not. If :math:`n` is missing, the function returns the\n        (floating point) precision in bits of the PARI object :math:`x`. If :math:`x` is an\n        exact object, the function returns :literal:`+oo`.\n        \n        ::\n        \n            ? bitprecision(exp(1e-100))\n            %1 = 512 \\\\ 512 bits\n            ? bitprecision( [ exp(1e-100), 0.5 ] )\n            %2 = 128 \\\\ minimal accuracy among components\n            ? bitprecision(2 + x)\n            %3 = +oo \\\\ exact object\n        \n        If :math:`n` is present and positive, the function creates a new object equal to :math:`x`\n        with the new bit-precision roughly :math:`n`. In fact, the smallest multiple of 64\n        (resp.\302\24032 on a 32-bit machine) larger than or equal to :math:`n`.\n        \n        For :math:`x` a vector or a matrix, the operation is\n        done componentwise; for series and polynomials, the operation is done\n        coefficientwise. For real :math:`x`, :math:`n` is the number of desired significant\n        :emphasis:`bits`. If :math:`n` is smaller than the precision of :math:`x`, :math:`x` is truncated,\n        otherwise :math:`x` is extended with zeros. For exact or non-floating point types,\n        no change.\n        \n        ::\n        \n            ? bitprecision(Pi, 10) \\\\ actually 64 bits ~ 19 decimal digits\n            %1 = 3.141592653589793239\n            ? bitprecision(1, 10)\n            %2 = 1\n            ? bitprecision(1 + O(x), 10)\n            %3 = 1 + O(x)\n            ? bitprecision(2 + O(3^5), 10)\n            %4 = 2 + O(3^5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_235bitprecision(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitprecision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitprecision") < 0)) __PYX_ERR(4, 3467, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3467, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitprecision", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3467, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitprecision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_234bitprecision(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_234bitprecision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitprecision", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3505
 *             %4 = 2 + O(3^5)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3506
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bitprecision0(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3506, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3507
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bitprecision0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3508
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bitprecision0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bitprecision0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":3509
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bitprecision0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bittest(self, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3467
 *         return new_gen(_ret)
 * 
 *     def bitprecision(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitprecision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3511
 *         return new_gen(_ret)
 * 
 *     def bittest(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the :math:`n-th` bit of :math:`x` starting
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_237bittest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_236bittest[] = "\n        Outputs the :math:`n-th` bit of :math:`x` starting\n        from the right (i.e.\302\240the coefficient of :math:`2^n` in the binary expansion of :math:`x`).\n        The result is 0 or 1.\n        \n        ::\n        \n            ? bittest(7, 0)\n            %1 = 1 \\\\ the bit 0 is 1\n            ? bittest(7, 2)\n            %2 = 1 \\\\ the bit 2 is 1\n            ? bittest(7, 3)\n            %3 = 0 \\\\ the bit 3 is 0\n        \n        See ``bitand`` (in the PARI manual) for the behavior at negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_237bittest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bittest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bittest", 1, 2, 2, 1); __PYX_ERR(4, 3511, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bittest") < 0)) __PYX_ERR(4, 3511, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3511, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bittest", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3511, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bittest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_236bittest(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_236bittest(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bittest", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3528
 *         See ``bitand`` (in the PARI manual) for the behavior at negative arguments.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3529
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbittest(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3529, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3530
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbittest(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3531
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbittest(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbittest(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":3532
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbittest(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitxor(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3511
 *         return new_gen(_ret)
 * 
 *     def bittest(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the :math:`n-th` bit of :math:`x` starting
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bittest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3534
 *         return new_gen(_ret)
 * 
 *     def bitxor(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise (exclusive) :literal:`or`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_239bitxor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_238bitxor[] = "\n        Bitwise (exclusive) :literal:`or`\n        of two integers :math:`x` and :math:`y`, that is the integer\n        \n        .. MATH::\n        \n            \\sum (x_i\302\240xor\302\240y_i) 2^i\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_239bitxor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitxor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bitxor", 1, 2, 2, 1); __PYX_ERR(4, 3534, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitxor") < 0)) __PYX_ERR(4, 3534, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitxor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3534, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitxor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_238bitxor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_238bitxor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitxor", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":3545
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3546
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3547
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3547, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3548
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitxor(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3549
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitxor(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3550
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitxor(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitxor(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":3551
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitxor(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfcertify(self, bnf, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3534
 *         return new_gen(_ret)
 * 
 *     def bitxor(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise (exclusive) :literal:`or`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bitxor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3553
 *         return new_gen(_ret)
 * 
 *     def bnfcertify(self, bnf, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_241bnfcertify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_240bnfcertify[] = "\n        :math:`bnf` being as output by\n        :literal:`bnfinit`, checks whether the result is correct, i.e.\302\240whether it is\n        possible to remove the assumption of the Generalized Riemann\n        Hypothesis. It is correct if and only if the answer is 1. If it is\n        incorrect, the program may output some error message, or loop indefinitely.\n        You can check its progress by increasing the debug level. The :emphasis:`bnf`\n        structure must contain the fundamental units:\n        \n        ::\n        \n            ? K = bnfinit(x^3+2^2^3+1); bnfcertify(K)\n             *** at top-level: K=bnfinit(x^3+2^2^3+1);bnfcertify(K)\n             *** ^-------------\n             *** bnfcertify: missing units in bnf.\n            ? K = bnfinit(x^3+2^2^3+1, 1); \\\\ include units\n            ? bnfcertify(K)\n            %3 = 1\n        \n        If flag is present, only certify that the class group is a quotient of the\n        one computed in bnf (much simpler in general); likewise, the computed units\n        may form a subgroup of the full unit group. In this variant, the units are\n        no longer needed:\n        \n        ::\n        \n            ? K = bnfinit(x^3+2^2^3+1); bnfcertify(K, 1)\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_241bnfcertify(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfcertify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_flag,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_bnf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfcertify") < 0)) __PYX_ERR(4, 3553, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bnf = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3553, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfcertify", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3553, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfcertify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_240bnfcertify(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_240bnfcertify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfcertify", 0);
  __Pyx_INCREF(__pyx_v_bnf);

  /* "cypari/auto_instance.pxi":3583
 *             %4 = 1
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3584
 *         '''
 *         bnf = objtogen(bnf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3584, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3585
 *         bnf = objtogen(bnf)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3586
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef long _ret = bnfcertify0(_bnf, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bnfcertify0(__pyx_v__bnf, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":3587
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":3588
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def bnfcompress(self, bnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3553
 *         return new_gen(_ret)
 * 
 *     def bnfcertify(self, bnf, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfcertify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3590
 *         return _ret
 * 
 *     def bnfcompress(self, bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a compressed version of :emphasis:`bnf` (from :literal:`bnfinit`), a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_243bnfcompress(PyObject *__pyx_v_self, PyObject *__pyx_v_bnf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_242bnfcompress[] = "\n        Computes a compressed version of :emphasis:`bnf` (from :literal:`bnfinit`), a\n        \"small Buchmann's number field\" (or :emphasis:`sbnf` for short) which contains\n        enough information to recover a full :math:`bnf` vector very rapidly, but\n        which is much smaller and hence easy to store and print. Calling\n        :literal:`bnfinit` on the result recovers a true :literal:`bnf`, in general different\n        from the original. Note that an :emphasis:`snbf` is useless for almost all\n        purposes besides storage, and must be converted back to :emphasis:`bnf` form\n        before use; for instance, no :literal:`nf*`, :literal:`bnf*` or member function\n        accepts them.\n        \n        An :emphasis:`sbnf` is a 12 component vector :math:`v`, as follows. Let :literal:`bnf` be\n        the result of a full :literal:`bnfinit`, complete with units. Then :math:`v[1]` is\n        :literal:`bnf.pol`, :math:`v[2]` is the number of real embeddings :literal:`bnf.sign[1]`,\n        :math:`v[3]` is :literal:`bnf.disc`, :math:`v[4]` is :literal:`bnf.zk`, :math:`v[5]` is the list of roots\n        :literal:`bnf.roots`, :math:`v[7]` is the matrix :math:`W = bnf[1]`,\n        :math:`v[8]` is the matrix :math:`matalpha = bnf[2]`,\n        :math:`v[9]` is the prime ideal factor base :literal:`bnf[5]` coded in a compact way,\n        and ordered according to the permutation :literal:`bnf[6]`, :math:`v[10]` is the\n        2-component vector giving the number of roots of unity and a generator,\n        expressed on the integral basis, :math:`v[11]` is the list of fundamental units,\n        expressed on the integral basis, :math:`v[12]` is a vector containing the algebraic\n        numbers alpha corresponding to the columns of the matrix :literal:`matalpha`,\n        expressed on the integral basis.\n        \n        All the components are exact (integral or rational), except for the roots in\n        :math:`v[5]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_243bnfcompress(PyObject *__pyx_v_self, PyObject *__pyx_v_bnf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfcompress (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_242bnfcompress(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_bnf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_242bnfcompress(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfcompress", 0);
  __Pyx_INCREF(__pyx_v_bnf);

  /* "cypari/auto_instance.pxi":3619
 *         :math:`v[5]`.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3620
 *         '''
 *         bnf = objtogen(bnf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfcompress(_bnf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3620, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3621
 *         bnf = objtogen(bnf)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfcompress(_bnf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3622
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfcompress(_bnf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfcompress(__pyx_v__bnf);

  /* "cypari/auto_instance.pxi":3623
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfcompress(_bnf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfdecodemodule(self, nf, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3590
 *         return _ret
 * 
 *     def bnfcompress(self, bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a compressed version of :emphasis:`bnf` (from :literal:`bnfinit`), a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfcompress", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3625
 *         return new_gen(_ret)
 * 
 *     def bnfdecodemodule(self, nf, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`m` is a module as output in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_245bnfdecodemodule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_244bnfdecodemodule[] = "\n        If :math:`m` is a module as output in the\n        first component of an extension given by :literal:`bnrdisclist`, outputs the\n        true module.\n        \n        ::\n        \n            ? K = bnfinit(x^2+23); L = bnrdisclist(K, 10); s = L[2]\n            %1 = [[[Vecsmall([8]), Vecsmall([1])], [[0, 0, 0]]],\n             [[Vecsmall([9]), Vecsmall([1])], [[0, 0, 0]]]]\n            ? bnfdecodemodule(K, s[1][1])\n            %2 =\n            [2 0]\n            \n            [0 1]\n            ? bnfdecodemodule(K,s[2][1])\n            %3 =\n            [2 1]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_245bnfdecodemodule(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfdecodemodule (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_m,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_nf)) != 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_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfdecodemodule", 1, 2, 2, 1); __PYX_ERR(4, 3625, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfdecodemodule") < 0)) __PYX_ERR(4, 3625, __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_nf = values[0];
    __pyx_v_m = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfdecodemodule", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3625, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfdecodemodule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_244bnfdecodemodule(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_244bnfdecodemodule(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_m) {
  GEN __pyx_v__nf;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfdecodemodule", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":3647
 *             [0 1]
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3648
 *         '''
 *         nf = objtogen(nf)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3649
 *         nf = objtogen(nf)
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3649, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3650
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = decodemodule(_nf, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3651
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = decodemodule(_nf, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3652
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = decodemodule(_nf, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = decodemodule(__pyx_v__nf, __pyx_v__m);

  /* "cypari/auto_instance.pxi":3653
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = decodemodule(_nf, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfinit(self, P, long flag=0, tech=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3625
 *         return new_gen(_ret)
 * 
 *     def bnfdecodemodule(self, nf, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`m` is a module as output in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfdecodemodule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3655
 *         return new_gen(_ret)
 * 
 *     def bnfinit(self, P, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_247bnfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_246bnfinit[] = "\n        Initializes a\n        :literal:`bnf` structure. Used in programs such as :literal:`bnfisprincipal`,\n        :literal:`bnfisunit` or :literal:`bnfnarrow`. By default, the results are conditional\n        on the GRH, see ``GRHbnf`` (in the PARI manual). The result is a\n        10-component vector :emphasis:`bnf`.\n        \n        This implements Buchmann's sub-exponential algorithm for computing the\n        class group, the regulator and a system of fundamental units of the\n        general algebraic number field :math:`K` defined by the irreducible polynomial :math:`P`\n        with integer coefficients.\n        \n        If the precision becomes insufficient, :literal:`gp` does not strive to compute\n        the units by default (:math:`flag = 0`).\n        \n        When :math:`flag = 1`, we insist on finding the fundamental units exactly. Be\n        warned that this can take a very long time when the coefficients of the\n        fundamental units on the integral basis are very large. If the fundamental\n        units are simply too large to be represented in this form, an error message\n        is issued. They could be obtained using the so-called compact representation\n        of algebraic numbers as a formal product of algebraic integers. The latter is\n        implemented internally but not publicly accessible yet.\n        \n        :math:`tech` is a technical vector (empty by default, see ``GRHbnf`` (in the PARI manual)).\n        Careful use of this parameter may speed up your computations,\n        but it is mostly obsolete and you should leave it alone.\n        \n        The components of a :emphasis:`bnf` or :emphasis:`sbnf` are technical and never used by\n        the casual user. In fact: :emphasis:`never access a component directly, always use\n        a proper member function.` However, for the sake of completeness and internal\n        documentation, their description is as follows. We use the notations\n        explained in the b""ook by H. Cohen, :emphasis:`A Course in Computational Algebraic\n        Number Theory`, Graduate Texts in Maths :strong:`138`, Springer-Verlag, 1993,\n        Section 6.5, and subsection 6.5.5 in particular.\n        \n        :math:`bnf[1]` contains the matrix :math:`W`, i.e.\302\240the matrix in Hermite normal\n        form giving relations for the class group on prime ideal generators\n        :math:`(p_i)_{1 <= i <= r}`.\n        \n        :math:`bnf[2]` contains the matrix :math:`B`, i.e.\302\240the matrix containing the\n        expressions of the prime ideal factorbase in terms of the :math:`p_i`.\n        It is an :math:`r x c` matrix.\n        \n        :math:`bnf[3]` contains the complex logarithmic embeddings of the system of\n        fundamental units which has been found. It is an :math:`(r_1+r_2) x (r_1+r_2-1)`\n        matrix.\n        \n        :math:`bnf[4]` contains the matrix :math:`M\"_C` of Archimedean components of the\n        relations of the matrix :math:`(W\\|B)`.\n        \n        :math:`bnf[5]` contains the prime factor base, i.e.\302\240the list of prime\n        ideals used in finding the relations.\n        \n        :math:`bnf[6]` used to contain a permutation of the prime factor base, but\n        has been obsoleted. It contains a dummy :math:`0`.\n        \n        :math:`bnf[7]` or :literal:`:emphasis:`bnf`.nf` is equal to the number field data\n        :math:`nf` as would be given by :literal:`nfinit`.\n        \n        :math:`bnf[8]` is a vector containing the classgroup :literal:`:emphasis:`bnf`.clgp`\n        as a finite abelian group, the regulator :literal:`:emphasis:`bnf`.reg`, a :math:`1` (used to\n        contain an obsolete \"check number\"), the number of roots of unity and a\n        generator :literal:`:emphasis:`bnf`.tu`, the fundamental units :literal:`:emphasis:`bnf`.fu`.\n        \n        :math:`bnf[9]` is a 3-element row vector used in :literal:`bnfisprincipal` only\n        and obtained as follows. Let :math:""`D = U W V` obtained by applying the\n        Smith normal form algorithm to the matrix :math:`W` ( = :math:`bnf[1]`) and\n        let :math:`U_r` be the reduction of :math:`U` modulo :math:`D`. The first elements of the\n        factorbase are given (in terms of :literal:`bnf.gen`) by the columns of :math:`U_r`,\n        with Archimedean component :math:`g_a`; let also :math:`GD_a` be the Archimedean\n        components of the generators of the (principal) ideals defined by the\n        :literal:`bnf.gen[i]^bnf.cyc[i]`. Then :math:`bnf[9] = [U_r, g_a, GD_a]`.\n        \n        :math:`bnf[10]` is by default unused and set equal to 0. This field is used\n        to store further information about the field as it becomes available, which\n        is rarely needed, hence would be too expensive to compute during the initial\n        :literal:`bnfinit` call. For instance, the generators of the principal ideals\n        :literal:`bnf.gen[i]^bnf.cyc[i]` (during a call to :literal:`bnrisprincipal`), or\n        those corresponding to the relations in :math:`W` and :math:`B` (when the :literal:`bnf`\n        internal precision needs to be increased).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_247bnfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_tech = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_flag,&__pyx_n_s_tech,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_P)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tech);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfinit") < 0)) __PYX_ERR(4, 3655, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3655, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_tech = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3655, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfinit", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3655, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_246bnfinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_P, __pyx_v_flag, __pyx_v_tech, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_246bnfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision) {
  int __pyx_v__have_tech;
  GEN __pyx_v__P;
  GEN __pyx_v__tech;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnfinit", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_tech);

  /* "cypari/auto_instance.pxi":3737
 *         internal precision needs to be increased).
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3738
 *         '''
 *         P = objtogen(P)
 *         cdef bint _have_tech = (tech is not None)             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             tech = objtogen(tech)
 */
  __pyx_t_2 = (__pyx_v_tech != Py_None);
  __pyx_v__have_tech = __pyx_t_2;

  /* "cypari/auto_instance.pxi":3739
 *         P = objtogen(P)
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_tech != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3740
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:
 *             tech = objtogen(tech)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tech, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_tech, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":3739
 *         P = objtogen(P)
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":3741
 *         if _have_tech:
 *             tech = objtogen(tech)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 3741, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3742
 *             tech = objtogen(tech)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_instance.pxi":3743
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 */
  __pyx_v__tech = NULL;

  /* "cypari/auto_instance.pxi":3744
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_tech != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":3745
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 *             _tech = (<Gen>tech).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tech)->__pyx_base.g;
    __pyx_v__tech = __pyx_t_4;

    /* "cypari/auto_instance.pxi":3744
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":3746
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":3747
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfinit0(__pyx_v__P, __pyx_v_flag, __pyx_v__tech, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":3748
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisintnorm(self, bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3655
 *         return new_gen(_ret)
 * 
 *     def bnfinit(self, P, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_tech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3750
 *         return new_gen(_ret)
 * 
 *     def bnfisintnorm(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a complete system of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_249bnfisintnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_248bnfisintnorm[] = "\n        Computes a complete system of\n        solutions (modulo units of positive norm) of the absolute norm equation\n        :math:`\\mathrm{Norm} (a) = x`,\n        where :math:`a` is an integer in :math:`bnf`. If :math:`bnf` has not been certified,\n        the correctness of the result depends on the validity of GRH.\n        \n        See also :literal:`bnfisnorm`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_249bnfisintnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisintnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_x,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_bnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfisintnorm", 1, 2, 2, 1); __PYX_ERR(4, 3750, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfisintnorm") < 0)) __PYX_ERR(4, 3750, __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_bnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfisintnorm", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3750, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisintnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_248bnfisintnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_248bnfisintnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisintnorm", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3760
 *         See also :literal:`bnfisnorm`.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3761
 *         '''
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3762
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3762, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3763
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3764
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3765
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisintnorm(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":3766
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisnorm(self, bnf, x, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3750
 *         return new_gen(_ret)
 * 
 *     def bnfisintnorm(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a complete system of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisintnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3768
 *         return new_gen(_ret)
 * 
 *     def bnfisnorm(self, bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tries to tell whether the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_251bnfisnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_250bnfisnorm[] = "\n        Tries to tell whether the\n        rational number :math:`x` is the norm of some element y in :math:`bnf`. Returns a\n        vector :math:`[a,b]` where :math:`x = Norm(a)*b`. Looks for a solution which is an :math:`S`-unit,\n        with :math:`S` a certain set of prime ideals containing (among others) all primes\n        dividing :math:`x`. If :math:`bnf` is known to be Galois, set :math:`flag = 0` (in\n        this case, :math:`x` is a norm iff :math:`b = 1`). If :math:`flag` is non zero the program adds to\n        :math:`S` the following prime ideals, depending on the sign of :math:`flag`. If :math:`flag > 0`,\n        the ideals of norm less than :math:`flag`. And if :math:`flag < 0` the ideals dividing :math:`flag`.\n        \n        Assuming GRH, the answer is guaranteed (i.e.\302\240:math:`x` is a norm iff :math:`b = 1`),\n        if :math:`S` contains all primes less than :math:`12\\log (\\mathrm{disc} (Bnf))^2`, where\n        :math:`Bnf` is the Galois closure of :math:`bnf`.\n        \n        See also :literal:`bnfisintnorm`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_251bnfisnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfisnorm", 0, 2, 3, 1); __PYX_ERR(4, 3768, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfisnorm") < 0)) __PYX_ERR(4, 3768, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_bnf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3768, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfisnorm", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3768, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_250bnfisnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_250bnfisnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisnorm", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3785
 *         See also :literal:`bnfisintnorm`.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3786
 *         '''
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3787
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3787, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3788
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3789
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3790
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisnorm(__pyx_v__bnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":3791
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisprincipal(self, bnf, x, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3768
 *         return new_gen(_ret)
 * 
 *     def bnfisnorm(self, bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tries to tell whether the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3793
 *         return new_gen(_ret)
 * 
 *     def bnfisprincipal(self, bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_253bnfisprincipal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_252bnfisprincipal[] = "\n        :math:`bnf` being the\n        number field data output by :literal:`bnfinit`, and :math:`x` being an ideal, this\n        function tests whether the ideal is principal or not. The result is more\n        complete than a simple true/false answer and solves general discrete\n        logarithm problem. Assume the class group is :math:`\\oplus (\\mathbb{Z}/d_i\\mathbb{Z})g_i`\n        (where the generators :math:`g_i` and their orders :math:`d_i` are respectively given by\n        :literal:`bnf.gen` and :literal:`bnf.cyc`). The routine returns a row vector :math:`[e,t]`,\n        where :math:`e` is a vector of exponents :math:`0 <= e_i < d_i`, and :math:`t` is a number\n        field element such that\n        \n        .. MATH::\n        \n            x = (t) \\prod_i g_i^{e_i}.\n        \n        For :emphasis:`given` :math:`g_i` (i.e. for a given :literal:`bnf`), the :math:`e_i` are unique,\n        and :math:`t` is unique modulo units.\n        \n        In particular, :math:`x` is principal if and only if :math:`e` is the zero vector. Note\n        that the empty vector, which is returned when the class number is :math:`1`, is\n        considered to be a zero vector (of dimension :math:`0`).\n        \n        ::\n        \n            ? K = bnfinit(y^2+23);\n            ? K.cyc\n            %2 = [3]\n            ? K.gen\n            %3 = [[2, 0; 0, 1]] \\\\ a prime ideal above 2\n            ? P = idealprimedec(K,3)[1]; \\\\ a prime ideal above 3\n            ? v = bnfisprincipal(K, P)\n            %5 = [[2]~, [3/4, 1/4]~]\n            ? idealmul(K, v[2], idealfactorback(K, K.gen, v[1]))\n            %6 =\n            [3 0]\n            \n            [0 1]\n            ? % == idealhnf(K, P)\n            %7 = 1\n        \n        The binary digits of :emphasis:`flag` mean:\n        \n        - :math:`1`: If set, outputs :math:`[e,t]` as explained above, otherwise returns\n          only :math:`e`, which is much easier to compute. The following idiom only"" tests\n          whether an ideal is principal:\n        \n        ::\n        \n             is_principal(bnf, x) = !bnfisprincipal(bnf,x,0);\n        \n        - :math:`2`: It may not be possible to recover :math:`t`, given the initial accuracy\n          to which the :literal:`bnf` structure was computed. In that case, a warning is\n          printed and :math:`t` is set equal to the empty vector :literal:`[]~`. If this bit is\n          set, increase the precision and recompute needed quantities until :math:`t` can be\n          computed. Warning: setting this may induce :emphasis:`lengthy` computations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_253bnfisprincipal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisprincipal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfisprincipal", 0, 2, 3, 1); __PYX_ERR(4, 3793, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfisprincipal") < 0)) __PYX_ERR(4, 3793, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_bnf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 3793, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfisprincipal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3793, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_252bnfisprincipal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_252bnfisprincipal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisprincipal", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3850
 *           computed. Warning: setting this may induce :emphasis:`lengthy` computations.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3851
 *         '''
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3852
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3852, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3853
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3854
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3855
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisprincipal0(__pyx_v__bnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":3856
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfissunit(self, bnf, sfu, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3793
 *         return new_gen(_ret)
 * 
 *     def bnfisprincipal(self, bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3858
 *         return new_gen(_ret)
 * 
 *     def bnfissunit(self, bnf, sfu, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_255bnfissunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_254bnfissunit[] = "\n        :math:`bnf` being output by\n        :literal:`bnfinit`, :emphasis:`sfu` by :literal:`bnfsunit`, gives the column vector of\n        exponents of :math:`x` on the fundamental :math:`S`-units and the roots of unity, in the\n        following order: the fundamental units\302\240:emphasis:`bnf.fu`, the root of\n        unity\302\240:emphasis:`bnf.tu`, and the :math:`S`-units\302\240:emphasis:`sfu[1]`.\n        If :math:`x` is not an :math:`S`-unit, outputs an empty vector.\n        \n        ::\n        \n             ? bnf = bnfinit(x^4 - x^3 + 4*x^2 + 3*x + 9, 1);\n             ? bnf.sign\n             %2 = [0, 2]\n             ? S = idealprimedec(bnf,5); #S\n             %3 = 2\n             ? sfu = bnfsunit(bnf,S);\n             ? sfu[1]\n             %5 = [-5/6*x^3 + 4/3*x^2 - 4/3*x - 3/2, 5]\n             ? u = [10,-40,24,11]~;\n             ? bnfissunit(bnf,sfu,u)\n             %7 = [1, Mod(2, 6), 2, 0]~\n             ? bnfissunit(bnf,sfu,3)\n             %8 = []~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_255bnfissunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_sfu = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfissunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_sfu,&__pyx_n_s_x,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnf)) != 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_sfu)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfissunit", 1, 3, 3, 1); __PYX_ERR(4, 3858, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfissunit", 1, 3, 3, 2); __PYX_ERR(4, 3858, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfissunit") < 0)) __PYX_ERR(4, 3858, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_bnf = values[0];
    __pyx_v_sfu = values[1];
    __pyx_v_x = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfissunit", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3858, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfissunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_254bnfissunit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_sfu, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_254bnfissunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_sfu, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__sfu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfissunit", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_sfu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3883
 *              %8 = []~
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         sfu = objtogen(sfu)
 *         x = objtogen(x)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3884
 *         '''
 *         bnf = objtogen(bnf)
 *         sfu = objtogen(sfu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sfu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sfu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3885
 *         bnf = objtogen(bnf)
 *         sfu = objtogen(sfu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3886
 *         sfu = objtogen(sfu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _sfu = (<Gen>sfu).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3886, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3887
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sfu = (<Gen>sfu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3888
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _sfu = (<Gen>sfu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sfu)->__pyx_base.g;
  __pyx_v__sfu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3889
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _sfu = (<Gen>sfu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3890
 *         cdef GEN _sfu = (<Gen>sfu).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfissunit(__pyx_v__bnf, __pyx_v__sfu, __pyx_v__x);

  /* "cypari/auto_instance.pxi":3891
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisunit(self, bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3858
 *         return new_gen(_ret)
 * 
 *     def bnfissunit(self, bnf, sfu, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfissunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_sfu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3893
 *         return new_gen(_ret)
 * 
 *     def bnfisunit(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being the number field data
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_257bnfisunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_256bnfisunit[] = "\n        :emphasis:`bnf` being the number field data\n        output by :literal:`bnfinit` and :math:`x` being an algebraic number (type integer,\n        rational or polmod), this outputs the decomposition of :math:`x` on the fundamental\n        units and the roots of unity if :math:`x` is a unit, the empty vector otherwise.\n        More precisely, if :math:`u_1`,...,:math:`u_r` are the fundamental units, and :math:`\\zeta`\n        is the generator of the group of roots of unity (:literal:`bnf.tu`), the output is\n        a vector :math:`[x_1,...,x_r,x_{r+1}]` such that :math:`x = u_1^{x_1}...\n        u_r^{x_r}.\\zeta^{x_{r+1}}`. The :math:`x_i` are integers for :math:`i <= r` and is an\n        integer modulo the order of :math:`\\zeta` for :math:`i = r+1`.\n        \n        Note that :emphasis:`bnf` need not contain the fundamental unit explicitly:\n        \n        ::\n        \n            ? setrand(1); bnf = bnfinit(x^2-x-100000);\n            ? bnf.fu\n             *** at top-level: bnf.fu\n             *** ^--\n             *** _.fu: missing units in .fu.\n            ? u = [119836165644250789990462835950022871665178127611316131167, \\\n             379554884019013781006303254896369154068336082609238336]~;\n            ? bnfisunit(bnf, u)\n            %3 = [-1, Mod(0, 2)]~\n        \n        The given :math:`u` is the inverse of the fundamental unit\n        implicitly stored in :emphasis:`bnf`. In this case, the fundamental unit was not\n        computed and stored in algebraic form since the default accuracy was too\n        low. (Re-run the command at \\\\g1 or higher to see such diagnostics.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_257bnfisunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_x,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_bnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfisunit", 1, 2, 2, 1); __PYX_ERR(4, 3893, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfisunit") < 0)) __PYX_ERR(4, 3893, __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_bnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfisunit", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3893, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_256bnfisunit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_256bnfisunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisunit", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":3924
 *         low. (Re-run the command at \\g1 or higher to see such diagnostics.)
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3925
 *         '''
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3926
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3926, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3927
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisunit(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3928
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisunit(_bnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3929
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisunit(_bnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisunit(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":3930
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisunit(_bnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnflog(self, bnf, l):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3893
 *         return new_gen(_ret)
 * 
 *     def bnfisunit(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being the number field data
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfisunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3932
 *         return new_gen(_ret)
 * 
 *     def bnflog(self, bnf, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnf` be a :emphasis:`bnf` structure attached to the number field :math:`F` and let :math:`l` be
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_259bnflog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_258bnflog[] = "\n        Let :emphasis:`bnf` be a :emphasis:`bnf` structure attached to the number field :math:`F` and let :math:`l` be\n        a prime number (hereafter denoted :math:`\\ell` for typographical reasons). Return\n        the logarithmic :math:`\\ell`-class group :math:`~{Cl}_F`\n        of :math:`F`. This is an abelian group, conjecturally finite (known to be finite\n        if :math:`F/\\mathbb{Q}` is abelian). The function returns if and only if\n        the group is indeed finite (otherwise it would run into an infinite loop).\n        Let :math:`S = { p_1,..., p_k}` be the set of :math:`\\ell`-adic places\n        (maximal ideals containing :math:`\\ell`).\n        The function returns :math:`[D, G(\\ell), G']`, where\n        \n        - :math:`D` is the vector of elementary divisors for :math:`~{Cl}_F`.\n        \n        - :math:`G(\\ell)` is the vector of elementary divisors for\n          the (conjecturally finite) abelian group\n          \n        \n        .. MATH::\n        \n            ~{\\mathrm{Cl}}(\\ell) =\n          \\{ a = \\sum_{i <= k} a_i p_i :\302\240\\deg_F a = 0},\n        \n          where the :math:`p_i` are the :math:`\\ell`-adic places of :math:`F`; this is a\n          subgroup of :math:`~{\\mathrm{Cl}}`.\n        \n        - :math:`G'` is the vector of elementary divisors for the :math:`\\ell`-Sylow :math:`Cl'`\n          of the :math:`S`-class group of :math:`F`; the group :math:`~{\\mathrm{Cl}}` maps to :math:`Cl'`\n          with a simple co-kernel.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_259bnflog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_l = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnflog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_l,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_bnf)) != 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_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnflog", 1, 2, 2, 1); __PYX_ERR(4, 3932, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnflog") < 0)) __PYX_ERR(4, 3932, __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_bnf = values[0];
    __pyx_v_l = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnflog", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3932, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnflog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_258bnflog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_l);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_258bnflog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_l) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__l;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnflog", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_l);

  /* "cypari/auto_instance.pxi":3962
 *           with a simple co-kernel.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         l = objtogen(l)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3963
 *         '''
 *         bnf = objtogen(bnf)
 *         l = objtogen(l)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_l, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_l, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3964
 *         bnf = objtogen(bnf)
 *         l = objtogen(l)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _l = (<Gen>l).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3964, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3965
 *         l = objtogen(l)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflog(_bnf, _l)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3966
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _l = (<Gen>l).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnflog(_bnf, _l)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_l)->__pyx_base.g;
  __pyx_v__l = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3967
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflog(_bnf, _l)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnflog(__pyx_v__bnf, __pyx_v__l);

  /* "cypari/auto_instance.pxi":3968
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflog(_bnf, _l)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnflogdegree(self, nf, A, l):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3932
 *         return new_gen(_ret)
 * 
 *     def bnflog(self, bnf, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnf` be a :emphasis:`bnf` structure attached to the number field :math:`F` and let :math:`l` be
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnflog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":3970
 *         return new_gen(_ret)
 * 
 *     def bnflogdegree(self, nf, A, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_261bnflogdegree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_260bnflogdegree[] = "\n        Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`,\n        and let :math:`l` be a prime number (hereafter\n        denoted :math:`\\ell`). The\n        :math:`\\ell`-adified group of id\\\\`{e}les of :math:`F` quotiented by\n        the group of logarithmic units is identified to the :math:`\\ell`-group\n        of logarithmic divisors :math:`\\oplus \\mathbb{Z}_\\ell [p]`, generated by the\n        maximal ideals of :math:`F`.\n        \n        The :emphasis:`degree` map :math:`\\deg_F` is additive with values in :math:`\\mathbb{Z}_\\ell`,\n        defined by :math:`\\deg_F p = ~{f}_{p} \\deg_\\ell p`,\n        where the integer :math:`~{f}_{p}` is as in :literal:`bnflogef` and :math:`\\deg_\\ell p`\n        is :math:`\\log_\\ell p` for :math:`p != \\ell`, :math:`\\log_\\ell (1 + \\ell)` for\n        :math:`p = \\ell != 2` and :math:`\\log_\\ell (1 + 2^2)` for :math:`p = \\ell = 2`.\n        \n        Let :math:`A = \\prod p^{n_{p}}` be an ideal and let :math:`~{A} =\n        \\sum n_p [p]` be the attached logarithmic divisor. Return the\n        exponential of the :math:`\\ell`-adic logarithmic degree :math:`\\deg_F A`, which is a\n        natural number.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_261bnflogdegree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_l = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnflogdegree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_A,&__pyx_n_s_l,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnflogdegree", 1, 3, 3, 1); __PYX_ERR(4, 3970, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnflogdegree", 1, 3, 3, 2); __PYX_ERR(4, 3970, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnflogdegree") < 0)) __PYX_ERR(4, 3970, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_A = values[1];
    __pyx_v_l = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnflogdegree", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 3970, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnflogdegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_260bnflogdegree(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_A, __pyx_v_l);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_260bnflogdegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_l) {
  GEN __pyx_v__nf;
  GEN __pyx_v__A;
  GEN __pyx_v__l;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnflogdegree", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_l);

  /* "cypari/auto_instance.pxi":3991
 *         natural number.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         l = objtogen(l)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3992
 *         '''
 *         nf = objtogen(nf)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         l = objtogen(l)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3993
 *         nf = objtogen(nf)
 *         A = objtogen(A)
 *         l = objtogen(l)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_l, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_l, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":3994
 *         A = objtogen(A)
 *         l = objtogen(l)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 3994, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":3995
 *         l = objtogen(l)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _l = (<Gen>l).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3996
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3997
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _l = (<Gen>l).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_l)->__pyx_base.g;
  __pyx_v__l = __pyx_t_3;

  /* "cypari/auto_instance.pxi":3998
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnflogdegree(__pyx_v__nf, __pyx_v__A, __pyx_v__l);

  /* "cypari/auto_instance.pxi":3999
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnflogef(self, nf, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 3999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":3970
 *         return new_gen(_ret)
 * 
 *     def bnflogdegree(self, nf, A, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnflogdegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4001
 *         return new_gen(_ret)
 * 
 *     def bnflogef(self, nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_263bnflogef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_262bnflogef[] = "\n        Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`\n        and let :emphasis:`pr` be a :emphasis:`prid` structure attached to a\n        maximal ideal :math:`p / p`. Return\n        :math:`[~{e}(F_p / \\mathbb{Q}_p), ~{f}(F_p / \\mathbb{Q}_p)]`\n        the logarithmic ramification and residue degrees. Let :math:`\\mathbb{Q}_p^c/\\mathbb{Q}_p` be the\n        cyclotomic :math:`\\mathbb{Z}_p`-extension, then\n        :math:`~{e} = [F_p : F_p \\cap \\mathbb{Q}_p^c]` and\n        :math:`~{f} = [F_p \\cap \\mathbb{Q}_p^c : \\mathbb{Q}_p]`. Note that\n        :math:`~{e}~{f} = e(p/p) f(p/p)`, where :math:`e(p/p)` and :math:`f(p/p)` denote the\n        usual ramification and residue degrees.\n        \n        ::\n        \n            ? F = nfinit(y^6 - 3*y^5 + 5*y^3 - 3*y + 1);\n            ? bnflogef(F, idealprimedec(F,2)[1])\n            %2 = [6, 1]\n            ? bnflogef(F, idealprimedec(F,5)[1])\n            %3 = [1, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_263bnflogef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnflogef (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pr,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_nf)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnflogef", 1, 2, 2, 1); __PYX_ERR(4, 4001, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnflogef") < 0)) __PYX_ERR(4, 4001, __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_nf = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnflogef", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4001, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnflogef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_262bnflogef(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_262bnflogef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnflogef", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":4022
 *             %3 = [1, 2]
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4023
 *         '''
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4024
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4024, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4025
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = bnflogef(_nf, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4026
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnflogef(_nf, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4027
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = bnflogef(_nf, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnflogef(__pyx_v__nf, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":4028
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = bnflogef(_nf, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfnarrow(self, bnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4001
 *         return new_gen(_ret)
 * 
 *     def bnflogef(self, nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnflogef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4030
 *         return new_gen(_ret)
 * 
 *     def bnfnarrow(self, bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_265bnfnarrow(PyObject *__pyx_v_self, PyObject *__pyx_v_bnf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_264bnfnarrow[] = "\n        :emphasis:`bnf` being as output by\n        :literal:`bnfinit`, computes the narrow class group of :emphasis:`bnf`. The output is\n        a 3-component row vector :math:`v` analogous to the corresponding class group\n        component :literal:`:emphasis:`bnf`.clgp`: the first component\n        is the narrow class number :literal:`:math:`v`.no`, the second component is a vector\n        containing the SNF cyclic components :literal:`:math:`v`.cyc` of\n        the narrow class group, and the third is a vector giving the generators of\n        the corresponding :literal:`:math:`v`.gen` cyclic groups. Note that this function is a\n        special case of :literal:`bnrinit`; the :emphasis:`bnf` need not contain fundamental\n        units.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_265bnfnarrow(PyObject *__pyx_v_self, PyObject *__pyx_v_bnf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfnarrow (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_264bnfnarrow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_bnf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_264bnfnarrow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfnarrow", 0);
  __Pyx_INCREF(__pyx_v_bnf);

  /* "cypari/auto_instance.pxi":4043
 *         units.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4044
 *         '''
 *         bnf = objtogen(bnf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfnarrow(_bnf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4044, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4045
 *         bnf = objtogen(bnf)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfnarrow(_bnf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4046
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfnarrow(_bnf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfnarrow(__pyx_v__bnf);

  /* "cypari/auto_instance.pxi":4047
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfnarrow(_bnf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfsignunit(self, bnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4030
 *         return new_gen(_ret)
 * 
 *     def bnfnarrow(self, bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfnarrow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4049
 *         return new_gen(_ret)
 * 
 *     def bnfsignunit(self, bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_267bnfsignunit(PyObject *__pyx_v_self, PyObject *__pyx_v_bnf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_266bnfsignunit[] = "\n        :math:`bnf` being as output by\n        :literal:`bnfinit`, this computes an :math:`r_1 x (r_1+r_2-1)` matrix having :math:`\302\2611`\n        components, giving the signs of the real embeddings of the fundamental units.\n        The following functions compute generators for the totally positive units:\n        \n        ::\n        \n            /* exponents of totally positive units generators on bnf.tufu */\n            tpuexpo(bnf)=\n            { my(K, S = bnfsignunit(bnf), [m,n] = matsize(S));\n             \\\\ m = bnf.r1, n = r1+r2-1\n             S = matrix(m,n, i,j, if (S[i,j] < 0, 1,0));\n             S = concat(vectorv(m,i,1), S); \\\\ add sign(-1)\n             K = matker(S * Mod(1,2));\n             if (K, mathnfmodid(lift(K), 2), 2*matid(n+1))\n            }\n            \n            /* totally positive fundamental units */\n            tpu(bnf)=\n            { my(ex = tpuexpo(bnf)[,2..-1]); \\\\ remove ex[,1], corresponds to 1 or -1\n             vector(#ex, i, nffactorback(bnf, bnf.tufu, ex[,i]));\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_267bnfsignunit(PyObject *__pyx_v_self, PyObject *__pyx_v_bnf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfsignunit (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_266bnfsignunit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_bnf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_266bnfsignunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfsignunit", 0);
  __Pyx_INCREF(__pyx_v_bnf);

  /* "cypari/auto_instance.pxi":4074
 *             }
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4075
 *         '''
 *         bnf = objtogen(bnf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = signunits(_bnf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4075, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4076
 *         bnf = objtogen(bnf)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = signunits(_bnf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4077
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = signunits(_bnf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = signunits(__pyx_v__bnf);

  /* "cypari/auto_instance.pxi":4078
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = signunits(_bnf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfsunit(self, bnf, S, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4049
 *         return new_gen(_ret)
 * 
 *     def bnfsignunit(self, bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfsignunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4080
 *         return new_gen(_ret)
 * 
 *     def bnfsunit(self, bnf, S, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the fundamental :math:`S`-units of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_269bnfsunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_268bnfsunit[] = "\n        Computes the fundamental :math:`S`-units of the\n        number field :math:`bnf` (output by :literal:`bnfinit`), where :math:`S` is a list of\n        prime ideals (output by :literal:`idealprimedec`). The output is a vector :math:`v` with\n        6 components.\n        \n        :math:`v[1]` gives a minimal system of (integral) generators of the :math:`S`-unit group\n        modulo the unit group.\n        \n        :math:`v[2]` contains technical data needed by :literal:`bnfissunit`.\n        \n        :math:`v[3]` is an empty vector (used to give the logarithmic embeddings of the\n        generators in :math:`v[1]` in version 2.0.16).\n        \n        :math:`v[4]` is the :math:`S`-regulator (this is the product of the regulator, the\n        determinant of :math:`v[2]` and the natural logarithms of the norms of the ideals\n        in :math:`S`).\n        \n        :math:`v[5]` gives the :math:`S`-class group structure, in the usual format\n        (a row vector whose three components give in order the :math:`S`-class number,\n        the cyclic components and the generators).\n        \n        :math:`v[6]` is a copy of :math:`S`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_269bnfsunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_S = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfsunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_S,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnf)) != 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_S)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfsunit", 0, 2, 3, 1); __PYX_ERR(4, 4080, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfsunit") < 0)) __PYX_ERR(4, 4080, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_bnf = values[0];
    __pyx_v_S = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4080, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfsunit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4080, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfsunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_268bnfsunit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_S, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_268bnfsunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_S, long __pyx_v_precision) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__S;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfsunit", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_S);

  /* "cypari/auto_instance.pxi":4105
 *         :math:`v[6]` is a copy of :math:`S`.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         S = objtogen(S)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4106
 *         '''
 *         bnf = objtogen(bnf)
 *         S = objtogen(S)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_S, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_S, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4107
 *         bnf = objtogen(bnf)
 *         S = objtogen(S)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _S = (<Gen>S).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4107, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4108
 *         S = objtogen(S)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _S = (<Gen>S).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4109
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _S = (<Gen>S).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_S)->__pyx_base.g;
  __pyx_v__S = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4110
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _S = (<Gen>S).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":4111
 *         cdef GEN _S = (<Gen>S).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfsunit(__pyx_v__bnf, __pyx_v__S, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":4112
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrL1(self, bnr, H=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4080
 *         return new_gen(_ret)
 * 
 *     def bnfsunit(self, bnf, S, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the fundamental :math:`S`-units of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnfsunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_S);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4114
 *         return new_gen(_ret)
 * 
 *     def bnrL1(self, bnr, H=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the number field data output by :literal:`bnrinit` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_271bnrL1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_270bnrL1[] = "\n        Let :emphasis:`bnr` be the number field data output by :literal:`bnrinit` and\n        :emphasis:`H` be a square matrix defining a congruence subgroup of the\n        ray class group corresponding to :emphasis:`bnr` (the trivial congruence subgroup\n        if omitted). This function returns, for each character :math:`\\chi` of the ray\n        class group which is trivial on :math:`H`, the value at :math:`s = 1` (or :math:`s = 0`) of the\n        abelian :math:`L`-function attached to :math:`\\chi`. For the value at :math:`s = 0`, the\n        function returns in fact for each :math:`\\chi` a vector :math:`[r_\\chi, c_\\chi]` where\n        \n        .. MATH::\n        \n            L(s, \\chi) = c.s^r + O(s^{r + 1})\n        \n        near :math:`0`.\n        \n        The argument :emphasis:`flag` is optional, its binary digits\n        mean 1: compute at :math:`s = 0` if unset or :math:`s = 1` if set, 2: compute the\n        primitive :math:`L`-function attached to :math:`\\chi` if unset or the :math:`L`-function\n        with Euler factors at prime ideals dividing the modulus of :emphasis:`bnr` removed\n        if set (that is :math:`L_S(s, \\chi)`, where :math:`S` is the\n        set of infinite places of the number field together with the finite prime\n        ideals dividing the modulus of :emphasis:`bnr`), 3: return also the character if\n        set.\n        \n        ::\n        \n            K = bnfinit(x^2-229);\n            bnr = bnrinit(K,1);\n            bnrL1(bnr)\n        \n        returns the order and the first non-zero term of :math:`L(s, \\chi)` at :math:`s = 0`\n        where :math:`\\chi` runs through the characters of the class group of\n        :math:`K = \\mathbb{Q} (\\sqrt{229})`. Then\n        \n        ::\n        \n            bnr2 = bnrinit(K,2);\n            bnrL1(bnr2,,2)\n        \n        returns the order and the first non-zero terms of :math:`L_S(s, \\chi)` at :math:`s = 0`\n        where :math:`\\chi` runs through th""e characters of the class group of :math:`K` and :math:`S` is\n        the set of infinite places of :math:`K` together with the finite prime :math:`2`. Note\n        that the ray class group modulo :math:`2` is in fact the class group, so\n        :literal:`bnrL1(bnr2,0)` returns the same answer as :literal:`bnrL1(bnr,0)`.\n        \n        This function will fail with the message\n        \n        ::\n        \n             *** bnrL1: overflow in zeta_get_N0 [need too many primes].\n        \n        if the approximate functional equation requires us to sum\n        too many terms (if the discriminant of :math:`K` is too large).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_271bnrL1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_H = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrL1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_H,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_bnr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrL1") < 0)) __PYX_ERR(4, 4114, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bnr = values[0];
    __pyx_v_H = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4114, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4114, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrL1", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_270bnrL1(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_H, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_270bnrL1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_H, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_H;
  GEN __pyx_v__bnr;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrL1", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":4169
 *         too many terms (if the discriminant of :math:`K` is too large).
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4169, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4170
 *         '''
 *         bnr = objtogen(bnr)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4171
 *         bnr = objtogen(bnr)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4172
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4171
 *         bnr = objtogen(bnr)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4173
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4173, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4174
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4175
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":4176
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4177
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4176
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":4178
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":4179
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrL1(__pyx_v__bnr, __pyx_v__H, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":4180
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrchar(self, bnr, g, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4114
 *         return new_gen(_ret)
 * 
 *     def bnrL1(self, bnr, H=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the number field data output by :literal:`bnrinit` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4182
 *         return new_gen(_ret)
 * 
 *     def bnrchar(self, bnr, g, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all characters :math:`\chi` on :literal:`bnr.clgp` such that
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_273bnrchar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_272bnrchar[] = "\n        Returns all characters :math:`\\chi` on :literal:`bnr.clgp` such that\n        :math:`\\chi (g_i) = e(v_i)`, where :math:`e(x) = \\exp (2i\\pi x)`. If :math:`v` is omitted,\n        returns all characters that are trivial on the :math:`g_i`. Else the vectors :math:`g`\n        and :math:`v` must have the same length, the :math:`g_i` must be ideals in any form, and\n        each :math:`v_i` is a rational number whose denominator must divide the order of\n        :math:`g_i` in the ray class group. For convenience, the vector of the :math:`g_i`\n        can be replaced by a matrix whose columns give their discrete logarithm,\n        as given by :literal:`bnrisprincipal`; this allows to specify abstractly a\n        subgroup of the ray class group.\n        \n        ::\n        \n            ? bnr = bnrinit(bnfinit(x), [160,[1]], 1); /* (Z/160Z)^* */\n            ? bnr.cyc\n            %2 = [8, 4, 2]\n            ? g = bnr.gen;\n            ? bnrchar(bnr, g, [1/2,0,0])\n            %4 = [[4, 0, 0]] \\\\ a unique character\n            ? bnrchar(bnr, [g[1],g[3]]) \\\\ all characters trivial on g[1] and g[3]\n            %5 = [[0, 1, 0], [0, 2, 0], [0, 3, 0], [0, 0, 0]]\n            ? bnrchar(bnr, [1,0,0;0,1,0;0,0,2])\n            %6 = [[0, 0, 1], [0, 0, 0]] \\\\ characters trivial on given subgroup\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_273bnrchar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrchar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_g,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_bnr)) != 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_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrchar", 0, 2, 3, 1); __PYX_ERR(4, 4182, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrchar") < 0)) __PYX_ERR(4, 4182, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_bnr = values[0];
    __pyx_v_g = values[1];
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrchar", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4182, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_272bnrchar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_g, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_272bnrchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_g, PyObject *__pyx_v_v) {
  int __pyx_v__have_v;
  GEN __pyx_v__bnr;
  GEN __pyx_v__g;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrchar", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_g);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":4207
 *             %6 = [[0, 0, 1], [0, 0, 0]] \\ characters trivial on given subgroup
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         g = objtogen(g)
 *         cdef bint _have_v = (v is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4208
 *         '''
 *         bnr = objtogen(bnr)
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4209
 *         bnr = objtogen(bnr)
 *         g = objtogen(g)
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4210
 *         g = objtogen(g)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4211
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4211, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4210
 *         g = objtogen(g)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4212
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4212, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4213
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4214
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4215
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_instance.pxi":4216
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4217
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4216
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 */
  }

  /* "cypari/auto_instance.pxi":4218
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrchar(__pyx_v__bnr, __pyx_v__g, __pyx_v__v);

  /* "cypari/auto_instance.pxi":4219
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrclassno(self, A, B=None, C=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4182
 *         return new_gen(_ret)
 * 
 *     def bnrchar(self, bnr, g, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all characters :math:`\chi` on :literal:`bnr.clgp` such that
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4221
 *         return new_gen(_ret)
 * 
 *     def bnrclassno(self, A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`A`, :math:`B`, :math:`C` define a class field :math:`L` over a ground field :math:`K`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_275bnrclassno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_274bnrclassno[] = "\n        Let :math:`A`, :math:`B`, :math:`C` define a class field :math:`L` over a ground field :math:`K`\n        (of type :literal:`[:emphasis:`bnr`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`subgroup`]`,\n        or :literal:`[:emphasis:`bnf`, :emphasis:`modulus`]`,\n        or :literal:`[:emphasis:`bnf`, :emphasis:`modulus`,:emphasis:`subgroup`]`,\n        ``CFT`` (in the PARI manual)); this function returns the relative degree :math:`[L:K]`.\n        \n        In particular if :math:`A` is a :emphasis:`bnf` (with units), and :math:`B` a modulus,\n        this function returns the corresponding ray class number modulo :math:`B`.\n        One can input the attached :emphasis:`bid` (with generators if the subgroup\n        :math:`C` is non trivial) for :math:`B` instead of the module itself, saving some time.\n        \n        This function is faster than :literal:`bnrinit` and should be used if only the\n        ray class number is desired. See :literal:`bnrclassnolist` if you need ray class\n        numbers for all moduli less than some bound.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_275bnrclassno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrclassno (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrclassno") < 0)) __PYX_ERR(4, 4221, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    __pyx_v_B = values[1];
    __pyx_v_C = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrclassno", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4221, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_274bnrclassno(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_C);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_274bnrclassno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrclassno", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_instance.pxi":4239
 *         numbers for all moduli less than some bound.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4240
 *         '''
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4241
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4242
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4241
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_instance.pxi":4243
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_2 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4244
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4245
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4244
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4246
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4246, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4247
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4248
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_instance.pxi":4249
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4250
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4249
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_instance.pxi":4251
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_instance.pxi":4252
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4253
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4252
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 */
  }

  /* "cypari/auto_instance.pxi":4254
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrclassno0(__pyx_v__A, __pyx_v__B, __pyx_v__C);

  /* "cypari/auto_instance.pxi":4255
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrclassnolist(self, bnf, list):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4221
 *         return new_gen(_ret)
 * 
 *     def bnrclassno(self, A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`A`, :math:`B`, :math:`C` define a class field :math:`L` over a ground field :math:`K`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4257
 *         return new_gen(_ret)
 * 
 *     def bnrclassnolist(self, bnf, list):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_277bnrclassnolist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_276bnrclassnolist[] = "\n        :math:`bnf` being as\n        output by :literal:`bnfinit`, and :emphasis:`list` being a list of moduli (with units) as\n        output by :literal:`ideallist` or :literal:`ideallistarch`, outputs the list of the\n        class numbers of the corresponding ray class groups. To compute a single\n        class number, :literal:`bnrclassno` is more efficient.\n        \n        ::\n        \n            ? bnf = bnfinit(x^2 - 2);\n            ? L = ideallist(bnf, 100, 2);\n            ? H = bnrclassnolist(bnf, L);\n            ? H[98]\n            %4 = [1, 3, 1]\n            ? l = L[1][98]; ids = vector(#l, i, l[i].mod[1])\n            %5 = [[98, 88; 0, 1], [14, 0; 0, 7], [98, 10; 0, 1]]\n        \n        The weird :literal:`l[i].mod[1]`, is the first component of :literal:`l[i].mod`, i.e.\n        the finite part of the conductor. (This is cosmetic: since by construction\n        the Archimedean part is trivial, I do not want to see it). This tells us that\n        the ray class groups modulo the ideals of norm 98 (printed as :literal:`\\%5`) have\n        respectively order :math:`1`, :math:`3` and :math:`1`. Indeed, we may check directly:\n        \n        ::\n        \n            ? bnrclassno(bnf, ids[2])\n            %6 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_277bnrclassnolist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_list = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrclassnolist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_list,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_bnf)) != 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_list)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrclassnolist", 1, 2, 2, 1); __PYX_ERR(4, 4257, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrclassnolist") < 0)) __PYX_ERR(4, 4257, __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_bnf = values[0];
    __pyx_v_list = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrclassnolist", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4257, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrclassnolist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_276bnrclassnolist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_list);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_276bnrclassnolist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_list) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__list;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrclassnolist", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_list);

  /* "cypari/auto_instance.pxi":4286
 *             %6 = 3
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         list = objtogen(list)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4287
 *         '''
 *         bnf = objtogen(bnf)
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4288
 *         bnf = objtogen(bnf)
 *         list = objtogen(list)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4288, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4289
 *         list = objtogen(list)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4290
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4291
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrclassnolist(__pyx_v__bnf, __pyx_v__list);

  /* "cypari/auto_instance.pxi":4292
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrconductor(self, A, B=None, C=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4257
 *         return new_gen(_ret)
 * 
 *     def bnrclassnolist(self, bnf, list):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrclassnolist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4294
 *         return new_gen(_ret)
 * 
 *     def bnrconductor(self, A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conductor :math:`f` of the subfield of a ray class field as defined by :math:`[A,B,C]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_279bnrconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_278bnrconductor[] = "\n        Conductor :math:`f` of the subfield of a ray class field as defined by :math:`[A,B,C]`\n        (of type :literal:`[:emphasis:`bnr`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`subgroup`]`,\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`]` or\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`, :emphasis:`subgroup`]`,\n        ``CFT`` (in the PARI manual))\n        \n        If :math:`flag = 0`, returns :math:`f`.\n        \n        If :math:`flag = 1`, returns :math:`[f, Cl_f, H]`, where :math:`Cl_f` is the ray class group\n        modulo :math:`f`, as a finite abelian group; finally :math:`H` is the subgroup of :math:`Cl_f`\n        defining the extension.\n        \n        If :math:`flag = 2`, returns :math:`[f, bnr (f), H]`, as above except :math:`Cl_f` is\n        replaced by a :literal:`bnr` structure, as output by :math:`bnrinit (,f)`, without\n        generators unless the input contained a :emphasis:`bnr` with generators.\n        \n        In place of a subgroup :math:`H`, this function also accepts a character\n        :literal:`chi` :math:`= (a_j)`, expressed as usual in terms of the generators\n        :literal:`bnr.gen`: :math:`\\chi (g_j) = \\exp (2i\\pi a_j / d_j)`, where :math:`g_j` has\n        order :math:`d_j = bnr.cyc[j]`. In which case, the function returns\n        respectively\n        \n        If :math:`flag = 0`, the conductor :math:`f` of :math:`Ker \\chi`.\n        \n        If :math:`flag = 1`, :math:`[f, Cl_f, \\chi_f]`, where :math:`\\chi_f` is :math:`\\chi` expressed\n        on the minimal ray class group, whose modulus is the conductor.\n        \n        If :math:`flag = 2`, :math:`[f, bnr (f), \\chi_f]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_279bnrconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_flag,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          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_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrconductor") < 0)) __PYX_ERR(4, 4294, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    __pyx_v_B = values[1];
    __pyx_v_C = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4294, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrconductor", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4294, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_278bnrconductor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_278bnrconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrconductor", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_instance.pxi":4326
 *         If :math:`flag = 2`, :math:`[f, bnr (f), \chi_f]`.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4327
 *         '''
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4328
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4329
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4328
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_instance.pxi":4330
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_2 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4331
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4332
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4332, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4331
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4333
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4333, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4334
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4335
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_instance.pxi":4336
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4337
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4336
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_instance.pxi":4338
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_instance.pxi":4339
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4340
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4339
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 */
  }

  /* "cypari/auto_instance.pxi":4341
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrconductor0(__pyx_v__A, __pyx_v__B, __pyx_v__C, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":4342
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrconductorofchar(self, bnr, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4294
 *         return new_gen(_ret)
 * 
 *     def bnrconductor(self, A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conductor :math:`f` of the subfield of a ray class field as defined by :math:`[A,B,C]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4344
 *         return new_gen(_ret)
 * 
 *     def bnrconductorofchar(self, bnr, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :emphasis:`bnrconductor`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_281bnrconductorofchar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_280bnrconductorofchar[] = "\n        This function is obsolete, use :emphasis:`bnrconductor`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_281bnrconductorofchar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrconductorofchar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_chi,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_bnr)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrconductorofchar", 1, 2, 2, 1); __PYX_ERR(4, 4344, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrconductorofchar") < 0)) __PYX_ERR(4, 4344, __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_bnr = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrconductorofchar", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4344, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrconductorofchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_280bnrconductorofchar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_chi);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_280bnrconductorofchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_chi) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__bnr;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrconductorofchar", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":4348
 *         This function is obsolete, use :emphasis:`bnrconductor`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)
 *         bnr = objtogen(bnr)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 4348, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":4349
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         bnr = objtogen(bnr)
 *         chi = objtogen(chi)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 4349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":4350
 *         from warnings import warn
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 4350, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":4351
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)
 *         bnr = objtogen(bnr)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 4351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":4352
 *         bnr = objtogen(bnr)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4352, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4353
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4354
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4355
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrconductorofchar(__pyx_v__bnr, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":4356
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrdisc(self, A, B=None, C=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 4356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4344
 *         return new_gen(_ret)
 * 
 *     def bnrconductorofchar(self, bnr, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :emphasis:`bnrconductor`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrconductorofchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4358
 *         return new_gen(_ret)
 * 
 *     def bnrdisc(self, A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A`, :math:`B`, :math:`C` defining a class field :math:`L` over a ground field :math:`K`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_283bnrdisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_282bnrdisc[] = "\n        :math:`A`, :math:`B`, :math:`C` defining a class field :math:`L` over a ground field :math:`K`\n        (of type :literal:`[:emphasis:`bnr`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`subgroup`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`character`]`,\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`]` or\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`, :emphasis:`subgroup`]`,\n        ``CFT`` (in the PARI manual)), outputs data :math:`[N,r_1,D]` giving the discriminant and\n        signature of :math:`L`, depending on the binary digits of :emphasis:`flag`:\n        \n        - 1: if this bit is unset, output absolute data related to :math:`L/\\mathbb{Q}`:\n          :math:`N` is the absolute degree :math:`[L:\\mathbb{Q}]`, :math:`r_1` the number of real places of :math:`L`,\n          and :math:`D` the discriminant of :math:`L/\\mathbb{Q}`. Otherwise, output relative data for :math:`L/K`:\n          :math:`N` is the relative degree :math:`[L:K]`, :math:`r_1` is the number of real places of :math:`K`\n          unramified in :math:`L` (so that the number of real places of :math:`L` is equal to :math:`r_1`\n          times :math:`N`), and :math:`D` is the relative discriminant ideal of :math:`L/K`.\n        \n        - 2: if this bit is set and if the modulus is not the conductor of :math:`L`,\n          only return 0.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_283bnrdisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrdisc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_flag,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          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_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrdisc") < 0)) __PYX_ERR(4, 4358, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    __pyx_v_B = values[1];
    __pyx_v_C = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4358, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrdisc", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4358, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_282bnrdisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_282bnrdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrdisc", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_instance.pxi":4379
 *           only return 0.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4380
 *         '''
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4381
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4382
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4381
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_instance.pxi":4383
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_2 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4384
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4385
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4385, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4384
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4386
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4386, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4387
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4388
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_instance.pxi":4389
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4390
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4389
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_instance.pxi":4391
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_instance.pxi":4392
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4393
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4392
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 */
  }

  /* "cypari/auto_instance.pxi":4394
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrdisc0(__pyx_v__A, __pyx_v__B, __pyx_v__C, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":4395
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrdisclist(self, bnf, bound, arch=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4358
 *         return new_gen(_ret)
 * 
 *     def bnrdisc(self, A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A`, :math:`B`, :math:`C` defining a class field :math:`L` over a ground field :math:`K`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4397
 *         return new_gen(_ret)
 * 
 *     def bnrdisclist(self, bnf, bound, arch=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by :literal:`bnfinit` (with units), computes a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_285bnrdisclist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_284bnrdisclist[] = "\n        :math:`bnf` being as output by :literal:`bnfinit` (with units), computes a\n        list of discriminants of Abelian extensions of the number field by increasing\n        modulus norm up to bound :emphasis:`bound`. The ramified Archimedean places are\n        given by :emphasis:`arch`; all possible values are taken if :emphasis:`arch` is omitted.\n        \n        The alternative syntax :math:`bnrdisclist (bnf,list)` is\n        supported, where :emphasis:`list` is as output by :literal:`ideallist` or\n        :literal:`ideallistarch` (with units), in which case :emphasis:`arch` is disregarded.\n        \n        The output :math:`v` is a vector, where :math:`v[k]` is itself a vector :math:`w`, whose length\n        is the number of ideals of norm :math:`k`.\n        \n        - We consider first the case where :emphasis:`arch` was specified. Each\n          component of :math:`w` corresponds to an ideal :math:`m` of norm :math:`k`, and\n          gives invariants attached to the ray class field :math:`L` of :math:`bnf` of\n          conductor :math:`[m, arch]`. Namely, each contains a vector :math:`[m,d,r,D]` with\n          the following meaning: :math:`m` is the prime ideal factorization of the modulus,\n          :math:`d = [L:\\mathbb{Q}]` is the absolute degree of :math:`L`, :math:`r` is the number of real places\n          of :math:`L`, and :math:`D` is the factorization of its absolute discriminant. We set :math:`d\n          = r = D = 0` if :math:`m` is not the finite part of a conductor.\n        \n        - If :emphasis:`arch` was omitted, all :math:`t = 2^{r_1}` possible values are taken\n          and a component of :math:`w` has the form\n          :math:`[m, [[d_1,r_1,D_1],..., [d_t,r_t,D_t]]]`,\n          where :math:`m` is the finite part of the conductor as above, and\n          :math:`[d_i,r_i,D_i]` are the invariants of the ray class field of conductor\n          :math:`[m,v_i]`, where :math:`v_i` is the :math:`i`-th Archimedean compon""ent, ordered by\n          inverse lexicographic order; so :math:`v_1 = [0,...,0]`, :math:`v_2 = [1,0...,0]`,\n          etc. Again, we set :math:`d_i = r_i = D_i = 0` if :math:`[m,v_i]` is not a conductor.\n        \n        Finally, each prime ideal :math:`pr = [p,\\alpha,e,f,\\beta]` in the prime\n        factorization :math:`m` is coded as the integer :math:`p.n^2+(f-1).n+(j-1)`,\n        where :math:`n` is the degree of the base field and :math:`j` is such that\n        \n        :literal:`pr = idealprimedec(:emphasis:`nf`,p)[j]`.\n        \n        :math:`m` can be decoded using :literal:`bnfdecodemodule`.\n        \n        Note that to compute such data for a single field, either :literal:`bnrclassno`\n        or :literal:`bnrdisc` are (much) more efficient.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_285bnrdisclist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_bound = 0;
  PyObject *__pyx_v_arch = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrdisclist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_bound,&__pyx_n_s_arch,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_bnf)) != 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_bound)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrdisclist", 0, 2, 3, 1); __PYX_ERR(4, 4397, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arch);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrdisclist") < 0)) __PYX_ERR(4, 4397, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_bnf = values[0];
    __pyx_v_bound = values[1];
    __pyx_v_arch = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrdisclist", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4397, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrdisclist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_284bnrdisclist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_bound, __pyx_v_arch);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_284bnrdisclist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_bound, PyObject *__pyx_v_arch) {
  int __pyx_v__have_arch;
  GEN __pyx_v__bnf;
  GEN __pyx_v__bound;
  GEN __pyx_v__arch;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrdisclist", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_bound);
  __Pyx_INCREF(__pyx_v_arch);

  /* "cypari/auto_instance.pxi":4440
 *         or :literal:`bnrdisc` are (much) more efficient.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         bound = objtogen(bound)
 *         cdef bint _have_arch = (arch is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4441
 *         '''
 *         bnf = objtogen(bnf)
 *         bound = objtogen(bound)             # <<<<<<<<<<<<<<
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bound, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bound, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4442
 *         bnf = objtogen(bnf)
 *         bound = objtogen(bound)
 *         cdef bint _have_arch = (arch is not None)             # <<<<<<<<<<<<<<
 *         if _have_arch:
 *             arch = objtogen(arch)
 */
  __pyx_t_2 = (__pyx_v_arch != Py_None);
  __pyx_v__have_arch = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4443
 *         bound = objtogen(bound)
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             arch = objtogen(arch)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_arch != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4444
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:
 *             arch = objtogen(arch)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_arch, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_arch, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4443
 *         bound = objtogen(bound)
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             arch = objtogen(arch)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4445
 *         if _have_arch:
 *             arch = objtogen(arch)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _bound = (<Gen>bound).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4445, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4446
 *             arch = objtogen(arch)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4447
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _bound = (<Gen>bound).g             # <<<<<<<<<<<<<<
 *         cdef GEN _arch = NULL
 *         if _have_arch:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bound)->__pyx_base.g;
  __pyx_v__bound = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4448
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL             # <<<<<<<<<<<<<<
 *         if _have_arch:
 *             _arch = (<Gen>arch).g
 */
  __pyx_v__arch = NULL;

  /* "cypari/auto_instance.pxi":4449
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 */
  __pyx_t_2 = (__pyx_v__have_arch != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4450
 *         cdef GEN _arch = NULL
 *         if _have_arch:
 *             _arch = (<Gen>arch).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_arch)->__pyx_base.g;
    __pyx_v__arch = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4449
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 */
  }

  /* "cypari/auto_instance.pxi":4451
 *         if _have_arch:
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrdisclist0(__pyx_v__bnf, __pyx_v__bound, __pyx_v__arch);

  /* "cypari/auto_instance.pxi":4452
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrgaloisapply(self, bnr, mat, H):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4397
 *         return new_gen(_ret)
 * 
 *     def bnrdisclist(self, bnf, bound, arch=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by :literal:`bnfinit` (with units), computes a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrdisclist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_bound);
  __Pyx_XDECREF(__pyx_v_arch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4454
 *         return new_gen(_ret)
 * 
 *     def bnrgaloisapply(self, bnr, mat, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the automorphism given by its matrix :emphasis:`mat` to the congruence
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_287bnrgaloisapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_286bnrgaloisapply[] = "\n        Apply the automorphism given by its matrix :emphasis:`mat` to the congruence\n        subgroup :math:`H` given as a HNF matrix.\n        The matrix :emphasis:`mat` can be computed with :literal:`bnrgaloismatrix`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_287bnrgaloisapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrgaloisapply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_mat,&__pyx_n_s_H,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnr)) != 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_mat)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrgaloisapply", 1, 3, 3, 1); __PYX_ERR(4, 4454, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrgaloisapply", 1, 3, 3, 2); __PYX_ERR(4, 4454, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrgaloisapply") < 0)) __PYX_ERR(4, 4454, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_bnr = values[0];
    __pyx_v_mat = values[1];
    __pyx_v_H = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrgaloisapply", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4454, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_286bnrgaloisapply(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_mat, __pyx_v_H);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_286bnrgaloisapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_mat, PyObject *__pyx_v_H) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__mat;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrgaloisapply", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_mat);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":4460
 *         The matrix :emphasis:`mat` can be computed with :literal:`bnrgaloismatrix`.
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         mat = objtogen(mat)
 *         H = objtogen(H)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4461
 *         '''
 *         bnr = objtogen(bnr)
 *         mat = objtogen(mat)             # <<<<<<<<<<<<<<
 *         H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mat, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mat, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4462
 *         bnr = objtogen(bnr)
 *         mat = objtogen(mat)
 *         H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4462, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4463
 *         mat = objtogen(mat)
 *         H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _mat = (<Gen>mat).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4463, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4464
 *         H = objtogen(H)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _mat = (<Gen>mat).g
 *         cdef GEN _H = (<Gen>H).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4465
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _mat = (<Gen>mat).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mat)->__pyx_base.g;
  __pyx_v__mat = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4466
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _mat = (<Gen>mat).g
 *         cdef GEN _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
  __pyx_v__H = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4467
 *         cdef GEN _mat = (<Gen>mat).g
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrgaloisapply(__pyx_v__bnr, __pyx_v__mat, __pyx_v__H);

  /* "cypari/auto_instance.pxi":4468
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrgaloismatrix(self, bnr, aut):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4454
 *         return new_gen(_ret)
 * 
 *     def bnrgaloisapply(self, bnr, mat, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the automorphism given by its matrix :emphasis:`mat` to the congruence
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_mat);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4470
 *         return new_gen(_ret)
 * 
 *     def bnrgaloismatrix(self, bnr, aut):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the matrix of the action of the automorphism :emphasis:`aut` of the base
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_289bnrgaloismatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_288bnrgaloismatrix[] = "\n        Return the matrix of the action of the automorphism :emphasis:`aut` of the base\n        field :literal:`bnf.nf` on the generators of the ray class field :literal:`bnr.gen`.\n        :emphasis:`aut` can be given as a polynomial, an algebraic number, or a vector of\n        automorphisms or a Galois group as output by :literal:`galoisinit`, in which case a\n        vector of matrices is returned (in the later case, only for the generators\n        :literal:`aut.gen`).\n        \n        See :literal:`bnrisgalois` for an example.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_289bnrgaloismatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_aut = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrgaloismatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_aut,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_bnr)) != 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_aut)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrgaloismatrix", 1, 2, 2, 1); __PYX_ERR(4, 4470, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrgaloismatrix") < 0)) __PYX_ERR(4, 4470, __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_bnr = values[0];
    __pyx_v_aut = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrgaloismatrix", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4470, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrgaloismatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_288bnrgaloismatrix(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_aut);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_288bnrgaloismatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_aut) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__aut;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrgaloismatrix", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_aut);

  /* "cypari/auto_instance.pxi":4481
 *         See :literal:`bnrisgalois` for an example.
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         aut = objtogen(aut)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4482
 *         '''
 *         bnr = objtogen(bnr)
 *         aut = objtogen(aut)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_aut, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_aut, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4483
 *         bnr = objtogen(bnr)
 *         aut = objtogen(aut)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _aut = (<Gen>aut).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4483, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4484
 *         aut = objtogen(aut)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4485
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _aut = (<Gen>aut).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_aut)->__pyx_base.g;
  __pyx_v__aut = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4486
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrgaloismatrix(__pyx_v__bnr, __pyx_v__aut);

  /* "cypari/auto_instance.pxi":4487
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrinit(self, bnf, f, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4470
 *         return new_gen(_ret)
 * 
 *     def bnrgaloismatrix(self, bnr, aut):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the matrix of the action of the automorphism :emphasis:`aut` of the base
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrgaloismatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_aut);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4489
 *         return new_gen(_ret)
 * 
 *     def bnrinit(self, bnf, f, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` is as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_291bnrinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_290bnrinit[] = "\n        :math:`bnf` is as\n        output by :literal:`bnfinit` (including fundamental units), :math:`f` is a modulus,\n        initializes data linked to the ray class group structure corresponding to\n        this module, a so-called :literal:`bnr` structure. One can input the attached\n        :emphasis:`bid` with generators for :math:`f` instead of the module itself, saving some\n        time. (As in :literal:`idealstar`, the finite part of the conductor may be given\n        by a factorization into prime ideals, as produced by :literal:`idealfactor`.)\n        \n        The following member functions are available\n        on the result: :literal:`.bnf` is the underlying :emphasis:`bnf`,\n        :literal:`.mod` the modulus, :literal:`.bid` the :literal:`bid` structure attached to the\n        modulus; finally, :literal:`.clgp`, :literal:`.no`, :literal:`.cyc`, :literal:`.gen` refer to the\n        ray class group (as a finite abelian group), its cardinality, its elementary\n        divisors, its generators (only computed if :math:`flag = 1`).\n        \n        The last group of functions are different from the members of the underlying\n        :emphasis:`bnf`, which refer to the class group; use :literal:`:emphasis:`bnr`.bnf.:emphasis:`xxx``\n        to access these, e.g.\302\240:literal:`:emphasis:`bnr`.bnf.cyc` to get the cyclic decomposition\n        of the class group.\n        \n        They are also different from the members of the underlying :emphasis:`bid`, which\n        refer to :math:`(\\mathbb{Z}_K/f)^*`; use :literal:`:emphasis:`bnr`.bid.:emphasis:`xxx`` to access these,\n        e.g.\302\240:literal:`:emphasis:`bnr`.bid.no` to get :math:`\\phi (f)`.\n        \n        If :math:`flag = 0` (default), the generators of the ray class group are not computed,\n        which saves time. Hence :literal:`:emphasis:`bnr`.gen` would produce an error.\n        \n        If :math:`flag = 1`, as the default, except that generators are computed.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_291bnrinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_f = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_f,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnf)) != 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_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrinit", 0, 2, 3, 1); __PYX_ERR(4, 4489, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrinit") < 0)) __PYX_ERR(4, 4489, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_bnf = values[0];
    __pyx_v_f = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4489, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrinit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4489, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_290bnrinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_f, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_290bnrinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_f, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrinit", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":4520
 *         If :math:`flag = 1`, as the default, except that generators are computed.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         f = objtogen(f)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4521
 *         '''
 *         bnf = objtogen(bnf)
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4522
 *         bnf = objtogen(bnf)
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4522, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4523
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4524
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4525
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrinit0(__pyx_v__bnf, __pyx_v__f, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":4526
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrisconductor(self, A, B=None, C=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4489
 *         return new_gen(_ret)
 * 
 *     def bnrinit(self, bnf, f, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` is as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4528
 *         return new_gen(_ret)
 * 
 *     def bnrisconductor(self, A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fast variant of :literal:`bnrconductor`:math:`(A,B,C)`; :math:`A`, :math:`B`, :math:`C` represent
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_293bnrisconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_292bnrisconductor[] = "\n        Fast variant of :literal:`bnrconductor`:math:`(A,B,C)`; :math:`A`, :math:`B`, :math:`C` represent\n        an extension of the base field, given by class field theory\n        (see\302\240``CFT`` (in the PARI manual)). Outputs 1 if this modulus is the conductor, and 0\n        otherwise. This is slightly faster than :literal:`bnrconductor` when the\n        character or subgroup is not primitive.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_293bnrisconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrisconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrisconductor") < 0)) __PYX_ERR(4, 4528, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    __pyx_v_B = values[1];
    __pyx_v_C = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrisconductor", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4528, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrisconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_292bnrisconductor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_C);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_292bnrisconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrisconductor", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_instance.pxi":4536
 *         character or subgroup is not primitive.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4537
 *         '''
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4538
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4539
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4538
 *         A = objtogen(A)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_instance.pxi":4540
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_2 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4541
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4542
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4541
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4543
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4543, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4544
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4545
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_instance.pxi":4546
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4547
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4546
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_instance.pxi":4548
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_instance.pxi":4549
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 */
  __pyx_t_2 = (__pyx_v__have_C != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4550
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4549
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 */
  }

  /* "cypari/auto_instance.pxi":4551
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bnrisconductor0(__pyx_v__A, __pyx_v__B, __pyx_v__C);

  /* "cypari/auto_instance.pxi":4552
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":4553
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def bnrisgalois(self, bnr, gal, H):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4528
 *         return new_gen(_ret)
 * 
 *     def bnrisconductor(self, A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fast variant of :literal:`bnrconductor`:math:`(A,B,C)`; :math:`A`, :math:`B`, :math:`C` represent
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrisconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4555
 *         return _ret
 * 
 *     def bnrisgalois(self, bnr, gal, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Check whether the class field attached to the subgroup :math:`H` is Galois
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_295bnrisgalois(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_294bnrisgalois[] = "\n        Check whether the class field attached to the subgroup :math:`H` is Galois\n        over the subfield of :literal:`bnr.nf` fixed by the group :emphasis:`gal`, which can be\n        given as output by :literal:`galoisinit`, or as a matrix or a vector of matrices as\n        output by :literal:`bnrgaloismatrix`, the second option being preferable, since it\n        saves the recomputation of the matrices. Note: The function assumes that the\n        ray class field attached to bnr is Galois, which is not checked.\n        \n        In the following example, we lists the congruence subgroups of subextension of\n        degree at most :math:`3` of the ray class field of conductor :math:`9` which are Galois\n        over the rationals.\n        \n        ::\n        \n            K=bnfinit(a^4-3*a^2+253009);\n            G=galoisinit(K);\n            B=bnrinit(K,9,1);\n            L1=[H|H<-subgrouplist(B,3), bnrisgalois(B,G,H)]\n            ##\n            M=bnrgaloismatrix(B,G)\n            L2=[H|H<-subgrouplist(B,3), bnrisgalois(B,M,H)]\n            ##\n        \n        The second computation is much faster since :literal:`bnrgaloismatrix(B,G)` is\n        computed only once.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_295bnrisgalois(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrisgalois (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_gal,&__pyx_n_s_H,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnr)) != 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_gal)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrisgalois", 1, 3, 3, 1); __PYX_ERR(4, 4555, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrisgalois", 1, 3, 3, 2); __PYX_ERR(4, 4555, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrisgalois") < 0)) __PYX_ERR(4, 4555, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_bnr = values[0];
    __pyx_v_gal = values[1];
    __pyx_v_H = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrisgalois", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrisgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_294bnrisgalois(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_gal, __pyx_v_H);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_294bnrisgalois(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_gal, PyObject *__pyx_v_H) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__gal;
  GEN __pyx_v__H;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrisgalois", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":4582
 *         computed only once.
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         gal = objtogen(gal)
 *         H = objtogen(H)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4583
 *         '''
 *         bnr = objtogen(bnr)
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4584
 *         bnr = objtogen(bnr)
 *         gal = objtogen(gal)
 *         H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4585
 *         gal = objtogen(gal)
 *         H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4585, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4586
 *         H = objtogen(H)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _H = (<Gen>H).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4587
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = (<Gen>H).g
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4588
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
  __pyx_v__H = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4589
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _H = (<Gen>H).g
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bnrisgalois(__pyx_v__bnr, __pyx_v__gal, __pyx_v__H);

  /* "cypari/auto_instance.pxi":4590
 *         cdef GEN _H = (<Gen>H).g
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":4591
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def bnrisprincipal(self, bnr, x, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4555
 *         return _ret
 * 
 *     def bnrisgalois(self, bnr, gal, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Check whether the class field attached to the subgroup :math:`H` is Galois
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrisgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4593
 *         return _ret
 * 
 *     def bnrisprincipal(self, bnr, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the ray class group data output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_297bnrisprincipal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_296bnrisprincipal[] = "\n        Let :emphasis:`bnr` be the ray class group data output by\n        :literal:`bnrinit`:math:`(,,1)` and let :math:`x` be an ideal in any form, coprime\n        to the modulus :math:`f = bnr.mod`. Solves the discrete logarithm problem\n        in the ray class group, with respect to the generators :literal:`bnr.gen`,\n        in a way similar to :literal:`bnfisprincipal`. If :math:`x` is not coprime to the\n        modulus of :emphasis:`bnr` the result is undefined.\n        \n        If :math:`flag = 1`, returns a 2-component vector :math:`v` where :math:`v[1]` is the\n        vector of components of :math:`x` on the ray class group generators, :math:`v[2]` is\n        an element :math:`\\alpha` congruent to :math:`1\302\240mod^* f` such that\n        :math:`x = \\alpha \\prod_i g_i^{x_i}`.\n        \n        If :math:`flag = 0`, outputs only :math:`v_1`. In that case, :emphasis:`bnr` need not contain the\n        ray class group generators, i.e.\302\240it may be created with\n        :literal:`bnrinit`:math:`(,,0)`; in that case, although :literal:`bnr.gen` is undefined, we\n        can still define canonical generators attached to the :literal:`bnr` and compute\n        with respect to them.\n        \n        ::\n        \n            ? K = bnfinit(x^2 - 30); bnr = bnrinit(K, [4, [1,1]]);\n            ? bnr.clgp \\\\ ray class group is isomorphic to Z/4 x Z/2 x Z/2\n            %2 = [16, [4, 2, 2]]\n            ? P = idealprimedec(K, 3)[1]; \\\\ a prime ideal above 3\n            ? bnrisprincipal(bnr,P)\n            %4 = [[1, 0, 0]~, 1]\n            ? bnrisprincipal(bnr,P, 0) \\\\ omit the principal part\n            %4 = [1, 0, 0]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_297bnrisprincipal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrisprincipal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnr)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrisprincipal", 0, 2, 3, 1); __PYX_ERR(4, 4593, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrisprincipal") < 0)) __PYX_ERR(4, 4593, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_bnr = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4593, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrisprincipal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4593, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_296bnrisprincipal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_296bnrisprincipal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrisprincipal", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":4624
 *             %4 = [1, 0, 0]~
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4625
 *         '''
 *         bnr = objtogen(bnr)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4626
 *         bnr = objtogen(bnr)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4626, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4627
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4628
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4629
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrisprincipal(__pyx_v__bnr, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":4630
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrrootnumber(self, bnr, chi, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4593
 *         return _ret
 * 
 *     def bnrisprincipal(self, bnr, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the ray class group data output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4632
 *         return new_gen(_ret)
 * 
 *     def bnrrootnumber(self, bnr, chi, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`\chi = chi` is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_299bnrrootnumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_298bnrrootnumber[] = "\n        If :math:`\\chi = chi` is a\n        character over :emphasis:`bnr`, not necessarily primitive, let\n        :math:`L(s,\\chi) = \\sum_{id} \\chi (id) N(id)^{-s}` be the attached\n        Artin L-function. Returns the so-called Artin root number, i.e.\302\240the\n        complex number :math:`W(\\chi)` of modulus 1 such that\n        \n        .. MATH::\n        \n            \\Lambda (1-s,\\chi) = W(\\chi) \\Lambda (s,\\overline{\\chi})\n        \n        where :math:`\\Lambda (s,\\chi) = A(\\chi)^{s/2}\\gamma_\\chi (s) L(s,\\chi)` is\n        the enlarged L-function attached to :math:`L`.\n        \n        You can set :math:`flag = 1` if the character is known to be primitive. Example:\n        \n        ::\n        \n            bnf = bnfinit(x^2 - x - 57);\n            bnr = bnrinit(bnf, [7,[1,1]]);\n            bnrrootnumber(bnr, [2,1])\n        \n        returns the root number of the character :math:`\\chi` of\n        :math:`\\mathrm{Cl}_{7 oo _1 oo _2}(\\mathbb{Q} (\\sqrt{229}))` defined by :math:`\\chi (g_1^ag_2^b)\n        = \\zeta_1^{2a}\\zeta_2^b`. Here :math:`g_1, g_2` are the generators of the\n        ray-class group given by :literal:`bnr.gen` and :math:`\\zeta_1 = e^{2i\\pi/N_1},\n        \\zeta_2 = e^{2i\\pi/N_2}` where :math:`N_1, N_2` are the orders of :math:`g_1` and\n        :math:`g_2` respectively (:math:`N_1 = 6` and :math:`N_2 = 3` as :literal:`bnr.cyc` readily tells us).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_299bnrrootnumber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrrootnumber (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_chi,&__pyx_n_s_flag,&__pyx_n_s_precision,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_bnr)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrrootnumber", 0, 2, 4, 1); __PYX_ERR(4, 4632, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrrootnumber") < 0)) __PYX_ERR(4, 4632, __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);
        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_bnr = values[0];
    __pyx_v_chi = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4632, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4632, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrrootnumber", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4632, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrrootnumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_298bnrrootnumber(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_chi, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_298bnrrootnumber(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_chi, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrrootnumber", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":4662
 *         :math:`g_2` respectively (:math:`N_1 = 6` and :math:`N_2 = 3` as :literal:`bnr.cyc` readily tells us).
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4663
 *         '''
 *         bnr = objtogen(bnr)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4664
 *         bnr = objtogen(bnr)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4664, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4665
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4666
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4667
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":4668
 *         cdef GEN _chi = (<Gen>chi).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrrootnumber(__pyx_v__bnr, __pyx_v__chi, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":4669
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrstark(self, bnr, subgroup=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4632
 *         return new_gen(_ret)
 * 
 *     def bnrrootnumber(self, bnr, chi, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`\chi = chi` is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrrootnumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4671
 *         return new_gen(_ret)
 * 
 *     def bnrstark(self, bnr, subgroup=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit`, finds a relative equation
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_301bnrstark(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_300bnrstark[] = "\n        :emphasis:`bnr` being as output by :literal:`bnrinit`, finds a relative equation\n        for the class field corresponding to the modulus in :emphasis:`bnr` and the given\n        congruence subgroup (as usual, omit :math:`subgroup` if you want the whole ray\n        class group).\n        \n        The main variable of :emphasis:`bnr` must not be :math:`x`, and the ground field and the\n        class field must be totally real. When the base field is :math:`\\mathbb{Q}`, the vastly\n        simpler :literal:`galoissubcyclo` is used instead. Here is an example:\n        \n        ::\n        \n            bnf = bnfinit(y^2 - 3);\n            bnr = bnrinit(bnf, 5);\n            bnrstark(bnr)\n        \n        returns the ray class field of :math:`\\mathbb{Q} (\\sqrt{3})` modulo :math:`5`. Usually, one wants\n        to apply to the result one of\n        \n        ::\n        \n            rnfpolredabs(bnf, pol, 16) \\\\ compute a reduced relative polynomial\n            rnfpolredabs(bnf, pol, 16 + 2) \\\\ compute a reduced absolute polynomial\n        \n        The routine uses Stark units and needs to find a suitable auxiliary\n        conductor, which may not exist when the class field is not cyclic over the\n        base. In this case :literal:`bnrstark` is allowed to return a vector of\n        polynomials defining :emphasis:`independent` relative extensions, whose compositum\n        is the requested class field. It was decided that it was more useful\n        to keep the extra information thus made available, hence the user has to take\n        the compositum herself.\n        \n        Even if it exists, the auxiliary conductor may be so large that later\n        computations become unfeasible. (And of course, Stark's conjecture may simply\n        be wrong.) In case of difficulties, try :literal:`rnfkummer`:\n        \n        ::\n        \n            ? bnr = bnrinit(bnfinit(y^8-12*y^6+36*y^4-36*y^2+9,1), 2);\n            ? bnrstark(bnr)\n      ""       *** at top-level: bnrstark(bnr)\n             *** ^-------------\n             *** bnrstark: need 3919350809720744 coefficients in initzeta.\n             *** Computation impossible.\n            ? lift( rnfkummer(bnr) )\n            time = 24 ms.\n            %2 = x^2 + (1/3*y^6 - 11/3*y^4 + 8*y^2 - 5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_301bnrstark(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_subgroup = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrstark (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_subgroup,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_bnr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subgroup);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrstark") < 0)) __PYX_ERR(4, 4671, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bnr = values[0];
    __pyx_v_subgroup = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 4671, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrstark", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4671, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrstark", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_300bnrstark(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_subgroup, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_300bnrstark(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_subgroup, long __pyx_v_precision) {
  int __pyx_v__have_subgroup;
  GEN __pyx_v__bnr;
  GEN __pyx_v__subgroup;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrstark", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_subgroup);

  /* "cypari/auto_instance.pxi":4720
 *             %2 = x^2 + (1/3*y^6 - 11/3*y^4 + 8*y^2 - 5)
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         cdef bint _have_subgroup = (subgroup is not None)
 *         if _have_subgroup:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4721
 *         '''
 *         bnr = objtogen(bnr)
 *         cdef bint _have_subgroup = (subgroup is not None)             # <<<<<<<<<<<<<<
 *         if _have_subgroup:
 *             subgroup = objtogen(subgroup)
 */
  __pyx_t_2 = (__pyx_v_subgroup != Py_None);
  __pyx_v__have_subgroup = __pyx_t_2;

  /* "cypari/auto_instance.pxi":4722
 *         bnr = objtogen(bnr)
 *         cdef bint _have_subgroup = (subgroup is not None)
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             subgroup = objtogen(subgroup)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_subgroup != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4723
 *         cdef bint _have_subgroup = (subgroup is not None)
 *         if _have_subgroup:
 *             subgroup = objtogen(subgroup)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_subgroup, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_subgroup, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":4722
 *         bnr = objtogen(bnr)
 *         cdef bint _have_subgroup = (subgroup is not None)
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             subgroup = objtogen(subgroup)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4724
 *         if _have_subgroup:
 *             subgroup = objtogen(subgroup)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 4724, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4725
 *             subgroup = objtogen(subgroup)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":4726
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL             # <<<<<<<<<<<<<<
 *         if _have_subgroup:
 *             _subgroup = (<Gen>subgroup).g
 */
  __pyx_v__subgroup = NULL;

  /* "cypari/auto_instance.pxi":4727
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_subgroup != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":4728
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:
 *             _subgroup = (<Gen>subgroup).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_subgroup)->__pyx_base.g;
    __pyx_v__subgroup = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4727
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":4729
 *         if _have_subgroup:
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":4730
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrstark(__pyx_v__bnr, __pyx_v__subgroup, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":4731
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def call(self, f, A):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4671
 *         return new_gen(_ret)
 * 
 *     def bnrstark(self, bnr, subgroup=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit`, finds a relative equation
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.bnrstark", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_subgroup);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4733
 *         return new_gen(_ret)
 * 
 *     def call(self, f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A = [a_1,..., a_n]` being a vector and :math:`f` being a function, returns the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_303call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_302call[] = "\n        :math:`A = [a_1,..., a_n]` being a vector and :math:`f` being a function, returns the\n        evaluation of :math:`f(a_1,...,a_n)`.\n        :math:`f` can also be the name of a built-in GP function.\n        If :math:`\\# A = 1`, :literal:`call` (:math:`f,A`) = :literal:`apply` (:math:`f,A`)[1].\n        If :math:`f` is variadic, the variadic arguments must grouped in a vector in\n        the last component of :math:`A`.\n        \n        This function is useful\n        \n        - when writing a variadic function, to call another one:\n        \n        ::\n        \n            fprintf(file,format,args[..]) = write(file,call(Strprintf,[format,args]))\n        \n        - when dealing with function arguments with unspecified arity\n        \n        The function below implements a global memoization interface:\n        \n        ::\n        \n            memo=Map();\n            memoize(f,A[..])=\n            {\n             my(res);\n             if(!mapisdefined(memo, [f,A], &res),\n             res = call(f,A);\n             mapput(memo,[f,A],res));\n             res;\n            }\n        \n        for example:\n        \n        ::\n        \n            ? memoize(factor,2^128+1)\n            %3 = [59649589127497217,1;5704689200685129054721,1]\n            ? ##\n             *** last result computed in 76 ms.\n            ? memoize(factor,2^128+1)\n            %4 = [59649589127497217,1;5704689200685129054721,1]\n            ? ##\n             *** last result computed in 0 ms.\n            ? memoize(ffinit,3,3)\n            %5 = Mod(1,3)*x^3+Mod(1,3)*x^2+Mod(1,3)*x+Mod(2,3)\n            ? fibo(n)=if(n==0,0,n==1,1,memoize(fibo,n-2)+memoize(fibo,n-1));\n            ? fibo(100)\n            %7 = 354224848179261915075\n        \n        - to call operators through their internal names without using\n          :literal:`alias`\n        \n        ::\n        \n            matnbelts(M) = call(\"_*_\",matsize(M))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_303call(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_A,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_f)) != 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_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("call", 1, 2, 2, 1); __PYX_ERR(4, 4733, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "call") < 0)) __PYX_ERR(4, 4733, __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_f = values[0];
    __pyx_v_A = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("call", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4733, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_302call(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_A);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_302call(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("call", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":4791
 *             matnbelts(M) = call("_*_",matsize(M))
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4792
 *         '''
 *         f = objtogen(f)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4793
 *         f = objtogen(f)
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4793, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4794
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = call0(_f, _A)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4795
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = call0(_f, _A)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4796
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = call0(_f, _A)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = call0(__pyx_v__f, __pyx_v__A);

  /* "cypari/auto_instance.pxi":4797
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = call0(_f, _A)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ceil(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4733
 *         return new_gen(_ret)
 * 
 *     def call(self, f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A = [a_1,..., a_n]` being a vector and :math:`f` being a function, returns the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4799
 *         return new_gen(_ret)
 * 
 *     def ceil(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ceiling of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_305ceil(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_304ceil[] = "\n        Ceiling of :math:`x`. When :math:`x` is in :math:`\\mathbb{R}`, the result is the\n        smallest integer greater than or equal to :math:`x`. Applied to a rational\n        function, :math:`ceil (x)` returns the Euclidean quotient of the numerator by\n        the denominator.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_305ceil(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ceil (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_304ceil(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_304ceil(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ceil", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":4806
 *         the denominator.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4807
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gceil(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4807, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4808
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gceil(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4809
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gceil(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gceil(__pyx_v__x);

  /* "cypari/auto_instance.pxi":4810
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gceil(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def centerlift(self, x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4799
 *         return new_gen(_ret)
 * 
 *     def ceil(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ceiling of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ceil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4812
 *         return new_gen(_ret)
 * 
 *     def centerlift(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`lift`, except that :literal:`t_INTMOD` and :literal:`t_PADIC` components
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_307centerlift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_306centerlift[] = "\n        Same as :literal:`lift`, except that :literal:`t_INTMOD` and :literal:`t_PADIC` components\n        are lifted using centered residues:\n        \n        - for a :literal:`t_INTMOD` :math:`x\\in \\mathbb{Z}/n\\mathbb{Z}`, the lift :math:`y` is such that\n          :math:`-n/2 < y <= n/2`.\n        \n        - a :literal:`t_PADIC` :math:`x` is lifted in the same way as above (modulo\n          :math:`p^padicprec(x)`) if its valuation :math:`v` is non-negative; if not, returns\n          the fraction :math:`p^v` :literal:`centerlift`:math:`(x p^{-v})`; in particular, rational\n          reconstruction is not attempted. Use :literal:`bestappr` for this.\n        \n        For backward compatibility, :literal:`centerlift(x,'v)` is allowed as an alias\n        for :literal:`lift(x,'v)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_307centerlift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("centerlift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "centerlift") < 0)) __PYX_ERR(4, 4812, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("centerlift", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4812, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.centerlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_306centerlift(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_306centerlift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("centerlift", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":4828
 *         for :literal:`lift(x,'v)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4829
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":4830
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":4831
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 4831, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":4830
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":4832
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = centerlift0(_x, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 4832, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4833
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = centerlift0(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":4834
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = centerlift0(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = centerlift0(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":4835
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = centerlift0(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def characteristic(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4812
 *         return new_gen(_ret)
 * 
 *     def centerlift(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`lift`, except that :literal:`t_INTMOD` and :literal:`t_PADIC` components
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.centerlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4837
 *         return new_gen(_ret)
 * 
 *     def characteristic(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the characteristic of the base ring over which :math:`x` is defined (as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_309characteristic(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_308characteristic[] = "\n        Returns the characteristic of the base ring over which :math:`x` is defined (as\n        defined by :literal:`t_INTMOD` and :literal:`t_FFELT` components). The function raises an\n        exception if incompatible primes arise from :literal:`t_FFELT` and :literal:`t_PADIC`\n        components.\n        \n        ::\n        \n            ? characteristic(Mod(1,24)*x + Mod(1,18)*y)\n            %1 = 6\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_309characteristic(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("characteristic (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_308characteristic(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_308characteristic(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("characteristic", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":4849
 *             %1 = 6
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4850
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = characteristic(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4850, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4851
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = characteristic(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4852
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = characteristic(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = characteristic(__pyx_v__x);

  /* "cypari/auto_instance.pxi":4853
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = characteristic(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charconj(self, cyc, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4837
 *         return new_gen(_ret)
 * 
 *     def characteristic(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the characteristic of the base ring over which :math:`x` is defined (as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.characteristic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4855
 *         return new_gen(_ret)
 * 
 *     def charconj(self, cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_311charconj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_310charconj[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`\\chi = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        This function returns the conjugate character.\n        \n        ::\n        \n            ? cyc = [15,5]; chi = [1,1];\n            ? charconj(cyc, chi)\n            %2 = [14, 4]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charconj(bnf, [1])\n            %5 = [2]\n        \n        For Dirichlet characters (when :literal:`cyc` is\n        :literal:`znstar(q,1)`), characters in Conrey representation are available,\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`:\n        \n        ::\n        \n            ? G = znstar(8, 1); \\\\ (Z/8Z)^*\n            ? charorder(G, 3) \\\\ Conrey label\n            %2 = 2\n            ? chi = znconreylog(G, 3);\n            ? charorder(G, chi) \\\\ Conrey logarithm\n            %4 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_311charconj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cyc = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charconj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cyc,&__pyx_n_s_chi,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_cyc)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charconj", 1, 2, 2, 1); __PYX_ERR(4, 4855, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charconj") < 0)) __PYX_ERR(4, 4855, __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_cyc = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charconj", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4855, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_310charconj(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cyc, __pyx_v_chi);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_310charconj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charconj", 0);
  __Pyx_INCREF(__pyx_v_cyc);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":4891
 *             %4 = 2
 *         '''
 *         cyc = objtogen(cyc)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cyc, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cyc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4892
 *         '''
 *         cyc = objtogen(cyc)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4893
 *         cyc = objtogen(cyc)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4893, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4894
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charconj0(_cyc, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4895
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charconj0(_cyc, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4896
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charconj0(_cyc, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charconj0(__pyx_v__cyc, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":4897
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charconj0(_cyc, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chardiv(self, cyc, a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4855
 *         return new_gen(_ret)
 * 
 *     def charconj(self, cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cyc);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4899
 *         return new_gen(_ret)
 * 
 *     def chardiv(self, cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_313chardiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_312chardiv[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`a = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        Given two characters :math:`a` and :math:`b`, return the character\n        :math:`a / b = a \\overline{b}`.\n        \n        ::\n        \n            ? cyc = [15,5]; a = [1,1]; b = [2,4];\n            ? chardiv(cyc, a,b)\n            %2 = [14, 2]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? chardiv(bnf, [1], [2])\n            %5 = [2]\n        \n        For Dirichlet characters on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, additional\n        representations are available (Conrey labels, Conrey logarithm),\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        If the two characters are in the same format, the\n        result is given in the same format, otherwise a Conrey logarithm is used.\n        \n        ::\n        \n            ? G = znstar(100, 1);\n            ? G.cyc\n            %2 = [20, 2]\n            ? a = [10, 1]; \\\\ usual representation for characters\n            ? b = 7; \\\\ Conrey label;\n            ? c = znconreylog(G, 11); \\\\ Conrey log\n            ? chardiv(G, b,b)\n            %6 = 1 \\\\ Conrey label\n            ? chardiv(G, a,b)\n            %7 = [0, 5]~ \\\\ Conrey log\n            ? chardiv(G, a,c)\n            %7 = [0, 14]~ \\\\ Conrey log\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_313chardiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cyc = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chardiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cyc,&__pyx_n_s_a,&__pyx_n_s_b,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyc)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chardiv", 1, 3, 3, 1); __PYX_ERR(4, 4899, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chardiv", 1, 3, 3, 2); __PYX_ERR(4, 4899, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chardiv") < 0)) __PYX_ERR(4, 4899, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_cyc = values[0];
    __pyx_v_a = values[1];
    __pyx_v_b = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chardiv", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4899, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chardiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_312chardiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cyc, __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_312chardiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("chardiv", 0);
  __Pyx_INCREF(__pyx_v_cyc);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":4944
 *             %7 = [0, 14]~ \\ Conrey log
 *         '''
 *         cyc = objtogen(cyc)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         b = objtogen(b)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cyc, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cyc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4945
 *         '''
 *         cyc = objtogen(cyc)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4946
 *         cyc = objtogen(cyc)
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":4947
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 4947, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":4948
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4949
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4950
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":4951
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chardiv0(__pyx_v__cyc, __pyx_v__a, __pyx_v__b);

  /* "cypari/auto_instance.pxi":4952
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chareval(self, G, chi, x, z=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4899
 *         return new_gen(_ret)
 * 
 *     def chardiv(self, cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chardiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cyc);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":4954
 *         return new_gen(_ret)
 * 
 *     def chareval(self, G, chi, x, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be an abelian group structure affording a discrete logarithm
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_315chareval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_314chareval[] = "\n        Let :math:`G` be an abelian group structure affording a discrete logarithm\n        method, e.g :math:`G = znstar (N, 1)` for :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` or a :literal:`bnr`\n        structure, let :math:`x` be an element of :math:`G` and let :emphasis:`chi` be a character of\n        :math:`G` (see the note below for details). This function returns the value of\n        :emphasis:`chi` at :math:`x`.\n        \n        :strong:`Note on characters.`\n        Let :math:`K` be some field. If :math:`G` is an abelian group,\n        let :math:`\\chi: G \\to K^*` be a character of finite order and let :math:`o` be a\n        multiple of the character order such that :math:`\\chi (n) = \\zeta^{c(n)}` for some\n        fixed :math:`\\zeta\\in K^*` of multiplicative order :math:`o` and a unique morphism :math:`c: G\n        \\to (\\mathbb{Z}/o\\mathbb{Z},+)`. Our usual convention is to write\n        \n        .. MATH::\n        \n            G = (\\mathbb{Z}/o_1\\mathbb{Z}) g_1 \\oplus...\\oplus (\\mathbb{Z}/o_d\\mathbb{Z}) g_d\n        \n        for some generators :math:`(g_i)` of respective order :math:`d_i`, where the group has\n        exponent :math:`o := lcm_i o_i`. Since :math:`\\zeta^o = 1`, the vector :math:`(c_i)` in\n        :math:`\\prod (\\mathbb{Z}/o_i\\mathbb{Z})` defines a character :math:`\\chi` on :math:`G` via :math:`\\chi (g_i) =\n        \\zeta^{c_i (o/o_i)}` for all :math:`i`. Classical Dirichlet characters have values\n        in :math:`K = \\mathbb{C}` and we can take :math:`\\zeta = \\exp (2i\\pi/o)`.\n        \n        :strong:`Note on Dirichlet characters.`\n        In the special case where :emphasis:`bid` is attached to :math:`G = (\\mathbb{Z}/q\\mathbb{Z})^*`\n        (as per :literal:`G = znstar(q,1)`), the Dirichlet\n        character :emphasis:`chi` can be written in one of the usual 3 formats: a :literal:`t_VEC`\n        in terms of :literal:`bid.gen` as above, a :literal:`t_COL` in terms of the Conrey\n        generator""s, or a :literal:`t_INT` (Conrey label);\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        The character value is encoded as follows, depending on the optional\n        argument :math:`z`:\n        \n        - If :math:`z` is omitted: return the rational number :math:`c(x)/o` for :math:`x` coprime\n          to :math:`q`, where we normalize :math:`0 <= c(x) < o`. If :math:`x` can not be mapped to the\n          group (e.g. :math:`x` is not coprime to the conductor of a Dirichlet or Hecke\n          character) we return the sentinel value :math:`-1`.\n        \n        - If :math:`z` is an integer :math:`o`, then we assume that :math:`o` is a multiple of the\n          character order and we return the integer :math:`c(x)` when :math:`x` belongs\n          to the group, and the sentinel value :math:`-1` otherwise.\n        \n        - :math:`z` can be of the form :math:`[zeta, o]`, where :emphasis:`zeta`\n          is an :math:`o`-th root of :math:`1` and :math:`o` is a multiple of the character order.\n          We return :math:`\\zeta^{c(x)}` if :math:`x` belongs to the group, and the sentinel\n          value :math:`0` otherwise. (Note that this coincides with the usual extension\n          of Dirichlet characters to :math:`\\mathbb{Z}`, or of Hecke characters to general ideals.)\n        \n        - Finally, :math:`z` can be of the form :math:`[vzeta, o]`, where\n          :emphasis:`vzeta` is a vector of powers :math:`\\zeta^0,..., \\zeta^{o-1}`\n          of some :math:`o`-th root of :math:`1` and :math:`o` is a multiple of the character order.\n          As above, we return :math:`\\zeta^{c(x)}` after a table lookup. Or the sentinel\n          value :math:`0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_315chareval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chareval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,&__pyx_n_s_x,&__pyx_n_s_z,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_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chareval", 0, 3, 4, 1); __PYX_ERR(4, 4954, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chareval", 0, 3, 4, 2); __PYX_ERR(4, 4954, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chareval") < 0)) __PYX_ERR(4, 4954, __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_G = values[0];
    __pyx_v_chi = values[1];
    __pyx_v_x = values[2];
    __pyx_v_z = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chareval", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 4954, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chareval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_314chareval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi, __pyx_v_x, __pyx_v_z);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_314chareval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_x, PyObject *__pyx_v_z) {
  int __pyx_v__have_z;
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__x;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("chareval", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":5011
 *           value :math:`0`.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         x = objtogen(x)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5012
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5013
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5014
 *         chi = objtogen(chi)
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_2 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_2;

  /* "cypari/auto_instance.pxi":5015
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5016
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":5015
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5017
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 5017, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5018
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5019
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5020
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5021
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_instance.pxi":5022
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5023
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5022
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 */
  }

  /* "cypari/auto_instance.pxi":5024
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chareval(__pyx_v__G, __pyx_v__chi, __pyx_v__x, __pyx_v__z);

  /* "cypari/auto_instance.pxi":5025
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chargalois(self, cyc, ORD=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":4954
 *         return new_gen(_ret)
 * 
 *     def chareval(self, G, chi, x, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be an abelian group structure affording a discrete logarithm
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chareval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5027
 *         return new_gen(_ret)
 * 
 *     def chargalois(self, cyc, ORD=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary divisors
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_317chargalois(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_316chargalois[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary divisors\n        (any object which has a :literal:`.cyc` method is also allowed, i.e. the output of\n        :literal:`znstar` or :literal:`bnrinit`). Return a list of representatives for the\n        Galois orbits of complex characters of :math:`G`.\n        If :literal:`ORD` is present, select characters depending on their orders:\n        \n        - if :literal:`ORD` is a :literal:`t_INT`, restrict to orders less than this\n          bound;\n        \n        - if :literal:`ORD` is a :literal:`t_VEC` or :literal:`t_VECSMALL`, restrict to orders in\n          the list.\n        \n        ::\n        \n            ? G = znstar(96);\n            ? #chargalois(G) \\\\ 16 orbits of characters mod 96\n            %2 = 16\n            ? #chargalois(G,4) \\\\ order less than 4\n            %3 = 12\n            ? chargalois(G,[1,4]) \\\\ order 1 or 4; 5 orbits\n            %4 = [[0, 0, 0], [2, 0, 0], [2, 1, 0], [2, 0, 1], [2, 1, 1]]\n        \n        Given a character :math:`\\chi`, of order :math:`n` (:literal:`charorder(G,chi)`), the\n        elements in its orbit are the :math:`\\phi (n)` characters :math:`\\chi^i`, :math:`(i,n) = 1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_317chargalois(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cyc = 0;
  PyObject *__pyx_v_ORD = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chargalois (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cyc,&__pyx_n_s_ORD,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_cyc)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ORD);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chargalois") < 0)) __PYX_ERR(4, 5027, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cyc = values[0];
    __pyx_v_ORD = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chargalois", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5027, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chargalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_316chargalois(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cyc, __pyx_v_ORD);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_316chargalois(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_ORD) {
  int __pyx_v__have_ORD;
  GEN __pyx_v__cyc;
  GEN __pyx_v__ORD;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("chargalois", 0);
  __Pyx_INCREF(__pyx_v_cyc);
  __Pyx_INCREF(__pyx_v_ORD);

  /* "cypari/auto_instance.pxi":5054
 *         elements in its orbit are the :math:`\phi (n)` characters :math:`\chi^i`, :math:`(i,n) = 1`.
 *         '''
 *         cyc = objtogen(cyc)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ORD = (ORD is not None)
 *         if _have_ORD:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cyc, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cyc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5055
 *         '''
 *         cyc = objtogen(cyc)
 *         cdef bint _have_ORD = (ORD is not None)             # <<<<<<<<<<<<<<
 *         if _have_ORD:
 *             ORD = objtogen(ORD)
 */
  __pyx_t_2 = (__pyx_v_ORD != Py_None);
  __pyx_v__have_ORD = __pyx_t_2;

  /* "cypari/auto_instance.pxi":5056
 *         cyc = objtogen(cyc)
 *         cdef bint _have_ORD = (ORD is not None)
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             ORD = objtogen(ORD)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_ORD != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5057
 *         cdef bint _have_ORD = (ORD is not None)
 *         if _have_ORD:
 *             ORD = objtogen(ORD)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ORD, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ORD, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":5056
 *         cyc = objtogen(cyc)
 *         cdef bint _have_ORD = (ORD is not None)
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             ORD = objtogen(ORD)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5058
 *         if _have_ORD:
 *             ORD = objtogen(ORD)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 5058, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5059
 *             ORD = objtogen(ORD)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5060
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL             # <<<<<<<<<<<<<<
 *         if _have_ORD:
 *             _ORD = (<Gen>ORD).g
 */
  __pyx_v__ORD = NULL;

  /* "cypari/auto_instance.pxi":5061
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 */
  __pyx_t_2 = (__pyx_v__have_ORD != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5062
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:
 *             _ORD = (<Gen>ORD).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ORD)->__pyx_base.g;
    __pyx_v__ORD = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5061
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 */
  }

  /* "cypari/auto_instance.pxi":5063
 *         if _have_ORD:
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chargalois(__pyx_v__cyc, __pyx_v__ORD);

  /* "cypari/auto_instance.pxi":5064
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charker(self, cyc, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5027
 *         return new_gen(_ret)
 * 
 *     def chargalois(self, cyc, ORD=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary divisors
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chargalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cyc);
  __Pyx_XDECREF(__pyx_v_ORD);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5066
 *         return new_gen(_ret)
 * 
 *     def charker(self, cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_319charker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_318charker[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`\\chi = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        This function returns the kernel of :math:`\\chi`, as a matrix :math:`K` in HNF which is a\n        left-divisor of :literal:`matdiagonal(d)`. Its columns express in terms of\n        the :math:`g_j` the generators of the subgroup. The determinant of :math:`K` is the\n        kernel index.\n        \n        ::\n        \n            ? cyc = [15,5]; chi = [1,1];\n            ? charker(cyc, chi)\n            %2 =\n            [15 12]\n            \n            [ 0 1]\n            \n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charker(bnf, [1])\n            %5 =\n            [3]\n        \n        Note that for Dirichlet characters (when :literal:`cyc` is\n        :literal:`znstar(q, 1)`), characters in Conrey representation are available,\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        ::\n        \n            ? G = znstar(8, 1); \\\\ (Z/8Z)^*\n            ? charker(G, 1) \\\\ Conrey label for trivial character\n            %2 =\n            [1 0]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_319charker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cyc = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charker (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cyc,&__pyx_n_s_chi,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_cyc)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charker", 1, 2, 2, 1); __PYX_ERR(4, 5066, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charker") < 0)) __PYX_ERR(4, 5066, __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_cyc = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charker", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5066, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_318charker(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cyc, __pyx_v_chi);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_318charker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charker", 0);
  __Pyx_INCREF(__pyx_v_cyc);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":5110
 *             [0 1]
 *         '''
 *         cyc = objtogen(cyc)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cyc, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cyc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5111
 *         '''
 *         cyc = objtogen(cyc)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5112
 *         cyc = objtogen(cyc)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5112, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5113
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charker0(_cyc, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5114
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charker0(_cyc, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5115
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charker0(_cyc, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charker0(__pyx_v__cyc, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":5116
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charker0(_cyc, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charmul(self, cyc, a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5066
 *         return new_gen(_ret)
 * 
 *     def charker(self, cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cyc);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5118
 *         return new_gen(_ret)
 * 
 *     def charmul(self, cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_321charmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_320charmul[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`a = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        Given two characters :math:`a` and :math:`b`, return the product character :math:`ab`.\n        \n        ::\n        \n            ? cyc = [15,5]; a = [1,1]; b = [2,4];\n            ? charmul(cyc, a,b)\n            %2 = [3, 0]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charmul(bnf, [1], [2])\n            %5 = [0]\n        \n        For Dirichlet characters on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, additional\n        representations are available (Conrey labels, Conrey logarithm), see\n        ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`. If the two characters are in\n        the same format, their\n        product is given in the same format, otherwise a Conrey logarithm is used.\n        \n        ::\n        \n            ? G = znstar(100, 1);\n            ? G.cyc\n            %2 = [20, 2]\n            ? a = [10, 1]; \\\\ usual representation for characters\n            ? b = 7; \\\\ Conrey label;\n            ? c = znconreylog(G, 11); \\\\ Conrey log\n            ? charmul(G, b,b)\n            %6 = 49 \\\\ Conrey label\n            ? charmul(G, a,b)\n            %7 = [0, 15]~ \\\\ Conrey log\n            ? charmul(G, a,c)\n            %7 = [0, 6]~ \\\\ Conrey log\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_321charmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cyc = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cyc,&__pyx_n_s_a,&__pyx_n_s_b,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyc)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charmul", 1, 3, 3, 1); __PYX_ERR(4, 5118, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charmul", 1, 3, 3, 2); __PYX_ERR(4, 5118, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charmul") < 0)) __PYX_ERR(4, 5118, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_cyc = values[0];
    __pyx_v_a = values[1];
    __pyx_v_b = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charmul", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5118, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_320charmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cyc, __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_320charmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charmul", 0);
  __Pyx_INCREF(__pyx_v_cyc);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":5162
 *             %7 = [0, 6]~ \\ Conrey log
 *         '''
 *         cyc = objtogen(cyc)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         b = objtogen(b)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cyc, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cyc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5163
 *         '''
 *         cyc = objtogen(cyc)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5164
 *         cyc = objtogen(cyc)
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5165
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5165, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5166
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5167
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5168
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5169
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charmul0(__pyx_v__cyc, __pyx_v__a, __pyx_v__b);

  /* "cypari/auto_instance.pxi":5170
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charorder(self, cyc, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5118
 *         return new_gen(_ret)
 * 
 *     def charmul(self, cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cyc);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5172
 *         return new_gen(_ret)
 * 
 *     def charorder(self, cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_323charorder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_322charorder[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`\\chi = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        This function returns the order of the character :literal:`chi`.\n        \n        ::\n        \n            ? cyc = [15,5]; chi = [1,1];\n            ? charorder(cyc, chi)\n            %2 = 15\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charorder(bnf, [1])\n            %5 = 3\n        \n        For Dirichlet characters (when :literal:`cyc` is\n        :literal:`znstar(q, 1)`), characters in Conrey representation are available,\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`:\n        \n        ::\n        \n            ? G = znstar(100, 1); \\\\ (Z/100Z)^*\n            ? charorder(G, 7) \\\\ Conrey label\n            %2 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_323charorder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cyc = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charorder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cyc,&__pyx_n_s_chi,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_cyc)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charorder", 1, 2, 2, 1); __PYX_ERR(4, 5172, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charorder") < 0)) __PYX_ERR(4, 5172, __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_cyc = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charorder", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5172, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_322charorder(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cyc, __pyx_v_chi);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_322charorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charorder", 0);
  __Pyx_INCREF(__pyx_v_cyc);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":5205
 *             %2 = 4
 *         '''
 *         cyc = objtogen(cyc)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cyc, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cyc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5206
 *         '''
 *         cyc = objtogen(cyc)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5207
 *         cyc = objtogen(cyc)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5207, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5208
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charorder0(_cyc, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5209
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charorder0(_cyc, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5210
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charorder0(_cyc, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charorder0(__pyx_v__cyc, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":5211
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charorder0(_cyc, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charpoly(self, A, v=None, long flag=5):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5172
 *         return new_gen(_ret)
 * 
 *     def charorder(self, cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cyc);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5213
 *         return new_gen(_ret)
 * 
 *     def charpoly(self, A, v=None, long flag=5):             # <<<<<<<<<<<<<<
 *         r'''
 *         characteristic polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_325charpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_324charpoly[] = "\n        characteristic polynomial\n        of :math:`A` with respect to the variable :math:`v`, i.e.\302\240determinant of :math:`v*I-A` if :math:`A`\n        is a square matrix.\n        \n        ::\n        \n            ? charpoly([1,2;3,4]);\n            %1 = x^2 - 5*x - 2\n            ? charpoly([1,2;3,4],, 't)\n            %2 = t^2 - 5*t - 2\n        \n        If :math:`A` is not a square matrix, the function returns the characteristic\n        polynomial of the map \"multiplication by :math:`A`\" if :math:`A` is a scalar:\n        \n        ::\n        \n            ? charpoly(Mod(x+2, x^3-2))\n            %1 = x^3 - 6*x^2 + 12*x - 10\n            ? charpoly(I)\n            %2 = x^2 + 1\n            ? charpoly(quadgen(5))\n            %3 = x^2 - x - 1\n            ? charpoly(ffgen(ffinit(2,4)))\n            %4 = Mod(1, 2)*x^4 + Mod(1, 2)*x^3 + Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2)\n        \n        The value of :math:`flag` is only significant for matrices, and we advise to stick\n        to the default value. Let :math:`n` be the dimension of :math:`A`.\n        \n        If :math:`flag = 0`, same method (Le Verrier's) as for computing the adjoint matrix,\n        i.e.\302\240using the traces of the powers of :math:`A`. Assumes that :math:`n!` is\n        invertible; uses :math:`O(n^4)` scalar operations.\n        \n        If :math:`flag = 1`, uses Lagrange interpolation which is usually the slowest method.\n        Assumes that :math:`n!` is invertible; uses :math:`O(n^4)` scalar operations.\n        \n        If :math:`flag = 2`, uses the Hessenberg form. Assumes that the base ring is a field.\n        Uses :math:`O(n^3)` scalar operations, but suffers from coefficient explosion\n        unless the base field is finite or :math:`\\mathbb{R}`.\n        \n        If :math:`flag = 3`, uses Berkowitz's division free algorithm, valid over any\n        ring (commutative, with unit). Uses :math:`O(n^4)` scalar operations.\n        \n        If :math:`flag ""= 4`, :math:`x` must be integral. Uses a modular algorithm: Hessenberg form\n        for various small primes, then Chinese remainders.\n        \n        If :math:`flag = 5` (default), uses the \"best\" method given :math:`x`.\n        This means we use Berkowitz unless the base ring is :math:`\\mathbb{Z}` (use :math:`flag = 4`)\n        or a field where coefficient explosion does not occur,\n        e.g.\302\240a finite field or the reals (use :math:`flag = 2`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_325charpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_v,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charpoly") < 0)) __PYX_ERR(4, 5213, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    __pyx_v_v = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5213, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)5);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charpoly", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_324charpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_v, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_324charpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_v, long __pyx_v_flag) {
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("charpoly", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":5265
 *         e.g.a finite field or the reals (use :math:`flag = 2`).
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5266
 *         '''
 *         A = objtogen(A)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":5267
 *         A = objtogen(A)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":5268
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 5268, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5267
 *         A = objtogen(A)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5269
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = charpoly0(_A, _v, flag)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 5269, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5270
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charpoly0(_A, _v, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_6;

  /* "cypari/auto_instance.pxi":5271
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = charpoly0(_A, _v, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charpoly0(__pyx_v__A, __pyx_v__v, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":5272
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = charpoly0(_A, _v, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charpow(self, cyc, a, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5213
 *         return new_gen(_ret)
 * 
 *     def charpoly(self, A, v=None, long flag=5):             # <<<<<<<<<<<<<<
 *         r'''
 *         characteristic polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5274
 *         return new_gen(_ret)
 * 
 *     def charpow(self, cyc, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_327charpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_326charpow[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`a = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        Given :math:`n\\in \\mathbb{Z}` and a character :math:`a`, return the character :math:`a^n`.\n        \n        ::\n        \n            ? cyc = [15,5]; a = [1,1];\n            ? charpow(cyc, a, 3)\n            %2 = [3, 3]\n            ? charpow(cyc, a, 5)\n            %2 = [5, 0]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charpow(bnf, [1], 3)\n            %5 = [0]\n        \n        For Dirichlet characters on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, additional\n        representations are available (Conrey labels, Conrey logarithm), see\n        ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character` and the output uses the\n        same format as the input.\n        \n        ::\n        \n            ? G = znstar(100, 1);\n            ? G.cyc\n            %2 = [20, 2]\n            ? a = [10, 1]; \\\\ standard representation for characters\n            ? b = 7; \\\\ Conrey label;\n            ? c = znconreylog(G, 11); \\\\ Conrey log\n            ? charpow(G, a,3)\n            %6 = [10, 1] \\\\ standard representation\n            ? charpow(G, b,3)\n            %7 = 43 \\\\ Conrey label\n            ? charpow(G, c,3)\n            %8 = [1, 8]~ \\\\ Conrey log\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_327charpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cyc = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cyc,&__pyx_n_s_a,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cyc)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charpow", 1, 3, 3, 1); __PYX_ERR(4, 5274, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charpow", 1, 3, 3, 2); __PYX_ERR(4, 5274, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charpow") < 0)) __PYX_ERR(4, 5274, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_cyc = values[0];
    __pyx_v_a = values[1];
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charpow", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5274, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_326charpow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cyc, __pyx_v_a, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_326charpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_n) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__a;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charpow", 0);
  __Pyx_INCREF(__pyx_v_cyc);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":5319
 *             %8 = [1, 8]~ \\ Conrey log
 *         '''
 *         cyc = objtogen(cyc)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         n = objtogen(n)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cyc, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cyc, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5320
 *         '''
 *         cyc = objtogen(cyc)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5321
 *         cyc = objtogen(cyc)
 *         a = objtogen(a)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5322
 *         a = objtogen(a)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5322, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5323
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5324
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5325
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5326
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charpow0(__pyx_v__cyc, __pyx_v__a, __pyx_v__n);

  /* "cypari/auto_instance.pxi":5327
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chinese(self, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5274
 *         return new_gen(_ret)
 * 
 *     def charpow(self, cyc, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.charpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cyc);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5329
 *         return new_gen(_ret)
 * 
 *     def chinese(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` and :math:`y` are both intmods or both polmods, creates (with the same
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_329chinese(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_328chinese[] = "\n        If :math:`x` and :math:`y` are both intmods or both polmods, creates (with the same\n        type) a :math:`z` in the same residue class as :math:`x` and in the same residue class as\n        :math:`y`, if it is possible.\n        \n        ::\n        \n            ? chinese(Mod(1,2), Mod(2,3))\n            %1 = Mod(5, 6)\n            ? chinese(Mod(x,x^2-1), Mod(x+1,x^2+1))\n            %2 = Mod(-1/2*x^2 + x + 1/2, x^4 - 1)\n        \n        This function also allows vector and matrix arguments, in which case the\n        operation is recursively applied to each component of the vector or matrix.\n        \n        ::\n        \n            ? chinese([Mod(1,2),Mod(1,3)], [Mod(1,5),Mod(2,7)])\n            %3 = [Mod(1, 10), Mod(16, 21)]\n        \n        For polynomial arguments in the same variable, the function is applied to each\n        coefficient; if the polynomials have different degrees, the high degree terms\n        are copied verbatim in the result, as if the missing high degree terms in the\n        polynomial of lowest degree had been :literal:`Mod(0,1)`. Since the latter\n        behavior is usually :emphasis:`not` the desired one, we propose to convert the\n        polynomials to vectors of the same length first:\n        \n        ::\n        \n             ? P = x+1; Q = x^2+2*x+1;\n             ? chinese(P*Mod(1,2), Q*Mod(1,3))\n             %4 = Mod(1, 3)*x^2 + Mod(5, 6)*x + Mod(3, 6)\n             ? chinese(Vec(P,3)*Mod(1,2), Vec(Q,3)*Mod(1,3))\n             %5 = [Mod(1, 6), Mod(5, 6), Mod(4, 6)]\n             ? Pol(%)\n             %6 = Mod(1, 6)*x^2 + Mod(5, 6)*x + Mod(4, 6)\n        \n        If :math:`y` is omitted, and :math:`x` is a vector, :literal:`chinese` is applied recursively\n        to the components of :math:`x`, yielding a residue belonging to the same class as all\n        components of :math:`x`.\n        \n        Finally :math:`chinese (x,x) = x` regardless of the type of :math:`x`; this allows\n        vector argum""ents to contain other data, so long as they are identical in both\n        vectors.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_329chinese(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chinese (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chinese") < 0)) __PYX_ERR(4, 5329, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chinese", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5329, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_328chinese(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_328chinese(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("chinese", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":5375
 *         vectors.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5376
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":5377
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5378
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5378, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":5377
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5379
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 5379, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5380
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5381
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":5382
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5383
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chinese(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5382
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)
 */
  }

  /* "cypari/auto_instance.pxi":5384
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chinese(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":5385
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cmp(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5329
 *         return new_gen(_ret)
 * 
 *     def chinese(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` and :math:`y` are both intmods or both polmods, creates (with the same
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.chinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5387
 *         return new_gen(_ret)
 * 
 *     def cmp(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a comparison between arbitrary objects :math:`x` and :math:`y`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_331cmp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_330cmp[] = "\n        Gives the result of a comparison between arbitrary objects :math:`x` and :math:`y`\n        (as :math:`-1`, :math:`0` or :math:`1`). The underlying order relation is transitive,\n        the function returns :math:`0` if and only if :math:`x\302\240 === \302\240y`. It has no\n        mathematical meaning but satisfies the following properties when comparing\n        entries of the same type:\n        \n        - two :literal:`t_INT`\302\240s compare as usual (i.e. :literal:`cmp`:math:`(x,y) < 0` if and only\n          if :math:`x < y`);\n        \n        - two :literal:`t_VECSMALL`\302\240s of the same length compare lexicographically;\n        \n        - two :literal:`t_STR`\302\240s compare lexicographically.\n        \n        In case all components are equal up to the smallest length of the operands,\n        the more complex is considered to be larger. More precisely, the longest is\n        the largest; when lengths are equal, we have matrix :math:`>` vector :math:`>` scalar.\n        For example:\n        \n        ::\n        \n            ? cmp(1, 2)\n            %1 = -1\n            ? cmp(2, 1)\n            %2 = 1\n            ? cmp(1, 1.0) \\\\ note that 1 == 1.0, but (1===1.0) is false.\n            %3 = -1\n            ? cmp(x + Pi, [])\n            %4 = -1\n        \n        This function is mostly useful to handle sorted lists or\n        vectors of arbitrary objects. For instance, if :math:`v` is a vector, the\n        construction :literal:`vecsort(v, cmp)` is equivalent to :literal:`Set(v)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_331cmp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cmp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("cmp", 1, 2, 2, 1); __PYX_ERR(4, 5387, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cmp") < 0)) __PYX_ERR(4, 5387, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cmp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5387, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cmp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_330cmp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_330cmp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("cmp", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":5422
 *         construction :literal:`vecsort(v, cmp)` is equivalent to :literal:`Set(v)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5423
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5424
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5424, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5425
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = cmp_universal(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5426
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = cmp_universal(_x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5427
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = cmp_universal(_x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = cmp_universal(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":5428
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = cmp_universal(_x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":5429
 *         cdef int _ret = cmp_universal(_x, _y)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def component(self, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5387
 *         return new_gen(_ret)
 * 
 *     def cmp(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a comparison between arbitrary objects :math:`x` and :math:`y`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cmp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5431
 *         return _ret
 * 
 *     def component(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extracts the :math:`n-th`-component of :math:`x`. This is to be understood
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_333component(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_332component[] = "\n        Extracts the :math:`n-th`-component of :math:`x`. This is to be understood\n        as follows: every PARI type has one or two initial code words. The\n        components are counted, starting at 1, after these code words. In particular\n        if :math:`x` is a vector, this is indeed the :math:`n-th`-component of :math:`x`, if\n        :math:`x` is a matrix, the :math:`n-th` column, if :math:`x` is a polynomial, the\n        :math:`n-th` coefficient (i.e.\302\240of degree :math:`n-1`), and for power series,\n        the :math:`n-th` significant coefficient.\n        \n        For polynomials and power series, one should rather use :literal:`polcoeff`, and\n        for vectors and matrices, the :literal:`[]` operator. Namely, if :math:`x` is a\n        vector, then :literal:`x[n]` represents the :math:`n-th` component of :math:`x`. If\n        :math:`x` is a matrix, :literal:`x[m,n]` represents the coefficient of row :literal:`m` and\n        column :literal:`n` of the matrix, :literal:`x[m,]` represents the :math:`m-th`\n        :emphasis:`row` of :math:`x`, and :literal:`x[,n]` represents the :math:`n-th`\n        :emphasis:`column` of :math:`x`.\n        \n        Using of this function requires detailed knowledge of the structure of the\n        different PARI types, and thus it should almost never be used directly.\n        Some useful exceptions:\n        \n        ::\n        \n             ? x = 3 + O(3^5);\n             ? component(x, 2)\n             %2 = 81 \\\\ p^(p-adic accuracy)\n             ? component(x, 1)\n             %3 = 3 \\\\ p\n             ? q = Qfb(1,2,3);\n             ? component(q, 1)\n             %5 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_333component(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("component (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("component", 1, 2, 2, 1); __PYX_ERR(4, 5431, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "component") < 0)) __PYX_ERR(4, 5431, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5431, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("component", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5431, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.component", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_332component(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_332component(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("component", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":5464
 *              %5 = 1
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5465
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = compo(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5465, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5466
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = compo(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5467
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = compo(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = compo(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":5468
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = compo(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def concat(self, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5431
 *         return _ret
 * 
 *     def component(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extracts the :math:`n-th`-component of :math:`x`. This is to be understood
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.component", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5470
 *         return new_gen(_ret)
 * 
 *     def concat(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Concatenation of :math:`x` and :math:`y`. If :math:`x` or :math:`y` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_335concat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_334concat[] = "\n        Concatenation of :math:`x` and :math:`y`. If :math:`x` or :math:`y` is\n        not a vector or matrix, it is considered as a one-dimensional vector. All\n        types are allowed for :math:`x` and :math:`y`, but the sizes must be compatible. Note\n        that matrices are concatenated horizontally, i.e.\302\240the number of rows stays\n        the same. Using transpositions, one can concatenate them vertically,\n        but it is often simpler to use :literal:`matconcat`.\n        \n        ::\n        \n            ? x = matid(2); y = 2*matid(2);\n            ? concat(x,y)\n            %2 =\n            [1 0 2 0]\n            \n            [0 1 0 2]\n            ? concat(x~,y~)~\n            %3 =\n            [1 0]\n            \n            [0 1]\n            \n            [2 0]\n            \n            [0 2]\n            ? matconcat([x;y])\n            %4 =\n            [1 0]\n            \n            [0 1]\n            \n            [2 0]\n            \n            [0 2]\n        \n        To concatenate vectors sideways (i.e.\302\240to obtain a two-row or two-column\n        matrix), use :literal:`Mat` instead, or :literal:`matconcat`:\n        \n        ::\n        \n            ? x = [1,2];\n            ? y = [3,4];\n            ? concat(x,y)\n            %3 = [1, 2, 3, 4]\n            \n            ? Mat([x,y]~)\n            %4 =\n            [1 2]\n            \n            [3 4]\n            ? matconcat([x;y])\n            %5 =\n            [1 2]\n            \n            [3 4]\n        \n        Concatenating a row vector to a matrix having the same number of columns will\n        add the row to the matrix (top row if the vector is :math:`x`, i.e.\302\240comes first, and\n        bottom row otherwise).\n        \n        The empty matrix :literal:`[;]` is considered to have a number of rows compatible\n        with any operation, in particular concatenation. (Note that this is\n        :emphasis:`not` the case for empty vectors :literal:`""[\302\240]` or :literal:`[\302\240]~`.)\n        \n        If :math:`y` is omitted, :math:`x` has to be a row vector or a list, in which case its\n        elements are concatenated, from left to right, using the above rules.\n        \n        ::\n        \n            ? concat([1,2], [3,4])\n            %1 = [1, 2, 3, 4]\n            ? a = [[1,2]~, [3,4]~]; concat(a)\n            %2 =\n            [1 3]\n            \n            [2 4]\n            \n            ? concat([1,2; 3,4], [5,6]~)\n            %3 =\n            [1 2 5]\n            \n            [3 4 6]\n            ? concat([%, [7,8]~, [1,2,3,4]])\n            %5 =\n            [1 2 5 7]\n            \n            [3 4 6 8]\n            \n            [1 2 3 4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_335concat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("concat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "concat") < 0)) __PYX_ERR(4, 5470, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("concat", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5470, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_334concat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_334concat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("concat", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":5561
 *             [1 2 3 4]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5562
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":5563
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5564
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":5563
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5565
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 5565, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5566
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5567
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":5568
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5569
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gconcat(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5568
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)
 */
  }

  /* "cypari/auto_instance.pxi":5570
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gconcat(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":5571
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def conj(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5470
 *         return new_gen(_ret)
 * 
 *     def concat(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Concatenation of :math:`x` and :math:`y`. If :math:`x` or :math:`y` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5573
 *         return new_gen(_ret)
 * 
 *     def conj(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate of :math:`x`. The meaning of this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_337conj(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_336conj[] = "\n        Conjugate of :math:`x`. The meaning of this\n        is clear, except that for real quadratic numbers, it means conjugation in the\n        real quadratic field. This function has no effect on integers, reals,\n        intmods, fractions or :math:`p`-adics. The only forbidden type is polmod\n        (see :literal:`conjvec` for this).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_337conj(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conj (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_336conj(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_336conj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("conj", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":5581
 *         (see :literal:`conjvec` for this).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5582
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gconj(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5582, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5583
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gconj(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5584
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gconj(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gconj(__pyx_v__x);

  /* "cypari/auto_instance.pxi":5585
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gconj(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def conjvec(self, z, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5573
 *         return new_gen(_ret)
 * 
 *     def conj(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate of :math:`x`. The meaning of this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.conj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5587
 *         return new_gen(_ret)
 * 
 *     def conjvec(self, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate vector representation of :math:`z`. If :math:`z` is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_339conjvec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_338conjvec[] = "\n        Conjugate vector representation of :math:`z`. If :math:`z` is a\n        polmod, equal to :literal:`Mod`:math:`(a,T)`, this gives a vector of length\n        :math:`degree(T)` containing:\n        \n        - the complex embeddings of :math:`z` if :math:`T` has rational coefficients,\n          i.e.\302\240the :math:`a(r[i])` where :math:`r = polroots (T)`;\n        \n        - the conjugates of :math:`z` if :math:`T` has some intmod coefficients;\n        \n        if :math:`z` is a finite field element, the result is the vector of\n        conjugates :math:`[z,z^p,z^{p^2},...,z^{p^{n-1}}]` where :math:`n = degree(T)`.\n        \n        If :math:`z` is an integer or a rational number, the result is\302\240:math:`z`. If\n        :math:`z` is a (row or column) vector, the result is a matrix whose columns are\n        the conjugate vectors of the individual elements of :math:`z`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_339conjvec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conjvec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_precision,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_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "conjvec") < 0)) __PYX_ERR(4, 5587, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5587, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("conjvec", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5587, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.conjvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_338conjvec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_z, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_338conjvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_precision) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("conjvec", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":5605
 *         the conjugate vectors of the individual elements of :math:`z`.
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5606
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5606, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5607
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = conjvec(_z, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5608
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = conjvec(_z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":5609
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = conjvec(_z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = conjvec(__pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":5610
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = conjvec(_z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def content(self, x, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5587
 *         return new_gen(_ret)
 * 
 *     def conjvec(self, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate vector representation of :math:`z`. If :math:`z` is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.conjvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5612
 *         return new_gen(_ret)
 * 
 *     def content(self, x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the gcd of all the coefficients of :math:`x`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_341content(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_340content[] = "\n        Computes the gcd of all the coefficients of :math:`x`,\n        when this gcd makes sense. This is the natural definition\n        if :math:`x` is a polynomial (and by extension a power series) or a\n        vector/matrix. This is in general a weaker notion than the :emphasis:`ideal`\n        generated by the coefficients:\n        \n        ::\n        \n            ? content(2*x+y)\n            %1 = 1 \\\\ = gcd(2,y) over Q[y]\n        \n        If :math:`x` is a scalar, this simply returns the absolute value of :math:`x` if :math:`x` is\n        rational (:literal:`t_INT` or :literal:`t_FRAC`), and either :math:`1` (inexact input) or :math:`x`\n        (exact input) otherwise; the result should be identical to :literal:`gcd(x, 0)`.\n        \n        The content of a rational function is the ratio of the contents of the\n        numerator and the denominator. In recursive structures, if a\n        matrix or vector :emphasis:`coefficient` :math:`x` appears, the gcd is taken\n        not with :math:`x`, but with its content:\n        \n        ::\n        \n            ? content([ [2], 4*matid(3) ])\n            %1 = 2\n        \n        The content of a :literal:`t_VECSMALL` is computed assuming the\n        entries are signed integers.\n        \n        The optional argument :math:`D` allows to control over which ring we compute\n        and get a more predictable behaviour:\n        \n        - :math:`1`: we only consider the underlying :math:`\\mathbb{Q}`-structure and the\n          denominator is a (positive) rational number\n        \n        - a simple variable, say :literal:`'x`: all entries are considered as\n          rational functions in :math:`K(x)` for some field :math:`K` and the content is an\n          element of :math:`K`.\n        \n        ::\n        \n            ? f = x + 1/y + 1/2;\n            ? content(f) \\\\ as a t_POL in x\n            %2 = 1/(2*y)\n            ? content(f, 1) \\\\ Q-content\n            %3 = 1/2\n          ""  ? content(f, y) \\\\ as a rational function in y\n            %4 = 1/2\n            ? g = x^2*y + y^2*x;\n            ? content(g, x)\n            %6 = y\n            ? content(g, y)\n            %7 = x\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_341content(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("content (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_D,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "content") < 0)) __PYX_ERR(4, 5612, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("content", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5612, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.content", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_340content(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_340content(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("content", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":5667
 *             %7 = x
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5668
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":5669
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5670
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5670, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":5669
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5671
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 5671, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5672
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5673
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":5674
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5675
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = content0(_x, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5674
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)
 */
  }

  /* "cypari/auto_instance.pxi":5676
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = content0(__pyx_v__x, __pyx_v__D);

  /* "cypari/auto_instance.pxi":5677
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfrac(self, x, b=None, long nmax=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5612
 *         return new_gen(_ret)
 * 
 *     def content(self, x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the gcd of all the coefficients of :math:`x`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.content", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5679
 *         return new_gen(_ret)
 * 
 *     def contfrac(self, x, b=None, long nmax=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the row vector whose components are the partial quotients of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_343contfrac(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_342contfrac[] = "\n        Returns the row vector whose components are the partial quotients of the\n        continued fraction expansion of :math:`x`. In other words, a result\n        :math:`[a_0,...,a_n]` means that :math:`x ~ a_0+1/(a_1+...+1/a_n)`. The\n        output is normalized so that :math:`a_n != 1` (unless we also have :math:`n = 0`).\n        \n        The number of partial quotients :math:`n+1` is limited by :literal:`nmax`. If\n        :literal:`nmax` is omitted, the expansion stops at the last significant partial\n        quotient.\n        \n        ::\n        \n            ? \\p19\n             realprecision = 19 significant digits\n            ? contfrac(Pi)\n            %1 = [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2]\n            ? contfrac(Pi,, 3) \\\\ n = 2\n            %2 = [3, 7, 15]\n        \n        :math:`x` can also be a rational function or a power series.\n        \n        If a vector :math:`b` is supplied, the numerators are equal to the coefficients\n        of :math:`b`, instead of all equal to :math:`1` as above; more precisely, :math:`x ~\n        (1/b_0)(a_0+b_1/(a_1+...+b_n/a_n))`; for a numerical continued fraction\n        (:math:`x` real), the :math:`a_i` are integers, as large as possible; if :math:`x` is a\n        rational function, they are polynomials with :math:`\\deg a_i = \\deg b_i + 1`.\n        The length of the result is then equal to the length of :math:`b`, unless the next\n        partial quotient cannot be reliably computed, in which case the expansion\n        stops. This happens when a partial remainder is equal to zero (or too small\n        compared to the available significant digits for :math:`x` a :literal:`t_REAL`).\n        \n        A direct implementation of the numerical continued fraction\n        :literal:`contfrac(x,b)` described above would be\n        \n        ::\n        \n            \\\\ \"greedy\" generalized continued fraction\n            cf(x, b) =\n            { my( a= vector(#b), t "");\n            \n             x *= b[1];\n             for (i = 1, #b,\n             a[i] = floor(x);\n             t = x - a[i]; if (!t || i == #b, break);\n             x = b[i+1] / t;\n             ); a;\n            }\n        \n        There is some degree of freedom when choosing the :math:`a_i`; the\n        program above can easily be modified to derive variants of the standard\n        algorithm. In the same vein, although no builtin\n        function implements the related Engel expansion (a special kind of\n        Egyptian fraction decomposition: :math:`x = 1/a_1 + 1/(a_1a_2) +...` ),\n        it can be obtained as follows:\n        \n        ::\n        \n            \\\\ n terms of the Engel expansion of x\n            engel(x, n = 10) =\n            { my( u = x, a = vector(n) );\n             for (k = 1, n,\n             a[k] = ceil(1/u);\n             u = u*a[k] - 1;\n             if (!u, break);\n             ); a\n            }\n        \n        :strong:`Obsolete hack.` (don't use this): if :math:`b` is an integer, :emphasis:`nmax`\n        is ignored and the command is understood as :literal:`contfrac(:math:`x,, b`)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_343contfrac(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_b = 0;
  long __pyx_v_nmax;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfrac (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_b,&__pyx_n_s_nmax,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmax);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfrac") < 0)) __PYX_ERR(4, 5679, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_b = values[1];
    if (values[2]) {
      __pyx_v_nmax = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_nmax == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5679, __pyx_L3_error)
    } else {
      __pyx_v_nmax = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfrac", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5679, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfrac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_342contfrac(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_b, __pyx_v_nmax);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_342contfrac(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b, long __pyx_v_nmax) {
  int __pyx_v__have_b;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("contfrac", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":5750
 *         is ignored and the command is understood as :literal:`contfrac(:math:`x,, b`)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5751
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_2 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_2;

  /* "cypari/auto_instance.pxi":5752
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5753
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":5752
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5754
 *         if _have_b:
 *             b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 5754, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5755
 *             b = objtogen(b)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5756
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_instance.pxi":5757
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5758
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5757
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 */
  }

  /* "cypari/auto_instance.pxi":5759
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfrac0(__pyx_v__x, __pyx_v__b, __pyx_v_nmax);

  /* "cypari/auto_instance.pxi":5760
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfraceval(self, CF, t, long lim=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5679
 *         return new_gen(_ret)
 * 
 *     def contfrac(self, x, b=None, long nmax=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the row vector whose components are the partial quotients of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfrac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5762
 *         return new_gen(_ret)
 * 
 *     def contfraceval(self, CF, t, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a continued fraction :literal:`CF` output by :literal:`contfracinit`, evaluate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_345contfraceval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_344contfraceval[] = "\n        Given a continued fraction :literal:`CF` output by :literal:`contfracinit`, evaluate\n        the first :literal:`lim` terms of the continued fraction at :literal:`t` (all\n        terms if :literal:`lim` is negative or omitted; if positive, :literal:`lim` must be\n        less than or equal to the length of :literal:`CF`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_345contfraceval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_CF = 0;
  PyObject *__pyx_v_t = 0;
  long __pyx_v_lim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfraceval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_CF,&__pyx_n_s_t,&__pyx_n_s_lim,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_CF)) != 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_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("contfraceval", 0, 2, 3, 1); __PYX_ERR(4, 5762, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfraceval") < 0)) __PYX_ERR(4, 5762, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_CF = values[0];
    __pyx_v_t = values[1];
    if (values[2]) {
      __pyx_v_lim = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_lim == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5762, __pyx_L3_error)
    } else {
      __pyx_v_lim = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfraceval", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5762, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfraceval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_344contfraceval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_CF, __pyx_v_t, __pyx_v_lim);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_344contfraceval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_CF, PyObject *__pyx_v_t, long __pyx_v_lim) {
  GEN __pyx_v__CF;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("contfraceval", 0);
  __Pyx_INCREF(__pyx_v_CF);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":5769
 *         less than or equal to the length of :literal:`CF`.
 *         '''
 *         CF = objtogen(CF)             # <<<<<<<<<<<<<<
 *         t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_CF, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_CF, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5770
 *         '''
 *         CF = objtogen(CF)
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _CF = (<Gen>CF).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5771
 *         CF = objtogen(CF)
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _CF = (<Gen>CF).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5771, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5772
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _CF = (<Gen>CF).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_CF)->__pyx_base.g;
  __pyx_v__CF = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5773
 *         sig_on()
 *         cdef GEN _CF = (<Gen>CF).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5774
 *         cdef GEN _CF = (<Gen>CF).g
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfraceval(__pyx_v__CF, __pyx_v__t, __pyx_v_lim);

  /* "cypari/auto_instance.pxi":5775
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfracinit(self, M, long lim=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5762
 *         return new_gen(_ret)
 * 
 *     def contfraceval(self, CF, t, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a continued fraction :literal:`CF` output by :literal:`contfracinit`, evaluate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfraceval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_CF);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5777
 *         return new_gen(_ret)
 * 
 *     def contfracinit(self, M, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`M` representing the power series :math:`S = \sum_{n >= 0} M[n+1]z^n`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_347contfracinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_346contfracinit[] = "\n        Given :math:`M` representing the power series :math:`S = \\sum_{n >= 0} M[n+1]z^n`,\n        transform it into a continued fraction; restrict to :math:`n <= lim`\n        if latter is non-negative. :math:`M` can be a vector, a power\n        series, a polynomial, or a rational function.\n        The result is a 2-component vector :math:`[A,B]` such that\n        :math:`S = M[1] / (1+A[1]z+B[1]z^2/(1+A[2]z+B[2]z^2/(1+...1/(1+A[lim/2]z))))`.\n        Does not work if any coefficient of :math:`M` vanishes, nor for series for\n        which certain partial denominators vanish.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_347contfracinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_lim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfracinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_lim,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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfracinit") < 0)) __PYX_ERR(4, 5777, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    if (values[1]) {
      __pyx_v_lim = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_lim == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5777, __pyx_L3_error)
    } else {
      __pyx_v_lim = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfracinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5777, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfracinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_346contfracinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_lim);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_346contfracinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_lim) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("contfracinit", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":5788
 *         which certain partial denominators vanish.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5789
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = contfracinit(_M, lim)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5789, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5790
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfracinit(_M, lim)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5791
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = contfracinit(_M, lim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfracinit(__pyx_v__M, __pyx_v_lim);

  /* "cypari/auto_instance.pxi":5792
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = contfracinit(_M, lim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfracpnqn(self, x, long n=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5777
 *         return new_gen(_ret)
 * 
 *     def contfracinit(self, M, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`M` representing the power series :math:`S = \sum_{n >= 0} M[n+1]z^n`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfracinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5794
 *         return new_gen(_ret)
 * 
 *     def contfracpnqn(self, x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a vector or a one-row matrix, :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_349contfracpnqn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_348contfracpnqn[] = "\n        When :math:`x` is a vector or a one-row matrix, :math:`x`\n        is considered as the list of partial quotients :math:`[a_0,a_1,...,a_n]` of a\n        rational number, and the result is the 2 by 2 matrix\n        :math:`[p_n,p_{n-1};q_n,q_{n-1}]` in the standard notation of continued fractions,\n        so :math:`p_n/q_n = a_0+1/(a_1+...+1/a_n)`. If :math:`x` is a matrix with two rows\n        :math:`[b_0,b_1,...,b_n]` and :math:`[a_0,a_1,...,a_n]`, this is then considered as a\n        generalized continued fraction and we have similarly\n        :math:`p_n/q_n = (1/b_0)(a_0+b_1/(a_1+...+b_n/a_n))`. Note that in this case one\n        usually has :math:`b_0 = 1`.\n        \n        If :math:`n >= 0` is present, returns all convergents from :math:`p_0/q_0` up to\n        :math:`p_n/q_n`. (All convergents if :math:`x` is too small to compute the :math:`n+1`\n        requested convergents.)\n        \n        ::\n        \n            ? a = contfrac(Pi,10)\n            %1 = [3, 7, 15, 1, 292, 1, 1, 1, 3]\n            ? allpnqn(x) = contfracpnqn(x,#x) \\\\ all convergents\n            ? allpnqn(a)\n            %3 =\n            [3 22 333 355 103993 104348 208341 312689 1146408]\n            \n            [1 7 106 113 33102 33215 66317 99532 364913]\n            ? contfracpnqn(a) \\\\ last two convergents\n            %4 =\n            [1146408 312689]\n            \n            [ 364913 99532]\n            \n            ? contfracpnqn(a,3) \\\\ first three convergents\n            %5 =\n            [3 22 333 355]\n            \n            [1 7 106 113]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_349contfracpnqn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfracpnqn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfracpnqn") < 0)) __PYX_ERR(4, 5794, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5794, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfracpnqn", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5794, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfracpnqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_348contfracpnqn(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_348contfracpnqn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("contfracpnqn", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":5832
 *             [1 7 106 113]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5833
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = contfracpnqn(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5833, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5834
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfracpnqn(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5835
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = contfracpnqn(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfracpnqn(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":5836
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = contfracpnqn(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def core(self, n, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5794
 *         return new_gen(_ret)
 * 
 *     def contfracpnqn(self, x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a vector or a one-row matrix, :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.contfracpnqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5838
 *         return new_gen(_ret)
 * 
 *     def core(self, n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`n` is an integer written as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_351core(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_350core[] = "\n        If :math:`n` is an integer written as\n        :math:`n = df^2` with :math:`d` squarefree, returns :math:`d`. If :math:`flag` is non-zero,\n        returns the two-element row vector :math:`[d,f]`. By convention, we write :math:`0 = 0\n        x 1^2`, so :literal:`core(0, 1)` returns :math:`[0,1]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_351core(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("core (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_flag,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "core") < 0)) __PYX_ERR(4, 5838, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5838, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("core", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5838, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.core", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_350core(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_350core(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("core", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":5845
 *         x 1^2`, so :literal:`core(0, 1)` returns :math:`[0,1]`.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5846
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = core0(_n, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5846, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5847
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = core0(_n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5848
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = core0(_n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = core0(__pyx_v__n, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":5849
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = core0(_n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def coredisc(self, n, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5838
 *         return new_gen(_ret)
 * 
 *     def core(self, n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`n` is an integer written as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.core", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5851
 *         return new_gen(_ret)
 * 
 *     def coredisc(self, n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         A :emphasis:`fundamental discriminant` is an integer of the form :math:`t = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_353coredisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_352coredisc[] = "\n        A :emphasis:`fundamental discriminant` is an integer of the form :math:`t = 1\n        mod 4` or :math:`4t = 8,12 mod 16`, with :math:`t` squarefree (i.e.\302\240:math:`1` or the\n        discriminant of a quadratic number field). Given a non-zero integer\n        :math:`n`, this routine returns the (unique) fundamental discriminant :math:`d`\n        such that :math:`n = df^2`, :math:`f` a positive rational number. If :math:`flag` is non-zero,\n        returns the two-element row vector :math:`[d,f]`. If :math:`n` is congruent to\n        0 or 1 modulo 4, :math:`f` is an integer, and a half-integer otherwise.\n        \n        By convention, :literal:`coredisc(0, 1))` returns :math:`[0,1]`.\n        \n        Note that :literal:`quaddisc`:math:`(n)` returns the same value as :literal:`coredisc`:math:`(n)`,\n        and also works with rational inputs :math:`n\\in\\mathbb{Q}^*`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_353coredisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coredisc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_flag,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "coredisc") < 0)) __PYX_ERR(4, 5851, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5851, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("coredisc", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5851, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.coredisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_352coredisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_352coredisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("coredisc", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":5866
 *         and also works with rational inputs :math:`n\in\mathbb{Q}^*`.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5867
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = coredisc0(_n, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5867, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5868
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = coredisc0(_n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5869
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = coredisc0(_n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = coredisc0(__pyx_v__n, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":5870
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = coredisc0(_n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cos(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5851
 *         return new_gen(_ret)
 * 
 *     def coredisc(self, n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         A :emphasis:`fundamental discriminant` is an integer of the form :math:`t = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.coredisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5872
 *         return new_gen(_ret)
 * 
 *     def cos(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cosine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_355cos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_354cos[] = "\n        Cosine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_355cos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cos (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cos") < 0)) __PYX_ERR(4, 5872, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5872, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cos", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5872, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_354cos(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_354cos(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("cos", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":5876
 *         Cosine of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5877
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5877, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5878
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcos(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5879
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcos(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":5880
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcos(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcos(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":5881
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcos(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cosh(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5881, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5872
 *         return new_gen(_ret)
 * 
 *     def cos(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cosine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5883
 *         return new_gen(_ret)
 * 
 *     def cosh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cosine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_357cosh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_356cosh[] = "\n        Hyperbolic cosine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_357cosh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cosh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cosh") < 0)) __PYX_ERR(4, 5883, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5883, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cosh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5883, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_356cosh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_356cosh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("cosh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":5887
 *         Hyperbolic cosine of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5888
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5888, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5889
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcosh(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5890
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcosh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":5891
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcosh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcosh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":5892
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcosh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cotan(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5883
 *         return new_gen(_ret)
 * 
 *     def cosh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cosine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5894
 *         return new_gen(_ret)
 * 
 *     def cotan(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cotangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_359cotan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_358cotan[] = "\n        Cotangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_359cotan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cotan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cotan") < 0)) __PYX_ERR(4, 5894, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5894, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cotan", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5894, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cotan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_358cotan(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_358cotan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("cotan", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":5898
 *         Cotangent of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5899
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5899, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5900
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotan(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5901
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcotan(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":5902
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotan(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcotan(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":5903
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotan(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cotanh(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5894
 *         return new_gen(_ret)
 * 
 *     def cotan(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cotangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cotan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5905
 *         return new_gen(_ret)
 * 
 *     def cotanh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cotangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_361cotanh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_360cotanh[] = "\n        Hyperbolic cotangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_361cotanh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cotanh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cotanh") < 0)) __PYX_ERR(4, 5905, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 5905, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cotanh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5905, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cotanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_360cotanh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_360cotanh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("cotanh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":5909
 *         Hyperbolic cotangent of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5910
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 5910, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5911
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotanh(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":5912
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcotanh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":5913
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotanh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcotanh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":5914
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotanh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def default(self, key=None, val=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5905
 *         return new_gen(_ret)
 * 
 *     def cotanh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cotangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.cotanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5916
 *         return new_gen(_ret)
 * 
 *     def default(self, key=None, val=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the default corresponding to keyword :emphasis:`key`. If :emphasis:`val` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_363default(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_362default[] = "\n        Returns the default corresponding to keyword :emphasis:`key`. If :emphasis:`val` is\n        present, sets the default to :emphasis:`val` first (which is subject to string\n        expansion first). Typing :literal:`default()` (or :literal:`\\\\d`) yields the complete\n        default list as well as their current values. See ``defaults`` (in the PARI manual) for an\n        introduction to GP defaults, ``gp_defaults`` (in the PARI manual) for a\n        list of available defaults, and ``meta`` (in the PARI manual) for some shortcut\n        alternatives. Note that the shortcuts are meant for interactive use and\n        usually display more information than :literal:`default`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_363default(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_val = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("default (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_key,&__pyx_n_s_val,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_key);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_val);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "default") < 0)) __PYX_ERR(4, 5916, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_key = values[0];
    __pyx_v_val = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("default", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5916, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_362default(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_key, __pyx_v_val);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_362default(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_val) {
  char *__pyx_v__key;
  char *__pyx_v__val;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("default", 0);
  __Pyx_INCREF(__pyx_v_key);
  __Pyx_INCREF(__pyx_v_val);

  /* "cypari/auto_instance.pxi":5928
 *         '''
 *         cdef char* _key
 *         if key is None:             # <<<<<<<<<<<<<<
 *             _key = NULL
 *         else:
 */
  __pyx_t_1 = (__pyx_v_key == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5929
 *         cdef char* _key
 *         if key is None:
 *             _key = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             key = to_bytes(key)
 */
    __pyx_v__key = NULL;

    /* "cypari/auto_instance.pxi":5928
 *         '''
 *         cdef char* _key
 *         if key is None:             # <<<<<<<<<<<<<<
 *             _key = NULL
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/auto_instance.pxi":5931
 *             _key = NULL
 *         else:
 *             key = to_bytes(key)             # <<<<<<<<<<<<<<
 *             _key = <bytes>key
 *         cdef char* _val
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/auto_instance.pxi":5932
 *         else:
 *             key = to_bytes(key)
 *             _key = <bytes>key             # <<<<<<<<<<<<<<
 *         cdef char* _val
 *         if val is None:
 */
    if (unlikely(__pyx_v_key == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 5932, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_key); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(4, 5932, __pyx_L1_error)
    __pyx_v__key = __pyx_t_4;
  }
  __pyx_L3:;

  /* "cypari/auto_instance.pxi":5934
 *             _key = <bytes>key
 *         cdef char* _val
 *         if val is None:             # <<<<<<<<<<<<<<
 *             _val = NULL
 *         else:
 */
  __pyx_t_2 = (__pyx_v_val == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":5935
 *         cdef char* _val
 *         if val is None:
 *             _val = NULL             # <<<<<<<<<<<<<<
 *         else:
 *             val = to_bytes(val)
 */
    __pyx_v__val = NULL;

    /* "cypari/auto_instance.pxi":5934
 *             _key = <bytes>key
 *         cdef char* _val
 *         if val is None:             # <<<<<<<<<<<<<<
 *             _val = NULL
 *         else:
 */
    goto __pyx_L4;
  }

  /* "cypari/auto_instance.pxi":5937
 *             _val = NULL
 *         else:
 *             val = to_bytes(val)             # <<<<<<<<<<<<<<
 *             _val = <bytes>val
 *         sig_on()
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_val); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5937, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_val, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/auto_instance.pxi":5938
 *         else:
 *             val = to_bytes(val)
 *             _val = <bytes>val             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = default0(_key, _val)
 */
    if (unlikely(__pyx_v_val == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 5938, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_val); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(4, 5938, __pyx_L1_error)
    __pyx_v__val = __pyx_t_4;
  }
  __pyx_L4:;

  /* "cypari/auto_instance.pxi":5939
 *             val = to_bytes(val)
 *             _val = <bytes>val
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = default0(_key, _val)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 5939, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5940
 *             _val = <bytes>val
 *         sig_on()
 *         cdef GEN _ret = default0(_key, _val)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = default0(__pyx_v__key, __pyx_v__val);

  /* "cypari/auto_instance.pxi":5941
 *         sig_on()
 *         cdef GEN _ret = default0(_key, _val)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def denominator(self, f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5916
 *         return new_gen(_ret)
 * 
 *     def default(self, key=None, val=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the default corresponding to keyword :emphasis:`key`. If :emphasis:`val` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5943
 *         return new_gen(_ret)
 * 
 *     def denominator(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Denominator of :math:`f`. The meaning of this is clear when :math:`f` is a rational number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_365denominator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_364denominator[] = "\n        Denominator of :math:`f`. The meaning of this is clear when :math:`f` is a rational number\n        or function. If :math:`f` is an integer or a polynomial, it is treated as a rational\n        number or function, respectively, and the result is equal to :math:`1`. For\n        polynomials, you probably want to use\n        \n        ::\n        \n            denominator( content(f) )\n        \n        instead. As for modular objects, :literal:`t_INTMOD` and :literal:`t_PADIC`\n        have denominator :math:`1`, and the denominator of a :literal:`t_POLMOD` is the\n        denominator of its lift.\n        \n        If :math:`f` is a recursive structure, for instance a vector or matrix, the lcm\n        of the denominators of its components (a common denominator) is computed.\n        This also applies for :literal:`t_COMPLEX`\302\240s and :literal:`t_QUAD`\302\240s.\n        \n        :strong:`Warning.` Multivariate objects are created according to variable\n        priorities, with possibly surprising side effects (:math:`x/y` is a polynomial, but\n        :math:`y/x` is a rational function). See ``priority`` (in the PARI manual).\n        \n        The optional argument :math:`D` allows to control over which ring we compute the\n        denominator and get a more predictable behaviour:\n        \n        - :math:`1`: we only consider the underlying :math:`\\mathbb{Q}`-structure and the\n          denominator is a (positive) rational integer\n        \n        - a simple variable, say :literal:`'x`: all entries as rational functions\n          in :math:`K(x)` and the denominator is a polynomial in :math:`x`.\n        \n        ::\n        \n            ? f = x + 1/y + 1/2;\n            ? denominator(f) \\\\ a t_POL in x\n            %2 = 1\n            ? denominator(f, 1) \\\\ Q-denominator\n            %3 = 2\n            ? denominator(f, x) \\\\ as a t_POL in x, seen above\n            %4 = 1\n            ? denominator(f, y) \\\\ as a rational functio""n in y\n            %5 = 2*y\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_365denominator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("denominator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_D,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "denominator") < 0)) __PYX_ERR(4, 5943, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("denominator", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5943, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.denominator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_364denominator(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_364denominator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("denominator", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":5987
 *             %5 = 2*y
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":5988
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":5989
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5990
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5990, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":5989
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":5991
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 5991, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":5992
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":5993
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":5994
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":5995
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = denominator(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":5994
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)
 */
  }

  /* "cypari/auto_instance.pxi":5996
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = denominator(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_instance.pxi":5997
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def deriv(self, x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5943
 *         return new_gen(_ret)
 * 
 *     def denominator(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Denominator of :math:`f`. The meaning of this is clear when :math:`f` is a rational number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.denominator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":5999
 *         return new_gen(_ret)
 * 
 *     def deriv(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Derivative of :math:`x` with respect to the main
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_367deriv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_366deriv[] = "\n        Derivative of :math:`x` with respect to the main\n        variable if :math:`v` is omitted, and with respect to :math:`v` otherwise. The derivative\n        of a scalar type is zero, and the derivative of a vector or matrix is done\n        componentwise. One can use :math:`x'` as a shortcut if the derivative is with\n        respect to the main variable of :math:`x`.\n        \n        By definition, the main variable of a :literal:`t_POLMOD` is the main variable among\n        the coefficients from its two polynomial components (representative and\n        modulus); in other words, assuming a polmod represents an element of\n        :math:`R[X]/(T(X))`, the variable :math:`X` is a mute variable and the derivative is\n        taken with respect to the main variable used in the base ring :math:`R`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_367deriv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deriv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "deriv") < 0)) __PYX_ERR(4, 5999, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("deriv", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 5999, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.deriv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_366deriv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_366deriv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("deriv", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":6013
 *         taken with respect to the main variable used in the base ring :math:`R`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6014
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":6015
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6016
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 6016, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6015
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6017
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = deriv(_x, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 6017, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6018
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = deriv(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6019
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = deriv(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = deriv(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":6020
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = deriv(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def diffop(self, x, v, d, long n=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":5999
 *         return new_gen(_ret)
 * 
 *     def deriv(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Derivative of :math:`x` with respect to the main
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.deriv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6022
 *         return new_gen(_ret)
 * 
 *     def diffop(self, x, v, d, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`v` be a vector of variables, and :math:`d` a vector of the same length,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_369diffop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_368diffop[] = "\n        Let :math:`v` be a vector of variables, and :math:`d` a vector of the same length,\n        return the image of :math:`x` by the :math:`n`-power (:math:`1` if n is not given) of the differential\n        operator :math:`D` that assumes the value :literal:`d[i]` on the variable :literal:`v[i]`.\n        The value of :math:`D` on a scalar type is zero, and :math:`D` applies componentwise to a vector\n        or matrix. When applied to a :literal:`t_POLMOD`, if no value is provided for the variable\n        of the modulus, such value is derived using the implicit function theorem.\n        \n        Some examples:\n        This function can be used to differentiate formal expressions:\n        If :math:`E = \\exp (X^2)` then we have :math:`E' = 2*X*E`. We can derivate :math:`X*exp(X^2)` as follow:\n        \n        ::\n        \n            ? diffop(E*X,[X,E],[1,2*X*E])\n            %1 = (2*X^2 + 1)*E\n        \n        Let :literal:`Sin` and :literal:`Cos` be two function such that :math:`Sin^2+Cos^2 = 1`\n        and :math:`Cos' = -Sin`. We can differentiate :math:`Sin/Cos` as follow,\n        PARI inferring the value of :math:`Sin'` from the equation:\n        \n        ::\n        \n            ? diffop(Mod('Sin/'Cos,'Sin^2+'Cos^2-1),['Cos],[-'Sin])\n            %1 = Mod(1/Cos^2, Sin^2 + (Cos^2 - 1))\n            \n        \n        Compute the Bell polynomials (both complete and partial) via the Faa di Bruno formula:\n        \n        ::\n        \n            Bell(k,n=-1)=\n            {\n             my(var(i)=eval(Str(\"X\",i)));\n             my(x,v,dv);\n             v=vector(k,i,if(i==1,'E,var(i-1)));\n             dv=vector(k,i,if(i==1,'X*var(1)*'E,var(i)));\n             x=diffop('E,v,dv,k)/'E;\n             if(n<0,subst(x,'X,1),polcoeff(x,n,'X))\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_369diffop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_d = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diffop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_d,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diffop", 0, 3, 4, 1); __PYX_ERR(4, 6022, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diffop", 0, 3, 4, 2); __PYX_ERR(4, 6022, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diffop") < 0)) __PYX_ERR(4, 6022, __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_x = values[0];
    __pyx_v_v = values[1];
    __pyx_v_d = values[2];
    if (values[3]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6022, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diffop", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6022, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.diffop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_368diffop(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v, __pyx_v_d, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_368diffop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("diffop", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":6064
 *             }
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         d = objtogen(d)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6065
 *         '''
 *         x = objtogen(x)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6066
 *         x = objtogen(x)
 *         v = objtogen(v)
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6067
 *         v = objtogen(v)
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6067, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6068
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6069
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6070
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6071
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = diffop0(__pyx_v__x, __pyx_v__v, __pyx_v__d, __pyx_v_n);

  /* "cypari/auto_instance.pxi":6072
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def digits(self, x, b=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6022
 *         return new_gen(_ret)
 * 
 *     def diffop(self, x, v, d, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`v` be a vector of variables, and :math:`d` a vector of the same length,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.diffop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6074
 *         return new_gen(_ret)
 * 
 *     def digits(self, x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the digits of :math:`\|x\|` in base :math:`b`, where :math:`x` and :math:`b` are
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_371digits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_370digits[] = "\n        Outputs the vector of the digits of :math:`\\|x\\|` in base :math:`b`, where :math:`x` and :math:`b` are\n        integers (:math:`b = 10` by default). See :literal:`fromdigits` for the reverse\n        operation.\n        \n        ::\n        \n            ? digits(1230)\n            %1 = [1, 2, 3, 0]\n            \n            ? digits(10, 2) \\\\ base 2\n            %2 = [1, 0, 1, 0]\n        \n        By convention, :math:`0` has no digits:\n        \n        ::\n        \n            ? digits(0)\n            %3 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_371digits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("digits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_b,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "digits") < 0)) __PYX_ERR(4, 6074, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("digits", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6074, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.digits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_370digits(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_370digits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b) {
  int __pyx_v__have_b;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("digits", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":6095
 *             %3 = []
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6096
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_2 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_2;

  /* "cypari/auto_instance.pxi":6097
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6098
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6098, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":6097
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6099
 *         if _have_b:
 *             b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 6099, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6100
 *             b = objtogen(b)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6101
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_instance.pxi":6102
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6103
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = digits(_x, _b)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6102
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)
 */
  }

  /* "cypari/auto_instance.pxi":6104
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = digits(__pyx_v__x, __pyx_v__b);

  /* "cypari/auto_instance.pxi":6105
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dilog(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6074
 *         return new_gen(_ret)
 * 
 *     def digits(self, x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the digits of :math:`\|x\|` in base :math:`b`, where :math:`x` and :math:`b` are
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.digits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6107
 *         return new_gen(_ret)
 * 
 *     def dilog(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the dilogarithm of :math:`x`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_373dilog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_372dilog[] = "\n        Principal branch of the dilogarithm of :math:`x`,\n        i.e.\302\240analytic continuation of the power series :math:`\\log_2(x) = \\sum_{n >= 1}x^n/n^2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_373dilog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dilog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dilog") < 0)) __PYX_ERR(4, 6107, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6107, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dilog", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6107, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dilog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_372dilog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_372dilog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("dilog", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":6112
 *         i.e.analytic continuation of the power series :math:`\log_2(x) = \sum_{n >= 1}x^n/n^2`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6113
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6113, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6114
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = dilog(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6115
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dilog(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":6116
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = dilog(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dilog(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6117
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = dilog(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dirdiv(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6107
 *         return new_gen(_ret)
 * 
 *     def dilog(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the dilogarithm of :math:`x`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dilog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6119
 *         return new_gen(_ret)
 * 
 *     def dirdiv(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_375dirdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_374dirdiv[] = "\n        :math:`x` and :math:`y` being vectors of perhaps different\n        lengths but with :math:`y[1] != 0` considered as Dirichlet series, computes\n        the quotient of :math:`x` by :math:`y`, again as a vector.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_375dirdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dirdiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dirdiv", 1, 2, 2, 1); __PYX_ERR(4, 6119, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dirdiv") < 0)) __PYX_ERR(4, 6119, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dirdiv", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6119, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dirdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_374dirdiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_374dirdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("dirdiv", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":6125
 *         the quotient of :math:`x` by :math:`y`, again as a vector.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6126
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6127
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6127, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6128
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirdiv(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6129
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dirdiv(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6130
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirdiv(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dirdiv(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":6131
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirdiv(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dirmul(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6119
 *         return new_gen(_ret)
 * 
 *     def dirdiv(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dirdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6133
 *         return new_gen(_ret)
 * 
 *     def dirmul(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different lengths representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_377dirmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_376dirmul[] = "\n        :math:`x` and :math:`y` being vectors of perhaps different lengths representing\n        the Dirichlet series :math:`\\sum_n x_n n^{-s}` and :math:`\\sum_n y_n n^{-s}`,\n        computes the product of :math:`x` by :math:`y`, again as a vector.\n        \n        ::\n        \n            ? dirmul(vector(10,n,1), vector(10,n,moebius(n)))\n            %1 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n        \n        The product\n        length is the minimum of :math:`\\#\302\240x*\302\240v(y)` and :math:`\\#\302\240y*\302\240v(x)`,\n        where :math:`v(x)` is the index of the first non-zero coefficient.\n        \n        ::\n        \n            ? dirmul([0,1], [0,1]);\n            %2 = [0, 0, 0, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_377dirmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dirmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dirmul", 1, 2, 2, 1); __PYX_ERR(4, 6133, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dirmul") < 0)) __PYX_ERR(4, 6133, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dirmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6133, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dirmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_376dirmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_376dirmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("dirmul", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":6153
 *             %2 = [0, 0, 0, 1]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6154
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6155
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6155, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6156
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirmul(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6157
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dirmul(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6158
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirmul(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dirmul(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":6159
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirmul(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dirzetak(self, nf, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6133
 *         return new_gen(_ret)
 * 
 *     def dirmul(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different lengths representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dirmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6161
 *         return new_gen(_ret)
 * 
 *     def dirzetak(self, nf, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives as a vector the first :math:`b`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_379dirzetak(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_378dirzetak[] = "\n        Gives as a vector the first :math:`b`\n        coefficients of the Dedekind zeta function of the number field :math:`nf`\n        considered as a Dirichlet series.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_379dirzetak(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dirzetak (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_b,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_nf)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("dirzetak", 1, 2, 2, 1); __PYX_ERR(4, 6161, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dirzetak") < 0)) __PYX_ERR(4, 6161, __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_nf = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dirzetak", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dirzetak", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_378dirzetak(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_378dirzetak(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_b) {
  GEN __pyx_v__nf;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("dirzetak", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":6167
 *         considered as a Dirichlet series.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6168
 *         '''
 *         nf = objtogen(nf)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6169
 *         nf = objtogen(nf)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6169, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6170
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = dirzetak(_nf, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6171
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dirzetak(_nf, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6172
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = dirzetak(_nf, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dirzetak(__pyx_v__nf, __pyx_v__b);

  /* "cypari/auto_instance.pxi":6173
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = dirzetak(_nf, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def divisors(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6161
 *         return new_gen(_ret)
 * 
 *     def dirzetak(self, nf, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives as a vector the first :math:`b`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.dirzetak", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6175
 *         return new_gen(_ret)
 * 
 *     def divisors(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_381divisors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_380divisors[] = "\n        Creates a row vector whose components are the\n        divisors of :math:`x`. The factorization of :math:`x` (as output by :literal:`factor`) can\n        be used instead. If :math:`flag = 1`, return pairs :math:`[d, factor (d)]`.\n        \n        By definition, these divisors are the products of the irreducible\n        factors of :math:`n`, as produced by :literal:`factor(n)`, raised to appropriate\n        powers (no negative exponent may occur in the factorization). If :math:`n` is\n        an integer, they are the positive divisors, in increasing order.\n        \n        ::\n        \n            ? divisors(12)\n            %1 = [1, 2, 3, 4, 6, 12]\n            ? divisors(12, 1) \\\\ include their factorization\n            %2 = [[1, matrix(0,2)], [2, Mat([2, 1])], [3, Mat([3, 1])],\n             [4, Mat([2, 2])], [6, [2, 1; 3, 1]], [12, [2, 2; 3, 1]]]\n            \n            ? divisors(x^4 + 2*x^3 + x^2) \\\\ also works for polynomials\n            %3 = [1, x, x^2, x + 1, x^2 + x, x^3 + x^2, x^2 + 2*x + 1,\n             x^3 + 2*x^2 + x, x^4 + 2*x^3 + x^2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_381divisors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divisors (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divisors") < 0)) __PYX_ERR(4, 6175, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6175, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divisors", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6175, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.divisors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_380divisors(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_380divisors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("divisors", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":6198
 *              x^3 + 2*x^2 + x, x^4 + 2*x^3 + x^2]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6199
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = divisors0(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6199, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6200
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = divisors0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6201
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = divisors0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = divisors0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":6202
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = divisors0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def divisorslenstra(self, N, r, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6175
 *         return new_gen(_ret)
 * 
 *     def divisors(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.divisors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6204
 *         return new_gen(_ret)
 * 
 *     def divisorslenstra(self, N, r, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given three integers :math:`N > s > r >= 0` such that :math:`(r,s) = 1`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_383divisorslenstra(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_382divisorslenstra[] = "\n        Given three integers :math:`N > s > r >= 0` such that :math:`(r,s) = 1`\n        and :math:`s^3 > N`, find all divisors :math:`d` of :math:`N` such that :math:`d = r (mod s)`.\n        There are at most :math:`11` such divisors (Lenstra).\n        \n        ::\n        \n            ? N = 245784; r = 19; s = 65 ;\n            ? divisorslenstra(N, r, s)\n            %2 = [19, 84, 539, 1254, 3724, 245784]\n            ? [ d | d <- divisors(N), d % s == r]\n            %3 = [19, 84, 539, 1254, 3724, 245784]\n        \n        When the preconditions are not met, the result is undefined:\n        \n        ::\n        \n            ? N = 4484075232; r = 7; s = 1303; s^3 > N\n            %4 = 0\n            ? divisorslenstra(N, r, s)\n            ? [ d | d <- divisors(N), d % s == r ]\n            %6 = [7, 2613, 9128, 19552, 264516, 3407352, 344928864]\n        \n        (Divisors were missing but :math:`s^3 < N`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_383divisorslenstra(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_r = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divisorslenstra (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_r,&__pyx_n_s_s,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N)) != 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("divisorslenstra", 1, 3, 3, 1); __PYX_ERR(4, 6204, __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("divisorslenstra", 1, 3, 3, 2); __PYX_ERR(4, 6204, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divisorslenstra") < 0)) __PYX_ERR(4, 6204, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_N = values[0];
    __pyx_v_r = values[1];
    __pyx_v_s = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divisorslenstra", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6204, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.divisorslenstra", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_382divisorslenstra(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N, __pyx_v_r, __pyx_v_s);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_382divisorslenstra(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_r, PyObject *__pyx_v_s) {
  GEN __pyx_v__N;
  GEN __pyx_v__r;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("divisorslenstra", 0);
  __Pyx_INCREF(__pyx_v_N);
  __Pyx_INCREF(__pyx_v_r);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":6230
 *         (Divisors were missing but :math:`s^3 < N`.)
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         r = objtogen(r)
 *         s = objtogen(s)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6231
 *         '''
 *         N = objtogen(N)
 *         r = objtogen(r)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_r, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_r, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6232
 *         N = objtogen(N)
 *         r = objtogen(r)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6233
 *         r = objtogen(r)
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _r = (<Gen>r).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6233, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6234
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _r = (<Gen>r).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6235
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _r = (<Gen>r).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_r)->__pyx_base.g;
  __pyx_v__r = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6236
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _r = (<Gen>r).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6237
 *         cdef GEN _r = (<Gen>r).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = divisorslenstra(__pyx_v__N, __pyx_v__r, __pyx_v__s);

  /* "cypari/auto_instance.pxi":6238
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def divrem(self, x, y, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6204
 *         return new_gen(_ret)
 * 
 *     def divisorslenstra(self, N, r, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given three integers :math:`N > s > r >= 0` such that :math:`(r,s) = 1`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.divisorslenstra", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6240
 *         return new_gen(_ret)
 * 
 *     def divrem(self, x, y, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a column vector with two components, the first being the Euclidean
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_385divrem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_384divrem[] = "\n        Creates a column vector with two components, the first being the Euclidean\n        quotient (:literal:`:math:`x` \\\\:math:`y``), the second the Euclidean remainder\n        (:literal:`:math:`x` - (:math:`x`\\\\:math:`y`)*:math:`y``), of the division of :math:`x` by :math:`y`. This avoids the\n        need to do two divisions if one needs both the quotient and the remainder.\n        If :math:`v` is present, and :math:`x`, :math:`y` are multivariate\n        polynomials, divide with respect to the variable :math:`v`.\n        \n        Beware that :literal:`divrem(:math:`x`,:math:`y`)[2]` is in general not the same as\n        :literal:`:math:`x` \\% :math:`y``; no GP operator corresponds to it:\n        \n        ::\n        \n            ? divrem(1/2, 3)[2]\n            %1 = 1/2\n            ? (1/2) % 3\n            %2 = 2\n            ? divrem(Mod(2,9), 3)[2]\n             *** at top-level: divrem(Mod(2,9),3)[2\n             *** ^--------------------\n             *** forbidden division t_INTMOD \\ t_INT.\n            ? Mod(2,9) % 6\n            %3 = Mod(2,3)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_385divrem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divrem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divrem", 0, 2, 3, 1); __PYX_ERR(4, 6240, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divrem") < 0)) __PYX_ERR(4, 6240, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divrem", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6240, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.divrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_384divrem(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_384divrem(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("divrem", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":6265
 *             %3 = Mod(2,3)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6266
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6267
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":6268
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6269
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 6269, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6268
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6270
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 6270, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6271
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = divrem(_x, _y, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6272
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = divrem(_x, _y, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6273
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = divrem(_x, _y, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = divrem(__pyx_v__x, __pyx_v__y, __pyx_v__v);

  /* "cypari/auto_instance.pxi":6274
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = divrem(_x, _y, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def eint1(self, x, n=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6240
 *         return new_gen(_ret)
 * 
 *     def divrem(self, x, y, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a column vector with two components, the first being the Euclidean
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.divrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6276
 *         return new_gen(_ret)
 * 
 *     def eint1(self, x, n=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential integral :math:`\int_x^ oo (e^{-t})/(t)dt =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_387eint1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_386eint1[] = "\n        Exponential integral :math:`\\int_x^ oo (e^{-t})/(t)dt =\n        incgam (0, x)`, where the latter expression extends the function\n        definition from real :math:`x > 0` to all complex :math:`x != 0`.\n        \n        If :math:`n` is present, we must have :math:`x > 0`; the function returns the\n        :math:`n`-dimensional vector :math:`[eint1 (x),...,eint1 (nx)]`. Contrary to\n        other transcendental functions, and to the default case (:math:`n` omitted), the\n        values are correct up to a bounded :emphasis:`absolute`, rather than relative,\n        error :math:`10^{-n}`, where :math:`n` is :literal:`precision`:math:`(x)` if :math:`x` is a :literal:`t_REAL`\n        and defaults to :literal:`realprecision` otherwise. (In the most important\n        application, to the computation of :math:`L`-functions via approximate functional\n        equations, those values appear as weights in long sums and small individual\n        relative errors are less useful than controlling the absolute error.) This is\n        faster than repeatedly calling :literal:`eint1(:math:`i` * x)`, but less precise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_387eint1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_n = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eint1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eint1") < 0)) __PYX_ERR(4, 6276, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_n = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6276, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("eint1", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6276, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.eint1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_386eint1(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_386eint1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_n, long __pyx_v_precision) {
  int __pyx_v__have_n;
  GEN __pyx_v__x;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("eint1", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":6293
 *         faster than repeatedly calling :literal:`eint1(:math:`i` * x)`, but less precise.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6294
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_n = (n is not None)             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             n = objtogen(n)
 */
  __pyx_t_2 = (__pyx_v_n != Py_None);
  __pyx_v__have_n = __pyx_t_2;

  /* "cypari/auto_instance.pxi":6295
 *         x = objtogen(x)
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_n != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6296
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:
 *             n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":6295
 *         x = objtogen(x)
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6297
 *         if _have_n:
 *             n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 6297, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6298
 *             n = objtogen(n)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = NULL
 *         if _have_n:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6299
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             _n = (<Gen>n).g
 */
  __pyx_v__n = NULL;

  /* "cypari/auto_instance.pxi":6300
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_n != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6301
 *         cdef GEN _n = NULL
 *         if _have_n:
 *             _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = veceint1(_x, _n, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6300
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":6302
 *         if _have_n:
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = veceint1(_x, _n, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":6303
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = veceint1(_x, _n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = veceint1(__pyx_v__x, __pyx_v__n, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6304
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = veceint1(_x, _n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellL1(self, E, long r=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6276
 *         return new_gen(_ret)
 * 
 *     def eint1(self, x, n=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential integral :math:`\int_x^ oo (e^{-t})/(t)dt =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.eint1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6306
 *         return new_gen(_ret)
 * 
 *     def ellL1(self, E, long r=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`s = 1` of the derivative of order :math:`r` of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_389ellL1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_388ellL1[] = "\n        Returns the value at :math:`s = 1` of the derivative of order :math:`r` of the\n        :math:`L`-function of the elliptic curve :math:`E`.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); \\\\ order of vanishing is 0\n            ? ellL1(E)\n            %2 = 0.2538418608559106843377589233\n            ? E = ellinit(\"389a1\"); \\\\ order of vanishing is 2\n            ? ellL1(E)\n            %4 = -5.384067311837218089235032414 E-29\n            ? ellL1(E, 1)\n            %5 = 0\n            ? ellL1(E, 2)\n            %6 = 1.518633000576853540460385214\n        \n        The main use of this function, after computing at :emphasis:`low` accuracy the\n        order of vanishing using :literal:`ellanalyticrank`, is to compute the\n        leading term at :emphasis:`high` accuracy to check (or use) the Birch and\n        Swinnerton-Dyer conjecture:\n        \n        ::\n        \n            ? \\p18\n             realprecision = 18 significant digits\n            ? E = ellinit(\"5077a1\"); ellanalyticrank(E)\n            time = 8 ms.\n            %1 = [3, 10.3910994007158041]\n            ? \\p200\n             realprecision = 202 significant digits (200 digits displayed)\n            ? ellL1(E, 3)\n            time = 104 ms.\n            %3 = 10.3910994007158041387518505103609170697263563756570092797[...]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_389ellL1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_r;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellL1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_r,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellL1") < 0)) __PYX_ERR(4, 6306, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_r = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6306, __pyx_L3_error)
    } else {
      __pyx_v_r = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6306, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellL1", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6306, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_388ellL1(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_r, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_388ellL1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_r, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("ellL1", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6342
 *             %3 = 10.3910994007158041387518505103609170697263563756570092797[...]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6343
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6343, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6344
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6345
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":6346
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":6345
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 */
  }

  /* "cypari/auto_instance.pxi":6347
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellL1_bitprec(__pyx_v__E, __pyx_v_r, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6348
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elladd(self, E, z1, z2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6306
 *         return new_gen(_ret)
 * 
 *     def ellL1(self, E, long r=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`s = 1` of the derivative of order :math:`r` of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6350
 *         return new_gen(_ret)
 * 
 *     def elladd(self, E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the points :math:`z1` and :math:`z2` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_391elladd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_390elladd[] = "\n        Sum of the points :math:`z1` and :math:`z2` on the\n        elliptic curve corresponding to :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_391elladd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z1 = 0;
  PyObject *__pyx_v_z2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elladd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z1,&__pyx_n_s_z2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_z1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elladd", 1, 3, 3, 1); __PYX_ERR(4, 6350, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elladd", 1, 3, 3, 2); __PYX_ERR(4, 6350, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elladd") < 0)) __PYX_ERR(4, 6350, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_E = values[0];
    __pyx_v_z1 = values[1];
    __pyx_v_z2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elladd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6350, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elladd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_390elladd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z1, __pyx_v_z2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_390elladd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2) {
  GEN __pyx_v__E;
  GEN __pyx_v__z1;
  GEN __pyx_v__z2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elladd", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z1);
  __Pyx_INCREF(__pyx_v_z2);

  /* "cypari/auto_instance.pxi":6355
 *         elliptic curve corresponding to :math:`E`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6356
 *         '''
 *         E = objtogen(E)
 *         z1 = objtogen(z1)             # <<<<<<<<<<<<<<
 *         z2 = objtogen(z2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6357
 *         E = objtogen(E)
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6358
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6358, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6359
 *         z2 = objtogen(z2)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6360
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = elladd(_E, _z1, _z2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z1)->__pyx_base.g;
  __pyx_v__z1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6361
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elladd(_E, _z1, _z2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z2)->__pyx_base.g;
  __pyx_v__z2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6362
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = elladd(_E, _z1, _z2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elladd(__pyx_v__E, __pyx_v__z1, __pyx_v__z2);

  /* "cypari/auto_instance.pxi":6363
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = elladd(_E, _z1, _z2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellak(self, E, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6350
 *         return new_gen(_ret)
 * 
 *     def elladd(self, E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the points :math:`z1` and :math:`z2` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elladd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z1);
  __Pyx_XDECREF(__pyx_v_z2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6365
 *         return new_gen(_ret)
 * 
 *     def ellak(self, E, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the coefficient :math:`a_n` of the :math:`L`-function of the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_393ellak(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_392ellak[] = "\n        Computes the coefficient :math:`a_n` of the :math:`L`-function of the elliptic curve\n        :math:`E/\\mathbb{Q}`, i.e.\302\240coefficients of a newform of weight 2 by the modularity theorem\n        (Taniyama-Shimura-Weil conjecture). :math:`E` must be an :literal:`ell` structure\n        over :math:`\\mathbb{Q}` as output by :literal:`ellinit`. :math:`E` must be given by an integral model,\n        not necessarily minimal, although a minimal model will make the function\n        faster.\n        \n        ::\n        \n            ? E = ellinit([1,-1,0,4,3]);\n            ? ellak(E, 10)\n            %2 = -3\n            ? e = ellchangecurve(E, [1/5,0,0,0]); \\\\ made not minimal at 5\n            ? ellak(e, 10) \\\\ wasteful but works\n            %3 = -3\n            ? E = ellminimalmodel(e); \\\\ now minimal\n            ? ellak(E, 5)\n            %5 = -3\n        \n        If the model is not minimal at a number of bad primes, then\n        the function will be slower on those :math:`n` divisible by the bad primes.\n        The speed should be comparable for other :math:`n`:\n        \n        ::\n        \n            ? for(i=1,10^6, ellak(E,5))\n            time = 699 ms.\n            ? for(i=1,10^6, ellak(e,5)) \\\\ 5 is bad, markedly slower\n            time = 1,079 ms.\n            \n            ? for(i=1,10^5,ellak(E,5*i))\n            time = 1,477 ms.\n            ? for(i=1,10^5,ellak(e,5*i)) \\\\ still slower but not so much on average\n            time = 1,569 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_393ellak(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellak (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_n,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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellak", 1, 2, 2, 1); __PYX_ERR(4, 6365, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellak") < 0)) __PYX_ERR(4, 6365, __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_E = values[0];
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellak", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6365, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellak", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_392ellak(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_392ellak(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellak", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":6402
 *             time = 1,569 ms.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6403
 *         '''
 *         E = objtogen(E)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6404
 *         E = objtogen(E)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6404, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6405
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = akell(_E, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6406
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = akell(_E, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6407
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = akell(_E, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = akell(__pyx_v__E, __pyx_v__n);

  /* "cypari/auto_instance.pxi":6408
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = akell(_E, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellan(self, E, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6365
 *         return new_gen(_ret)
 * 
 *     def ellak(self, E, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the coefficient :math:`a_n` of the :math:`L`-function of the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellak", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6410
 *         return new_gen(_ret)
 * 
 *     def ellan(self, E, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the vector of the first :math:`n` Fourier coefficients :math:`a_k`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_395ellan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_394ellan[] = "\n        Computes the vector of the first :math:`n` Fourier coefficients :math:`a_k`\n        corresponding to the elliptic curve :math:`E` defined over a number field.\n        If :math:`E` is defined over :math:`\\mathbb{Q}`, the curve may be given by an\n        arbitrary model, not necessarily minimal,\n        although a minimal model will make the function faster. Over a more general\n        number field, the model must be locally minimal at all primes above :math:`2`\n        and :math:`3`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_395ellan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_n,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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellan", 1, 2, 2, 1); __PYX_ERR(4, 6410, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellan") < 0)) __PYX_ERR(4, 6410, __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_E = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6410, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellan", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6410, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_394ellan(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_394ellan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellan", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6420
 *         and :math:`3`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6421
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellan(_E, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6421, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6422
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellan(_E, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6423
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellan(_E, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellan(__pyx_v__E, __pyx_v_n);

  /* "cypari/auto_instance.pxi":6424
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellan(_E, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellanalyticrank(self, E, eps=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6410
 *         return new_gen(_ret)
 * 
 *     def ellan(self, E, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the vector of the first :math:`n` Fourier coefficients :math:`a_k`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6426
 *         return new_gen(_ret)
 * 
 *     def ellanalyticrank(self, E, eps=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the order of vanishing at :math:`s = 1` of the :math:`L`-function of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_397ellanalyticrank(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_396ellanalyticrank[] = "\n        Returns the order of vanishing at :math:`s = 1` of the :math:`L`-function of the\n        elliptic curve :math:`E` and the value of the first non-zero derivative. To\n        determine this order, it is assumed that any value less than :literal:`eps` is\n        zero. If :literal:`eps` is omitted, :math:`2^{-b/2}` is used, where :math:`b`\n        is the current bit precision.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); \\\\ rank 0\n            ? ellanalyticrank(E)\n            %2 = [0, 0.2538418608559106843377589233]\n            ? E = ellinit(\"37a1\"); \\\\ rank 1\n            ? ellanalyticrank(E)\n            %4 = [1, 0.3059997738340523018204836835]\n            ? E = ellinit(\"389a1\"); \\\\ rank 2\n            ? ellanalyticrank(E)\n            %6 = [2, 1.518633000576853540460385214]\n            ? E = ellinit(\"5077a1\"); \\\\ rank 3\n            ? ellanalyticrank(E)\n            %8 = [3, 10.39109940071580413875185035]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_397ellanalyticrank(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_eps = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellanalyticrank (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_eps,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellanalyticrank") < 0)) __PYX_ERR(4, 6426, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_eps = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6426, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellanalyticrank", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6426, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellanalyticrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_396ellanalyticrank(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_eps, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_396ellanalyticrank(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_eps, long __pyx_v_precision) {
  int __pyx_v__have_eps;
  GEN __pyx_v__E;
  GEN __pyx_v__eps;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellanalyticrank", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_eps);

  /* "cypari/auto_instance.pxi":6449
 *             %8 = [3, 10.39109940071580413875185035]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_eps = (eps is not None)
 *         if _have_eps:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6450
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_eps = (eps is not None)             # <<<<<<<<<<<<<<
 *         if _have_eps:
 *             eps = objtogen(eps)
 */
  __pyx_t_2 = (__pyx_v_eps != Py_None);
  __pyx_v__have_eps = __pyx_t_2;

  /* "cypari/auto_instance.pxi":6451
 *         E = objtogen(E)
 *         cdef bint _have_eps = (eps is not None)
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             eps = objtogen(eps)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_eps != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6452
 *         cdef bint _have_eps = (eps is not None)
 *         if _have_eps:
 *             eps = objtogen(eps)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_eps, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6452, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":6451
 *         E = objtogen(E)
 *         cdef bint _have_eps = (eps is not None)
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             eps = objtogen(eps)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6453
 *         if _have_eps:
 *             eps = objtogen(eps)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 6453, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6454
 *             eps = objtogen(eps)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _eps = NULL
 *         if _have_eps:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6455
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL             # <<<<<<<<<<<<<<
 *         if _have_eps:
 *             _eps = (<Gen>eps).g
 */
  __pyx_v__eps = NULL;

  /* "cypari/auto_instance.pxi":6456
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             _eps = (<Gen>eps).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_eps != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6457
 *         cdef GEN _eps = NULL
 *         if _have_eps:
 *             _eps = (<Gen>eps).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_eps)->__pyx_base.g;
    __pyx_v__eps = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6456
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             _eps = (<Gen>eps).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":6458
 *         if _have_eps:
 *             _eps = (<Gen>eps).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6459
 *             _eps = (<Gen>eps).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":6458
 *         if _have_eps:
 *             _eps = (<Gen>eps).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 */
  }

  /* "cypari/auto_instance.pxi":6460
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellanalyticrank_bitprec(__pyx_v__E, __pyx_v__eps, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6461
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellap(self, E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6426
 *         return new_gen(_ret)
 * 
 *     def ellanalyticrank(self, E, eps=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the order of vanishing at :math:`s = 1` of the :math:`L`-function of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellanalyticrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6463
 *         return new_gen(_ret)
 * 
 *     def ellap(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_399ellap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_398ellap[] = "\n        Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached\n        to an elliptic curve :math:`E/K`. If the field :math:`K = \\mathbb{F}_q` is finite, return the\n        trace of Frobenius :math:`t`, defined by the equation :math:`\\#E(\\mathbb{F}_q) = q+1 - t`.\n        \n        For other fields of definition and :math:`p` defining a finite residue field\n        :math:`\\mathbb{F}_q`, return the trace of Frobenius for the reduction of :math:`E`: the argument\n        :math:`p` is best left omitted if :math:`K = \\mathbb{Q}_\\ell` (else we must have :math:`p = \\ell`) and\n        must be a prime number (:math:`K = \\mathbb{Q}`) or prime ideal (:math:`K` a general number field)\n        with residue field :math:`\\mathbb{F}_q` otherwise. The equation need not be minimal\n        or even integral at :math:`p`; of course, a minimal model will be more efficient.\n        \n        For a number field :math:`K`, the trace of Frobenius is the :math:`a_p`\n        coefficient in the Euler product defining the curve :math:`L`-series, whence\n        the function name:\n        \n        .. MATH::\n        \n            L(E/K,s) = \\prod_{bad p} (1-a_p (Np)^{-s})^{-1}\n            \\prod_{good p} (1-a_p (Np)^{-s} + (Np)^{1-2s})^{-1}.\n        \n        When the characteristic of the finite field is large, the availability of\n        the :literal:`seadata` package will speed up the computation.\n        \n        ::\n        \n            ? E = ellinit([0,1]); \\\\ y^2 = x^3 + 0.x + 1, defined over Q\n            ? ellap(E, 7) \\\\ 7 necessary here\n            %2 = -4 \\\\ #E(F_7) = 7+1-(-4) = 12\n            ? ellcard(E, 7)\n            %3 = 12 \\\\ OK\n            \n            ? E = ellinit([0,1], 11); \\\\ defined over F_11\n            ? ellap(E) \\\\ no need to repeat 11\n            %4 = 0\n            ? ellap(E, 11) \\\\ ... but it also works\n            %5 = 0\n            ? ellgroup(E, 13) \\\\ ouch, inconsistent input""!\n             *** at top-level: ellap(E,13)\n             *** ^-----------\n             *** ellap: inconsistent moduli in Rg_to_Fp:\n             11\n             13\n            ? a = ffgen(ffinit(11,3), 'a); \\\\ defines F_q := F_{11^3}\n            ? E = ellinit([a+1,a]); \\\\ y^2 = x^3 + (a+1)x + a, defined over F_q\n            ? ellap(E)\n            %8 = -3\n        \n        If the curve is defined over a more general number field than :math:`\\mathbb{Q}`,\n        the maximal ideal :math:`p` must be explicitly given in :literal:`idealprimedec`\n        format. There is no assumption of local minimality at :math:`p`.\n        \n        ::\n        \n            ? K = nfinit(a^2+1); E = ellinit([1+a,0,1,0,0], K);\n            ? fa = idealfactor(K, E.disc)\n            %2 =\n            [ [5, [-2, 1]~, 1, 1, [2, -1; 1, 2]] 1]\n            \n            [[13, [5, 1]~, 1, 1, [-5, -1; 1, -5]] 2]\n            ? ellap(E, fa[1,1])\n            %3 = -1 \\\\ non-split multiplicative reduction\n            ? ellap(E, fa[2,1])\n            %4 = 1 \\\\ split multiplicative reduction\n            ? P17 = idealprimedec(K,17)[1];\n            ? ellap(E, P17)\n            %6 = 6 \\\\ good reduction\n            ? E2 = ellchangecurve(E, [17,0,0,0]);\n            ? ellap(E2, P17)\n            %8 = 6 \\\\ same, starting from a non-miminal model\n            \n            ? P3 = idealprimedec(K,3)[1];\n            ? ellap(E, P3) \\\\ OK: E is minimal at P3\n            %10 = -2\n            ? E3 = ellchangecurve(E, [3,0,0,0]);\n            ? ellap(E3, P3) \\\\ not integral at P3\n             *** at top-level: ellap(E3,P3)\n             *** ^------------\n             *** ellap: impossible inverse in Rg_to_ff: Mod(0, 3).\n        \n        :strong:`Algorithms used.` If :math:`E/\\mathbb{F}_q` has CM by a principal imaginary\n        quadratic order we use a fast explicit formula (involving essentially\n        Kronecker symbols and Cornacchia's algorithm), in :math:`O(\\log q"")^2` bit\n        operations.\n        Otherwise, we use Shanks-Mestre's baby-step/giant-step method, which runs in\n        time :math:`~{O}(q^{1/4})` using :math:`~{O}(q^{1/4})` storage, hence becomes\n        unreasonable when :math:`q` has about 30\302\240digits. Above this range, the :literal:`SEA`\n        algorithm becomes available, heuristically in :math:`~{O}(\\log q)^4`, and\n        primes of the order of 200\302\240digits become feasible. In small\n        characteristic we use Mestre's (p = 2), Kohel's (p = 3,5,7,13), Satoh-Harley\n        (all in :math:`~{O}(p^{2} n^2)`) or Kedlaya's (in :math:`~{O}(p n^3)`)\n        algorithms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_399ellap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellap") < 0)) __PYX_ERR(4, 6463, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellap", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6463, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_398ellap(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_398ellap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellap", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":6557
 *         algorithms.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6558
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":6559
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6560
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":6559
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6561
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 6561, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6562
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6563
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":6564
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6565
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellap(_E, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6564
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)
 */
  }

  /* "cypari/auto_instance.pxi":6566
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellap(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_instance.pxi":6567
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellbil(self, E, z1, z2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6463
 *         return new_gen(_ret)
 * 
 *     def ellap(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6569
 *         return new_gen(_ret)
 * 
 *     def ellbil(self, E, z1, z2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellheight(E,P,Q)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_401ellbil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_400ellbil[] = "\n        Deprecated alias for :literal:`ellheight(E,P,Q)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_401ellbil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z1 = 0;
  PyObject *__pyx_v_z2 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellbil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z1,&__pyx_n_s_z2,&__pyx_n_s_precision,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_E)) != 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_z1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellbil", 0, 3, 4, 1); __PYX_ERR(4, 6569, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellbil", 0, 3, 4, 2); __PYX_ERR(4, 6569, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellbil") < 0)) __PYX_ERR(4, 6569, __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_E = values[0];
    __pyx_v_z1 = values[1];
    __pyx_v_z2 = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6569, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellbil", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6569, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_400ellbil(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z1, __pyx_v_z2, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_400ellbil(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2, long __pyx_v_precision) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__E;
  GEN __pyx_v__z1;
  GEN __pyx_v__z2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellbil", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z1);
  __Pyx_INCREF(__pyx_v_z2);

  /* "cypari/auto_instance.pxi":6573
 *         Deprecated alias for :literal:`ellheight(E,P,Q)`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)
 *         E = objtogen(E)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6573, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":6574
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         E = objtogen(E)
 *         z1 = objtogen(z1)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":6575
 *         from warnings import warn
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":6576
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)
 *         E = objtogen(E)
 *         z1 = objtogen(z1)             # <<<<<<<<<<<<<<
 *         z2 = objtogen(z2)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z1, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_z1, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":6577
 *         E = objtogen(E)
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_z2, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":6578
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 6578, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6579
 *         z2 = objtogen(z2)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6580
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z2 = (<Gen>z2).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z1)->__pyx_base.g;
  __pyx_v__z1 = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6581
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z2)->__pyx_base.g;
  __pyx_v__z2 = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6582
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":6583
 *         cdef GEN _z2 = (<Gen>z2).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bilhell(__pyx_v__E, __pyx_v__z1, __pyx_v__z2, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6584
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellbsd(self, E, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 6584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6569
 *         return new_gen(_ret)
 * 
 *     def ellbil(self, E, z1, z2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellheight(E,P,Q)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z1);
  __Pyx_XDECREF(__pyx_v_z2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6586
 *         return new_gen(_ret)
 * 
 *     def ellbsd(self, E, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns a real
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_403ellbsd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_402ellbsd[] = "\n        The object :math:`E` being an elliptic curve over a number field, returns a real\n        number :math:`c` such that the BSD conjecture predicts that\n        :math:`L_{E}^{(r)}(1)/r != c R S` where :math:`r` is the rank, :math:`R` the regulator and\n        :math:`S` the cardinal of the Tate-Shafarevich group.\n        \n        ::\n        \n            ? e = ellinit([0,-1,1,-10,-20]); \\\\ rank 0\n            ? ellbsd(e)\n            %2 = 0.25384186085591068433775892335090946105\n            ? lfun(e,1)\n            %3 = 0.25384186085591068433775892335090946104\n            ? e = ellinit([0,0,1,-1,0]); \\\\ rank 1\n            ? P = ellheegner(e);\n            ? ellbsd(e)*ellheight(e,P)\n            %6 = 0.30599977383405230182048368332167647445\n            ? lfun(e,1,1)\n            %7 = 0.30599977383405230182048368332167647445\n            ? e = ellinit([1+a,0,1,0,0],nfinit(a^2+1)); \\\\ rank 0\n            ? ellbsd(e)\n            %9 = 0.42521832235345764503001271536611593310\n            ? lfun(e,1)\n            %10 = 0.42521832235345764503001271536611593309\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_403ellbsd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellbsd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_precision,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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellbsd") < 0)) __PYX_ERR(4, 6586, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6586, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellbsd", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6586, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_402ellbsd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_402ellbsd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellbsd", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6612
 *             %10 = 0.42521832235345764503001271536611593309
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6613
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6613, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6614
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellbsd(_E, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6615
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellbsd(_E, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":6616
 *         cdef GEN _E = (<Gen>E).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellbsd(_E, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellbsd(__pyx_v__E, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6617
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellbsd(_E, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellcard(self, E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6586
 *         return new_gen(_ret)
 * 
 *     def ellbsd(self, E, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns a real
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6619
 *         return new_gen(_ret)
 * 
 *     def ellcard(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_405ellcard(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_404ellcard[] = "\n        Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached\n        to an elliptic curve :math:`E/K`. If :math:`K = \\mathbb{F}_q` is finite, return the order of the\n        group :math:`E(\\mathbb{F}_q)`.\n        \n        ::\n        \n            ? E = ellinit([-3,1], 5); ellcard(E)\n            %1 = 7\n            ? t = ffgen(3^5,'t); E = ellinit([t,t^2+1]); ellcard(E)\n            %2 = 217\n        \n        For other fields of definition and :math:`p` defining a finite residue field\n        :math:`\\mathbb{F}_q`, return the order of the reduction of :math:`E`: the argument :math:`p` is best\n        left omitted if :math:`K = \\mathbb{Q}_\\ell` (else we must have :math:`p = \\ell`) and must be a\n        prime number (:math:`K = \\mathbb{Q}`) or prime ideal (:math:`K` a general number field) with\n        residue field :math:`\\mathbb{F}_q` otherwise. The equation need not be minimal\n        or even integral at :math:`p`; of course, a minimal model will be more efficient.\n        The function considers the group of non-singular points of the reduction\n        of a minimal model of the curve at :math:`p`, so also makes sense when the curve\n        has bad reduction.\n        \n        ::\n        \n            ? E = ellinit([-3,1]);\n            ? factor(E.disc)\n            %2 =\n            [2 4]\n            \n            [3 4]\n            ? ellcard(E, 5) \\\\ as above !\n            %3 = 7\n            ? ellcard(E, 2) \\\\ additive reduction\n            %4 = 2\n        \n        When the characteristic of the finite field is large, the availability of\n        the :literal:`seadata` package will speed the computation. See also :literal:`ellap`\n        for the list of implemented algorithms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_405ellcard(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellcard (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellcard") < 0)) __PYX_ERR(4, 6619, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellcard", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6619, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellcard", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_404ellcard(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_404ellcard(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellcard", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":6659
 *         for the list of implemented algorithms.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6660
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":6661
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6662
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6662, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":6661
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6663
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 6663, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6664
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":6665
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":6666
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":6667
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellcard(_E, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6666
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)
 */
  }

  /* "cypari/auto_instance.pxi":6668
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellcard(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_instance.pxi":6669
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellchangecurve(self, E, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6619
 *         return new_gen(_ret)
 * 
 *     def ellcard(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellcard", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6671
 *         return new_gen(_ret)
 * 
 *     def ellchangecurve(self, E, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the data for the elliptic curve :math:`E`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_407ellchangecurve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_406ellchangecurve[] = "\n        Changes the data for the elliptic curve :math:`E`\n        by changing the coordinates using the vector :literal:`v = [u,r,s,t]`, i.e.\302\240if :math:`x'`\n        and :math:`y'` are the new coordinates, then :math:`x = u^2x'+r`, :math:`y = u^3y'+su^2x'+t`.\n        :math:`E` must be an :literal:`ell` structure as output by :literal:`ellinit`. The special\n        case :math:`v = 1` is also used instead of :math:`[1,0,0,0]` to denote the\n        trivial coordinate change.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_407ellchangecurve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellchangecurve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_v,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_E)) != 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_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellchangecurve", 1, 2, 2, 1); __PYX_ERR(4, 6671, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellchangecurve") < 0)) __PYX_ERR(4, 6671, __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_E = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellchangecurve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6671, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellchangecurve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_406ellchangecurve(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_406ellchangecurve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_v) {
  GEN __pyx_v__E;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellchangecurve", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":6680
 *         trivial coordinate change.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6681
 *         '''
 *         E = objtogen(E)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6682
 *         E = objtogen(E)
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6682, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6683
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangecurve(_E, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6684
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellchangecurve(_E, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6685
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangecurve(_E, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellchangecurve(__pyx_v__E, __pyx_v__v);

  /* "cypari/auto_instance.pxi":6686
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangecurve(_E, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellchangepoint(self, x, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6671
 *         return new_gen(_ret)
 * 
 *     def ellchangecurve(self, E, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the data for the elliptic curve :math:`E`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellchangecurve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6688
 *         return new_gen(_ret)
 * 
 *     def ellchangepoint(self, x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_409ellchangepoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_408ellchangepoint[] = "\n        Changes the coordinates of the point or\n        vector of points :math:`x` using the vector :literal:`v = [u,r,s,t]`, i.e.\302\240if :math:`x'` and\n        :math:`y'` are the new coordinates, then :math:`x = u^2x'+r`, :math:`y = u^3y'+su^2x'+t` (see also\n        :literal:`ellchangecurve`).\n        \n        ::\n        \n            ? E0 = ellinit([1,1]); P0 = [0,1]; v = [1,2,3,4];\n            ? E = ellchangecurve(E0, v);\n            ? P = ellchangepoint(P0,v)\n            %3 = [-2, 3]\n            ? ellisoncurve(E, P)\n            %4 = 1\n            ? ellchangepointinv(P,v)\n            %5 = [0, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_409ellchangepoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellchangepoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellchangepoint", 1, 2, 2, 1); __PYX_ERR(4, 6688, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellchangepoint") < 0)) __PYX_ERR(4, 6688, __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_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellchangepoint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6688, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellchangepoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_408ellchangepoint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_408ellchangepoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellchangepoint", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":6706
 *             %5 = [0, 1]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6707
 *         '''
 *         x = objtogen(x)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6708
 *         x = objtogen(x)
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6708, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6709
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepoint(_x, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6710
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellchangepoint(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6711
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepoint(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellchangepoint(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":6712
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepoint(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellchangepointinv(self, x, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6688
 *         return new_gen(_ret)
 * 
 *     def ellchangepoint(self, x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellchangepoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6714
 *         return new_gen(_ret)
 * 
 *     def ellchangepointinv(self, x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or vector of points :math:`x` using
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_411ellchangepointinv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_410ellchangepointinv[] = "\n        Changes the coordinates of the point or vector of points :math:`x` using\n        the inverse of the isomorphism attached to :literal:`v = [u,r,s,t]`,\n        i.e.\302\240if :math:`x'` and :math:`y'` are the old coordinates, then :math:`x = u^2x'+r`,\n        :math:`y = u^3y'+su^2x'+t` (inverse of :literal:`ellchangepoint`).\n        \n        ::\n        \n            ? E0 = ellinit([1,1]); P0 = [0,1]; v = [1,2,3,4];\n            ? E = ellchangecurve(E0, v);\n            ? P = ellchangepoint(P0,v)\n            %3 = [-2, 3]\n            ? ellisoncurve(E, P)\n            %4 = 1\n            ? ellchangepointinv(P,v)\n            %5 = [0, 1] \\\\ we get back P0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_411ellchangepointinv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellchangepointinv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellchangepointinv", 1, 2, 2, 1); __PYX_ERR(4, 6714, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellchangepointinv") < 0)) __PYX_ERR(4, 6714, __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_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellchangepointinv", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6714, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellchangepointinv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_410ellchangepointinv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_410ellchangepointinv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellchangepointinv", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":6732
 *             %5 = [0, 1] \\ we get back P0
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6733
 *         '''
 *         x = objtogen(x)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6734
 *         x = objtogen(x)
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6734, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6735
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepointinv(_x, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6736
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellchangepointinv(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6737
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepointinv(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellchangepointinv(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":6738
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepointinv(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellconvertname(self, name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6714
 *         return new_gen(_ret)
 * 
 *     def ellchangepointinv(self, x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or vector of points :math:`x` using
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellchangepointinv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6740
 *         return new_gen(_ret)
 * 
 *     def ellconvertname(self, name):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts an elliptic curve name, as found in the :literal:`elldata` database,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_413ellconvertname(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_412ellconvertname[] = "\n        Converts an elliptic curve name, as found in the :literal:`elldata` database,\n        from a string to a triplet :math:`[conductor, isogeny class,\n        index]`. It will also convert a triplet back to a curve name.\n        Examples:\n        \n        ::\n        \n            ? ellconvertname(\"123b1\")\n            %1 = [123, 1, 1]\n            ? ellconvertname(%)\n            %2 = \"123b1\"\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_413ellconvertname(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellconvertname (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_412ellconvertname(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_name));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_412ellconvertname(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name) {
  GEN __pyx_v__name;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellconvertname", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "cypari/auto_instance.pxi":6754
 *             %2 = "123b1"
 *         '''
 *         name = objtogen(name)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _name = (<Gen>name).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_name, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6755
 *         '''
 *         name = objtogen(name)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _name = (<Gen>name).g
 *         cdef GEN _ret = ellconvertname(_name)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6755, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6756
 *         name = objtogen(name)
 *         sig_on()
 *         cdef GEN _name = (<Gen>name).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellconvertname(_name)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_name)->__pyx_base.g;
  __pyx_v__name = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6757
 *         sig_on()
 *         cdef GEN _name = (<Gen>name).g
 *         cdef GEN _ret = ellconvertname(_name)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellconvertname(__pyx_v__name);

  /* "cypari/auto_instance.pxi":6758
 *         cdef GEN _name = (<Gen>name).g
 *         cdef GEN _ret = ellconvertname(_name)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elldivpol(self, E, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6740
 *         return new_gen(_ret)
 * 
 *     def ellconvertname(self, name):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts an elliptic curve name, as found in the :literal:`elldata` database,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellconvertname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6760
 *         return new_gen(_ret)
 * 
 *     def elldivpol(self, E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-division polynomial :math:`f_n` for the curve :math:`E` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_415elldivpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_414elldivpol[] = "\n        :math:`n`-division polynomial :math:`f_n` for the curve :math:`E` in the\n        variable :math:`v`. In standard notation, for any affine point :math:`P = (X,Y)` on the\n        curve, we have\n        \n        .. MATH::\n        \n            [n]P = (\\phi_n(P)\\psi_n(P) : \\omega_n(P) : \\psi_n(P)^3)\n        \n        for some polynomials :math:`\\phi_n,\\omega_n,\\psi_n` in\n        :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6][X,Y]`. We have :math:`f_n(X) = \\psi_n(X)` for :math:`n` odd, and\n        :math:`f_n(X) = \\psi_n(X,Y) (2Y + a_1X+a_3)` for :math:`n` even. We have\n        \n        .. MATH::\n        \n            f_1 = 1, f_2 = 4X^3 + b_2X^2 + 2b_4 X + b_6, f_3 = 3 X^4 + b_2 X^3 + 3b_4 X^2 + 3 b_6 X + b8,\n        \n        .. MATH::\n        \n            f_4 = f_2(2X^6 + b_2 X^5 + 5b_4 X^4 + 10 b_6 X^3 + 10 b_8 X^2 +\n            (b_2b_8-b_4b_6)X + (b_8b_4 - b_6^2)),...\n        \n        For :math:`n >= 2`, the roots of :math:`f_n` are the :math:`X`-coordinates of points in :math:`E[n]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_415elldivpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elldivpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elldivpol", 0, 2, 3, 1); __PYX_ERR(4, 6760, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elldivpol") < 0)) __PYX_ERR(4, 6760, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6760, __pyx_L3_error)
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elldivpol", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6760, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elldivpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_414elldivpol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_n, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_414elldivpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("elldivpol", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6785
 *         For :math:`n >= 2`, the roots of :math:`f_n` are the :math:`X`-coordinates of points in :math:`E[n]`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6786
 *         '''
 *         E = objtogen(E)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":6787
 *         E = objtogen(E)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6788
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 6788, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6787
 *         E = objtogen(E)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6789
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elldivpol(_E, n, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 6789, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6790
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elldivpol(_E, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6791
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elldivpol(_E, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elldivpol(__pyx_v__E, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_instance.pxi":6792
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elldivpol(_E, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elleisnum(self, w, long k, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6760
 *         return new_gen(_ret)
 * 
 *     def elldivpol(self, E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-division polynomial :math:`f_n` for the curve :math:`E` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elldivpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6794
 *         return new_gen(_ret)
 * 
 *     def elleisnum(self, w, long k, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being an even positive integer, computes the numerical value of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_417elleisnum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_416elleisnum[] = "\n        :math:`k` being an even positive integer, computes the numerical value of the\n        Eisenstein series of weight :math:`k` at the lattice :math:`w`, as given by\n        :literal:`ellperiods`, namely\n        \n        .. MATH::\n        \n            (2i \\pi/\\omega_2)^k\n            (1 + 2/\\zeta (1-k) \\sum_{n >= 1} n^{k-1}q^n / (1-q^n)),\n        \n        where :math:`q = \\exp (2i\\pi \\tau)` and :math:`\\tau := \\omega_1/\\omega_2` belongs to the\n        complex upper half-plane. It is also possible to directly input :math:`w =\n        [\\omega_1,\\omega_2]`, or an elliptic curve :math:`E` as given by :literal:`ellinit`.\n        \n        ::\n        \n            ? w = ellperiods([1,I]);\n            ? elleisnum(w, 4)\n            %2 = 2268.8726415508062275167367584190557607\n            ? elleisnum(w, 6)\n            %3 = -3.977978632282564763 E-33\n            ? E = ellinit([1, 0]);\n            ? elleisnum(E, 4, 1)\n            %5 = -47.999999999999999999999999999999999998\n        \n        When :emphasis:`flag` is non-zero and :math:`k = 4` or 6, returns the elliptic invariants :math:`g_2`\n        or :math:`g_3`, such that\n        \n        .. MATH::\n        \n            y^2 = 4x^3 - g_2 x - g_3\n        \n        is a Weierstrass equation for :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_417elleisnum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  long __pyx_v_k;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elleisnum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_k,&__pyx_n_s_flag,&__pyx_n_s_precision,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_w)) != 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_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elleisnum", 0, 2, 4, 1); __PYX_ERR(4, 6794, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elleisnum") < 0)) __PYX_ERR(4, 6794, __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);
        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_w = values[0];
    __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6794, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6794, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6794, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elleisnum", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6794, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elleisnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_416elleisnum(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_k, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_416elleisnum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_k, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elleisnum", 0);
  __Pyx_INCREF(__pyx_v_w);

  /* "cypari/auto_instance.pxi":6829
 *         is a Weierstrass equation for :math:`E`.
 *         '''
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6830
 *         '''
 *         w = objtogen(w)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6830, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6831
 *         w = objtogen(w)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6832
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":6833
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elleisnum(__pyx_v__w, __pyx_v_k, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6834
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elleta(self, w, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6794
 *         return new_gen(_ret)
 * 
 *     def elleisnum(self, w, long k, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being an even positive integer, computes the numerical value of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elleisnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6836
 *         return new_gen(_ret)
 * 
 *     def elleta(self, w, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the quasi-periods :math:`[\eta_1,\eta_2]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_419elleta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_418elleta[] = "\n        Returns the quasi-periods :math:`[\\eta_1,\\eta_2]`\n        attached to the lattice basis :math:`w = [\\omega_1, \\omega_2]`.\n        Alternatively, :emphasis:`w` can be an elliptic curve :math:`E` as output by\n        :literal:`ellinit`, in which case, the quasi periods attached to the period\n        lattice basis :literal:`:math:`E`.omega` (namely, :literal:`:math:`E`.eta`) are returned.\n        \n        ::\n        \n            ? elleta([1, I])\n            %1 = [3.141592653589793238462643383, 9.424777960769379715387930149*I]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_419elleta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elleta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_precision,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_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elleta") < 0)) __PYX_ERR(4, 6836, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6836, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elleta", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6836, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elleta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_418elleta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_418elleta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_precision) {
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elleta", 0);
  __Pyx_INCREF(__pyx_v_w);

  /* "cypari/auto_instance.pxi":6849
 *             %1 = [3.141592653589793238462643383, 9.424777960769379715387930149*I]
 *         '''
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6850
 *         '''
 *         w = objtogen(w)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 6850, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6851
 *         w = objtogen(w)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleta(_w, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_3;

  /* "cypari/auto_instance.pxi":6852
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elleta(_w, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":6853
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleta(_w, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elleta(__pyx_v__w, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":6854
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleta(_w, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformaldifferential(self, E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6836
 *         return new_gen(_ret)
 * 
 *     def elleta(self, w, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the quasi-periods :math:`[\eta_1,\eta_2]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elleta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6856
 *         return new_gen(_ret)
 * 
 *     def ellformaldifferential(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\omega := dx / (2y+a_1x+a_3)` be the invariant differential form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_421ellformaldifferential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_420ellformaldifferential[] = "\n        Let :math:`\\omega := dx / (2y+a_1x+a_3)` be the invariant differential form\n        attached to the model :math:`E` of some elliptic curve (:literal:`ellinit` form),\n        and :math:`\\eta := x(t)\\omega`. Return :math:`n` terms (:literal:`seriesprecision` by default)\n        of :math:`f(t),g(t)` two power series in the formal parameter :math:`t = -x/y` such that\n        :math:`\\omega = f(t) dt`, :math:`\\eta = g(t) dt`:\n        \n        .. MATH::\n        \n            f(t) = 1+a_1 t + (a_1^2 + a_2) t^2 +...,\n            g(t) = t^{-2} +...\n        \n        ::\n        \n             ? E = ellinit([-1,1/4]); [f,g] = ellformaldifferential(E,7,'t);\n             ? f\n             %2 = 1 - 2*t^4 + 3/4*t^6 + O(t^7)\n             ? g\n             %3 = t^-2 - t^2 + 1/2*t^4 + O(t^5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_421ellformaldifferential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformaldifferential (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformaldifferential") < 0)) __PYX_ERR(4, 6856, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6856, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformaldifferential", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6856, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformaldifferential", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_420ellformaldifferential(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_serprec, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_420ellformaldifferential(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellformaldifferential", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6877
 *              %3 = t^-2 - t^2 + 1/2*t^4 + O(t^5)
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef long _n = -1
 *         if n is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6878
 *         '''
 *         E = objtogen(E)
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_instance.pxi":6879
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_n != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6880
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 6880, __pyx_L1_error)
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6879
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6881
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 6881, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6882
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6883
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6884
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":6883
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 */
  }

  /* "cypari/auto_instance.pxi":6885
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformaldifferential(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_instance.pxi":6886
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformalexp(self, E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6856
 *         return new_gen(_ret)
 * 
 *     def ellformaldifferential(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\omega := dx / (2y+a_1x+a_3)` be the invariant differential form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformaldifferential", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6888
 *         return new_gen(_ret)
 * 
 *     def ellformalexp(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The elliptic formal exponential :literal:`Exp` attached to :math:`E` is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_423ellformalexp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_422ellformalexp[] = "\n        The elliptic formal exponential :literal:`Exp` attached to :math:`E` is the\n        isomorphism from the formal additive law to the formal group of :math:`E`. It is\n        normalized so as to be the inverse of the elliptic logarithm (see\n        :literal:`ellformallog`): :math:`Exp o L = \\mathrm{Id}`. Return :math:`n` terms of this\n        power series:\n        \n        ::\n        \n            ? E=ellinit([-1,1/4]); Exp = ellformalexp(E,10,'z)\n            %1 = z + 2/5*z^5 - 3/28*z^7 + 2/15*z^9 + O(z^11)\n            ? L = ellformallog(E,10,'t);\n            ? subst(Exp,z,L)\n            %3 = t + O(t^11)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_423ellformalexp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformalexp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformalexp") < 0)) __PYX_ERR(4, 6888, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6888, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformalexp", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6888, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformalexp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_422ellformalexp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_serprec, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_422ellformalexp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellformalexp", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6904
 *             %3 = t + O(t^11)
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef long _n = -1
 *         if n is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6905
 *         '''
 *         E = objtogen(E)
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_instance.pxi":6906
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_n != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6907
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 6907, __pyx_L1_error)
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6906
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6908
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 6908, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6909
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6910
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6911
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":6910
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 */
  }

  /* "cypari/auto_instance.pxi":6912
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformalexp(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_instance.pxi":6913
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformallog(self, E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6888
 *         return new_gen(_ret)
 * 
 *     def ellformalexp(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The elliptic formal exponential :literal:`Exp` attached to :math:`E` is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformalexp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6915
 *         return new_gen(_ret)
 * 
 *     def ellformallog(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The formal elliptic logarithm is a series :math:`L` in :math:`t K[[t]]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_425ellformallog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_424ellformallog[] = "\n        The formal elliptic logarithm is a series :math:`L` in :math:`t K[[t]]`\n        such that :math:`d L = \\omega = dx / (2y + a_1x + a_3)`, the canonical invariant\n        differential attached to the model :math:`E`. It gives an isomorphism\n        from the formal group of :math:`E` to the additive formal group.\n        \n        ::\n        \n            ? E = ellinit([-1,1/4]); L = ellformallog(E, 9, 't)\n            %1 = t - 2/5*t^5 + 3/28*t^7 + 2/3*t^9 + O(t^10)\n            ? [f,g] = ellformaldifferential(E,8,'t);\n            ? L' - f\n            %3 = O(t^8)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_425ellformallog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformallog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformallog") < 0)) __PYX_ERR(4, 6915, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6915, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformallog", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6915, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_424ellformallog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_serprec, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_424ellformallog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellformallog", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6930
 *             %3 = O(t^8)
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef long _n = -1
 *         if n is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6931
 *         '''
 *         E = objtogen(E)
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_instance.pxi":6932
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_n != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6933
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 6933, __pyx_L1_error)
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6932
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6934
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 6934, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6935
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6936
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6937
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":6936
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 */
  }

  /* "cypari/auto_instance.pxi":6938
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformallog(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_instance.pxi":6939
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformalpoint(self, E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6915
 *         return new_gen(_ret)
 * 
 *     def ellformallog(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The formal elliptic logarithm is a series :math:`L` in :math:`t K[[t]]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6941
 *         return new_gen(_ret)
 * 
 *     def ellformalpoint(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve, return the coordinates :math:`x(t), y(t)` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_427ellformalpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_426ellformalpoint[] = "\n        If :math:`E` is an elliptic curve, return the coordinates :math:`x(t), y(t)` in the\n        formal group of the elliptic curve :math:`E` in the formal parameter :math:`t = -x/y`\n        at :math:`oo`:\n        \n        .. MATH::\n        \n            x = t^{-2} -a_1 t^{-1} - a_2 - a_3 t +...\n        \n        .. MATH::\n        \n            y = - t^{-3} -a_1 t^{-2} - a_2t^{-1} -a_3 +...\n        \n        Return :math:`n` terms (:literal:`seriesprecision` by default) of these two power\n        series, whose coefficients are in :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6]`.\n        \n        ::\n        \n            ? E = ellinit([0,0,1,-1,0]); [x,y] = ellformalpoint(E,8,'t);\n            ? x\n            %2 = t^-2 - t + t^2 - t^4 + 2*t^5 + O(t^6)\n            ? y\n            %3 = -t^-3 + 1 - t + t^3 - 2*t^4 + O(t^5)\n            ? E = ellinit([0,1/2]); ellformalpoint(E,7)\n            %4 = [x^-2 - 1/2*x^4 + O(x^5), -x^-3 + 1/2*x^3 + O(x^4)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_427ellformalpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformalpoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformalpoint") < 0)) __PYX_ERR(4, 6941, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6941, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformalpoint", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6941, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformalpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_426ellformalpoint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_serprec, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_426ellformalpoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellformalpoint", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6968
 *             %4 = [x^-2 - 1/2*x^4 + O(x^5), -x^-3 + 1/2*x^3 + O(x^4)]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef long _n = -1
 *         if n is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6969
 *         '''
 *         E = objtogen(E)
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_instance.pxi":6970
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_n != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6971
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 6971, __pyx_L1_error)
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6970
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":6972
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 6972, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":6973
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":6974
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":6975
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":6974
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 */
  }

  /* "cypari/auto_instance.pxi":6976
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformalpoint(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_instance.pxi":6977
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformalw(self, E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6941
 *         return new_gen(_ret)
 * 
 *     def ellformalpoint(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve, return the coordinates :math:`x(t), y(t)` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformalpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":6979
 *         return new_gen(_ret)
 * 
 *     def ellformalw(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the formal power series :math:`w` attached to the elliptic curve :math:`E`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_429ellformalw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_428ellformalw[] = "\n        Return the formal power series :math:`w` attached to the elliptic curve :math:`E`,\n        in the variable :math:`t`:\n        \n        .. MATH::\n        \n            w(t) = t^3 + a_1 t^4 + (a_2 + a_1^2) t^5 +...+ O(t^{n+3}),\n        \n        which is the formal expansion of :math:`-1/y` in the formal parameter :math:`t := -x/y`\n        at :math:`oo` (take :math:`n = seriesprecision` if :math:`n` is omitted). The\n        coefficients of :math:`w` belong to :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6]`.\n        \n        ::\n        \n            ? E=ellinit([3,2,-4,-2,5]); ellformalw(E, 5, 't)\n            %1 = t^3 + 3*t^4 + 11*t^5 + 35*t^6 + 101*t^7 + O(t^8)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_429ellformalw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformalw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformalw") < 0)) __PYX_ERR(4, 6979, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 6979, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformalw", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 6979, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformalw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_428ellformalw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_serprec, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_428ellformalw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellformalw", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":6997
 *             %1 = t^3 + 3*t^4 + 11*t^5 + 35*t^6 + 101*t^7 + O(t^8)
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef long _n = -1
 *         if n is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":6998
 *         '''
 *         E = objtogen(E)
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_instance.pxi":6999
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_n != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":7000
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 7000, __pyx_L1_error)
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":6999
 *         E = objtogen(E)
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7001
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 7001, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7002
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":7003
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":7004
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":7003
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 */
  }

  /* "cypari/auto_instance.pxi":7005
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformalw(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_instance.pxi":7006
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellfromeqn(self, P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":6979
 *         return new_gen(_ret)
 * 
 *     def ellformalw(self, E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the formal power series :math:`w` attached to the elliptic curve :math:`E`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellformalw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7008
 *         return new_gen(_ret)
 * 
 *     def ellfromeqn(self, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a genus :math:`1` plane curve, defined by the affine equation :math:`f(x,y) = 0`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_431ellfromeqn(PyObject *__pyx_v_self, PyObject *__pyx_v_P); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_430ellfromeqn[] = "\n        Given a genus :math:`1` plane curve, defined by the affine equation :math:`f(x,y) = 0`,\n        return the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a Weierstrass equation\n        for its Jacobian. This allows to recover a Weierstrass model for an elliptic\n        curve given by a general plane cubic or by a binary quartic or biquadratic\n        model. The function implements the :math:`f :--->\302\240f^*` formulae of Artin, Tate\n        and Villegas (Advances in Math. 198 (2005), pp. 366--382).\n        \n        In the example below, the function is used to convert between twisted Edwards\n        coordinates and Weierstrass coordinates.\n        \n        ::\n        \n            ? e = ellfromeqn(a*x^2+y^2 - (1+d*x^2*y^2))\n            %1 = [0, -a - d, 0, -4*d*a, 4*d*a^2 + 4*d^2*a]\n            ? E = ellinit(ellfromeqn(y^2-x^2 - 1 +(121665/121666*x^2*y^2)),2^255-19);\n            ? isprime(ellcard(E) / 8)\n            %3 = 1\n        \n        The elliptic curve attached to the sum of two cubes is given by\n        \n        ::\n        \n            ? ellfromeqn(x^3+y^3 - a)\n            %1 = [0, 0, -9*a, 0, -27*a^2]\n        \n        :strong:`Congruent number problem:.`\n        Let :math:`n` be an integer, if :math:`a^2+b^2 = c^2` and :math:`a b = 2 n`,\n        then by substituting :math:`b` by :math:`2 n/a` in the first equation,\n        we get :math:`((a^2+(2 n/a)^2)-c^2) a^2 = 0`.\n        We set :math:`x = a`, :math:`y = a c`.\n        \n        ::\n        \n            ? En = ellfromeqn((x^2 + (2*n/x)^2 - (y/x)^2)*x^2)\n            %1 = [0, 0, 0, -16*n^2, 0]\n        \n        For example :math:`23` is congruent since the curve has a point of infinite order,\n        namely:\n        \n        ::\n        \n            ? ellheegner( ellinit(subst(En, n, 23)) )\n            %2 = [168100/289, 68053440/4913]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_431ellfromeqn(PyObject *__pyx_v_self, PyObject *__pyx_v_P) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellfromeqn (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_430ellfromeqn(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_P));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_430ellfromeqn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P) {
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellfromeqn", 0);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":7054
 *             %2 = [168100/289, 68053440/4913]
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7055
 *         '''
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellfromeqn(_P)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7055, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7056
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellfromeqn(_P)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7057
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellfromeqn(_P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellfromeqn(__pyx_v__P);

  /* "cypari/auto_instance.pxi":7058
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellfromeqn(_P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellfromj(self, j):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7008
 *         return new_gen(_ret)
 * 
 *     def ellfromeqn(self, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a genus :math:`1` plane curve, defined by the affine equation :math:`f(x,y) = 0`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellfromeqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7060
 *         return new_gen(_ret)
 * 
 *     def ellfromj(self, j):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a fixed elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_433ellfromj(PyObject *__pyx_v_self, PyObject *__pyx_v_j); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_432ellfromj[] = "\n        Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a fixed elliptic curve\n        with :math:`j`-invariant :math:`j`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_433ellfromj(PyObject *__pyx_v_self, PyObject *__pyx_v_j) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellfromj (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_432ellfromj(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_j));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_432ellfromj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_j) {
  GEN __pyx_v__j;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellfromj", 0);
  __Pyx_INCREF(__pyx_v_j);

  /* "cypari/auto_instance.pxi":7065
 *         with :math:`j`-invariant :math:`j`.
 *         '''
 *         j = objtogen(j)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _j = (<Gen>j).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_j, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_j, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7066
 *         '''
 *         j = objtogen(j)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _j = (<Gen>j).g
 *         cdef GEN _ret = ellfromj(_j)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7066, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7067
 *         j = objtogen(j)
 *         sig_on()
 *         cdef GEN _j = (<Gen>j).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellfromj(_j)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_j)->__pyx_base.g;
  __pyx_v__j = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7068
 *         sig_on()
 *         cdef GEN _j = (<Gen>j).g
 *         cdef GEN _ret = ellfromj(_j)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellfromj(__pyx_v__j);

  /* "cypari/auto_instance.pxi":7069
 *         cdef GEN _j = (<Gen>j).g
 *         cdef GEN _ret = ellfromj(_j)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellgenerators(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7060
 *         return new_gen(_ret)
 * 
 *     def ellfromj(self, j):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a fixed elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellfromj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7071
 *         return new_gen(_ret)
 * 
 *     def ellgenerators(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve over the rationals, return a :math:`\mathbb{Z}`-basis of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_435ellgenerators(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_434ellgenerators[] = "\n        If :math:`E` is an elliptic curve over the rationals, return a :math:`\\mathbb{Z}`-basis of the\n        free part of the Mordell-Weil group attached to :math:`E`. This relies on\n        the :literal:`elldata` database being installed and referencing the curve, and so\n        is only available for curves over :math:`\\mathbb{Z}` of small conductors.\n        If :math:`E` is an elliptic curve over a finite field :math:`\\mathbb{F}_q` as output by\n        :literal:`ellinit`, return a minimal set of generators for the group :math:`E(\\mathbb{F}_q)`.\n        \n        :strong:`Caution.` when the group is not cyclic, of shape :math:`\\mathbb{Z}/d_1\\mathbb{Z} x\n        \\mathbb{Z}/d_2\\mathbb{Z}` with :math:`d_2 \\| d_1`, the points :math:`[P,Q]` returned by ellgenerators\n        need not have order :math:`d_1` and :math:`d_2`: it is true that\n        :math:`P` has order :math:`d_1`, but we only know that :math:`Q` is a generator of\n        :math:`E(\\mathbb{F}_q)/ <P>` and that the Weil pairing :math:`w(P,Q)` has order :math:`d_2`,\n        see :literal:`\077\077ellgroup`.\n        If you need generators :math:`[P,R]` with :math:`R` of order :math:`d_2`, find\n        :math:`x` such that :math:`R = Q-[x]P` has order :math:`d_2` by solving\n        the discrete logarithm problem :math:`[d_2]Q = [x]([d_2]P)` in a cyclic group of\n        order :math:`d_1/d_2`. This will be very expensive if :math:`d_1/d_2` has a large\n        prime factor.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_435ellgenerators(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellgenerators (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_434ellgenerators(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_434ellgenerators(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellgenerators", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7092
 *         prime factor.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7093
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellgenerators(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7093, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7094
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellgenerators(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7095
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellgenerators(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellgenerators(__pyx_v__E);

  /* "cypari/auto_instance.pxi":7096
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellgenerators(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellglobalred(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7071
 *         return new_gen(_ret)
 * 
 *     def ellgenerators(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve over the rationals, return a :math:`\mathbb{Z}`-basis of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellgenerators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7098
 *         return new_gen(_ret)
 * 
 *     def ellglobalred(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit` attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_437ellglobalred(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_436ellglobalred[] = "\n        Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit` attached\n        to an elliptic curve defined over a number field. This function calculates\n        the arithmetic conductor and the global Tamagawa number :math:`c`.\n        The result :math:`[N,v,c,F,L]` is slightly different if :math:`E` is defined\n        over :math:`\\mathbb{Q}` (domain :math:`D = 1` in :literal:`ellinit`) or over a number field\n        (domain :math:`D` is a number field structure, including :literal:`nfinit(x)`\n        representing :math:`\\mathbb{Q}` !):\n        \n        - :math:`N` is the arithmetic conductor of the curve,\n        \n        - :math:`v` is an obsolete field, left in place for backward compatibility.\n          If :math:`E` is defined over :math:`\\mathbb{Q}`, :math:`v` gives the coordinate change for :math:`E` to the\n          standard minimal integral model (:literal:`ellminimalmodel` provides it in a\n          cheaper way); if :math:`E` is defined over another number field, :math:`v` gives a\n          coordinate change to an integral model (:literal:`ellintegralmodel` provides it\n          in a cheaper way).\n        \n        - :math:`c` is the product of the local Tamagawa numbers :math:`c_p`, a quantity\n          which enters in the Birch and Swinnerton-Dyer conjecture,\n        \n        - :math:`F` is the factorization of :math:`N`,\n        \n        - :math:`L` is a vector, whose :math:`i`-th entry contains the local data\n          at the :math:`i`-th prime ideal divisor of :math:`N`, i.e.\n          :literal:`L[i] = elllocalred(E,F[i,1])`. If :math:`E` is defined over :math:`\\mathbb{Q}`, the local\n          coordinate change has been deleted and replaced by a 0; if :math:`E` is defined\n          over another number field the local coordinate change to a local minimal\n          model is given relative to the integral model afforded by :math:`v` (so either\n          start from an integral model so that :math:`v`"" be trivial, or apply :math:`v` first).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_437ellglobalred(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellglobalred (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_436ellglobalred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_436ellglobalred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellglobalred", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7130
 *           start from an integral model so that :math:`v` be trivial, or apply :math:`v` first).
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7131
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellglobalred(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7131, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7132
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellglobalred(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7133
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellglobalred(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellglobalred(__pyx_v__E);

  /* "cypari/auto_instance.pxi":7134
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellglobalred(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellgroup(self, E, p=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7098
 *         return new_gen(_ret)
 * 
 *     def ellglobalred(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit` attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellglobalred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7136
 *         return new_gen(_ret)
 * 
 *     def ellgroup(self, E, p=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_439ellgroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_438ellgroup[] = "\n        Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached\n        to an elliptic curve :math:`E/K`. We first describle the function when the field\n        :math:`K = \\mathbb{F}_q` is finite, it computes the structure of the finite abelian group\n        :math:`E(\\mathbb{F}_q)`:\n        \n        - if :math:`flag = 0`, return the structure :math:`[]` (trivial group) or :math:`[d_1]`\n          (non-trivial cyclic group) or :math:`[d_1,d_2]` (non-cyclic group) of\n          :math:`E(\\mathbb{F}_q) ~ \\mathbb{Z}/d_1\\mathbb{Z} x \\mathbb{Z}/d_2\\mathbb{Z}`, with :math:`d_2 \\| d_1`.\n        \n        - if :math:`flag = 1`, return a triple :math:`[h,cyc,gen]`, where\n          :math:`h` is the curve cardinality, :emphasis:`cyc` gives the group structure as a\n          product of cyclic groups (as per :math:`flag = 0`). More precisely, if :math:`d_2 > 1`,\n          the output is :math:`[d_1d_2, [d_1,d_2], [P,Q]]` where :math:`P` is\n          of order :math:`d_1` and :math:`[P,Q]` generates the curve.\n          :strong:`Caution.` It is not guaranteed that :math:`Q` has order :math:`d_2`, which in\n          the worst case requires an expensive discrete log computation. Only that\n          :literal:`ellweilpairing`:math:`(E, P, Q, d_1)` has order :math:`d_2`.\n        \n        For other fields of definition and :math:`p` defining a finite residue field\n        :math:`\\mathbb{F}_q`, return the structure of the reduction of :math:`E`: the argument\n        :math:`p` is best left omitted if :math:`K = \\mathbb{Q}_\\ell` (else we must have :math:`p = \\ell`) and\n        must be a prime number (:math:`K = \\mathbb{Q}`) or prime ideal (:math:`K` a general number field)\n        with residue field :math:`\\mathbb{F}_q` otherwise. The curve is allowed to have bad\n        reduction at :math:`p` and in this case we consider the (cyclic) group of\n        non-singular points for the reduction of a minimal model at :math:`p`.""\n        \n        If :math:`flag = 0`, the equation not be minimal or even integral at :math:`p`; of course,\n        a minimal model will be more efficient.\n        \n        If :math:`flag = 1`, the requested generators depend on the model, which must then\n        be minimal at :math:`p`, otherwise an exception is thrown. Use\n        :literal:`ellintegralmodel` and/or :literal:`ellocalred` first to reduce to this case.\n        \n        ::\n        \n            ? E = ellinit([0,1]); \\\\ y^2 = x^3 + 0.x + 1, defined over Q\n            ? ellgroup(E, 7)\n            %2 = [6, 2] \\\\ Z/6 x Z/2, non-cyclic\n            ? E = ellinit([0,1] * Mod(1,11)); \\\\ defined over F_11\n            ? ellgroup(E) \\\\ no need to repeat 11\n            %4 = [12]\n            ? ellgroup(E, 11) \\\\ ... but it also works\n            %5 = [12]\n            ? ellgroup(E, 13) \\\\ ouch, inconsistent input!\n             *** at top-level: ellgroup(E,13)\n             *** ^--------------\n             *** ellgroup: inconsistent moduli in Rg_to_Fp:\n             11\n             13\n            ? ellgroup(E, 7, 1)\n            %6 = [12, [6, 2], [[Mod(2, 7), Mod(4, 7)], [Mod(4, 7), Mod(4, 7)]]]\n        \n        Let us now consider curves of bad reduction, in this case we return the\n        structure of the (cyclic) group of non-singular points, satisfying\n        :math:`\\#E_{ns}(\\mathbb{F}_p) = p - a_p`:\n        \n        ::\n        \n            ? E = ellinit([0,5]);\n            ? ellgroup(E, 5, 1)\n            %2 = [5, [5], [[Mod(4, 5), Mod(2, 5)]]]\n            ? ellap(E, 5)\n            %3 = 0 \\\\ additive reduction at 5\n            ? E = ellinit([0,-1,0,35,0]);\n            ? ellgroup(E, 5, 1)\n            %5 = [4, [4], [[Mod(2, 5), Mod(2, 5)]]]\n            ? ellap(E, 5)\n            %6 = 1 \\\\ split multiplicative reduction at 5\n            ? ellgroup(E, 7, 1)\n            %7 = [8, [8], [[Mod(3, 7), Mod(5, 7)]]]\n            ? ellap(E, 7)\n            %8 = -1 ""\\\\ non-split multiplicative reduction at 7\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_439ellgroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellgroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellgroup") < 0)) __PYX_ERR(4, 7136, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_p = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7136, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellgroup", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7136, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_438ellgroup(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_438ellgroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_flag) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellgroup", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":7211
 *             %8 = -1 \\ non-split multiplicative reduction at 7
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7212
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":7213
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7214
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7214, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":7213
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7215
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 7215, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7216
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7217
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":7218
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7219
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7218
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 */
  }

  /* "cypari/auto_instance.pxi":7220
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellgroup0(__pyx_v__E, __pyx_v__p, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":7221
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellheegner(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7136
 *         return new_gen(_ret)
 * 
 *     def ellgroup(self, E, p=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7223
 *         return new_gen(_ret)
 * 
 *     def ellheegner(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve over the rationals, assumed to be of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_441ellheegner(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_440ellheegner[] = "\n        Let :math:`E` be an elliptic curve over the rationals, assumed to be of\n        (analytic) rank :math:`1`. This returns a non-torsion rational point on the curve,\n        whose canonical height is equal to the product of the elliptic regulator by the\n        analytic Sha.\n        \n        This uses the Heegner point method, described in Cohen GTM 239; the complexity\n        is proportional to the product of the square root of the conductor and the\n        height of the point (thus, it is preferable to apply it to strong Weil curves).\n        \n        ::\n        \n            ? E = ellinit([-157^2,0]);\n            ? u = ellheegner(E); print(u[1], \"\\n\", u[2])\n            69648970982596494254458225/166136231668185267540804\n            538962435089604615078004307258785218335/67716816556077455999228495435742408\n            ? ellheegner(ellinit([0,1])) \\\\ E has rank 0 !\n             *** at top-level: ellheegner(E=ellinit\n             *** ^--------------------\n             *** ellheegner: The curve has even analytic rank.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_441ellheegner(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellheegner (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_440ellheegner(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_440ellheegner(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellheegner", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7245
 *              *** ellheegner: The curve has even analytic rank.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7246
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellheegner(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7246, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7247
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellheegner(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7248
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellheegner(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellheegner(__pyx_v__E);

  /* "cypari/auto_instance.pxi":7249
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellheegner(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellheight(self, E, P, Q=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7223
 *         return new_gen(_ret)
 * 
 *     def ellheegner(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve over the rationals, assumed to be of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellheegner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7251
 *         return new_gen(_ret)
 * 
 *     def ellheight(self, E, P, Q=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Global Nron-Tate height :math:`h(P)` of the point :math:`P` on the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_443ellheight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_442ellheight[] = "\n        Global N\303\251ron-Tate height :math:`h(P)` of the point :math:`P` on the elliptic curve\n        :math:`E`, defined over :math:`\\mathbb{Q}` or a number field, using the same normalization as\n        Cremona's :emphasis:`Algorithms for modular elliptic curves`. :math:`E` must be an\n        :literal:`ell` as output by :literal:`ellinit`; it needs not be given by a minimal\n        model although the computation will be faster if it is. The height of a\n        torsion point is exactly 0, else a positive real number.\n        \n        If the argument :math:`Q` is present, computes the value of the bilinear\n        form :math:`(h(P+Q)-h(P-Q)) / 4`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_443ellheight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellheight (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_E)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellheight", 0, 2, 4, 1); __PYX_ERR(4, 7251, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellheight") < 0)) __PYX_ERR(4, 7251, __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);
        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_E = values[0];
    __pyx_v_P = values[1];
    __pyx_v_Q = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7251, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellheight", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7251, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_442ellheight(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_P, __pyx_v_Q, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_442ellheight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_precision) {
  int __pyx_v__have_Q;
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellheight", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":7263
 *         form :math:`(h(P+Q)-h(P-Q)) / 4`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7264
 *         '''
 *         E = objtogen(E)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7265
 *         E = objtogen(E)
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             Q = objtogen(Q)
 */
  __pyx_t_2 = (__pyx_v_Q != Py_None);
  __pyx_v__have_Q = __pyx_t_2;

  /* "cypari/auto_instance.pxi":7266
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7267
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 *             Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":7266
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7268
 *         if _have_Q:
 *             Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 7268, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7269
 *             Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7270
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7271
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 */
  __pyx_v__Q = NULL;

  /* "cypari/auto_instance.pxi":7272
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7273
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 *             _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
    __pyx_v__Q = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7272
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":7274
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":7275
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellheight0(__pyx_v__E, __pyx_v__P, __pyx_v__Q, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":7276
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellheightmatrix(self, E, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7251
 *         return new_gen(_ret)
 * 
 *     def ellheight(self, E, P, Q=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Global Nron-Tate height :math:`h(P)` of the point :math:`P` on the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7278
 *         return new_gen(_ret)
 * 
 *     def ellheightmatrix(self, E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector of points, this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_445ellheightmatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_444ellheightmatrix[] = "\n        :math:`x` being a vector of points, this\n        function outputs the Gram matrix of :math:`x` with respect to the N\303\251ron-Tate\n        height, in other words, the :math:`(i,j)` component of the matrix is equal to\n        :literal:`ellbil(:math:`E`,x[:math:`i`],x[:math:`j`])`. The rank of this matrix, at least in some\n        approximate sense, gives the rank of the set of points, and if :math:`x` is a\n        basis of the Mordell-Weil group of :math:`E`, its determinant is equal to\n        the regulator of :math:`E`. Note our height normalization follows Cremona's\n        :emphasis:`Algorithms for modular elliptic curves`: this matrix should be divided\n        by 2 to be in accordance with, e.g., Silverman's normalizations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_445ellheightmatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellheightmatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellheightmatrix", 0, 2, 3, 1); __PYX_ERR(4, 7278, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellheightmatrix") < 0)) __PYX_ERR(4, 7278, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7278, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellheightmatrix", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7278, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_444ellheightmatrix(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_444ellheightmatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellheightmatrix", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":7290
 *         by 2 to be in accordance with, e.g., Silverman's normalizations.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7291
 *         '''
 *         E = objtogen(E)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7292
 *         E = objtogen(E)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7292, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7293
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7294
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7295
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":7296
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellheightmatrix(__pyx_v__E, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":7297
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellidentify(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7278
 *         return new_gen(_ret)
 * 
 *     def ellheightmatrix(self, E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector of points, this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7299
 *         return new_gen(_ret)
 * 
 *     def ellidentify(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Look up the elliptic curve :math:`E`, defined by an arbitrary model over :math:`\mathbb{Q}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_447ellidentify(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_446ellidentify[] = "\n        Look up the elliptic curve :math:`E`, defined by an arbitrary model over :math:`\\mathbb{Q}`,\n        in the :literal:`elldata` database.\n        Return :literal:`[[N, M, G], C]` where :math:`N` is the curve name in Cremona's\n        elliptic curve database, :math:`M` is the minimal model, :math:`G` is a :math:`\\mathbb{Z}`-basis of\n        the free part of the Mordell-Weil group :math:`E(\\mathbb{Q})` and :math:`C` is the\n        change of coordinates change, suitable for :literal:`ellchangecurve`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_447ellidentify(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellidentify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_446ellidentify(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_446ellidentify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellidentify", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7308
 *         change of coordinates change, suitable for :literal:`ellchangecurve`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7309
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellidentify(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7309, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7310
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellidentify(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7311
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellidentify(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellidentify(__pyx_v__E);

  /* "cypari/auto_instance.pxi":7312
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellidentify(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellinit(self, x, D=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7299
 *         return new_gen(_ret)
 * 
 *     def ellidentify(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Look up the elliptic curve :math:`E`, defined by an arbitrary model over :math:`\mathbb{Q}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellidentify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7314
 *         return new_gen(_ret)
 * 
 *     def ellinit(self, x, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize an :literal:`ell` structure, attached to the elliptic curve :math:`E`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_449ellinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_448ellinit[] = "\n        Initialize an :literal:`ell` structure, attached to the elliptic curve :math:`E`.\n        :math:`E` is either\n        \n        - a :math:`5`-component vector :math:`[a_1,a_2,a_3,a_4,a_6]` defining the elliptic\n          curve with Weierstrass equation\n          \n        \n        .. MATH::\n        \n            Y^2 + a_1 XY + a_3 Y = X^3 + a_2 X^2 + a_4 X + a_6,\n        \n        - a :math:`2`-component vector :math:`[a_4,a_6]` defining the elliptic\n          curve with short Weierstrass equation\n          \n        \n        .. MATH::\n        \n            Y^2 = X^3 + a_4 X + a_6,\n        \n        - a character string in Cremona's notation, e.g. :literal:`\"11a1\"`, in which\n          case the curve is retrieved from the :literal:`elldata` database if available.\n        \n        The optional argument :math:`D` describes the domain over which the curve is\n        defined:\n        \n        - the :literal:`t_INT` :math:`1` (default): the field of rational numbers :math:`\\mathbb{Q}`.\n        \n        - a :literal:`t_INT` :math:`p`, where :math:`p` is a prime number: the prime finite field\n          :math:`\\mathbb{F}_p`.\n        \n        - an :literal:`t_INTMOD` :literal:`Mod(a, p)`, where :math:`p` is a prime number: the\n          prime finite field :math:`\\mathbb{F}_p`.\n        \n        - a :literal:`t_FFELT`, as returned by :literal:`ffgen`: the corresponding finite\n          field :math:`\\mathbb{F}_q`.\n        \n        - a :literal:`t_PADIC`, :math:`O(p^n)`: the field :math:`\\mathbb{Q}_p`, where :math:`p`-adic quantities\n          will be computed to a relative accuracy of :math:`n` digits. We advise to input a\n          model defined over :math:`\\mathbb{Q}` for such curves. In any case, if you input an\n          approximate model with :literal:`t_PADIC` coefficients, it will be replaced by a lift\n          to :math:`\\mathbb{Q}` (an exact model \"close\" to the one that was input) and all quantities\n          will ""then be computed in terms of this lifted model, at the given accuracy.\n        \n        - a :literal:`t_REAL` :math:`x`: the field :math:`\\mathbb{C}` of complex numbers, where floating\n          point quantities are by default computed to a relative accuracy of\n          :literal:`precision`:math:`(x)`. If no such argument is given, the value of\n          :literal:`realprecision` at the time :literal:`ellinit` is called will be used.\n        \n        - a number field :math:`K`, given by a :literal:`nf` or :literal:`bnf` structure; a\n          :literal:`bnf` is required for :literal:`ellminimalmodel`.\n        \n        - a prime ideal :math:`p`, given by a :literal:`prid` structure; valid if\n          :math:`x` is a curve defined over a number field :math:`K` and the equation is integral\n          and minimal at :math:`p`.\n        \n        This argument :math:`D` is indicative: the curve coefficients are checked for\n        compatibility, possibly changing :math:`D`; for instance if :math:`D = 1` and\n        an :literal:`t_INTMOD` is found. If inconsistencies are detected, an error is\n        raised:\n        \n        ::\n        \n            ? ellinit([1 + O(5), 1], O(7));\n             *** at top-level: ellinit([1+O(5),1],O\n             *** ^--------------------\n             *** ellinit: inconsistent moduli in ellinit: 7 != 5\n        \n        If the curve coefficients are too general to fit any of the\n        above domain categories, only basic operations, such as point addition, will\n        be supported later.\n        \n        If the curve (seen over the domain :math:`D`) is singular, fail and return an\n        empty vector :math:`[]`.\n        \n        ::\n        \n            ? E = ellinit([0,0,0,0,1]); \\\\ y^2 = x^3 + 1, over Q\n            ? E = ellinit([0,1]); \\\\ the same curve, short form\n            ? E = ellinit(\"36a1\"); \\\\ sill the same curve, Cremona's notations\n            ? E = ellinit([0,1], 2) \\\\ over F2: sin""gular curve\n            %4 = []\n            ? E = ellinit(['a4,'a6] * Mod(1,5)); \\\\ over F_5[a4,a6], basic support !\n        \n        The result of :literal:`ellinit` is an :emphasis:`ell` structure. It contains at least\n        the following information in its components:\n        \n        .. MATH::\n        \n            a_1,a_2,a_3,a_4,a_6,b_2,b_4,b_6,b_8,c_4,c_6,\\Delta,j.\n        \n        All are accessible via member functions. In particular, the discriminant is\n        :literal:`:math:`E`.disc`, and the :math:`j`-invariant is :literal:`:math:`E`.j`.\n        \n        ::\n        \n            ? E = ellinit([a4, a6]);\n            ? E.disc\n            %2 = -64*a4^3 - 432*a6^2\n            ? E.j\n            %3 = -6912*a4^3/(-4*a4^3 - 27*a6^2)\n        \n        Further components contain domain-specific data, which are in general dynamic:\n        only computed when needed, and then cached in the structure.\n        \n        ::\n        \n            ? E = ellinit([2,3], 10^60+7); \\\\ E over F_p, p large\n            ? ellap(E)\n            time = 4,440 ms.\n            %2 = -1376268269510579884904540406082\n            ? ellcard(E); \\\\ now instantaneous !\n            time = 0 ms.\n            ? ellgenerators(E);\n            time = 5,965 ms.\n            ? ellgenerators(E); \\\\ second time instantaneous\n            time = 0 ms.\n        \n        See the description of member functions related to elliptic curves at the\n        beginning of this section.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_449ellinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_D = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_D,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellinit") < 0)) __PYX_ERR(4, 7314, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_D = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7314, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellinit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7314, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_448ellinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_D, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_448ellinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_D, long __pyx_v_precision) {
  int __pyx_v__have_D;
  GEN __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellinit", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":7436
 *         beginning of this section.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7437
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":7438
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7439
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7439, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":7438
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7440
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 7440, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7441
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7442
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":7443
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7444
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellinit(_x, _D, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7443
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":7445
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellinit(_x, _D, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":7446
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellinit(_x, _D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellinit(__pyx_v__x, __pyx_v__D, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":7447
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellinit(_x, _D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisogeny(self, E, G, long only_image=0, x=None, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7314
 *         return new_gen(_ret)
 * 
 *     def ellinit(self, x, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize an :literal:`ell` structure, attached to the elliptic curve :math:`E`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7449
 *         return new_gen(_ret)
 * 
 *     def ellisogeny(self, E, G, long only_image=0, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E`, a finite subgroup :math:`G` of :math:`E` is given either
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_451ellisogeny(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_450ellisogeny[] = "\n        Given an elliptic curve :math:`E`, a finite subgroup :math:`G` of :math:`E` is given either\n        as a generating point :math:`P` (for a cyclic :math:`G`) or as a polynomial whose roots\n        vanish on the :math:`x`-coordinates of the non-zero elements of :math:`G` (general case\n        and more efficient if available). This function returns the\n        :math:`[a_1,a_2,a_3,a_4,a_6]` invariants of the quotient elliptic curve :math:`E/G` and\n        (if :emphasis:`only_image` is zero (the default)) a vector of rational\n        functions :math:`[f, g, h]` such that the isogeny :math:`E \\to E/G` is given by :math:`(x,y)\n        :---> (f(x)/h(x)^2, g(x,y)/h(x)^3)`.\n        \n        ::\n        \n            ? E = ellinit([0,1]);\n            ? elltors(E)\n            %2 = [6, [6], [[2, 3]]]\n            ? ellisogeny(E, [2,3], 1) \\\\ Weierstrass model for E/<P>\n            %3 = [0, 0, 0, -135, -594]\n            ? ellisogeny(E,[-1,0])\n            %4 = [[0,0,0,-15,22], [x^3+2*x^2+4*x+3, y*x^3+3*y*x^2-2*y, x+1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_451ellisogeny(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_G = 0;
  long __pyx_v_only_image;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisogeny (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_G,&__pyx_n_s_only_image,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  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_E)) != 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_G)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellisogeny", 0, 2, 5, 1); __PYX_ERR(4, 7449, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_only_image);
          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_x);
          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_y);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellisogeny") < 0)) __PYX_ERR(4, 7449, __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_E = values[0];
    __pyx_v_G = values[1];
    if (values[2]) {
      __pyx_v_only_image = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_only_image == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7449, __pyx_L3_error)
    } else {
      __pyx_v_only_image = ((long)0);
    }
    __pyx_v_x = values[3];
    __pyx_v_y = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellisogeny", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7449, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisogeny", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_450ellisogeny(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_G, __pyx_v_only_image, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_450ellisogeny(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_G, long __pyx_v_only_image, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  long __pyx_v__x;
  long __pyx_v__y;
  GEN __pyx_v__E;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellisogeny", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":7470
 *             %4 = [[0,0,0,-15,22], [x^3+2*x^2+4*x+3, y*x^3+3*y*x^2-2*y, x+1]]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         G = objtogen(G)
 *         cdef long _x = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7471
 *         '''
 *         E = objtogen(E)
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         cdef long _x = -1
 *         if x is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7472
 *         E = objtogen(E)
 *         G = objtogen(G)
 *         cdef long _x = -1             # <<<<<<<<<<<<<<
 *         if x is not None:
 *             _x = get_var(x)
 */
  __pyx_v__x = -1L;

  /* "cypari/auto_instance.pxi":7473
 *         G = objtogen(G)
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         cdef long _y = -1
 */
  __pyx_t_2 = (__pyx_v_x != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":7474
 *         cdef long _x = -1
 *         if x is not None:
 *             _x = get_var(x)             # <<<<<<<<<<<<<<
 *         cdef long _y = -1
 *         if y is not None:
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_x); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 7474, __pyx_L1_error)
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7473
 *         G = objtogen(G)
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         cdef long _y = -1
 */
  }

  /* "cypari/auto_instance.pxi":7475
 *         if x is not None:
 *             _x = get_var(x)
 *         cdef long _y = -1             # <<<<<<<<<<<<<<
 *         if y is not None:
 *             _y = get_var(y)
 */
  __pyx_v__y = -1L;

  /* "cypari/auto_instance.pxi":7476
 *             _x = get_var(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_y != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7477
 *         cdef long _y = -1
 *         if y is not None:
 *             _y = get_var(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_y); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 7477, __pyx_L1_error)
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7476
 *             _x = get_var(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7478
 *         if y is not None:
 *             _y = get_var(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 7478, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7479
 *             _y = get_var(y)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":7480
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_6;

  /* "cypari/auto_instance.pxi":7481
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisogeny(__pyx_v__E, __pyx_v__G, __pyx_v_only_image, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":7482
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisogenyapply(self, f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7449
 *         return new_gen(_ret)
 * 
 *     def ellisogeny(self, E, G, long only_image=0, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E`, a finite subgroup :math:`G` of :math:`E` is given either
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisogeny", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7484
 *         return new_gen(_ret)
 * 
 *     def ellisogenyapply(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an isogeny of elliptic curves :math:`f:E'\to E` (being the result of a call
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_453ellisogenyapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_452ellisogenyapply[] = "\n        Given an isogeny of elliptic curves :math:`f:E'\\to E` (being the result of a call\n        to :literal:`ellisogeny`), apply :math:`f` to :math:`g`:\n        \n        - if :math:`g` is a point :math:`P` in the domain of :math:`f`, return the image :math:`f(P)`;\n        \n        - if :math:`g:E\"\\to E'` is a compatible isogeny, return the composite\n          isogeny :math:`f o g: E\"\\to E`.\n        \n        ::\n        \n            ? one = ffgen(101, 't)^0;\n            ? E = ellinit([6, 53, 85, 32, 34] * one);\n            ? P = [84, 71] * one;\n            ? ellorder(E, P)\n            %4 = 5\n            ? [F, f] = ellisogeny(E, P); \\\\ f: E->F = E/<P>\n            ? ellisogenyapply(f, P)\n            %6 = [0]\n            ? F = ellinit(F);\n            ? Q = [89, 44] * one;\n            ? ellorder(F, Q)\n            %9 = 2\n            ? [G, g] = ellisogeny(F, Q); \\\\ g: F->G = F/<Q>\n            ? gof = ellisogenyapply(g, f); \\\\ gof: E -> G\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_453ellisogenyapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisogenyapply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_g,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_f)) != 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_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellisogenyapply", 1, 2, 2, 1); __PYX_ERR(4, 7484, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellisogenyapply") < 0)) __PYX_ERR(4, 7484, __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_f = values[0];
    __pyx_v_g = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellisogenyapply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7484, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisogenyapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_452ellisogenyapply(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_g);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_452ellisogenyapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellisogenyapply", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_instance.pxi":7511
 *             ? gof = ellisogenyapply(g, f); \\ gof: E -> G
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         g = objtogen(g)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7512
 *         '''
 *         f = objtogen(f)
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7513
 *         f = objtogen(f)
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7513, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7514
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ellisogenyapply(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7515
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisogenyapply(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7516
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ellisogenyapply(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisogenyapply(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_instance.pxi":7517
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ellisogenyapply(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisomat(self, E, long p=0, long fl=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7484
 *         return new_gen(_ret)
 * 
 *     def ellisogenyapply(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an isogeny of elliptic curves :math:`f:E'\to E` (being the result of a call
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisogenyapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7519
 *         return new_gen(_ret)
 * 
 *     def ellisomat(self, E, long p=0, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over a number field, compute
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_455ellisomat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_454ellisomat[] = "\n        Given an elliptic curve :math:`E` defined over a number field, compute\n        representatives of the isomorphism classes of elliptic curves :math:`\\mathbb{Q}`-isogenous\n        to :math:`E`. The function returns a vector :math:`[L,M]` where :math:`L` is a list of triples\n        :math:`[E_i, f_i, g_i]`, where :math:`E_i` is an elliptic curve in :math:`[a_4,a_6]` form,\n        :math:`f_i: E \\to E_i` is a rational isogeny, :math:`g_i: E_i \\to E` is the dual isogeny\n        of :math:`f_i`, and :math:`M` is the matrix such that :math:`M_{i,j}` is the degree of the\n        isogeny between :math:`E_i` and :math:`E_j`. Furthermore the first curve :math:`E_1` is\n        isomorphic to :math:`E` by :math:`f_1`. If the flag :math:`fl = 1`, the :math:`f_i` and :math:`g_i` are\n        not computed, which saves time, and :math:`L` is the list of the curves :math:`E_i`.\n        If :math:`p` is set, it must be a prime number; in this which case only isogenies of\n        degree a power of :math:`p` are considered.\n        Over a number field, the possible isogeny degrees are determined by\n        Billerey algorithm. As a consequence, CM curves over a number field are not\n        fully supported.\n        \n        ::\n        \n            ? E = ellinit(\"14a1\");\n            ? [L,M] = ellisomat(E);\n            ? LE = apply(x->x[1], L) \\\\ list of curves\n            %3 = [[215/48,-5291/864],[-675/16,6831/32],[-8185/48,-742643/864],\n             [-1705/48,-57707/864],[-13635/16,306207/32],[-131065/48,-47449331/864]]\n            ? L[2][2] \\\\ isogeny f_2\n            %4 = [x^3+3/4*x^2+19/2*x-311/12,\n             1/2*x^4+(y+1)*x^3+(y-4)*x^2+(-9*y+23)*x+(55*y+55/2),x+1/3]\n            ? L[2][3] \\\\ dual isogeny g_2\n            %5 = [1/9*x^3-1/4*x^2-141/16*x+5613/64,\n             -1/18*x^4+(1/27*y-1/3)*x^3+(-1/12*y+87/16)*x^2+(49/16*y-48)*x\n             +(-3601/64*y+16947/512),x-3/4]\n            ? apply(E->ellidentify(ellinit(E))[1][1], LE)\n      ""      %6 = [\"14a1\",\"14a4\",\"14a3\",\"14a2\",\"14a6\",\"14a5\"]\n            ? M\n            %7 =\n            [1 3 3 2 6 6]\n            \n            [3 1 9 6 2 18]\n            \n            [3 9 1 6 18 2]\n            \n            [2 6 6 1 3 3]\n            \n            [6 2 18 3 1 9]\n            \n            [6 18 2 3 9 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_455ellisomat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_p;
  long __pyx_v_fl;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisomat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_fl,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellisomat") < 0)) __PYX_ERR(4, 7519, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_p = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7519, __pyx_L3_error)
    } else {
      __pyx_v_p = ((long)0);
    }
    if (values[2]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7519, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellisomat", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7519, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisomat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_454ellisomat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_fl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_454ellisomat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_p, long __pyx_v_fl) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellisomat", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7566
 *             [6 18 2 3 9 1]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7567
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisomat(_E, p, fl)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7567, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7568
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisomat(_E, p, fl)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7569
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisomat(_E, p, fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisomat(__pyx_v__E, __pyx_v_p, __pyx_v_fl);

  /* "cypari/auto_instance.pxi":7570
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisomat(_E, p, fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisoncurve(self, E, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7519
 *         return new_gen(_ret)
 * 
 *     def ellisomat(self, E, long p=0, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over a number field, compute
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisomat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7572
 *         return new_gen(_ret)
 * 
 *     def ellisoncurve(self, E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives 1 (i.e.true) if the point :math:`z` is on the elliptic curve :math:`E`, 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_457ellisoncurve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_456ellisoncurve[] = "\n        Gives 1 (i.e.\302\240true) if the point :math:`z` is on the elliptic curve :math:`E`, 0\n        otherwise. If :math:`E` or :math:`z` have imprecise coefficients, an attempt is made to\n        take this into account, i.e.\302\240an imprecise equality is checked, not a precise\n        one. It is allowed for :math:`z` to be a vector of points in which case a vector\n        (of the same type) is returned.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_457ellisoncurve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisoncurve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z,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_E)) != 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("ellisoncurve", 1, 2, 2, 1); __PYX_ERR(4, 7572, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellisoncurve") < 0)) __PYX_ERR(4, 7572, __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_E = values[0];
    __pyx_v_z = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellisoncurve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7572, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisoncurve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_456ellisoncurve(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_456ellisoncurve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellisoncurve", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":7580
 *         (of the same type) is returned.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7581
 *         '''
 *         E = objtogen(E)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7582
 *         E = objtogen(E)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7582, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7583
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellisoncurve(_E, _z)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7584
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisoncurve(_E, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7585
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellisoncurve(_E, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisoncurve(__pyx_v__E, __pyx_v__z);

  /* "cypari/auto_instance.pxi":7586
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellisoncurve(_E, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisotree(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7572
 *         return new_gen(_ret)
 * 
 *     def ellisoncurve(self, E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives 1 (i.e.true) if the point :math:`z` is on the elliptic curve :math:`E`, 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisoncurve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7588
 *         return new_gen(_ret)
 * 
 *     def ellisotree(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over :math:`\mathbb{Q}` or a set of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_459ellisotree(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_458ellisotree[] = "\n        Given an elliptic curve :math:`E` defined over :math:`\\mathbb{Q}` or a set of\n        :math:`\\mathbb{Q}`-isogenous curves as given by :literal:`ellisomat`, return a pair :math:`[L,M]` where\n        \n        - :math:`L` lists the minimal models of the isomorphism classes of elliptic\n          curves :math:`\\mathbb{Q}`-isogenous to :math:`E` (or in the set of isogenous curves),\n        \n        - :math:`M` is the adjacency matrix of the prime degree isogenies tree:\n          there is an edge from :math:`E_i` to :math:`E_j` if there is an isogeny :math:`E_i \\to E_j` of\n          prime degree such that the N\303\251ron differential forms are preserved.\n        \n        ::\n        \n            ? E = ellinit(\"14a1\");\n            ? [L,M] = ellisotree(E);\n            ? M\n            %3 =\n            [0 0 3 2 0 0]\n            \n            [3 0 0 0 2 0]\n            \n            [0 0 0 0 0 2]\n            \n            [0 0 0 0 0 3]\n            \n            [0 0 0 3 0 0]\n            \n            [0 0 0 0 0 0]\n            ? [L2,M2] = ellisotree(ellisomat(E,2,1));\n            %4 =\n            [0 2]\n            \n            [0 0]\n            ? [L3,M3] = ellisotree(ellisomat(E,3,1));\n            ? M3\n            %6 =\n            [0 0 3]\n            \n            [3 0 0]\n            \n            [0 0 0]\n        \n        Compare with the result of :literal:`ellisomat`.\n        \n        ::\n        \n            ? [L,M]=ellisomat(E,,1);\n            ? M\n            %7 =\n            [1 3 3 2 6 6]\n            \n            [3 1 9 6 2 18]\n            \n            [3 9 1 6 18 2]\n            \n            [2 6 6 1 3 3]\n            \n            [6 2 18 3 1 9]\n            \n            [6 18 2 3 9 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_459ellisotree(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisotree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_458ellisotree(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_458ellisotree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellisotree", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7650
 *             [6 18 2 3 9 1]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7651
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisotree(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7651, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7652
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisotree(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7653
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisotree(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisotree(__pyx_v__E);

  /* "cypari/auto_instance.pxi":7654
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisotree(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellissupersingular(self, E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7588
 *         return new_gen(_ret)
 * 
 *     def ellisotree(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over :math:`\mathbb{Q}` or a set of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellisotree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7656
 *         return new_gen(_ret)
 * 
 *     def ellissupersingular(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return 1 if the elliptic curve :math:`E` defined over a number field, :math:`\mathbb{Q}_p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_461ellissupersingular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_460ellissupersingular[] = "\n        Return 1 if the elliptic curve :math:`E` defined over a number field, :math:`\\mathbb{Q}_p`\n        or a finite field is supersingular at :math:`p`, and :math:`0` otherwise.\n        If the curve is defined over a number field, :math:`p` must be explicitly given,\n        and must be a prime number, resp.\302\240a maximal ideal, if the curve is defined\n        over :math:`\\mathbb{Q}`, resp.\302\240a general number field: we return :math:`1` if and only if :math:`E`\n        has supersingular good reduction at :math:`p`.\n        \n        Alternatively, :math:`E` can be given by its :math:`j`-invariant in a finite field. In\n        this case :math:`p` must be omitted.\n        \n        ::\n        \n            ? setrand(1); \\\\ make the choice of g deterministic\n            ? g = ffprimroot(ffgen(7^5))\n            %1 = 4*x^4 + 5*x^3 + 6*x^2 + 5*x + 6\n            ? [g^n | n <- [1 .. 7^5 - 1], ellissupersingular(g^n)]\n            %2 = [6]\n            \n            ? K = nfinit(y^3-2); P = idealprimedec(K, 2)[1];\n            ? E = ellinit([y,1], K);\n            ? ellissupersingular(E, P)\n            %5 = 1\n            ? Q = idealprimedec(K,5)[1];\n            ? ellissupersingular(E, Q)\n            %6 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_461ellissupersingular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellissupersingular (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellissupersingular") < 0)) __PYX_ERR(4, 7656, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellissupersingular", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7656, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellissupersingular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_460ellissupersingular(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_460ellissupersingular(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellissupersingular", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":7684
 *             %6 = 0
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7685
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":7686
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7687
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7687, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":7686
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7688
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 7688, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7689
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7690
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":7691
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7692
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = ellissupersingular(_E, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7691
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)
 */
  }

  /* "cypari/auto_instance.pxi":7693
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = ellissupersingular(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_instance.pxi":7694
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":7695
 *         cdef int _ret = ellissupersingular(_E, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def ellj(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7656
 *         return new_gen(_ret)
 * 
 *     def ellissupersingular(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return 1 if the elliptic curve :math:`E` defined over a number field, :math:`\mathbb{Q}_p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellissupersingular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7697
 *         return _ret
 * 
 *     def ellj(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Elliptic :math:`j`-invariant. :math:`x` must be a complex number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_463ellj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_462ellj[] = "\n        Elliptic :math:`j`-invariant. :math:`x` must be a complex number\n        with positive imaginary part, or convertible into a power series or a\n        :math:`p`-adic number with positive valuation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_463ellj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellj") < 0)) __PYX_ERR(4, 7697, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7697, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellj", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7697, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_462ellj(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_462ellj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellj", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":7703
 *         :math:`p`-adic number with positive valuation.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7704
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7704, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7705
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jell(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7706
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jell(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":7707
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jell(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jell(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":7708
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jell(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elllocalred(self, E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7697
 *         return _ret
 * 
 *     def ellj(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Elliptic :math:`j`-invariant. :math:`x` must be a complex number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7710
 *         return new_gen(_ret)
 * 
 *     def elllocalred(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Calculates the Kodaira type of the local fiber of the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_465elllocalred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_464elllocalred[] = "\n        Calculates the Kodaira type of the local fiber of the elliptic curve\n        :math:`E` at :math:`p`. :math:`E` must be an :literal:`ell` structure as output by\n        :literal:`ellinit`, over :math:`\\mathbb{Q}_\\ell` (:math:`p` better left omitted, else equal to :math:`\\ell`)\n        over :math:`\\mathbb{Q}` (:math:`p` a rational prime) or a number field :math:`K` (:math:`p`\n        a maximal ideal given by a :literal:`prid` structure).\n        The result is a 4-component vector :math:`[f,kod,v,c]`. Here :math:`f` is the exponent of\n        :math:`p` in the arithmetic conductor of :math:`E`, and :math:`kod` is the Kodaira type which\n        is coded as follows:\n        \n        1 means good reduction (type I:math:`_0`), 2, 3 and 4 mean types II, III and IV\n        respectively, :math:`4+\\nu` with :math:`\\nu > 0` means type I:math:`_\\nu`;\n        finally the opposite values :math:`-1`, :math:`-2`, etc.\302\240refer to the starred types\n        I:math:`_0^*`, II:math:`^*`, etc. The third component :math:`v` is itself a vector :math:`[u,r,s,t]`\n        giving the coordinate changes done during the local reduction;\n        :math:`u = 1` if and only if the given equation was already minimal at :math:`p`.\n        Finally, the last component :math:`c` is the local Tamagawa number :math:`c_p`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_465elllocalred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elllocalred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elllocalred") < 0)) __PYX_ERR(4, 7710, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elllocalred", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7710, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elllocalred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_464elllocalred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_464elllocalred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("elllocalred", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":7729
 *         Finally, the last component :math:`c` is the local Tamagawa number :math:`c_p`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7730
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":7731
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7732
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":7731
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7733
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 7733, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7734
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7735
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":7736
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7737
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elllocalred(_E, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7736
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)
 */
  }

  /* "cypari/auto_instance.pxi":7738
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elllocalred(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_instance.pxi":7739
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elllog(self, E, P, G, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7710
 *         return new_gen(_ret)
 * 
 *     def elllocalred(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Calculates the Kodaira type of the local fiber of the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elllocalred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7741
 *         return new_gen(_ret)
 * 
 *     def elllog(self, E, P, G, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two points :math:`P` and :math:`G` on the elliptic curve :math:`E/\mathbb{F}_q`, returns the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_467elllog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_466elllog[] = "\n        Given two points :math:`P` and :math:`G` on the elliptic curve :math:`E/\\mathbb{F}_q`, returns the\n        discrete logarithm of :math:`P` in base :math:`G`, i.e. the smallest non-negative\n        integer :math:`n` such that :math:`P = [n]G`.\n        See :literal:`znlog` for the limitations of the underlying discrete log algorithms.\n        If present, :math:`o` represents the order of :math:`G`, see ``DLfun`` (in the PARI manual);\n        the preferred format for this parameter is :literal:`[N, factor(N)]`, where :math:`N`\n        is the order of :math:`G`.\n        \n        If no :math:`o` is given, assume that :math:`G` generates the curve.\n        The function also assumes that :math:`P` is a multiple of :math:`G`.\n        \n        ::\n        \n            ? a = ffgen(ffinit(2,8),'a);\n            ? E = ellinit([a,1,0,0,1]); \\\\ over F_{2^8}\n            ? x = a^3; y = ellordinate(E,x)[1];\n            ? P = [x,y]; G = ellmul(E, P, 113);\n            ? ord = [242, factor(242)]; \\\\ P generates a group of order 242. Initialize.\n            ? ellorder(E, G, ord)\n            %4 = 242\n            ? e = elllog(E, P, G, ord)\n            %5 = 15\n            ? ellmul(E,G,e) == P\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_467elllog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elllog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_P,&__pyx_n_s_G,&__pyx_n_s_o,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_E)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elllog", 0, 3, 4, 1); __PYX_ERR(4, 7741, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elllog", 0, 3, 4, 2); __PYX_ERR(4, 7741, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elllog") < 0)) __PYX_ERR(4, 7741, __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_E = values[0];
    __pyx_v_P = values[1];
    __pyx_v_G = values[2];
    __pyx_v_o = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elllog", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7741, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elllog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_466elllog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_P, __pyx_v_G, __pyx_v_o);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_466elllog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_G, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__G;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("elllog", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_instance.pxi":7768
 *             %6 = 1
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         G = objtogen(G)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7769
 *         '''
 *         E = objtogen(E)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7770
 *         E = objtogen(E)
 *         P = objtogen(P)
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7771
 *         P = objtogen(P)
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_instance.pxi":7772
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7773
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":7772
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7774
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 7774, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7775
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7776
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7777
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_instance.pxi":7778
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_instance.pxi":7779
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7780
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_instance.pxi":7779
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 */
  }

  /* "cypari/auto_instance.pxi":7781
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elllog(__pyx_v__E, __pyx_v__P, __pyx_v__G, __pyx_v__o);

  /* "cypari/auto_instance.pxi":7782
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elllseries(self, E, s, A=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7741
 *         return new_gen(_ret)
 * 
 *     def elllog(self, E, P, G, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two points :math:`P` and :math:`G` on the elliptic curve :math:`E/\mathbb{F}_q`, returns the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elllog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7784
 *         return new_gen(_ret)
 * 
 *     def elllseries(self, E, s, A=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`lfun(E,s)` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_469elllseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_468elllseries[] = "\n        This function is deprecated, use :literal:`lfun(E,s)` instead.\n        \n        :math:`E` being an elliptic curve, given by an arbitrary model over :math:`\\mathbb{Q}` as output\n        by :literal:`ellinit`, this function computes the value of the :math:`L`-series of :math:`E` at\n        the (complex) point :math:`s`. This function uses an :math:`O(N^{1/2})` algorithm, where\n        :math:`N` is the conductor.\n        \n        The optional parameter :math:`A` fixes a cutoff point for the integral and is best\n        left omitted; the result must be independent of :math:`A`, up to\n        :literal:`realprecision`, so this allows to check the function's accuracy.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_469elllseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_A = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elllseries (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_s,&__pyx_n_s_A,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_E)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elllseries", 0, 2, 4, 1); __PYX_ERR(4, 7784, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elllseries") < 0)) __PYX_ERR(4, 7784, __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);
        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_E = values[0];
    __pyx_v_s = values[1];
    __pyx_v_A = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7784, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elllseries", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7784, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elllseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_468elllseries(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_s, __pyx_v_A, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_468elllseries(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_s, PyObject *__pyx_v_A, long __pyx_v_precision) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_A;
  GEN __pyx_v__E;
  GEN __pyx_v__s;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("elllseries", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":7797
 *         :literal:`realprecision`, so this allows to check the function's accuracy.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)
 *         E = objtogen(E)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7797, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":7798
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         E = objtogen(E)
 *         s = objtogen(s)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":7799
 *         from warnings import warn
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":7800
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)
 *         E = objtogen(E)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":7801
 *         E = objtogen(E)
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)             # <<<<<<<<<<<<<<
 *         if _have_A:
 *             A = objtogen(A)
 */
  __pyx_t_3 = (__pyx_v_A != Py_None);
  __pyx_v__have_A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7802
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             A = objtogen(A)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_A != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":7803
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:
 *             A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7803, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":7802
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             A = objtogen(A)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7804
 *         if _have_A:
 *             A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 7804, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7805
 *             A = objtogen(A)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_instance.pxi":7806
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = NULL
 *         if _have_A:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_5;

  /* "cypari/auto_instance.pxi":7807
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL             # <<<<<<<<<<<<<<
 *         if _have_A:
 *             _A = (<Gen>A).g
 */
  __pyx_v__A = NULL;

  /* "cypari/auto_instance.pxi":7808
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = (__pyx_v__have_A != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":7809
 *         cdef GEN _A = NULL
 *         if _have_A:
 *             _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
    __pyx_v__A = __pyx_t_5;

    /* "cypari/auto_instance.pxi":7808
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":7810
 *         if _have_A:
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":7811
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elllseries(__pyx_v__E, __pyx_v__s, __pyx_v__A, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":7812
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellminimaldisc(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 7812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7784
 *         return new_gen(_ret)
 * 
 *     def elllseries(self, E, s, A=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`lfun(E,s)` instead.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elllseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7814
 *         return new_gen(_ret)
 * 
 *     def ellminimaldisc(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over a number field output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_471ellminimaldisc(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_470ellminimaldisc[] = "\n        :math:`E` being an elliptic curve defined over a number field output by\n        :literal:`ellinit`, return the minimal discriminant ideal of E.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_471ellminimaldisc(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellminimaldisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_470ellminimaldisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_470ellminimaldisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellminimaldisc", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7819
 *         :literal:`ellinit`, return the minimal discriminant ideal of E.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7820
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaldisc(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7820, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7821
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellminimaldisc(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7822
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaldisc(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellminimaldisc(__pyx_v__E);

  /* "cypari/auto_instance.pxi":7823
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaldisc(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellminimaltwist(self, E, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7814
 *         return new_gen(_ret)
 * 
 *     def ellminimaldisc(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over a number field output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellminimaldisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7825
 *         return new_gen(_ret)
 * 
 *     def ellminimaltwist(self, E, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve defined over :math:`\mathbb{Q}`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_473ellminimaltwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_472ellminimaltwist[] = "\n        Let :math:`E` be an elliptic curve defined over :math:`\\mathbb{Q}`, return\n        a discriminant :math:`D` such that the twist of :math:`E` by :math:`D` is minimal among all\n        possible quadratic twists, i.e. if :math:`flag = 0`, its minimal model has minimal\n        discriminant, or if :math:`flag = 1`, it has minimal conductor.\n        \n        In the example below, we find a curve with :math:`j`-invariant :math:`3` and minimal\n        conductor.\n        \n        ::\n        \n            ? E = ellminimalmodel(ellinit(ellfromj(3)));\n            ? ellglobalred(E)[1]\n            %2 = 357075\n            ? D = ellminimaltwist(E,1)\n            %3 = -15\n            ? E2 = ellminimalmodel(ellinit(elltwist(E,D)));\n            ? ellglobalred(E2)[1]\n            %5 = 14283\n        \n        In the example below, :math:`flag = 0` and :math:`flag = 1` give different results.\n        \n        ::\n        \n            ? E = ellinit([1,0]);\n            ? D0 = ellminimaltwist(E,0)\n            %7 = 1\n            ? D1 = ellminimaltwist(E,1)\n            %8 = 8\n            ? E0 = ellminimalmodel(ellinit(elltwist(E,D0)));\n            ? [E0.disc, ellglobalred(E0)[1]]\n            %10 = [-64, 64]\n            ? E1 = ellminimalmodel(ellinit(elltwist(E,D1)));\n            ? [E1.disc, ellglobalred(E1)[1]]\n            %12 = [-4096, 32]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_473ellminimaltwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellminimaltwist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_flag,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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellminimaltwist") < 0)) __PYX_ERR(4, 7825, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7825, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellminimaltwist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7825, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellminimaltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_472ellminimaltwist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_472ellminimaltwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_flag) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellminimaltwist", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":7862
 *             %12 = [-4096, 32]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7863
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7863, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7864
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7865
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellminimaltwist0(__pyx_v__E, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":7866
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellmoddegree(self, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7825
 *         return new_gen(_ret)
 * 
 *     def ellminimaltwist(self, E, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve defined over :math:`\mathbb{Q}`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellminimaltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7868
 *         return new_gen(_ret)
 * 
 *     def ellmoddegree(self, e):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`e` being an elliptic curve defined over :math:`\mathbb{Q}` output by :literal:`ellinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_475ellmoddegree(PyObject *__pyx_v_self, PyObject *__pyx_v_e); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_474ellmoddegree[] = "\n        :math:`e` being an elliptic curve defined over :math:`\\mathbb{Q}` output by :literal:`ellinit`,\n        compute the modular degree of :math:`e` divided by the square of\n        the Manin constant :math:`c`. It is conjectured that :math:`c = 1` for the strong Weil\n        curve in the isogeny class (optimal quotient of :math:`J_0(N)`) and this can be\n        proven using :literal:`ellweilcurve` when the conductor :math:`N` is moderate.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); \\\\ from Cremona table: strong Weil curve and c = 1\n            ? [v,smith] = ellweilcurve(E); smith \\\\ proof of the above\n            %2 = [[1, 1], [5, 1], [1, 1/5]]\n            ? ellmoddegree(E)\n            %3 = 1\n            ? [ellidentify(e)[1][1] | e<-v]\n            %4 = [\"11a1\", \"11a2\", \"11a3\"]\n            ? ellmoddegree(ellinit(\"11a2\"))\n            %5 = 5\n            ? ellmoddegree(ellinit(\"11a3\"))\n            %6 = 1/5\n        \n        The modular degree of :literal:`11a1` is :math:`1` (because\n        :literal:`ellweilcurve` or Cremona's table prove that the Manin constant\n        is :math:`1` for this curve); the output of :literal:`ellweilcurve` also proves\n        that the Manin constants of :literal:`11a2` and :literal:`11a3` are 1 and 5\n        respectively, so the actual modular degree of both :literal:`11a2` and :literal:`11a3`\n        is 5.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_475ellmoddegree(PyObject *__pyx_v_self, PyObject *__pyx_v_e) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellmoddegree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_474ellmoddegree(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_e));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_474ellmoddegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_e) {
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellmoddegree", 0);
  __Pyx_INCREF(__pyx_v_e);

  /* "cypari/auto_instance.pxi":7897
 *         is 5.
 *         '''
 *         e = objtogen(e)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _e = (<Gen>e).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_e, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7898
 *         '''
 *         e = objtogen(e)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _e = (<Gen>e).g
 *         cdef GEN _ret = ellmoddegree(_e)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7898, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7899
 *         e = objtogen(e)
 *         sig_on()
 *         cdef GEN _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellmoddegree(_e)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
  __pyx_v__e = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7900
 *         sig_on()
 *         cdef GEN _e = (<Gen>e).g
 *         cdef GEN _ret = ellmoddegree(_e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellmoddegree(__pyx_v__e);

  /* "cypari/auto_instance.pxi":7901
 *         cdef GEN _e = (<Gen>e).g
 *         cdef GEN _ret = ellmoddegree(_e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellmodulareqn(self, long N, x=None, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7868
 *         return new_gen(_ret)
 * 
 *     def ellmoddegree(self, e):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`e` being an elliptic curve defined over :math:`\mathbb{Q}` output by :literal:`ellinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellmoddegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7903
 *         return new_gen(_ret)
 * 
 *     def ellmodulareqn(self, long N, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime :math:`N < 500`, return a vector :math:`[P,t]` where :math:`P(x,y)`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_477ellmodulareqn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_476ellmodulareqn[] = "\n        Given a prime :math:`N < 500`, return a vector :math:`[P,t]` where :math:`P(x,y)`\n        is a modular equation of level :math:`N`, i.e.\302\240a bivariate polynomial with integer\n        coefficients; :math:`t` indicates the type of this equation: either\n        :emphasis:`canonical` (:math:`t = 0`) or :emphasis:`Atkin` (:math:`t = 1`). This function requires\n        the :literal:`seadata` package and its only use is to give access to the package\n        contents. See :literal:`polmodular` for a more general and more flexible function.\n        \n        Let :math:`j` be the :math:`j`-invariant function. The polynomial :math:`P` satisfies\n        the functional equation,\n        \n        .. MATH::\n        \n            P(f,j) = P(f \\| W_N, j \\| W_N) = 0\n        \n        for some modular function :math:`f = f_N` (hand-picked for each fixed :math:`N` to\n        minimize its size, see below), where :math:`W_N(\\tau) = -1 / (N \\tau)` is the\n        Atkin-Lehner involution. These two equations allow to compute the values of\n        the classical modular polynomial :math:`\\Phi_N`, such that :math:`\\Phi_N(j(\\tau),\n        j(N\\tau)) = 0`, while being much smaller than the latter. More precisely, we\n        have :math:`j(W_N(\\tau)) = j(N \\tau)`; the function :math:`f` is invariant under\n        :math:`\\Gamma_0(N)` and also satisfies\n        \n        - for Atkin type: :math:`f \\| W_N = f`;\n        \n        - for canonical type: let :math:`s = 12/\\mathrm{gcd} (12,N-1)`, then\n          :math:`f \\| W_N = N^s / f`. In this case, :math:`f` has a simple definition:\n          :math:`f(\\tau) = N^s (\\eta (N \\tau) / \\eta (\\tau) )^{2 s}`,\n          where :math:`\\eta` is Dedekind's eta function.\n        \n        The following GP function returns values of the classical modular polynomial\n        by eliminating :math:`f_N(\\tau)` in the above functional equation,\n        for :math:`N <= 31` or :math:`N\\in{41,47,59,71}`.\n        ""\n        ::\n        \n            classicaleqn(N, X='X, Y='Y)=\n            {\n             my([P,t] = ellmodulareqn(N), Q, d);\n             if (poldegree(P,'y) > 2, error(\"level unavailable in classicaleqn\"));\n             if (t == 0, \\\\ Canonical\n             my(s = 12/gcd(12,N-1));\n             Q = 'x^(N+1) * substvec(P,['x,'y],[N^s/'x,Y]);\n             d = N^(s*(2*N+1)) * (-1)^(N+1);\n             , \\\\ Atkin\n             Q = subst(P,'y,Y);\n             d = (X-Y)^(N+1));\n             polresultant(subst(P,'y,X), Q) / d;\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_477ellmodulareqn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_N;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellmodulareqn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellmodulareqn") < 0)) __PYX_ERR(4, 7903, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_N == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 7903, __pyx_L3_error)
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellmodulareqn", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7903, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellmodulareqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_476ellmodulareqn(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_476ellmodulareqn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_N, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  long __pyx_v__x;
  long __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("ellmodulareqn", 0);

  /* "cypari/auto_instance.pxi":7954
 *             }
 *         '''
 *         cdef long _x = -1             # <<<<<<<<<<<<<<
 *         if x is not None:
 *             _x = get_var(x)
 */
  __pyx_v__x = -1L;

  /* "cypari/auto_instance.pxi":7955
 *         '''
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         cdef long _y = -1
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":7956
 *         cdef long _x = -1
 *         if x is not None:
 *             _x = get_var(x)             # <<<<<<<<<<<<<<
 *         cdef long _y = -1
 *         if y is not None:
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_x); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(4, 7956, __pyx_L1_error)
    __pyx_v__x = __pyx_t_3;

    /* "cypari/auto_instance.pxi":7955
 *         '''
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         cdef long _y = -1
 */
  }

  /* "cypari/auto_instance.pxi":7957
 *         if x is not None:
 *             _x = get_var(x)
 *         cdef long _y = -1             # <<<<<<<<<<<<<<
 *         if y is not None:
 *             _y = get_var(y)
 */
  __pyx_v__y = -1L;

  /* "cypari/auto_instance.pxi":7958
 *             _x = get_var(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":7959
 *         cdef long _y = -1
 *         if y is not None:
 *             _y = get_var(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = ellmodulareqn(N, _x, _y)
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_y); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(4, 7959, __pyx_L1_error)
    __pyx_v__y = __pyx_t_3;

    /* "cypari/auto_instance.pxi":7958
 *             _x = get_var(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":7960
 *         if y is not None:
 *             _y = get_var(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellmodulareqn(N, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 7960, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7961
 *             _y = get_var(y)
 *         sig_on()
 *         cdef GEN _ret = ellmodulareqn(N, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellmodulareqn(__pyx_v_N, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":7962
 *         sig_on()
 *         cdef GEN _ret = ellmodulareqn(N, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellmul(self, E, z, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 7962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7903
 *         return new_gen(_ret)
 * 
 *     def ellmodulareqn(self, long N, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime :math:`N < 500`, return a vector :math:`[P,t]` where :math:`P(x,y)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellmodulareqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":7964
 *         return new_gen(_ret)
 * 
 *     def ellmul(self, E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes :math:`[n]z`, where :math:`z` is a point on the elliptic curve :math:`E`. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_479ellmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_478ellmul[] = "\n        Computes :math:`[n]z`, where :math:`z` is a point on the elliptic curve :math:`E`. The\n        exponent :math:`n` is in :math:`\\mathbb{Z}`, or may be a complex quadratic integer if the curve :math:`E`\n        has complex multiplication by :math:`n` (if not, an error message is issued).\n        \n        ::\n        \n            ? Ei = ellinit([1,0]); z = [0,0];\n            ? ellmul(Ei, z, 10)\n            %2 = [0] \\\\ unsurprising: z has order 2\n            ? ellmul(Ei, z, I)\n            %3 = [0, 0] \\\\ Ei has complex multiplication by Z[i]\n            ? ellmul(Ei, z, quadgen(-4))\n            %4 = [0, 0] \\\\ an alternative syntax for the same query\n            ? Ej = ellinit([0,1]); z = [-1,0];\n            ? ellmul(Ej, z, I)\n             *** at top-level: ellmul(Ej,z,I)\n             *** ^--------------\n             *** ellmul: not a complex multiplication in ellmul.\n            ? ellmul(Ej, z, 1+quadgen(-3))\n            %6 = [1 - w, 0]\n        \n        The simple-minded algorithm for the CM case assumes that we are in\n        characteristic :math:`0`, and that the quadratic order to which :math:`n` belongs has\n        small discriminant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_479ellmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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("ellmul", 1, 3, 3, 1); __PYX_ERR(4, 7964, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellmul", 1, 3, 3, 2); __PYX_ERR(4, 7964, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellmul") < 0)) __PYX_ERR(4, 7964, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_E = values[0];
    __pyx_v_z = values[1];
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellmul", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 7964, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_478ellmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_478ellmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellmul", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":7991
 *         small discriminant.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         n = objtogen(n)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7992
 *         '''
 *         E = objtogen(E)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7993
 *         E = objtogen(E)
 *         z = objtogen(z)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":7994
 *         z = objtogen(z)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 7994, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":7995
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7996
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7997
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":7998
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellmul(__pyx_v__E, __pyx_v__z, __pyx_v__n);

  /* "cypari/auto_instance.pxi":7999
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellneg(self, E, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 7999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":7964
 *         return new_gen(_ret)
 * 
 *     def ellmul(self, E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes :math:`[n]z`, where :math:`z` is a point on the elliptic curve :math:`E`. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8001
 *         return new_gen(_ret)
 * 
 *     def ellneg(self, E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Opposite of the point :math:`z` on elliptic curve :math:`E`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_481ellneg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_480ellneg[] = "\n        Opposite of the point :math:`z` on elliptic curve :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_481ellneg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellneg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z,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_E)) != 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("ellneg", 1, 2, 2, 1); __PYX_ERR(4, 8001, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellneg") < 0)) __PYX_ERR(4, 8001, __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_E = values[0];
    __pyx_v_z = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellneg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8001, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_480ellneg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_480ellneg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellneg", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":8005
 *         Opposite of the point :math:`z` on elliptic curve :math:`E`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8006
 *         '''
 *         E = objtogen(E)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8007
 *         E = objtogen(E)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8007, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8008
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellneg(_E, _z)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8009
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellneg(_E, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8010
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellneg(_E, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellneg(__pyx_v__E, __pyx_v__z);

  /* "cypari/auto_instance.pxi":8011
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellneg(_E, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellnonsingularmultiple(self, E, P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8011, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8001
 *         return new_gen(_ret)
 * 
 *     def ellneg(self, E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Opposite of the point :math:`z` on elliptic curve :math:`E`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8013
 *         return new_gen(_ret)
 * 
 *     def ellnonsingularmultiple(self, E, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E/\mathbb{Q}` (more precisely, a model defined over :math:`\mathbb{Q}`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_483ellnonsingularmultiple(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_482ellnonsingularmultiple[] = "\n        Given an elliptic curve :math:`E/\\mathbb{Q}` (more precisely, a model defined over :math:`\\mathbb{Q}`\n        of a curve) and a rational point :math:`P \\in E(\\mathbb{Q})`, returns the pair :math:`[R,n]`,\n        where :math:`n` is the least positive integer such that :math:`R := [n]P` has good\n        reduction at every prime. More precisely, its image in a minimal model is\n        everywhere non-singular.\n        \n        ::\n        \n            ? e = ellinit(\"57a1\"); P = [2,-2];\n            ? ellnonsingularmultiple(e, P)\n            %2 = [[1, -1], 2]\n            ? e = ellinit(\"396b2\"); P = [35, -198];\n            ? [R,n] = ellnonsingularmultiple(e, P);\n            ? n\n            %5 = 12\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_483ellnonsingularmultiple(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellnonsingularmultiple (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_P,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_E)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellnonsingularmultiple", 1, 2, 2, 1); __PYX_ERR(4, 8013, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellnonsingularmultiple") < 0)) __PYX_ERR(4, 8013, __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_E = values[0];
    __pyx_v_P = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellnonsingularmultiple", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8013, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellnonsingularmultiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_482ellnonsingularmultiple(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_P);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_482ellnonsingularmultiple(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellnonsingularmultiple", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":8031
 *             %5 = 12
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8032
 *         '''
 *         E = objtogen(E)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8033
 *         E = objtogen(E)
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8033, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8034
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8035
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8036
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellnonsingularmultiple(__pyx_v__E, __pyx_v__P);

  /* "cypari/auto_instance.pxi":8037
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellorder(self, E, z, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8013
 *         return new_gen(_ret)
 * 
 *     def ellnonsingularmultiple(self, E, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E/\mathbb{Q}` (more precisely, a model defined over :math:`\mathbb{Q}`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellnonsingularmultiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8039
 *         return new_gen(_ret)
 * 
 *     def ellorder(self, E, z, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the order of the point :math:`z` on the elliptic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_485ellorder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_484ellorder[] = "\n        Gives the order of the point :math:`z` on the elliptic\n        curve :math:`E`, defined over a finite field or a number field.\n        Return (the impossible value) zero if the point has infinite order.\n        \n        ::\n        \n            ? E = ellinit([-157^2,0]); \\\\ the \"157-is-congruent\" curve\n            ? P = [2,2]; ellorder(E, P)\n            %2 = 2\n            ? P = ellheegner(E); ellorder(E, P) \\\\ infinite order\n            %3 = 0\n            ? K = nfinit(polcyclo(11,t)); E=ellinit(\"11a3\", K); T = elltors(E);\n            ? ellorder(E, T.gen[1])\n            %5 = 25\n            ? E = ellinit(ellfromj(ffgen(5^10)));\n            ? ellcard(E)\n            %7 = 9762580\n            ? P = random(E); ellorder(E, P)\n            %8 = 4881290\n            ? p = 2^160+7; E = ellinit([1,2], p);\n            ? N = ellcard(E)\n            %9 = 1461501637330902918203686560289225285992592471152\n            ? o = [N, factor(N)];\n            ? for(i=1,100, ellorder(E,random(E)))\n            time = 260 ms.\n        \n        The parameter :math:`o`, is now mostly useless, and kept for backward\n        compatibility. If present, it represents a non-zero multiple of the order\n        of :math:`z`, see ``DLfun`` (in the PARI manual); the preferred format for this parameter is\n        :literal:`[ord, factor(ord)]`, where :literal:`ord` is the cardinality of the curve.\n        It is no longer needed since PARI is now able to compute it over large\n        finite fields (was restricted to small prime fields at the time this feature\n        was introduced), :emphasis:`and` caches the result in :math:`E` so that it is computed\n        and factored only once. Modifying the last example, we see that including\n        this extra parameter provides no improvement:\n        \n        ::\n        \n            ? o = [N, factor(N)];\n            ? for(i=1,100, ellorder(E,random(E),o))\n            time = 260 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_485ellorder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellorder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z,&__pyx_n_s_o,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 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("ellorder", 0, 2, 3, 1); __PYX_ERR(4, 8039, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellorder") < 0)) __PYX_ERR(4, 8039, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_z = values[1];
    __pyx_v_o = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellorder", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8039, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_484ellorder(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z, __pyx_v_o);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_484ellorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellorder", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_instance.pxi":8083
 *             time = 260 ms.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         cdef bint _have_o = (o is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8084
 *         '''
 *         E = objtogen(E)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8085
 *         E = objtogen(E)
 *         z = objtogen(z)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_instance.pxi":8086
 *         z = objtogen(z)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8087
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8087, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":8086
 *         z = objtogen(z)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":8088
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 8088, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8089
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8090
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8091
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_instance.pxi":8092
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8093
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_instance.pxi":8092
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 */
  }

  /* "cypari/auto_instance.pxi":8094
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellorder(__pyx_v__E, __pyx_v__z, __pyx_v__o);

  /* "cypari/auto_instance.pxi":8095
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellordinate(self, E, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8039
 *         return new_gen(_ret)
 * 
 *     def ellorder(self, E, z, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the order of the point :math:`z` on the elliptic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8097
 *         return new_gen(_ret)
 * 
 *     def ellordinate(self, E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a 0, 1 or 2-component vector containing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_487ellordinate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_486ellordinate[] = "\n        Gives a 0, 1 or 2-component vector containing\n        the :math:`y`-coordinates of the points of the curve :math:`E` having :math:`x` as\n        :math:`x`-coordinate.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_487ellordinate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellordinate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellordinate", 0, 2, 3, 1); __PYX_ERR(4, 8097, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellordinate") < 0)) __PYX_ERR(4, 8097, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8097, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellordinate", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8097, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellordinate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_486ellordinate(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_486ellordinate(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellordinate", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":8103
 *         :math:`x`-coordinate.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8104
 *         '''
 *         E = objtogen(E)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8105
 *         E = objtogen(E)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8105, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8106
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8107
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellordinate(_E, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8108
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellordinate(_E, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":8109
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellordinate(_E, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellordinate(__pyx_v__E, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":8110
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellordinate(_E, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicL(self, E, p, long n, s=None, long r=0, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8097
 *         return new_gen(_ret)
 * 
 *     def ellordinate(self, E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a 0, 1 or 2-component vector containing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellordinate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8112
 *         return new_gen(_ret)
 * 
 *     def ellpadicL(self, E, p, long n, s=None, long r=0, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative) on a character :math:`\chi^s` of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_489ellpadicL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_488ellpadicL[] = "\n        Returns the value (or :math:`r`-th derivative) on a character :math:`\\chi^s` of\n        :math:`\\mathbb{Z}_p^*` of the :math:`p`-adic :math:`L`-function of the elliptic curve :math:`E/\\mathbb{Q}`, twisted by\n        :math:`D`, given modulo :math:`p^n`.\n        \n        :strong:`Characters.` The set of continuous characters of\n        :math:`Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})` is identified to :math:`\\mathbb{Z}_p^*` via the\n        cyclotomic character :math:`\\chi` with values in :math:`\\overline{\\mathbb{Q}_p}^*`. Denote by\n        :math:`\\tau:\\mathbb{Z}_p^*\\to\\mathbb{Z}_p^*` the Teichm\303\274ller character, with values\n        in the :math:`(p-1)`-th roots of :math:`1` for :math:`p != 2`, and :math:`{-1,1}` for :math:`p = 2`;\n        finally, let\n        :math:`<\\chi>= \\chi \\tau^{-1}`, with values in :math:`1 + 2p\\mathbb{Z}_p`.\n        In GP, the continuous character of\n        :math:`Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})` given by :math:`<\\chi>^{s_1}\n        \\tau^{s_2}` is represented by the pair of integers :math:`s = (s_1,s_2)`, with :math:`s_1\n        \\in \\mathbb{Z}_p` and :math:`s_2 mod p-1` for :math:`p > 2`, (resp. mod :math:`2` for :math:`p = 2`); :math:`s`\n        may be also an integer, representing :math:`(s,s)` or :math:`\\chi^s`.\n        \n        :strong:`The :math:`p`-adic :math:`L` function.`\n        The :math:`p`-adic :math:`L` function :math:`L_p` is defined on the set of continuous\n        characters of :math:`Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})`, as :math:`\\int_{\\mathbb{Z}_p^*}\n        \\chi^s d \\mu` for a certain :math:`p`-adic distribution :math:`\\mu` on :math:`\\mathbb{Z}_p^*`. The\n        derivative is given by\n        \n        .. MATH::\n        \n            L_p^{(r)}(E, \\chi^s) = \\int_{\\mathbb{Z}_p^*} \\log_p^r(a) \\chi^s(a) d\\mu (a).\n        \n        More precisely:\n        \n        - When :math:`E` has good supersingular reduction, :math:`L_""p` takes its\n          values in :math:`D := H^1_{dR}(E/\\mathbb{Q})\\otimes_\\mathbb{Q} \\mathbb{Q}_p` and satisfies\n          \n        \n        .. MATH::\n        \n            (1-p^{-1} F)^{-2} L_p(E, \\chi^0) = (L(E,1) / \\Omega).\\omega\n        \n          where :math:`F` is the Frobenius, :math:`L(E,1)` is the value of the complex :math:`L`\n          function at :math:`1`, :math:`\\omega` is the N\303\251ron differential\n          and :math:`\\Omega` the attached period on :math:`E(\\mathbb{R})`. Here, :math:`\\chi^0` represents\n          the trivial character.\n        \n        The function returns the components of :math:`L_p^{(r)}(E,\\chi^s)` in\n        the basis :math:`(\\omega, F \\omega)`.\n        \n        - When :math:`E` has ordinary good reduction, this method only defines\n          the projection of :math:`L_p(E,\\chi^s)` on the :math:`\\alpha`-eigenspace,\n          where :math:`\\alpha` is the unit eigenvalue for :math:`F`. This is what the function\n          returns. We have\n          \n        \n        .. MATH::\n        \n            (1- \\alpha^{-1})^{-2} L_{p,\\alpha}(E,\\chi^0) = L(E,1) / \\Omega.\n        \n        Two supersingular examples:\n        \n        ::\n        \n            ? cxL(e) = bestappr( ellL1(e) / e.omega[1] );\n            \n            ? e = ellinit(\"17a1\"); p=3; \\\\ supersingular, a3 = 0\n            ? L = ellpadicL(e,p,4);\n            ? F = [0,-p;1,ellap(e,p)]; \\\\ Frobenius matrix in the basis (omega,F(omega))\n            ? (1-p^(-1)*F)^-2 * L / cxL(e)\n            %5 = [1 + O(3^5), O(3^5)]~ \\\\ [1,0]~\n            \n            ? e = ellinit(\"116a1\"); p=3; \\\\ supersingular, a3 != 0~\n            ? L = ellpadicL(e,p,4);\n            ? F = [0,-p; 1,ellap(e,p)];\n            ? (1-p^(-1)*F)^-2*L~ / cxL(e)\n            %9 = [1 + O(3^4), O(3^5)]~\n        \n        Good ordinary reduction:\n        \n        ::\n        \n            ? e = ellinit(\"17a1\"); p=5; ap = ellap(e,p)\n            %1"" = -2 \\\\ ordinary\n            ? L = ellpadicL(e,p,4)\n            %2 = 4 + 3*5 + 4*5^2 + 2*5^3 + O(5^4)\n            ? al = padicappr(x^2 - ap*x + p, ap + O(p^7))[1];\n            ? (1-al^(-1))^(-2) * L / cxL(e)\n            %4 = 1 + O(5^4)\n        \n        Twist and Teichm\303\274ller:\n        \n        ::\n        \n            ? e = ellinit(\"17a1\"); p=5; \\\\ ordinary\n            \\\\ 2nd derivative at tau^1, twist by -7\n            ? ellpadicL(e, p, 4, [0,1], 2, -7)\n            %2 = 2*5^2 + 5^3 + O(5^4)\n        \n        We give an example of non split multiplicative reduction (see\n        :literal:`ellpadicbsd` for more examples).\n        \n        ::\n        \n            ? e=ellinit(\"15a1\"); p=3; n=5;\n            ? L = ellpadicL(e,p,n)\n            %2 = 2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)\n            ? (1 - ellap(e,p))^(-1) * L / cxL(e)\n            %3 = 1 + O(3^5)\n        \n        This function is a special case of :literal:`mspadicL` and it also appears\n        as the first term of :literal:`mspadicseries`:\n        \n        ::\n        \n            ? e = ellinit(\"17a1\"); p=5;\n            ? L = ellpadicL(e,p,4)\n            %2 = 4 + 3*5 + 4*5^2 + 2*5^3 + O(5^4)\n            ? [M,phi] = msfromell(e, 1);\n            ? Mp = mspadicinit(M, p, 4);\n            ? mu = mspadicmoments(Mp, phi);\n            ? mspadicL(mu)\n            %6 = 4 + 3*5 + 4*5^2 + 2*5^3 + 2*5^4 + 5^5 + O(5^6)\n            ? mspadicseries(mu)\n            %7 = (4 + 3*5 + 4*5^2 + 2*5^3 + 2*5^4 + 5^5 + O(5^6))\n             + (3 + 3*5 + 5^2 + 5^3 + O(5^4))*x\n             + (2 + 3*5 + 5^2 + O(5^3))*x^2\n             + (3 + 4*5 + 4*5^2 + O(5^3))*x^3\n             + (3 + 2*5 + O(5^2))*x^4 + O(x^5)\n        \n        These are more cumbersome than :literal:`ellpadicL` but allow to\n        compute at different characters, or successive derivatives, or to\n        twist by a quadratic character essentially for the cost of a single call to\n        :literal:`ellpadicL` du""e to precomputations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_489ellpadicL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_s = 0;
  long __pyx_v_r;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicL (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_s,&__pyx_n_s_r,&__pyx_n_s_D,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    values[5] = ((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  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_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicL", 0, 3, 6, 1); __PYX_ERR(4, 8112, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicL", 0, 3, 6, 2); __PYX_ERR(4, 8112, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          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_r);
          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_D);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicL") < 0)) __PYX_ERR(4, 8112, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        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_E = values[0];
    __pyx_v_p = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8112, __pyx_L3_error)
    __pyx_v_s = values[3];
    if (values[4]) {
      __pyx_v_r = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8112, __pyx_L3_error)
    } else {
      __pyx_v_r = ((long)0);
    }
    __pyx_v_D = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicL", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8112, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_488ellpadicL(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n, __pyx_v_s, __pyx_v_r, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_488ellpadicL(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_s, long __pyx_v_r, PyObject *__pyx_v_D) {
  int __pyx_v__have_s;
  int __pyx_v__have_D;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__s;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpadicL", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":8244
 *         :literal:`ellpadicL` due to precomputations.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         cdef bint _have_s = (s is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8245
 *         '''
 *         E = objtogen(E)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8246
 *         E = objtogen(E)
 *         p = objtogen(p)
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_2 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_2;

  /* "cypari/auto_instance.pxi":8247
 *         p = objtogen(p)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8248
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":8247
 *         p = objtogen(p)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 */
  }

  /* "cypari/auto_instance.pxi":8249
 *         if _have_s:
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":8250
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8251
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":8250
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":8252
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 8252, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8253
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8254
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8255
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_instance.pxi":8256
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8257
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_instance.pxi":8256
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 */
  }

  /* "cypari/auto_instance.pxi":8258
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":8259
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8260
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":8259
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 */
  }

  /* "cypari/auto_instance.pxi":8261
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicL(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__s, __pyx_v_r, __pyx_v__D);

  /* "cypari/auto_instance.pxi":8262
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicbsd(self, E, p, long n, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8112
 *         return new_gen(_ret)
 * 
 *     def ellpadicL(self, E, p, long n, s=None, long r=0, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative) on a character :math:`\chi^s` of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8264
 *         return new_gen(_ret)
 * 
 *     def ellpadicbsd(self, E, p, long n, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` over :math:`\mathbb{Q}`, its quadratic twist :math:`E_D`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_491ellpadicbsd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_490ellpadicbsd[] = "\n        Given an elliptic curve :math:`E` over :math:`\\mathbb{Q}`, its quadratic twist :math:`E_D`\n        and a prime number :math:`p`, this function is a :math:`p`-adic analog of the complex\n        functions :literal:`ellanalyticrank` and :literal:`ellbsd`. It calls :literal:`ellpadicL`\n        with initial accuracy :math:`p^n` and may increase it internally;\n        it returns a vector :math:`[r, L_p]` where\n        \n        - :math:`L_p` is a :math:`p`-adic number (resp. a pair of :math:`p`-adic numbers if\n          :math:`E` has good supersingular reduction) defined modulo :math:`p^N`, conjecturally\n          equal to :math:`R_p S`, where :math:`R_p` is the :math:`p`-adic regulator as given by\n          :literal:`ellpadicregulator` (in the basis :math:`(\\omega, F \\omega)`) and :math:`S` is the\n          cardinal of the Tate-Shafarevich group for the quadratic twist :math:`E_D`.\n        \n        - :math:`r` is an upper bound for the analytic rank of the :math:`p`-adic\n          :math:`L`-function attached to :math:`E_D`: we know for sure that the :math:`i`-th\n          derivative of :math:`L_p(E_D,.)` at :math:`\\chi^0` is :math:`O(p^N)` for all :math:`i < r`\n          and that its :math:`r`-th derivative is non-zero; it is expected that the true\n          analytic rank is equal to the rank of the Mordell-Weil group :math:`E_D(\\mathbb{Q})`,\n          plus :math:`1` if the reduction of :math:`E_D` at :math:`p` is split multiplicative;\n          if :math:`r = 0`, then both the analytic rank and the Mordell-Weil rank are\n          unconditionnally :math:`0`.\n        \n        Recall that the :math:`p`-adic BSD conjecture (Mazur, Tate, Teitelbaum, Bernardi,\n        Perrin-Riou) predicts an explicit link between :math:`R_p S` and\n        \n        .. MATH::\n        \n            (1-p^{-1} F)^{-2}.L_p^{(r)}(E_D, \\chi^0) / r!\n        \n        where :math:`r` is the analytic rank of the :math:`p`-adic :math:`L`-function attached to\n    ""    :math:`E_D` and :math:`F` is the Frobenius on :math:`H^1_{dR}`; see :literal:`ellpadicL`\n        for definitions.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); p = 7; n = 5; \\\\ good ordinary\n            ? ellpadicbsd(E, 7, 5) \\\\ rank 0,\n            %2 = [0, 1 + O(7^5)]\n            \n            ? E = ellinit(\"91a1\"); p = 7; n = 5; \\\\ non split multiplicative\n            ? [r,Lp] = ellpadicbsd(E, p, n)\n            %5 = [1, 2*7 + 6*7^2 + 3*7^3 + 7^4 + O(7^5)]\n            ? R = ellpadicregulator(E, p, n, E.gen)\n            %6 = 2*7 + 6*7^2 + 3*7^3 + 7^4 + 5*7^5 + O(7^6)\n            ? sha = Lp/R\n            %7 = 1 + O(7^4)\n            \n            ? E = ellinit(\"91b1\"); p = 7; n = 5; \\\\ split multiplicative\n            ? [r,Lp] = ellpadicbsd(E, p, n)\n            %9 = [2, 2*7 + 7^2 + 5*7^3 + O(7^4)]\n            ? ellpadicregulator(E, p, n, E.gen)\n            %10 = 2*7 + 7^2 + 5*7^3 + 6*7^4 + 2*7^5 + O(7^6)\n            ? [rC, LC] = ellanalyticrank(E);\n            ? [r, rC]\n            %12 = [2, 1] \\\\ r = rC+1 because of split multiplicative reduction\n            \n            ? E = ellinit(\"53a1\"); p = 5; n = 5; \\\\ supersingular\n            ? [r, Lp] = ellpadicbsd(E, p, n);\n            ? r\n            %15 = 1\n            ? Lp\n            %16 = [3*5 + 2*5^2 + 2*5^5 + O(5^6), \\\n             5 + 3*5^2 + 4*5^3 + 2*5^4 + 5^5 + O(5^6)]\n            ? R = ellpadicregulator(E, p, n, E.gen)\n            %17 = [3*5 + 2*5^2 + 2*5^5 + O(5^6), 5 + 3*5^2 + 4*5^3 + 2*5^4 + O(5^5)]\n            \\\\ expect Lp = R*#Sha, hence (conjecturally) #Sha = 1\n            \n            ? E = ellinit(\"84a1\"); p = 11; n = 6; D = -443;\n            ? [r,Lp] = ellpadicbsd(E, 11, 6, D) \\\\ Mordell-Weil rank 0, no regulator\n            %19 = [0, 3 + 2*11 + O(11^6)]\n            ? lift(Lp) \\\\ expected cardinal for Sha is 5^2\n            %20 = 25\n            ? ellpadicbsd(E, 3, 12, D) \\\\ at 3\n            %21 = [1, 1 + 2*3 ""+ 2*3^2 + O(3^8)]\n            ? ellpadicbsd(E, 7, 8, D) \\\\ and at 7\n            %22 = [0, 4 + 3*7 + O(7^8)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_491ellpadicbsd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicbsd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_D,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_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicbsd", 0, 3, 4, 1); __PYX_ERR(4, 8264, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicbsd", 0, 3, 4, 2); __PYX_ERR(4, 8264, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicbsd") < 0)) __PYX_ERR(4, 8264, __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_E = values[0];
    __pyx_v_p = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8264, __pyx_L3_error)
    __pyx_v_D = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicbsd", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8264, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_490ellpadicbsd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_490ellpadicbsd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpadicbsd", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":8342
 *             %22 = [0, 4 + 3*7 + O(7^8)]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         cdef bint _have_D = (D is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8343
 *         '''
 *         E = objtogen(E)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8344
 *         E = objtogen(E)
 *         p = objtogen(p)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":8345
 *         p = objtogen(p)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8346
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":8345
 *         p = objtogen(p)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":8347
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 8347, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8348
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8349
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8350
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":8351
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8352
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":8351
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 */
  }

  /* "cypari/auto_instance.pxi":8353
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicbsd(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__D);

  /* "cypari/auto_instance.pxi":8354
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicfrobenius(self, E, long p, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8264
 *         return new_gen(_ret)
 * 
 *     def ellpadicbsd(self, E, p, long n, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` over :math:`\mathbb{Q}`, its quadratic twist :math:`E_D`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8356
 *         return new_gen(_ret)
 * 
 *     def ellpadicfrobenius(self, E, long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E` is an elliptic curve on :math:`\mathbb{Q}` with good
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_493ellpadicfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_492ellpadicfrobenius[] = "\n        If :math:`p > 2` is a prime and :math:`E` is an elliptic curve on :math:`\\mathbb{Q}` with good\n        reduction at :math:`p`, return the matrix of the Frobenius endomorphism :math:`\\varphi` on\n        the crystalline module :math:`D_p(E) = \\mathbb{Q}_p \\otimes H^1_{dR}(E/\\mathbb{Q})` with respect to\n        the basis of the given model :math:`(\\omega, \\eta = x \\omega)`, where\n        :math:`\\omega = dx/(2 y+a_1 x+a_3)` is the invariant differential.\n        The characteristic polynomial of :math:`\\varphi` is :math:`x^2 - a_p x + p`.\n        The matrix is computed to absolute :math:`p`-adic precision :math:`p^n`.\n        \n        ::\n        \n            ? E = ellinit([1,-1,1,0,0]);\n            ? F = ellpadicfrobenius(E,5,3);\n            ? lift(F)\n            %3 =\n            [120 29]\n            \n            [ 55 5]\n            ? charpoly(F)\n            %4 = x^2 + O(5^3)*x + (5 + O(5^3))\n            ? ellap(E, 5)\n            %5 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_493ellpadicfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_p;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicfrobenius", 1, 3, 3, 1); __PYX_ERR(4, 8356, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicfrobenius", 1, 3, 3, 2); __PYX_ERR(4, 8356, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicfrobenius") < 0)) __PYX_ERR(4, 8356, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_E = values[0];
    __pyx_v_p = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8356, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8356, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicfrobenius", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8356, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_492ellpadicfrobenius(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_492ellpadicfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_p, long __pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadicfrobenius", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":8380
 *             %5 = 0
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8381
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8381, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8382
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8383
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicfrobenius(__pyx_v__E, __pyx_v_p, __pyx_v_n);

  /* "cypari/auto_instance.pxi":8384
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicheight(self, E, p, long n, P, Q=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8356
 *         return new_gen(_ret)
 * 
 *     def ellpadicfrobenius(self, E, long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E` is an elliptic curve on :math:`\mathbb{Q}` with good
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8386
 *         return new_gen(_ret)
 * 
 *     def ellpadicheight(self, E, p, long n, P, Q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cyclotomic :math:`p`-adic height of the rational point :math:`P` on the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_495ellpadicheight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_494ellpadicheight[] = "\n        Cyclotomic :math:`p`-adic height of the rational point :math:`P` on the elliptic curve\n        :math:`E` (defined over :math:`\\mathbb{Q}`), given to :math:`n` :math:`p`-adic digits.\n        If the argument :math:`Q` is present, computes the value of the bilinear\n        form :math:`(h(P+Q)-h(P-Q)) / 4`.\n        \n        Let :math:`D := H^1_{dR}(E) \\otimes_\\mathbb{Q} \\mathbb{Q}_p` be the :math:`\\mathbb{Q}_p` vector space\n        spanned by :math:`\\omega`\n        (invariant differential :math:`dx/(2y+a_1x+a3)` related to the given model) and\n        :math:`\\eta = x \\omega`. Then the cyclotomic :math:`p`-adic height :math:`h_E` associates to\n        :math:`P\\in E(\\mathbb{Q})` an element :math:`f \\omega + g \\eta` in :math:`D`.\n        This routine returns the vector :math:`[f, g]` to :math:`n` :math:`p`-adic digits.\n        If :math:`P\\in E(\\mathbb{Q})` is in the kernel of reduction mod :math:`p` and if its reduction\n        at all finite places is non singular, then :math:`g = -(\\log_E P)^2`, where\n        :math:`\\log_E` is the logarithm for the formal group of :math:`E` at :math:`p`.\n        \n        If furthermore the model is of the form :math:`Y^2 = X^3 + a X + b` and :math:`P = (x,y)`,\n        then\n        \n        .. MATH::\n        \n            f = \\log_p(denominator (x)) - 2 \\log_p(\\sigma (P))\n        \n        where :math:`\\sigma (P)` is given by :literal:`ellsigma`:math:`(E,P)`.\n        \n        Recall (:emphasis:`Advanced topics in the arithmetic of elliptic\n        curves`, Theorem\302\2403.2) that the local height function over the complex numbers\n        is of the form\n        \n        .. MATH::\n        \n            \\lambda (z) = -\\log (\\|E.disc\\|) / 6 + \\Re (z \\eta (z)) - 2 \\log (\n            \\sigma (z)).\n        \n        (N.B. our normalization for local and global heights is twice that of\n        Silverman's).\n        \n        ::\n        \n             ? E = ellinit([1,-1,1,0,0]);"" P = [0,0];\n             ? ellpadicheight(E,5,3, P)\n             %2 = [3*5 + 5^2 + 2*5^3 + O(5^4), 5^2 + 4*5^4 + O(5^5)]\n             ? E = ellinit(\"11a1\"); P = [5,5]; \\\\ torsion point\n             ? ellpadicheight(E,19,6, P)\n             %4 = [0, 0]\n             ? E = ellinit([0,0,1,-4,2]); P = [-2,1];\n             ? ellpadicheight(E,3,3, P)\n             %6 = [2*3^2 + 2*3^3 + 3^4 + O(3^5), 2*3^2 + 3^4 + O(3^5)]\n             ? ellpadicheight(E,3,5, P, elladd(E,P,P))\n             %7 = [3^2 + 2*3^3 + O(3^7), 3^2 + 3^3 + 2*3^4 + 3^5 + O(3^7)]\n        \n        - When :math:`E` has good ordinary reduction at :math:`p` or non split multiplicative\n          reduction, the \"canonical\" :math:`p`-adic height is given by\n        \n        ::\n        \n            s2 = ellpadics2(E,p,n);\n            ellpadicheight(E, p, n, P) * [1,-s2]~\n        \n        Since :math:`s_2` does not depend on :math:`P`, it is preferable to\n        compute it only once:\n        \n        ::\n        \n            ? E = ellinit(\"5077a1\"); p = 5; n = 7; \\\\ rank 3\n            ? s2 = ellpadics2(E,p,n);\n            ? M = ellpadicheightmatrix(E,p, n, E.gen) * [1,-s2]~;\n            ? matdet(M) \\\\ p-adic regulator on the points in E.gen\n            %4 = 5 + 5^2 + 4*5^3 + 2*5^4 + 2*5^5 + 2*5^6 + O(5^7)\n        \n        - When :math:`E` has split multiplicative reduction at :math:`p` (Tate curve),\n          the \"canonical\" :math:`p`-adic height is given by\n        \n        ::\n        \n            Ep = ellinit(E[1..5], O(p^(n))); \\\\ E seen as a Tate curve over Qp\n            [u2,u,q] = Ep.tate;\n            ellpadicheight(E, p, n, P) * [1,-s2 + 1/log(q)/u2]]~\n        \n        where :math:`s_2` is as above. For example,\n        \n        ::\n        \n            ? E = ellinit(\"91b1\"); P =[-1, 3]; p = 7; n = 5;\n            ? Ep = ellinit(E[1..5], O(p^(n)));\n            ? s2 = ellpadics2(E,p,n);\n            ? [u2,u,q] = Ep.tate;\n            ? H = ellpadic""height(E,p, n, P) * [1,-s2 + 1/log(q)/u2]~\n            %5 = 2*7 + 7^2 + 5*7^3 + 6*7^4 + 2*7^5 + O(7^6)\n        \n        These normalizations are chosen so that :math:`p`-adic BSD conjectures\n        are easy to state, see :literal:`ellpadicbsd`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_495ellpadicheight(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicheight (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_P,&__pyx_n_s_Q,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((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  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_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheight", 0, 4, 5, 1); __PYX_ERR(4, 8386, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheight", 0, 4, 5, 2); __PYX_ERR(4, 8386, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheight", 0, 4, 5, 3); __PYX_ERR(4, 8386, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicheight") < 0)) __PYX_ERR(4, 8386, __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);
        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_E = values[0];
    __pyx_v_p = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8386, __pyx_L3_error)
    __pyx_v_P = values[3];
    __pyx_v_Q = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicheight", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8386, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_494ellpadicheight(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n, __pyx_v_P, __pyx_v_Q);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_494ellpadicheight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P, PyObject *__pyx_v_Q) {
  int __pyx_v__have_Q;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpadicheight", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":8480
 *         are easy to state, see :literal:`ellpadicbsd`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         P = objtogen(P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8481
 *         '''
 *         E = objtogen(E)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8482
 *         E = objtogen(E)
 *         p = objtogen(p)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8483
 *         p = objtogen(p)
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             Q = objtogen(Q)
 */
  __pyx_t_2 = (__pyx_v_Q != Py_None);
  __pyx_v__have_Q = __pyx_t_2;

  /* "cypari/auto_instance.pxi":8484
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8485
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 *             Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":8484
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":8486
 *         if _have_Q:
 *             Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 8486, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8487
 *             Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8488
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8489
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8490
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 */
  __pyx_v__Q = NULL;

  /* "cypari/auto_instance.pxi":8491
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8492
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 *             _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
    __pyx_v__Q = __pyx_t_4;

    /* "cypari/auto_instance.pxi":8491
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 */
  }

  /* "cypari/auto_instance.pxi":8493
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicheight0(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__P, __pyx_v__Q);

  /* "cypari/auto_instance.pxi":8494
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicheightmatrix(self, E, p, long n, Q):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8386
 *         return new_gen(_ret)
 * 
 *     def ellpadicheight(self, E, p, long n, P, Q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cyclotomic :math:`p`-adic height of the rational point :math:`P` on the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8496
 *         return new_gen(_ret)
 * 
 *     def ellpadicheightmatrix(self, E, p, long n, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being a vector of points, this function returns the "Gram matrix"
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_497ellpadicheightmatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_496ellpadicheightmatrix[] = "\n        :math:`Q` being a vector of points, this function returns the \"Gram matrix\"\n        :math:`[F,G]` of the cyclotomic :math:`p`-adic height :math:`h_E` with respect to\n        the basis :math:`(\\omega, \\eta)` of :math:`D = H^1_{dR}(E) \\otimes_\\mathbb{Q} \\mathbb{Q}_p`\n        given to :math:`n` :math:`p`-adic digits. In other words, if\n        :literal:`ellpadicheight`:math:`(E,p,n, Q[i],Q[j]) = [f,g]`, corresponding to\n        :math:`f \\omega + g \\eta` in :math:`D`, then :math:`F[i,j] = f` and :math:`G[i,j] = g`.\n        \n        ::\n        \n            ? E = ellinit([0,0,1,-7,6]); Q = [[-2,3],[-1,3]]; p = 5; n = 5;\n            ? [F,G] = ellpadicheightmatrix(E,p,n,Q);\n            ? lift(F) \\\\ p-adic entries, integral approximation for readability\n            %3 =\n            [2364 3100]\n            \n            [3100 3119]\n            \n            ? G\n            %4 =\n            [25225 46975]\n            \n            [46975 61850]\n            \n            ? [F,G] * [1,-ellpadics2(E,p,n)]~\n            %5 =\n            [4 + 2*5 + 4*5^2 + 3*5^3 + O(5^5) 4*5^2 + 4*5^3 + 5^4 + O(5^5)]\n            \n            [ 4*5^2 + 4*5^3 + 5^4 + O(5^5) 4 + 3*5 + 4*5^2 + 4*5^3 + 5^4 + O(5^5)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_497ellpadicheightmatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicheightmatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_Q,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_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheightmatrix", 1, 4, 4, 1); __PYX_ERR(4, 8496, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheightmatrix", 1, 4, 4, 2); __PYX_ERR(4, 8496, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheightmatrix", 1, 4, 4, 3); __PYX_ERR(4, 8496, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicheightmatrix") < 0)) __PYX_ERR(4, 8496, __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_E = values[0];
    __pyx_v_p = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8496, __pyx_L3_error)
    __pyx_v_Q = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicheightmatrix", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_496ellpadicheightmatrix(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n, __pyx_v_Q);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_496ellpadicheightmatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_Q) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadicheightmatrix", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":8527
 *             [ 4*5^2 + 4*5^3 + 5^4 + O(5^5) 4 + 3*5 + 4*5^2 + 4*5^3 + 5^4 + O(5^5)]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         Q = objtogen(Q)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8528
 *         '''
 *         E = objtogen(E)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8529
 *         E = objtogen(E)
 *         p = objtogen(p)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8530
 *         p = objtogen(p)
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8530, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8531
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8532
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8533
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8534
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicheightmatrix(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__Q);

  /* "cypari/auto_instance.pxi":8535
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadiclog(self, E, p, long n, P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8496
 *         return new_gen(_ret)
 * 
 *     def ellpadicheightmatrix(self, E, p, long n, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being a vector of points, this function returns the "Gram matrix"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8537
 *         return new_gen(_ret)
 * 
 *     def ellpadiclog(self, E, p, long n, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`E` defined over :math:`K = \mathbb{Q}` or :math:`\mathbb{Q}_p` and :math:`P = [x,y]` on :math:`E(K)` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_499ellpadiclog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_498ellpadiclog[] = "\n        Given :math:`E` defined over :math:`K = \\mathbb{Q}` or :math:`\\mathbb{Q}_p` and :math:`P = [x,y]` on :math:`E(K)` in the\n        kernel of reduction mod :math:`p`, let :math:`t(P) = -x/y` be the formal group\n        parameter; this function returns :math:`L(t)`, where :math:`L` denotes the formal\n        logarithm (mapping the formal group of :math:`E` to the additive formal group)\n        attached to the canonical invariant differential:\n        :math:`dL = dx/(2y + a_1x + a_3)`.\n        \n        ::\n        \n            ? E = ellinit([0,0,1,-4,2]); P = [-2,1];\n            ? ellpadiclog(E,2,10,P)\n            %2 = 2 + 2^3 + 2^8 + 2^9 + 2^10 + O(2^11)\n            ? E = ellinit([17,42]);\n            ? p=3; Ep = ellinit(E,p); \\\\ E mod p\n            ? P=[114,1218]; ellorder(Ep,P) \\\\ the order of P on (E mod p) is 2\n            %5 = 2\n            ? Q = ellmul(E,P,2) \\\\ we need a point of the form 2*P\n            %6 = [200257/7056, 90637343/592704]\n            ? ellpadiclog(E,3,10,Q)\n            %7 = 3 + 2*3^2 + 3^3 + 3^4 + 3^5 + 3^6 + 2*3^8 + 3^9 + 2*3^10 + O(3^11)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_499ellpadiclog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadiclog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_P,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_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadiclog", 1, 4, 4, 1); __PYX_ERR(4, 8537, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadiclog", 1, 4, 4, 2); __PYX_ERR(4, 8537, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadiclog", 1, 4, 4, 3); __PYX_ERR(4, 8537, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadiclog") < 0)) __PYX_ERR(4, 8537, __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_E = values[0];
    __pyx_v_p = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8537, __pyx_L3_error)
    __pyx_v_P = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadiclog", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8537, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadiclog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_498ellpadiclog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n, __pyx_v_P);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_498ellpadiclog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadiclog", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":8560
 *             %7 = 3 + 2*3^2 + 3^3 + 3^4 + 3^5 + 3^6 + 2*3^8 + 3^9 + 2*3^10 + O(3^11)
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         P = objtogen(P)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8561
 *         '''
 *         E = objtogen(E)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8562
 *         E = objtogen(E)
 *         p = objtogen(p)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8563
 *         p = objtogen(p)
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8563, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8564
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8565
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8566
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8567
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadiclog(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__P);

  /* "cypari/auto_instance.pxi":8568
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicregulator(self, E, p, long n, S):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8537
 *         return new_gen(_ret)
 * 
 *     def ellpadiclog(self, E, p, long n, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`E` defined over :math:`K = \mathbb{Q}` or :math:`\mathbb{Q}_p` and :math:`P = [x,y]` on :math:`E(K)` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadiclog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8570
 *         return new_gen(_ret)
 * 
 *     def ellpadicregulator(self, E, p, long n, S):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve. Return the determinant of the Gram
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_501ellpadicregulator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_500ellpadicregulator[] = "\n        Let :math:`E/\\mathbb{Q}` be an elliptic curve. Return the determinant of the Gram\n        matrix of the vector of points :math:`S = (S_1,..., S_r)` with respect to the\n        \"canonical\" cyclotomic :math:`p`-adic height on :math:`E`, given to :math:`n` (:math:`p`-adic)\n        digits.\n        \n        When :math:`E` has ordinary reduction at :math:`p`, this is the expected Gram\n        deteterminant in :math:`\\mathbb{Q}_p`.\n        \n        In the case of supersingular reduction of :math:`E` at :math:`p`, the definition\n        requires care: the regulator :math:`R` is an element of\n        :math:`D := H^1_{dR}(E) \\otimes_\\mathbb{Q} \\mathbb{Q}_p`, which is a two-dimensional\n        :math:`\\mathbb{Q}_p`-vector space spanned by :math:`\\omega` and :math:`\\eta = x \\omega`\n        (which are defined over :math:`\\mathbb{Q}`) or equivalently but now over :math:`\\mathbb{Q}_p`\n        by :math:`\\omega` and :math:`F\\omega` where :math:`F` is the Frobenius endomorphism on :math:`D`\n        as defined in :literal:`ellpadicfrobenius`. On :math:`D` we\n        define the cyclotomic height :math:`h_E = f \\omega + g \\eta`\n        (see :literal:`ellpadicheight`) and a canonical alternating bilinear form\n        :math:`[.,.]_D` such that :math:`[\\omega, \\eta]_D = 1`.\n        \n        For any :math:`\\nu \\in D`, we can define a height :math:`h_\\nu := [ h_E, \\nu ]_D`\n        from :math:`E(\\mathbb{Q})` to :math:`\\mathbb{Q}_p` and :math:`<.,.>_\\nu` the attached\n        bilinear form. In particular, if :math:`h_E = f \\omega + g\\eta`, then\n        :math:`h_\\eta = [ h_E, \\eta ]_D` = f and :math:`h_\\omega = [ h_E, \\omega ]_D = - g`\n        hence :math:`h_E = h_\\eta \\omega - h_\\omega \\eta`.\n        Then, :math:`R` is the unique element of :math:`D` such that\n        \n        .. MATH::\n        \n            [\\omega,\\nu]_D^{r-1} [R, \\nu]_D = \\det (<\302\240S_i, S_j >_{\\nu})\n        \n        for all :math:`\\nu \\in D""` not in :math:`\\mathbb{Q}_p \\omega`. The :literal:`ellpadicregulator`\n        function returns :math:`R` in the basis :math:`(\\omega, F\\omega)`, which was chosen\n        so that :math:`p`-adic BSD conjectures are easy to state, see :literal:`ellpadicbsd`.\n        \n        Note that by definition\n        \n        .. MATH::\n        \n            [R, \\eta]_D = \\det (<\302\240S_i, S_j >_{\\eta})\n        \n        and\n        \n        .. MATH::\n        \n            [R, \\omega+\\eta]_D = \\det (<\302\240S_i, S_j >_{\\omega+\\eta}).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_501ellpadicregulator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_S = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicregulator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_S,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_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicregulator", 1, 4, 4, 1); __PYX_ERR(4, 8570, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicregulator", 1, 4, 4, 2); __PYX_ERR(4, 8570, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_S)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicregulator", 1, 4, 4, 3); __PYX_ERR(4, 8570, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicregulator") < 0)) __PYX_ERR(4, 8570, __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_E = values[0];
    __pyx_v_p = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8570, __pyx_L3_error)
    __pyx_v_S = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicregulator", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8570, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_500ellpadicregulator(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n, __pyx_v_S);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_500ellpadicregulator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_S) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__S;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadicregulator", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_S);

  /* "cypari/auto_instance.pxi":8618
 *             [R, \omega+\eta]_D = \det (<S_i, S_j >_{\omega+\eta}).
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         S = objtogen(S)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8619
 *         '''
 *         E = objtogen(E)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         S = objtogen(S)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8620
 *         E = objtogen(E)
 *         p = objtogen(p)
 *         S = objtogen(S)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_S, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_S, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8621
 *         p = objtogen(p)
 *         S = objtogen(S)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8621, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8622
 *         S = objtogen(S)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _S = (<Gen>S).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8623
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8624
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _S = (<Gen>S).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_S)->__pyx_base.g;
  __pyx_v__S = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8625
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicregulator(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__S);

  /* "cypari/auto_instance.pxi":8626
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadics2(self, E, p, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8570
 *         return new_gen(_ret)
 * 
 *     def ellpadicregulator(self, E, p, long n, S):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve. Return the determinant of the Gram
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadicregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_S);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8628
 *         return new_gen(_ret)
 * 
 *     def ellpadics2(self, E, p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E/\mathbb{Q}` is an elliptic curve with ordinary good
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_503ellpadics2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_502ellpadics2[] = "\n        If :math:`p > 2` is a prime and :math:`E/\\mathbb{Q}` is an elliptic curve with ordinary good\n        reduction at :math:`p`, returns the slope of the unit eigenvector\n        of :literal:`ellpadicfrobenius(E,p,n)`, i.e., the action of Frobenius :math:`\\varphi` on\n        the crystalline module :math:`D_p(E) = \\mathbb{Q}_p \\otimes H^1_{dR}(E/\\mathbb{Q})` in the basis of\n        the given model :math:`(\\omega, \\eta = x \\omega)`, where :math:`\\omega` is the invariant\n        differential :math:`dx/(2 y+a_1 x+a_3)`. In other words, :math:`\\eta + s_2\\omega`\n        is an eigenvector for the unit eigenvalue of :math:`\\varphi`.\n        \n        ::\n        \n            ? e=ellinit([17,42]);\n            ? ellpadics2(e,13,4)\n            %2 = 10 + 2*13 + 6*13^3 + O(13^4)\n        \n        This slope is the unique :math:`c \\in 3^{-1}\\mathbb{Z}_p` such that the odd solution\n        :math:`\\sigma (t) = t + O(t^2)` of\n        \n        .. MATH::\n        \n            - d((1)/(\\sigma) (d \\sigma)/(\\omega))\n            = (x(t) + c) \\omega\n        \n        is in :math:`t\\mathbb{Z}_p[[t]]`.\n        \n        It is equal to :math:`b_2/12 - E_2/12` where :math:`E_2` is the value of the Katz\n        :math:`p`-adic Eisenstein series of weight 2 on :math:`(E,\\omega)`. This is\n        used to construct a canonical :math:`p`-adic height when :math:`E` has good ordinary\n        reduction at :math:`p` as follows\n        \n        ::\n        \n            s2 = ellpadics2(E,p,n);\n            h(E,p,n, P, s2) = ellpadicheight(E, [p,[1,-s2]],n, P);\n        \n        Since :math:`s_2` does not depend on the point :math:`P`, we compute it\n        only once.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_503ellpadics2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadics2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadics2", 1, 3, 3, 1); __PYX_ERR(4, 8628, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadics2", 1, 3, 3, 2); __PYX_ERR(4, 8628, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadics2") < 0)) __PYX_ERR(4, 8628, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_E = values[0];
    __pyx_v_p = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8628, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadics2", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8628, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadics2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_502ellpadics2(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_502ellpadics2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadics2", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":8667
 *         only once.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8668
 *         '''
 *         E = objtogen(E)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8669
 *         E = objtogen(E)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8669, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8670
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ellpadics2(_E, _p, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8671
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadics2(_E, _p, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8672
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ellpadics2(_E, _p, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadics2(__pyx_v__E, __pyx_v__p, __pyx_v_n);

  /* "cypari/auto_instance.pxi":8673
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ellpadics2(_E, _p, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellperiods(self, w, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8628
 *         return new_gen(_ret)
 * 
 *     def ellpadics2(self, E, p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E/\mathbb{Q}` is an elliptic curve with ordinary good
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpadics2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8675
 *         return new_gen(_ret)
 * 
 *     def ellperiods(self, w, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`w` describe a complex period lattice (:math:`w = [w_1,w_2]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_505ellperiods(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_504ellperiods[] = "\n        Let :math:`w` describe a complex period lattice (:math:`w = [w_1,w_2]`\n        or an :literal:`ellinit` structure). Returns normalized periods :math:`[W_1,W_2]` generating\n        the same lattice such that :math:`\\tau := W_1/W_2` has positive imaginary part\n        and lies in the standard fundamental domain for :math:`SL_2(\\mathbb{Z})`.\n        \n        If :math:`flag = 1`, the function returns :math:`[[W_1,W_2], [\\eta_1,\\eta_2]]`, where\n        :math:`\\eta_1` and :math:`\\eta_2` are the quasi-periods attached to\n        :math:`[W_1,W_2]`, satisfying :math:`\\eta_2 W_1 - \\eta_1 W_2 = 2 i \\pi`.\n        \n        The output of this function is meant to be used as the first argument\n        given to ellwp, ellzeta, ellsigma or elleisnum. Quasi-periods are\n        needed by ellzeta and ellsigma only.\n        \n        ::\n        \n            ? L = ellperiods([1,I],1);\n            ? [w1,w2] = L[1]; [e1,e2] = L[2];\n            ? e2*w1 - e1*w2\n            %3 = 6.2831853071795864769252867665590057684*I\n            ? ellzeta(L, 1/2 + 2*I)\n            %4 = 1.5707963... - 6.283185307...*I\n            ? ellzeta([1,I], 1/2 + 2*I) \\\\ same but less efficient\n            %4 = 1.5707963... - 6.283185307...*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_505ellperiods(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellperiods (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellperiods") < 0)) __PYX_ERR(4, 8675, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8675, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8675, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellperiods", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8675, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellperiods", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_504ellperiods(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_504ellperiods(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellperiods", 0);
  __Pyx_INCREF(__pyx_v_w);

  /* "cypari/auto_instance.pxi":8701
 *             %4 = 1.5707963... - 6.283185307...*I
 *         '''
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8702
 *         '''
 *         w = objtogen(w)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8702, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8703
 *         w = objtogen(w)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellperiods(_w, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8704
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellperiods(_w, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":8705
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellperiods(_w, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellperiods(__pyx_v__w, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":8706
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellperiods(_w, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpointtoz(self, E, P, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8675
 *         return new_gen(_ret)
 * 
 *     def ellperiods(self, w, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`w` describe a complex period lattice (:math:`w = [w_1,w_2]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellperiods", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8708
 *         return new_gen(_ret)
 * 
 *     def ellpointtoz(self, E, P, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E/\mathbb{C} ~ \mathbb{C}/\Lambda` is a complex elliptic curve (:math:`\Lambda =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_507ellpointtoz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_506ellpointtoz[] = "\n        If :math:`E/\\mathbb{C} ~ \\mathbb{C}/\\Lambda` is a complex elliptic curve (:math:`\\Lambda =\n        E.omega`), computes a complex number :math:`z`, well-defined modulo the\n        lattice :math:`\\Lambda`, corresponding to the point :math:`P`; i.e.\302\240such that\n        :math:`P = [\\wp_\\Lambda (z),\\wp'_\\Lambda (z)]` satisfies the equation\n        \n        .. MATH::\n        \n            y^2 = 4x^3 - g_2 x - g_3,\n        \n        where :math:`g_2`, :math:`g_3` are the elliptic invariants.\n        \n        If :math:`E` is defined over :math:`\\mathbb{R}` and :math:`P\\in E(\\mathbb{R})`, we have more precisely, :math:`0 \\leq\n        \\Re (t) < w1` and :math:`0 <= \\Im (t) < \\Im (w2)`, where :math:`(w1,w2)` are the real and\n        complex periods of :math:`E`.\n        \n        ::\n        \n            ? E = ellinit([0,1]); P = [2,3];\n            ? z = ellpointtoz(E, P)\n            %2 = 3.5054552633136356529375476976257353387\n            ? ellwp(E, z)\n            %3 = 2.0000000000000000000000000000000000000\n            ? ellztopoint(E, z) - P\n            %4 = [2.548947057811923643 E-57, 7.646841173435770930 E-57]\n            ? ellpointtoz(E, [0]) \\\\ the point at infinity\n            %5 = 0\n        \n        If :math:`E` is defined over a general number field, the function returns the\n        values corresponding to the various complex embeddings of the curve\n        and of the point, in the same order as :literal:`E.nf.roots`:\n        \n        ::\n        \n            ? E=ellinit([-22032-15552*x,0], nfinit(x^2-2));\n            ? P=[-72*x-108,0];\n            ? ellisoncurve(E,P)\n            %3 = 1\n            ? ellpointtoz(E,P)\n            %4 = [-0.52751724240790530394437835702346995884*I,\n             -0.090507650025885335533571758708283389896*I]\n            ? E.nf.roots\n            %5 = [-1.4142135623730950488016887242096980786, \\\\ x-> -sqrt(2)\n             1.4142135623730950488016887242096980786] \\\\ x->"" sqrt(2)\n        \n        If :math:`E/\\mathbb{Q}_p` has multiplicative reduction, then :math:`E/\\bar{\\mathbb{Q}_p}` is analytically\n        isomorphic to :math:`\\bar{\\mathbb{Q}}_p^*/q^\\mathbb{Z}` (Tate curve) for some :math:`p`-adic integer :math:`q`.\n        The behavior is then as follows:\n        \n        - If the reduction is split (:math:`E.tate[2]` is a :literal:`t_PADIC`), we have\n          an isomorphism :math:`\\phi: E(\\mathbb{Q}_p) ~ \\mathbb{Q}_p^*/q^\\mathbb{Z}` and the function returns\n          :math:`\\phi (P)\\in \\mathbb{Q}_p`.\n        \n        - If the reduction is :emphasis:`not` split (:math:`E.tate[2]` is a\n          :literal:`t_POLMOD`), we only have an isomorphism :math:`\\phi: E(K) ~ K^*/q^\\mathbb{Z}` over\n          the unramified quadratic extension :math:`K/\\mathbb{Q}_p`. In this case, the output\n          :math:`\\phi (P)\\in K` is a :literal:`t_POLMOD`.\n        \n        ::\n        \n            ? E = ellinit([0,-1,1,0,0], O(11^5)); P = [0,0];\n            ? [u2,u,q] = E.tate; type(u) \\\\ split multiplicative reduction\n            %2 = \"t_PADIC\"\n            ? ellmul(E, P, 5) \\\\ P has order 5\n            %3 = [0]\n            ? z = ellpointtoz(E, [0,0])\n            %4 = 3 + 11^2 + 2*11^3 + 3*11^4 + 6*11^5 + 10*11^6 + 8*11^7 + O(11^8)\n            ? z^5\n            %5 = 1 + O(11^9)\n            ? E = ellinit(ellfromj(1/4), O(2^6)); x=1/2; y=ellordinate(E,x)[1];\n            ? z = ellpointtoz(E,[x,y]); \\\\ t_POLMOD of t_POL with t_PADIC coeffs\n            ? liftint(z) \\\\ lift all p-adics\n            %8 = Mod(8*u + 7, u^2 + 437)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_507ellpointtoz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_P = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpointtoz (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_P,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpointtoz", 0, 2, 3, 1); __PYX_ERR(4, 8708, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpointtoz") < 0)) __PYX_ERR(4, 8708, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_P = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8708, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpointtoz", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8708, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpointtoz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_506ellpointtoz(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_P, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_506ellpointtoz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpointtoz", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":8783
 *             %8 = Mod(8*u + 7, u^2 + 437)
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8784
 *         '''
 *         E = objtogen(E)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8785
 *         E = objtogen(E)
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8785, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8786
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8787
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zell(_E, _P, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8788
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zell(_E, _P, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":8789
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zell(_E, _P, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zell(__pyx_v__E, __pyx_v__P, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":8790
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zell(_E, _P, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpow(self, E, z, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8708
 *         return new_gen(_ret)
 * 
 *     def ellpointtoz(self, E, P, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E/\mathbb{C} ~ \mathbb{C}/\Lambda` is a complex elliptic curve (:math:`\Lambda =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpointtoz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8792
 *         return new_gen(_ret)
 * 
 *     def ellpow(self, E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellmul`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_509ellpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_508ellpow[] = "\n        Deprecated alias for :literal:`ellmul`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_509ellpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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("ellpow", 1, 3, 3, 1); __PYX_ERR(4, 8792, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpow", 1, 3, 3, 2); __PYX_ERR(4, 8792, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpow") < 0)) __PYX_ERR(4, 8792, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_E = values[0];
    __pyx_v_z = values[1];
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpow", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8792, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_508ellpow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_508ellpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpow", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":8796
 *         Deprecated alias for :literal:`ellmul`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)
 *         E = objtogen(E)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8796, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":8797
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         E = objtogen(E)
 *         z = objtogen(z)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":8798
 *         from warnings import warn
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         n = objtogen(n)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":8799
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)
 *         E = objtogen(E)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":8800
 *         E = objtogen(E)
 *         z = objtogen(z)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":8801
 *         z = objtogen(z)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 8801, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8802
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8803
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8804
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8805
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellmul(__pyx_v__E, __pyx_v__z, __pyx_v__n);

  /* "cypari/auto_instance.pxi":8806
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellratpoints(self, E, h, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 8806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8792
 *         return new_gen(_ret)
 * 
 *     def ellpow(self, E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellmul`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8808
 *         return new_gen(_ret)
 * 
 *     def ellratpoints(self, E, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an integral model of elliptic curve , return a vector
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_511ellratpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_510ellratpoints[] = "\n        :math:`E` being an integral model of elliptic curve , return a vector\n        containing the affine rational points on the curve of naive height less than\n        :math:`h`. If :math:`flag = 1`, stop as soon as a point is found; return either an empty\n        vector or a vector containing a single point.\n        See :literal:`hyperellratpoints` for how :math:`h` can be specified.\n        \n        ::\n        \n            ? E=ellinit([-25,1]);\n            ? ellratpoints(E,10)\n            %2 = [[-5,1],[-5,-1],[-3,7],[-3,-7],[-1,5],[-1,-5],\n             [0,1],[0,-1],[5,1],[5,-1],[7,13],[7,-13]]\n            ? ellratpoints(E,10,1)\n            %3 = [[-5,1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_511ellratpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_h = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellratpoints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_h,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellratpoints", 0, 2, 3, 1); __PYX_ERR(4, 8808, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellratpoints") < 0)) __PYX_ERR(4, 8808, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_h = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8808, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellratpoints", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8808, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_510ellratpoints(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_h, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_510ellratpoints(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_h, long __pyx_v_flag) {
  GEN __pyx_v__E;
  GEN __pyx_v__h;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellratpoints", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_h);

  /* "cypari/auto_instance.pxi":8825
 *             %3 = [[-5,1]]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         h = objtogen(h)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8826
 *         '''
 *         E = objtogen(E)
 *         h = objtogen(h)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_h, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8827
 *         E = objtogen(E)
 *         h = objtogen(h)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _h = (<Gen>h).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8827, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8828
 *         h = objtogen(h)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8829
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _h = (<Gen>h).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_h)->__pyx_base.g;
  __pyx_v__h = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8830
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellratpoints(__pyx_v__E, __pyx_v__h, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":8831
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellrootno(self, E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8808
 *         return new_gen(_ret)
 * 
 *     def ellratpoints(self, E, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an integral model of elliptic curve , return a vector
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8833
 *         return new_gen(_ret)
 * 
 *     def ellrootno(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :literal:`ell` structure over :math:`\mathbb{Q}` as output by :literal:`ellinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_513ellrootno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_512ellrootno[] = "\n        :math:`E` being an :literal:`ell` structure over :math:`\\mathbb{Q}` as output by :literal:`ellinit`,\n        this function computes the local root number of its :math:`L`-series at the place\n        :math:`p` (at the infinite place if :math:`p = 0`). If :math:`p` is omitted, return the global\n        root number and in this case the curve can also be defined over a number field.\n        \n        Note that the global root number is the sign of the functional\n        equation and conjecturally is the parity of the rank of the\n        Mordell-Weil group. The equation for :math:`E` needs not be minimal at :math:`p`,\n        but if the model is already minimal the function will run faster.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_513ellrootno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellrootno (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellrootno") < 0)) __PYX_ERR(4, 8833, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellrootno", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8833, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellrootno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_512ellrootno(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_512ellrootno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellrootno", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":8845
 *         but if the model is already minimal the function will run faster.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8846
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":8847
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8848
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":8847
 *         E = objtogen(E)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":8849
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 8849, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8850
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":8851
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":8852
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":8853
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = ellrootno(_E, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":8852
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)
 */
  }

  /* "cypari/auto_instance.pxi":8854
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = ellrootno(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_instance.pxi":8855
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":8856
 *         cdef long _ret = ellrootno(_E, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def ellsea(self, E, long tors=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8833
 *         return new_gen(_ret)
 * 
 *     def ellrootno(self, E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :literal:`ell` structure over :math:`\mathbb{Q}` as output by :literal:`ellinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellrootno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8858
 *         return _ret
 * 
 *     def ellsea(self, E, long tors=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :emphasis:`ell` structure as output by :literal:`ellinit`, defined over
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_515ellsea(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_514ellsea[] = "\n        Let :math:`E` be an :emphasis:`ell` structure as output by :literal:`ellinit`, defined over\n        a finite field :math:`\\mathbb{F}_q`. This low-level function computes the order of the\n        group :math:`E(\\mathbb{F}_q)` using the SEA algorithm; compared to the high-level\n        function :literal:`ellcard`, which includes SEA among its choice of algorithms,\n        the :literal:`tors` argument allows to speed up a search for curves having almost\n        prime order and whose quadratic twist may also have almost prime order.\n        When :literal:`tors` is set to a non-zero value, the function returns :math:`0` as soon\n        as it detects that the order has a small prime factor not dividing :literal:`tors`;\n        SEA considers modular polynomials of increasing prime degree :math:`\\ell` and we\n        return :math:`0` as soon as we hit an :math:`\\ell` (coprime to :literal:`tors`) dividing\n        :math:`\\#E(\\mathbb{F}_q)`:\n        \n        ::\n        \n            ? ellsea(ellinit([1,1], 2^56+3477), 1)\n            %1 = 72057594135613381\n            ? forprime(p=2^128,oo, q = ellcard(ellinit([1,1],p)); if(isprime(q),break))\n            time = 6,571 ms.\n            ? forprime(p=2^128,oo, q = ellsea(ellinit([1,1],p),1);if(isprime(q),break))\n            time = 522 ms.\n        \n        In particular, set :literal:`tors` to :math:`1` if you want a curve with prime order,\n        to :math:`2` if you want to allow a cofactor which is a power of two (e.g. for\n        Edwards's curves), etc. The early exit on bad curves yields a massive\n        speedup compared to running the cardinal algorithm to completion.\n        \n        When :literal:`tors` is negative, similar checks are performed for the quadratic\n        twist of the curve.\n        \n        The following function returns a curve of prime order over :math:`\\mathbb{F}_p`.\n        \n        ::\n        \n            cryptocurve(p) =\n            {\n             while(""1,\n             my(E, N, j = Mod(random(p), p));\n             E = ellinit(ellfromj(j));\n             N = ellsea(E, 1); if (!N, continue);\n             if (isprime(N), return(E));\n             \\\\ try the quadratic twist for free\n             if (isprime(2*p+2 - N), return(ellinit(elltwist(E))));\n             );\n            }\n            ? p = randomprime([2^255, 2^256]);\n            ? E = cryptocurve(p); \\\\ insist on prime order\n            %2 = 47,447ms\n        \n        The same example without early abort (using :literal:`ellcard(E)`\n        instead of :literal:`ellsea(E, 1)`) runs for about 5 minutes before finding a\n        suitable curve.\n        \n        The availability of the :literal:`seadata` package will speed up the computation,\n        and is strongly recommended. The generic function :literal:`ellcard` should be\n        preferred when you only want to compute the cardinal of a given curve without\n        caring about it having almost prime order:\n        \n        - If the characteristic is too small (:math:`p <= 7`) or the field\n          cardinality is tiny (:math:`q <= 523`) the generic algorithm\n          :literal:`ellcard` is used instead and the :literal:`tors` argument is ignored.\n          (The reason for this is that SEA is not implemented for :math:`p <= 7` and\n          that if :math:`q <= 523` it is likely to run into an infinite loop.)\n        \n        - If the field cardinality is smaller than about :math:`2^{50}`, the\n          generic algorithm will be faster.\n        \n        - Contrary to :literal:`ellcard`, :literal:`ellsea` does not store the computed\n          cardinality in :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_515ellsea(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_tors;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsea (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_tors,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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tors);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellsea") < 0)) __PYX_ERR(4, 8858, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_tors = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_tors == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8858, __pyx_L3_error)
    } else {
      __pyx_v_tors = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellsea", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8858, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellsea", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_514ellsea(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_tors);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_514ellsea(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_tors) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellsea", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":8929
 *           cardinality in :math:`E`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8930
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellsea(_E, tors)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8930, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8931
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsea(_E, tors)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8932
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellsea(_E, tors)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsea(__pyx_v__E, __pyx_v_tors);

  /* "cypari/auto_instance.pxi":8933
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellsea(_E, tors)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellsearch(self, N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8858
 *         return _ret
 * 
 *     def ellsea(self, E, long tors=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :emphasis:`ell` structure as output by :literal:`ellinit`, defined over
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellsea", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8935
 *         return new_gen(_ret)
 * 
 *     def ellsearch(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function finds all curves in the :literal:`elldata` database satisfying
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_517ellsearch(PyObject *__pyx_v_self, PyObject *__pyx_v_N); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_516ellsearch[] = "\n        This function finds all curves in the :literal:`elldata` database satisfying\n        the constraint defined by the argument :math:`N`:\n        \n        - if :math:`N` is a character string, it selects a given curve, e.g.\n          :literal:`\"11a1\"`, or curves in the given isogeny class, e.g. :literal:`\"11a\"`, or\n          curves with given conductor, e.g. :literal:`\"11\"`;\n        \n        - if :math:`N` is a vector of integers, it encodes the same constraints\n          as the character string above, according to the :literal:`ellconvertname`\n          correspondance, e.g. :literal:`[11,0,1]` for :literal:`\"11a1\"`, :literal:`[11,0]` for\n          :literal:`\"11a\"` and :literal:`[11]` for :literal:`\"11\"`;\n        \n        - if :math:`N` is an integer, curves with conductor :math:`N` are selected.\n        \n        If :math:`N` codes a full curve name, for instance :literal:`\"11a1\"` or :literal:`[11,0,1]`,\n        the output format is :math:`[N, [a_1,a_2,a_3,a_4,a_6], G]` where\n        :math:`[a_1,a_2,a_3,a_4,a_6]` are the coefficients of the Weierstrass equation of\n        the curve and :math:`G` is a :math:`\\mathbb{Z}`-basis of the free part of the\n        Mordell-Weil group attached to the curve.\n        \n        ::\n        \n            ? ellsearch(\"11a3\")\n            %1 = [\"11a3\", [0, -1, 1, 0, 0], []]\n            ? ellsearch([11,0,3])\n            %2 = [\"11a3\", [0, -1, 1, 0, 0], []]\n        \n        If :math:`N` is not a full curve name, then the output is a vector of all matching\n        curves in the above format:\n        \n        ::\n        \n            ? ellsearch(\"11a\")\n            %1 = [[\"11a1\", [0, -1, 1, -10, -20], []],\n             [\"11a2\", [0, -1, 1, -7820, -263580], []],\n             [\"11a3\", [0, -1, 1, 0, 0], []]]\n            ? ellsearch(\"11b\")\n            %2 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_517ellsearch(PyObject *__pyx_v_self, PyObject *__pyx_v_N) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsearch (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_516ellsearch(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_N));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_516ellsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellsearch", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":8976
 *             %2 = []
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":8977
 *         '''
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = ellsearch(_N)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 8977, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":8978
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsearch(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":8979
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = ellsearch(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsearch(__pyx_v__N);

  /* "cypari/auto_instance.pxi":8980
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = ellsearch(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellsigma(self, L, z=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8935
 *         return new_gen(_ret)
 * 
 *     def ellsearch(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function finds all curves in the :literal:`elldata` database satisfying
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":8982
 *         return new_gen(_ret)
 * 
 *     def ellsigma(self, L, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\sigma` function attached to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_519ellsigma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_518ellsigma[] = "\n        Computes the value at :math:`z` of the Weierstrass :math:`\\sigma` function attached to\n        the lattice :math:`L` as given by :literal:`ellperiods`:math:`(,1)`: including quasi-periods\n        is useful, otherwise there are recomputed from scratch for each new :math:`z`.\n        \n        .. MATH::\n        \n            \\sigma (z, L) = z \\prod_{\\omega\\in L^*} (1 -\n            (z)/(\\omega))e^{(z)/(\\omega) + (z^2)/(2\\omega^2)}.\n        \n        It is also possible to directly input :math:`L = [\\omega_1,\\omega_2]`,\n        or an elliptic curve :math:`E` as given by :literal:`ellinit` (:math:`L = E.omega`).\n        \n        ::\n        \n            ? w = ellperiods([1,I], 1);\n            ? ellsigma(w, 1/2)\n            %2 = 0.47494937998792065033250463632798296855\n            ? E = ellinit([1,0]);\n            ? ellsigma(E) \\\\ at 'x, implicitly at default seriesprecision\n            %4 = x + 1/60*x^5 - 1/10080*x^9 - 23/259459200*x^13 + O(x^17)\n        \n        If :math:`flag = 1`, computes an arbitrary determination of :math:`\\log (\\sigma (z))`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_519ellsigma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_z = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsigma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_z,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellsigma") < 0)) __PYX_ERR(4, 8982, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    __pyx_v_z = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8982, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 8982, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellsigma", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 8982, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellsigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_518ellsigma(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_z, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_518ellsigma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_z;
  GEN __pyx_v__L;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellsigma", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":9007
 *         If :math:`flag = 1`, computes an arbitrary determination of :math:`\log (\sigma (z))`.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9008
 *         '''
 *         L = objtogen(L)
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_2 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9009
 *         L = objtogen(L)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9010
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9010, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":9009
 *         L = objtogen(L)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":9011
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9011, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9012
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9013
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_instance.pxi":9014
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9015
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_instance.pxi":9014
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":9016
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9017
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsigma(__pyx_v__L, __pyx_v__z, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9018
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellsub(self, E, z1, z2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":8982
 *         return new_gen(_ret)
 * 
 *     def ellsigma(self, L, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\sigma` function attached to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellsigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9020
 *         return new_gen(_ret)
 * 
 *     def ellsub(self, E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the points :math:`z1` and :math:`z2` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_521ellsub(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_520ellsub[] = "\n        Difference of the points :math:`z1` and :math:`z2` on the\n        elliptic curve corresponding to :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_521ellsub(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z1 = 0;
  PyObject *__pyx_v_z2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsub (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z1,&__pyx_n_s_z2,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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_z1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellsub", 1, 3, 3, 1); __PYX_ERR(4, 9020, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellsub", 1, 3, 3, 2); __PYX_ERR(4, 9020, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellsub") < 0)) __PYX_ERR(4, 9020, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_E = values[0];
    __pyx_v_z1 = values[1];
    __pyx_v_z2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellsub", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9020, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_520ellsub(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z1, __pyx_v_z2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_520ellsub(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2) {
  GEN __pyx_v__E;
  GEN __pyx_v__z1;
  GEN __pyx_v__z2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellsub", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z1);
  __Pyx_INCREF(__pyx_v_z2);

  /* "cypari/auto_instance.pxi":9025
 *         elliptic curve corresponding to :math:`E`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9026
 *         '''
 *         E = objtogen(E)
 *         z1 = objtogen(z1)             # <<<<<<<<<<<<<<
 *         z2 = objtogen(z2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9027
 *         E = objtogen(E)
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9028
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9028, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9029
 *         z2 = objtogen(z2)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9030
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z1)->__pyx_base.g;
  __pyx_v__z1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9031
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z2)->__pyx_base.g;
  __pyx_v__z2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9032
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsub(__pyx_v__E, __pyx_v__z1, __pyx_v__z2);

  /* "cypari/auto_instance.pxi":9033
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltamagawa(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9020
 *         return new_gen(_ret)
 * 
 *     def ellsub(self, E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the points :math:`z1` and :math:`z2` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z1);
  __Pyx_XDECREF(__pyx_v_z2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9035
 *         return new_gen(_ret)
 * 
 *     def elltamagawa(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns the global
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_523elltamagawa(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_522elltamagawa[] = "\n        The object :math:`E` being an elliptic curve over a number field, returns the global\n        Tamagawa number of the curve (including the factor at infinite places).\n        \n        ::\n        \n            ? e = ellinit([1, -1, 1, -3002, 63929]); \\\\ curve \"90c6\" from elldata\n            ? elltamagawa(e)\n            %2 = 288\n            ? [elllocalred(e,p)[4] | p<-[2,3,5]]\n            %3 = [6, 4, 6]\n            ? vecprod(%) \\\\ since e.disc > 0 the factor at infinity is 2\n            %4 = 144\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_523elltamagawa(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltamagawa (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_522elltamagawa(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_522elltamagawa(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elltamagawa", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":9050
 *             %4 = 144
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9051
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltamagawa(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9051, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9052
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltamagawa(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9053
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltamagawa(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltamagawa(__pyx_v__E);

  /* "cypari/auto_instance.pxi":9054
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltamagawa(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltaniyama(self, E, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9035
 *         return new_gen(_ret)
 * 
 *     def elltamagawa(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns the global
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltamagawa", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9056
 *         return new_gen(_ret)
 * 
 *     def elltaniyama(self, E, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the modular parametrization of the elliptic curve :math:`E/\mathbb{Q}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_525elltaniyama(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_524elltaniyama[] = "\n        Computes the modular parametrization of the elliptic curve :math:`E/\\mathbb{Q}`,\n        where :math:`E` is an :literal:`ell` structure as output by :literal:`ellinit`. This returns\n        a two-component vector :math:`[u,v]` of power series, given to :math:`d` significant\n        terms (:literal:`seriesprecision` by default), characterized by the following two\n        properties. First the point :math:`(u,v)` satisfies the equation of the elliptic\n        curve. Second, let :math:`N` be the conductor of :math:`E` and :math:`\\Phi: X_0(N)\\to E`\n        be a modular parametrization; the pullback by :math:`\\Phi` of the\n        N\303\251ron differential :math:`du/(2v+a_1u+a_3)` is equal to :math:`2i\\pi\n        f(z)dz`, a holomorphic differential form. The variable used in the power\n        series for :math:`u` and :math:`v` is :math:`x`, which is implicitly understood to be equal to\n        :math:`\\exp (2i\\pi z)`.\n        \n        The algorithm assumes that :math:`E` is a :emphasis:`strong` Weil curve\n        and that the Manin constant is equal to 1: in fact, :math:`f(x) = \\sum_{n > 0}\n        ellan (E, n) x^n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_525elltaniyama(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltaniyama (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_serprec,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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elltaniyama") < 0)) __PYX_ERR(4, 9056, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9056, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elltaniyama", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9056, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltaniyama", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_524elltaniyama(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_serprec);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_524elltaniyama(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_serprec) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("elltaniyama", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":9074
 *         ellan (E, n) x^n`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9075
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9075, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9076
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9077
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 */
  __pyx_t_4 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":9078
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":9077
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 */
  }

  /* "cypari/auto_instance.pxi":9079
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltaniyama(__pyx_v__E, __pyx_v_serprec);

  /* "cypari/auto_instance.pxi":9080
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltatepairing(self, E, P, Q, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9056
 *         return new_gen(_ret)
 * 
 *     def elltaniyama(self, E, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the modular parametrization of the elliptic curve :math:`E/\mathbb{Q}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltaniyama", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9082
 *         return new_gen(_ret)
 * 
 *     def elltatepairing(self, E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Tate pairing of the two points :math:`P` and :math:`Q` on the elliptic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_527elltatepairing(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_526elltatepairing[] = "\n        Computes the Tate pairing of the two points :math:`P` and :math:`Q` on the elliptic\n        curve :math:`E`. The point :math:`P` must be of :math:`m`-torsion.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_527elltatepairing(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltatepairing (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_m,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_E)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elltatepairing", 1, 4, 4, 1); __PYX_ERR(4, 9082, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elltatepairing", 1, 4, 4, 2); __PYX_ERR(4, 9082, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elltatepairing", 1, 4, 4, 3); __PYX_ERR(4, 9082, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elltatepairing") < 0)) __PYX_ERR(4, 9082, __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_E = values[0];
    __pyx_v_P = values[1];
    __pyx_v_Q = values[2];
    __pyx_v_m = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elltatepairing", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9082, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltatepairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_526elltatepairing(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_P, __pyx_v_Q, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_526elltatepairing(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elltatepairing", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":9087
 *         curve :math:`E`. The point :math:`P` must be of :math:`m`-torsion.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9088
 *         '''
 *         E = objtogen(E)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9089
 *         E = objtogen(E)
 *         P = objtogen(P)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9090
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9091
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9091, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9092
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9093
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9094
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9095
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9096
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltatepairing(__pyx_v__E, __pyx_v__P, __pyx_v__Q, __pyx_v__m);

  /* "cypari/auto_instance.pxi":9097
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltors(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9082
 *         return new_gen(_ret)
 * 
 *     def elltatepairing(self, E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Tate pairing of the two points :math:`P` and :math:`Q` on the elliptic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltatepairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9099
 *         return new_gen(_ret)
 * 
 *     def elltors(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve defined over a number field or a finite field,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_529elltors(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_528elltors[] = "\n        If :math:`E` is an elliptic curve defined over a number field or a finite field,\n        outputs the torsion subgroup of :math:`E` as a 3-component vector :literal:`[t,v1,v2]`,\n        where :literal:`t` is the order of the torsion group, :literal:`v1` gives the structure\n        of the torsion group as a product of cyclic groups (sorted by decreasing\n        order), and :literal:`v2` gives generators for these cyclic groups. :math:`E` must be an\n        :literal:`ell` structure as output by :literal:`ellinit`.\n        \n        ::\n        \n            ? E = ellinit([-1,0]);\n            ? elltors(E)\n            %1 = [4, [2, 2], [[0, 0], [1, 0]]]\n        \n        Here, the torsion subgroup is isomorphic to :math:`\\mathbb{Z}/2\\mathbb{Z} x \\mathbb{Z}/2\\mathbb{Z}`, with\n        generators :math:`[0,0]` and :math:`[1,0]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_529elltors(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltors (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_528elltors(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_528elltors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elltors", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":9117
 *         generators :math:`[0,0]` and :math:`[1,0]`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9118
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltors(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9118, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9119
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltors(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9120
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltors(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltors(__pyx_v__E);

  /* "cypari/auto_instance.pxi":9121
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltors(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltwist(self, E, P=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9099
 *         return new_gen(_ret)
 * 
 *     def elltors(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve defined over a number field or a finite field,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9123
 *         return new_gen(_ret)
 * 
 *     def elltwist(self, E, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of the twist of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_531elltwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_530elltwist[] = "\n        Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of the twist of the\n        elliptic curve :math:`E` by the quadratic extension of the coefficient ring\n        defined by :math:`P` (when :math:`P` is a polynomial) or :literal:`quadpoly(P)` when :math:`P` is an\n        integer. If :math:`E` is defined over a finite field, then :math:`P` can be omitted,\n        in which case a random model of the unique non-trivial twist is returned.\n        If :math:`E` is defined over a number field, the model should be replaced by a\n        minimal model (if one exists).\n        \n        Example: Twist by discriminant :math:`-3`:\n        \n        ::\n        \n            ? elltwist(ellinit([0,a2,0,a4,a6]),-3)\n            %1 = [0,-3*a2,0,9*a4,-27*a6]\n        \n        Twist by the Artin-Shreier extension given by :math:`x^2+x+T` in\n        characteristic :math:`2`:\n        \n        ::\n        \n            ? lift(elltwist(ellinit([a1,a2,a3,a4,a6]*Mod(1,2)),x^2+x+T))\n            %1 = [a1,a2+a1^2*T,a3,a4,a6+a3^2*T]\n        \n        Twist of an elliptic curve defined over a finite field:\n        \n        ::\n        \n            ? E=ellinit([1,7]*Mod(1,19));lift(elltwist(E))\n            %1 = [0,0,0,11,12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_531elltwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltwist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_P,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elltwist") < 0)) __PYX_ERR(4, 9123, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    __pyx_v_P = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elltwist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9123, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_530elltwist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_P);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_530elltwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P) {
  int __pyx_v__have_P;
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("elltwist", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":9155
 *             %1 = [0,0,0,11,12]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9155, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9156
 *         '''
 *         E = objtogen(E)
 *         cdef bint _have_P = (P is not None)             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             P = objtogen(P)
 */
  __pyx_t_2 = (__pyx_v_P != Py_None);
  __pyx_v__have_P = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9157
 *         E = objtogen(E)
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_P != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9158
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:
 *             P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9158, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":9157
 *         E = objtogen(E)
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":9159
 *         if _have_P:
 *             P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9159, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9160
 *             P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = NULL
 *         if _have_P:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9161
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             _P = (<Gen>P).g
 */
  __pyx_v__P = NULL;

  /* "cypari/auto_instance.pxi":9162
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)
 */
  __pyx_t_2 = (__pyx_v__have_P != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9163
 *         cdef GEN _P = NULL
 *         if _have_P:
 *             _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltwist(_E, _P)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
    __pyx_v__P = __pyx_t_4;

    /* "cypari/auto_instance.pxi":9162
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)
 */
  }

  /* "cypari/auto_instance.pxi":9164
 *         if _have_P:
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltwist(__pyx_v__E, __pyx_v__P);

  /* "cypari/auto_instance.pxi":9165
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellweilpairing(self, E, P, Q, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9123
 *         return new_gen(_ret)
 * 
 *     def elltwist(self, E, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of the twist of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.elltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9167
 *         return new_gen(_ret)
 * 
 *     def ellweilpairing(self, E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Weil pairing of the two points of :math:`m`-torsion :math:`P` and :math:`Q`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_533ellweilpairing(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_532ellweilpairing[] = "\n        Computes the Weil pairing of the two points of :math:`m`-torsion :math:`P` and :math:`Q`\n        on the elliptic curve :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_533ellweilpairing(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellweilpairing (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_m,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_E)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellweilpairing", 1, 4, 4, 1); __PYX_ERR(4, 9167, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellweilpairing", 1, 4, 4, 2); __PYX_ERR(4, 9167, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellweilpairing", 1, 4, 4, 3); __PYX_ERR(4, 9167, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellweilpairing") < 0)) __PYX_ERR(4, 9167, __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_E = values[0];
    __pyx_v_P = values[1];
    __pyx_v_Q = values[2];
    __pyx_v_m = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellweilpairing", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9167, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellweilpairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_532ellweilpairing(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_P, __pyx_v_Q, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_532ellweilpairing(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellweilpairing", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":9172
 *         on the elliptic curve :math:`E`.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9173
 *         '''
 *         E = objtogen(E)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9174
 *         E = objtogen(E)
 *         P = objtogen(P)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9175
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9176
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9176, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9177
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9178
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9179
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9180
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9181
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellweilpairing(__pyx_v__E, __pyx_v__P, __pyx_v__Q, __pyx_v__m);

  /* "cypari/auto_instance.pxi":9182
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellwp(self, w, z=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9167
 *         return new_gen(_ret)
 * 
 *     def ellweilpairing(self, E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Weil pairing of the two points of :math:`m`-torsion :math:`P` and :math:`Q`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellweilpairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9184
 *         return new_gen(_ret)
 * 
 *     def ellwp(self, w, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\wp` function attached to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_535ellwp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_534ellwp[] = "\n        Computes the value at :math:`z` of the Weierstrass :math:`\\wp` function attached to\n        the lattice :math:`w` as given by :literal:`ellperiods`. It is also possible to\n        directly input :math:`w = [\\omega_1,\\omega_2]`, or an elliptic curve :math:`E` as given\n        by :literal:`ellinit` (:math:`w = E.omega`).\n        \n        ::\n        \n            ? w = ellperiods([1,I]);\n            ? ellwp(w, 1/2)\n            %2 = 6.8751858180203728274900957798105571978\n            ? E = ellinit([1,1]);\n            ? ellwp(E, 1/2)\n            %4 = 3.9413112427016474646048282462709151389\n        \n        One can also compute the series expansion around :math:`z = 0`:\n        \n        ::\n        \n            ? E = ellinit([1,0]);\n            ? ellwp(E) \\\\ 'x implicitly at default seriesprecision\n            %5 = x^-2 - 1/5*x^2 + 1/75*x^6 - 2/4875*x^10 + O(x^14)\n            ? ellwp(E, x + O(x^12)) \\\\ explicit precision\n            %6 = x^-2 - 1/5*x^2 + 1/75*x^6 + O(x^9)\n        \n        Optional :emphasis:`flag` means 0 (default): compute only :math:`\\wp (z)`, 1: compute\n        :math:`[\\wp (z),\\wp'(z)]`.\n        \n        For instance, the Dickson elliptic functions :emphasis:`sm` and :emphasis:`sn` can be\n        implemented as follows\n        \n        ::\n        \n             smcm(z) =\n             { my(a, b, E = ellinit([0,-1/(4*27)])); \\\\ ell. invariants (g2,g3)=(0,1/27)\n             [a,b] = ellwp(E, z, 1);\n             [6*a / (1-3*b), (3*b+1)/(3*b-1)];\n             }\n             ? [s,c] = smcm(0.5);\n             ? s\n             %2 = 0.4898258757782682170733218609\n             ? c\n             %3 = 0.9591820206453842491187464098\n             ? s^3+c^3\n             %4 = 1.000000000000000000000000000\n             ? smcm('x + O('x^11))\n             %5 = [x - 1/6*x^4 + 2/63*x^7 - 13/2268*x^10 + O(x^11),\n             1 - 1/3*x^3 + 1/18*x^6 - 23/2268*x^9 + O(x^10)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_535ellwp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_z = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellwp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_z,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellwp") < 0)) __PYX_ERR(4, 9184, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = values[0];
    __pyx_v_z = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9184, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9184, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellwp", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9184, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellwp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_534ellwp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_z, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_534ellwp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_z;
  GEN __pyx_v__w;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellwp", 0);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":9234
 *              1 - 1/3*x^3 + 1/18*x^6 - 23/2268*x^9 + O(x^10)]
 *         '''
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9235
 *         '''
 *         w = objtogen(w)
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_2 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9236
 *         w = objtogen(w)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9237
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":9236
 *         w = objtogen(w)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":9238
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9238, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9239
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9240
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_instance.pxi":9241
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9242
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_instance.pxi":9241
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":9243
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9244
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellwp0(__pyx_v__w, __pyx_v__z, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9245
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellxn(self, E, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9184
 *         return new_gen(_ret)
 * 
 *     def ellwp(self, w, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\wp` function attached to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellwp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9247
 *         return new_gen(_ret)
 * 
 *     def ellxn(self, E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         In standard notation, for any affine point :math:`P = (v,w)` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_537ellxn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_536ellxn[] = "\n        In standard notation, for any affine point :math:`P = (v,w)` on the\n        curve :math:`E`, we have\n        \n        .. MATH::\n        \n            [n]P = (\\phi_n(P)\\psi_n(P) : \\omega_n(P) : \\psi_n(P)^3)\n        \n        for some polynomials :math:`\\phi_n,\\omega_n,\\psi_n` in\n        :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6][v,w]`. This function returns\n        :math:`[\\phi_n(P),\\psi_n(P)^2]`, which give the numerator and denominator of\n        the abscissa of :math:`[n]P` and depend only on :math:`v`.\n        \n        ::\n        \n            ? E = ellinit([17,42]);\n            ? T = ellxn(E, 2, 'X)\n            %2 = [X^4 - 34*X^2 - 336*X + 289, 4*X^3 + 68*X + 168]\n            ? P = [114,1218]; ellmul(E,P,2)\n            %3 = [200257/7056, 90637343/592704]\n            ? [x,y] = subst(T,'X,P[1]) \\\\ substitute P[1] in ellxn(E,2)\n            %4 = [168416137, 5934096] \\\\ numerator and denominator of 2*P\n            ? x/y \\\\ check we find ellmul(e,P,2)[1]\n            %5 = 200257/7056\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_537ellxn(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellxn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellxn", 0, 2, 3, 1); __PYX_ERR(4, 9247, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellxn") < 0)) __PYX_ERR(4, 9247, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9247, __pyx_L3_error)
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellxn", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9247, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellxn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_536ellxn(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_n, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_536ellxn(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellxn", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":9273
 *             %5 = 200257/7056
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9274
 *         '''
 *         E = objtogen(E)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":9275
 *         E = objtogen(E)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":9276
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 9276, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":9275
 *         E = objtogen(E)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":9277
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellxn(_E, n, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 9277, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9278
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellxn(_E, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_instance.pxi":9279
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellxn(_E, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellxn(__pyx_v__E, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_instance.pxi":9280
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellxn(_E, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellzeta(self, w, z=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9247
 *         return new_gen(_ret)
 * 
 *     def ellxn(self, E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         In standard notation, for any affine point :math:`P = (v,w)` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellxn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9282
 *         return new_gen(_ret)
 * 
 *     def ellzeta(self, w, z=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\zeta` function attached to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_539ellzeta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_538ellzeta[] = "\n        Computes the value at :math:`z` of the Weierstrass :math:`\\zeta` function attached to\n        the lattice :math:`w` as given by :literal:`ellperiods`:math:`(,1)`: including quasi-periods\n        is useful, otherwise there are recomputed from scratch for each new :math:`z`.\n        \n        .. MATH::\n        \n            \\zeta (z, L) = (1)/(z) + z^2\\sum_{\\omega\\in L^*}\n            (1)/(\\omega^2(z-\\omega)).\n        \n        It is also possible to directly input :math:`w = [\\omega_1,\\omega_2]`,\n        or an elliptic curve :math:`E` as given by :literal:`ellinit` (:math:`w = E.omega`).\n        The quasi-periods of :math:`\\zeta`, such that\n        \n        .. MATH::\n        \n            \\zeta (z + a\\omega_1 + b\\omega_2) = \\zeta (z) + a\\eta_1 + b\\eta_2\n        \n        for integers :math:`a` and :math:`b` are obtained as :math:`\\eta_i = 2\\zeta (\\omega_i/2)`.\n        Or using directly :literal:`elleta`.\n        \n        ::\n        \n            ? w = ellperiods([1,I],1);\n            ? ellzeta(w, 1/2)\n            %2 = 1.5707963267948966192313216916397514421\n            ? E = ellinit([1,0]);\n            ? ellzeta(E, E.omega[1]/2)\n            %4 = 0.84721308479397908660649912348219163647\n        \n        One can also compute the series expansion around :math:`z = 0`\n        (the quasi-periods are useless in this case):\n        \n        ::\n        \n            ? E = ellinit([0,1]);\n            ? ellzeta(E) \\\\ at 'x, implicitly at default seriesprecision\n            %4 = x^-1 + 1/35*x^5 - 1/7007*x^11 + O(x^15)\n            ? ellzeta(E, x + O(x^20)) \\\\ explicit precision\n            %5 = x^-1 + 1/35*x^5 - 1/7007*x^11 + 1/1440257*x^17 + O(x^18)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_539ellzeta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_z = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellzeta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_z,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellzeta") < 0)) __PYX_ERR(4, 9282, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = values[0];
    __pyx_v_z = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9282, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellzeta", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9282, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellzeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_538ellzeta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_z, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_538ellzeta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_precision) {
  int __pyx_v__have_z;
  GEN __pyx_v__w;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellzeta", 0);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":9324
 *             %5 = x^-1 + 1/35*x^5 - 1/7007*x^11 + 1/1440257*x^17 + O(x^18)
 *         '''
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9325
 *         '''
 *         w = objtogen(w)
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_2 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9326
 *         w = objtogen(w)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9327
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":9326
 *         w = objtogen(w)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":9328
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9328, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9329
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9330
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_instance.pxi":9331
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9332
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellzeta(_w, _z, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_instance.pxi":9331
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":9333
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellzeta(_w, _z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9334
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellzeta(_w, _z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellzeta(__pyx_v__w, __pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9335
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellzeta(_w, _z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellztopoint(self, E, z, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9282
 *         return new_gen(_ret)
 * 
 *     def ellzeta(self, w, z=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\zeta` function attached to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellzeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9337
 *         return new_gen(_ret)
 * 
 *     def ellztopoint(self, E, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :emphasis:`ell` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_541ellztopoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_540ellztopoint[] = "\n        :math:`E` being an :emphasis:`ell` as output by\n        :literal:`ellinit`, computes the coordinates :math:`[x,y]` on the curve :math:`E`\n        corresponding to the complex or :math:`p`-adic parameter :math:`z`. Hence this is the\n        inverse function of :literal:`ellpointtoz`.\n        \n        - If :math:`E` is defined over a :math:`p`-adic field and has multiplicative\n          reduction, then :math:`z` is understood as an element on the\n          Tate curve :math:`\\bar{Q}_p^* / q^\\mathbb{Z}`.\n        \n        ::\n        \n            ? E = ellinit([0,-1,1,0,0], O(11^5));\n            ? [u2,u,q] = E.tate; type(u)\n            %2 = \"t_PADIC\" \\\\ split multiplicative reduction\n            ? z = ellpointtoz(E, [0,0])\n            %3 = 3 + 11^2 + 2*11^3 + 3*11^4 + 6*11^5 + 10*11^6 + 8*11^7 + O(11^8)\n            ? ellztopoint(E,z)\n            %4 = [O(11^9), O(11^9)]\n            \n            ? E = ellinit(ellfromj(1/4), O(2^6)); x=1/2; y=ellordinate(E,x)[1];\n            ? z = ellpointtoz(E,[x,y]); \\\\ non-split: t_POLMOD with t_PADIC coefficients\n            ? P = ellztopoint(E, z);\n            ? P[1] \\\\ y coordinate is analogous, more complicated\n            %8 = Mod(O(2^4)*x + (2^-1 + O(2^5)), x^2 + (1 + 2^2 + 2^4 + 2^5 + O(2^7)))\n        \n        - If :math:`E` is defined over the complex numbers (for instance over :math:`\\mathbb{Q}`),\n          :math:`z` is understood as a complex number in :math:`\\mathbb{C}/\\Lambda_E`. If the\n          short Weierstrass equation is :math:`y^2 = 4x^3 - g_2x - g_3`, then :math:`[x,y]`\n          represents the Weierstrass :math:`\\wp`-function\n          and its derivative. For a general Weierstrass equation we have\n          \n        \n        .. MATH::\n        \n            x = \\wp (z) - b_2/12, y = \\wp'(z)/2 - (a_1 x + a_3)/2.\n        \n          If :math:`z` is in the lattice defining :math:`E` over :math:`\\mathbb{C}`, the result is the point at\n          infinity :math:`[0""]`.\n        \n        ::\n        \n            ? E = ellinit([0,1]); P = [2,3];\n            ? z = ellpointtoz(E, P)\n            %2 = 3.5054552633136356529375476976257353387\n            ? ellwp(E, z)\n            %3 = 2.0000000000000000000000000000000000000\n            ? ellztopoint(E, z) - P\n            %4 = [2.548947057811923643 E-57, 7.646841173435770930 E-57]\n            ? ellztopoint(E, 0)\n            %5 = [0] \\\\ point at infinity\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_541ellztopoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  PyObject *__pyx_v_z = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellztopoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_z,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 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("ellztopoint", 0, 2, 3, 1); __PYX_ERR(4, 9337, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellztopoint") < 0)) __PYX_ERR(4, 9337, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_E = values[0];
    __pyx_v_z = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9337, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellztopoint", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9337, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellztopoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_540ellztopoint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_z, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_540ellztopoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, PyObject *__pyx_v_z, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellztopoint", 0);
  __Pyx_INCREF(__pyx_v_E);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":9390
 *             %5 = [0] \\ point at infinity
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9391
 *         '''
 *         E = objtogen(E)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9392
 *         E = objtogen(E)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9392, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9393
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9394
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = pointell(_E, _z, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9395
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pointell(_E, _z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9396
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = pointell(_E, _z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pointell(__pyx_v__E, __pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9397
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = pointell(_E, _z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def erfc(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9337
 *         return new_gen(_ret)
 * 
 *     def ellztopoint(self, E, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :emphasis:`ell` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ellztopoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9399
 *         return new_gen(_ret)
 * 
 *     def erfc(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary error function, analytic continuation of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_543erfc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_542erfc[] = "\n        Complementary error function, analytic continuation of\n        :math:`(2/\\sqrt\\pi)\\int_x^ oo e^{-t^2}dt = incgam (1/2,x^2)/\\sqrt\\pi`,\n        where the latter expression extends the function definition from real :math:`x` to\n        all complex :math:`x != 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_543erfc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("erfc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "erfc") < 0)) __PYX_ERR(4, 9399, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9399, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("erfc", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9399, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.erfc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_542erfc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_542erfc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("erfc", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":9406
 *         all complex :math:`x != 0`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9407
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9407, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9408
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gerfc(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9409
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gerfc(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9410
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gerfc(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gerfc(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9411
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gerfc(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def errname(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9399
 *         return new_gen(_ret)
 * 
 *     def erfc(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary error function, analytic continuation of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.erfc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9413
 *         return new_gen(_ret)
 * 
 *     def errname(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the type of the error message :literal:`E` as a string.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_545errname(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_544errname[] = "\n        Returns the type of the error message :literal:`E` as a string.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_545errname(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("errname (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_544errname(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_544errname(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("errname", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":9417
 *         Returns the type of the error message :literal:`E` as a string.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9418
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = errname(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9418, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9419
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = errname(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9420
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = errname(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = errname(__pyx_v__E);

  /* "cypari/auto_instance.pxi":9421
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = errname(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def eta(self, z, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9413
 *         return new_gen(_ret)
 * 
 *     def errname(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the type of the error message :literal:`E` as a string.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.errname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9423
 *         return new_gen(_ret)
 * 
 *     def eta(self, z, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variants of Dedekind's :math:`\eta` function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_547eta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_546eta[] = "\n        Variants of Dedekind's :math:`\\eta` function.\n        If :math:`flag = 0`, return :math:`\\prod_{n = 1}^ oo (1-q^n)`, where :math:`q` depends on :math:`x`\n        in the following way:\n        \n        - :math:`q = e^{2i\\pi x}` if :math:`x` is a :emphasis:`complex number` (which must then\n          have positive imaginary part); notice that the factor :math:`q^{1/24}` is\n          missing!\n        \n        - :math:`q = x` if :math:`x` is a :literal:`t_PADIC`, or can be converted to a\n          :emphasis:`power series` (which must then have positive valuation).\n        \n        If :math:`flag` is non-zero, :math:`x` is converted to a complex number and we return the\n        true :math:`\\eta` function, :math:`q^{1/24}\\prod_{n = 1}^ oo (1-q^n)`,\n        where :math:`q = e^{2i\\pi x}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_547eta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eta") < 0)) __PYX_ERR(4, 9423, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9423, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9423, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("eta", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9423, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.eta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_546eta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_z, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_546eta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("eta", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":9440
 *         where :math:`q = e^{2i\pi x}`.
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9441
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9441, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9442
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = eta0(_z, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9443
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = eta0(_z, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9444
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = eta0(_z, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = eta0(__pyx_v__z, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9445
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = eta0(_z, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def eulerphi(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9423
 *         return new_gen(_ret)
 * 
 *     def eta(self, z, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variants of Dedekind's :math:`\eta` function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.eta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9447
 *         return new_gen(_ret)
 * 
 *     def eulerphi(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Euler's :math:`\phi` (totient) function of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_549eulerphi(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_548eulerphi[] = "\n        Euler's :math:`\\phi` (totient) function of the\n        integer :math:`\\|x\\|`, in other words :math:`\\|(\\mathbb{Z}/x\\mathbb{Z})^*\\|`.\n        \n        ::\n        \n            ? eulerphi(40)\n            %1 = 16\n        \n        According to this definition we let :math:`\\phi (0) := 2`, since :math:`\\mathbb{Z}^ *= {-1,1}`;\n        this is consistent with :literal:`znstar(0)`: we have\n        :literal:`znstar:math:`(n)`.no = eulerphi(n)` for all :math:`n\\in\\mathbb{Z}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_549eulerphi(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eulerphi (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_548eulerphi(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_548eulerphi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("eulerphi", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":9461
 *         :literal:`znstar:math:`(n)`.no = eulerphi(n)` for all :math:`n\in\mathbb{Z}`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9462
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = eulerphi(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9462, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9463
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = eulerphi(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9464
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = eulerphi(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = eulerphi(__pyx_v__x);

  /* "cypari/auto_instance.pxi":9465
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = eulerphi(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def exp(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9447
 *         return new_gen(_ret)
 * 
 *     def eulerphi(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Euler's :math:`\phi` (totient) function of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.eulerphi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9467
 *         return new_gen(_ret)
 * 
 *     def exp(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_551exp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_550exp[] = "\n        Exponential of :math:`x`.\n        :math:`p`-adic arguments with positive valuation are accepted.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_551exp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "exp") < 0)) __PYX_ERR(4, 9467, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9467, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("exp", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9467, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_550exp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_550exp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("exp", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":9472
 *         :math:`p`-adic arguments with positive valuation are accepted.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9473
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9473, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9474
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexp(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9475
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gexp(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9476
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexp(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gexp(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9477
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexp(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def expm1(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9467
 *         return new_gen(_ret)
 * 
 *     def exp(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9479
 *         return new_gen(_ret)
 * 
 *     def expm1(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\exp (x)-1`, computed in a way that is also accurate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_553expm1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_552expm1[] = "\n        Return :math:`\\exp (x)-1`, computed in a way that is also accurate\n        when the real part of :math:`x` is near :math:`0`.\n        A naive direct computation would suffer from catastrophic cancellation;\n        PARI's direct computation of :math:`\\exp (x)` alleviates this well known problem at\n        the expense of computing :math:`\\exp (x)` to a higher accuracy when :math:`x` is small.\n        Using :literal:`expm1` is recommended instead:\n        \n        ::\n        \n            ? default(realprecision, 10000); x = 1e-100;\n            ? a = expm1(x);\n            time = 4 ms.\n            ? b = exp(x)-1;\n            time = 4 ms.\n            ? default(realprecision, 10040); x = 1e-100;\n            ? c = expm1(x); \\\\ reference point\n            ? abs(a-c)/c \\\\ relative error in expm1(x)\n            %7 = 1.4027986153764843997 E-10019\n            ? abs(b-c)/c \\\\ relative error in exp(x)-1\n            %8 = 1.7907031188259675794 E-9919\n        \n        As the example above shows, when :math:`x` is near :math:`0`,\n        :literal:`expm1` is more accurate than :literal:`exp(x)-1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_553expm1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("expm1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "expm1") < 0)) __PYX_ERR(4, 9479, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 9479, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("expm1", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9479, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.expm1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_552expm1(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_552expm1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("expm1", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":9505
 *         :literal:`expm1` is more accurate than :literal:`exp(x)-1`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9506
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9506, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9507
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexpm1(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9508
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gexpm1(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":9509
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexpm1(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gexpm1(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":9510
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexpm1(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def exponent(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9479
 *         return new_gen(_ret)
 * 
 *     def expm1(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\exp (x)-1`, computed in a way that is also accurate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.expm1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9512
 *         return new_gen(_ret)
 * 
 *     def exponent(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a :literal:`t_REAL`, the result is the binary exponent :math:`e` of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_555exponent(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_554exponent[] = "\n        When :math:`x` is a :literal:`t_REAL`, the result is the binary exponent :math:`e` of :math:`x`.\n        For a non-zero :math:`x`, this is the unique integer :math:`e` such that\n        :math:`2^e <= \\|x\\| < 2^{e+1}`. For a real :math:`0`, this returns the PARI exponent :math:`e`\n        attached to :math:`x` (which may represent any floating-point number less than\n        :math:`2^e` in absolute value).\n        \n        ::\n        \n            ? exponent(Pi)\n            %1 = 1\n            ? exponent(4.0)\n            %2 = 2\n            ? exponent(0.0)\n            %3 = -128\n            ? default(realbitprecision)\n            %4 = 128\n        \n        This definition extends naturally to non-zero integers,\n        and the exponent of an exact :math:`0` is :math:`-oo` by convention.\n        \n        For convenience, we :emphasis:`define` the exponent of a :literal:`t_FRAC` :math:`a/b` as\n        the difference of :literal:`exponent`:math:`(a)` and :literal:`exponent`:math:`(b)`; note that,\n        if :math:`e'` denotes the exponent of :literal:`:math:`a/b` * 1.0`, then the exponent :math:`e`\n        we return is either :math:`e'` or :math:`e'+1`, thus :math:`2^{e+1}` is an upper bound for\n        :math:`\\|a/b\\|`.\n        \n        ::\n        \n            ? [ exponent(9), exponent(10), exponent(9/10), exponent(9/10*1.) ]\n            %5 = [3, 3, 0, -1]\n        \n        For a PARI object of type :literal:`t_COMPLEX`, :literal:`t_POL`, :literal:`t_SER`, :literal:`t_VEC`,\n        :literal:`t_COL`, :literal:`t_MAT` this returns the largest exponent found among the\n        components of :math:`x`. Hence :math:`2^{e+1}` is a quick upper bound for the sup norm\n        of real matrices or polynomials; and :math:`2^{e+(3/2)}` for complex ones.\n        \n        ::\n        \n            ? exponent(3*x^2 + 15*x - 100)\n            %5 = 6\n            ? exponent(0)\n            %6 = -oo\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_555exponent(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exponent (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_554exponent(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_554exponent(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("exponent", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":9557
 *             %6 = -oo
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9558
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpexponent(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 9558, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9559
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpexponent(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":9560
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpexponent(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpexponent(__pyx_v__x);

  /* "cypari/auto_instance.pxi":9561
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpexponent(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def extern(self, str):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9512
 *         return new_gen(_ret)
 * 
 *     def exponent(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a :literal:`t_REAL`, the result is the binary exponent :math:`e` of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.exponent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9563
 *         return new_gen(_ret)
 * 
 *     def extern(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         The string :emphasis:`str` is the name of an external command (i.e.one you
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_557extern(PyObject *__pyx_v_self, PyObject *__pyx_v_str); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_556extern[] = "\n        The string :emphasis:`str` is the name of an external command (i.e.\302\240one you\n        would type from your UNIX shell prompt). This command is immediately run and\n        its output fed into :literal:`gp`, just as if read from a file.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_557extern(PyObject *__pyx_v_self, PyObject *__pyx_v_str) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("extern (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_556extern(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_str));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_556extern(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str) {
  char *__pyx_v__str;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("extern", 0);
  __Pyx_INCREF(__pyx_v_str);

  /* "cypari/auto_instance.pxi":9569
 *         its output fed into :literal:`gp`, just as if read from a file.
 *         '''
 *         str = to_bytes(str)             # <<<<<<<<<<<<<<
 *         cdef char* _str = <bytes>str
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_str, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9570
 *         '''
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = gpextern(_str)
 */
  if (unlikely(__pyx_v_str == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 9570, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_str); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 9570, __pyx_L1_error)
  __pyx_v__str = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9571
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpextern(_str)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9571, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9572
 *         cdef char* _str = <bytes>str
 *         sig_on()
 *         cdef GEN _ret = gpextern(_str)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpextern(__pyx_v__str);

  /* "cypari/auto_instance.pxi":9573
 *         sig_on()
 *         cdef GEN _ret = gpextern(_str)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def externstr(self, str):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9573, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9563
 *         return new_gen(_ret)
 * 
 *     def extern(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         The string :emphasis:`str` is the name of an external command (i.e.one you
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.extern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9575
 *         return new_gen(_ret)
 * 
 *     def externstr(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         The string :emphasis:`str` is the name of an external command (i.e.one you
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_559externstr(PyObject *__pyx_v_self, PyObject *__pyx_v_str); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_558externstr[] = "\n        The string :emphasis:`str` is the name of an external command (i.e.\302\240one you\n        would type from your UNIX shell prompt). This command is immediately run and\n        its output is returned as a vector of GP strings, one component per output\n        line.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_559externstr(PyObject *__pyx_v_self, PyObject *__pyx_v_str) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("externstr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_558externstr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_str));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_558externstr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str) {
  char *__pyx_v__str;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("externstr", 0);
  __Pyx_INCREF(__pyx_v_str);

  /* "cypari/auto_instance.pxi":9582
 *         line.
 *         '''
 *         str = to_bytes(str)             # <<<<<<<<<<<<<<
 *         cdef char* _str = <bytes>str
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_str, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9583
 *         '''
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = externstr(_str)
 */
  if (unlikely(__pyx_v_str == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 9583, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_str); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 9583, __pyx_L1_error)
  __pyx_v__str = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9584
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = externstr(_str)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9584, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9585
 *         cdef char* _str = <bytes>str
 *         sig_on()
 *         cdef GEN _ret = externstr(_str)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = externstr(__pyx_v__str);

  /* "cypari/auto_instance.pxi":9586
 *         sig_on()
 *         cdef GEN _ret = externstr(_str)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factor(self, x, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9575
 *         return new_gen(_ret)
 * 
 *     def externstr(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         The string :emphasis:`str` is the name of an external command (i.e.one you
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.externstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9588
 *         return new_gen(_ret)
 * 
 *     def factor(self, x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor :math:`x` over domain :math:`D`; if :math:`D` is omitted, it is determined from :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_561factor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_560factor[] = "\n        Factor :math:`x` over domain :math:`D`; if :math:`D` is omitted, it is determined from :math:`x`.\n        For instance, if :math:`x` is an integer, it is factored in :math:`\\mathbb{Z}`, if it is a\n        polynomial with rational coefficients, it is factored in :math:`\\mathbb{Q}[x]`, etc., see\n        below for details. The result is a two-column matrix: the first contains the\n        irreducibles dividing :math:`x` (rational or Gaussian primes, irreducible\n        polynomials), and the second the exponents. By convention, :math:`0` is factored\n        as :math:`0^1`.\n        \n        :strong:`:math:`x \\in \\mathbb{Q}`.`\n        See :literal:`factorint` for the algorithms used. The factorization includes the\n        unit :math:`-1` when :math:`x < 0` and all other factors are positive; a denominator is\n        factored with negative exponents. The factors are sorted in increasing order.\n        \n        ::\n        \n            ? factor(-7/106)\n            %1 =\n            [-1 1]\n            \n            [ 2 -1]\n            \n            [ 7 1]\n            \n            [53 -1]\n        \n        By convention, :math:`1` is factored as :literal:`matrix(0,2)`\n        (the empty factorization, printed as :literal:`[;]`).\n        \n        Large rational \"primes\" :math:`> 2^{64}` in the factorization are in fact\n        :emphasis:`pseudoprimes` (see :literal:`ispseudoprime`), a priori not rigorously proven\n        primes. Use :literal:`isprime` to prove primality of these factors, as in\n        \n        ::\n        \n            ? fa = factor(2^2^7 + 1)\n            %1 =\n            [59649589127497217 1]\n            \n            [5704689200685129054721 1]\n            \n            ? isprime( fa[,1] )\n            %2 = [1, 1]~ \\\\ both entries are proven primes\n        \n        Another possibility is to globally set the default :literal:`factor_proven`, which\n        will perform a rigorous primality proof for each pseudo""prime factor but will\n        slow down PARI.\n        \n        A :literal:`t_INT` argument :math:`D` can be added, meaning that we look only for\n        prime factors :math:`p < D`. The limit :math:`D` must be non-negative.\n        In this case, all but the last factor are proven primes, but the remaining\n        factor may actually be a proven composite! If the remaining factor is less\n        than :math:`D^2`, then it is prime.\n        \n        ::\n        \n            ? factor(2^2^7 +1, 10^5)\n            %3 =\n            [340282366920938463463374607431768211457 1]\n        \n        :strong:`Deprecated feature.` Setting :math:`D = 0` is the same\n        as setting it to :math:`primelimit + 1`.\n        \n        This routine uses trial division and perfect power tests, and should not be\n        used for huge values of :math:`D` (at most :math:`10^9`, say):\n        :literal:`factorint(, 1 + 8)` will in general be faster. The latter does not\n        guarantee that all small prime factors are found, but it also finds larger\n        factors and in a more efficient way.\n        \n        ::\n        \n            ? F = (2^2^7 + 1) * 1009 * (10^5+3); factor(F, 10^5) \\\\ fast, incomplete\n            time = 0 ms.\n            %4 =\n            [1009 1]\n            \n            [34029257539194609161727850866999116450334371 1]\n            \n            ? factor(F, 10^9) \\\\ slow\n            time = 3,260 ms.\n            %6 =\n            [1009 1]\n            \n            [100003 1]\n            \n            [340282366920938463463374607431768211457 1]\n            \n            ? factorint(F, 1+8) \\\\ much faster and all small primes were found\n            time = 8 ms.\n            %7 =\n            [1009 1]\n            \n            [100003 1]\n            \n            [340282366920938463463374607431768211457 1]\n            \n            ? factor(F) \\\\ complete factorization\n            time = 60 ms.\n            %8 =\n            [1009 ""1]\n            \n            [100003 1]\n            \n            [59649589127497217 1]\n            \n            [5704689200685129054721 1]\n        \n        Setting :math:`D = I` will factor in the Gaussian integers\n        :math:`\\mathbb{Z}[i]`:\n        \n        :strong:`:math:`x \\in \\mathbb{Q} (i)`.` The factorization is performed with Gaussian\n        primes in :math:`\\mathbb{Z}[i]` and includes Gaussian units in :math:`{\302\2611, \302\261 i}`;\n        factors are sorted by increasing norm. Except for a possible leading unit,\n        the Gaussian factors are normalized: rational factors are positive and\n        irrational factors have positive imaginary part (a canonical represneta.\n        \n        Unless :literal:`factor_proven` is set, large factors are actually pseudoprimes,\n        not proven primes; a rational factor is prime if less than :math:`2^{64}` and an\n        irrational one if its norm is less than :math:`2^{64}`.\n        \n        ::\n        \n            ? factor(5*I)\n            %1 =\n            [ 2 + I 1]\n            \n            [1 + 2*I 1]\n        \n        One can force the factorization of a rational number\n        by setting the domain :math:`D = I`:\n        \n        ::\n        \n            ? factor(-5, I)\n            %2 =\n            [ I 1]\n            \n            [ 2 + I 1]\n            \n            [1 + 2*I 1]\n            ? factorback(%)\n            %3 = -5\n        \n        :strong:`Univariate polynomials and rational functions.`\n        PARI can factor univariate polynomials in :math:`K[t]`. The following base fields\n        :math:`K` are currently supported: :math:`\\mathbb{Q}`, :math:`\\mathbb{R}`, :math:`\\mathbb{C}`, :math:`\\mathbb{Q}_p`, finite fields and\n        number fields. See :literal:`factormod` and :literal:`factorff` for the algorithms used\n        over finite fields and :literal:`nffactor` for the algorithms over number fields.\n        The irreducible factors are sorted b""y increasing degree and normalized: they\n        are monic except when :math:`K = \\mathbb{Q}` where they are primitive in :math:`\\mathbb{Z}[t]`.\n        \n        The content is :emphasis:`not` included in the factorization, in particular\n        :literal:`factorback` will in general recover the original :math:`x` only up to\n        multiplication by an element of :math:`K^*`: when :math:`K != \\mathbb{Q}`, this scalar is\n        :literal:`pollead`:math:`(x)` (since irreducible factors are monic); and when :math:`K = \\mathbb{Q}`\n        you can either ask for the :math:`\\mathbb{Q}`-content explicitly of use factorback:\n        \n        ::\n        \n            ? P = t^2 + 5*t/2 + 1; F = factor(P)\n            %1 =\n            [t + 2 1]\n            \n            [2*t + 1 1]\n            \n            ? content(P, 1) \\\\ Q-content\n            %2 = 1/2\n            \n            ? pollead(factorback(F)) / pollead(P)\n            %3 = 2\n        \n        You can specify :math:`K` using the optional \"domain\" argument :math:`D` as follows\n        \n        - :math:`K = \\mathbb{Q}` : :math:`D` a rational number (:literal:`t_INT` or :literal:`t_FRAC`),\n        \n        - :math:`K = \\mathbb{Z}/p\\mathbb{Z}` with :math:`p` prime : :math:`D` a :literal:`t_INTMOD` modulo :math:`p`;\n          factoring modulo a non-prime number is not supported.\n        \n        - :math:`K = \\mathbb{F}_q` : :math:`D` a :literal:`t_FFELT` encoding the finite field; you can also\n          use a :literal:`t_POLMOD` of :literal:`t_INTMOD` modulo a prime :math:`p` but this is usualy\n          less convenient;\n        \n        - :math:`K = \\mathbb{Q}[X]/(T)` a number field : :math:`D` a :literal:`t_POLMOD` modulo :math:`T`,\n        \n        - :math:`K = \\mathbb{Q} (i)` (alternate syntax for special case): :math:`D = I`,\n        \n        - :math:`K = \\mathbb{Q} (w)` a quadratic number field (alternate syntax for special\n          case): :math:`D` a :literal:`t_Q""UAD`,\n        \n        - :math:`K = \\mathbb{R}` : :math:`D` a real number (:literal:`t_REAL`); truncate the factorization\n          at accuracy :literal:`precision`:math:`(D)`. If :math:`x` is inexact and :literal:`precision`:math:`(x)`\n          is less than :literal:`precision`:math:`(D)`, then the precision of :math:`x` is used instead.\n        \n        - :math:`K = \\mathbb{C}` : :math:`D` a complex number with a :literal:`t_REAL` component, e.g.\n          :literal:`I * 1.`; truncate the factorization as for :math:`K = \\mathbb{R}`,\n        \n        - :math:`K = \\mathbb{Q}_p` : :math:`D` a :literal:`t_PADIC`; truncate the factorization at\n          :math:`p`-adic accuracy :literal:`padicprec`:math:`(D)`, possibly less if :math:`x` is inexact\n          with insufficient :math:`p`-adic accuracy;\n        \n        ::\n        \n            ? T = x^2+1;\n            ? factor(T, 1); \\\\ over Q\n            ? factor(T, Mod(1,3)) \\\\ over F_3\n            ? factor(T, ffgen(ffinit(3,2,'t))^0) \\\\ over F_{3^2}\n            ? factor(T, Mod(Mod(1,3), t^2+t+2)) \\\\ over F_{3^2}, again\n            ? factor(T, O(3^6)) \\\\ over Q_3, precision 6\n            ? factor(T, 1.) \\\\ over R, current precision\n            ? factor(T, I*1.) \\\\ over C\n            ? factor(T, Mod(1, y^3-2)) \\\\ over Q(2^{1/3})\n        \n        In most cases, it is possible and simpler to call a\n        specialized variant rather than use the above scheme:\n        \n        ::\n        \n            ? factormod(T, 3) \\\\ over F_3\n            ? factormod(T, [t^2+t+2, 3]) \\\\ over F_{3^2}\n            ? factormod(T, ffgen(3^2, 't)) \\\\ over F_{3^2}\n            ? factorpadic(T, 3,6) \\\\ over Q_3, precision 6\n            ? nffactor(y^3-2, T) \\\\ over Q(2^{1/3})\n            ? polroots(T) \\\\ over C\n            ? polrootsreal(T) \\\\ over R (real polynomial)\n        \n        It is also possible to let the routine use the smallest field containing all\n        coefficie""nts, taking into account quotient structures induced by\n        :literal:`t_INTMOD`\302\240s and :literal:`t_POLMOD`\302\240s (e.g.\302\240if a coefficient in :math:`\\mathbb{Z}/n\\mathbb{Z}` is known,\n        all rational numbers encountered are first mapped to :math:`\\mathbb{Z}/n\\mathbb{Z}`; different\n        moduli will produce an error):\n        \n        ::\n        \n            ? T = x^2+1;\n            ? factor(T); \\\\ over Q\n            ? factor(T*Mod(1,3)) \\\\ over F_3\n            ? factor(T*ffgen(ffinit(3,2,'t))^0) \\\\ over F_{3^2}\n            ? factor(T*Mod(Mod(1,3), t^2+t+2)) \\\\ over F_{3^2}, again\n            ? factor(T*(1 + O(3^6)) \\\\ over Q_3, precision 6\n            ? factor(T*1.) \\\\ over R, current precision\n            ? factor(T*(1.+0.*I)) \\\\ over C\n            ? factor(T*Mod(1, y^3-2)) \\\\ over Q(2^{1/3})\n        \n        Multiplying by a suitable field element equal to :math:`1 \\in K`\n        in this way is error-prone and is not recommanded. Factoring existing\n        polynomials with obvious fields of coefficients is fine, the domain\n        argument :math:`D` should be used instead ad hoc conversions.\n        \n        :strong:`Note on inexact polynomials.`\n        Polynomials with inexact coefficients\n        (e.g. floating point or :math:`p`-adic numbers)\n        are first rounded to an exact representation, then factored to (potentially)\n        infinite accuracy and we return a truncated approximation of that\n        virtual factorization. To avoid pitfalls, we advise to only factor\n        :emphasis:`exact` polynomials:\n        \n        ::\n        \n            ? factor(x^2-1+O(2^2)) \\\\ rounded to x^2 + 3, irreducible in Q_2\n            %1 =\n            [(1 + O(2^2))*x^2 + O(2^2)*x + (1 + 2 + O(2^2)) 1]\n            \n            ? factor(x^2-1+O(2^3)) \\\\ rounded to x^2 + 7, reducible !\n            %2 =\n            [ (1 + O(2^3))*x + (1 + 2 + O(2^3)) 1]\n            \n            [(1 + O(""2^3))*x + (1 + 2^2 + O(2^3)) 1]\n            \n            ? factor(x^2-1, O(2^2)) \\\\ no ambiguity now\n            %3 =\n            [ (1 + O(2^2))*x + (1 + O(2^2)) 1]\n            \n            [(1 + O(2^2))*x + (1 + 2 + O(2^2)) 1]\n        \n        :strong:`Note about inseparable polynomials.` Polynomials with inexact\n        coefficients are considered to be squarefree: indeed, there exist a\n        squarefree polynomial arbitrarily close to the input, and they cannot be\n        distinguished at the input accuracy. This means that irreducible factors are\n        repeated according to their apparent multiplicity. On the contrary, using a\n        specialized function such as :literal:`factorpadic` with an :emphasis:`exact` rational\n        input yields the correct multiplicity when the (now exact) input is not\n        separable. Compare:\n        \n        ::\n        \n            ? factor(z^2 + O(5^2)))\n            %1 =\n            [(1 + O(5^2))*z + O(5^2) 1]\n            \n            [(1 + O(5^2))*z + O(5^2) 1]\n            ? factor(z^2, O(5^2))\n            %2 =\n            [1 + O(5^2))*z + O(5^2) 2]\n        \n        :strong:`Multivariate polynomials and rational functions.`\n        PARI recursively factors :emphasis:`multivariate` polynomials in\n        :math:`K[t_1,..., t_d]` for the same fields :math:`K` as above and the argument :math:`D`\n        is used in the same way to specify :math:`K`. The irreducible factors are sorted\n        by their main variable (least priority first) then by increasing degree.\n        \n        ::\n        \n            ? factor(x^2 + y^2, Mod(1,5))\n            %1 =\n            [ x + Mod(2, 5)*y 1]\n            \n            [Mod(1, 5)*x + Mod(3, 5)*y 1]\n            \n            ? factor(x^2 + y^2, O(5^2))\n            %2 =\n            [ (1 + O(5^2))*x + (O(5^2)*y^2 + (2 + 5 + O(5^2))*y + O(5^2)) 1]\n            \n            [(1 + O(5^2))*x + (O(5^2)*y^2 + (3 + 3*5 + O(5^2))*y + O(5^2)) 1]\n          ""  \n            ? lift(%)\n            %3 =\n            [ x + 7*y 1]\n            \n            [x + 18*y 1]\n        \n        Note that the implementation does not really support inexact\n        real fields (:math:`\\mathbb{R}` or :math:`\\mathbb{C}`) and usually misses factors even if the input\n        is exact:\n        \n        ::\n        \n            ? factor(x^2 + y^2, I) \\\\ over Q(i)\n            %4 =\n            [x - I*y 1]\n            \n            [x + I*y 1]\n            \n            ? factor(x^2 + y^2, I*1.) \\\\ over C\n            %5 =\n            [x^2 + y^2 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_561factor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_D,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factor") < 0)) __PYX_ERR(4, 9588, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factor", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9588, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_560factor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_560factor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factor", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":9925
 *             [x^2 + y^2 1]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9926
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9927
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9928
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":9927
 *         x = objtogen(x)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":9929
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9929, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9930
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9931
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":9932
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9933
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factor0(_x, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":9932
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)
 */
  }

  /* "cypari/auto_instance.pxi":9934
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factor0(__pyx_v__x, __pyx_v__D);

  /* "cypari/auto_instance.pxi":9935
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorback(self, f, e=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9588
 *         return new_gen(_ret)
 * 
 *     def factor(self, x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor :math:`x` over domain :math:`D`; if :math:`D` is omitted, it is determined from :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9937
 *         return new_gen(_ret)
 * 
 *     def factorback(self, f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the factored object corresponding to a factorization. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_563factorback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_562factorback[] = "\n        Gives back the factored object corresponding to a factorization. The\n        integer :math:`1` corresponds to the empty factorization.\n        \n        If :math:`e` is present, :math:`e` and :math:`f` must be vectors of the same length (:math:`e` being\n        integral), and the corresponding factorization is the product of the\n        :math:`f[i]^{e[i]}`.\n        \n        If not, and :math:`f` is vector, it is understood as in the preceding case with :math:`e`\n        a vector of 1s: we return the product of the :math:`f[i]`. Finally, :math:`f` can be a\n        regular factorization, as produced with any :literal:`factor` command. A few\n        examples:\n        \n        ::\n        \n            ? factor(12)\n            %1 =\n            [2 2]\n            \n            [3 1]\n            \n            ? factorback(%)\n            %2 = 12\n            ? factorback([2,3], [2,1]) \\\\ 2^3 * 3^1\n            %3 = 12\n            ? factorback([5,2,3])\n            %4 = 30\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_563factorback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_e = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_e,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorback") < 0)) __PYX_ERR(4, 9937, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_e = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorback", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9937, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_562factorback(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_e);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_562factorback(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_e) {
  int __pyx_v__have_e;
  GEN __pyx_v__f;
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factorback", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_e);

  /* "cypari/auto_instance.pxi":9966
 *             %4 = 30
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":9967
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             e = objtogen(e)
 */
  __pyx_t_2 = (__pyx_v_e != Py_None);
  __pyx_v__have_e = __pyx_t_2;

  /* "cypari/auto_instance.pxi":9968
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9969
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 *             e = objtogen(e)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_e, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":9968
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":9970
 *         if _have_e:
 *             e = objtogen(e)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9970, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9971
 *             e = objtogen(e)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _e = NULL
 *         if _have_e:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9972
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             _e = (<Gen>e).g
 */
  __pyx_v__e = NULL;

  /* "cypari/auto_instance.pxi":9973
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":9974
 *         cdef GEN _e = NULL
 *         if _have_e:
 *             _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorback2(_f, _e)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
    __pyx_v__e = __pyx_t_4;

    /* "cypari/auto_instance.pxi":9973
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)
 */
  }

  /* "cypari/auto_instance.pxi":9975
 *         if _have_e:
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorback2(__pyx_v__f, __pyx_v__e);

  /* "cypari/auto_instance.pxi":9976
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorcantor(self, x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9937
 *         return new_gen(_ret)
 * 
 *     def factorback(self, f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the factored object corresponding to a factorization. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9978
 *         return new_gen(_ret)
 * 
 *     def factorcantor(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use factormod.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_565factorcantor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_564factorcantor[] = "\n        This function is obsolete, use factormod.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_565factorcantor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorcantor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorcantor", 1, 2, 2, 1); __PYX_ERR(4, 9978, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorcantor") < 0)) __PYX_ERR(4, 9978, __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_x = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorcantor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9978, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorcantor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_564factorcantor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_564factorcantor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factorcantor", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":9982
 *         This function is obsolete, use factormod.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9982, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":9983
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         p = objtogen(p)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":9984
 *         from warnings import warn
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":9985
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)
 *         x = objtogen(x)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":9986
 *         x = objtogen(x)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 9986, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":9987
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factmod(_x, _p)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9988
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factmod(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_instance.pxi":9989
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factmod(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factmod(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_instance.pxi":9990
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factmod(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorff(self, x, p=None, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9978
 *         return new_gen(_ret)
 * 
 *     def factorcantor(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use factormod.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorcantor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":9992
 *         return new_gen(_ret)
 * 
 *     def factorff(self, x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_567factorff(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_566factorff[] = "\n        Obsolete, kept for backward compatibility: use factormod.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_567factorff(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorff (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,&__pyx_n_s_a,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorff") < 0)) __PYX_ERR(4, 9992, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_p = values[1];
    __pyx_v_a = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorff", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 9992, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_566factorff(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_566factorff(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_p;
  int __pyx_v__have_a;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("factorff", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":9996
 *         Obsolete, kept for backward compatibility: use factormod.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9996, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":9997
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":9998
 *         from warnings import warn
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 9998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":9999
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_3 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10000
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":10001
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10001, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":10000
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  }

  /* "cypari/auto_instance.pxi":10002
 *         if _have_p:
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_3 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10003
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":10004
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10004, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":10003
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10005
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 10005, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10006
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_instance.pxi":10007
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":10008
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":10009
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_5;

    /* "cypari/auto_instance.pxi":10008
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  }

  /* "cypari/auto_instance.pxi":10010
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":10011
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":10012
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorff(_x, _p, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_5;

    /* "cypari/auto_instance.pxi":10011
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)
 */
  }

  /* "cypari/auto_instance.pxi":10013
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorff(__pyx_v__x, __pyx_v__p, __pyx_v__a);

  /* "cypari/auto_instance.pxi":10014
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorial(self, long x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10014, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":9992
 *         return new_gen(_ret)
 * 
 *     def factorff(self, x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10016
 *         return new_gen(_ret)
 * 
 *     def factorial(self, long x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factorial of :math:`x`. The expression :math:`x!` gives a result which is an integer,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_569factorial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_568factorial[] = "\n        Factorial of :math:`x`. The expression :math:`x!` gives a result which is an integer,\n        while :math:`factorial (x)` gives a real number.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_569factorial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_x;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorial (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorial") < 0)) __PYX_ERR(4, 10016, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_x == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10016, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10016, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorial", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10016, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_568factorial(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_568factorial(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("factorial", 0);

  /* "cypari/auto_instance.pxi":10021
 *         while :math:`factorial (x)` gives a real number.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpfactr(x, precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 10021, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10022
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mpfactr(x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":10023
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpfactr(x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mpfactr(__pyx_v_x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":10024
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mpfactr(x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorint(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10016
 *         return new_gen(_ret)
 * 
 *     def factorial(self, long x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factorial of :math:`x`. The expression :math:`x!` gives a result which is an integer,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10026
 *         return new_gen(_ret)
 * 
 *     def factorint(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the integer :math:`n` into a product of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_571factorint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_570factorint[] = "\n        Factors the integer :math:`n` into a product of\n        pseudoprimes (see :literal:`ispseudoprime`), using a combination of the\n        Shanks SQUFOF and Pollard Rho method (with modifications due to\n        Brent), Lenstra's ECM (with modifications by Montgomery), and\n        MPQS (the latter adapted from the LiDIA code with the kind\n        permission of the LiDIA maintainers), as well as a search for pure powers.\n        The output is a two-column matrix as for :literal:`factor`: the first column\n        contains the \"prime\" divisors of :math:`n`, the second one contains the\n        (positive) exponents.\n        \n        By convention :math:`0` is factored as :math:`0^1`, and :math:`1` as the empty factorization;\n        also the divisors are by default not proven primes if they are larger than\n        :math:`2^{64}`, they only failed the BPSW compositeness test (see\n        :literal:`ispseudoprime`). Use :literal:`isprime` on the result if you want to\n        guarantee primality or set the :literal:`factor_proven` default to :math:`1`.\n        Entries of the private prime tables (see :literal:`addprimes`) are also included\n        as is.\n        \n        This gives direct access to the integer factoring engine called by most\n        arithmetical functions. :emphasis:`flag` is optional; its binary digits mean 1: avoid\n        MPQS, 2: skip first stage ECM (we may still fall back to it later), 4: avoid\n        Rho and SQUFOF, 8: don't run final ECM (as a result, a huge composite may be\n        declared to be prime). Note that a (strong) probabilistic primality test is\n        used; thus composites might not be detected, although no example is known.\n        \n        You are invited to play with the flag settings and watch the internals at\n        work by using :literal:`gp`'s :literal:`debug` default parameter (level 3 shows\n        just the outline, 4 turns on time keeping, 5 and above show an increasing\n        amount of i""nternal details).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_571factorint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorint") < 0)) __PYX_ERR(4, 10026, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10026, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorint", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10026, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_570factorint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_570factorint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("factorint", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":10058
 *         amount of internal details).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10059
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = factorint(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10059, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10060
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorint(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10061
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = factorint(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorint(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":10062
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = factorint(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factormod(self, f, D=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10026
 *         return new_gen(_ret)
 * 
 *     def factorint(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the integer :math:`n` into a product of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10064
 *         return new_gen(_ret)
 * 
 *     def factormod(self, f, D=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the polynomial :math:`f` over the finite field defined by the domain
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_573factormod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_572factormod[] = "\n        Factors the polynomial :math:`f` over the finite field defined by the domain\n        :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        The coefficients of :math:`f` must be operation-compatible with the corresponding\n        finite field. The result is a two-column matrix, the first column being the\n        irreducible polynomials dividing :math:`f`, and the second the exponents.\n        By convention, the :math:`0` polynomial factors as :math:`0^1`; a non-zero constant\n        polynomial has empty factorization, a :math:`0 x 2` matrix. The irreducible\n        factors are ordered by increasing degree and the result is canonical: it will\n        not change across multiple calls or sessions.\n        \n        ::\n        \n            ? factormod(x^2 + 1, 3) \\\\ over F_3\n            %1 =\n            [Mod(1, 3)*x^2 + Mod(1, 3) 1]\n            ? liftall( factormod(x^2 + 1, [3, t^2+1]) ) \\\\ over F_9\n            %2 =\n            [ x + t 1]\n            \n            [x + 2*t 1]\n            ? t = ffgen(t^2+Mod(1,3)); factormod(x^2 + t^0) \\\\ same using t_FFELT\n            %3 =\n            [ x + t 1]\n            \n            [x + 2*t 1]\n            ? factormod(x^2+Mod(1,3))\n            %4 =\n            [Mod(1, 3)*x^2 + Mod(1, 3) 1]\n            ? liftall( factormod(x^2 + Mod(Mod(1,3),y^2+1)) )\n            %5 =\n            [ x + y 1]\n            \n            [x + 2*y 1]\n        \n        If :math:`flag` is non-zero, outputs only the :emphasis:`degrees` of the irreducible\n     ""   polynomials (for example to compute an :math:`L`-function). By convention, a\n        constant polynomial (including the :math:`0` polynomial) has empty factorization.\n        The degrees appear in increasing order but need not correspond to the\n        ordering with :math:`flag = 0` when multiplicities are present.\n        \n        ::\n        \n            ? f = x^3 + 2*x^2 + x + 2;\n            ? factormod(f, 5) \\\\ (x+2)^2 * (x+3)\n            %1 =\n            [Mod(1, 5)*x + Mod(2, 5) 2]\n            \n            [Mod(1, 5)*x + Mod(3, 5) 1]\n            ? factormod(f, 5, 1) \\\\ (deg 1) * (deg 1)^2\n            %2 =\n            [1 1]\n            \n            [1 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_573factormod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_D = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factormod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_D,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factormod") < 0)) __PYX_ERR(4, 10064, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_D = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10064, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factormod", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10064, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_572factormod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_D, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_572factormod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D, long __pyx_v_flag) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factormod", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":10131
 *             [1 2]
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10132
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10133
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10134
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":10133
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10135
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10135, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10136
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10137
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":10138
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10139
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10138
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 */
  }

  /* "cypari/auto_instance.pxi":10140
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factormod0(__pyx_v__f, __pyx_v__D, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":10141
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factormodDDF(self, f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10064
 *         return new_gen(_ret)
 * 
 *     def factormod(self, f, D=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the polynomial :math:`f` over the finite field defined by the domain
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10143
 *         return new_gen(_ret)
 * 
 *     def factormodDDF(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Distinct-degree factorization of the squarefree polynomial :math:`f` over the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_575factormodDDF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_574factormodDDF[] = "\n        Distinct-degree factorization of the squarefree polynomial :math:`f` over the\n        finite field defined by the domain :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        This is somewhat faster than full factorization. The coefficients of :math:`f`\n        must be operation-compatible with the corresponding finite field. The result\n        is a two-column matrix:\n        \n        - the first column contains monic (squarefree) pairwise coprime polynomials\n          dividing :math:`f`, all of whose irreducible factors have degree :math:`d`;\n        \n        - the second column contains the degrees of the irreducible factors.\n        \n        The factors are ordered by increasing degree and the result is canonical: it\n        will not change across multiple calls or sessions.\n        \n        ::\n        \n            ? f = (x^2 + 1) * (x^2-1);\n            ? factormodSQF(f,3) \\\\ squarefree over F_3\n            %2 =\n            [Mod(1, 3)*x^4 + Mod(2, 3) 1]\n            \n            ? factormodDDF(f, 3)\n            %3 =\n            [Mod(1, 3)*x^2 + Mod(2, 3) 1] \\\\ two degree 1 factors\n            \n            [Mod(1, 3)*x^2 + Mod(1, 3) 2] \\\\ irred of degree 2\n            \n            ? for(i=1,10^5,factormodDDF(f,3))\n            time = 424 ms.\n            ? for(i=1,10^5,factormod(f,3)) \\\\ full factorization is slower\n            time = 464 ms.\n            \n            ? liftall( factormodDDF(x^2 + 1, [3, t^2+1]) ) \\\\ over F_9\n            %6 =\n            [x^2 +"" 1 1] \\\\ product of two degree 1 factors\n            \n            ? t = ffgen(t^2+Mod(1,3)); factormodDDF(x^2 + t^0) \\\\ same using t_FFELT\n            %7 =\n            [x^2 + 1 1]\n            \n            ? factormodDDF(x^2-Mod(1,3))\n            %8 =\n            [Mod(1, 3)*x^2 + Mod(2, 3) 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_575factormodDDF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factormodDDF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_D,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factormodDDF") < 0)) __PYX_ERR(4, 10143, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factormodDDF", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10143, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factormodDDF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_574factormodDDF(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_574factormodDDF(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factormodDDF", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":10200
 *             [Mod(1, 3)*x^2 + Mod(2, 3) 1]
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10201
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10202
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10203
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":10202
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10204
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10204, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10205
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10206
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":10207
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10208
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factormodDDF(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10207
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)
 */
  }

  /* "cypari/auto_instance.pxi":10209
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factormodDDF(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_instance.pxi":10210
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factormodSQF(self, f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10143
 *         return new_gen(_ret)
 * 
 *     def factormodDDF(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Distinct-degree factorization of the squarefree polynomial :math:`f` over the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factormodDDF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10212
 *         return new_gen(_ret)
 * 
 *     def factormodSQF(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Squarefree factorization of the polynomial :math:`f` over the finite field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_577factormodSQF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_576factormodSQF[] = "\n        Squarefree factorization of the polynomial :math:`f` over the finite field\n        defined by the domain :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        This is somewhat faster than full factorization. The coefficients of :math:`f`\n        must be operation-compatible with the corresponding finite field. The result\n        is a two-column matrix:\n        \n        - the first column contains monic squarefree pairwise coprime polynomials\n          dividing :math:`f`;\n        \n        - the second column contains the power to which the polynomial in column\n          :math:`1` divides :math:`f`;\n        \n        The factors are ordered by increasing degree and the result is canonical: it\n        will not change across multiple calls or sessions.\n        \n        ::\n        \n            ? f = (x^2 + 1)^3 * (x^2-1)^2;\n            ? factormodSQF(f, 3) \\\\ over F_3\n            %1 =\n            [Mod(1, 3)*x^2 + Mod(2, 3) 2]\n            \n            [Mod(1, 3)*x^2 + Mod(1, 3) 3]\n            \n            ? for(i=1,10^5,factormodSQF(f,3))\n            time = 192 ms.\n            ? for(i=1,10^5,factormod(f,3)) \\\\ full factorization is slower\n            time = 409 ms.\n            \n            ? liftall( factormodSQF((x^2 + 1)^3, [3, t^2+1]) ) \\\\ over F_9\n            %4 =\n            [x^2 + 1 3]\n            \n            ? t = ffgen(t^2+Mod(1,3)); factormodSQF((x^2 + t^0)^3) \\\\ same using t_FFELT\n            %5 =\n            [x^2 + 1 3]\n            \n            ? factor""modSQF(x^8 + x^7 + x^6 + x^2 + x + Mod(1,2))\n            %6 =\n            [ Mod(1, 2)*x + Mod(1, 2) 2]\n            \n            [Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2) 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_577factormodSQF(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factormodSQF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_D,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factormodSQF") < 0)) __PYX_ERR(4, 10212, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factormodSQF", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10212, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factormodSQF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_576factormodSQF(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_576factormodSQF(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factormodSQF", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":10268
 *             [Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2) 3]
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10269
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10270
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10271
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":10270
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10272
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10272, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10273
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10274
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":10275
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10276
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factormodSQF(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10275
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)
 */
  }

  /* "cypari/auto_instance.pxi":10277
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factormodSQF(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_instance.pxi":10278
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factornf(self, x, t):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10212
 *         return new_gen(_ret)
 * 
 *     def factormodSQF(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Squarefree factorization of the polynomial :math:`f` over the finite field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factormodSQF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10280
 *         return new_gen(_ret)
 * 
 *     def factornf(self, x, t):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nffactor`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_579factornf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_578factornf[] = "\n        This function is obsolete, use :literal:`nffactor`.\n        \n        factorization of the univariate polynomial :math:`x`\n        over the number field defined by the (univariate) polynomial :math:`t`. :math:`x` may\n        have coefficients in :math:`\\mathbb{Q}` or in the number field. The algorithm reduces to\n        factorization over :math:`\\mathbb{Q}` (Trager's trick). The direct approach of\n        :literal:`nffactor`, which uses van Hoeij's method in a relative setting, is\n        in general faster.\n        \n        The main variable of :math:`t` must be of :emphasis:`lower` priority than that of :math:`x`\n        (see ``priority`` (in the PARI manual)). However if non-rational number field elements\n        occur (as polmods or polynomials) as coefficients of :math:`x`, the variable of\n        these polmods :emphasis:`must` be the same as the main variable of :math:`t`. For\n        example\n        \n        ::\n        \n            ? factornf(x^2 + Mod(y, y^2+1), y^2+1);\n            ? factornf(x^2 + y, y^2+1); \\\\ these two are OK\n            ? factornf(x^2 + Mod(z,z^2+1), y^2+1)\n             *** at top-level: factornf(x^2+Mod(z,z\n             *** ^--------------------\n             *** factornf: inconsistent data in rnf function.\n            ? factornf(x^2 + z, y^2+1)\n             *** at top-level: factornf(x^2+z,y^2+1\n             *** ^--------------------\n             *** factornf: incorrect variable in rnf function.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_579factornf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factornf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_t,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factornf", 1, 2, 2, 1); __PYX_ERR(4, 10280, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factornf") < 0)) __PYX_ERR(4, 10280, __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_x = values[0];
    __pyx_v_t = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factornf", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10280, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factornf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_578factornf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_t);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_578factornf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_t) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factornf", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":10310
 *              *** factornf: incorrect variable in rnf function.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10310, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":10311
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         t = objtogen(t)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":10312
 *         from warnings import warn
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":10313
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":10314
 *         x = objtogen(x)
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10314, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10315
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = polfnf(_x, _t)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10316
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polfnf(_x, _t)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10317
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = polfnf(_x, _t)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polfnf(__pyx_v__x, __pyx_v__t);

  /* "cypari/auto_instance.pxi":10318
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = polfnf(_x, _t)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorpadic(self, pol, p, long r):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10280
 *         return new_gen(_ret)
 * 
 *     def factornf(self, x, t):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nffactor`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factornf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10320
 *         return new_gen(_ret)
 * 
 *     def factorpadic(self, pol, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`p`-adic factorization
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_581factorpadic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_580factorpadic[] = "\n        :math:`p`-adic factorization\n        of the polynomial :emphasis:`pol` to precision :math:`r`, the result being a\n        two-column matrix as in :literal:`factor`. Note that this is not the same\n        as a factorization over :math:`\\mathbb{Z}/p^r\\mathbb{Z}` (polynomials over that ring do not form a\n        unique factorization domain, anyway), but approximations in :math:`\\mathbb{Q}/p^r\\mathbb{Z}` of\n        the true factorization in :math:`\\mathbb{Q}_p[X]`.\n        \n        ::\n        \n            ? factorpadic(x^2 + 9, 3,5)\n            %1 =\n            [(1 + O(3^5))*x^2 + O(3^5)*x + (3^2 + O(3^5)) 1]\n            ? factorpadic(x^2 + 1, 5,3)\n            %2 =\n            [ (1 + O(5^3))*x + (2 + 5 + 2*5^2 + O(5^3)) 1]\n            \n            [(1 + O(5^3))*x + (3 + 3*5 + 2*5^2 + O(5^3)) 1]\n        \n        The factors are normalized so that their leading coefficient is a power of\n        :math:`p`. The method used is a modified version of the round 4 algorithm of\n        Zassenhaus.\n        \n        If :emphasis:`pol` has inexact :literal:`t_PADIC` coefficients, this is not always\n        well-defined; in this case, the polynomial is first made integral by dividing\n        out the :math:`p`-adic content, then lifted to :math:`\\mathbb{Z}` using :literal:`truncate`\n        coefficientwise.\n        Hence we actually factor exactly a polynomial which is only :math:`p`-adically\n        close to the input. To avoid pitfalls, we advise to only factor polynomials\n        with exact rational coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_581factorpadic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorpadic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_p,&__pyx_n_s_r,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pol)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorpadic", 1, 3, 3, 1); __PYX_ERR(4, 10320, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("factorpadic", 1, 3, 3, 2); __PYX_ERR(4, 10320, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorpadic") < 0)) __PYX_ERR(4, 10320, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_pol = values[0];
    __pyx_v_p = values[1];
    __pyx_v_r = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10320, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorpadic", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10320, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorpadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_580factorpadic(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_pol, __pyx_v_p, __pyx_v_r);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_580factorpadic(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_p, long __pyx_v_r) {
  GEN __pyx_v__pol;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("factorpadic", 0);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":10352
 *         with exact rational coefficients.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10353
 *         '''
 *         pol = objtogen(pol)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10354
 *         pol = objtogen(pol)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10354, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10355
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factorpadic(_pol, _p, r)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10356
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorpadic(_pol, _p, r)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10357
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factorpadic(_pol, _p, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorpadic(__pyx_v__pol, __pyx_v__p, __pyx_v_r);

  /* "cypari/auto_instance.pxi":10358
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factorpadic(_pol, _p, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffcompomap(self, f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10320
 *         return new_gen(_ret)
 * 
 *     def factorpadic(self, pol, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`p`-adic factorization
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.factorpadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10360
 *         return new_gen(_ret)
 * 
 *     def ffcompomap(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`k`, :math:`l`, :math:`m` be three finite fields and :math:`f` a (partial) map from :math:`l`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_583ffcompomap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_582ffcompomap[] = "\n        Let :math:`k`, :math:`l`, :math:`m` be three finite fields and :math:`f` a (partial) map from :math:`l`\n        to :math:`m` and :math:`g` a (partial) map from :math:`k` to :math:`l`, return the (partial) map :math:`f\n        o g` from :math:`k` to :math:`m`.\n        \n        ::\n        \n            a = ffgen([3,5],'a); b = ffgen([3,10],'b); c = ffgen([3,20],'c);\n            m = ffembed(a, b); n = ffembed(b, c);\n            rm = ffinvmap(m); rn = ffinvmap(n);\n            nm = ffcompomap(n,m);\n            ffmap(n,ffmap(m,a)) == ffmap(nm, a)\n            %5 = 1\n            ffcompomap(rm, rn) == ffinvmap(nm)\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_583ffcompomap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffcompomap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_g,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_f)) != 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_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffcompomap", 1, 2, 2, 1); __PYX_ERR(4, 10360, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffcompomap") < 0)) __PYX_ERR(4, 10360, __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_f = values[0];
    __pyx_v_g = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffcompomap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10360, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffcompomap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_582ffcompomap(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_g);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_582ffcompomap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffcompomap", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_instance.pxi":10377
 *             %6 = 1
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         g = objtogen(g)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10378
 *         '''
 *         f = objtogen(f)
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10379
 *         f = objtogen(f)
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10379, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10380
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ffcompomap(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10381
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffcompomap(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10382
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ffcompomap(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffcompomap(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_instance.pxi":10383
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ffcompomap(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffembed(self, a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10360
 *         return new_gen(_ret)
 * 
 *     def ffcompomap(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`k`, :math:`l`, :math:`m` be three finite fields and :math:`f` a (partial) map from :math:`l`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffcompomap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10385
 *         return new_gen(_ret)
 * 
 *     def ffembed(self, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two finite fields elements :math:`a` and :math:`b`, return a :emphasis:`map`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_585ffembed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_584ffembed[] = "\n        Given two finite fields elements :math:`a` and :math:`b`, return a :emphasis:`map`\n        embedding the definition field of :math:`a` to the definition field of :math:`b`.\n        Assume that the latter contains the former.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? b = ffgen([3,10],'b);\n            ? m = ffembed(a, b);\n            ? A = ffmap(m, a);\n            ? minpoly(A) == minpoly(a)\n            %5 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_585ffembed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffembed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffembed", 1, 2, 2, 1); __PYX_ERR(4, 10385, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffembed") < 0)) __PYX_ERR(4, 10385, __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_a = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffembed", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10385, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_584ffembed(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_584ffembed(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffembed", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":10400
 *             %5 = 1
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10401
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10402
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10402, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10403
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = ffembed(_a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10404
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffembed(_a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10405
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = ffembed(_a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffembed(__pyx_v__a, __pyx_v__b);

  /* "cypari/auto_instance.pxi":10406
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = ffembed(_a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffextend(self, a, P, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10385
 *         return new_gen(_ret)
 * 
 *     def ffembed(self, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two finite fields elements :math:`a` and :math:`b`, return a :emphasis:`map`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10408
 *         return new_gen(_ret)
 * 
 *     def ffextend(self, a, P, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extend the field :math:`K` of definition of :math:`a` by a root of the polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_587ffextend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_586ffextend[] = "\n        Extend the field :math:`K` of definition of :math:`a` by a root of the polynomial\n        :math:`P\\in K[X]` assumed to be irreducible over :math:`K`. Return :math:`[r, m]` where :math:`r`\n        is a root of :math:`P` in the extension field :math:`L` and :math:`m` is a map from :math:`K` to :math:`L`,\n        see :literal:`ffmap`.\n        If :math:`v` is given, the variable name is used to display the generator of :math:`L`,\n        else the name of the variable of :math:`P` is used.\n        A generator of :math:`L` can be recovered using :math:`b = ffgen(r)`.\n        The image of :math:`P` in :math:`L[X]` can be recovered using :math:`PL = ffmap(m,P)`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? P = x^2-a; polisirreducible(P)\n            %2 = 1\n            ? [r,m] = ffextend(a, P, 'b);\n            ? r\n            %3 = b^9+2*b^8+b^7+2*b^6+b^4+1\n            ? subst(ffmap(m, P), x, r)\n            %4 = 0\n            ? ffgen(r)\n            %5 = b\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_587ffextend(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffextend (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_P,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_a)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffextend", 0, 2, 3, 1); __PYX_ERR(4, 10408, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffextend") < 0)) __PYX_ERR(4, 10408, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_a = values[0];
    __pyx_v_P = values[1];
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffextend", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10408, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffextend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_586ffextend(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_P, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_586ffextend(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_P, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__a;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ffextend", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":10432
 *             %5 = b
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10433
 *         '''
 *         a = objtogen(a)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10434
 *         a = objtogen(a)
 *         P = objtogen(P)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":10435
 *         P = objtogen(P)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":10436
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 10436, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10435
 *         P = objtogen(P)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10437
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 10437, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10438
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ffextend(_a, _P, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_6;

  /* "cypari/auto_instance.pxi":10439
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffextend(_a, _P, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_6;

  /* "cypari/auto_instance.pxi":10440
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ffextend(_a, _P, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffextend(__pyx_v__a, __pyx_v__P, __pyx_v__v);

  /* "cypari/auto_instance.pxi":10441
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ffextend(_a, _P, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fffrobenius(self, m, long n=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10408
 *         return new_gen(_ret)
 * 
 *     def ffextend(self, a, P, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extend the field :math:`K` of definition of :math:`a` by a root of the polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffextend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10443
 *         return new_gen(_ret)
 * 
 *     def fffrobenius(self, m, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the :math:`n`-th power of the Frobenius map over the field of definition
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_589fffrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_588fffrobenius[] = "\n        Return the :math:`n`-th power of the Frobenius map over the field of definition\n        of :math:`m`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? f = fffrobenius(a);\n            ? ffmap(f,a) == a^3\n            %3 = 1\n            ? g = fffrobenius(a, 5);\n            ? ffmap(g,a) == a\n            %5 = 1\n            ? h = fffrobenius(a, 2);\n            ? h == ffcompomap(f,f)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_589fffrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_m = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fffrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_n,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_m)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fffrobenius") < 0)) __PYX_ERR(4, 10443, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_m = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10443, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fffrobenius", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10443, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fffrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_588fffrobenius(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_m, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_588fffrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_m, long __pyx_v_n) {
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("fffrobenius", 0);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":10461
 *             %7 = 1
 *         '''
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10462
 *         '''
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = fffrobenius(_m, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10462, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10463
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fffrobenius(_m, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10464
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = fffrobenius(_m, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fffrobenius(__pyx_v__m, __pyx_v_n);

  /* "cypari/auto_instance.pxi":10465
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = fffrobenius(_m, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffgen(self, k, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10443
 *         return new_gen(_ret)
 * 
 *     def fffrobenius(self, m, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the :math:`n`-th power of the Frobenius map over the field of definition
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fffrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10467
 *         return new_gen(_ret)
 * 
 *     def ffgen(self, k, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a generator for the finite field :math:`k` as a :literal:`t_FFELT`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_591ffgen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_590ffgen[] = "\n        Return a generator for the finite field :math:`k` as a :literal:`t_FFELT`.\n        The field :math:`k` can be given by\n        \n        - its order :math:`q`\n        \n        - the pair :math:`[p,f]` where :math:`q = p^f`\n        \n        - a monic irreducible polynomial with :literal:`t_INTMOD` coefficients modulo a\n          prime.\n        \n        - a :literal:`t_FFELT` belonging to :math:`k`.\n        \n        If :literal:`v` is given, the variable name is used to display :math:`g`, else the\n        variable of the polynomial or the :literal:`t_FFELT` is used, else :math:`x` is used.\n        \n        When only the order is specified, the function uses the polynomial generated\n        by :literal:`ffinit` and is deterministic: two calls to the function with the\n        same parameters will always give the same generator.\n        \n        For efficiency, the characteristic is not checked to be prime; similarly\n        if a polynomial is given, we do not check whether it is irreducible.\n        \n        To obtain a multiplicative generator, call :literal:`ffprimroot` on the result.\n        \n        ::\n        \n            ? g = ffgen(16, 't);\n            ? g.mod \\\\ recover the underlying polynomial.\n            %2 = t^4+t^3+t^2+t+1\n            ? g.p \\\\ recover the characteristic\n            %3 = 2\n            ? fforder(g) \\\\ g is not a multiplicative generator\n            %4 = 5\n            ? a = ffprimroot(g) \\\\ recover a multiplicative generator\n            %5 = t^3+t^2+t\n            ? fforder(a)\n            %6 = 15\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_591ffgen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffgen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_k)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffgen") < 0)) __PYX_ERR(4, 10467, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffgen", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10467, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_590ffgen(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_k, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_590ffgen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_k, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ffgen", 0);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_instance.pxi":10507
 *             %6 = 15
 *         '''
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10508
 *         '''
 *         k = objtogen(k)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":10509
 *         k = objtogen(k)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":10510
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 10510, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10509
 *         k = objtogen(k)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10511
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = ffgen(_k, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 10511, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10512
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffgen(_k, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_6;

  /* "cypari/auto_instance.pxi":10513
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = ffgen(_k, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffgen(__pyx_v__k, __pyx_v__v);

  /* "cypari/auto_instance.pxi":10514
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = ffgen(_k, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffinit(self, p, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10467
 *         return new_gen(_ret)
 * 
 *     def ffgen(self, k, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a generator for the finite field :math:`k` as a :literal:`t_FFELT`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10516
 *         return new_gen(_ret)
 * 
 *     def ffinit(self, p, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a monic polynomial of degree :math:`n` which is irreducible over
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_593ffinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_592ffinit[] = "\n        Computes a monic polynomial of degree :math:`n` which is irreducible over\n        :math:`\\mathbb{F}_p`, where :math:`p` is assumed to be prime. This function uses a fast variant\n        of Adleman and Lenstra's algorithm.\n        \n        It is useful in conjunction with :literal:`ffgen`; for instance if\n        :literal:`P = ffinit(3,2)`, you can represent elements in :math:`\\mathbb{F}_{3^2}` in term of\n        :literal:`g = ffgen(P,'t)`. This can be abbreviated as\n        :literal:`g = ffgen(3^2, 't)`, where the defining polynomial :math:`P` can be later\n        recovered as :literal:`g.mod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_593ffinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffinit", 0, 2, 3, 1); __PYX_ERR(4, 10516, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffinit") < 0)) __PYX_ERR(4, 10516, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10516, __pyx_L3_error)
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffinit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_592ffinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_p, __pyx_v_n, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_592ffinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ffinit", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":10528
 *         recovered as :literal:`g.mod`.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10529
 *         '''
 *         p = objtogen(p)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":10530
 *         p = objtogen(p)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":10531
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 10531, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10530
 *         p = objtogen(p)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10532
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ffinit(_p, n, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 10532, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10533
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffinit(_p, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_6;

  /* "cypari/auto_instance.pxi":10534
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ffinit(_p, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffinit(__pyx_v__p, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_instance.pxi":10535
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ffinit(_p, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffinvmap(self, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10516
 *         return new_gen(_ret)
 * 
 *     def ffinit(self, p, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a monic polynomial of degree :math:`n` which is irreducible over
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10537
 *         return new_gen(_ret)
 * 
 *     def ffinvmap(self, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m` being a map from :math:`K` to :math:`L` two finite fields, return the partial map
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_595ffinvmap(PyObject *__pyx_v_self, PyObject *__pyx_v_m); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_594ffinvmap[] = "\n        :math:`m` being a map from :math:`K` to :math:`L` two finite fields, return the partial map\n        :math:`p` from :math:`L` to :math:`K` such that for all :math:`k\\in K`, :math:`p(m(k)) = k`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? b = ffgen([3,10],'b);\n            ? m = ffembed(a, b);\n            ? p = ffinvmap(m);\n            ? u = random(a);\n            ? v = ffmap(m, u);\n            ? ffmap(p, v^2+v+2) == u^2+u+2\n            %7 = 1\n            ? ffmap(p, b)\n            %8 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_595ffinvmap(PyObject *__pyx_v_self, PyObject *__pyx_v_m) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffinvmap (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_594ffinvmap(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_m));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_594ffinvmap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_m) {
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffinvmap", 0);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":10555
 *             %8 = []
 *         '''
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10556
 *         '''
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ffinvmap(_m)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10556, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10557
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffinvmap(_m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10558
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ffinvmap(_m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffinvmap(__pyx_v__m);

  /* "cypari/auto_instance.pxi":10559
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ffinvmap(_m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fflog(self, x, g, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10537
 *         return new_gen(_ret)
 * 
 *     def ffinvmap(self, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m` being a map from :math:`K` to :math:`L` two finite fields, return the partial map
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffinvmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10561
 *         return new_gen(_ret)
 * 
 *     def fflog(self, x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discrete logarithm of the finite field element :math:`x` in base :math:`g`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_597fflog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_596fflog[] = "\n        Discrete logarithm of the finite field element :math:`x` in base :math:`g`,\n        i.e.\302\240an :math:`e` in :math:`\\mathbb{Z}` such that :math:`g^e = o`. If\n        present, :math:`o` represents the multiplicative order of :math:`g`, see\n        ``DLfun`` (in the PARI manual); the preferred format for\n        this parameter is :literal:`[ord, factor(ord)]`, where :literal:`ord` is the\n        order of :math:`g`. It may be set as a side effect of calling :literal:`ffprimroot`.\n        \n        If no :math:`o` is given, assume that :math:`g` is a primitive root. The result is\n        undefined if :math:`e` does not exist. This function uses\n        \n        - a combination of generic discrete log algorithms (see :literal:`znlog`)\n        \n        - a cubic sieve index calculus algorithm for large fields of degree at\n          least :math:`5`.\n        \n        - Coppersmith's algorithm for fields of characteristic at most :math:`5`.\n        \n        ::\n        \n            ? t = ffgen(ffinit(7,5));\n            ? o = fforder(t)\n            %2 = 5602 \\\\ not a primitive root.\n            ? fflog(t^10,t)\n            %3 = 10\n            ? fflog(t^10,t, o)\n            %4 = 10\n            ? g = ffprimroot(t, &o);\n            ? o \\\\ order is 16806, bundled with its factorization matrix\n            %6 = [16806, [2, 1; 3, 1; 2801, 1]]\n            ? fforder(g, o)\n            %7 = 16806\n            ? fflog(g^10000, g, o)\n            %8 = 10000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_597fflog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fflog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_g,&__pyx_n_s_o,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fflog", 0, 2, 3, 1); __PYX_ERR(4, 10561, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fflog") < 0)) __PYX_ERR(4, 10561, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_g = values[1];
    __pyx_v_o = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fflog", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10561, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fflog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_596fflog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_g, __pyx_v_o);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_596fflog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__g;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("fflog", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_g);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_instance.pxi":10597
 *             %8 = 10000
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10598
 *         '''
 *         x = objtogen(x)
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10599
 *         x = objtogen(x)
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10600
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10601
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":10600
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10602
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10602, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10603
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10604
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10605
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_instance.pxi":10606
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10607
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fflog(_x, _g, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10606
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)
 */
  }

  /* "cypari/auto_instance.pxi":10608
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fflog(__pyx_v__x, __pyx_v__g, __pyx_v__o);

  /* "cypari/auto_instance.pxi":10609
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffmap(self, m, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10561
 *         return new_gen(_ret)
 * 
 *     def fflog(self, x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discrete logarithm of the finite field element :math:`x` in base :math:`g`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fflog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10611
 *         return new_gen(_ret)
 * 
 *     def ffmap(self, m, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a (partial) map :math:`m` between two finite fields, return the image of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_599ffmap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_598ffmap[] = "\n        Given a (partial) map :math:`m` between two finite fields, return the image of\n        :math:`x` by :math:`m`. The function is applied recursively to the component of vectors,\n        matrices and polynomials. If :math:`m` is a partial map that is not defined at :math:`x`,\n        return :math:`[]`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? b = ffgen([3,10],'b);\n            ? m = ffembed(a, b);\n            ? P = x^2+a*x+1;\n            ? Q = ffmap(m,P);\n            ? ffmap(m,poldisc(P)) == poldisc(Q)\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_599ffmap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffmap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_x,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_m)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffmap", 1, 2, 2, 1); __PYX_ERR(4, 10611, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffmap") < 0)) __PYX_ERR(4, 10611, __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_m = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffmap", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10611, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_598ffmap(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_m, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_598ffmap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_m, PyObject *__pyx_v_x) {
  GEN __pyx_v__m;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffmap", 0);
  __Pyx_INCREF(__pyx_v_m);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":10628
 *             %6 = 1
 *         '''
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10629
 *         '''
 *         m = objtogen(m)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10630
 *         m = objtogen(m)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10630, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10631
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = ffmap(_m, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10632
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffmap(_m, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10633
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = ffmap(_m, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffmap(__pyx_v__m, __pyx_v__x);

  /* "cypari/auto_instance.pxi":10634
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = ffmap(_m, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffnbirred(self, q, long n, long fl=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10611
 *         return new_gen(_ret)
 * 
 *     def ffmap(self, m, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a (partial) map :math:`m` between two finite fields, return the image of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10636
 *         return new_gen(_ret)
 * 
 *     def ffnbirred(self, q, long n, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the number of monic irreducible polynomials over :math:`\mathbb{F}_q` of degree exactly :math:`n`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_601ffnbirred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_600ffnbirred[] = "\n        Computes the number of monic irreducible polynomials over :math:`\\mathbb{F}_q` of degree exactly :math:`n`,\n        (:math:`flag = 0` or omitted) or at most :math:`n` (:math:`flag = 1`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_601ffnbirred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_q = 0;
  long __pyx_v_n;
  long __pyx_v_fl;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffnbirred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,&__pyx_n_s_n,&__pyx_n_s_fl,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ffnbirred", 0, 2, 3, 1); __PYX_ERR(4, 10636, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffnbirred") < 0)) __PYX_ERR(4, 10636, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_q = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10636, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10636, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffnbirred", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10636, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffnbirred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_600ffnbirred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_q, __pyx_v_n, __pyx_v_fl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_600ffnbirred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, long __pyx_v_n, long __pyx_v_fl) {
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffnbirred", 0);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_instance.pxi":10641
 *         (:math:`flag = 0` or omitted) or at most :math:`n` (:math:`flag = 1`).
 *         '''
 *         q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10642
 *         '''
 *         q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10642, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10643
 *         q = objtogen(q)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10644
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffnbirred0(__pyx_v__q, __pyx_v_n, __pyx_v_fl);

  /* "cypari/auto_instance.pxi":10645
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fforder(self, x, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10636
 *         return new_gen(_ret)
 * 
 *     def ffnbirred(self, q, long n, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the number of monic irreducible polynomials over :math:`\mathbb{F}_q` of degree exactly :math:`n`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ffnbirred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10647
 *         return new_gen(_ret)
 * 
 *     def fforder(self, x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplicative order of the finite field element :math:`x`. If :math:`o` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_603fforder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_602fforder[] = "\n        Multiplicative order of the finite field element :math:`x`. If :math:`o` is\n        present, it represents a multiple of the order of the element,\n        see ``DLfun`` (in the PARI manual); the preferred format for\n        this parameter is :literal:`[N, factor(N)]`, where :literal:`N` is the cardinality\n        of the multiplicative group of the underlying finite field.\n        \n        ::\n        \n            ? t = ffgen(ffinit(nextprime(10^8), 5));\n            ? g = ffprimroot(t, &o); \\\\ o will be useful!\n            ? fforder(g^1000000, o)\n            time = 0 ms.\n            %5 = 5000001750000245000017150000600250008403\n            ? fforder(g^1000000)\n            time = 16 ms. \\\\ noticeably slower, same result of course\n            %6 = 5000001750000245000017150000600250008403\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_603fforder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fforder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_o,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fforder") < 0)) __PYX_ERR(4, 10647, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_o = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fforder", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10647, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fforder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_602fforder(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_o);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_602fforder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("fforder", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_instance.pxi":10666
 *             %6 = 5000001750000245000017150000600250008403
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10667
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10668
 *         x = objtogen(x)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10669
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":10668
 *         x = objtogen(x)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10670
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10670, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10671
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":10672
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_instance.pxi":10673
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":10674
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fforder(_x, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10673
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)
 */
  }

  /* "cypari/auto_instance.pxi":10675
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fforder(__pyx_v__x, __pyx_v__o);

  /* "cypari/auto_instance.pxi":10676
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fibonacci(self, long x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10647
 *         return new_gen(_ret)
 * 
 *     def fforder(self, x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplicative order of the finite field element :math:`x`. If :math:`o` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fforder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10678
 *         return new_gen(_ret)
 * 
 *     def fibonacci(self, long x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x-th` Fibonacci number.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_605fibonacci(PyObject *__pyx_v_self, PyObject *__pyx_arg_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_604fibonacci[] = "\n        :math:`x-th` Fibonacci number.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_605fibonacci(PyObject *__pyx_v_self, PyObject *__pyx_arg_x) {
  long __pyx_v_x;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fibonacci (wrapper)", 0);
  assert(__pyx_arg_x); {
    __pyx_v_x = __Pyx_PyInt_As_long(__pyx_arg_x); if (unlikely((__pyx_v_x == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10678, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fibonacci", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_604fibonacci(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_604fibonacci(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_x) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("fibonacci", 0);

  /* "cypari/auto_instance.pxi":10682
 *         :math:`x-th` Fibonacci number.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fibo(x)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 10682, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10683
 *         '''
 *         sig_on()
 *         cdef GEN _ret = fibo(x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fibo(__pyx_v_x);

  /* "cypari/auto_instance.pxi":10684
 *         sig_on()
 *         cdef GEN _ret = fibo(x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fileclose(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10678
 *         return new_gen(_ret)
 * 
 *     def fibonacci(self, long x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x-th` Fibonacci number.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fibonacci", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10686
 *         return new_gen(_ret)
 * 
 *     def fileclose(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Close the file descriptor :math:`n`, created via :literal:`fileopen` or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_607fileclose(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_606fileclose[] = "\n        Close the file descriptor :math:`n`, created via :literal:`fileopen` or\n        :literal:`fileextern`. Finitely many files can be opened at a given time,\n        closing them recycles file descriptors and avoids running out of them:\n        \n        ::\n        \n            ? n = 0; while(n++, fileopen(\"/tmp/test\", \"w\"))\n             *** at top-level: n=0;while(n++,fileopen(\"/tmp/test\",\"w\"))\n             *** ^--------------------------\n             *** fileopen: error opening requested file: `/tmp/test'.\n             *** Break loop: type 'break' to go back to GP prompt\n            break> n\n            65533\n        \n        This is a limitation of the operating system and does not\n        depend on PARI: if you open too many files in :literal:`gp` without closing them,\n        the operating system will also prevent unrelated applications from opening\n        files. Independently, your operating system (e.g. Windows) may prevent other\n        applications from accessing or deleting your file while it is opened by\n        :literal:`gp`. Quitting :literal:`gp` implicitly calls this function on all opened\n        file descriptors.\n        \n        On files opened for writing, this function also forces a write of all\n        buffered data to the file system and completes all pending write operations.\n        This function is implicitly called for all open file descriptors when\n        exiting :literal:`gp` but it is cleaner and safer to call it explicitly, for\n        instance in case of a :literal:`gp` crash or general system failure, which could\n        cause data loss.\n        \n        ::\n        \n            ? n = fileopen(\"./here\");\n            ? while(l = fileread(n), print(l));\n            ? fileclose(n);\n            \n            ? n = fileopen(\"./there\", \"w\");\n            ? for (i = 1, 100, filewrite(n, i^2+1))\n            ? fileclose(n)\n        \n        Until a :literal:`fileclose`, there is no guaran""tee that the file on disk\n        contains all the expected data from previous :literal:`filewrite`\302\240s. (And even\n        then the operating system may delay the actual write to hardware.)\n        \n        Closing a file twice raises an exception:\n        \n        ::\n        \n            ? n = fileopen(\"/tmp/test\");\n            ? fileclose(n)\n            ? fileclose(n)\n             *** at top-level: fileclose(n)\n             *** ^------------\n             *** fileclose: invalid file descriptor 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_607fileclose(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fileclose (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10686, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileclose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_606fileclose(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_606fileclose(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("fileclose", 0);

  /* "cypari/auto_instance.pxi":10742
 *              *** fileclose: invalid file descriptor 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         gp_fileclose(n)
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 10742, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10743
 *         '''
 *         sig_on()
 *         gp_fileclose(n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gp_fileclose(__pyx_v_n);

  /* "cypari/auto_instance.pxi":10744
 *         sig_on()
 *         gp_fileclose(n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def fileextern(self, str):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":10686
 *         return new_gen(_ret)
 * 
 *     def fileclose(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Close the file descriptor :math:`n`, created via :literal:`fileopen` or
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileclose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10746
 *         clear_stack()
 * 
 *     def fileextern(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         The string :emphasis:`str` is the name of an external command, i.e.one you
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_609fileextern(PyObject *__pyx_v_self, PyObject *__pyx_v_str); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_608fileextern[] = "\n        The string :emphasis:`str` is the name of an external command, i.e.\302\240one you\n        would type from your UNIX shell prompt. This command is immediately run and\n        the function returns a file descriptor attached to the command output as if\n        it were read from a file.\n        \n        ::\n        \n            ? n = fileextern(\"ls -l\");\n            ? while(l = filereadstr(n), print(l))\n            ? fileclose(n)\n        \n        If the :literal:`secure` default is set, this function will raise\n        en exception.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_609fileextern(PyObject *__pyx_v_self, PyObject *__pyx_v_str) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fileextern (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_608fileextern(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_str));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_608fileextern(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str) {
  char *__pyx_v__str;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("fileextern", 0);
  __Pyx_INCREF(__pyx_v_str);

  /* "cypari/auto_instance.pxi":10762
 *         en exception.
 *         '''
 *         str = to_bytes(str)             # <<<<<<<<<<<<<<
 *         cdef char* _str = <bytes>str
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_str, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10763
 *         '''
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef long _ret = gp_fileextern(_str)
 */
  if (unlikely(__pyx_v_str == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 10763, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_str); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 10763, __pyx_L1_error)
  __pyx_v__str = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10764
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long _ret = gp_fileextern(_str)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10764, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10765
 *         cdef char* _str = <bytes>str
 *         sig_on()
 *         cdef long _ret = gp_fileextern(_str)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = gp_fileextern(__pyx_v__str);

  /* "cypari/auto_instance.pxi":10766
 *         sig_on()
 *         cdef long _ret = gp_fileextern(_str)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":10767
 *         cdef long _ret = gp_fileextern(_str)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def fileflush(self, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10746
 *         clear_stack()
 * 
 *     def fileextern(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         The string :emphasis:`str` is the name of an external command, i.e.one you
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileextern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10769
 *         return _ret
 * 
 *     def fileflush(self, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Flushes the file descriptor :math:`n`, created via :literal:`fileopen` or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_611fileflush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_610fileflush[] = "\n        Flushes the file descriptor :math:`n`, created via :literal:`fileopen` or\n        :literal:`fileextern`. On files opened for writing, this function forces a write\n        of all buffered data to the file system and completes all pending write\n        operations. This function is implicitly called by :literal:`fileclose` but you may\n        want to call it explicitly at synchronization points, for instance after\n        writing a large result to file and before printing diagnostics on screen.\n        (In order to be sure that the file contains the expected content on\n        inspection.)\n        \n        If :math:`n` is omitted, flush all descriptors to output streams.\n        \n        ::\n        \n            ? n = fileopen(\"./here\", \"w\");\n            ? for (i = 1, 10^5, \\\n             filewrite(n, i^2+1); \\\n             if (i % 10000 == 0, fileflush(n)))\n        \n        Until a :literal:`fileflush` or :literal:`fileclose`, there is no guarantee\n        that the file contains all the expected data from previous :literal:`filewrite`\302\240s.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_611fileflush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fileflush (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fileflush") < 0)) __PYX_ERR(4, 10769, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fileflush", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10769, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileflush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_610fileflush(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_610fileflush(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n) {
  int __pyx_v__have_n;
  GEN __pyx_v__n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("fileflush", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":10792
 *         that the file contains all the expected data from previous :literal:`filewrite`s.
 *         '''
 *         cdef bint _have_n = (n is not None)             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             n = objtogen(n)
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_v__have_n = __pyx_t_1;

  /* "cypari/auto_instance.pxi":10793
 *         '''
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_n != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":10794
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:
 *             n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":10793
 *         '''
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":10795
 *         if _have_n:
 *             n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = NULL
 *         if _have_n:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10795, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10796
 *             n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = NULL             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             _n = (<Gen>n).g
 */
  __pyx_v__n = NULL;

  /* "cypari/auto_instance.pxi":10797
 *         sig_on()
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         gp_fileflush0(_n)
 */
  __pyx_t_1 = (__pyx_v__have_n != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":10798
 *         cdef GEN _n = NULL
 *         if _have_n:
 *             _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         gp_fileflush0(_n)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":10797
 *         sig_on()
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         gp_fileflush0(_n)
 */
  }

  /* "cypari/auto_instance.pxi":10799
 *         if _have_n:
 *             _n = (<Gen>n).g
 *         gp_fileflush0(_n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gp_fileflush0(__pyx_v__n);

  /* "cypari/auto_instance.pxi":10800
 *             _n = (<Gen>n).g
 *         gp_fileflush0(_n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def fileopen(self, path, mode=None):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":10769
 *         return _ret
 * 
 *     def fileflush(self, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Flushes the file descriptor :math:`n`, created via :literal:`fileopen` or
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileflush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10802
 *         clear_stack()
 * 
 *     def fileopen(self, path, mode=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Open the file pointed to by 'path' and return a file descriptor which
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_613fileopen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_612fileopen[] = "\n        Open the file pointed to by 'path' and return a file descriptor which\n        can be used with other file functions.\n        \n        The mode can be\n        \n        - :literal:`\"r\"` (default): open for reading; allow :literal:`fileread` and\n          :literal:`filereadstr`.\n        \n        - :literal:`\"w\"`: open for writing, discarding existing content; allow\n          :literal:`filewrite`, :literal:`filewrite1`.\n        \n        - :literal:`\"a\"`: open for writing, appending to existing content; same\n          operations allowed as :literal:`\"w\"`.\n        \n        Eventually, the file should be closed and the descriptor recycled using\n        :literal:`fileclose`.\n        \n        ::\n        \n            ? n = fileopen(\"./here\"); \\\\ \"r\" by default\n            ? while (l = filereadstr(n), print(l)) \\\\ print successive lines\n            ? fileclose(n) \\\\ done\n        \n        In :emphasis:`read` mode, raise an exception if the file does not\n        exist or the user does not have read permission. In :emphasis:`write` mode, raise\n        an exception if the file cannot be written to. Trying to read or write to a\n        file that was not opend with the right mode raises an exception.\n        \n        ::\n        \n            ? n = fileopen(\"./read\", \"r\");\n            ? filewrite(n, \"test\") \\\\ not open for writing\n             *** at top-level: filewrite(n,\"test\")\n             *** ^-------------------\n             *** filewrite: invalid file descriptor 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_613fileopen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fileopen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_mode,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fileopen") < 0)) __PYX_ERR(4, 10802, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_mode = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fileopen", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10802, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileopen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_612fileopen(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_path, __pyx_v_mode);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_612fileopen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_mode) {
  char *__pyx_v__path;
  char *__pyx_v__mode;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("fileopen", 0);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_mode);

  /* "cypari/auto_instance.pxi":10840
 *              *** filewrite: invalid file descriptor 0
 *         '''
 *         path = to_bytes(path)             # <<<<<<<<<<<<<<
 *         cdef char* _path = <bytes>path
 *         cdef char* _mode
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_path); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10841
 *         '''
 *         path = to_bytes(path)
 *         cdef char* _path = <bytes>path             # <<<<<<<<<<<<<<
 *         cdef char* _mode
 *         if mode is None:
 */
  if (unlikely(__pyx_v_path == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 10841, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_path); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 10841, __pyx_L1_error)
  __pyx_v__path = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10843
 *         cdef char* _path = <bytes>path
 *         cdef char* _mode
 *         if mode is None:             # <<<<<<<<<<<<<<
 *             _mode = "r"
 *         else:
 */
  __pyx_t_3 = (__pyx_v_mode == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":10844
 *         cdef char* _mode
 *         if mode is None:
 *             _mode = "r"             # <<<<<<<<<<<<<<
 *         else:
 *             mode = to_bytes(mode)
 */
    __pyx_v__mode = ((char *)"r");

    /* "cypari/auto_instance.pxi":10843
 *         cdef char* _path = <bytes>path
 *         cdef char* _mode
 *         if mode is None:             # <<<<<<<<<<<<<<
 *             _mode = "r"
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/auto_instance.pxi":10846
 *             _mode = "r"
 *         else:
 *             mode = to_bytes(mode)             # <<<<<<<<<<<<<<
 *             _mode = <bytes>mode
 *         sig_on()
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_mode); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10846, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":10847
 *         else:
 *             mode = to_bytes(mode)
 *             _mode = <bytes>mode             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef long _ret = gp_fileopen(_path, _mode)
 */
    if (unlikely(__pyx_v_mode == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 10847, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_mode); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 10847, __pyx_L1_error)
    __pyx_v__mode = __pyx_t_2;
  }
  __pyx_L3:;

  /* "cypari/auto_instance.pxi":10848
 *             mode = to_bytes(mode)
 *             _mode = <bytes>mode
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long _ret = gp_fileopen(_path, _mode)
 *         clear_stack()
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 10848, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10849
 *             _mode = <bytes>mode
 *         sig_on()
 *         cdef long _ret = gp_fileopen(_path, _mode)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = gp_fileopen(__pyx_v__path, __pyx_v__mode);

  /* "cypari/auto_instance.pxi":10850
 *         sig_on()
 *         cdef long _ret = gp_fileopen(_path, _mode)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":10851
 *         cdef long _ret = gp_fileopen(_path, _mode)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def fileread(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10802
 *         clear_stack()
 * 
 *     def fileopen(self, path, mode=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Open the file pointed to by 'path' and return a file descriptor which
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileopen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10853
 *         return _ret
 * 
 *     def fileread(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Read a logical line from the file attached to the descriptor :math:`n`, opened
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_615fileread(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_614fileread[] = "\n        Read a logical line from the file attached to the descriptor :math:`n`, opened\n        for reading with :literal:`fileopen`. Return 0 at end of file.\n        \n        A logical line is a full command as it is prepared by gp's\n        preprocessor (skipping blanks and comments or assembling multiline commands\n        between braces) before being fed to the interpreter. The function\n        :literal:`filereadstr` would read a :emphasis:`raw` line exactly as input, up to the\n        next carriage return :literal:`\\\\n`.\n        \n        Compare raw lines\n        \n        ::\n        \n            ? n = fileopen(\"examples/bench.gp\");\n            ? while(l = filereadstr(n), print(l));\n            {\n             u=v=p=q=1;\n             for (k=1, 2000,\n             [u,v] = [v,u+v];\n             p *= v; q = lcm(q,v);\n             if (k%50 == 0,\n             print(k, \" \", log(p)/log(q))\n             )\n             )\n            }\n        \n        and logical lines\n        \n        ::\n        \n            ? n = fileopen(\"examples/bench.gp\");\n            ? while(l = fileread(n), print(l));\n            u=v=p=q=1;for(k=1,2000,[u,v]=[v,u+v];p*=v;q=lcm(q,v);[...]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_615fileread(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fileread (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10853, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileread", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_614fileread(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_614fileread(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("fileread", 0);

  /* "cypari/auto_instance.pxi":10889
 *             u=v=p=q=1;for(k=1,2000,[u,v]=[v,u+v];p*=v;q=lcm(q,v);[...]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gp_fileread(n)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 10889, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10890
 *         '''
 *         sig_on()
 *         cdef GEN _ret = gp_fileread(n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gp_fileread(__pyx_v_n);

  /* "cypari/auto_instance.pxi":10891
 *         sig_on()
 *         cdef GEN _ret = gp_fileread(n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def filereadstr(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10853
 *         return _ret
 * 
 *     def fileread(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Read a logical line from the file attached to the descriptor :math:`n`, opened
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fileread", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10893
 *         return new_gen(_ret)
 * 
 *     def filereadstr(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Read a raw line from the file attached to the descriptor :math:`n`, opened
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_617filereadstr(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_616filereadstr[] = "\n        Read a raw line from the file attached to the descriptor :math:`n`, opened\n        for reading with :literal:`fileopen`, discarding the terminating newline.\n        In other words the line is read exactly as input, up to the\n        next carriage return :literal:`\\\\n`. By comparison, :literal:`fileread` would\n        read a logical line, as assembled by gp's preprocessor (skipping blanks\n        and comments for instance).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_617filereadstr(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filereadstr (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10893, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.filereadstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_616filereadstr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_616filereadstr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("filereadstr", 0);

  /* "cypari/auto_instance.pxi":10902
 *         and comments for instance).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gp_filereadstr(n)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 10902, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10903
 *         '''
 *         sig_on()
 *         cdef GEN _ret = gp_filereadstr(n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gp_filereadstr(__pyx_v_n);

  /* "cypari/auto_instance.pxi":10904
 *         sig_on()
 *         cdef GEN _ret = gp_filereadstr(n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def filewrite(self, long n, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 10904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10893
 *         return new_gen(_ret)
 * 
 *     def filereadstr(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Read a raw line from the file attached to the descriptor :math:`n`, opened
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.filereadstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10906
 *         return new_gen(_ret)
 * 
 *     def filewrite(self, long n, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Write the string :math:`s` to the file attached to descriptor :math:`n`, ending with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_619filewrite(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_618filewrite[] = "\n        Write the string :math:`s` to the file attached to descriptor :math:`n`, ending with\n        a newline. The file must have been opened with :literal:`fileopen` in\n        :literal:`\"w\"` or :literal:`\"a\"` mode. There is no guarantee that :math:`s` is completely\n        written to disk until :literal:`fileclose:math:`(n)`` is executed, which is automatic\n        when quitting :literal:`gp`.\n        \n        If the newline is not desired, use :literal:`filewrite1`.\n        \n        :strong:`Variant.` The high-level function :literal:`write` is expensive when many\n        consecutive writes are expected because it cannot use buffering. The low-level\n        interface :literal:`fileopen` / :literal:`filewrite` / :literal:`fileclose` is more efficient:\n        \n        ::\n        \n            ? f = \"/tmp/bigfile\";\n            ? for (i = 1, 10^5, write(f, i^2+1))\n            time = 240 ms.\n            \n            ? v = vector(10^5, i, i^2+1);\n            time = 10 ms. \\\\ computing the values is fast\n            ? write(\"/tmp/bigfile2\",v)\n            time = 12 ms. \\\\ writing them in one operation is fast\n            \n            ? n = fileopen(\"/tmp/bigfile\", \"w\");\n            ? for (i = 1, 10^5, filewrite(n, i^2+1))\n            time = 24 ms. \\\\ low-level write is ten times faster\n            ? fileclose(n);\n        \n        In the final example, the file needs not be in a consistent\n        state until the ending :literal:`fileclose` is evaluated, e.g. some lines might be\n        half-written or not present at all even though the corresponding\n        :literal:`filewrite` was executed already. Both a single high-level :literal:`write`\n        and a succession of low-level :literal:`filewrite`\302\240s achieve the same efficiency,\n        but the latter is often more natural. In fact, concatenating naively\n        the entries to be written is quadratic in the number of entries, hence\n        much more expensive"" than the original write operations:\n        \n        ::\n        \n            ? v = []; for (i = 1, 10^5, v = concat(v,i))\n            time = 1min, 41,456 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_619filewrite(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filewrite (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_s,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_n)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filewrite", 1, 2, 2, 1); __PYX_ERR(4, 10906, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filewrite") < 0)) __PYX_ERR(4, 10906, __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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10906, __pyx_L3_error)
    __pyx_v_s = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filewrite", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10906, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.filewrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_618filewrite(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_s);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_618filewrite(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_s) {
  char *__pyx_v__s;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("filewrite", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":10950
 *             time = 1min, 41,456 ms.
 *         '''
 *         s = to_bytes(s)             # <<<<<<<<<<<<<<
 *         cdef char* _s = <bytes>s
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10951
 *         '''
 *         s = to_bytes(s)
 *         cdef char* _s = <bytes>s             # <<<<<<<<<<<<<<
 *         sig_on()
 *         gp_filewrite(n, _s)
 */
  if (unlikely(__pyx_v_s == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 10951, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_s); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 10951, __pyx_L1_error)
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10952
 *         s = to_bytes(s)
 *         cdef char* _s = <bytes>s
 *         sig_on()             # <<<<<<<<<<<<<<
 *         gp_filewrite(n, _s)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10952, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10953
 *         cdef char* _s = <bytes>s
 *         sig_on()
 *         gp_filewrite(n, _s)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gp_filewrite(__pyx_v_n, __pyx_v__s);

  /* "cypari/auto_instance.pxi":10954
 *         sig_on()
 *         gp_filewrite(n, _s)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def filewrite1(self, long n, s):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":10906
 *         return new_gen(_ret)
 * 
 *     def filewrite(self, long n, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Write the string :math:`s` to the file attached to descriptor :math:`n`, ending with
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.filewrite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10956
 *         clear_stack()
 * 
 *     def filewrite1(self, long n, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Write the string :math:`s` to the file attached to descriptor :math:`n`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_621filewrite1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_620filewrite1[] = "\n        Write the string :math:`s` to the file attached to descriptor :math:`n`.\n        The file must have been opened with :literal:`fileopen` in :literal:`\"w\"` or :literal:`\"a\"`\n        mode.\n        \n        If you want to append a newline at the end of :math:`s`, you can use\n        :literal:`Str(s,\"\\\\n\")` or :literal:`filewrite`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_621filewrite1(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("filewrite1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_s,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_n)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("filewrite1", 1, 2, 2, 1); __PYX_ERR(4, 10956, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "filewrite1") < 0)) __PYX_ERR(4, 10956, __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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 10956, __pyx_L3_error)
    __pyx_v_s = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("filewrite1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10956, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.filewrite1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_620filewrite1(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_s);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_620filewrite1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_s) {
  char *__pyx_v__s;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("filewrite1", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":10965
 *         :literal:`Str(s,"\\n")` or :literal:`filewrite`.
 *         '''
 *         s = to_bytes(s)             # <<<<<<<<<<<<<<
 *         cdef char* _s = <bytes>s
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10966
 *         '''
 *         s = to_bytes(s)
 *         cdef char* _s = <bytes>s             # <<<<<<<<<<<<<<
 *         sig_on()
 *         gp_filewrite1(n, _s)
 */
  if (unlikely(__pyx_v_s == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 10966, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_s); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 10966, __pyx_L1_error)
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_instance.pxi":10967
 *         s = to_bytes(s)
 *         cdef char* _s = <bytes>s
 *         sig_on()             # <<<<<<<<<<<<<<
 *         gp_filewrite1(n, _s)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 10967, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10968
 *         cdef char* _s = <bytes>s
 *         sig_on()
 *         gp_filewrite1(n, _s)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gp_filewrite1(__pyx_v_n, __pyx_v__s);

  /* "cypari/auto_instance.pxi":10969
 *         sig_on()
 *         gp_filewrite1(n, _s)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def floor(self, x):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":10956
 *         clear_stack()
 * 
 *     def filewrite1(self, long n, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Write the string :math:`s` to the file attached to descriptor :math:`n`.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.filewrite1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10971
 *         clear_stack()
 * 
 *     def floor(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Floor of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_623floor(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_622floor[] = "\n        Floor of :math:`x`. When :math:`x` is in :math:`\\mathbb{R}`, the result is the\n        largest integer smaller than or equal to :math:`x`. Applied to a rational function,\n        :math:`floor (x)` returns the Euclidean quotient of the numerator by the\n        denominator.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_623floor(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("floor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_622floor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_622floor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("floor", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":10978
 *         denominator.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":10979
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfloor(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 10979, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":10980
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gfloor(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":10981
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfloor(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gfloor(__pyx_v__x);

  /* "cypari/auto_instance.pxi":10982
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfloor(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fold(self, f, A):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 10982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10971
 *         clear_stack()
 * 
 *     def floor(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Floor of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.floor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":10984
 *         return new_gen(_ret)
 * 
 *     def fold(self, f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` of arity :math:`2` to the entries of :literal:`A`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_625fold(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_624fold[] = "\n        Apply the :literal:`t_CLOSURE` :literal:`f` of arity :math:`2` to the entries of :literal:`A`,\n        in order to return :literal:`f(...f(f(A[1],A[2]),A[3])...,A[\\#A])`.\n        \n        ::\n        \n            ? fold((x,y)->x*y, [1,2,3,4])\n            %1 = 24\n            ? fold((x,y)->[x,y], [1,2,3,4])\n            %2 = [[[1, 2], 3], 4]\n            ? fold((x,f)->f(x), [2,sqr,sqr,sqr])\n            %3 = 256\n            ? fold((x,y)->(x+y)/(1-x*y),[1..5])\n            %4 = -9/19\n            ? bestappr(tan(sum(i=1,5,atan(i))))\n            %5 = -9/19\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_625fold(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fold (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_A,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_f)) != 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_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("fold", 1, 2, 2, 1); __PYX_ERR(4, 10984, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fold") < 0)) __PYX_ERR(4, 10984, __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_f = values[0];
    __pyx_v_A = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fold", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 10984, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_624fold(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_A);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_624fold(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("fold", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":11002
 *             %5 = -9/19
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11003
 *         '''
 *         f = objtogen(f)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11004
 *         f = objtogen(f)
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11004, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11005
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = fold0(_f, _A)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11006
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fold0(_f, _A)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11007
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = fold0(_f, _A)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fold0(__pyx_v__f, __pyx_v__A);

  /* "cypari/auto_instance.pxi":11008
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = fold0(_f, _A)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def frac(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":10984
 *         return new_gen(_ret)
 * 
 *     def fold(self, f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` of arity :math:`2` to the entries of :literal:`A`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11010
 *         return new_gen(_ret)
 * 
 *     def frac(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fractional part of :math:`x`. Identical to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_627frac(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_626frac[] = "\n        Fractional part of :math:`x`. Identical to\n        :math:`x-floor(x)`. If :math:`x` is real, the result is in :math:`[0,1[`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_627frac(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frac (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_626frac(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_626frac(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("frac", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":11015
 *         :math:`x-floor(x)`. If :math:`x` is real, the result is in :math:`[0,1[`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11016
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfrac(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11016, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11017
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gfrac(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11018
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfrac(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gfrac(__pyx_v__x);

  /* "cypari/auto_instance.pxi":11019
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfrac(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fromdigits(self, x, b=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11010
 *         return new_gen(_ret)
 * 
 *     def frac(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fractional part of :math:`x`. Identical to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.frac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11021
 *         return new_gen(_ret)
 * 
 *     def fromdigits(self, x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the integer formed by the elements of :math:`x` seen as the digits of a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_629fromdigits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_628fromdigits[] = "\n        Gives the integer formed by the elements of :math:`x` seen as the digits of a\n        number in base :math:`b` (:math:`b = 10` by default). This is the reverse of :literal:`digits`:\n        \n        ::\n        \n            ? digits(1234,5)\n            %1 = [1,4,4,1,4]\n            ? fromdigits([1,4,4,1,4],5)\n            %2 = 1234\n        \n        By convention, :math:`0` has no digits:\n        \n        ::\n        \n            ? fromdigits([])\n            %3 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_629fromdigits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromdigits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_b,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fromdigits") < 0)) __PYX_ERR(4, 11021, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromdigits", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11021, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fromdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_628fromdigits(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_628fromdigits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b) {
  int __pyx_v__have_b;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("fromdigits", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":11040
 *             %3 = 0
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11041
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_2 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_2;

  /* "cypari/auto_instance.pxi":11042
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":11043
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":11042
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":11044
 *         if _have_b:
 *             b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 11044, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11045
 *             b = objtogen(b)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":11046
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_instance.pxi":11047
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":11048
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fromdigits(_x, _b)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_instance.pxi":11047
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)
 */
  }

  /* "cypari/auto_instance.pxi":11049
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fromdigits(__pyx_v__x, __pyx_v__b);

  /* "cypari/auto_instance.pxi":11050
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoischardet(self, gal, chi, long o=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11021
 *         return new_gen(_ret)
 * 
 *     def fromdigits(self, x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the integer formed by the elements of :math:`x` seen as the digits of a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.fromdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11052
 *         return new_gen(_ret)
 * 
 *     def galoischardet(self, gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_631galoischardet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_630galoischardet[] = "\n        Let :math:`G` be the group attached to the :literal:`galoisinit`\n        structure\302\240:emphasis:`gal`, and\n        let :math:`\\chi` be the character of some representation :math:`\\rho` of the group :math:`G`,\n        where a polynomial variable is to be interpreted as an :math:`o`-th root of 1.\n        For instance, if :literal:`[T,o] = galoischartable(gal)` the characters\n        :math:`\\chi` are input as the columns of :literal:`T`.\n        \n        Return the degree-:math:`1` character :math:`\\det\\rho` as the list of :math:`\\det \\rho (g)`,\n        where :math:`g` runs through representatives of the conjugacy classes\n        in :literal:`galoisconjclasses(gal)`, with the same ordering.\n        \n        ::\n        \n            ? P = x^5 - x^4 - 5*x^3 + 4*x^2 + 3*x - 1;\n            ? polgalois(P)\n            %2 = [10, 1, 1, \"D(5) = 5:2\"]\n            ? K = nfsplitting(P);\n            ? gal = galoisinit(K); \\\\ dihedral of order 10\n            ? [T,o] = galoischartable(gal);\n            ? chi = T[,1]; \\\\ trivial character\n            ? galoischardet(gal, chi, o)\n            %7 = [1, 1, 1, 1]~\n            ? [galoischardet(gal, T[,i], o) | i <- [1..#T]] \\\\ all characters\n            %8 = [[1, 1, 1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_631galoischardet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_o;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoischardet (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_chi,&__pyx_n_s_o,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gal)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("galoischardet", 0, 2, 3, 1); __PYX_ERR(4, 11052, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoischardet") < 0)) __PYX_ERR(4, 11052, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_gal = values[0];
    __pyx_v_chi = values[1];
    if (values[2]) {
      __pyx_v_o = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_o == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11052, __pyx_L3_error)
    } else {
      __pyx_v_o = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoischardet", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11052, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoischardet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_630galoischardet(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_chi, __pyx_v_o);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_630galoischardet(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o) {
  GEN __pyx_v__gal;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoischardet", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":11079
 *             %8 = [[1, 1, 1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~]
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11080
 *         '''
 *         gal = objtogen(gal)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11081
 *         gal = objtogen(gal)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11081, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11082
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11083
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11084
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoischardet(__pyx_v__gal, __pyx_v__chi, __pyx_v_o);

  /* "cypari/auto_instance.pxi":11085
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoischarpoly(self, gal, chi, long o=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11052
 *         return new_gen(_ret)
 * 
 *     def galoischardet(self, gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoischardet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11087
 *         return new_gen(_ret)
 * 
 *     def galoischarpoly(self, gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_633galoischarpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_632galoischarpoly[] = "\n        Let :math:`G` be the group attached to the :literal:`galoisinit`\n        structure\302\240:emphasis:`gal`, and\n        let :math:`\\chi` be the character of some representation :math:`\\rho` of the group\n        :math:`G`, where a polynomial variable is to be interpreted as an :math:`o`-th root of\n        1, e.g., if :literal:`[T,o] = galoischartable(gal)` and :math:`\\chi` is a column of\n        :literal:`T`.\n        Return the list of characteristic polynomials :math:`\\det (1 - \\rho (g)T)`,\n        where :math:`g` runs through representatives of the conjugacy classes\n        in :literal:`galoisconjclasses(gal)`, with the same ordering.\n        \n        ::\n        \n            ? T = x^5 - x^4 - 5*x^3 + 4*x^2 + 3*x - 1;\n            ? polgalois(T)\n            %2 = [10, 1, 1, \"D(5) = 5:2\"]\n            ? K = nfsplitting(T);\n            ? gal = galoisinit(K); \\\\ dihedral of order 10\n            ? [T,o] = galoischartable(gal);\n            ? o\n            %5 = 5\n            ? galoischarpoly(gal, T[,1], o) \\\\ T[,1] is the trivial character\n            %6 = [-x + 1, -x + 1, -x + 1, -x + 1]~\n            ? galoischarpoly(gal, T[,3], o)\n            %7 = [x^2 - 2*x + 1,\n             x^2 + (y^3 + y^2 + 1)*x + 1,\n             -x^2 + 1,\n             x^2 + (-y^3 - y^2)*x + 1]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_633galoischarpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_o;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoischarpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_chi,&__pyx_n_s_o,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gal)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("galoischarpoly", 0, 2, 3, 1); __PYX_ERR(4, 11087, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoischarpoly") < 0)) __PYX_ERR(4, 11087, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_gal = values[0];
    __pyx_v_chi = values[1];
    if (values[2]) {
      __pyx_v_o = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_o == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11087, __pyx_L3_error)
    } else {
      __pyx_v_o = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoischarpoly", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11087, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoischarpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_632galoischarpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_chi, __pyx_v_o);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_632galoischarpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o) {
  GEN __pyx_v__gal;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoischarpoly", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":11117
 *              x^2 + (-y^3 - y^2)*x + 1]~
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11118
 *         '''
 *         gal = objtogen(gal)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11119
 *         gal = objtogen(gal)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11119, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11120
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11121
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11122
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoischarpoly(__pyx_v__gal, __pyx_v__chi, __pyx_v_o);

  /* "cypari/auto_instance.pxi":11123
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoischartable(self, gal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11087
 *         return new_gen(_ret)
 * 
 *     def galoischarpoly(self, gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoischarpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11125
 *         return new_gen(_ret)
 * 
 *     def galoischartable(self, gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the character table of:math:`G`, where:math:`G` is the underlying group of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_635galoischartable(PyObject *__pyx_v_self, PyObject *__pyx_v_gal); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_634galoischartable[] = "\n        Compute the character table of\302\240:math:`G`, where\302\240:math:`G` is the underlying group of\n        the :literal:`galoisinit` structure\302\240:emphasis:`gal`. The input\302\240:emphasis:`gal` is also allowed\n        to be a :literal:`t_VEC` of permutations that is closed under products.\n        Let\302\240:math:`N` be the number of conjugacy classes of\302\240:math:`G`.\n        Return a :literal:`t_VEC`\302\240:math:`[M,e]` where :math:`e >= 1` is an integer\n        and :math:`M` is a square :literal:`t_MAT` of size\302\240:math:`N` giving the character table\n        of\302\240:math:`G`.\n        \n        - Each column corresponds to an irreducible character; the characters\n          are ordered by increasing dimension and the first column is the trivial\n          character (hence contains only :math:`1`'s).\n        \n        - Each row corresponds to a conjugacy class; the conjugacy classes are\n          ordered as specified by :literal:`galoisconjclasses(gal)`, in particular the\n          first row corresponds to the identity and gives the dimension :math:`\\chi (1)`\n          of the irreducible representation attached to the successive characters\n          :math:`\\chi`.\n        \n        The value :math:`M[i,j]` of the character :math:`j` at the conjugacy class :math:`i`\n        is represented by a polynomial in :literal:`y` whose variable should be\n        interpreted as an :math:`e`-th root of unity, i.e. as the lift of\n        \n        ::\n        \n             Mod(y, polcyclo(e,'y))\n        \n        (Note that :math:`M` is the transpose of the usual orientation for\n        character tables.)\n        \n        The integer :math:`e` divides the exponent of the group :math:`G` and is chosen as small\n        as posible; for instance :math:`e = 1` when the characters are all defined over\n        :math:`\\mathbb{Q}`, as is the case for :math:`S_n`. Examples:\n        \n        ::\n        \n            ? K = nfsplitting(""x^4+x+1);\n            ? gal = galoisinit(K);\n            ? [M,e] = galoischartable(gal);\n            ? M~ \\\\ take the transpose to get the usual orientation\n            %4 =\n            [1 1 1 1 1]\n            \n            [1 -1 -1 1 1]\n            \n            [2 0 0 -1 2]\n            \n            [3 -1 1 0 -1]\n            \n            [3 1 -1 0 -1]\n            ? e\n            %5 = 1\n            ? {G = [Vecsmall([1, 2, 3, 4, 5]), Vecsmall([1, 5, 4, 3, 2]),\n             Vecsmall([2, 1, 5, 4, 3]), Vecsmall([2, 3, 4, 5, 1]),\n             Vecsmall([3, 2, 1, 5, 4]), Vecsmall([3, 4, 5, 1, 2]),\n             Vecsmall([4, 3, 2, 1, 5]), Vecsmall([4, 5, 1, 2, 3]),\n             Vecsmall([5, 1, 2, 3, 4]), Vecsmall([5, 4, 3, 2, 1])];}\n             \\\\G = D10\n            ? [M,e] = galoischartable(G);\n            ? M~\n            %8 =\n            [1 1 1 1]\n            \n            [1 -1 1 1]\n            \n            [2 0 -y^3 - y^2 - 1 y^3 + y^2]\n            \n            [2 0 y^3 + y^2 -y^3 - y^2 - 1]\n            ? e\n            %9 = 5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_635galoischartable(PyObject *__pyx_v_self, PyObject *__pyx_v_gal) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoischartable (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_634galoischartable(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_gal));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_634galoischartable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoischartable", 0);
  __Pyx_INCREF(__pyx_v_gal);

  /* "cypari/auto_instance.pxi":11197
 *             %9 = 5
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11198
 *         '''
 *         gal = objtogen(gal)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoischartable(_gal)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11198, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11199
 *         gal = objtogen(gal)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoischartable(_gal)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11200
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoischartable(_gal)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoischartable(__pyx_v__gal);

  /* "cypari/auto_instance.pxi":11201
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoischartable(_gal)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisconjclasses(self, gal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11125
 *         return new_gen(_ret)
 * 
 *     def galoischartable(self, gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the character table of:math:`G`, where:math:`G` is the underlying group of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoischartable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11203
 *         return new_gen(_ret)
 * 
 *     def galoisconjclasses(self, gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being output by :literal:`galoisinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_637galoisconjclasses(PyObject *__pyx_v_self, PyObject *__pyx_v_gal); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_636galoisconjclasses[] = "\n        :emphasis:`gal` being output by :literal:`galoisinit`,\n        return the list of conjugacy classes of the underlying group.\n        The ordering of the classes is consistent with :literal:`galoischartable`\n        and the trivial class comes first.\n        \n        ::\n        \n            ? G = galoisinit(x^6+108);\n            ? galoisidentify(G)\n            %2 = [6, 1] \\\\ S_3\n            ? S = galoisconjclasses(G)\n            %3 = [[Vecsmall([1,2,3,4,5,6])],\n             [Vecsmall([3,1,2,6,4,5]),Vecsmall([2,3,1,5,6,4])],\n             [Vecsmall([6,5,4,3,2,1]),Vecsmall([5,4,6,2,1,3]),\n             Vecsmall([4,6,5,1,3,2])]]\n            ? [[permorder(c[1]),#c] | c <- S ]\n            %4 = [[1,1], [3,2], [2,3]]\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`:\n        \n        ::\n        \n            ? subs = galoissubgroups(G); H = subs[5];\n            ? galoisidentify(H)\n            %2 = [2, 1] \\\\ Z/2\n            ? S = galoisconjclasses(subgroups_of_G[5]);\n            ? [[permorder(c[1]),#c] | c <- S ]\n            %4 = [[1,1], [2,1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_637galoisconjclasses(PyObject *__pyx_v_self, PyObject *__pyx_v_gal) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisconjclasses (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_636galoisconjclasses(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_gal));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_636galoisconjclasses(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoisconjclasses", 0);
  __Pyx_INCREF(__pyx_v_gal);

  /* "cypari/auto_instance.pxi":11234
 *             %4 = [[1,1], [2,1]]
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11235
 *         '''
 *         gal = objtogen(gal)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisconjclasses(_gal)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11235, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11236
 *         gal = objtogen(gal)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisconjclasses(_gal)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11237
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisconjclasses(_gal)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisconjclasses(__pyx_v__gal);

  /* "cypari/auto_instance.pxi":11238
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisconjclasses(_gal)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisexport(self, gal, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11203
 *         return new_gen(_ret)
 * 
 *     def galoisconjclasses(self, gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being output by :literal:`galoisinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisconjclasses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11240
 *         return new_gen(_ret)
 * 
 *     def galoisexport(self, gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_639galoisexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_638galoisexport[] = "\n        :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,\n        export the underlying permutation group as a string suitable\n        for (no flags or :math:`flag = 0`) GAP or (:math:`flag = 1`) Magma. The following example\n        compute the index of the underlying abstract group in the GAP library:\n        \n        ::\n        \n            ? G = galoisinit(x^6+108);\n            ? s = galoisexport(G)\n            %2 = \"Group((1, 2, 3)(4, 5, 6), (1, 4)(2, 6)(3, 5))\"\n            ? extern(\"echo \\\"IdGroup(\"s\");\\\" | gap -q\")\n            %3 = [6, 1]\n            ? galoisidentify(G)\n            %4 = [6, 1]\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        \n        To :emphasis:`import` a GAP permutation into gp (for :literal:`galoissubfields` for\n        instance), the following GAP function may be useful:\n        \n        ::\n        \n            PermToGP := function(p, n)\n             return Permuted([1..n],p);\n            end;\n            \n            gap> p:= (1,26)(2,5)(3,17)(4,32)(6,9)(7,11)(8,24)(10,13)(12,15)(14,27)\n             (16,22)(18,28)(19,20)(21,29)(23,31)(25,30)\n            gap> PermToGP(p,32);\n            [ 26, 5, 17, 32, 2, 9, 11, 24, 6, 13, 7, 15, 10, 27, 12, 22, 3, 28, 20, 19,\n             29, 16, 31, 8, 30, 1, 14, 18, 21, 25, 23, 4 ]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_639galoisexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_flag,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_gal)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisexport") < 0)) __PYX_ERR(4, 11240, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gal = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11240, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisexport", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11240, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_638galoisexport(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_638galoisexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, long __pyx_v_flag) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoisexport", 0);
  __Pyx_INCREF(__pyx_v_gal);

  /* "cypari/auto_instance.pxi":11274
 *              29, 16, 31, 8, 30, 1, 14, 18, 21, 25, 23, 4 ]
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11275
 *         '''
 *         gal = objtogen(gal)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisexport(_gal, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11275, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11276
 *         gal = objtogen(gal)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisexport(_gal, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11277
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisexport(_gal, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisexport(__pyx_v__gal, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":11278
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisexport(_gal, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisfixedfield(self, gal, perm, long flag=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11240
 *         return new_gen(_ret)
 * 
 *     def galoisexport(self, gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11280
 *         return new_gen(_ret)
 * 
 *     def galoisfixedfield(self, gal, perm, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_641galoisfixedfield(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_640galoisfixedfield[] = "\n        :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit` and\n        :emphasis:`perm` an element of :math:`gal.group`, a vector of such elements\n        or a subgroup of :emphasis:`gal` as returned by galoissubgroups,\n        computes the fixed field of :emphasis:`gal` by the automorphism defined by the\n        permutations :emphasis:`perm` of the roots :math:`gal.roots`. :math:`P` is guaranteed to\n        be squarefree modulo :math:`gal.p`.\n        \n        If no flags or :math:`flag = 0`, output format is the same as for :literal:`nfsubfield`,\n        returning :math:`[P,x]` such that :math:`P` is a polynomial defining the fixed field, and\n        :math:`x` is a root of :math:`P` expressed as a polmod in :math:`gal.pol`.\n        \n        If :math:`flag = 1` return only the polynomial :math:`P`.\n        \n        If :math:`flag = 2` return :math:`[P,x,F]` where :math:`P` and :math:`x` are as above and :math:`F` is the\n        factorization of :math:`gal.pol` over the field defined by :math:`P`, where\n        variable :math:`v` (:math:`y` by default) stands for a root of :math:`P`. The priority of :math:`v`\n        must be less than the priority of the variable of :math:`gal.pol` (see\n        ``priority`` (in the PARI manual)).\n        In this case, :math:`P` is also expressed in the variable :math:`v` for compatibility\n        with :math:`F`. Example:\n        \n        ::\n        \n            ? G = galoisinit(x^4+1);\n            ? galoisfixedfield(G,G.group[2],2)\n            %2 = [y^2 - 2, Mod(- x^3 + x, x^4 + 1), [x^2 - y*x + 1, x^2 + y*x + 1]]\n        \n        computes the factorization :math:`x^4+1 = (x^2-\\sqrt{2}x+1)(x^2+\\sqrt{2}x+1)`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_641galoisfixedfield(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_perm = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisfixedfield (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_perm,&__pyx_n_s_flag,&__pyx_n_s_v,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_gal)) != 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_perm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("galoisfixedfield", 0, 2, 4, 1); __PYX_ERR(4, 11280, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_v);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisfixedfield") < 0)) __PYX_ERR(4, 11280, __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);
        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_gal = values[0];
    __pyx_v_perm = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11280, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_v = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisfixedfield", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11280, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisfixedfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_640galoisfixedfield(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_perm, __pyx_v_flag, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_640galoisfixedfield(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_perm, long __pyx_v_flag, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__gal;
  GEN __pyx_v__perm;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("galoisfixedfield", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_perm);

  /* "cypari/auto_instance.pxi":11311
 *         computes the factorization :math:`x^4+1 = (x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)`
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         perm = objtogen(perm)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11312
 *         '''
 *         gal = objtogen(gal)
 *         perm = objtogen(perm)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_perm, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_perm, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11313
 *         gal = objtogen(gal)
 *         perm = objtogen(perm)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":11314
 *         perm = objtogen(perm)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":11315
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 11315, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":11314
 *         perm = objtogen(perm)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":11316
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 11316, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11317
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_6;

  /* "cypari/auto_instance.pxi":11318
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_perm)->__pyx_base.g;
  __pyx_v__perm = __pyx_t_6;

  /* "cypari/auto_instance.pxi":11319
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisfixedfield(__pyx_v__gal, __pyx_v__perm, __pyx_v_flag, __pyx_v__v);

  /* "cypari/auto_instance.pxi":11320
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisgetgroup(self, long a, long b=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11280
 *         return new_gen(_ret)
 * 
 *     def galoisfixedfield(self, gal, perm, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisfixedfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_perm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11322
 *         return new_gen(_ret)
 * 
 *     def galoisgetgroup(self, long a, long b=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Query the :literal:`galpol` package for a group of order :math:`a` with index :math:`b`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_643galoisgetgroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_642galoisgetgroup[] = "\n        Query the :literal:`galpol` package for a group of order :math:`a` with index :math:`b`\n        in the GAP4 Small Group library, by Hans Ulrich Besche, Bettina Eick and\n        Eamonn O'Brien.\n        \n        The current version of :literal:`galpol` supports groups of order :math:`a <= 143`.\n        If :math:`b` is omitted, return the number of isomorphism classes of\n        groups of order :math:`a`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_643galoisgetgroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_a;
  long __pyx_v_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisgetgroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisgetgroup") < 0)) __PYX_ERR(4, 11322, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_a = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11322, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_b = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_b == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11322, __pyx_L3_error)
    } else {
      __pyx_v_b = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisgetgroup", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11322, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisgetgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_642galoisgetgroup(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_642galoisgetgroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_a, long __pyx_v_b) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("galoisgetgroup", 0);

  /* "cypari/auto_instance.pxi":11332
 *         groups of order :math:`a`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisgetgroup(a, b)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 11332, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11333
 *         '''
 *         sig_on()
 *         cdef GEN _ret = galoisgetgroup(a, b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisgetgroup(__pyx_v_a, __pyx_v_b);

  /* "cypari/auto_instance.pxi":11334
 *         sig_on()
 *         cdef GEN _ret = galoisgetgroup(a, b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisgetname(self, long a, long b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 11334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11322
 *         return new_gen(_ret)
 * 
 *     def galoisgetgroup(self, long a, long b=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Query the :literal:`galpol` package for a group of order :math:`a` with index :math:`b`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisgetgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11336
 *         return new_gen(_ret)
 * 
 *     def galoisgetname(self, long a, long b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Query the :literal:`galpol` package for a string describing the group of order
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_645galoisgetname(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_644galoisgetname[] = "\n        Query the :literal:`galpol` package for a string describing the group of order\n        :math:`a`\n        with index :math:`b` in the GAP4 Small Group library, by Hans Ulrich Besche,\n        Bettina Eick and Eamonn O'Brien.\n        The strings were generated using the GAP4 function :literal:`StructureDescription`.\n        It is possible for different groups to have the same name.\n        The command below outputs the names of all abstract groups of order 12:\n        \n        ::\n        \n            ? N = galoisgetgroup(12); \\\\ # of abstract groups of order 12\n            ? for(i=1, N, print(i,\". \",galoisgetname(12,i)))\n            1. C3 : C4\n            2. C12\n            3. A4\n            4. D12\n            5. C6 x C2\n        \n        The current version of :literal:`galpol` supports groups of order :math:`a <= 143`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_645galoisgetname(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_a;
  long __pyx_v_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisgetname (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("galoisgetname", 1, 2, 2, 1); __PYX_ERR(4, 11336, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisgetname") < 0)) __PYX_ERR(4, 11336, __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_a = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11336, __pyx_L3_error)
    __pyx_v_b = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_b == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11336, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisgetname", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11336, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisgetname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_644galoisgetname(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_644galoisgetname(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_a, long __pyx_v_b) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("galoisgetname", 0);

  /* "cypari/auto_instance.pxi":11358
 *         The current version of :literal:`galpol` supports groups of order :math:`a <= 143`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisgetname(a, b)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 11358, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11359
 *         '''
 *         sig_on()
 *         cdef GEN _ret = galoisgetname(a, b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisgetname(__pyx_v_a, __pyx_v_b);

  /* "cypari/auto_instance.pxi":11360
 *         sig_on()
 *         cdef GEN _ret = galoisgetname(a, b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisgetpol(self, long a, long b=0, long s=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 11360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11336
 *         return new_gen(_ret)
 * 
 *     def galoisgetname(self, long a, long b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Query the :literal:`galpol` package for a string describing the group of order
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisgetname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11362
 *         return new_gen(_ret)
 * 
 *     def galoisgetpol(self, long a, long b=0, long s=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Query the :literal:`galpol` package for a polynomial with Galois group
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_647galoisgetpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_646galoisgetpol[] = "\n        Query the :literal:`galpol` package for a polynomial with Galois group\n        isomorphic to\n        GAP4(a,b), totally real if :math:`s = 1` (default) and totally complex if :math:`s = 2`.\n        The current version of :literal:`galpol` supports groups of order :math:`a <= 143`.\n        The output is a vector [:literal:`pol`, :literal:`den`] where\n        \n        - :literal:`pol` is the polynomial of degree :math:`a`\n        \n        - :literal:`den` is the denominator of :literal:`nfgaloisconj(pol)`.\n          Pass it as an optional argument to :literal:`galoisinit` or :literal:`nfgaloisconj` to\n          speed them up:\n        \n        ::\n        \n            ? [pol,den] = galoisgetpol(64,4,1);\n            ? G = galoisinit(pol);\n            time = 352ms\n            ? galoisinit(pol, den); \\\\ passing 'den' speeds up the computation\n            time = 264ms\n            ? % == %`\n            %4 = 1 \\\\ same answer\n        \n        If :math:`b` and :math:`s` are omitted, return the number of isomorphism classes of\n        groups of order :math:`a`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_647galoisgetpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_a;
  long __pyx_v_b;
  long __pyx_v_s;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisgetpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_s,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisgetpol") < 0)) __PYX_ERR(4, 11362, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_a = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11362, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_b = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_b == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11362, __pyx_L3_error)
    } else {
      __pyx_v_b = ((long)0);
    }
    if (values[2]) {
      __pyx_v_s = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11362, __pyx_L3_error)
    } else {
      __pyx_v_s = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisgetpol", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11362, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisgetpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_646galoisgetpol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b, __pyx_v_s);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_646galoisgetpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_a, long __pyx_v_b, long __pyx_v_s) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("galoisgetpol", 0);

  /* "cypari/auto_instance.pxi":11389
 *         groups of order :math:`a`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisgetpol(a, b, s)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 11389, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11390
 *         '''
 *         sig_on()
 *         cdef GEN _ret = galoisgetpol(a, b, s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisgetpol(__pyx_v_a, __pyx_v_b, __pyx_v_s);

  /* "cypari/auto_instance.pxi":11391
 *         sig_on()
 *         cdef GEN _ret = galoisgetpol(a, b, s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisidentify(self, gal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 11391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11362
 *         return new_gen(_ret)
 * 
 *     def galoisgetpol(self, long a, long b=0, long s=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Query the :literal:`galpol` package for a polynomial with Galois group
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisgetpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11393
 *         return new_gen(_ret)
 * 
 *     def galoisidentify(self, gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_649galoisidentify(PyObject *__pyx_v_self, PyObject *__pyx_v_gal); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_648galoisidentify[] = "\n        :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,\n        output the isomorphism class of the underlying abstract group as a\n        two-components vector :math:`[o,i]`, where :math:`o` is the group order, and :math:`i` is the\n        group index in the GAP4 Small Group library, by Hans Ulrich Besche, Bettina\n        Eick and Eamonn O'Brien.\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        \n        The current implementation is limited to degree less or equal to :math:`127`.\n        Some larger \"easy\" orders are also supported.\n        \n        The output is similar to the output of the function :literal:`IdGroup` in GAP4.\n        Note that GAP4 :literal:`IdGroup` handles all groups of order less than :math:`2000`\n        except :math:`1024`, so you can use :literal:`galoisexport` and GAP4 to identify large\n        Galois groups.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_649galoisidentify(PyObject *__pyx_v_self, PyObject *__pyx_v_gal) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisidentify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_648galoisidentify(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_gal));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_648galoisidentify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoisidentify", 0);
  __Pyx_INCREF(__pyx_v_gal);

  /* "cypari/auto_instance.pxi":11411
 *         Galois groups.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11412
 *         '''
 *         gal = objtogen(gal)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisidentify(_gal)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11412, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11413
 *         gal = objtogen(gal)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisidentify(_gal)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11414
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisidentify(_gal)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisidentify(__pyx_v__gal);

  /* "cypari/auto_instance.pxi":11415
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisidentify(_gal)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisinit(self, pol, den=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11393
 *         return new_gen(_ret)
 * 
 *     def galoisidentify(self, gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisidentify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11417
 *         return new_gen(_ret)
 * 
 *     def galoisinit(self, pol, den=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Galois group
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_651galoisinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_650galoisinit[] = "\n        Computes the Galois group\n        and all necessary information for computing the fixed fields of the\n        Galois extension :math:`K/\\mathbb{Q}` where :math:`K` is the number field defined by\n        :math:`pol` (monic irreducible polynomial in :math:`\\mathbb{Z}[X]` or\n        a number field as output by :literal:`nfinit`). The extension :math:`K/\\mathbb{Q}` must be\n        Galois with Galois group \"weakly\" super-solvable, see below;\n        returns 0 otherwise. Hence this permits to quickly check whether a polynomial\n        of order strictly less than :math:`36` is Galois or not.\n        \n        The algorithm used is an improved version of the paper\n        \"An efficient algorithm for the computation of Galois automorphisms\",\n        Bill Allombert, Math.\302\240Comp, vol.\302\24073, 245, 2001, pp.\302\240359--375.\n        \n        A group :math:`G` is said to be \"weakly\" super-solvable if there exists a\n        normal series\n        \n        :math:`{1} = H_0 \\triangleleft H_1 \\triangleleft...\\triangleleft H_{n-1}\n        \\triangleleft H_n`\n        \n        such that each :math:`H_i` is normal in :math:`G` and for :math:`i < n`, each quotient group\n        :math:`H_{i+1}/H_i` is cyclic, and either :math:`H_n = G` (then :math:`G` is super-solvable) or\n        :math:`G/H_n` is isomorphic to either :math:`A_4` or :math:`S_4`.\n        \n        In practice, almost all small groups are WKSS, the exceptions having order\n        36(1 exception), 48(2), 56(1), 60(1), 72(5), 75(1), 80(1), 96(10) and :math:`\\geq\n        108`.\n        \n        This function is a prerequisite for most of the :literal:`galois`:math:`xxx` routines.\n        For instance:\n        \n        ::\n        \n            P = x^6 + 108;\n            G = galoisinit(P);\n            L = galoissubgroups(G);\n            vector(#L, i, galoisisabelian(L[i],1))\n            vector(#L, i, galoisidentify(L[i]))\n        \n        The output is an 8-compone""nt vector :emphasis:`gal`.\n        \n        :math:`gal[1]` contains the polynomial :emphasis:`pol`\n        (:literal:`:emphasis:`gal`.pol`).\n        \n        :math:`gal[2]` is a three-components vector :math:`[p,e,q]` where :math:`p` is a\n        prime number (:literal:`:emphasis:`gal`.p`) such that :emphasis:`pol` totally split\n        modulo :math:`p` , :math:`e` is an integer and :math:`q = p^e` (:literal:`:emphasis:`gal`.mod`) is the\n        modulus of the roots in :literal:`:emphasis:`gal`.roots`.\n        \n        :math:`gal[3]` is a vector :math:`L` containing the :math:`p`-adic roots of\n        :emphasis:`pol` as integers implicitly modulo :literal:`:emphasis:`gal`.mod`.\n        (:literal:`:emphasis:`gal`.roots`).\n        \n        :math:`gal[4]` is the inverse of the Vandermonde matrix of the\n        :math:`p`-adic roots of :emphasis:`pol`, multiplied by :math:`gal[5]`.\n        \n        :math:`gal[5]` is a multiple of the least common denominator of the\n        automorphisms expressed as polynomial in a root of :emphasis:`pol`.\n        \n        :math:`gal[6]` is the Galois group :math:`G` expressed as a vector of\n        permutations of :math:`L` (:literal:`:emphasis:`gal`.group`).\n        \n        :math:`gal[7]` is a generating subset :math:`S = [s_1,...,s_g]` of :math:`G`\n        expressed as a vector of permutations of :math:`L` (:literal:`:emphasis:`gal`.gen`).\n        \n        :math:`gal[8]` contains the relative orders :math:`[o_1,...,o_g]` of\n        the generators of :math:`S` (:literal:`:emphasis:`gal`.orders`).\n        \n        Let :math:`H_n` be as above, we have the following properties:\n        \n        \302\240\302\240:strong:`*` if :math:`G/H_n ~ A_4` then :math:`[o_1,...,o_g]` ends by\n        :math:`[2,2,3]`.\n        \n        \302\240\302\240:strong:`*` if :math:`G/H_n ~ S_4` then :math:`[o_1,...,o_g]` ends by\n        :math:`[2,2,3,2]`.\n        \n        \302\240\302\240:strong:`*` for :math:`1 <= i <= g` th""e subgroup of :math:`G` generated by\n        :math:`[s_1,...,s_i]` is normal, with the exception of :math:`i = g-2` in the\n        :math:`A_4` case and of :math:`i = g-3` in the :math:`S_4` case.\n        \n        \302\240\302\240:strong:`*` the relative order :math:`o_i` of :math:`s_i` is its order in the\n        quotient group :math:`G/<\302\240s_1,...,s_{i-1}>`, with the same\n        exceptions.\n        \n        \302\240\302\240:strong:`*` for any :math:`x\\in G` there exists a unique family\n        :math:`[e_1,...,e_g]` such that (no exceptions):\n        \n        -- for :math:`1 <= i <= g` we have :math:`0 <= e_i < o_i`\n        \n        -- :math:`x = g_1^{e_1}g_2^{e_2}...g_n^{e_n}`\n        \n        If present :math:`den` must be a suitable value for :math:`gal[5]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_651galoisinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_den = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_den,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_den);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisinit") < 0)) __PYX_ERR(4, 11417, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    __pyx_v_den = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11417, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_650galoisinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_pol, __pyx_v_den);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_650galoisinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_den) {
  int __pyx_v__have_den;
  GEN __pyx_v__pol;
  GEN __pyx_v__den;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("galoisinit", 0);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_den);

  /* "cypari/auto_instance.pxi":11511
 *         If present :math:`den` must be a suitable value for :math:`gal[5]`.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         cdef bint _have_den = (den is not None)
 *         if _have_den:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11512
 *         '''
 *         pol = objtogen(pol)
 *         cdef bint _have_den = (den is not None)             # <<<<<<<<<<<<<<
 *         if _have_den:
 *             den = objtogen(den)
 */
  __pyx_t_2 = (__pyx_v_den != Py_None);
  __pyx_v__have_den = __pyx_t_2;

  /* "cypari/auto_instance.pxi":11513
 *         pol = objtogen(pol)
 *         cdef bint _have_den = (den is not None)
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             den = objtogen(den)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_den != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":11514
 *         cdef bint _have_den = (den is not None)
 *         if _have_den:
 *             den = objtogen(den)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_den, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11514, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_den, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":11513
 *         pol = objtogen(pol)
 *         cdef bint _have_den = (den is not None)
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             den = objtogen(den)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":11515
 *         if _have_den:
 *             den = objtogen(den)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 11515, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11516
 *             den = objtogen(den)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _den = NULL
 *         if _have_den:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_4;

  /* "cypari/auto_instance.pxi":11517
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL             # <<<<<<<<<<<<<<
 *         if _have_den:
 *             _den = (<Gen>den).g
 */
  __pyx_v__den = NULL;

  /* "cypari/auto_instance.pxi":11518
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)
 */
  __pyx_t_2 = (__pyx_v__have_den != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":11519
 *         cdef GEN _den = NULL
 *         if _have_den:
 *             _den = (<Gen>den).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisinit(_pol, _den)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_den)->__pyx_base.g;
    __pyx_v__den = __pyx_t_4;

    /* "cypari/auto_instance.pxi":11518
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)
 */
  }

  /* "cypari/auto_instance.pxi":11520
 *         if _have_den:
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisinit(__pyx_v__pol, __pyx_v__den);

  /* "cypari/auto_instance.pxi":11521
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisisabelian(self, gal, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11417
 *         return new_gen(_ret)
 * 
 *     def galoisinit(self, pol, den=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Galois group
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_den);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11523
 *         return new_gen(_ret)
 * 
 *     def galoisisabelian(self, gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, return :math:`0` if
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_653galoisisabelian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_652galoisisabelian[] = "\n        :emphasis:`gal` being as output by :literal:`galoisinit`, return :math:`0` if\n        :emphasis:`gal` is not an abelian group, and the HNF matrix of :emphasis:`gal` over\n        :literal:`gal.gen` if :math:`flag = 0`, :math:`1` if :math:`flag = 1`, and the SNF matrix of :emphasis:`gal`\n        if :math:`flag = 2`.\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_653galoisisabelian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisisabelian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_flag,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_gal)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisisabelian") < 0)) __PYX_ERR(4, 11523, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gal = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11523, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisisabelian", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11523, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisisabelian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_652galoisisabelian(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_652galoisisabelian(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, long __pyx_v_flag) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoisisabelian", 0);
  __Pyx_INCREF(__pyx_v_gal);

  /* "cypari/auto_instance.pxi":11532
 *         This command also accepts subgroups returned by :literal:`galoissubgroups`.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11533
 *         '''
 *         gal = objtogen(gal)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisisabelian(_gal, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11533, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11534
 *         gal = objtogen(gal)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisisabelian(_gal, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11535
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisisabelian(_gal, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisisabelian(__pyx_v__gal, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":11536
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisisabelian(_gal, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisisnormal(self, gal, subgrp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11523
 *         return new_gen(_ret)
 * 
 *     def galoisisabelian(self, gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, return :math:`0` if
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisisabelian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11538
 *         return new_gen(_ret)
 * 
 *     def galoisisnormal(self, gal, subgrp):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, and :emphasis:`subgrp` a subgroup
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_655galoisisnormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_654galoisisnormal[] = "\n        :emphasis:`gal` being as output by :literal:`galoisinit`, and :emphasis:`subgrp` a subgroup\n        of :emphasis:`gal` as output by :literal:`galoissubgroups`,return :math:`1` if :emphasis:`subgrp` is a\n        normal subgroup of :emphasis:`gal`, else return 0.\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_655galoisisnormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_subgrp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisisnormal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_subgrp,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_gal)) != 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_subgrp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("galoisisnormal", 1, 2, 2, 1); __PYX_ERR(4, 11538, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisisnormal") < 0)) __PYX_ERR(4, 11538, __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_gal = values[0];
    __pyx_v_subgrp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisisnormal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11538, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisisnormal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_654galoisisnormal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_subgrp);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_654galoisisnormal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_subgrp) {
  GEN __pyx_v__gal;
  GEN __pyx_v__subgrp;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoisisnormal", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_subgrp);

  /* "cypari/auto_instance.pxi":11546
 *         This command also accepts subgroups returned by :literal:`galoissubgroups`.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         subgrp = objtogen(subgrp)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11547
 *         '''
 *         gal = objtogen(gal)
 *         subgrp = objtogen(subgrp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_subgrp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_subgrp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11548
 *         gal = objtogen(gal)
 *         subgrp = objtogen(subgrp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11548, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11549
 *         subgrp = objtogen(subgrp)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11550
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _subgrp = (<Gen>subgrp).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_subgrp)->__pyx_base.g;
  __pyx_v__subgrp = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11551
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = galoisisnormal(__pyx_v__gal, __pyx_v__subgrp);

  /* "cypari/auto_instance.pxi":11552
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":11553
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def galoispermtopol(self, gal, perm):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11538
 *         return new_gen(_ret)
 * 
 *     def galoisisnormal(self, gal, subgrp):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, and :emphasis:`subgrp` a subgroup
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoisisnormal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_subgrp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11555
 *         return _ret
 * 
 *     def galoispermtopol(self, gal, perm):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_657galoispermtopol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_656galoispermtopol[] = "\n        :emphasis:`gal` being a\n        Galois group as output by :literal:`galoisinit` and :emphasis:`perm` a element of\n        :math:`gal.group`, return the polynomial defining the Galois\n        automorphism, as output by :literal:`nfgaloisconj`, attached to the\n        permutation :emphasis:`perm` of the roots :math:`gal.roots`. :emphasis:`perm` can\n        also be a vector or matrix, in this case, :literal:`galoispermtopol` is\n        applied to all components recursively.\n        \n        Note that\n        \n        ::\n        \n            G = galoisinit(pol);\n            galoispermtopol(G, G[6])~\n        \n        is equivalent to :literal:`nfgaloisconj(pol)`, if degree of :emphasis:`pol` is greater\n        or equal to :math:`2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_657galoispermtopol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_perm = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoispermtopol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_perm,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_gal)) != 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_perm)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("galoispermtopol", 1, 2, 2, 1); __PYX_ERR(4, 11555, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoispermtopol") < 0)) __PYX_ERR(4, 11555, __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_gal = values[0];
    __pyx_v_perm = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoispermtopol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoispermtopol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_656galoispermtopol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_gal, __pyx_v_perm);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_656galoispermtopol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_gal, PyObject *__pyx_v_perm) {
  GEN __pyx_v__gal;
  GEN __pyx_v__perm;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoispermtopol", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_perm);

  /* "cypari/auto_instance.pxi":11575
 *         or equal to :math:`2`.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         perm = objtogen(perm)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11576
 *         '''
 *         gal = objtogen(gal)
 *         perm = objtogen(perm)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_perm, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_perm, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11577
 *         gal = objtogen(gal)
 *         perm = objtogen(perm)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11577, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11578
 *         perm = objtogen(perm)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11579
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_perm)->__pyx_base.g;
  __pyx_v__perm = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11580
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoispermtopol(__pyx_v__gal, __pyx_v__perm);

  /* "cypari/auto_instance.pxi":11581
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoissubcyclo(self, N, H=None, long fl=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11555
 *         return _ret
 * 
 *     def galoispermtopol(self, gal, perm):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoispermtopol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_perm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11583
 *         return new_gen(_ret)
 * 
 *     def galoissubcyclo(self, N, H=None, long fl=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the subextension of :math:`\mathbb{Q} (\zeta_n)` fixed by the subgroup
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_659galoissubcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_658galoissubcyclo[] = "\n        Computes the subextension of :math:`\\mathbb{Q} (\\zeta_n)` fixed by the subgroup\n        :math:`H \\subset (\\mathbb{Z}/n\\mathbb{Z})^*`. By the Kronecker-Weber theorem, all abelian number\n        fields can be generated in this way (uniquely if :math:`n` is taken to be minimal).\n        \n        The pair :math:`(n, H)` is deduced from the parameters :math:`(N, H)` as follows\n        \n        - :math:`N` an integer: then :math:`n = N`; :math:`H` is a generator, i.e. an\n          integer or an integer modulo :math:`n`; or a vector of generators.\n        \n        - :math:`N` the output of :literal:`znstar`:math:`(n)` or :literal:`znstar`:math:`(n,1)`.\n          :math:`H` as in the first case above, or a matrix, taken to be a HNF left divisor\n          of the SNF for :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`\n          (:literal:`:math:`N`.cyc`), giving the generators of :math:`H` in terms of :literal:`:math:`N`.gen`.\n        \n        - :math:`N` the output of :literal:`bnrinit(bnfinit(y), :math:`m`)` where :math:`m` is a\n          module. :math:`H` as in the first case, or a matrix taken to be a HNF left\n          divisor of the SNF for the ray class group modulo :math:`m`\n          (of type :literal:`:math:`N`.cyc`), giving the generators of :math:`H` in terms of\n          :literal:`:math:`N`.bid.gen` ( = :literal:`:math:`N``.gen if :math:`N` includes generators).\n        \n        In this last case, beware that :math:`H` is understood relatively to :math:`N`; in\n        particular, if the infinite place does not divide the module, e.g if :math:`m` is\n        an integer, then it is not a subgroup of :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`, but of its quotient by\n        :math:`{\302\261 1}`.\n        \n        If :math:`fl = 0`, compute a polynomial (in the variable :emphasis:`v`) defining\n        the subfield of :math:`\\mathbb{Q} (\\zeta_n)` fixed by the subgroup :emphasis:`H` of :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`.\n        \n        If :""math:`fl = 1`, compute only the conductor of the abelian extension, as a module.\n        \n        If :math:`fl = 2`, output :math:`[pol, N]`, where :math:`pol` is the polynomial as output when\n        :math:`fl = 0` and :math:`N` the conductor as output when :math:`fl = 1`.\n        \n        The following function can be used to compute all subfields of\n        :math:`\\mathbb{Q} (\\zeta_n)` (of exact degree :literal:`d`, if :literal:`d` is set):\n        \n        ::\n        \n            subcyclo(n, d = -1)=\n            { my(bnr,L,IndexBound);\n             IndexBound = if (d < 0, n, [d]);\n             bnr = bnrinit(bnfinit(y), [n,[1]]);\n             L = subgrouplist(bnr, IndexBound, 1);\n             vector(#L,i, galoissubcyclo(bnr,L[i]));\n            }\n        \n        Setting :literal:`L = subgrouplist(bnr, IndexBound)` would produce subfields of\n        exact conductor :math:`n oo`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_659galoissubcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_H = 0;
  long __pyx_v_fl;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoissubcyclo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_H,&__pyx_n_s_fl,&__pyx_n_s_v,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    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_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          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_v);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoissubcyclo") < 0)) __PYX_ERR(4, 11583, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
    __pyx_v_H = values[1];
    if (values[2]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11583, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)0);
    }
    __pyx_v_v = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoissubcyclo", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11583, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoissubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_658galoissubcyclo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N, __pyx_v_H, __pyx_v_fl, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_658galoissubcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_H, long __pyx_v_fl, PyObject *__pyx_v_v) {
  int __pyx_v__have_H;
  long __pyx_v__v;
  GEN __pyx_v__N;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("galoissubcyclo", 0);
  __Pyx_INCREF(__pyx_v_N);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":11634
 *         exact conductor :math:`n oo`.
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11635
 *         '''
 *         N = objtogen(N)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":11636
 *         N = objtogen(N)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         cdef long _v = -1
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":11637
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":11636
 *         N = objtogen(N)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         cdef long _v = -1
 */
  }

  /* "cypari/auto_instance.pxi":11638
 *         if _have_H:
 *             H = objtogen(H)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":11639
 *             H = objtogen(H)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":11640
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 11640, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":11639
 *             H = objtogen(H)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":11641
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 11641, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11642
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_6;

  /* "cypari/auto_instance.pxi":11643
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":11644
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 */
  __pyx_t_3 = (__pyx_v__have_H != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":11645
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_6;

    /* "cypari/auto_instance.pxi":11644
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 */
  }

  /* "cypari/auto_instance.pxi":11646
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoissubcyclo(__pyx_v__N, __pyx_v__H, __pyx_v_fl, __pyx_v__v);

  /* "cypari/auto_instance.pxi":11647
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoissubfields(self, G, long flag=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11583
 *         return new_gen(_ret)
 * 
 *     def galoissubcyclo(self, N, H=None, long fl=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the subextension of :math:`\mathbb{Q} (\zeta_n)` fixed by the subgroup
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoissubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11649
 *         return new_gen(_ret)
 * 
 *     def galoissubfields(self, G, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subfields of the Galois group :emphasis:`G`, as a vector.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_661galoissubfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_660galoissubfields[] = "\n        Outputs all the subfields of the Galois group :emphasis:`G`, as a vector.\n        This works by applying :literal:`galoisfixedfield` to all subgroups. The meaning of\n        :emphasis:`flag` is the same as for :literal:`galoisfixedfield`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_661galoissubfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoissubfields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_flag,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_G)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoissubfields") < 0)) __PYX_ERR(4, 11649, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_G = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11649, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoissubfields", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11649, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoissubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_660galoissubfields(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_flag, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_660galoissubfields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, long __pyx_v_flag, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("galoissubfields", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":11655
 *         :emphasis:`flag` is the same as for :literal:`galoisfixedfield`.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11656
 *         '''
 *         G = objtogen(G)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":11657
 *         G = objtogen(G)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":11658
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 11658, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":11657
 *         G = objtogen(G)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":11659
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 11659, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11660
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_6;

  /* "cypari/auto_instance.pxi":11661
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoissubfields(__pyx_v__G, __pyx_v_flag, __pyx_v__v);

  /* "cypari/auto_instance.pxi":11662
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoissubgroups(self, G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11649
 *         return new_gen(_ret)
 * 
 *     def galoissubfields(self, G, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subfields of the Galois group :emphasis:`G`, as a vector.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoissubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11664
 *         return new_gen(_ret)
 * 
 *     def galoissubgroups(self, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subgroups of the Galois group :literal:`gal`. A subgroup is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_663galoissubgroups(PyObject *__pyx_v_self, PyObject *__pyx_v_G); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_662galoissubgroups[] = "\n        Outputs all the subgroups of the Galois group :literal:`gal`. A subgroup is a\n        vector [:emphasis:`gen`, :emphasis:`orders`], with the same meaning\n        as for :math:`gal.gen` and :math:`gal.orders`. Hence :emphasis:`gen` is a vector of\n        permutations generating the subgroup, and :emphasis:`orders` is the relatives\n        orders of the generators. The cardinality of a subgroup is the product of the\n        relative orders. Such subgroup can be used instead of a Galois group in the\n        following command: :literal:`galoisisabelian`, :literal:`galoissubgroups`,\n        :literal:`galoisexport` and :literal:`galoisidentify`.\n        \n        To get the subfield fixed by a subgroup :emphasis:`sub` of :emphasis:`gal`, use\n        \n        ::\n        \n            galoisfixedfield(gal,sub[1])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_663galoissubgroups(PyObject *__pyx_v_self, PyObject *__pyx_v_G) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoissubgroups (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_662galoissubgroups(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_G));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_662galoissubgroups(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoissubgroups", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":11681
 *             galoisfixedfield(gal,sub[1])
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11682
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubgroups(_G)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11682, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11683
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoissubgroups(_G)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11684
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubgroups(_G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoissubgroups(__pyx_v__G);

  /* "cypari/auto_instance.pxi":11685
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubgroups(_G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gamma(self, s, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11664
 *         return new_gen(_ret)
 * 
 *     def galoissubgroups(self, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subgroups of the Galois group :literal:`gal`. A subgroup is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.galoissubgroups", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11687
 *         return new_gen(_ret)
 * 
 *     def gamma(self, s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a complex number, evaluates Euler's gamma
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_665gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_664gamma[] = "\n        For :math:`s` a complex number, evaluates Euler's gamma\n        function\n        \n        .. MATH::\n        \n            \\Gamma (s) = \\int_0^ oo t^{s-1}\\exp (-t)dt.\n        \n        Error if :math:`s` is a non-positive integer, where :math:`\\Gamma` has a pole.\n        \n        For :math:`s` a :literal:`t_PADIC`, evaluates the Morita gamma function at :math:`s`, that\n        is the unique continuous :math:`p`-adic function on the :math:`p`-adic integers\n        extending :math:`\\Gamma_p(k) = (-1)^k \\prod_{j < k}'j`, where the prime means that :math:`p`\n        does not divide :math:`j`.\n        \n        ::\n        \n            ? gamma(1/4 + O(5^10))\n            %1= 1 + 4*5 + 3*5^4 + 5^6 + 5^7 + 4*5^9 + O(5^10)\n            ? algdep(%,4)\n            %2 = x^4 + 4*x^2 + 5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_665gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gamma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_precision,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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gamma") < 0)) __PYX_ERR(4, 11687, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11687, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gamma", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11687, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_664gamma(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_664gamma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("gamma", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":11710
 *             %2 = x^4 + 4*x^2 + 5
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11710, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11711
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11711, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11712
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggamma(_s, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11713
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ggamma(_s, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":11714
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggamma(_s, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ggamma(__pyx_v__s, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":11715
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggamma(_s, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammah(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11687
 *         return new_gen(_ret)
 * 
 *     def gamma(self, s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a complex number, evaluates Euler's gamma
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11717
 *         return new_gen(_ret)
 * 
 *     def gammah(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gamma function evaluated at the argument :math:`x+1/2`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_667gammah(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_666gammah[] = "\n        Gamma function evaluated at the argument :math:`x+1/2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_667gammah(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammah (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammah") < 0)) __PYX_ERR(4, 11717, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11717, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammah", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11717, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammah", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_666gammah(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_666gammah(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("gammah", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":11721
 *         Gamma function evaluated at the argument :math:`x+1/2`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11722
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11722, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11723
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggammah(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11724
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ggammah(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":11725
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggammah(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ggammah(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":11726
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggammah(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammamellininv(self, G, t, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11717
 *         return new_gen(_ret)
 * 
 *     def gammah(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gamma function evaluated at the argument :math:`x+1/2`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammah", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11728
 *         return new_gen(_ret)
 * 
 *     def gammamellininv(self, G, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`t` of the inverse Mellin transform
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_669gammamellininv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_668gammamellininv[] = "\n        Returns the value at :math:`t` of the inverse Mellin transform\n        :math:`G` initialized by :literal:`gammamellininvinit`.\n        \n        ::\n        \n            ? G = gammamellininvinit([0]);\n            ? gammamellininv(G, 2) - 2*exp(-Pi*2^2)\n            %2 = -4.484155085839414627 E-44\n        \n        The alternative shortcut\n        \n        ::\n        \n             gammamellininv(A,t,m)\n        \n        for\n        \n        ::\n        \n             gammamellininv(gammamellininvinit(A,m), t)\n        \n        is available.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_669gammamellininv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_t = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammamellininv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_t,&__pyx_n_s_m,&__pyx_n_s_precision,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_G)) != 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_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gammamellininv", 0, 2, 4, 1); __PYX_ERR(4, 11728, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammamellininv") < 0)) __PYX_ERR(4, 11728, __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);
        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_G = values[0];
    __pyx_v_t = values[1];
    if (values[2]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11728, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11728, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammamellininv", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11728, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammamellininv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_668gammamellininv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_t, __pyx_v_m, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_668gammamellininv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__G;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("gammamellininv", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":11753
 *         is available.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11754
 *         '''
 *         G = objtogen(G)
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11755
 *         G = objtogen(G)
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11755, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11756
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11757
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11758
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":11759
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":11758
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 */
  }

  /* "cypari/auto_instance.pxi":11760
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gammamellininv(__pyx_v__G, __pyx_v__t, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":11761
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammamellininvasymp(self, A, long serprec=-1, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11728
 *         return new_gen(_ret)
 * 
 *     def gammamellininv(self, G, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`t` of the inverse Mellin transform
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammamellininv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11763
 *         return new_gen(_ret)
 * 
 *     def gammamellininvasymp(self, A, long serprec=-1, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the first :math:`n` terms of the asymptotic expansion at infinity
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_671gammamellininvasymp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_670gammamellininvasymp[] = "\n        Return the first :math:`n` terms of the asymptotic expansion at infinity\n        of the :math:`m`-th derivative :math:`K^{(m)}(t)` of the inverse Mellin transform of the\n        function\n        \n        .. MATH::\n        \n            f(s) = \\Gamma_\\mathbb{R} (s+a_1)...\\Gamma_\\mathbb{R} (s+a_d) ,\n        \n        where :literal:`A` is the vector :math:`[a_1,...,a_d]` and\n        :math:`\\Gamma_\\mathbb{R} (s) = \\pi^{-s/2} \\Gamma (s/2)` (Euler's :literal:`gamma`).\n        The result is a vector\n        :math:`[M[1]...M[n]]` with M[1] = 1, such that\n        \n        .. MATH::\n        \n            K^{(m)}(t) = \\sqrt{2^{d+1}/d}t^{a+m(2/d-1)}e^{-d\\pi t^{2/d}}\n            \\sum_{n >= 0} M[n+1] (\\pi t^{2/d})^{-n}\n        \n        with :math:`a = (1-d+\\sum_{1 <= j <= d}a_j)/d`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_671gammamellininvasymp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  long __pyx_v_serprec;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammamellininvasymp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammamellininvasymp") < 0)) __PYX_ERR(4, 11763, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11763, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    if (values[2]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11763, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammamellininvasymp", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11763, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammamellininvasymp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_670gammamellininvasymp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_serprec, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_670gammamellininvasymp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, long __pyx_v_serprec, long __pyx_v_n) {
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("gammamellininvasymp", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":11785
 *         with :math:`a = (1-d+\sum_{1 <= j <= d}a_j)/d`.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11786
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11786, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11787
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11788
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 */
  __pyx_t_4 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":11789
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":11788
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 */
  }

  /* "cypari/auto_instance.pxi":11790
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gammamellininvasymp(__pyx_v__A, __pyx_v_serprec, __pyx_v_n);

  /* "cypari/auto_instance.pxi":11791
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammamellininvinit(self, A, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11763
 *         return new_gen(_ret)
 * 
 *     def gammamellininvasymp(self, A, long serprec=-1, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the first :math:`n` terms of the asymptotic expansion at infinity
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammamellininvasymp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11793
 *         return new_gen(_ret)
 * 
 *     def gammamellininvinit(self, A, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for the computation by :literal:`gammamellininv` of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_673gammamellininvinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_672gammamellininvinit[] = "\n        Initialize data for the computation by :literal:`gammamellininv` of\n        the :math:`m`-th derivative of the inverse Mellin transform of the function\n        \n        .. MATH::\n        \n            f(s) = \\Gamma_\\mathbb{R} (s+a_1)...\\Gamma_\\mathbb{R} (s+a_d)\n        \n        where :literal:`A` is the vector :math:`[a_1,...,a_d]` and\n        :math:`\\Gamma_\\mathbb{R} (s) = \\pi^{-s/2} \\Gamma (s/2)` (Euler's :literal:`gamma`). This is the\n        special case of Meijer's :math:`G` functions used to compute :math:`L`-values via the\n        approximate functional equation.\n        \n        :strong:`Caveat.` Contrary to the PARI convention, this function\n        guarantees an :emphasis:`absolute` (rather than relative) error bound.\n        \n        For instance, the inverse Mellin transform of :math:`\\Gamma_\\mathbb{R} (s)` is\n        :math:`2\\exp (-\\pi z^2)`:\n        \n        ::\n        \n            ? G = gammamellininvinit([0]);\n            ? gammamellininv(G, 2) - 2*exp(-Pi*2^2)\n            %2 = -4.484155085839414627 E-44\n        \n        The inverse Mellin transform of :math:`\\Gamma_\\mathbb{R} (s+1)` is\n        :math:`2 z\\exp (-\\pi z^2)`, and its second derivative is\n        :math:`4\\pi z \\exp (-\\pi z^2)(2\\pi z^2 - 3)`:\n        \n        ::\n        \n            ? G = gammamellininvinit([1], 2);\n            ? a(z) = 4*Pi*z*exp(-Pi*z^2)*(2*Pi*z^2-3);\n            ? b(z) = gammamellininv(G,z);\n            ? t(z) = b(z) - a(z);\n            ? t(3/2)\n            %3 = -1.4693679385278593850 E-39\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_673gammamellininvinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammamellininvinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammamellininvinit") < 0)) __PYX_ERR(4, 11793, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11793, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 11793, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammamellininvinit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11793, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammamellininvinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_672gammamellininvinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_m, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_672gammamellininvinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("gammamellininvinit", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":11832
 *             %3 = -1.4693679385278593850 E-39
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11833
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11833, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11834
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11835
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":11836
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":11835
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 */
  }

  /* "cypari/auto_instance.pxi":11837
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gammamellininvinit(__pyx_v__A, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":11838
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gcd(self, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11793
 *         return new_gen(_ret)
 * 
 *     def gammamellininvinit(self, A, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for the computation by :literal:`gammamellininv` of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gammamellininvinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11840
 *         return new_gen(_ret)
 * 
 *     def gcd(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the greatest common divisor of :math:`x` and :math:`y`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_675gcd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_674gcd[] = "\n        Creates the greatest common divisor of :math:`x` and :math:`y`.\n        If you also need the :math:`u` and :math:`v` such that :math:`x*u + y*v = \\mathrm{gcd} (x,y)`,\n        use the :literal:`gcdext` function. :math:`x` and :math:`y` can have rather quite general\n        types, for instance both rational numbers. If :math:`y` is omitted and :math:`x` is a\n        vector, returns the :math:`gcd` of all components of :math:`x`, i.e.\302\240this is\n        equivalent to :literal:`content(x)`.\n        \n        When :math:`x` and :math:`y` are both given and one of them is a vector/matrix type,\n        the GCD is again taken recursively on each component, but in a different way.\n        If :math:`y` is a vector, resp.\302\240matrix, then the result has the same type as :math:`y`,\n        and components equal to :literal:`gcd(x, y[i])`, resp.\302\240:literal:`gcd(x, y[,i])`. Else\n        if :math:`x` is a vector/matrix the result has the same type as :math:`x` and an\n        analogous definition. Note that for these types, :literal:`gcd` is not\n        commutative.\n        \n        The algorithm used is a naive Euclid except for the following inputs:\n        \n        - integers: use modified right-shift binary (\"plus-minus\"\n          variant).\n        \n        - univariate polynomials with coefficients in the same number\n          field (in particular rational): use modular gcd algorithm.\n        \n        - general polynomials: use the subresultant algorithm if\n          coefficient explosion is likely (non modular coefficients).\n        \n        If :math:`u` and :math:`v` are polynomials in the same variable with :emphasis:`inexact`\n        coefficients, their gcd is defined to be scalar, so that\n        \n        ::\n        \n            ? a = x + 0.0; gcd(a,a)\n            %1 = 1\n            ? b = y*x + O(y); gcd(b,b)\n            %2 = y\n            ? c = 4*x + O(2^3); gcd(c,c)\n            %3 = 4\n        \n        A good q""uantitative check to decide whether such a\n        gcd \"should be\" non-trivial, is to use :literal:`polresultant`: a value\n        close to :math:`0` means that a small deformation of the inputs has non-trivial gcd.\n        You may also use :literal:`gcdext`, which does try to compute an approximate gcd\n        :math:`d` and provides :math:`u`, :math:`v` to check whether :math:`u x + v y` is close to :math:`d`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_675gcd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gcd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcd") < 0)) __PYX_ERR(4, 11840, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gcd", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11840, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gcd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_674gcd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_674gcd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("gcd", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":11886
 *         :math:`d` and provides :math:`u`, :math:`v` to check whether :math:`u x + v y` is close to :math:`d`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11887
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":11888
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":11889
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11889, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":11888
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":11890
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 11890, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11891
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":11892
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":11893
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":11894
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ggcd0(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":11893
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)
 */
  }

  /* "cypari/auto_instance.pxi":11895
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ggcd0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":11896
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gcdext(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11840
 *         return new_gen(_ret)
 * 
 *     def gcd(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the greatest common divisor of :math:`x` and :math:`y`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gcd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11898
 *         return new_gen(_ret)
 * 
 *     def gcdext(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[u,v,d]` such that :math:`d` is the gcd of :math:`x,y`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_677gcdext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_676gcdext[] = "\n        Returns :math:`[u,v,d]` such that :math:`d` is the gcd of :math:`x,y`,\n        :math:`x*u+y*v = \\mathrm{gcd} (x,y)`, and :math:`u` and :math:`v` minimal in a natural sense.\n        The arguments must be integers or polynomials.\n        \n        ::\n        \n            ? [u, v, d] = gcdext(32,102)\n            %1 = [16, -5, 2]\n            ? d\n            %2 = 2\n            ? gcdext(x^2-x, x^2+x-2)\n            %3 = [-1/2, 1/2, x - 1]\n        \n        If :math:`x,y` are polynomials in the same variable and :emphasis:`inexact`\n        coefficients, then compute :math:`u,v,d` such that :math:`x*u+y*v = d`, where :math:`d`\n        approximately divides both and :math:`x` and :math:`y`; in particular, we do not obtain\n        :literal:`gcd(x,y)` which is :emphasis:`defined` to be a scalar in this case:\n        \n        ::\n        \n            ? a = x + 0.0; gcd(a,a)\n            %1 = 1\n            \n            ? gcdext(a,a)\n            %2 = [0, 1, x + 0.E-28]\n            \n            ? gcdext(x-Pi, 6*x^2-zeta(2))\n            %3 = [-6*x - 18.8495559, 1, 57.5726923]\n        \n        For inexact inputs, the output is thus not well defined\n        mathematically, but you obtain explicit polynomials to check whether the\n        approximation is close enough for your needs.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_677gcdext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gcdext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("gcdext", 1, 2, 2, 1); __PYX_ERR(4, 11898, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcdext") < 0)) __PYX_ERR(4, 11898, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gcdext", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11898, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gcdext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_676gcdext(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_676gcdext(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("gcdext", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":11933
 *         approximation is close enough for your needs.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11934
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":11935
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 11935, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":11936
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11937
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":11938
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcdext0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":11939
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def genus2red(self, PQ, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 11939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11898
 *         return new_gen(_ret)
 * 
 *     def gcdext(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[u,v,d]` such that :math:`d` is the gcd of :math:`x,y`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gcdext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":11941
 *         return new_gen(_ret)
 * 
 *     def genus2red(self, PQ, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`PQ` be a polynomial :math:`P`, resp. a vector :math:`[P,Q]` of polynomials, with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_679genus2red(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_678genus2red[] = "\n        Let :math:`PQ` be a polynomial :math:`P`, resp. a vector :math:`[P,Q]` of polynomials, with\n        rational coefficients.\n        Determines the reduction at :math:`p > 2` of the (proper, smooth) genus\302\2402\n        curve :math:`C/\\mathbb{Q}`, defined by the hyperelliptic equation :math:`y^2 = P(x)`, resp.\n        :math:`y^2 + Q(x)*y = P(x)`.\n        (The special fiber :math:`X_p` of the minimal regular model :math:`X` of :math:`C` over :math:`\\mathbb{Z}`.)\n        \n        If :math:`p` is omitted, determines the reduction type for all (odd) prime\n        divisors of the discriminant.\n        \n        This function was rewritten from an implementation of Liu's\n        algorithm by Cohen and Liu (1994), :literal:`genus2reduction-0.3`, see\n        :literal:`http://www.math.u-bordeaux.fr/~liu/G2R/`.\n        \n        :strong:`CAVEAT.` The function interface may change: for the\n        time being, it returns :math:`[N,FaN, T, V]`\n        where :math:`N` is either the local conductor at :math:`p` or the\n        global conductor, :emphasis:`FaN` is its factorization, :math:`y^2 = T` defines a\n        minimal model over :math:`\\mathbb{Z}[1/2]` and :math:`V` describes the reduction type at the\n        various considered\302\240:math:`p`. Unfortunately, the program is not complete for\n        :math:`p = 2`, and we may return the odd part of the conductor only: this is the\n        case if the factorization includes the (impossible) term :math:`2^{-1}`; if the\n        factorization contains another power of :math:`2`, then this is the exact local\n        conductor at :math:`2` and :math:`N` is the global conductor.\n        \n        ::\n        \n            ? default(debuglevel, 1);\n            ? genus2red(x^6 + 3*x^3 + 63, 3)\n            (potential) stable reduction: [1, []]\n            reduction at p: [III{9}] page 184, [3, 3], f = 10\n            %1 = [59049, Mat([3, 10]), x^6 + 3*x^3 + 63, [3, [1, []],\n             [\"[III{9}] p""age 184\", [3, 3]]]]\n            ? [N, FaN, T, V] = genus2red(x^3-x^2-1, x^2-x); \\\\ X_1(13), global reduction\n            p = 13\n            (potential) stable reduction: [5, [Mod(0, 13), Mod(0, 13)]]\n            reduction at p: [I{0}-II-0] page 159, [], f = 2\n            ? N\n            %3 = 169\n            ? FaN\n            %4 = Mat([13, 2]) \\\\ in particular, good reduction at 2 !\n            ? T\n            %5 = x^6 + 58*x^5 + 1401*x^4 + 18038*x^3 + 130546*x^2 + 503516*x + 808561\n            ? V\n            %6 = [[13, [5, [Mod(0, 13), Mod(0, 13)]], [\"[I{0}-II-0] page 159\", []]]]\n        \n        We now first describe the format of the vector :math:`V = V_p` in the case where\n        :math:`p` was specified (local reduction at\302\240:math:`p`): it is a triple :math:`[p, stable,\n        red]`. The component :math:`stable = [type, vecj]` contains\n        information about the stable reduction after a field extension;\n        depending on :emphasis:`type`\302\240s, the stable reduction is\n        \n        - 1: smooth (i.e. the curve has potentially good reduction). The\n          Jacobian :math:`J(C)` has potentially good reduction.\n        \n        - 2: an elliptic curve :math:`E` with an ordinary double point; :emphasis:`vecj`\n          contains :math:`j` mod :math:`p`, the modular invariant of :math:`E`. The (potential)\n          semi-abelian reduction of :math:`J(C)` is the extension of an elliptic curve (with\n          modular invariant :math:`j` mod :math:`p`) by a torus.\n        \n        - 3: a projective line with two ordinary double points. The Jacobian\n          :math:`J(C)` has potentially multiplicative reduction.\n        \n        - 4: the union of two projective lines crossing transversally at three\n          points. The Jacobian :math:`J(C)` has potentially multiplicative reduction.\n        \n        - 5: the union of two elliptic curves :math:`E_1` and :math:`E_2` intersecting\n          transversally at one point""; :emphasis:`vecj` contains their modular invariants\n          :math:`j_1` and :math:`j_2`, which may live in a quadratic extension of :math:`\\mathbb{F}_p` and need\n          not be distinct. The Jacobian :math:`J(C)` has potentially good reduction,\n          isomorphic to the product of the reductions of :math:`E_1` and :math:`E_2`.\n        \n        - 6: the union of an elliptic curve :math:`E` and a projective line which has\n          an ordinary double point, and these two components intersect transversally\n          at one point; :emphasis:`vecj` contains :math:`j` mod :math:`p`, the modular invariant of :math:`E`.\n          The (potential) semi-abelian reduction of :math:`J(C)` is the extension of an\n          elliptic curve (with modular invariant :math:`j` mod :math:`p`) by a torus.\n        \n        - 7: as in type 6, but the two components are both singular. The\n          Jacobian :math:`J(C)` has potentially multiplicative reduction.\n        \n        The component :math:`red = [NUtype, neron]` contains two data\n        concerning the reduction at :math:`p` without any ramified field extension.\n        \n        The :emphasis:`NUtype` is a :literal:`t_STR` describing the reduction at :math:`p` of :math:`C`,\n        following Namikawa-Ueno, :emphasis:`The complete classification of fibers in\n        pencils of curves of genus two`, Manuscripta Math., vol. 9, (1973), pages\n        143-186. The reduction symbol is followed by the corresponding page number\n        or page range in this article.\n        \n        The second datum :emphasis:`neron` is the group of connected components (over an\n        algebraic closure of :math:`\\mathbb{F}_p`) of the N\303\251ron model of :math:`J(C)`, given as a\n        finite abelian group (vector of elementary divisors).\n        \n        If :math:`p = 2`, the :emphasis:`red` component may be omitted altogether (and\n        replaced by :literal:`[]`, in the case where the program could not compute it.""\n        When :math:`p` was not specified, :math:`V` is the vector of all :math:`V_p`, for all\n        considered :math:`p`.\n        \n        :strong:`Notes about Namikawa-Ueno types.`\n        \n        - A lower index is denoted between braces: for instance,\n          :literal:`[I{2}-II-5]` means :literal:`[I_2-II-5]`.\n        \n        - If :math:`K` and :math:`K'` are Kodaira symbols for singular fibers of elliptic\n          curves, then :literal:`[:math:`K`-:math:`K'`-m]` and :literal:`[:math:`K'`-:math:`K`-m]` are the same.\n        \n        We define a total ordering on Kodaira symbol by fixing :math:`I < I* <\n        II < II*,...`. If the reduction type is the same, we order by\n        the number of components, e.g. :math:`I_2 < I_4`, etc.\n        Then we normalize our output so that :math:`K <= K'`.\n        \n        - :literal:`[:math:`K`-:math:`K'`-:math:`-1`]` is :literal:`[:math:`K`-:math:`K'`-:math:`\\alpha`]` in the notation of\n          Namikawa-Ueno.\n        \n        - The figure :literal:`[2I_0-m]` in Namikawa-Ueno, page 159, must be denoted\n          by :literal:`[2I_0-(m+1)]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_679genus2red(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_PQ = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genus2red (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_PQ,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_PQ)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "genus2red") < 0)) __PYX_ERR(4, 11941, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_PQ = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("genus2red", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 11941, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.genus2red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_678genus2red(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_PQ, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_678genus2red(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_PQ, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__PQ;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("genus2red", 0);
  __Pyx_INCREF(__pyx_v_PQ);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":12061
 *           by :literal:`[2I_0-(m+1)]`.
 *         '''
 *         PQ = objtogen(PQ)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_PQ, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_PQ, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12062
 *         '''
 *         PQ = objtogen(PQ)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12063
 *         PQ = objtogen(PQ)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12064
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _PQ = (<Gen>PQ).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":12063
 *         PQ = objtogen(PQ)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":12065
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12065, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12066
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _PQ = (<Gen>PQ).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_PQ)->__pyx_base.g;
  __pyx_v__PQ = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12067
 *         sig_on()
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":12068
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12069
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = genus2red(_PQ, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":12068
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)
 */
  }

  /* "cypari/auto_instance.pxi":12070
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = genus2red(__pyx_v__PQ, __pyx_v__p);

  /* "cypari/auto_instance.pxi":12071
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def getabstime(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":11941
 *         return new_gen(_ret)
 * 
 *     def genus2red(self, PQ, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`PQ` be a polynomial :math:`P`, resp. a vector :math:`[P,Q]` of polynomials, with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.genus2red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_PQ);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12073
 *         return new_gen(_ret)
 * 
 *     def getabstime(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the CPU time (in milliseconds) elapsed since :literal:`gp` startup.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_681getabstime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_680getabstime[] = "\n        Returns the CPU time (in milliseconds) elapsed since :literal:`gp` startup.\n        This provides a reentrant version of :literal:`gettime`:\n        \n        ::\n        \n            my (t = getabstime());\n            ...\n            print(\"Time: \", getabstime() - t);\n        \n        For a version giving wall-clock time, see :literal:`getwalltime`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_681getabstime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getabstime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_680getabstime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_680getabstime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getabstime", 0);

  /* "cypari/auto_instance.pxi":12086
 *         For a version giving wall-clock time, see :literal:`getwalltime`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long _ret = getabstime()
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 12086, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12087
 *         '''
 *         sig_on()
 *         cdef long _ret = getabstime()             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = getabstime();

  /* "cypari/auto_instance.pxi":12088
 *         sig_on()
 *         cdef long _ret = getabstime()
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":12089
 *         cdef long _ret = getabstime()
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def getcache(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12073
 *         return new_gen(_ret)
 * 
 *     def getabstime(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the CPU time (in milliseconds) elapsed since :literal:`gp` startup.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.getabstime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12091
 *         return _ret
 * 
 *     def getcache(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns information about various auto-growing caches. For
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_683getcache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_682getcache[] = "\n        Returns information about various auto-growing caches. For\n        each ressource, we report its name, its size, the number of cache misses\n        (since the last extension), the largest cache miss and the size of the cache\n        in bytes.\n        \n        The caches are initially empty, then set automatically to a small\n        inexpensive default value, then grow on demand up to some maximal value.\n        Their size never decreases, they are only freed on exit.\n        \n        The current caches are\n        \n        - Hurwitz class numbers :math:`H(D)` for :math:`\\|D\\| <= N`, computed in time\n          :math:`O(N^{3/2})` using :math:`O(N)` space.\n        \n        - Factorizations of small integers up to :math:`N`, computed in time\n          :math:`O(N^{1+\\varepsilon})` using :math:`O(N\\log N)` space.\n        \n        - Divisors of small integers up to :math:`N`, computed in time\n          :math:`O(N^{1+\\varepsilon})` using :math:`O(N\\log N)` space.\n        \n        - Primitive dihedral forms of weight :math:`1` and level up to :math:`N`,\n          computed in time :math:`O(N^{2+\\varepsilon})` and space :math:`O(N^2)`.\n        \n        ::\n        \n            ? getcache() \\\\ on startup, all caches are empty\n            %1 =\n            [ \"Factors\" 0 0 0 0]\n            \n            [\"Divisors\" 0 0 0 0]\n            \n            [ \"H\" 0 0 0 0]\n            \n            [\"Dihedral\" 0 0 0 0]\n            ? mfdim([500,1,0],0); \\\\ non-trivial computation\n            time = 540 ms.\n            ? getcache()\n            %3 =\n            [ \"Factors\" 50000 0 0 4479272]\n            \n            [\"Divisors\" 50000 1 100000 5189808]\n            \n            [ \"H\" 50000 0 0 400008]\n            \n            [\"Dihedral\" 1000 0 0 2278208]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_683getcache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getcache (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_682getcache(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_682getcache(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getcache", 0);

  /* "cypari/auto_instance.pxi":12139
 *             ["Dihedral" 1000 0 0 2278208]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = getcache()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 12139, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12140
 *         '''
 *         sig_on()
 *         cdef GEN _ret = getcache()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = getcache();

  /* "cypari/auto_instance.pxi":12141
 *         sig_on()
 *         cdef GEN _ret = getcache()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def getenv(self, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12091
 *         return _ret
 * 
 *     def getcache(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns information about various auto-growing caches. For
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.getcache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12143
 *         return new_gen(_ret)
 * 
 *     def getenv(self, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the value of the environment variable :literal:`s` if it is defined, otherwise return 0.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_685getenv(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_684getenv[] = "\n        Return the value of the environment variable :literal:`s` if it is defined, otherwise return 0.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_685getenv(PyObject *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getenv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_684getenv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_s));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_684getenv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s) {
  char *__pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("getenv", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":12147
 *         Return the value of the environment variable :literal:`s` if it is defined, otherwise return 0.
 *         '''
 *         s = to_bytes(s)             # <<<<<<<<<<<<<<
 *         cdef char* _s = <bytes>s
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12148
 *         '''
 *         s = to_bytes(s)
 *         cdef char* _s = <bytes>s             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = gp_getenv(_s)
 */
  if (unlikely(__pyx_v_s == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 12148, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_s); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 12148, __pyx_L1_error)
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12149
 *         s = to_bytes(s)
 *         cdef char* _s = <bytes>s
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gp_getenv(_s)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12149, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12150
 *         cdef char* _s = <bytes>s
 *         sig_on()
 *         cdef GEN _ret = gp_getenv(_s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gp_getenv(__pyx_v__s);

  /* "cypari/auto_instance.pxi":12151
 *         sig_on()
 *         cdef GEN _ret = gp_getenv(_s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def getheap(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12143
 *         return new_gen(_ret)
 * 
 *     def getenv(self, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the value of the environment variable :literal:`s` if it is defined, otherwise return 0.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.getenv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12153
 *         return new_gen(_ret)
 * 
 *     def getheap(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a two-component row vector giving the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_687getheap(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_686getheap[] = "\n        Returns a two-component row vector giving the\n        number of objects on the heap and the amount of memory they occupy in long\n        words. Useful mainly for debugging purposes.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_687getheap(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getheap (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_686getheap(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_686getheap(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getheap", 0);

  /* "cypari/auto_instance.pxi":12159
 *         words. Useful mainly for debugging purposes.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = getheap()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 12159, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12160
 *         '''
 *         sig_on()
 *         cdef GEN _ret = getheap()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = getheap();

  /* "cypari/auto_instance.pxi":12161
 *         sig_on()
 *         cdef GEN _ret = getheap()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def getrand(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12153
 *         return new_gen(_ret)
 * 
 *     def getheap(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a two-component row vector giving the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.getheap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12163
 *         return new_gen(_ret)
 * 
 *     def getrand(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the current value of the seed used by the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_689getrand(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_688getrand[] = "\n        Returns the current value of the seed used by the\n        pseudo-random number generator :literal:`random`. Useful mainly for debugging\n        purposes, to reproduce a specific chain of computations. The returned value\n        is technical (reproduces an internal state array), and can only be used as an\n        argument to :literal:`setrand`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_689getrand(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getrand (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_688getrand(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_688getrand(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getrand", 0);

  /* "cypari/auto_instance.pxi":12171
 *         argument to :literal:`setrand`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = getrand()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 12171, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12172
 *         '''
 *         sig_on()
 *         cdef GEN _ret = getrand()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = getrand();

  /* "cypari/auto_instance.pxi":12173
 *         sig_on()
 *         cdef GEN _ret = getrand()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def getstack(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12163
 *         return new_gen(_ret)
 * 
 *     def getrand(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the current value of the seed used by the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.getrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12175
 *         return new_gen(_ret)
 * 
 *     def getstack(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the current value of :math:`top-avma`, i.e.the number of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_691getstack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_690getstack[] = "\n        Returns the current value of :math:`top-avma`, i.e.\302\240the number of\n        bytes used up to now on the stack. Useful mainly for debugging purposes.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_691getstack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getstack (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_690getstack(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_690getstack(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getstack", 0);

  /* "cypari/auto_instance.pxi":12180
 *         bytes used up to now on the stack. Useful mainly for debugging purposes.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long _ret = getstack()
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 12180, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12181
 *         '''
 *         sig_on()
 *         cdef long _ret = getstack()             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = getstack();

  /* "cypari/auto_instance.pxi":12182
 *         sig_on()
 *         cdef long _ret = getstack()
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":12183
 *         cdef long _ret = getstack()
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def gettime(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12175
 *         return new_gen(_ret)
 * 
 *     def getstack(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the current value of :math:`top-avma`, i.e.the number of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.getstack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12185
 *         return _ret
 * 
 *     def gettime(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the CPU time (in milliseconds) used since either the last call to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_693gettime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_692gettime[] = "\n        Returns the CPU time (in milliseconds) used since either the last call to\n        :literal:`gettime`, or to the beginning of the containing GP instruction (if\n        inside :literal:`gp`), whichever came last.\n        \n        For a reentrant version, see :literal:`getabstime`.\n        \n        For a version giving wall-clock time, see :literal:`getwalltime`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_693gettime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gettime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_692gettime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_692gettime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("gettime", 0);

  /* "cypari/auto_instance.pxi":12195
 *         For a version giving wall-clock time, see :literal:`getwalltime`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long _ret = gettime()
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 12195, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12196
 *         '''
 *         sig_on()
 *         cdef long _ret = gettime()             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = gettime();

  /* "cypari/auto_instance.pxi":12197
 *         sig_on()
 *         cdef long _ret = gettime()
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":12198
 *         cdef long _ret = gettime()
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def getwalltime(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12185
 *         return _ret
 * 
 *     def gettime(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the CPU time (in milliseconds) used since either the last call to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.gettime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12200
 *         return _ret
 * 
 *     def getwalltime(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the time (in milliseconds) elapsed since
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_695getwalltime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_694getwalltime[] = "\n        Returns the time (in milliseconds) elapsed since\n        00:00:00 UTC Thursday 1, January 1970 (the Unix epoch).\n        \n        ::\n        \n            my (t = getwalltime());\n            ...\n            print(\"Time: \", getwalltime() - t);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_695getwalltime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getwalltime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_694getwalltime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_694getwalltime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("getwalltime", 0);

  /* "cypari/auto_instance.pxi":12211
 *             print("Time: ", getwalltime() - t);
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = getwalltime()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 12211, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12212
 *         '''
 *         sig_on()
 *         cdef GEN _ret = getwalltime()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = getwalltime();

  /* "cypari/auto_instance.pxi":12213
 *         sig_on()
 *         cdef GEN _ret = getwalltime()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hammingweight(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12200
 *         return _ret
 * 
 *     def getwalltime(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the time (in milliseconds) elapsed since
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.getwalltime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12215
 *         return new_gen(_ret)
 * 
 *     def hammingweight(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a :literal:`t_INT`, return the binary Hamming weight of :math:`\|x\|`. Otherwise
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_697hammingweight(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_696hammingweight[] = "\n        If :math:`x` is a :literal:`t_INT`, return the binary Hamming weight of :math:`\\|x\\|`. Otherwise\n        :math:`x` must be of type :literal:`t_POL`, :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_VECSMALL`, or\n        :literal:`t_MAT` and the function returns the number of non-zero coefficients of\n        :math:`x`.\n        \n        ::\n        \n            ? hammingweight(15)\n            %1 = 4\n            ? hammingweight(x^100 + 2*x + 1)\n            %2 = 3\n            ? hammingweight([Mod(1,2), 2, Mod(0,3)])\n            %3 = 2\n            ? hammingweight(matid(100))\n            %4 = 100\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_697hammingweight(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hammingweight (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_696hammingweight(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_696hammingweight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("hammingweight", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":12233
 *             %4 = 100
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12234
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = hammingweight(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12234, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12235
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = hammingweight(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12236
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = hammingweight(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = hammingweight(__pyx_v__x);

  /* "cypari/auto_instance.pxi":12237
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = hammingweight(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":12238
 *         cdef long _ret = hammingweight(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def hilbert(self, x, y, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12215
 *         return new_gen(_ret)
 * 
 *     def hammingweight(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a :literal:`t_INT`, return the binary Hamming weight of :math:`\|x\|`. Otherwise
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hammingweight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12240
 *         return _ret
 * 
 *     def hilbert(self, x, y, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hilbert symbol of :math:`x` and :math:`y` modulo the prime :math:`p`, :math:`p = 0` meaning
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_699hilbert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_698hilbert[] = "\n        Hilbert symbol of :math:`x` and :math:`y` modulo the prime :math:`p`, :math:`p = 0` meaning\n        the place at infinity (the result is undefined if :math:`p != 0` is not prime).\n        \n        It is possible to omit :math:`p`, in which case we take :math:`p = 0` if both :math:`x`\n        and :math:`y` are rational, or one of them is a real number. And take :math:`p = q`\n        if one of :math:`x`, :math:`y` is a :literal:`t_INTMOD` modulo :math:`q` or a :math:`q`-adic. (Incompatible\n        types will raise an error.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_699hilbert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hilbert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_p,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hilbert", 0, 2, 3, 1); __PYX_ERR(4, 12240, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hilbert") < 0)) __PYX_ERR(4, 12240, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_p = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hilbert", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12240, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_698hilbert(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_698hilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__p;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("hilbert", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":12250
 *         types will raise an error.)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12251
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12252
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12253
 *         y = objtogen(y)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12254
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":12253
 *         y = objtogen(y)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":12255
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12255, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12256
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12257
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12258
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":12259
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12260
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = hilbert(_x, _y, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":12259
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)
 */
  }

  /* "cypari/auto_instance.pxi":12261
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = hilbert(__pyx_v__x, __pyx_v__y, __pyx_v__p);

  /* "cypari/auto_instance.pxi":12262
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":12263
 *         cdef long _ret = hilbert(_x, _y, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def hyperellcharpoly(self, X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12240
 *         return _ret
 * 
 *     def hilbert(self, x, y, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hilbert symbol of :math:`x` and :math:`y` modulo the prime :math:`p`, :math:`p = 0` meaning
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12265
 *         return _ret
 * 
 *     def hyperellcharpoly(self, X):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve defined over a finite field,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_701hyperellcharpoly(PyObject *__pyx_v_self, PyObject *__pyx_v_X); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_700hyperellcharpoly[] = "\n        :math:`X` being a non-singular hyperelliptic curve defined over a finite field,\n        return the characteristic polynomial of the Frobenius automorphism.\n        :math:`X` can be given either by a squarefree polynomial :math:`P` such that\n        :math:`X: y^2 = P(x)` or by a vector :math:`[P,Q]` such that\n        :math:`X: y^2 + Q(x) y = P(x)` and :math:`Q^2+4 P` is squarefree.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_701hyperellcharpoly(PyObject *__pyx_v_self, PyObject *__pyx_v_X) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperellcharpoly (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_700hyperellcharpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_X));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_700hyperellcharpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X) {
  GEN __pyx_v__X;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("hyperellcharpoly", 0);
  __Pyx_INCREF(__pyx_v_X);

  /* "cypari/auto_instance.pxi":12273
 *         :math:`X: y^2 + Q(x) y = P(x)` and :math:`Q^2+4 P` is squarefree.
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12274
 *         '''
 *         X = objtogen(X)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = hyperellcharpoly(_X)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12274, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12275
 *         X = objtogen(X)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperellcharpoly(_X)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12276
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = hyperellcharpoly(_X)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperellcharpoly(__pyx_v__X);

  /* "cypari/auto_instance.pxi":12277
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = hyperellcharpoly(_X)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hyperellpadicfrobenius(self, Q, unsigned long p, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12265
 *         return _ret
 * 
 *     def hyperellcharpoly(self, X):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve defined over a finite field,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hyperellcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12279
 *         return new_gen(_ret)
 * 
 *     def hyperellpadicfrobenius(self, Q, unsigned long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`X` be the curve defined by :math:`y^2 = Q(x)`, where :math:`Q` is a polynomial of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_703hyperellpadicfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_702hyperellpadicfrobenius[] = "\n        Let :math:`X` be the curve defined by :math:`y^2 = Q(x)`, where :math:`Q` is a polynomial of\n        degree :math:`d` over :math:`\\mathbb{Q}` and :math:`p >= d` a prime such that :math:`X` has good reduction\n        at :math:`p` return the matrix of the Frobenius endomorphism :math:`\\varphi` on the\n        crystalline module :math:`D_p(X) = \\mathbb{Q}_p \\otimes H^1_{dR}(X/\\mathbb{Q})` with respect to the\n        basis of the given model :math:`(\\omega, x \\omega,...,x^{g-1} \\omega)`, where\n        :math:`\\omega = dx/(2 y)` is the invariant differential, where :math:`g` is the genus of\n        :math:`X` (either :math:`d = 2 g+1` or :math:`d = 2 g+2`). The characteristic polynomial of\n        :math:`\\varphi` is the numerator of the zeta-function of the reduction of the curve\n        :math:`X` modulo :math:`p`. The matrix is computed to absolute :math:`p`-adic precision :math:`p^n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_703hyperellpadicfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Q = 0;
  unsigned long __pyx_v_p;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperellpadicfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_p,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hyperellpadicfrobenius", 1, 3, 3, 1); __PYX_ERR(4, 12279, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hyperellpadicfrobenius", 1, 3, 3, 2); __PYX_ERR(4, 12279, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hyperellpadicfrobenius") < 0)) __PYX_ERR(4, 12279, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_Q = values[0];
    __pyx_v_p = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_p == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12279, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12279, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hyperellpadicfrobenius", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12279, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hyperellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_702hyperellpadicfrobenius(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Q, __pyx_v_p, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_702hyperellpadicfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, unsigned long __pyx_v_p, long __pyx_v_n) {
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("hyperellpadicfrobenius", 0);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":12291
 *         :math:`X` modulo :math:`p`. The matrix is computed to absolute :math:`p`-adic precision :math:`p^n`.
 *         '''
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12292
 *         '''
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12292, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12293
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12294
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperellpadicfrobenius(__pyx_v__Q, __pyx_v_p, __pyx_v_n);

  /* "cypari/auto_instance.pxi":12295
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hyperellratpoints(self, X, h, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12279
 *         return new_gen(_ret)
 * 
 *     def hyperellpadicfrobenius(self, Q, unsigned long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`X` be the curve defined by :math:`y^2 = Q(x)`, where :math:`Q` is a polynomial of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hyperellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12297
 *         return new_gen(_ret)
 * 
 *     def hyperellratpoints(self, X, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve given by an integral model,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_705hyperellratpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_704hyperellratpoints[] = "\n        :math:`X` being a non-singular hyperelliptic curve given by an integral model,\n        return a vector containing the affine rational points on the curve of naive height less than :math:`h`.\n        If :math:`flag = 1`, stop as soon as a point is found; return either an empty vector or a vector containing a single point.\n        \n        :math:`X` is given either by a squarefree polynomial :math:`P` such that :math:`X: y^2 = P(x)`\n        or by a vector :math:`[P,Q]` such that :math:`X: y^2+Q(x) y = P(x)` and :math:`Q^2+4 P` is\n        squarefree.\n        \n        The parameter :math:`h` can be\n        \n        - an integer :math:`H`: find the points :math:`[n/d,y]` whose abscissas :math:`x = n/d` have\n          naive height ( = :math:`\\max (\\|n\\|, d)`) less than :math:`H`;\n        \n        - a vector :math:`[N,D]` with :math:`D <= N`: find the points :math:`[n/d,y]` with\n          :math:`\\|n\\| <= N`, :math:`d <= D`.\n        \n        - a vector :math:`[N,[D_1,D_2]]` with :math:`D_1 < D_2 <= N` find the points\n          :math:`[n/d,y]` with :math:`\\|n\\| <= N` and :math:`D_1 <= d <= D_2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_705hyperellratpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_h = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperellratpoints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_h,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hyperellratpoints", 0, 2, 3, 1); __PYX_ERR(4, 12297, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hyperellratpoints") < 0)) __PYX_ERR(4, 12297, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_X = values[0];
    __pyx_v_h = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12297, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hyperellratpoints", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12297, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hyperellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_704hyperellratpoints(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_X, __pyx_v_h, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_704hyperellratpoints(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_h, long __pyx_v_flag) {
  GEN __pyx_v__X;
  GEN __pyx_v__h;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("hyperellratpoints", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_h);

  /* "cypari/auto_instance.pxi":12318
 *           :math:`[n/d,y]` with :math:`\|n\| <= N` and :math:`D_1 <= d <= D_2`.
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         h = objtogen(h)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12319
 *         '''
 *         X = objtogen(X)
 *         h = objtogen(h)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_h, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12320
 *         X = objtogen(X)
 *         h = objtogen(h)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _h = (<Gen>h).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12320, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12321
 *         h = objtogen(h)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12322
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _h = (<Gen>h).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_h)->__pyx_base.g;
  __pyx_v__h = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12323
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperellratpoints(__pyx_v__X, __pyx_v__h, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":12324
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hyperu(self, a, b, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12297
 *         return new_gen(_ret)
 * 
 *     def hyperellratpoints(self, X, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve given by an integral model,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hyperellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12326
 *         return new_gen(_ret)
 * 
 *     def hyperu(self, a, b, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`U`-confluent hypergeometric function with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_707hyperu(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_706hyperu[] = "\n        :math:`U`-confluent hypergeometric function with\n        parameters :math:`a` and :math:`b`. The parameters :math:`a` and :math:`b` can be complex but\n        the present implementation requires :math:`x` to be positive.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_707hyperu(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperu (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_x,&__pyx_n_s_precision,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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hyperu", 0, 3, 4, 1); __PYX_ERR(4, 12326, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hyperu", 0, 3, 4, 2); __PYX_ERR(4, 12326, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hyperu") < 0)) __PYX_ERR(4, 12326, __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_a = values[0];
    __pyx_v_b = values[1];
    __pyx_v_x = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12326, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hyperu", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12326, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hyperu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_706hyperu(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_706hyperu(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("hyperu", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":12332
 *         the present implementation requires :math:`x` to be positive.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         x = objtogen(x)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12333
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12334
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12335
 *         b = objtogen(b)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12335, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12336
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12337
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12338
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12339
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":12340
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperu(__pyx_v__a, __pyx_v__b, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":12341
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealadd(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12326
 *         return new_gen(_ret)
 * 
 *     def hyperu(self, a, b, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`U`-confluent hypergeometric function with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.hyperu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12343
 *         return new_gen(_ret)
 * 
 *     def idealadd(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the two ideals :math:`x` and :math:`y` in the number field :math:`nf`. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_709idealadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_708idealadd[] = "\n        Sum of the two ideals :math:`x` and :math:`y` in the number field :math:`nf`. The\n        result is given in HNF.\n        \n        ::\n        \n             ? K = nfinit(x^2 + 1);\n             ? a = idealadd(K, 2, x + 1) \\\\ ideal generated by 2 and 1+I\n             %2 =\n             [2 1]\n            \n             [0 1]\n             ? pr = idealprimedec(K, 5)[1]; \\\\ a prime ideal above 5\n             ? idealadd(K, a, pr) \\\\ coprime, as expected\n             %4 =\n             [1 0]\n            \n             [0 1]\n        \n        This function cannot be used to add arbitrary :math:`\\mathbb{Z}`-modules, since it assumes\n        that its arguments are ideals:\n        \n        ::\n        \n             ? b = Mat([1,0]~);\n             ? idealadd(K, b, b) \\\\ only square t_MATs represent ideals\n             *** idealadd: non-square t_MAT in idealtyp.\n             ? c = [2, 0; 2, 0]; idealadd(K, c, c) \\\\ non-sense\n             %6 =\n             [2 0]\n            \n             [0 2]\n             ? d = [1, 0; 0, 2]; idealadd(K, d, d) \\\\ non-sense\n             %7 =\n             [1 0]\n            \n             [0 1]\n            \n        \n        In the last two examples, we get wrong results since the\n        matrices :math:`c` and :math:`d` do not correspond to an ideal: the :math:`\\mathbb{Z}`-span of their\n        columns (as usual interpreted as coordinates with respect to the integer basis\n        :literal:`K.zk`) is not an :math:`O_K`-module. To add arbitrary :math:`\\mathbb{Z}`-modules generated\n        by the columns of matrices :math:`A` and :math:`B`, use :literal:`mathnf(concat(A,B))`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_709idealadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealadd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealadd", 1, 3, 3, 1); __PYX_ERR(4, 12343, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealadd", 1, 3, 3, 2); __PYX_ERR(4, 12343, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealadd") < 0)) __PYX_ERR(4, 12343, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealadd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12343, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_708idealadd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_708idealadd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealadd", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":12389
 *         by the columns of matrices :math:`A` and :math:`B`, use :literal:`mathnf(concat(A,B))`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12390
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12391
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12391, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12392
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12392, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12393
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12394
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealadd(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12395
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealadd(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12396
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealadd(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealadd(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":12397
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealadd(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealaddtoone(self, nf, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12343
 *         return new_gen(_ret)
 * 
 *     def idealadd(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the two ideals :math:`x` and :math:`y` in the number field :math:`nf`. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12399
 *         return new_gen(_ret)
 * 
 *     def idealaddtoone(self, nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two co-prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_711idealaddtoone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_710idealaddtoone[] = "\n        :math:`x` and :math:`y` being two co-prime\n        integral ideals (given in any form), this gives a two-component row vector\n        :math:`[a,b]` such that :math:`a\\in x`, :math:`b\\in y` and :math:`a+b = 1`.\n        \n        The alternative syntax :math:`idealaddtoone (nf,v)`, is supported, where\n        :math:`v` is a :math:`k`-component vector of ideals (given in any form) which sum to\n        :math:`\\mathbb{Z}_K`. This outputs a :math:`k`-component vector :math:`e` such that :math:`e[i]\\in x[i]` for\n        :math:`1 <= i <= k` and :math:`\\sum_{1 <= i <= k}e[i] = 1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_711idealaddtoone(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealaddtoone (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealaddtoone", 0, 2, 3, 1); __PYX_ERR(4, 12399, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealaddtoone") < 0)) __PYX_ERR(4, 12399, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealaddtoone", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12399, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealaddtoone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_710idealaddtoone(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_710idealaddtoone(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealaddtoone", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":12410
 *         :math:`1 <= i <= k` and :math:`\sum_{1 <= i <= k}e[i] = 1`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12411
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12412
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12413
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12414
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":12413
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":12415
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12415, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12416
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12417
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12418
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":12419
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12420
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":12419
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 */
  }

  /* "cypari/auto_instance.pxi":12421
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealaddtoone0(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":12422
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealappr(self, nf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12399
 *         return new_gen(_ret)
 * 
 *     def idealaddtoone(self, nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two co-prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealaddtoone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12424
 *         return new_gen(_ret)
 * 
 *     def idealappr(self, nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a fractional ideal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_713idealappr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_712idealappr[] = "\n        If :math:`x` is a fractional ideal\n        (given in any form), gives an element :math:`\\alpha` in :math:`nf` such that for\n        all prime ideals :math:`p` such that the valuation of :math:`x` at :math:`p` is\n        non-zero, we have :math:`v_{p}(\\alpha) = v_{p}(x)`, and\n        :math:`v_{p}(\\alpha) >= 0` for all other :math:`p`.\n        \n        The argument :math:`x` may also be given as a prime ideal factorization, as\n        output by :literal:`idealfactor`, but allowing zero exponents.\n        This yields an element :math:`\\alpha` such that for all prime ideals :math:`p`\n        occurring in :math:`x`, :math:`v_{p}(\\alpha) = v_{p}(x)`;\n        for all other prime ideals, :math:`v_{p}(\\alpha) >= 0`.\n        \n        flag is deprecated (ignored), kept for backward compatibility.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_713idealappr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealappr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealappr", 0, 2, 3, 1); __PYX_ERR(4, 12424, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealappr") < 0)) __PYX_ERR(4, 12424, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12424, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealappr", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12424, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_712idealappr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_712idealappr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealappr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":12440
 *         flag is deprecated (ignored), kept for backward compatibility.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12441
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12442
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12442, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12443
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12444
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12445
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealappr0(__pyx_v__nf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":12446
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealchinese(self, nf, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12424
 *         return new_gen(_ret)
 * 
 *     def idealappr(self, nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a fractional ideal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12448
 *         return new_gen(_ret)
 * 
 *     def idealchinese(self, nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a prime ideal factorization (i.e.a 2-columns matrix whose first
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_715idealchinese(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_714idealchinese[] = "\n        :math:`x` being a prime ideal factorization (i.e.\302\240a 2-columns matrix whose first\n        column contains prime ideals and the second column contains integral\n        exponents), :math:`y` a vector of elements in :math:`nf` indexed by the ideals in\n        :math:`x`, computes an element :math:`b` such that\n        \n        :math:`v_{p}(b - y_{p}) >= v_{p}(x)` for all prime ideals\n        in :math:`x` and :math:`v_{p}(b) >= 0` for all other :math:`p`.\n        \n        ::\n        \n            ? K = nfinit(t^2-2);\n            ? x = idealfactor(K, 2^2*3)\n            %2 =\n            [[2, [0, 1]~, 2, 1, [0, 2; 1, 0]] 4]\n            \n            [ [3, [3, 0]~, 1, 2, 1] 1]\n            ? y = [t,1];\n            ? idealchinese(K, x, y)\n            %4 = [4, -3]~\n        \n        The argument :math:`x` may also be of the form :math:`[x, s]` where the first component\n        is as above and :math:`s` is a vector of signs, with :math:`r_1` components\n        :math:`s_i` in :math:`{-1,0,1}`:\n        if :math:`\\sigma_i` denotes the :math:`i`-th real embedding of the number field,\n        the element :math:`b` returned satisfies further\n        :math:`sign (\\sigma_i(b)) = s_i` for all :math:`i` such that :math:`s_i = \302\2611`.\n        In other words, the sign is fixed to :math:`s_i` at the :math:`i`-th embedding whenever\n        :math:`s_i` is non-zero.\n        \n        ::\n        \n            ? idealchinese(K, [x, [1,1]], y)\n            %5 = [16, -3]~\n            ? idealchinese(K, [x, [-1,-1]], y)\n            %6 = [-20, -3]~\n            ? idealchinese(K, [x, [1,-1]], y)\n            %7 = [4, -3]~\n        \n        If :math:`y` is omitted, return a data structure which can be used in\n        place of :math:`x` in later calls and allows to solve many chinese remainder\n        problems for a given :math:`x` more efficiently.\n        \n        ::\n        \n            ? C = idealchinese(K, [x, [1,1]]);\n            ? idealchin""ese(K, C, y) \\\\ as above\n            %9 = [16, -3]~\n            ? for(i=1,10^4, idealchinese(K,C,y)) \\\\ ... but faster !\n            time = 80 ms.\n            ? for(i=1,10^4, idealchinese(K,[x,[1,1]],y))\n            time = 224 ms.\n        \n        Finally, this structure is itself allowed in place of :math:`x`, the\n        new :math:`s` overriding the one already present in the structure. This allows to\n        initialize for different sign conditions more efficiently when the underlying\n        ideal factorization remains the same.\n        \n        ::\n        \n            ? D = idealchinese(K, [C, [1,-1]]); \\\\ replaces [1,1]\n            ? idealchinese(K, D, y)\n            %13 = [4, -3]~\n            ? for(i=1,10^4,idealchinese(K,[C,[1,-1]]))\n            time = 40 ms. \\\\ faster than starting from scratch\n            ? for(i=1,10^4,idealchinese(K,[x,[1,-1]]))\n            time = 128 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_715idealchinese(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealchinese (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealchinese", 0, 2, 3, 1); __PYX_ERR(4, 12448, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealchinese") < 0)) __PYX_ERR(4, 12448, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealchinese", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12448, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealchinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_714idealchinese(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_714idealchinese(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealchinese", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":12517
 *             time = 128 ms.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12518
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12519
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12520
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12521
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12521, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":12520
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":12522
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12522, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12523
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12524
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12525
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":12526
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12527
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":12526
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 */
  }

  /* "cypari/auto_instance.pxi":12528
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealchinese(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":12529
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealcoprime(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12448
 *         return new_gen(_ret)
 * 
 *     def idealchinese(self, nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a prime ideal factorization (i.e.a 2-columns matrix whose first
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealchinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12531
 *         return new_gen(_ret)
 * 
 *     def idealcoprime(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two integral ideals :math:`x` and :math:`y`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_717idealcoprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_716idealcoprime[] = "\n        Given two integral ideals :math:`x` and :math:`y`\n        in the number field :math:`nf`, returns a :math:`\\beta` in the field,\n        such that :math:`\\beta.x` is an integral ideal coprime to :math:`y`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_717idealcoprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealcoprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealcoprime", 1, 3, 3, 1); __PYX_ERR(4, 12531, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealcoprime", 1, 3, 3, 2); __PYX_ERR(4, 12531, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealcoprime") < 0)) __PYX_ERR(4, 12531, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealcoprime", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12531, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealcoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_716idealcoprime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_716idealcoprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealcoprime", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":12537
 *         such that :math:`\beta.x` is an integral ideal coprime to :math:`y`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12538
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12539
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12540
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12540, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12541
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12542
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12543
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12544
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealcoprime(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":12545
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealdiv(self, nf, x, y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12531
 *         return new_gen(_ret)
 * 
 *     def idealcoprime(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two integral ideals :math:`x` and :math:`y`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealcoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12547
 *         return new_gen(_ret)
 * 
 *     def idealdiv(self, nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Quotient :math:`x.y^{-1}` of the two ideals :math:`x` and :math:`y` in the number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_719idealdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_718idealdiv[] = "\n        Quotient :math:`x.y^{-1}` of the two ideals :math:`x` and :math:`y` in the number\n        field :math:`nf`. The result is given in HNF.\n        \n        If :math:`flag` is non-zero, the quotient :math:`x.y^{-1}` is assumed to be an\n        integral ideal. This can be much faster when the norm of the quotient is\n        small even though the norms of :math:`x` and :math:`y` are large. More precisely,\n        the algorithm cheaply removes all maximal ideals above rational\n        primes such that :math:`v_p(Nx) = v_p(Ny)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_719idealdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealdiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_flag,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealdiv", 0, 3, 4, 1); __PYX_ERR(4, 12547, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealdiv", 0, 3, 4, 2); __PYX_ERR(4, 12547, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealdiv") < 0)) __PYX_ERR(4, 12547, __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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12547, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealdiv", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12547, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_718idealdiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_718idealdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealdiv", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":12558
 *         primes such that :math:`v_p(Nx) = v_p(Ny)`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12559
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12560
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12561
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12561, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12562
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12563
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12564
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12565
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealdiv0(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":12566
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealfactor(self, nf, x, lim=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12547
 *         return new_gen(_ret)
 * 
 *     def idealdiv(self, nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Quotient :math:`x.y^{-1}` of the two ideals :math:`x` and :math:`y` in the number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12568
 *         return new_gen(_ret)
 * 
 *     def idealfactor(self, nf, x, lim=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors into prime ideal powers the ideal :math:`x` in the number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_721idealfactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_720idealfactor[] = "\n        Factors into prime ideal powers the ideal :math:`x` in the number field\n        :math:`nf`. The output format is similar to the :literal:`factor` function, and\n        the prime ideals are represented in the form output by the\n        :literal:`idealprimedec` function. If :emphasis:`lim` is set, return partial\n        factorization, including only prime ideals above rational primes\n        :math:`< lim`.\n        \n        ::\n        \n            ? nf = nfinit(x^3-2);\n            ? idealfactor(nf, x) \\\\ a prime ideal above 2\n            %2 =\n            [[2, [0, 1, 0]~, 3, 1, ...] 1]\n            \n            ? A = idealhnf(nf, 6*x, 4+2*x+x^2)\n            %3 =\n            [6 0 4]\n            \n            [0 6 2]\n            \n            [0 0 1]\n            \n            ? idealfactor(nf, A)\n            %4 =\n             [[2, [0, 1, 0]~, 3, 1, ...] 2]\n            \n             [[3, [1, 1, 0]~, 3, 1, ...] 2]\n            \n            ? idealfactor(nf, A, 3) \\\\ restrict to primes above p < 3\n            %5 =\n            [[2, [0, 1, 0]~, 3, 1, ...] 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_721idealfactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_lim = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealfactor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_lim,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealfactor", 0, 2, 3, 1); __PYX_ERR(4, 12568, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealfactor") < 0)) __PYX_ERR(4, 12568, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_lim = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealfactor", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12568, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealfactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_720idealfactor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_lim);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_720idealfactor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_lim) {
  int __pyx_v__have_lim;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__lim;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealfactor", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_lim);

  /* "cypari/auto_instance.pxi":12602
 *             [[2, [0, 1, 0]~, 3, 1, ...] 2]
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_lim = (lim is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12603
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12604
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         cdef bint _have_lim = (lim is not None)             # <<<<<<<<<<<<<<
 *         if _have_lim:
 *             lim = objtogen(lim)
 */
  __pyx_t_2 = (__pyx_v_lim != Py_None);
  __pyx_v__have_lim = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12605
 *         x = objtogen(x)
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             lim = objtogen(lim)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_lim != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12606
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:
 *             lim = objtogen(lim)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lim, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_lim, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":12605
 *         x = objtogen(x)
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             lim = objtogen(lim)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":12607
 *         if _have_lim:
 *             lim = objtogen(lim)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12607, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12608
 *             lim = objtogen(lim)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12609
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lim = NULL
 *         if _have_lim:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12610
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL             # <<<<<<<<<<<<<<
 *         if _have_lim:
 *             _lim = (<Gen>lim).g
 */
  __pyx_v__lim = NULL;

  /* "cypari/auto_instance.pxi":12611
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 */
  __pyx_t_2 = (__pyx_v__have_lim != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12612
 *         cdef GEN _lim = NULL
 *         if _have_lim:
 *             _lim = (<Gen>lim).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lim)->__pyx_base.g;
    __pyx_v__lim = __pyx_t_4;

    /* "cypari/auto_instance.pxi":12611
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 */
  }

  /* "cypari/auto_instance.pxi":12613
 *         if _have_lim:
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpidealfactor(__pyx_v__nf, __pyx_v__x, __pyx_v__lim);

  /* "cypari/auto_instance.pxi":12614
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealfactorback(self, nf, f, e=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12568
 *         return new_gen(_ret)
 * 
 *     def idealfactor(self, nf, x, lim=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors into prime ideal powers the ideal :math:`x` in the number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealfactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_lim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12616
 *         return new_gen(_ret)
 * 
 *     def idealfactorback(self, nf, f, e=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the ideal corresponding to a factorization. The integer :math:`1`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_723idealfactorback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_722idealfactorback[] = "\n        Gives back the ideal corresponding to a factorization. The integer :math:`1`\n        corresponds to the empty factorization.\n        If :math:`e` is present, :math:`e` and :math:`f` must be vectors of the same length (:math:`e` being\n        integral), and the corresponding factorization is the product of the\n        :math:`f[i]^{e[i]}`.\n        \n        If not, and :math:`f` is vector, it is understood as in the preceding case with :math:`e`\n        a vector of 1s: we return the product of the :math:`f[i]`. Finally, :math:`f` can be a\n        regular factorization, as produced by :literal:`idealfactor`.\n        \n        ::\n        \n            ? nf = nfinit(y^2+1); idealfactor(nf, 4 + 2*y)\n            %1 =\n            [[2, [1, 1]~, 2, 1, [1, 1]~] 2]\n            \n            [[5, [2, 1]~, 1, 1, [-2, 1]~] 1]\n            \n            ? idealfactorback(nf, %)\n            %2 =\n            [10 4]\n            \n            [0 2]\n            \n            ? f = %1[,1]; e = %1[,2]; idealfactorback(nf, f, e)\n            %3 =\n            [10 4]\n            \n            [0 2]\n            \n            ? % == idealhnf(nf, 4 + 2*y)\n            %4 = 1\n        \n        If :literal:`flag` is non-zero, perform ideal reductions (:literal:`idealred`) along the\n        way. This is most useful if the ideals involved are all :emphasis:`extended`\n        ideals (for instance with trivial principal part), so that the principal parts\n        extracted by :literal:`idealred` are not lost. Here is an example:\n        \n        ::\n        \n            ? f = vector(#f, i, [f[i], [;]]); \\\\ transform to extended ideals\n            ? idealfactorback(nf, f, e, 1)\n            %6 = [[1, 0; 0, 1], [2, 1; [2, 1]~, 1]]\n            ? nffactorback(nf, %[2])\n            %7 = [4, 2]~\n        \n        The extended ideal returned in :literal:`\\%6` is the trivial ideal :math:`1`, extended\n        with a principal generator given in factored form. We use "":literal:`nffactorback`\n        to recover it in standard form.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_723idealfactorback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_e = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealfactorback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_f,&__pyx_n_s_e,&__pyx_n_s_flag,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_nf)) != 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_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealfactorback", 0, 2, 4, 1); __PYX_ERR(4, 12616, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e);
          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_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealfactorback") < 0)) __PYX_ERR(4, 12616, __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);
        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_nf = values[0];
    __pyx_v_f = values[1];
    __pyx_v_e = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12616, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealfactorback", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12616, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealfactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_722idealfactorback(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_f, __pyx_v_e, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_722idealfactorback(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e, long __pyx_v_flag) {
  int __pyx_v__have_e;
  GEN __pyx_v__nf;
  GEN __pyx_v__f;
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealfactorback", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_e);

  /* "cypari/auto_instance.pxi":12668
 *         to recover it in standard form.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12669
 *         '''
 *         nf = objtogen(nf)
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12670
 *         nf = objtogen(nf)
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             e = objtogen(e)
 */
  __pyx_t_2 = (__pyx_v_e != Py_None);
  __pyx_v__have_e = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12671
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12672
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 *             e = objtogen(e)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_e, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":12671
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":12673
 *         if _have_e:
 *             e = objtogen(e)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12673, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12674
 *             e = objtogen(e)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12675
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _e = NULL
 *         if _have_e:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12676
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             _e = (<Gen>e).g
 */
  __pyx_v__e = NULL;

  /* "cypari/auto_instance.pxi":12677
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12678
 *         cdef GEN _e = NULL
 *         if _have_e:
 *             _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
    __pyx_v__e = __pyx_t_4;

    /* "cypari/auto_instance.pxi":12677
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 */
  }

  /* "cypari/auto_instance.pxi":12679
 *         if _have_e:
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealfactorback(__pyx_v__nf, __pyx_v__f, __pyx_v__e, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":12680
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealfrobenius(self, nf, gal, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12616
 *         return new_gen(_ret)
 * 
 *     def idealfactorback(self, nf, f, e=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the ideal corresponding to a factorization. The integer :math:`1`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealfactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12682
 *         return new_gen(_ret)
 * 
 *     def idealfrobenius(self, nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :math:`nf` and assume :math:`K/\mathbb{Q}` be a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_725idealfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_724idealfrobenius[] = "\n        Let :math:`K` be the number field defined by :math:`nf` and assume :math:`K/\\mathbb{Q}` be a\n        Galois extension with Galois group given :literal:`gal = galoisinit(nf)`,\n        and that :emphasis:`pr` is an unramified prime ideal :math:`p` in :literal:`prid`\n        format.\n        This function returns a permutation of :literal:`gal.group` which defines\n        the Frobenius element :math:`\\text{Frob}_{p}` attached to :math:`p`.\n        If :math:`p` is the unique prime number in :math:`p`, then\n        :math:`\\text{Frob} (x) = x^p mod p` for all :math:`x\\in\\mathbb{Z}_K`.\n        \n        ::\n        \n            ? nf = nfinit(polcyclo(31));\n            ? gal = galoisinit(nf);\n            ? pr = idealprimedec(nf,101)[1];\n            ? g = idealfrobenius(nf,gal,pr);\n            ? galoispermtopol(gal,g)\n            %5 = x^8\n        \n        This is correct since :math:`101 = 8 mod 31`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_725idealfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_gal,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_gal)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealfrobenius", 1, 3, 3, 1); __PYX_ERR(4, 12682, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealfrobenius", 1, 3, 3, 2); __PYX_ERR(4, 12682, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealfrobenius") < 0)) __PYX_ERR(4, 12682, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_gal = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealfrobenius", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12682, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_724idealfrobenius(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_gal, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_724idealfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__gal;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealfrobenius", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":12704
 *         This is correct since :math:`101 = 8 mod 31`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12705
 *         '''
 *         nf = objtogen(nf)
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12706
 *         nf = objtogen(nf)
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12707
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12707, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12708
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12709
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12710
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12711
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealfrobenius(__pyx_v__nf, __pyx_v__gal, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":12712
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealhnf(self, nf, u, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12682
 *         return new_gen(_ret)
 * 
 *     def idealfrobenius(self, nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :math:`nf` and assume :math:`K/\mathbb{Q}` be a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12714
 *         return new_gen(_ret)
 * 
 *     def idealhnf(self, nf, u, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Hermite normal form of the ideal :math:`u\mathbb{Z}_K+v\mathbb{Z}_K`, where :math:`u`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_727idealhnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_726idealhnf[] = "\n        Gives the Hermite normal form of the ideal :math:`u\\mathbb{Z}_K+v\\mathbb{Z}_K`, where :math:`u`\n        and :math:`v` are elements of the number field :math:`K` defined by :emphasis:`nf`.\n        \n        ::\n        \n            ? nf = nfinit(y^3 - 2);\n            ? idealhnf(nf, 2, y+1)\n            %2 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? idealhnf(nf, y/2, [0,0,1/3]~)\n            %3 =\n            [1/3 0 0]\n            \n            [0 1/6 0]\n            \n            [0 0 1/6]\n        \n        If :math:`b` is omitted, returns the HNF of the ideal defined by :math:`u`: :math:`u` may be an\n        algebraic number (defining a principal ideal), a maximal ideal (as given by\n        :literal:`idealprimedec` or :literal:`idealfactor`), or a matrix whose columns give\n        generators for the ideal. This last format is a little complicated, but\n        useful to reduce general modules to the canonical form once in a while:\n        \n        - if strictly less than :math:`N = [K:\\mathbb{Q}]` generators are given, :math:`u`\n          is the :math:`\\mathbb{Z}_K`-module they generate,\n        \n        - if :math:`N` or more are given, it is :emphasis:`assumed` that they form a\n          :math:`\\mathbb{Z}`-basis of the ideal, in particular that the matrix has maximal rank :math:`N`.\n          This acts as :literal:`mathnf` since the :math:`\\mathbb{Z}_K`-module structure is (taken for\n          granted hence) not taken into account in this case.\n        \n        ::\n        \n            ? idealhnf(nf, idealprimedec(nf,2)[1])\n            %4 =\n            [2 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? idealhnf(nf, [1,2;2,3;3,4])\n            %5 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n        \n        Finally, when :math:`K` is quadratic with discriminant :math:`D_K`, ""we\n        allow :math:`u =` :literal:`Qfb(a,b,c)`, provided :math:`b^2 - 4ac = D_K`. As usual,\n        this represents the ideal :math:`a \\mathbb{Z} + (1/2)(-b + \\sqrt{D_K}) \\mathbb{Z}`.\n        \n        ::\n        \n            ? K = nfinit(x^2 - 60); K.disc\n            %1 = 60\n            ? idealhnf(K, qfbprimeform(60,2))\n            %2 =\n            [2 1]\n            \n            [0 1]\n            ? idealhnf(K, Qfb(1,2,3))\n             *** at top-level: idealhnf(K,Qfb(1,2,3\n             *** ^--------------------\n             *** idealhnf: Qfb(1, 2, 3) has discriminant != 60 in idealhnf.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_727idealhnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_u = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealhnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_u,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_u)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealhnf", 0, 2, 3, 1); __PYX_ERR(4, 12714, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealhnf") < 0)) __PYX_ERR(4, 12714, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_u = values[1];
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealhnf", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12714, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_726idealhnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_u, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_726idealhnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_u, PyObject *__pyx_v_v) {
  int __pyx_v__have_v;
  GEN __pyx_v__nf;
  GEN __pyx_v__u;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealhnf", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_u);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":12786
 *              *** idealhnf: Qfb(1, 2, 3) has discriminant != 60 in idealhnf.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         u = objtogen(u)
 *         cdef bint _have_v = (v is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12787
 *         '''
 *         nf = objtogen(nf)
 *         u = objtogen(u)             # <<<<<<<<<<<<<<
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_u, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_u, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12788
 *         nf = objtogen(nf)
 *         u = objtogen(u)
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_2;

  /* "cypari/auto_instance.pxi":12789
 *         u = objtogen(u)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12790
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":12789
 *         u = objtogen(u)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":12791
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _u = (<Gen>u).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 12791, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12792
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12793
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _u = (<Gen>u).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_u)->__pyx_base.g;
  __pyx_v__u = __pyx_t_4;

  /* "cypari/auto_instance.pxi":12794
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_instance.pxi":12795
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":12796
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":12795
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 */
  }

  /* "cypari/auto_instance.pxi":12797
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealhnf0(__pyx_v__nf, __pyx_v__u, __pyx_v__v);

  /* "cypari/auto_instance.pxi":12798
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealintersect(self, nf, A, B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12714
 *         return new_gen(_ret)
 * 
 *     def idealhnf(self, nf, u, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Hermite normal form of the ideal :math:`u\mathbb{Z}_K+v\mathbb{Z}_K`, where :math:`u`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_u);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12800
 *         return new_gen(_ret)
 * 
 *     def idealintersect(self, nf, A, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two ideals
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_729idealintersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_728idealintersect[] = "\n        Intersection of the two ideals\n        :math:`A` and :math:`B` in the number field :math:`nf`. The result is given in HNF.\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? idealintersect(nf, 2, x+1)\n            %2 =\n            [2 0]\n            \n            [0 2]\n        \n        This function does not apply to general :math:`\\mathbb{Z}`-modules, e.g.\302\240orders, since its\n        arguments are replaced by the ideals they generate. The following script\n        intersects :math:`\\mathbb{Z}`-modules :math:`A` and :math:`B` given by matrices of compatible\n        dimensions with integer coefficients:\n        \n        ::\n        \n            ZM_intersect(A,B) =\n            { my(Ker = matkerint(concat(A,B)));\n             mathnf( A * Ker[1..#A,] )\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_729idealintersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealintersect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_A,&__pyx_n_s_B,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealintersect", 1, 3, 3, 1); __PYX_ERR(4, 12800, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealintersect", 1, 3, 3, 2); __PYX_ERR(4, 12800, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealintersect") < 0)) __PYX_ERR(4, 12800, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_A = values[1];
    __pyx_v_B = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealintersect", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12800, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_728idealintersect(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_A, __pyx_v_B);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_728idealintersect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_B) {
  GEN __pyx_v__nf;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealintersect", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":12826
 *             }
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         B = objtogen(B)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12827
 *         '''
 *         nf = objtogen(nf)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12828
 *         nf = objtogen(nf)
 *         A = objtogen(A)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12829
 *         A = objtogen(A)
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12829, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12830
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12831
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12832
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12833
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealintersect(__pyx_v__nf, __pyx_v__A, __pyx_v__B);

  /* "cypari/auto_instance.pxi":12834
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealinv(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12800
 *         return new_gen(_ret)
 * 
 *     def idealintersect(self, nf, A, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two ideals
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12836
 *         return new_gen(_ret)
 * 
 *     def idealinv(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inverse of the ideal :math:`x` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_731idealinv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_730idealinv[] = "\n        Inverse of the ideal :math:`x` in the\n        number field :math:`nf`, given in HNF. If :math:`x` is an extended\n        ideal, its principal part is suitably\n        updated: i.e. inverting :math:`[I,t]`, yields :math:`[I^{-1}, 1/t]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_731idealinv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealinv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealinv", 1, 2, 2, 1); __PYX_ERR(4, 12836, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealinv") < 0)) __PYX_ERR(4, 12836, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealinv", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12836, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealinv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_730idealinv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_730idealinv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealinv", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":12843
 *         updated: i.e. inverting :math:`[I,t]`, yields :math:`[I^{-1}, 1/t]`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12844
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12845
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12845, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12846
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealinv(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12847
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealinv(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12848
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealinv(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealinv(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":12849
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealinv(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ideallist(self, nf, long bound, long flag=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12836
 *         return new_gen(_ret)
 * 
 *     def idealinv(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inverse of the ideal :math:`x` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealinv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12851
 *         return new_gen(_ret)
 * 
 *     def ideallist(self, nf, long bound, long flag=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the list
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_733ideallist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_732ideallist[] = "\n        Computes the list\n        of all ideals of norm less or equal to :emphasis:`bound` in the number field\n        :emphasis:`nf`. The result is a row vector with exactly :emphasis:`bound` components.\n        Each component is itself a row vector containing the information about\n        ideals of a given norm, in no specific order, depending on the value of\n        :math:`flag`:\n        \n        The possible values of :math:`flag` are:\n        \n        \302\240\302\2400: give the :emphasis:`bid` attached to the ideals, without generators.\n        \n        \302\240\302\2401: as 0, but include the generators in the :emphasis:`bid`.\n        \n        \302\240\302\2402: in this case, :emphasis:`nf` must be a :emphasis:`bnf` with units. Each\n        component is of the form :math:`[bid,U]`, where :emphasis:`bid` is as case 0\n        and :math:`U` is a vector of discrete logarithms of the units. More precisely, it\n        gives the :literal:`ideallog`\302\240s with respect to :emphasis:`bid` of :literal:`bnf.tufu`.\n        This structure is technical, and only meant to be used in conjunction with\n        :literal:`bnrclassnolist` or :literal:`bnrdisclist`.\n        \n        \302\240\302\2403: as 2, but include the generators in the :emphasis:`bid`.\n        \n        \302\240\302\2404: give only the HNF of the ideal.\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? L = ideallist(nf, 100);\n            ? L[1]\n            %3 = [[1, 0; 0, 1]] \\\\ A single ideal of norm 1\n            ? #L[65]\n            %4 = 4 \\\\ There are 4 ideals of norm 4 in Z[i]\n        \n        If one wants more information, one could do instead:\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? L = ideallist(nf, 100, 0);\n            ? l = L[25]; vector(#l, i, l[i].clgp)\n            %3 = [[20, [20]], [16, [4, 4]], [20, [20]]]\n            ? l[1].mod\n            %4 = [[25, 18; 0, 1], []]\n            ? l[2""].mod\n            %5 = [[5, 0; 0, 5], []]\n            ? l[3].mod\n            %6 = [[25, 7; 0, 1], []]\n        \n        where we ask for the structures of the :math:`(\\mathbb{Z}[i]/I)^*` for all\n        three ideals of norm :math:`25`. In fact, for all moduli with finite part of norm\n        :math:`25` and trivial Archimedean part, as the last 3 commands show. See\n        :literal:`ideallistarch` to treat general moduli.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_733ideallist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  long __pyx_v_bound;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ideallist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_bound,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_bound)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ideallist", 0, 2, 3, 1); __PYX_ERR(4, 12851, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ideallist") < 0)) __PYX_ERR(4, 12851, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_bound = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_bound == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12851, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 12851, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ideallist", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12851, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ideallist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_732ideallist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_bound, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_732ideallist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, long __pyx_v_bound, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ideallist", 0);
  __Pyx_INCREF(__pyx_v_nf);

  /* "cypari/auto_instance.pxi":12906
 *         :literal:`ideallistarch` to treat general moduli.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12907
 *         '''
 *         nf = objtogen(nf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12907, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12908
 *         nf = objtogen(nf)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12909
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ideallist0(__pyx_v__nf, __pyx_v_bound, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":12910
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ideallistarch(self, nf, list, arch):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12851
 *         return new_gen(_ret)
 * 
 *     def ideallist(self, nf, long bound, long flag=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the list
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ideallist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12912
 *         return new_gen(_ret)
 * 
 *     def ideallistarch(self, nf, list, arch):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`list` is a vector of vectors of bid's, as output by :literal:`ideallist` with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_735ideallistarch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_734ideallistarch[] = "\n        :emphasis:`list` is a vector of vectors of bid's, as output by :literal:`ideallist` with\n        flag :math:`0` to :math:`3`. Return a vector of vectors with the same number of\n        components as the original :emphasis:`list`. The leaves give information about\n        moduli whose finite part is as in original list, in the same order, and\n        Archimedean part is now :emphasis:`arch` (it was originally trivial). The\n        information contained is of the same kind as was present in the input; see\n        :literal:`ideallist`, in particular the meaning of :emphasis:`flag`.\n        \n        ::\n        \n            ? bnf = bnfinit(x^2-2);\n            ? bnf.sign\n            %2 = [2, 0] \\\\ two places at infinity\n            ? L = ideallist(bnf, 100, 0);\n            ? l = L[98]; vector(#l, i, l[i].clgp)\n            %4 = [[42, [42]], [36, [6, 6]], [42, [42]]]\n            ? La = ideallistarch(bnf, L, [1,1]); \\\\ add them to the modulus\n            ? l = La[98]; vector(#l, i, l[i].clgp)\n            %6 = [[168, [42, 2, 2]], [144, [6, 6, 2, 2]], [168, [42, 2, 2]]]\n        \n        Of course, the results above are obvious: adding :math:`t` places at infinity will\n        add :math:`t` copies of :math:`\\mathbb{Z}/2\\mathbb{Z}` to :math:`(\\mathbb{Z}_K/f)^*`. The following application\n        is more typical:\n        \n        ::\n        \n            ? L = ideallist(bnf, 100, 2); \\\\ units are required now\n            ? La = ideallistarch(bnf, L, [1,1]);\n            ? H = bnrclassnolist(bnf, La);\n            ? H[98];\n            %4 = [2, 12, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_735ideallistarch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_list = 0;
  PyObject *__pyx_v_arch = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ideallistarch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_list,&__pyx_n_s_arch,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_list)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ideallistarch", 1, 3, 3, 1); __PYX_ERR(4, 12912, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arch)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ideallistarch", 1, 3, 3, 2); __PYX_ERR(4, 12912, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ideallistarch") < 0)) __PYX_ERR(4, 12912, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_list = values[1];
    __pyx_v_arch = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ideallistarch", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12912, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ideallistarch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_734ideallistarch(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_list, __pyx_v_arch);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_734ideallistarch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_list, PyObject *__pyx_v_arch) {
  GEN __pyx_v__nf;
  GEN __pyx_v__list;
  GEN __pyx_v__arch;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ideallistarch", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_list);
  __Pyx_INCREF(__pyx_v_arch);

  /* "cypari/auto_instance.pxi":12946
 *             %4 = [2, 12, 2]
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         list = objtogen(list)
 *         arch = objtogen(arch)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12947
 *         '''
 *         nf = objtogen(nf)
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         arch = objtogen(arch)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12948
 *         nf = objtogen(nf)
 *         list = objtogen(list)
 *         arch = objtogen(arch)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_arch, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_arch, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":12949
 *         list = objtogen(list)
 *         arch = objtogen(arch)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 12949, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12950
 *         arch = objtogen(arch)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _arch = (<Gen>arch).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12951
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _arch = (<Gen>arch).g
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12952
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _arch = (<Gen>arch).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_arch)->__pyx_base.g;
  __pyx_v__arch = __pyx_t_3;

  /* "cypari/auto_instance.pxi":12953
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _arch = (<Gen>arch).g
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ideallistarch(__pyx_v__nf, __pyx_v__list, __pyx_v__arch);

  /* "cypari/auto_instance.pxi":12954
 *         cdef GEN _arch = (<Gen>arch).g
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ideallog(self, nf=None, x=None, bid=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12912
 *         return new_gen(_ret)
 * 
 *     def ideallistarch(self, nf, list, arch):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`list` is a vector of vectors of bid's, as output by :literal:`ideallist` with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ideallistarch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XDECREF(__pyx_v_arch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12956
 *         return new_gen(_ret)
 * 
 *     def ideallog(self, nf=None, x=None, bid=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` is a number field,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_737ideallog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_736ideallog[] = "\n        :math:`nf` is a number field,\n        :emphasis:`bid` is as output by :literal:`idealstar(nf, D,...)` and :math:`x` a\n        non-necessarily integral element of :emphasis:`nf` which must have valuation\n        equal to 0 at all prime ideals in the support of :math:`D`. This function\n        computes the discrete logarithm of :math:`x` on the generators given in\n        :literal:`:emphasis:`bid`.gen`. In other words, if :math:`g_i` are these generators, of orders\n        :math:`d_i` respectively, the result is a column vector of integers :math:`(x_i)` such\n        that :math:`0 <= x_i < d_i` and\n        \n        .. MATH::\n        \n            x = \\prod_i g_i^{x_i} (mod ^*D) .\n        \n        Note that when the support of :literal:`D` contains places at infinity, this\n        congruence implies also sign conditions on the attached real embeddings.\n        See :literal:`znlog` for the limitations of the underlying discrete log algorithms.\n        \n        When :emphasis:`nf` is omitted, take it to be the rational number field. In that\n        case, :math:`x` must be a :literal:`t_INT` and :emphasis:`bid` must have been initialized by\n        :literal:`znstar(N,1)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_737ideallog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_bid = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ideallog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_bid,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bid);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ideallog") < 0)) __PYX_ERR(4, 12956, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_bid = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ideallog", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12956, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ideallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_736ideallog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_bid);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_736ideallog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_bid) {
  int __pyx_v__have_nf;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__bid;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("ideallog", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_bid);

  /* "cypari/auto_instance.pxi":12979
 *         :literal:`znstar(N,1)`.
 *         '''
 *         cdef bint _have_nf = (nf is not None)             # <<<<<<<<<<<<<<
 *         if _have_nf:
 *             nf = objtogen(nf)
 */
  __pyx_t_1 = (__pyx_v_nf != Py_None);
  __pyx_v__have_nf = __pyx_t_1;

  /* "cypari/auto_instance.pxi":12980
 *         '''
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             nf = objtogen(nf)
 *         if x is None:
 */
  __pyx_t_1 = (__pyx_v__have_nf != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":12981
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:
 *             nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":12980
 *         '''
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             nf = objtogen(nf)
 *         if x is None:
 */
  }

  /* "cypari/auto_instance.pxi":12982
 *         if _have_nf:
 *             nf = objtogen(nf)
 *         if x is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x == Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "cypari/auto_instance.pxi":12983
 *             nf = objtogen(nf)
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         if bid is None:
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12983, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 12983, __pyx_L1_error)

    /* "cypari/auto_instance.pxi":12982
 *         if _have_nf:
 *             nf = objtogen(nf)
 *         if x is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 */
  }

  /* "cypari/auto_instance.pxi":12984
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         if bid is None:
 *             raise TypeError("missing required argument: 'bid'")
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":12985
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 *         if bid is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'bid'")
 *         bid = objtogen(bid)
 */
  __pyx_t_3 = (__pyx_v_bid == Py_None);
  __pyx_t_1 = (__pyx_t_3 != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/auto_instance.pxi":12986
 *         x = objtogen(x)
 *         if bid is None:
 *             raise TypeError("missing required argument: 'bid'")             # <<<<<<<<<<<<<<
 *         bid = objtogen(bid)
 *         sig_on()
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 12986, __pyx_L1_error)

    /* "cypari/auto_instance.pxi":12985
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 *         if bid is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'bid'")
 *         bid = objtogen(bid)
 */
  }

  /* "cypari/auto_instance.pxi":12987
 *         if bid is None:
 *             raise TypeError("missing required argument: 'bid'")
 *         bid = objtogen(bid)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = NULL
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bid, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_bid, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":12988
 *             raise TypeError("missing required argument: 'bid'")
 *         bid = objtogen(bid)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = NULL
 *         if _have_nf:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 12988, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":12989
 *         bid = objtogen(bid)
 *         sig_on()
 *         cdef GEN _nf = NULL             # <<<<<<<<<<<<<<
 *         if _have_nf:
 *             _nf = (<Gen>nf).g
 */
  __pyx_v__nf = NULL;

  /* "cypari/auto_instance.pxi":12990
 *         sig_on()
 *         cdef GEN _nf = NULL
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = (__pyx_v__have_nf != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":12991
 *         cdef GEN _nf = NULL
 *         if _have_nf:
 *             _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _bid = (<Gen>bid).g
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
    __pyx_v__nf = __pyx_t_5;

    /* "cypari/auto_instance.pxi":12990
 *         sig_on()
 *         cdef GEN _nf = NULL
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  }

  /* "cypari/auto_instance.pxi":12992
 *         if _have_nf:
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bid = (<Gen>bid).g
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_instance.pxi":12993
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _bid = (<Gen>bid).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bid)->__pyx_base.g;
  __pyx_v__bid = __pyx_t_5;

  /* "cypari/auto_instance.pxi":12994
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _bid = (<Gen>bid).g
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ideallog(__pyx_v__nf, __pyx_v__x, __pyx_v__bid);

  /* "cypari/auto_instance.pxi":12995
 *         cdef GEN _bid = (<Gen>bid).g
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealmin(self, nf, ix, vdir=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 12995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12956
 *         return new_gen(_ret)
 * 
 *     def ideallog(self, nf=None, x=None, bid=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` is a number field,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ideallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_bid);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":12997
 *         return new_gen(_ret)
 * 
 *     def idealmin(self, nf, ix, vdir=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`This function is useless and kept for backward compatibility only,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_739idealmin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_738idealmin[] = "\n        :emphasis:`This function is useless and kept for backward compatibility only,\n        use :literal:`idealred``. Computes a pseudo-minimum of the ideal :math:`x` in the\n        direction :emphasis:`vdir` in the number field :emphasis:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_739idealmin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_ix = 0;
  PyObject *__pyx_v_vdir = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealmin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_ix,&__pyx_n_s_vdir,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_ix)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealmin", 0, 2, 3, 1); __PYX_ERR(4, 12997, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vdir);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealmin") < 0)) __PYX_ERR(4, 12997, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_ix = values[1];
    __pyx_v_vdir = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealmin", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 12997, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_738idealmin(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_ix, __pyx_v_vdir);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_738idealmin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_ix, PyObject *__pyx_v_vdir) {
  int __pyx_v__have_vdir;
  GEN __pyx_v__nf;
  GEN __pyx_v__ix;
  GEN __pyx_v__vdir;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealmin", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_ix);
  __Pyx_INCREF(__pyx_v_vdir);

  /* "cypari/auto_instance.pxi":13003
 *         direction :emphasis:`vdir` in the number field :emphasis:`nf`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         ix = objtogen(ix)
 *         cdef bint _have_vdir = (vdir is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13004
 *         '''
 *         nf = objtogen(nf)
 *         ix = objtogen(ix)             # <<<<<<<<<<<<<<
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ix, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_ix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13005
 *         nf = objtogen(nf)
 *         ix = objtogen(ix)
 *         cdef bint _have_vdir = (vdir is not None)             # <<<<<<<<<<<<<<
 *         if _have_vdir:
 *             vdir = objtogen(vdir)
 */
  __pyx_t_2 = (__pyx_v_vdir != Py_None);
  __pyx_v__have_vdir = __pyx_t_2;

  /* "cypari/auto_instance.pxi":13006
 *         ix = objtogen(ix)
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             vdir = objtogen(vdir)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_vdir != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13007
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:
 *             vdir = objtogen(vdir)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_vdir, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13007, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_vdir, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":13006
 *         ix = objtogen(ix)
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             vdir = objtogen(vdir)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":13008
 *         if _have_vdir:
 *             vdir = objtogen(vdir)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ix = (<Gen>ix).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 13008, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13009
 *             vdir = objtogen(vdir)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13010
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ix = (<Gen>ix).g             # <<<<<<<<<<<<<<
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ix)->__pyx_base.g;
  __pyx_v__ix = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13011
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL             # <<<<<<<<<<<<<<
 *         if _have_vdir:
 *             _vdir = (<Gen>vdir).g
 */
  __pyx_v__vdir = NULL;

  /* "cypari/auto_instance.pxi":13012
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 */
  __pyx_t_2 = (__pyx_v__have_vdir != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13013
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:
 *             _vdir = (<Gen>vdir).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vdir)->__pyx_base.g;
    __pyx_v__vdir = __pyx_t_4;

    /* "cypari/auto_instance.pxi":13012
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 */
  }

  /* "cypari/auto_instance.pxi":13014
 *         if _have_vdir:
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealmin(__pyx_v__nf, __pyx_v__ix, __pyx_v__vdir);

  /* "cypari/auto_instance.pxi":13015
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealmul(self, nf, x, y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":12997
 *         return new_gen(_ret)
 * 
 *     def idealmin(self, nf, ix, vdir=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`This function is useless and kept for backward compatibility only,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_ix);
  __Pyx_XDECREF(__pyx_v_vdir);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13017
 *         return new_gen(_ret)
 * 
 *     def idealmul(self, nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ideal multiplication of the ideals :math:`x` and :math:`y` in the number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_741idealmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_740idealmul[] = "\n        Ideal multiplication of the ideals :math:`x` and :math:`y` in the number field\n        :emphasis:`nf`; the result is the ideal product in HNF. If either :math:`x` or :math:`y`\n        are extended ideals, their principal part is suitably\n        updated: i.e. multiplying :math:`[I,t]`, :math:`[J,u]` yields :math:`[IJ, tu]`; multiplying\n        :math:`I` and :math:`[J, u]` yields :math:`[IJ, u]`.\n        \n        ::\n        \n            ? nf = nfinit(x^2 + 1);\n            ? idealmul(nf, 2, x+1)\n            %2 =\n            [4 2]\n            \n            [0 2]\n            ? idealmul(nf, [2, x], x+1) \\\\ extended ideal * ideal\n            %3 = [[4, 2; 0, 2], x]\n            ? idealmul(nf, [2, x], [x+1, x]) \\\\ two extended ideals\n            %4 = [[4, 2; 0, 2], [-1, 0]~]\n        \n        If :math:`flag` is non-zero, reduce the result using :literal:`idealred`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_741idealmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_flag,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealmul", 0, 3, 4, 1); __PYX_ERR(4, 13017, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealmul", 0, 3, 4, 2); __PYX_ERR(4, 13017, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealmul") < 0)) __PYX_ERR(4, 13017, __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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13017, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealmul", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13017, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_740idealmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_740idealmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealmul", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":13040
 *         If :math:`flag` is non-zero, reduce the result using :literal:`idealred`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13041
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13042
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13043
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13043, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13044
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13045
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13046
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13047
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealmul0(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":13048
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealnorm(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13017
 *         return new_gen(_ret)
 * 
 *     def idealmul(self, nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ideal multiplication of the ideals :math:`x` and :math:`y` in the number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13050
 *         return new_gen(_ret)
 * 
 *     def idealnorm(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the norm of the ideal:math:`x` in the number field:math:`nf`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_743idealnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_742idealnorm[] = "\n        Computes the norm of the ideal\302\240:math:`x` in the number field\302\240:math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_743idealnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealnorm", 1, 2, 2, 1); __PYX_ERR(4, 13050, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealnorm") < 0)) __PYX_ERR(4, 13050, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealnorm", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13050, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_742idealnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_742idealnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealnorm", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13054
 *         Computes the norm of the ideal:math:`x` in the number field:math:`nf`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13055
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13056
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13056, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13057
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnorm(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13058
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealnorm(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13059
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnorm(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealnorm(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":13060
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnorm(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealnumden(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13050
 *         return new_gen(_ret)
 * 
 *     def idealnorm(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the norm of the ideal:math:`x` in the number field:math:`nf`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13062
 *         return new_gen(_ret)
 * 
 *     def idealnumden(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[A,B]`, where :math:`A,B` are coprime integer ideals
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_745idealnumden(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_744idealnumden[] = "\n        Returns :math:`[A,B]`, where :math:`A,B` are coprime integer ideals\n        such that :math:`x = A/B`, in the number field :math:`nf`.\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? idealnumden(nf, (x+1)/2)\n            %2 = [[1, 0; 0, 1], [2, 1; 0, 1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_745idealnumden(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealnumden (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealnumden", 1, 2, 2, 1); __PYX_ERR(4, 13062, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealnumden") < 0)) __PYX_ERR(4, 13062, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealnumden", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13062, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealnumden", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_744idealnumden(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_744idealnumden(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealnumden", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13073
 *             %2 = [[1, 0; 0, 1], [2, 1; 0, 1]]
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13074
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13075
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13075, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13076
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnumden(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13077
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealnumden(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13078
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnumden(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealnumden(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":13079
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnumden(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealpow(self, nf, x, k, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13062
 *         return new_gen(_ret)
 * 
 *     def idealnumden(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[A,B]`, where :math:`A,B` are coprime integer ideals
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealnumden", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13081
 *         return new_gen(_ret)
 * 
 *     def idealpow(self, nf, x, k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the :math:`k`-th power of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_747idealpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_746idealpow[] = "\n        Computes the :math:`k`-th power of\n        the ideal :math:`x` in the number field :math:`nf`; :math:`k\\in\\mathbb{Z}`.\n        If :math:`x` is an extended\n        ideal, its principal part is suitably\n        updated: i.e. raising :math:`[I,t]` to the :math:`k`-th power, yields :math:`[I^k, t^k]`.\n        \n        If :math:`flag` is non-zero, reduce the result using :literal:`idealred`, :emphasis:`throughout\n        the (binary) powering process`; in particular, this is :emphasis:`not` the same\n        as :math:`idealpow (nf,x,k)` followed by reduction.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_747idealpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_k = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_k,&__pyx_n_s_flag,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealpow", 0, 3, 4, 1); __PYX_ERR(4, 13081, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealpow", 0, 3, 4, 2); __PYX_ERR(4, 13081, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealpow") < 0)) __PYX_ERR(4, 13081, __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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_k = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13081, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealpow", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13081, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_746idealpow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_k, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_746idealpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealpow", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_instance.pxi":13093
 *         as :math:`idealpow (nf,x,k)` followed by reduction.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         k = objtogen(k)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13094
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         k = objtogen(k)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13095
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13096
 *         x = objtogen(x)
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13096, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13097
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13098
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13099
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13100
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealpow0(__pyx_v__nf, __pyx_v__x, __pyx_v__k, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":13101
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealprimedec(self, nf, p, long f=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13081
 *         return new_gen(_ret)
 * 
 *     def idealpow(self, nf, x, k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the :math:`k`-th power of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13103
 *         return new_gen(_ret)
 * 
 *     def idealprimedec(self, nf, p, long f=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the prime ideal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_749idealprimedec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_748idealprimedec[] = "\n        Computes the prime ideal\n        decomposition of the (positive) prime number :math:`p` in the number field :math:`K`\n        represented by :emphasis:`nf`. If a non-prime :math:`p` is given the result is undefined.\n        If :math:`f` is present and non-zero, restrict the result to primes of residue\n        degree :math:`<= f`.\n        \n        The result is a vector of :emphasis:`prid` structures, each representing one of the\n        prime ideals above :math:`p` in the number field :math:`nf`. The representation\n        :math:`pr = [p,a,e,f,mb]` of a prime ideal means the following: :math:`a`\n        is an algebraic integer in the maximal order :math:`\\mathbb{Z}_K` and the prime ideal is\n        equal to :math:`p = p\\mathbb{Z}_K + a\\mathbb{Z}_K`;\n        :math:`e` is the ramification index; :math:`f` is the residual index;\n        finally, :emphasis:`mb` is the multiplication table attached to the algebraic\n        integer :math:`b` is such that :math:`p^{-1} = \\mathbb{Z}_K+ b/ p\\mathbb{Z}_K`, which is used\n        internally to compute valuations. In other words if :math:`p` is inert,\n        then :emphasis:`mb` is the integer :math:`1`, and otherwise it is a square :literal:`t_MAT`\n        whose :math:`j`-th column is :math:`b.nf.zk[j]`.\n        \n        The algebraic number :math:`a` is guaranteed to have a\n        valuation equal to 1 at the prime ideal (this is automatic if :math:`e > 1`).\n        \n        The components of :literal:`pr` should be accessed by member functions: :literal:`pr.p`,\n        :literal:`pr.e`, :literal:`pr.f`, and :literal:`pr.gen` (returns the vector :math:`[p,a]`):\n        \n        ::\n        \n            ? K = nfinit(x^3-2);\n            ? P = idealprimedec(K, 5);\n            ? #P \\\\ 2 primes above 5 in Q(2^(1/3))\n            %3 = 2\n            ? [p1,p2] = P;\n            ? [p1.e, p1.f] \\\\ the first is unramified of degree 1\n            %5 = [1, 1]\n            ? [p2.e, p2.f] ""\\\\ the second is unramified of degree 2\n            %6 = [1, 2]\n            ? p1.gen\n            %7 = [5, [2, 1, 0]~]\n            ? nfbasistoalg(K, %[2]) \\\\ a uniformizer for p1\n            %8 = Mod(x + 2, x^3 - 2)\n            ? #idealprimedec(K, 5, 1) \\\\ restrict to f = 1\n            %9 = 1 \\\\ now only p1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_749idealprimedec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_f;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealprimedec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_p,&__pyx_n_s_f,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealprimedec", 0, 2, 3, 1); __PYX_ERR(4, 13103, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealprimedec") < 0)) __PYX_ERR(4, 13103, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_p = values[1];
    if (values[2]) {
      __pyx_v_f = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_f == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13103, __pyx_L3_error)
    } else {
      __pyx_v_f = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealprimedec", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13103, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealprimedec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_748idealprimedec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_p, __pyx_v_f);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_748idealprimedec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_p, long __pyx_v_f) {
  GEN __pyx_v__nf;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealprimedec", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":13147
 *             %9 = 1 \\ now only p1
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13148
 *         '''
 *         nf = objtogen(nf)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13149
 *         nf = objtogen(nf)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13149, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13150
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13151
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13152
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealprimedec_limit_f(__pyx_v__nf, __pyx_v__p, __pyx_v_f);

  /* "cypari/auto_instance.pxi":13153
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealprincipalunits(self, nf, pr, long k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13103
 *         return new_gen(_ret)
 * 
 *     def idealprimedec(self, nf, p, long f=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the prime ideal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealprimedec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13155
 *         return new_gen(_ret)
 * 
 *     def idealprincipalunits(self, nf, pr, long k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime ideal in :literal:`idealprimedec` format,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_751idealprincipalunits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_750idealprincipalunits[] = "\n        Given a prime ideal in :literal:`idealprimedec` format,\n        returns the multiplicative group :math:`(1 + pr) / (1 + pr^k)` as an\n        abelian group. This function is much faster than :literal:`idealstar` when the\n        norm of :emphasis:`pr` is large, since it avoids (useless) work in the\n        multiplicative group of the residue field.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K,2)[1];\n            ? G = idealprincipalunits(K, P, 20);\n            ? G.cyc\n            %4 = [512, 256, 4] \\\\ Z/512 x Z/256 x Z/4\n            ? G.gen\n            %5 = [[-1, -2]~, 1021, [0, -1]~] \\\\ minimal generators of given order\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_751idealprincipalunits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pr = 0;
  long __pyx_v_k;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealprincipalunits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pr,&__pyx_n_s_k,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealprincipalunits", 1, 3, 3, 1); __PYX_ERR(4, 13155, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealprincipalunits", 1, 3, 3, 2); __PYX_ERR(4, 13155, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealprincipalunits") < 0)) __PYX_ERR(4, 13155, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_pr = values[1];
    __pyx_v_k = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13155, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealprincipalunits", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13155, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealprincipalunits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_750idealprincipalunits(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pr, __pyx_v_k);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_750idealprincipalunits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr, long __pyx_v_k) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealprincipalunits", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":13173
 *             %5 = [[-1, -2]~, 1021, [0, -1]~] \\ minimal generators of given order
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13174
 *         '''
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13175
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13175, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13176
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13177
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13178
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealprincipalunits(__pyx_v__nf, __pyx_v__pr, __pyx_v_k);

  /* "cypari/auto_instance.pxi":13179
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealramgroups(self, nf, gal, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13155
 *         return new_gen(_ret)
 * 
 *     def idealprincipalunits(self, nf, pr, long k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime ideal in :literal:`idealprimedec` format,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealprincipalunits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13181
 *         return new_gen(_ret)
 * 
 *     def idealramgroups(self, nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :emphasis:`nf` and assume that :math:`K/\mathbb{Q}` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_753idealramgroups(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_752idealramgroups[] = "\n        Let :math:`K` be the number field defined by :emphasis:`nf` and assume that :math:`K/\\mathbb{Q}` is\n        Galois with Galois group :math:`G` given by :literal:`gal = galoisinit(nf)`.\n        Let :emphasis:`pr` be the prime ideal :math:`P` in prid format.\n        This function returns a vector :math:`g` of subgroups of :literal:`gal`\n        as follow:\n        \n        - :literal:`g[1]` is the decomposition group of :math:`P`,\n        \n        - :literal:`g[2]` is :math:`G_0(P)`, the inertia group of :math:`P`,\n        \n        and for :math:`i >= 2`,\n        \n        - :literal:`g[i]` is :math:`G_{i-2}(P)`, the :math:`i-2`-th\n          ramification group of :math:`P`.\n        \n        The length of :math:`g` is the number of non-trivial groups in the\n        sequence, thus is :math:`0` if :math:`e = 1` and :math:`f = 1`, and :math:`1` if :math:`f > 1` and :math:`e = 1`.\n        The following function computes the cardinality of a subgroup of :math:`G`,\n        as given by the components of :math:`g`:\n        \n        ::\n        \n            card(H) =my(o=H[2]); prod(i=1,#o,o[i]);\n        \n        ::\n        \n            ? nf=nfinit(x^6+3); gal=galoisinit(nf); pr=idealprimedec(nf,3)[1];\n            ? g = idealramgroups(nf, gal, pr);\n            ? apply(card,g)\n            %3 = [6, 6, 3, 3, 3] \\\\ cardinalities of the G_i\n        \n        ::\n        \n            ? nf=nfinit(x^6+108); gal=galoisinit(nf); pr=idealprimedec(nf,2)[1];\n            ? iso=idealramgroups(nf,gal,pr)[2]\n            %5 = [[Vecsmall([2, 3, 1, 5, 6, 4])], Vecsmall([3])]\n            ? nfdisc(galoisfixedfield(gal,iso,1))\n            %6 = -3\n        \n        The field fixed by the inertia group of :math:`2` is not ramified at\n        :math:`2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_753idealramgroups(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealramgroups (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_gal,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_gal)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealramgroups", 1, 3, 3, 1); __PYX_ERR(4, 13181, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealramgroups", 1, 3, 3, 2); __PYX_ERR(4, 13181, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealramgroups") < 0)) __PYX_ERR(4, 13181, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_gal = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealramgroups", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13181, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealramgroups", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_752idealramgroups(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_gal, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_752idealramgroups(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__gal;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealramgroups", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":13225
 *         :math:`2`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13226
 *         '''
 *         nf = objtogen(nf)
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13227
 *         nf = objtogen(nf)
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13228
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13228, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13229
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13230
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13231
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13232
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealramgroups(__pyx_v__nf, __pyx_v__gal, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":13233
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealred(self, nf, I, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13181
 *         return new_gen(_ret)
 * 
 *     def idealramgroups(self, nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :emphasis:`nf` and assume that :math:`K/\mathbb{Q}` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealramgroups", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13235
 *         return new_gen(_ret)
 * 
 *     def idealred(self, nf, I, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL reduction of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_755idealred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_754idealred[] = "\n        LLL reduction of\n        the ideal :math:`I` in the number field :math:`K` attached to :emphasis:`nf`, along the\n        direction :math:`v`. The :math:`v` parameter is best left omitted, but if it is present,\n        it must be an :math:`nf.r1 + nf.r2`-component vector of\n        :emphasis:`non-negative` integers. (What counts is the relative magnitude of the\n        entries: if all entries are equal, the effect is the same as if the vector\n        had been omitted.)\n        \n        This function finds an :math:`a\\in K^*` such that :math:`J = (a)I` is\n        \"small\" and integral (see the end for technical details).\n        The result is the Hermite normal form of\n        the \"reduced\" ideal :math:`J`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K,5)[1];\n            ? idealred(K, P)\n            %3 =\n            [1 0]\n            \n            [0 1]\n        \n        More often than not, a principal ideal yields the unit\n        ideal as above. This is a quick and dirty way to check if ideals are principal,\n        but it is not a necessary condition: a non-trivial result does not prove that\n        the ideal is non-principal. For guaranteed results, see :literal:`bnfisprincipal`,\n        which requires the computation of a full :literal:`bnf` structure.\n        \n        If the input is an extended ideal :math:`[I,s]`, the output is :math:`[J, sa]`; in\n        this way, one keeps track of the principal ideal part:\n        \n        ::\n        \n            ? idealred(K, [P, 1])\n            %5 = [[1, 0; 0, 1], [2, -1]~]\n        \n        meaning that :math:`P` is generated by :math:`[2, -1]`. The number field element in the\n        extended part is an algebraic number in any form :emphasis:`or` a factorization\n        matrix (in terms of number field elements, not ideals!). In the latter case,\n        elements stay in factored form, which is a convenient way to avoid""\n        coefficient explosion; see also :literal:`idealpow`.\n        \n        :strong:`Technical note.` The routine computes an LLL-reduced\n        basis for the lattice :math:`I^{-1}` equipped with the quadratic\n        form\n        \n        .. MATH::\n        \n            \\|\\| x \\|\\|_v^2 = \\sum_{i = 1}^{r_1+r_2} 2^{v_i}\\varepsilon_i\\|\\sigma_i(x)\\|^2,\n        \n        where as usual the :math:`\\sigma_i` are the (real and) complex embeddings and\n        :math:`\\varepsilon_i = 1`, resp.\302\240:math:`2`, for a real, resp.\302\240complex place. The element\n        :math:`a` is simply the first vector in the LLL basis. The only reason you may want\n        to try to change some directions and set some :math:`v_i != 0` is to randomize\n        the elements found for a fixed ideal, which is heuristically useful in index\n        calculus algorithms like :literal:`bnfinit` and :literal:`bnfisprincipal`.\n        \n        :strong:`Even more technical note.` In fact, the above is a white lie.\n        We do not use :math:`\\|\\|.\\|\\|_v` exactly but a rescaled rounded variant which\n        gets us faster and simpler LLLs. There's no harm since we are not using any\n        theoretical property of :math:`a` after all, except that it belongs to :math:`I^{-1}`\n        and that :math:`a I` is \"expected to be small\".\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_755idealred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_I,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_I)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealred", 0, 2, 3, 1); __PYX_ERR(4, 13235, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealred") < 0)) __PYX_ERR(4, 13235, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_I = values[1];
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealred", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13235, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_754idealred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_I, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_754idealred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_I, PyObject *__pyx_v_v) {
  int __pyx_v__have_v;
  GEN __pyx_v__nf;
  GEN __pyx_v__I;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealred", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_I);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":13301
 *         and that :math:`a I` is "expected to be small".
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         I = objtogen(I)
 *         cdef bint _have_v = (v is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13302
 *         '''
 *         nf = objtogen(nf)
 *         I = objtogen(I)             # <<<<<<<<<<<<<<
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_I, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_I, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13303
 *         nf = objtogen(nf)
 *         I = objtogen(I)
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_2;

  /* "cypari/auto_instance.pxi":13304
 *         I = objtogen(I)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13305
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":13304
 *         I = objtogen(I)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":13306
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _I = (<Gen>I).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 13306, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13307
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13308
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _I = (<Gen>I).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_I)->__pyx_base.g;
  __pyx_v__I = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13309
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_instance.pxi":13310
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13311
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":13310
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 */
  }

  /* "cypari/auto_instance.pxi":13312
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealred0(__pyx_v__nf, __pyx_v__I, __pyx_v__v);

  /* "cypari/auto_instance.pxi":13313
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealredmodpower(self, nf, x, unsigned long n, unsigned long B=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13235
 *         return new_gen(_ret)
 * 
 *     def idealred(self, nf, I, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL reduction of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_I);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13315
 *         return new_gen(_ret)
 * 
 *     def idealredmodpower(self, nf, x, unsigned long n, unsigned long B=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field, :math:`x` an ideal in :emphasis:`nf` and :math:`n > 0` be a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_757idealredmodpower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_756idealredmodpower[] = "\n        Let :emphasis:`nf` be a number field, :math:`x` an ideal in :emphasis:`nf` and :math:`n > 0` be a\n        positive integer. Return a number field element :math:`b` such that :math:`x b^n = v`\n        is small. If :math:`x` is integral, then :math:`v` is also integral.\n        \n        More precisely, :literal:`idealnumden` reduces the problem to :math:`x` integral. Then,\n        factoring out the prime ideals dividing a rational prime :math:`p <= B`,\n        we rewrite :math:`x = I J^n` where the ideals :math:`I` and :math:`J` are both integral and\n        :math:`I` is :math:`B`-smooth. Then we return a small element :math:`b` in :math:`J^{-1}`.\n        \n        The bound :math:`B` avoids a costly complete factorization of :math:`x`; as soon as the\n        :math:`n`-core of :math:`x` is :math:`B`-smooth (i.e., as soon as :math:`I` is :math:`n`-power free),\n        then :math:`J` is as large as possible and so is the expected reduction.\n        \n        ::\n        \n            ? T = x^6+108; nf = nfinit(T); a = Mod(x,T);\n            ? setrand(1); u = (2*a^2+a+3)*random(2^1000*x^6)^6;\n            ? sizebyte(u)\n            %3 = 4864\n            ? b = idealredmodpower(nf,u,2);\n            ? v2 = nfeltmul(nf,u, nfeltpow(nf,b,2))\n            %5 = [34, 47, 15, 35, 9, 3]~\n            ? b = idealredmodpower(nf,u,6);\n            ? v6 = nfeltmul(nf,u, nfeltpow(nf,b,6))\n            %7 = [3, 0, 2, 6, -7, 1]~\n        \n        The last element :literal:`v6`, obtained by reducing\n        modulo :math:`6`-th powers instead of squares, looks smaller than :literal:`v2`\n        but its norm is actually a little larger:\n        \n        ::\n        \n            ? idealnorm(nf,v2)\n            %8 = 81309\n            ? idealnorm(nf,v6)\n            %9 = 731781\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_757idealredmodpower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  unsigned long __pyx_v_n;
  unsigned long __pyx_v_B;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealredmodpower (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_n,&__pyx_n_s_B,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealredmodpower", 0, 3, 4, 1); __PYX_ERR(4, 13315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealredmodpower", 0, 3, 4, 2); __PYX_ERR(4, 13315, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealredmodpower") < 0)) __PYX_ERR(4, 13315, __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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_n = __Pyx_PyInt_As_unsigned_long(values[2]); if (unlikely((__pyx_v_n == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13315, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_B = __Pyx_PyInt_As_unsigned_long(values[3]); if (unlikely((__pyx_v_B == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13315, __pyx_L3_error)
    } else {
      __pyx_v_B = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealredmodpower", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13315, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealredmodpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_756idealredmodpower(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_n, __pyx_v_B);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_756idealredmodpower(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, unsigned long __pyx_v_n, unsigned long __pyx_v_B) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealredmodpower", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13354
 *             %9 = 731781
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13355
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13356
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13356, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13357
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13358
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13359
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealredmodpower(__pyx_v__nf, __pyx_v__x, __pyx_v_n, __pyx_v_B);

  /* "cypari/auto_instance.pxi":13360
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealstar(self, nf=None, N=None, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13315
 *         return new_gen(_ret)
 * 
 *     def idealredmodpower(self, nf, x, unsigned long n, unsigned long B=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field, :math:`x` an ideal in :emphasis:`nf` and :math:`n > 0` be a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealredmodpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13362
 *         return new_gen(_ret)
 * 
 *     def idealstar(self, nf=None, N=None, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs a :literal:`bid` structure,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_759idealstar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_758idealstar[] = "\n        Outputs a :literal:`bid` structure,\n        necessary for computing in the finite abelian group :math:`G = (\\mathbb{Z}_K/N)^*`. Here,\n        :emphasis:`nf` is a number field and :math:`N` is a :emphasis:`modulus`: either an ideal in any\n        form, or a row vector whose first component is an ideal and whose second\n        component is a row vector of :math:`r_1` 0 or 1. Ideals can also be given\n        by a factorization into prime ideals, as produced by :literal:`idealfactor`.\n        \n        This :emphasis:`bid` is used in :literal:`ideallog` to compute discrete logarithms. It\n        also contains useful information which can be conveniently retrieved as\n        :literal:`:emphasis:`bid`.mod` (the modulus),\n        :literal:`:emphasis:`bid`.clgp` (:math:`G` as a finite abelian group),\n        :literal:`:emphasis:`bid`.no` (the cardinality of :math:`G`),\n        :literal:`:emphasis:`bid`.cyc` (elementary divisors) and\n        :literal:`:emphasis:`bid`.gen` (generators).\n        \n        If :math:`flag = 1` (default), the result is a :literal:`bid` structure without\n        generators: they are well defined but not explicitly computed, which saves\n        time.\n        \n        If :math:`flag = 2`, as :math:`flag = 1`, but including generators.\n        \n        If :math:`flag = 0`, only outputs :math:`(\\mathbb{Z}_K/N)^*` as an abelian group,\n        i.e as a 3-component vector :math:`[h,d,g]`: :math:`h` is the order, :math:`d` is the vector of\n        SNF cyclic components and :math:`g` the corresponding\n        generators.\n        \n        If :emphasis:`nf` is omitted, we take it to be the rational number fields, :math:`N` must\n        be an integer and we return the structure of :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`. In other words\n        :literal:`idealstar(, N, flag)` is short for\n        \n        ::\n        \n             idealstar(nfinit(x), N, flag)\n        \n        but faster. The alternative syntax :literal:""`znstar(N, flag)`\n        is also available for an analogous effect but, due to an unfortunate\n        historical oversight, the default value of :literal:`flag` is different in\n        the two functions (:literal:`znstar` does not initialize by default, you probably\n        want :literal:`znstar(N,1)`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_759idealstar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_N = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealstar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_N,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealstar") < 0)) __PYX_ERR(4, 13362, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_nf = values[0];
    __pyx_v_N = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13362, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealstar", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13362, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_758idealstar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_N, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_758idealstar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_N, long __pyx_v_flag) {
  int __pyx_v__have_nf;
  GEN __pyx_v__nf;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("idealstar", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":13404
 *         want :literal:`znstar(N,1)`).
 *         '''
 *         cdef bint _have_nf = (nf is not None)             # <<<<<<<<<<<<<<
 *         if _have_nf:
 *             nf = objtogen(nf)
 */
  __pyx_t_1 = (__pyx_v_nf != Py_None);
  __pyx_v__have_nf = __pyx_t_1;

  /* "cypari/auto_instance.pxi":13405
 *         '''
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             nf = objtogen(nf)
 *         if N is None:
 */
  __pyx_t_1 = (__pyx_v__have_nf != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":13406
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:
 *             nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         if N is None:
 *             raise TypeError("missing required argument: 'N'")
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":13405
 *         '''
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             nf = objtogen(nf)
 *         if N is None:
 */
  }

  /* "cypari/auto_instance.pxi":13407
 *         if _have_nf:
 *             nf = objtogen(nf)
 *         if N is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'N'")
 *         N = objtogen(N)
 */
  __pyx_t_1 = (__pyx_v_N == Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "cypari/auto_instance.pxi":13408
 *             nf = objtogen(nf)
 *         if N is None:
 *             raise TypeError("missing required argument: 'N'")             # <<<<<<<<<<<<<<
 *         N = objtogen(N)
 *         sig_on()
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 13408, __pyx_L1_error)

    /* "cypari/auto_instance.pxi":13407
 *         if _have_nf:
 *             nf = objtogen(nf)
 *         if N is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'N'")
 *         N = objtogen(N)
 */
  }

  /* "cypari/auto_instance.pxi":13409
 *         if N is None:
 *             raise TypeError("missing required argument: 'N'")
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = NULL
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":13410
 *             raise TypeError("missing required argument: 'N'")
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = NULL
 *         if _have_nf:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 13410, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13411
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _nf = NULL             # <<<<<<<<<<<<<<
 *         if _have_nf:
 *             _nf = (<Gen>nf).g
 */
  __pyx_v__nf = NULL;

  /* "cypari/auto_instance.pxi":13412
 *         sig_on()
 *         cdef GEN _nf = NULL
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             _nf = (<Gen>nf).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_3 = (__pyx_v__have_nf != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":13413
 *         cdef GEN _nf = NULL
 *         if _have_nf:
 *             _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
    __pyx_v__nf = __pyx_t_5;

    /* "cypari/auto_instance.pxi":13412
 *         sig_on()
 *         cdef GEN _nf = NULL
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             _nf = (<Gen>nf).g
 *         cdef GEN _N = (<Gen>N).g
 */
  }

  /* "cypari/auto_instance.pxi":13414
 *         if _have_nf:
 *             _nf = (<Gen>nf).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_5;

  /* "cypari/auto_instance.pxi":13415
 *             _nf = (<Gen>nf).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealstar0(__pyx_v__nf, __pyx_v__N, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":13416
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealtwoelt(self, nf, x, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13362
 *         return new_gen(_ret)
 * 
 *     def idealstar(self, nf=None, N=None, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs a :literal:`bid` structure,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13418
 *         return new_gen(_ret)
 * 
 *     def idealtwoelt(self, nf, x, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a two-element representation of the ideal :math:`x` in the number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_761idealtwoelt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_760idealtwoelt[] = "\n        Computes a two-element representation of the ideal :math:`x` in the number\n        field :math:`nf`, combining a random search and an approximation theorem; :math:`x`\n        is an ideal in any form (possibly an extended ideal, whose principal part is\n        ignored)\n        \n        - When called as :literal:`idealtwoelt(nf,x)`, the result is a row vector\n          :math:`[a,\\alpha]` with two components such that :math:`x = a\\mathbb{Z}_K+\\alpha\\mathbb{Z}_K` and :math:`a` is\n          chosen to be the positive generator of :math:`x\\cap\\mathbb{Z}`, unless :math:`x` was given as a\n          principal ideal in which case we may choose :math:`a = 0`. The algorithm\n          uses a fast lazy factorization of :math:`x\\cap \\mathbb{Z}` and runs in randomized\n          polynomial time.\n        \n        ::\n        \n            ? K = nfinit(t^5-23);\n            ? x = idealhnf(K, t^2*(t+1), t^3*(t+1))\n            %2 = \\\\ some random ideal of norm 552*23\n            [552 23 23 529 23]\n            \n            [ 0 23 0 0 0]\n            \n            [ 0 0 1 0 0]\n            \n            [ 0 0 0 1 0]\n            \n            [ 0 0 0 0 1]\n            \n            ? [a,alpha] = idealtwoelt(K, x)\n            %3 = [552, [23, 0, 1, 0, 0]~]\n            ? nfbasistoalg(K, alpha)\n            %4 = Mod(t^2 + 23, t^5 - 23)\n        \n        - When called as :literal:`idealtwoelt(nf,x,a)` with an explicit non-zero :math:`a`\n          supplied as third argument, the function assumes that :math:`a \\in x` and returns\n          :math:`\\alpha\\in x` such that :math:`x = a\\mathbb{Z}_K + \\alpha\\mathbb{Z}_K`. Note that we must factor\n          :math:`a` in this case, and the algorithm is generally slower than the\n          default variant and gives larger generators:\n        \n        ::\n        \n            ? alpha2 = idealtwoelt(K, x, 552)\n            %5 = [-161, -161, -183, -207, 0]~\n            ? idealhnf(K, 552, alpha2) == x\n      ""      %6 = 1\n        \n        Note that, in both cases, the return value is :emphasis:`not`\n        recognized as an ideal by GP functions; one must use :literal:`idealhnf` as\n        above to recover a valid ideal structure from the two-element representation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_761idealtwoelt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealtwoelt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_a,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealtwoelt", 0, 2, 3, 1); __PYX_ERR(4, 13418, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealtwoelt") < 0)) __PYX_ERR(4, 13418, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_a = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealtwoelt", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13418, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealtwoelt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_760idealtwoelt(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_760idealtwoelt(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_a) {
  int __pyx_v__have_a;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealtwoelt", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":13469
 *         above to recover a valid ideal structure from the two-element representation.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_a = (a is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13470
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13471
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_2 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_2;

  /* "cypari/auto_instance.pxi":13472
 *         x = objtogen(x)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13473
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":13472
 *         x = objtogen(x)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":13474
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 13474, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13475
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13476
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13477
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":13478
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13479
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_instance.pxi":13478
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 */
  }

  /* "cypari/auto_instance.pxi":13480
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealtwoelt0(__pyx_v__nf, __pyx_v__x, __pyx_v__a);

  /* "cypari/auto_instance.pxi":13481
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealval(self, nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13418
 *         return new_gen(_ret)
 * 
 *     def idealtwoelt(self, nf, x, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a two-element representation of the ideal :math:`x` in the number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealtwoelt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13483
 *         return new_gen(_ret)
 * 
 *     def idealval(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the valuation of the ideal :math:`x` at the prime ideal :emphasis:`pr` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_763idealval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_762idealval[] = "\n        Gives the valuation of the ideal :math:`x` at the prime ideal :emphasis:`pr` in the\n        number field :math:`nf`, where :emphasis:`pr` is in :literal:`idealprimedec` format.\n        The valuation of the :math:`0` ideal is :literal:`+oo`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_763idealval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealval", 1, 3, 3, 1); __PYX_ERR(4, 13483, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealval", 1, 3, 3, 2); __PYX_ERR(4, 13483, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealval") < 0)) __PYX_ERR(4, 13483, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealval", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13483, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_762idealval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_762idealval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealval", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":13489
 *         The valuation of the :math:`0` ideal is :literal:`+oo`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13490
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13491
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13492
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13492, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13493
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13494
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13495
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13496
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpidealval(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":13497
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def imag(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13483
 *         return new_gen(_ret)
 * 
 *     def idealval(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the valuation of the ideal :math:`x` at the prime ideal :emphasis:`pr` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.idealval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13499
 *         return new_gen(_ret)
 * 
 *     def imag(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Imaginary part of :math:`x`. When :math:`x` is a quadratic number, this is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_765imag(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_764imag[] = "\n        Imaginary part of :math:`x`. When :math:`x` is a quadratic number, this is the\n        coefficient of :math:`\\omega` in the \"canonical\" integral basis :math:`(1,\\omega)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_765imag(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("imag (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_764imag(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_764imag(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("imag", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13504
 *         coefficient of :math:`\omega` in the "canonical" integral basis :math:`(1,\omega)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13505
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gimag(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13505, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13506
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gimag(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13507
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gimag(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gimag(__pyx_v__x);

  /* "cypari/auto_instance.pxi":13508
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gimag(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def incgam(self, s, x, g=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13499
 *         return new_gen(_ret)
 * 
 *     def imag(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Imaginary part of :math:`x`. When :math:`x` is a quadratic number, this is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.imag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13510
 *         return new_gen(_ret)
 * 
 *     def incgam(self, s, x, g=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Incomplete gamma function :math:`\int_x^ oo e^{-t}t^{s-1}dt`, extended by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_767incgam(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_766incgam[] = "\n        Incomplete gamma function :math:`\\int_x^ oo e^{-t}t^{s-1}dt`, extended by\n        analytic continuation to all complex :math:`x, s` not both :math:`0`. The relative error\n        is bounded in terms of the precision of :math:`s` (the accuracy of :math:`x` is ignored\n        when determining the output precision). When :math:`g` is given, assume that\n        :math:`g = \\Gamma (s)`. For small :math:`\\|x\\|`, this will speed up the computation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_767incgam(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_g = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("incgam (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_x,&__pyx_n_s_g,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_s)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("incgam", 0, 2, 4, 1); __PYX_ERR(4, 13510, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "incgam") < 0)) __PYX_ERR(4, 13510, __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);
        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_s = values[0];
    __pyx_v_x = values[1];
    __pyx_v_g = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13510, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("incgam", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13510, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.incgam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_766incgam(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_x, __pyx_v_g, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_766incgam(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_x, PyObject *__pyx_v_g, long __pyx_v_precision) {
  int __pyx_v__have_g;
  GEN __pyx_v__s;
  GEN __pyx_v__x;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("incgam", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_instance.pxi":13518
 *         :math:`g = \Gamma (s)`. For small :math:`\|x\|`, this will speed up the computation.
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_g = (g is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13519
 *         '''
 *         s = objtogen(s)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13520
 *         s = objtogen(s)
 *         x = objtogen(x)
 *         cdef bint _have_g = (g is not None)             # <<<<<<<<<<<<<<
 *         if _have_g:
 *             g = objtogen(g)
 */
  __pyx_t_2 = (__pyx_v_g != Py_None);
  __pyx_v__have_g = __pyx_t_2;

  /* "cypari/auto_instance.pxi":13521
 *         x = objtogen(x)
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             g = objtogen(g)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_g != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13522
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:
 *             g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13522, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":13521
 *         x = objtogen(x)
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             g = objtogen(g)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":13523
 *         if _have_g:
 *             g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 13523, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13524
 *             g = objtogen(g)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13525
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = NULL
 *         if _have_g:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":13526
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL             # <<<<<<<<<<<<<<
 *         if _have_g:
 *             _g = (<Gen>g).g
 */
  __pyx_v__g = NULL;

  /* "cypari/auto_instance.pxi":13527
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_g != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":13528
 *         cdef GEN _g = NULL
 *         if _have_g:
 *             _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
    __pyx_v__g = __pyx_t_4;

    /* "cypari/auto_instance.pxi":13527
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":13529
 *         if _have_g:
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":13530
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = incgam0(__pyx_v__s, __pyx_v__x, __pyx_v__g, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":13531
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def incgamc(self, s, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13510
 *         return new_gen(_ret)
 * 
 *     def incgam(self, s, x, g=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Incomplete gamma function :math:`\int_x^ oo e^{-t}t^{s-1}dt`, extended by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.incgam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13533
 *         return new_gen(_ret)
 * 
 *     def incgamc(self, s, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary incomplete gamma function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_769incgamc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_768incgamc[] = "\n        Complementary incomplete gamma function.\n        The arguments :math:`x` and :math:`s` are complex numbers such that :math:`s` is not a pole of\n        :math:`\\Gamma` and :math:`\\|x\\|/(\\|s\\|+1)` is not much larger than 1 (otherwise the\n        convergence is very slow). The result returned is :math:`\\int_0^x\n        e^{-t}t^{s-1}dt`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_769incgamc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("incgamc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("incgamc", 0, 2, 3, 1); __PYX_ERR(4, 13533, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "incgamc") < 0)) __PYX_ERR(4, 13533, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_s = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13533, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("incgamc", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13533, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.incgamc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_768incgamc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_768incgamc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("incgamc", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13541
 *         e^{-t}t^{s-1}dt`.
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13542
 *         '''
 *         s = objtogen(s)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13543
 *         s = objtogen(s)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13543, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13544
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13545
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgamc(_s, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13546
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = incgamc(_s, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":13547
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgamc(_s, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = incgamc(__pyx_v__s, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":13548
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgamc(_s, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def input(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13533
 *         return new_gen(_ret)
 * 
 *     def incgamc(self, s, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary incomplete gamma function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.incgamc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13550
 *         return new_gen(_ret)
 * 
 *     def input(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads a string, interpreted as a GP expression,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_771input(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_770input[] = "\n        Reads a string, interpreted as a GP expression,\n        from the input file, usually standard input (i.e.\302\240the keyboard). If a\n        sequence of expressions is given, the result is the result of the last\n        expression of the sequence. When using this instruction, it is useful to\n        prompt for the string by using the :literal:`print1` function. Note that in the\n        present version 2.19 of :literal:`pari.el`, when using :literal:`gp` under GNU Emacs (see\n        ``emacs`` (in the PARI manual)) one :emphasis:`must` prompt for the string, with a string\n        which ends with the same prompt as any of the previous ones (a :literal:`\"? \"`\n        will do for instance).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_771input(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("input (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_770input(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_770input(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("input", 0);

  /* "cypari/auto_instance.pxi":13562
 *         will do for instance).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gp_input()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 13562, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13563
 *         '''
 *         sig_on()
 *         cdef GEN _ret = gp_input()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gp_input();

  /* "cypari/auto_instance.pxi":13564
 *         sig_on()
 *         cdef GEN _ret = gp_input()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def install(self, name, code, gpname=None, lib=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13550
 *         return new_gen(_ret)
 * 
 *     def input(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads a string, interpreted as a GP expression,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.input", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13566
 *         return new_gen(_ret)
 * 
 *     def install(self, name, code, gpname=None, lib=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Loads from dynamic library :emphasis:`lib` the function :emphasis:`name`. Assigns to it
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_773install(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_772install[] = "\n        Loads from dynamic library :emphasis:`lib` the function :emphasis:`name`. Assigns to it\n        the name :emphasis:`gpname` in this :literal:`gp` session, with :emphasis:`prototype`\n        :emphasis:`code` (see below). If :emphasis:`gpname` is omitted, uses :emphasis:`name`.\n        If :emphasis:`lib` is omitted, all symbols known to :literal:`gp` are available: this\n        includes the whole of :literal:`libpari.so` and possibly others (such as\n        :literal:`libc.so`).\n        \n        Most importantly, :literal:`install` gives you access to all non-static functions\n        defined in the PARI library. For instance, the function\n        \n        ::\n        \n             GEN addii(GEN x, GEN y)\n        \n        adds two PARI integers, and is not directly accessible under\n        :literal:`gp` (it is eventually called by the :literal:`+` operator of course):\n        \n        ::\n        \n            ? install(\"addii\", \"GG\")\n            ? addii(1, 2)\n            %1 = 3\n        \n        It also allows to add external functions to the :literal:`gp` interpreter.\n        For instance, it makes the function :literal:`system` obsolete:\n        \n        ::\n        \n            ? install(system, vs, sys,/*omitted*/)\n            ? sys(\"ls gp*\")\n            gp.c gp.h gp_rl.c\n        \n        This works because :literal:`system` is part of :literal:`libc.so`,\n        which is linked to :literal:`gp`. It is also possible to compile a shared library\n        yourself and provide it to gp in this way: use :literal:`gp2c`, or do it manually\n        (see the :literal:`modules_build` variable in :literal:`pari.cfg` for hints).\n        \n        Re-installing a function will print a warning and update the prototype code\n        if needed. However, it will not reload a symbol from the library, even if the\n        latter has been recompiled.\n        \n        :strong:`Prototype.` We only give a simplified description here, coveri""ng\n        most functions, but there are many more possibilities. The full documentation\n        is available in :literal:`libpari.dvi`, see\n        \n        ::\n        \n             \077\077prototype\n        \n        - First character :literal:`i`, :literal:`l`, :literal:`v` : return type int / long /\n          void. (Default: :literal:`GEN`)\n        \n        - One letter for each mandatory argument, in the same order as they appear\n          in the argument list: :literal:`G` (:literal:`GEN`), :literal:`&`\n          (:literal:`GEN*`), :literal:`L` (:literal:`long`), :literal:`s` (:literal:`char *`), :literal:`n`\n          (variable).\n        \n        - :literal:`p` to supply :literal:`realprecision` (usually :literal:`long prec` in the\n          argument list), :literal:`P` to supply :literal:`seriesprecision`\n          (usually :literal:`long precdl`).\n        \n        We also have special constructs for optional arguments and default\n        values:\n        \n        - :literal:`DG` (optional :literal:`GEN`, :literal:`NULL` if omitted),\n        \n        - :literal:`D&` (optional :literal:`GEN*`, :literal:`NULL` if omitted),\n        \n        - :literal:`Dn` (optional variable, :math:`-1` if omitted),\n        \n        For instance the prototype corresponding to\n        \n        ::\n        \n             long issquareall(GEN x, GEN *n = NULL)\n        \n        is :literal:`lGD&`.\n        \n        :strong:`Caution.` This function may not work on all systems, especially\n        when :literal:`gp` has been compiled statically. In that case, the first use of an\n        installed function will provoke a Segmentation Fault (this should never\n        happen with a dynamically linked executable). If you intend to use this\n        function, please check first on some harmless example such as the one above\n        that it works properly on your machine.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_773install(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_code = 0;
  PyObject *__pyx_v_gpname = 0;
  PyObject *__pyx_v_lib = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("install (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_code,&__pyx_n_s_gpname,&__pyx_n_s_lib,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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_name)) != 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_code)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("install", 0, 2, 4, 1); __PYX_ERR(4, 13566, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gpname);
          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_lib);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "install") < 0)) __PYX_ERR(4, 13566, __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);
        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_name = values[0];
    __pyx_v_code = values[1];
    __pyx_v_gpname = values[2];
    __pyx_v_lib = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("install", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13566, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.install", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_772install(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_name, __pyx_v_code, __pyx_v_gpname, __pyx_v_lib);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_772install(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_code, PyObject *__pyx_v_gpname, PyObject *__pyx_v_lib) {
  char *__pyx_v__name;
  char *__pyx_v__code;
  char *__pyx_v__gpname;
  char *__pyx_v__lib;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("install", 0);
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_INCREF(__pyx_v_code);
  __Pyx_INCREF(__pyx_v_gpname);
  __Pyx_INCREF(__pyx_v_lib);

  /* "cypari/auto_instance.pxi":13653
 *         that it works properly on your machine.
 *         '''
 *         name = to_bytes(name)             # <<<<<<<<<<<<<<
 *         cdef char* _name = <bytes>name
 *         code = to_bytes(code)
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13654
 *         '''
 *         name = to_bytes(name)
 *         cdef char* _name = <bytes>name             # <<<<<<<<<<<<<<
 *         code = to_bytes(code)
 *         cdef char* _code = <bytes>code
 */
  if (unlikely(__pyx_v_name == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 13654, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_name); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 13654, __pyx_L1_error)
  __pyx_v__name = __pyx_t_2;

  /* "cypari/auto_instance.pxi":13655
 *         name = to_bytes(name)
 *         cdef char* _name = <bytes>name
 *         code = to_bytes(code)             # <<<<<<<<<<<<<<
 *         cdef char* _code = <bytes>code
 *         cdef char* _gpname
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_code, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13656
 *         cdef char* _name = <bytes>name
 *         code = to_bytes(code)
 *         cdef char* _code = <bytes>code             # <<<<<<<<<<<<<<
 *         cdef char* _gpname
 *         if gpname is None:
 */
  if (unlikely(__pyx_v_code == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 13656, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_code); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 13656, __pyx_L1_error)
  __pyx_v__code = __pyx_t_2;

  /* "cypari/auto_instance.pxi":13658
 *         cdef char* _code = <bytes>code
 *         cdef char* _gpname
 *         if gpname is None:             # <<<<<<<<<<<<<<
 *             _gpname = ""
 *         else:
 */
  __pyx_t_3 = (__pyx_v_gpname == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":13659
 *         cdef char* _gpname
 *         if gpname is None:
 *             _gpname = ""             # <<<<<<<<<<<<<<
 *         else:
 *             gpname = to_bytes(gpname)
 */
    __pyx_v__gpname = ((char *)"");

    /* "cypari/auto_instance.pxi":13658
 *         cdef char* _code = <bytes>code
 *         cdef char* _gpname
 *         if gpname is None:             # <<<<<<<<<<<<<<
 *             _gpname = ""
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/auto_instance.pxi":13661
 *             _gpname = ""
 *         else:
 *             gpname = to_bytes(gpname)             # <<<<<<<<<<<<<<
 *             _gpname = <bytes>gpname
 *         cdef char* _lib
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_gpname); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_gpname, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":13662
 *         else:
 *             gpname = to_bytes(gpname)
 *             _gpname = <bytes>gpname             # <<<<<<<<<<<<<<
 *         cdef char* _lib
 *         if lib is None:
 */
    if (unlikely(__pyx_v_gpname == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 13662, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_gpname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 13662, __pyx_L1_error)
    __pyx_v__gpname = __pyx_t_2;
  }
  __pyx_L3:;

  /* "cypari/auto_instance.pxi":13664
 *             _gpname = <bytes>gpname
 *         cdef char* _lib
 *         if lib is None:             # <<<<<<<<<<<<<<
 *             _lib = ""
 *         else:
 */
  __pyx_t_4 = (__pyx_v_lib == Py_None);
  __pyx_t_3 = (__pyx_t_4 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":13665
 *         cdef char* _lib
 *         if lib is None:
 *             _lib = ""             # <<<<<<<<<<<<<<
 *         else:
 *             lib = to_bytes(lib)
 */
    __pyx_v__lib = ((char *)"");

    /* "cypari/auto_instance.pxi":13664
 *             _gpname = <bytes>gpname
 *         cdef char* _lib
 *         if lib is None:             # <<<<<<<<<<<<<<
 *             _lib = ""
 *         else:
 */
    goto __pyx_L4;
  }

  /* "cypari/auto_instance.pxi":13667
 *             _lib = ""
 *         else:
 *             lib = to_bytes(lib)             # <<<<<<<<<<<<<<
 *             _lib = <bytes>lib
 *         sig_on()
 */
  /*else*/ {
    __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_lib); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_lib, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":13668
 *         else:
 *             lib = to_bytes(lib)
 *             _lib = <bytes>lib             # <<<<<<<<<<<<<<
 *         sig_on()
 *         gpinstall(_name, _code, _gpname, _lib)
 */
    if (unlikely(__pyx_v_lib == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 13668, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_lib); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 13668, __pyx_L1_error)
    __pyx_v__lib = __pyx_t_2;
  }
  __pyx_L4:;

  /* "cypari/auto_instance.pxi":13669
 *             lib = to_bytes(lib)
 *             _lib = <bytes>lib
 *         sig_on()             # <<<<<<<<<<<<<<
 *         gpinstall(_name, _code, _gpname, _lib)
 *         clear_stack()
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 13669, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13670
 *             _lib = <bytes>lib
 *         sig_on()
 *         gpinstall(_name, _code, _gpname, _lib)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gpinstall(__pyx_v__name, __pyx_v__code, __pyx_v__gpname, __pyx_v__lib);

  /* "cypari/auto_instance.pxi":13671
 *         sig_on()
 *         gpinstall(_name, _code, _gpname, _lib)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def intformal(self, x, v=None):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":13566
 *         return new_gen(_ret)
 * 
 *     def install(self, name, code, gpname=None, lib=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Loads from dynamic library :emphasis:`lib` the function :emphasis:`name`. Assigns to it
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.install", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XDECREF(__pyx_v_code);
  __Pyx_XDECREF(__pyx_v_gpname);
  __Pyx_XDECREF(__pyx_v_lib);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13673
 *         clear_stack()
 * 
 *     def intformal(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal integration of :math:`x` with respect to the variable :math:`v` (wrt.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_775intformal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_774intformal[] = "\n        formal integration of :math:`x` with respect to the variable :math:`v` (wrt.\n        the main variable if :math:`v` is omitted). Since PARI cannot represent\n        logarithmic or arctangent terms, any such term in the result will yield an\n        error:\n        \n        ::\n        \n             ? intformal(x^2)\n             %1 = 1/3*x^3\n             ? intformal(x^2, y)\n             %2 = y*x^2\n             ? intformal(1/x)\n             *** at top-level: intformal(1/x)\n             *** ^--------------\n             *** intformal: domain error in intformal: residue(series, pole) != 0\n        \n        The argument :math:`x` can be of any type. When :math:`x` is a rational function, we\n        assume that the base ring is an integral domain of characteristic zero.\n        \n        By definition, the main variable of a :literal:`t_POLMOD` is the main variable\n        among the coefficients from its two polynomial components\n        (representative and modulus); in other words, assuming a polmod represents an\n        element of :math:`R[X]/(T(X))`, the variable :math:`X` is a mute variable and the\n        integral is taken with respect to the main variable used in the base ring :math:`R`.\n        In particular, it is meaningless to integrate with respect to the main\n        variable of :literal:`x.mod`:\n        \n        ::\n        \n            ? intformal(Mod(1,x^2+1), 'x)\n            *** intformal: incorrect priority in intformal: variable x = x\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_775intformal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("intformal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "intformal") < 0)) __PYX_ERR(4, 13673, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("intformal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13673, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.intformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_774intformal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_774intformal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("intformal", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13707
 *             *** intformal: incorrect priority in intformal: variable x = x
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13708
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":13709
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":13710
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 13710, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":13709
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":13711
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = integ(_x, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 13711, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13712
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = integ(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":13713
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = integ(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = integ(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":13714
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = integ(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def intnumgaussinit(self, long n=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13673
 *         clear_stack()
 * 
 *     def intformal(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal integration of :math:`x` with respect to the variable :math:`v` (wrt.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.intformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13716
 *         return new_gen(_ret)
 * 
 *     def intnumgaussinit(self, long n=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for :math:`n`-point Gauss-Legendre integration of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_777intnumgaussinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_776intnumgaussinit[] = "\n        Initialize tables for :math:`n`-point Gauss-Legendre integration of\n        a smooth function :math:`f` lon a compact\n        interval :math:`[a,b]` at current :literal:`realprecision`. If :math:`n` is omitted, make a\n        default choice :math:`n ~ realprecision`, suitable for analytic\n        functions on :math:`[-1,1]`. The error is bounded by\n        \n        .. MATH::\n        \n            ((b-a)^{2n+1} (n!)^4)/((2n+1)[(2n)!]^3) f^{(2n)} (\\xi) ,\n            a < \\xi < b\n        \n        so, if the interval length increases, :math:`n` should be increased as well.\n        \n        ::\n        \n            ? T = intnumgaussinit();\n            ? intnumgauss(t=-1,1,exp(t), T) - exp(1)+exp(-1)\n            %1 = -5.877471754111437540 E-39\n            ? intnumgauss(t=-10,10,exp(t), T) - exp(10)+exp(-10)\n            %2 = -8.358367809712546836 E-35\n            ? intnumgauss(t=-1,1,1/(1+t^2), T) - Pi/2\n            %3 = -9.490148553624725335 E-22\n            \n            ? T = intnumgaussinit(50);\n            ? intnumgauss(t=-1,1,1/(1+t^2), T) - Pi/2\n            %5 = -1.1754943508222875080 E-38\n            ? intnumgauss(t=-5,5,1/(1+t^2), T) - 2*atan(5)\n            %6 = -1.2[...]E-8\n        \n        On the other hand, we recommend to split the integral and change variables\n        rather than increasing :math:`n` too much, see :literal:`intnumgauss`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_777intnumgaussinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("intnumgaussinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "intnumgaussinit") < 0)) __PYX_ERR(4, 13716, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13716, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13716, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("intnumgaussinit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13716, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.intnumgaussinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_776intnumgaussinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_776intnumgaussinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("intnumgaussinit", 0);

  /* "cypari/auto_instance.pxi":13750
 *         rather than increasing :math:`n` too much, see :literal:`intnumgauss`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnumgaussinit(n, precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 13750, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13751
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = intnumgaussinit(n, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":13752
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnumgaussinit(n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = intnumgaussinit(__pyx_v_n, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":13753
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnumgaussinit(n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def intnuminit(self, a, b, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13716
 *         return new_gen(_ret)
 * 
 *     def intnumgaussinit(self, long n=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for :math:`n`-point Gauss-Legendre integration of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.intnumgaussinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13755
 *         return new_gen(_ret)
 * 
 *     def intnuminit(self, a, b, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for integration from
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_779intnuminit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_778intnuminit[] = "\n        Initialize tables for integration from\n        :math:`a` to :math:`b`, where :math:`a` and :math:`b` are coded as in :literal:`intnum`. Only the\n        compactness, the possible existence of singularities, the speed of decrease\n        or the oscillations at infinity are taken into account, and not the values.\n        For instance ``intnuminit(-1,1)`` is equivalent to ``intnuminit(0,Pi)``,\n        and ``intnuminit([0,-1/2],oo)`` is equivalent to\n        ``intnuminit([-1,-1/2], -oo)``; on the other hand, the order matters\n        and\n        ``intnuminit([0,-1/2], [1,-1/3])`` is :emphasis:`not` equivalent to\n        ``intnuminit([0,-1/3], [1,-1/2])`` !\n        \n        If :math:`m` is present, it must be non-negative and we multiply the default\n        number of sampling points by :math:`2^m` (increasing the running time by a\n        similar factor).\n        \n        The result is technical and liable to change in the future, but we document\n        it here for completeness. Let :math:`x = \\phi (t)`, :math:`t\\in ]- oo , oo [` be an\n        internally chosen change of variable, achieving double exponential decrease of\n        the integrand at infinity. The integrator :literal:`intnum` will compute\n        \n        .. MATH::\n        \n            h \\sum_{\\|n\\| < N} \\phi'(nh) F(\\phi (nh))\n        \n        for some integration step :math:`h` and truncation parameter :math:`N`.\n        In basic use, let\n        \n        ::\n        \n            [h, x0, w0, xp, wp, xm, wm] = intnuminit(a,b);\n        \n        - :math:`h` is the integration step\n        \n        - :math:`x_0 = \\phi (0)` and :math:`w_0 = \\phi'(0)`,\n        \n        - :emphasis:`xp` contains the :math:`\\phi (nh)`, :math:`0 < n < N`,\n        \n        - :emphasis:`xm` contains the :math:`\\phi (nh)`, :math:`0 < -n < N`, or is empty.\n        \n        - :emphasis:`wp` contains the :math:`\\phi'(nh)`, :math:`0 < n < N`,\n        \n        - :emphasis:`wm` co""ntains the :math:`\\phi'(nh)`, :math:`0 < -n < N`, or is empty.\n        \n        The arrays :emphasis:`xm` and :emphasis:`wm` are left empty when :math:`\\phi` is an odd\n        function. In complicated situations when non-default behavior is specified at\n        end points, :literal:`intnuminit` may return up to :math:`3` such arrays, corresponding\n        to a splitting of up to :math:`3` integrals of basic type.\n        \n        If the functions to be integrated later are of the form :math:`F = f(t) k(t,z)`\n        for some kernel :math:`k` (e.g. Fourier, Laplace, Mellin,...), it is\n        useful to also precompute the values of :math:`f(\\phi (nh))`, which is accomplished\n        by :literal:`intfuncinit`. The hard part is to determine the behavior\n        of :math:`F` at endpoints, depending on :math:`z`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_779intnuminit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("intnuminit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_m,&__pyx_n_s_precision,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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("intnuminit", 0, 2, 4, 1); __PYX_ERR(4, 13755, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "intnuminit") < 0)) __PYX_ERR(4, 13755, __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);
        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_a = values[0];
    __pyx_v_b = values[1];
    if (values[2]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13755, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13755, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("intnuminit", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13755, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.intnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_778intnuminit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_b, __pyx_v_m, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_778intnuminit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("intnuminit", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_instance.pxi":13811
 *         of :math:`F` at endpoints, depending on :math:`z`.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13812
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13813
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13813, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13814
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13815
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13816
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":13817
 *         cdef GEN _b = (<Gen>b).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = intnuminit(__pyx_v__a, __pyx_v__b, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":13818
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def isfundamental(self, D):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13755
 *         return new_gen(_ret)
 * 
 *     def intnuminit(self, a, b, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for integration from
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.intnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13820
 *         return new_gen(_ret)
 * 
 *     def isfundamental(self, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`D` is equal to 1 or to the discriminant of a quadratic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_781isfundamental(PyObject *__pyx_v_self, PyObject *__pyx_v_D); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_780isfundamental[] = "\n        True (1) if :math:`D` is equal to 1 or to the discriminant of a quadratic\n        field, false (0) otherwise. :math:`D` can be input in factored form as for\n        arithmetic functions:\n        \n        ::\n        \n            ? isfundamental(factor(-8))\n            %1 = 1\n            \\\\ count fundamental discriminants up to 10^8\n            ? c = 0; forfactored(d = 1, 10^8, if (isfundamental(d), c++)); c\n            time = 40,840 ms.\n            %2 = 30396325\n            ? c = 0; for(d = 1, 10^8, if (isfundamental(d), c++)); c\n            time = 1min, 33,593 ms. \\\\ slower !\n            %3 = 30396325\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_781isfundamental(PyObject *__pyx_v_self, PyObject *__pyx_v_D) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isfundamental (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_780isfundamental(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_D));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_780isfundamental(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D) {
  GEN __pyx_v__D;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("isfundamental", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":13838
 *             %3 = 30396325
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13839
 *         '''
 *         D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef long _ret = isfundamental(_D)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13839, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13840
 *         D = objtogen(D)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = isfundamental(_D)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13841
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef long _ret = isfundamental(_D)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isfundamental(__pyx_v__D);

  /* "cypari/auto_instance.pxi":13842
 *         cdef GEN _D = (<Gen>D).g
 *         cdef long _ret = isfundamental(_D)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":13843
 *         cdef long _ret = isfundamental(_D)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def ispowerful(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13820
 *         return new_gen(_ret)
 * 
 *     def isfundamental(self, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`D` is equal to 1 or to the discriminant of a quadratic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.isfundamental", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13845
 *         return _ret
 * 
 *     def ispowerful(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a powerful integer, false (0) if not;
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_783ispowerful(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_782ispowerful[] = "\n        True (1) if :math:`x` is a powerful integer, false (0) if not;\n        an integer is powerful if and only if its valuation at all primes dividing\n        :math:`x` is greater than 1.\n        \n        ::\n        \n            ? ispowerful(50)\n            %1 = 0\n            ? ispowerful(100)\n            %2 = 1\n            ? ispowerful(5^3*(10^1000+1)^2)\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_783ispowerful(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ispowerful (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_782ispowerful(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_782ispowerful(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ispowerful", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13860
 *             %3 = 1
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13861
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = ispowerful(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13861, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13862
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = ispowerful(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13863
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = ispowerful(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = ispowerful(__pyx_v__x);

  /* "cypari/auto_instance.pxi":13864
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = ispowerful(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":13865
 *         cdef long _ret = ispowerful(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def isprime(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13845
 *         return _ret
 * 
 *     def ispowerful(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a powerful integer, false (0) if not;
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ispowerful", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13867
 *         return _ret
 * 
 *     def isprime(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_785isprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_784isprime[] = "\n        True (1) if :math:`x` is a prime\n        number, false (0) otherwise. A prime number is a positive integer having\n        exactly two distinct divisors among the natural numbers, namely 1 and\n        itself.\n        \n        This routine proves or disproves rigorously that a number is prime, which can\n        be very slow when :math:`x` is indeed a large prime integer. For instance\n        a :math:`1000` digits prime should require 15 to 30 minutes with default algorithms.\n        Use :literal:`ispseudoprime` to quickly check for compositeness. Use\n        :literal:`primecert` in order to obtain a primality proof instead of a yes/no\n        answer; see also :literal:`factor`.\n        \n        The function accepts vector/matrices arguments, and is then\n        applied componentwise.\n        \n        If :math:`flag = 0`, use a combination of\n        \n        - Baillie-Pomerance-Selfridge-Wagstaff compositeness test\n          (see :literal:`ispseudoprime`),\n        \n        - Selfridge \":math:`p-1`\" test if :math:`x-1` is smooth enough,\n        \n        - Adleman-Pomerance-Rumely-Cohen-Lenstra (APRCL) for general\n          medium-sized :math:`x` (less than 1500 bits),\n        \n        - Atkin-Morain's Elliptic Curve Primality Prover (ECPP) for general\n          large :math:`x`.\n        \n        If :math:`flag = 1`, use Selfridge-Pocklington-Lehmer \":math:`p-1`\" test; this requires\n        partially factoring various auxilliary integers and is likely to be very slow.\n        \n        If :math:`flag = 2`, use APRCL only.\n        \n        If :math:`flag = 3`, use ECPP only.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_785isprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isprime") < 0)) __PYX_ERR(4, 13867, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13867, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isprime", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13867, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.isprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_784isprime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_784isprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("isprime", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13904
 *         If :math:`flag = 3`, use ECPP only.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13905
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gisprime(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13905, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13906
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gisprime(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13907
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gisprime(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gisprime(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":13908
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gisprime(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ispseudoprime(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13867
 *         return _ret
 * 
 *     def isprime(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.isprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13910
 *         return new_gen(_ret)
 * 
 *     def ispseudoprime(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a strong pseudo
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_787ispseudoprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_786ispseudoprime[] = "\n        True (1) if :math:`x` is a strong pseudo\n        prime (see below), false (0) otherwise. If this function returns false, :math:`x`\n        is not prime; if, on the other hand it returns true, it is only highly likely\n        that :math:`x` is a prime number. Use :literal:`isprime` (which is of course much\n        slower) to prove that :math:`x` is indeed prime.\n        The function accepts vector/matrices arguments, and is then applied\n        componentwise.\n        \n        If :math:`flag = 0`, checks whether :math:`x` has no small prime divisors (up to :math:`101`\n        included) and is a Baillie-Pomerance-Selfridge-Wagstaff pseudo prime.\n        Such a pseudo prime passes a Rabin-Miller test for base :math:`2`,\n        followed by a Lucas test for the sequence :math:`(P,1)`, where :math:`P >= 3`\n        is the smallest odd integer such that :math:`P^2 - 4` is not a square mod :math:`x`.\n        (Technically, we are using an \"almost extra strong Lucas test\" that\n        checks whether :math:`V_n` is :math:`\302\261 2`, without computing :math:`U_n`.)\n        \n        There are no known composite numbers passing the above test, although it is\n        expected that infinitely many such numbers exist. In particular, all\n        composites :math:`<= 2^{64}` are correctly detected (checked using\n        :literal:`http://www.cecm.sfu.ca/Pseudoprimes/index-2-to-64.html`).\n        \n        If :math:`flag > 0`, checks whether :math:`x` is a strong Miller-Rabin pseudo prime for\n        :math:`flag` randomly chosen bases (with end-matching to catch square roots of :math:`-1`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_787ispseudoprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ispseudoprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ispseudoprime") < 0)) __PYX_ERR(4, 13910, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 13910, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ispseudoprime", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 13910, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ispseudoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_786ispseudoprime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_786ispseudoprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ispseudoprime", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13936
 *         :math:`flag` randomly chosen bases (with end-matching to catch square roots of :math:`-1`).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13937
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gispseudoprime(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13937, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13938
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gispseudoprime(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13939
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gispseudoprime(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gispseudoprime(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":13940
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gispseudoprime(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def issquarefree(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13910
 *         return new_gen(_ret)
 * 
 *     def ispseudoprime(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a strong pseudo
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ispseudoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13942
 *         return new_gen(_ret)
 * 
 *     def issquarefree(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is squarefree, false (0) if not. Here :math:`x` can be an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_789issquarefree(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_788issquarefree[] = "\n        True (1) if :math:`x` is squarefree, false (0) if not. Here :math:`x` can be an\n        integer or a polynomial with coefficients in an integral domain.\n        \n        ::\n        \n            ? issquarefree(12)\n            %1 = 0\n            ? issquarefree(6)\n            %2 = 1\n            ? issquarefree(x^3+x^2)\n            %3 = 0\n            ? issquarefree(Mod(1,4)*(x^2+x+1)) \\\\ Z/4Z is not a domain !\n             *** at top-level: issquarefree(Mod(1,4)*(x^2+x+1))\n             *** ^--------------------------------\n             *** issquarefree: impossible inverse in Fp_inv: Mod(2, 4).\n        \n        A polynomial is declared squarefree if :literal:`gcd`:math:`(x,x')` is\n        :math:`1`. In particular a non-zero polynomial with inexact coefficients is\n        considered to be squarefree. Note that this may be inconsistent with\n        :literal:`factor`, which first rounds the input to some exact approximation before\n        factoring in the apropriate domain; this is correct when the input is not\n        close to an inseparable polynomial (the resultant of :math:`x` and :math:`x'` is not\n        close to :math:`0`).\n        \n        An integer can be input in factored form as in arithmetic functions.\n        \n        ::\n        \n            ? issquarefree(factor(6))\n            %1 = 1\n            \\\\ count squarefree integers up to 10^8\n            ? c = 0; for(d = 1, 10^8, if (issquarefree(d), c++)); c\n            time = 3min, 2,590 ms.\n            %2 = 60792694\n            ? c = 0; forfactored(d = 1, 10^8, if (issquarefree(d), c++)); c\n            time = 45,348 ms. \\\\ faster !\n            %3 = 60792694\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_789issquarefree(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("issquarefree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_788issquarefree(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_788issquarefree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("issquarefree", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":13982
 *             %3 = 60792694
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":13983
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = issquarefree(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 13983, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":13984
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = issquarefree(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":13985
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = issquarefree(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = issquarefree(__pyx_v__x);

  /* "cypari/auto_instance.pxi":13986
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = issquarefree(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":13987
 *         cdef long _ret = issquarefree(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def kill(self, sym):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":13942
 *         return new_gen(_ret)
 * 
 *     def issquarefree(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is squarefree, false (0) if not. Here :math:`x` can be an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.issquarefree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":13989
 *         return _ret
 * 
 *     def kill(self, sym):             # <<<<<<<<<<<<<<
 *         r'''
 *         Restores the symbol :literal:`sym` to its "undefined" status, and deletes any
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_791kill(PyObject *__pyx_v_self, PyObject *__pyx_v_sym); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_790kill[] = "\n        Restores the symbol :literal:`sym` to its \"undefined\" status, and deletes any\n        help messages attached to :literal:`sym` using :literal:`addhelp`. Variable names\n        remain known to the interpreter and keep their former priority: you cannot\n        make a variable \"less important\" by killing it!\n        \n        ::\n        \n            ? z = y = 1; y\n            %1 = 1\n            ? kill(y)\n            ? y \\\\ restored to ``undefined'' status\n            %2 = y\n            ? variable()\n            %3 = [x, y, z] \\\\ but the variable name y is still known, with y > z !\n        \n        For the same reason, killing a user function (which is an ordinary\n        variable holding a :literal:`t_CLOSURE`) does not remove its name from the list of\n        variable names.\n        \n        If the symbol is attached to a variable --- user functions being an\n        important special case ---, one may use the quote operator\n        :literal:`a = 'a` to reset variables to their starting values. However, this\n        will not delete a help message attached to :literal:`a`, and is also slightly\n        slower than :literal:`kill(a)`.\n        \n        ::\n        \n            ? x = 1; addhelp(x, \"foo\"); x\n            %1 = 1\n            ? x = 'x; x \\\\ same as 'kill', except we don't delete help.\n            %2 = x\n            ? ?x\n            foo\n        \n        On the other hand, :literal:`kill` is the only way to remove aliases and installed\n        functions.\n        \n        ::\n        \n            ? alias(fun, sin);\n            ? kill(fun);\n            \n            ? install(addii, GG);\n            ? kill(addii);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_791kill(PyObject *__pyx_v_self, PyObject *__pyx_v_sym) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kill (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_790kill(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_sym));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_790kill(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_sym) {
  char *__pyx_v__sym;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("kill", 0);
  __Pyx_INCREF(__pyx_v_sym);

  /* "cypari/auto_instance.pxi":14036
 *             ? kill(addii);
 *         '''
 *         sym = to_bytes(sym)             # <<<<<<<<<<<<<<
 *         cdef char* _sym = <bytes>sym
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_sym); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sym, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14037
 *         '''
 *         sym = to_bytes(sym)
 *         cdef char* _sym = <bytes>sym             # <<<<<<<<<<<<<<
 *         sig_on()
 *         kill0(_sym)
 */
  if (unlikely(__pyx_v_sym == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 14037, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_sym); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 14037, __pyx_L1_error)
  __pyx_v__sym = __pyx_t_2;

  /* "cypari/auto_instance.pxi":14038
 *         sym = to_bytes(sym)
 *         cdef char* _sym = <bytes>sym
 *         sig_on()             # <<<<<<<<<<<<<<
 *         kill0(_sym)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 14038, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14039
 *         cdef char* _sym = <bytes>sym
 *         sig_on()
 *         kill0(_sym)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  kill0(__pyx_v__sym);

  /* "cypari/auto_instance.pxi":14040
 *         sig_on()
 *         kill0(_sym)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def kronecker(self, x, y):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":13989
 *         return _ret
 * 
 *     def kill(self, sym):             # <<<<<<<<<<<<<<
 *         r'''
 *         Restores the symbol :literal:`sym` to its "undefined" status, and deletes any
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.kill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sym);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14042
 *         clear_stack()
 * 
 *     def kronecker(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Kronecker symbol :math:`(x\|y)`, where :math:`x` and :math:`y` must be of type integer. By
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_793kronecker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_792kronecker[] = "\n        Kronecker symbol :math:`(x\\|y)`, where :math:`x` and :math:`y` must be of type integer. By\n        definition, this is the extension of Legendre symbol to :math:`\\mathbb{Z} x \\mathbb{Z}`\n        by total multiplicativity in both arguments with the following special rules\n        for :math:`y = 0, -1` or :math:`2`:\n        \n        - :math:`(x\\|0) = 1` if :math:`\\|x \\|= 1` and :math:`0` otherwise.\n        \n        - :math:`(x\\|-1) = 1` if :math:`x >= 0` and :math:`-1` otherwise.\n        \n        - :math:`(x\\|2) = 0` if :math:`x` is even and :math:`1` if :math:`x = 1,-1 mod 8` and :math:`-1`\n          if :math:`x = 3,-3 mod 8`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_793kronecker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kronecker (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("kronecker", 1, 2, 2, 1); __PYX_ERR(4, 14042, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "kronecker") < 0)) __PYX_ERR(4, 14042, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("kronecker", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14042, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.kronecker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_792kronecker(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_792kronecker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("kronecker", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":14056
 *           if :math:`x = 3,-3 mod 8`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14057
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14058
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14058, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14059
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef long _ret = kronecker(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14060
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = kronecker(_x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14061
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef long _ret = kronecker(_x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = kronecker(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":14062
 *         cdef GEN _y = (<Gen>y).g
 *         cdef long _ret = kronecker(_x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":14063
 *         cdef long _ret = kronecker(_x, _y)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lambertw(self, y, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14042
 *         clear_stack()
 * 
 *     def kronecker(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Kronecker symbol :math:`(x\|y)`, where :math:`x` and :math:`y` must be of type integer. By
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.kronecker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14065
 *         return _ret
 * 
 *     def lambertw(self, y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lambert :math:`W` function, solution of the implicit equation :math:`xe^x = y`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_795lambertw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_794lambertw[] = "\n        Lambert :math:`W` function, solution of the implicit equation :math:`xe^x = y`,\n        for :math:`y > 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_795lambertw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambertw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_precision,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_y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambertw") < 0)) __PYX_ERR(4, 14065, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14065, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lambertw", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14065, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lambertw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_794lambertw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_y, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_794lambertw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_y, long __pyx_v_precision) {
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lambertw", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":14070
 *         for :math:`y > 0`.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14071
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14071, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14072
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glambertW(_y, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14073
 *         sig_on()
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glambertW(_y, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":14074
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glambertW(_y, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glambertW(__pyx_v__y, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14075
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glambertW(_y, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def laurentseries(self, f, long serprec=-1, M=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14065
 *         return _ret
 * 
 *     def lambertw(self, y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lambert :math:`W` function, solution of the implicit equation :math:`xe^x = y`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lambertw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14077
 *         return new_gen(_ret)
 * 
 *     def laurentseries(self, f, long serprec=-1, M=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expand :math:`f` as a Laurent series around :math:`x = 0` to order :math:`M`. This
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_797laurentseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_796laurentseries[] = "\n        Expand :math:`f` as a Laurent series around :math:`x = 0` to order :math:`M`. This\n        function computes :math:`f(x + O(x^n))` until :math:`n` is large enough: it\n        must be possible to evaluate :math:`f` on a power series with :math:`0` constant term.\n        \n        ::\n        \n            ? laurentseries(t->sin(t)/(1-cos(t)), 5)\n            %1 = 2*x^-1 - 1/6*x - 1/360*x^3 - 1/15120*x^5 + O(x^6)\n            ? laurentseries(log)\n             *** at top-level: laurentseries(log)\n             *** ^------------------\n             *** in function laurentseries: log\n             *** ^---\n             *** log: domain error in log: series valuation != 0\n        \n        Note that individual Laurent coefficients of order :math:`<= M`\n        can be retrieved from :math:`s = laurentseries (f,M)` via :literal:`polcoeff(s,i)`\n        for any :math:`i <= M`. The series :math:`s` may occasionally be more precise that\n        the required :math:`O(x^{M+1})`.\n        \n        With respect to successive calls to :literal:`derivnum`,\n        :literal:`laurentseries` is both faster and more precise:\n        \n        ::\n        \n            ? laurentseries(t->log(3+t),1)\n            %1 = 1.0986122886681096913952452369225257047 + 1/3*x - 1/18*x^2 + O(x^3)\n            ? derivnum(t=0,log(3+t),1)\n            %2 = 0.33333333333333333333333333333333333333\n            ? derivnum(t=0,log(3+t),2)\n            %3 = -0.11111111111111111111111111111111111111\n            \n            ? f = x->sin(exp(x));\n            ? polcoeff(laurentseries(x->f(x+2), 1), 1)\n            %5 = 3.3129294231043339804683687620360224365\n            ? exp(2) * cos(exp(2));\n            %6 = 3.3129294231043339804683687620360224365\n            ? derivnum(x = 2, f(x))\n            %7 = 3.3129294231043339804683687620360224364 \\\\ 1 ulp off\n            \n            ? default(realprecision,115);\n            ? for(i=1,10^4, laurentseries(x->f(x+2),1))\n            tim""e = 279 ms.\n            ? for(i=1,10^4, derivnum(x=2,f(x))) \\\\ ... and slower\n            time = 1,134 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_797laurentseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_v_M = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("laurentseries (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_serprec,&__pyx_n_s_M,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "laurentseries") < 0)) __PYX_ERR(4, 14077, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14077, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_M = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14077, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("laurentseries", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14077, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.laurentseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_796laurentseries(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_serprec, __pyx_v_M, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_796laurentseries(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, long __pyx_v_serprec, PyObject *__pyx_v_M, long __pyx_v_precision) {
  long __pyx_v__M;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("laurentseries", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":14125
 *             time = 1,134 ms.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef long _M = -1
 *         if M is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14126
 *         '''
 *         f = objtogen(f)
 *         cdef long _M = -1             # <<<<<<<<<<<<<<
 *         if M is not None:
 *             _M = get_var(M)
 */
  __pyx_v__M = -1L;

  /* "cypari/auto_instance.pxi":14127
 *         f = objtogen(f)
 *         cdef long _M = -1
 *         if M is not None:             # <<<<<<<<<<<<<<
 *             _M = get_var(M)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_M != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":14128
 *         cdef long _M = -1
 *         if M is not None:
 *             _M = get_var(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_M); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 14128, __pyx_L1_error)
    __pyx_v__M = __pyx_t_4;

    /* "cypari/auto_instance.pxi":14127
 *         f = objtogen(f)
 *         cdef long _M = -1
 *         if M is not None:             # <<<<<<<<<<<<<<
 *             _M = get_var(M)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":14129
 *         if M is not None:
 *             _M = get_var(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 14129, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14130
 *             _M = get_var(M)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_6;

  /* "cypari/auto_instance.pxi":14131
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":14132
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":14131
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":14133
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":14134
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = laurentseries0(__pyx_v__f, __pyx_v_serprec, __pyx_v__M, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14135
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lcm(self, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14077
 *         return new_gen(_ret)
 * 
 *     def laurentseries(self, f, long serprec=-1, M=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expand :math:`f` as a Laurent series around :math:`x = 0` to order :math:`M`. This
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.laurentseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14137
 *         return new_gen(_ret)
 * 
 *     def lcm(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Least common multiple of :math:`x` and :math:`y`, i.e.such
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_799lcm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_798lcm[] = "\n        Least common multiple of :math:`x` and :math:`y`, i.e.\302\240such\n        that :math:`\\mathrm{lcm} (x,y)*\\mathrm{gcd} (x,y) = x*y`, up to units. If :math:`y` is omitted and :math:`x`\n        is a vector, returns the :math:`lcm` of all components of :math:`x`.\n        For integer arguments, return the non-negative lcm.\n        \n        When :math:`x` and :math:`y` are both given and one of them is a vector/matrix type,\n        the LCM is again taken recursively on each component, but in a different way.\n        If :math:`y` is a vector, resp.\302\240matrix, then the result has the same type as :math:`y`,\n        and components equal to :literal:`lcm(x, y[i])`, resp.\302\240:literal:`lcm(x, y[,i])`. Else\n        if :math:`x` is a vector/matrix the result has the same type as :math:`x` and an\n        analogous definition. Note that for these types, :literal:`lcm` is not\n        commutative.\n        \n        Note that :literal:`lcm(v)` is quite different from\n        \n        ::\n        \n            l = v[1]; for (i = 1, #v, l = lcm(l, v[i]))\n        \n        Indeed, :literal:`lcm(v)` is a scalar, but :literal:`l` may not be (if one of\n        the :literal:`v[i]` is a vector/matrix). The computation uses a divide-conquer tree\n        and should be much more efficient, especially when using the GMP\n        multiprecision kernel (and more subquadratic algorithms become available):\n        \n        ::\n        \n            ? v = vector(10^5, i, random);\n            ? lcm(v);\n            time = 546 ms.\n            ? l = v[1]; for (i = 1, #v, l = lcm(l, v[i]))\n            time = 4,561 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_799lcm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lcm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lcm") < 0)) __PYX_ERR(4, 14137, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lcm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lcm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_798lcm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_798lcm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lcm", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":14171
 *             time = 4,561 ms.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14172
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":14173
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14174
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14174, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":14173
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":14175
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 14175, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14176
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":14177
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":14178
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14179
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glcm0(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":14178
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)
 */
  }

  /* "cypari/auto_instance.pxi":14180
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glcm0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":14181
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def length(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14137
 *         return new_gen(_ret)
 * 
 *     def lcm(self, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Least common multiple of :math:`x` and :math:`y`, i.e.such
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lcm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14183
 *         return new_gen(_ret)
 * 
 *     def length(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Length of :math:`x`; :literal:`\#`:math:`x` is a shortcut for :literal:`length`:math:`(x)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_801length(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_800length[] = "\n        Length of :math:`x`; :literal:`\\#`:math:`x` is a shortcut for :literal:`length`:math:`(x)`.\n        This is mostly useful for\n        \n        - vectors: dimension (0 for empty vectors),\n        \n        - lists: number of entries (0 for empty lists),\n        \n        - matrices: number of columns,\n        \n        - character strings: number of actual characters (without\n          trailing :literal:`\\\\0`, should you expect it from :math:`C` :literal:`char*`).\n        \n        ::\n        \n             ? #\"a string\"\n             %1 = 8\n             ? #[3,2,1]\n             %2 = 3\n             ? #[]\n             %3 = 0\n             ? #matrix(2,5)\n             %4 = 5\n             ? L = List([1,2,3,4]); #L\n             %5 = 4\n        \n        The routine is in fact defined for arbitrary GP types, but is awkward and\n        useless in other cases: it returns the number of non-code words in :math:`x`, e.g.\n        the effective length minus 2 for integers since the :literal:`t_INT` type has two code\n        words.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_801length(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("length (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_800length(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_800length(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("length", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":14215
 *         words.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14216
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = glength(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14216, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14217
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = glength(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14218
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = glength(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = glength(__pyx_v__x);

  /* "cypari/auto_instance.pxi":14219
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = glength(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":14220
 *         cdef long _ret = glength(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lex(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14220, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14183
 *         return new_gen(_ret)
 * 
 *     def length(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Length of :math:`x`; :literal:`\#`:math:`x` is a shortcut for :literal:`length`:math:`(x)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14222
 *         return _ret
 * 
 *     def lex(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a lexicographic comparison
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_803lex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_802lex[] = "\n        Gives the result of a lexicographic comparison\n        between :math:`x` and :math:`y` (as :math:`-1`, :math:`0` or :math:`1`). This is to be interpreted in quite\n        a wide sense: It is admissible to compare objects of different types\n        (scalars, vectors, matrices), provided the scalars can be compared, as well\n        as vectors/matrices of different lengths. The comparison is recursive.\n        \n        In case all components are equal up to the smallest length of the operands,\n        the more complex is considered to be larger. More precisely, the longest is\n        the largest; when lengths are equal, we have matrix :math:`>` vector :math:`>` scalar.\n        For example:\n        \n        ::\n        \n            ? lex([1,3], [1,2,5])\n            %1 = 1\n            ? lex([1,3], [1,3,-1])\n            %2 = -1\n            ? lex([1], [[1]])\n            %3 = -1\n            ? lex([1], [1]~)\n            %4 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_803lex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lex", 1, 2, 2, 1); __PYX_ERR(4, 14222, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lex") < 0)) __PYX_ERR(4, 14222, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14222, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_802lex(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_802lex(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lex", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":14246
 *             %4 = 0
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14247
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14248
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14248, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14249
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = lexcmp(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14250
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = lexcmp(_x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14251
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = lexcmp(_x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lexcmp(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":14252
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = lexcmp(_x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":14253
 *         cdef int _ret = lexcmp(_x, _y)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfun(self, L, s, long D=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14222
 *         return _ret
 * 
 *     def lex(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a lexicographic comparison
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14255
 *         return _ret
 * 
 *     def lfun(self, L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the L-function value :math:`L(s)`, or if :literal:`D` is set, the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_805lfun(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_804lfun[] = "\n        Compute the L-function value :math:`L(s)`, or if :literal:`D` is set, the\n        derivative of order :literal:`D` at :math:`s`. The parameter\n        :literal:`L` is either an Lmath, an Ldata (created by :literal:`lfuncreate`, or an\n        Linit (created by :literal:`lfuninit`), preferrably the latter if many values\n        are to be computed.\n        \n        The argument :math:`s` is also allowed to be a power series; for instance, if :math:`s =\n        \\alpha + x + O(x^n)`, the function returns the Taylor expansion of order :math:`n`\n        around :math:`\\alpha`. The result is given with absolute error less than :math:`2^{-B}`,\n        where :math:`B = realbitprecision`.\n        \n        :strong:`Caveat.` The requested precision has a major impact on runtimes.\n        It is advised to manipulate precision via :literal:`realbitprecision` as\n        explained above instead of :literal:`realprecision` as the latter allows less\n        granularity: :literal:`realprecision` increases by increments of 64 bits, i.e. 19\n        decimal digits at a time.\n        \n        ::\n        \n            ? lfun(x^2+1, 2) \\\\ Lmath: Dedekind zeta for Q(i) at 2\n            %1 = 1.5067030099229850308865650481820713960\n            \n            ? L = lfuncreate(ellinit(\"5077a1\")); \\\\ Ldata: Hasse-Weil zeta function\n            ? lfun(L, 1+x+O(x^4)) \\\\ zero of order 3 at the central point\n            %3 = 0.E-58 - 5.[...] E-40*x + 9.[...] E-40*x^2 + 1.7318[...]*x^3 + O(x^4)\n            \n            \\\\ Linit: zeta(1/2+it), |t| < 100, and derivative\n            ? L = lfuninit(1, [100], 1);\n            ? T = lfunzeros(L, [1,25]);\n            %5 = [14.134725[...], 21.022039[...]]\n            ? z = 1/2 + I*T[1];\n            ? abs( lfun(L, z) )\n            %7 = 8.7066865533412207420780392991125136196 E-39\n            ? abs( lfun(L, z, 1) )\n            %8 = 0.79316043335650611601389756527435211412 \\\\ simple zero\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_805lfun(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_s = 0;
  long __pyx_v_D;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfun (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_s,&__pyx_n_s_D,&__pyx_n_s_precision,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_L)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfun", 0, 2, 4, 1); __PYX_ERR(4, 14255, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfun") < 0)) __PYX_ERR(4, 14255, __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);
        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_L = values[0];
    __pyx_v_s = values[1];
    if (values[2]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14255, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14255, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfun", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14255, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_804lfun(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_s, __pyx_v_D, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_804lfun(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfun", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":14293
 *             %8 = 0.79316043335650611601389756527435211412 \\ simple zero
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14294
 *         '''
 *         L = objtogen(L)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14295
 *         L = objtogen(L)
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14295, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14296
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14297
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14298
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":14299
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14298
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14300
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfun0(__pyx_v__L, __pyx_v__s, __pyx_v_D, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14301
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunabelianrelinit(self, bnfL, bnfK, polrel, sdom, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14255
 *         return _ret
 * 
 *     def lfun(self, L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the L-function value :math:`L(s)`, or if :literal:`D` is set, the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14303
 *         return new_gen(_ret)
 * 
 *     def lfunabelianrelinit(self, bnfL, bnfK, polrel, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Linit` structure attached to the Dedekind zeta function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_807lfunabelianrelinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_806lfunabelianrelinit[] = "\n        Returns the :literal:`Linit` structure attached to the Dedekind zeta function\n        of the number field :math:`L` (see :literal:`lfuninit`), given a subfield :math:`K` such that\n        :math:`L/K` is abelian.\n        Here :literal:`polrel` defines :math:`L` over :math:`K`, as usual with the priority of the\n        variable of :literal:`bnfK` lower than that of :literal:`polrel`.\n        :literal:`sdom` and :literal:`der` are as in :literal:`lfuninit`.\n        \n        ::\n        \n             ? D = -47; K = bnfinit(y^2-D);\n             ? rel = quadhilbert(D); T = rnfequation(K.pol, rel); \\\\ degree 10\n             ? L = lfunabelianrelinit(T,K,rel, [2,0,0]); \\\\ at 2\n             time = 84 ms.\n             ? lfun(L, 2)\n             %4 = 1.0154213394402443929880666894468182650\n             ? lfun(T, 2) \\\\ using parisize > 300MB\n             time = 652 ms.\n             %5 = 1.0154213394402443929880666894468182656\n        \n        As the example shows, using the (abelian) relative structure\n        is more efficient than a direct computation. The difference becomes drastic\n        as the absolute degree increases while the subfield degree remains constant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_807lfunabelianrelinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnfL = 0;
  PyObject *__pyx_v_bnfK = 0;
  PyObject *__pyx_v_polrel = 0;
  PyObject *__pyx_v_sdom = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunabelianrelinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnfL,&__pyx_n_s_bnfK,&__pyx_n_s_polrel,&__pyx_n_s_sdom,&__pyx_n_s_der,&__pyx_n_s_precision,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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_bnfL)) != 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_bnfK)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunabelianrelinit", 0, 4, 6, 1); __PYX_ERR(4, 14303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_polrel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunabelianrelinit", 0, 4, 6, 2); __PYX_ERR(4, 14303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sdom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunabelianrelinit", 0, 4, 6, 3); __PYX_ERR(4, 14303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          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_precision);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunabelianrelinit") < 0)) __PYX_ERR(4, 14303, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        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_bnfL = values[0];
    __pyx_v_bnfK = values[1];
    __pyx_v_polrel = values[2];
    __pyx_v_sdom = values[3];
    if (values[4]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14303, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[5]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[5]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14303, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunabelianrelinit", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14303, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunabelianrelinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_806lfunabelianrelinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnfL, __pyx_v_bnfK, __pyx_v_polrel, __pyx_v_sdom, __pyx_v_der, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_806lfunabelianrelinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnfL, PyObject *__pyx_v_bnfK, PyObject *__pyx_v_polrel, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision) {
  GEN __pyx_v__bnfL;
  GEN __pyx_v__bnfK;
  GEN __pyx_v__polrel;
  GEN __pyx_v__sdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunabelianrelinit", 0);
  __Pyx_INCREF(__pyx_v_bnfL);
  __Pyx_INCREF(__pyx_v_bnfK);
  __Pyx_INCREF(__pyx_v_polrel);
  __Pyx_INCREF(__pyx_v_sdom);

  /* "cypari/auto_instance.pxi":14328
 *         as the absolute degree increases while the subfield degree remains constant.
 *         '''
 *         bnfL = objtogen(bnfL)             # <<<<<<<<<<<<<<
 *         bnfK = objtogen(bnfK)
 *         polrel = objtogen(polrel)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnfL, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnfL, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14329
 *         '''
 *         bnfL = objtogen(bnfL)
 *         bnfK = objtogen(bnfK)             # <<<<<<<<<<<<<<
 *         polrel = objtogen(polrel)
 *         sdom = objtogen(sdom)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnfK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnfK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14330
 *         bnfL = objtogen(bnfL)
 *         bnfK = objtogen(bnfK)
 *         polrel = objtogen(polrel)             # <<<<<<<<<<<<<<
 *         sdom = objtogen(sdom)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_polrel, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_polrel, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14331
 *         bnfK = objtogen(bnfK)
 *         polrel = objtogen(polrel)
 *         sdom = objtogen(sdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sdom, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sdom, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14332
 *         polrel = objtogen(polrel)
 *         sdom = objtogen(sdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14332, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14333
 *         sdom = objtogen(sdom)
 *         sig_on()
 *         cdef GEN _bnfL = (<Gen>bnfL).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnfL)->__pyx_base.g;
  __pyx_v__bnfL = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14334
 *         sig_on()
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 *         cdef GEN _bnfK = (<Gen>bnfK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnfK)->__pyx_base.g;
  __pyx_v__bnfK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14335
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 *         cdef GEN _polrel = (<Gen>polrel).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_polrel)->__pyx_base.g;
  __pyx_v__polrel = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14336
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sdom)->__pyx_base.g;
  __pyx_v__sdom = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14337
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":14338
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14337
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14339
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunabelianrelinit(__pyx_v__bnfL, __pyx_v__bnfK, __pyx_v__polrel, __pyx_v__sdom, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14340
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunan(self, L, long n, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14303
 *         return new_gen(_ret)
 * 
 *     def lfunabelianrelinit(self, bnfL, bnfK, polrel, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Linit` structure attached to the Dedekind zeta function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunabelianrelinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnfL);
  __Pyx_XDECREF(__pyx_v_bnfK);
  __Pyx_XDECREF(__pyx_v_polrel);
  __Pyx_XDECREF(__pyx_v_sdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14342
 *         return new_gen(_ret)
 * 
 *     def lfunan(self, L, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the first :math:`n` terms of the Dirichlet series attached to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_809lfunan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_808lfunan[] = "\n        Compute the first :math:`n` terms of the Dirichlet series attached to the\n        :math:`L`-function given by :literal:`L` (:literal:`Lmath`, :literal:`Ldata` or :literal:`Linit`).\n        \n        ::\n        \n             ? lfunan(1, 10) \\\\ Riemann zeta\n             %1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n             ? lfunan(5, 10) \\\\ Dirichlet L-function for kronecker(5,.)\n             %2 = [1, -1, -1, 1, 0, 1, -1, -1, 1, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_809lfunan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  long __pyx_v_n;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_n,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunan", 0, 2, 3, 1); __PYX_ERR(4, 14342, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunan") < 0)) __PYX_ERR(4, 14342, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_L = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14342, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14342, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunan", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14342, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_808lfunan(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_n, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_808lfunan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_n, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfunan", 0);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":14354
 *              %2 = [1, -1, -1, 1, 0, 1, -1, -1, 1, 0]
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14355
 *         '''
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14355, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14356
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunan(_L, n, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14357
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunan(_L, n, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":14358
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunan(_L, n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunan(__pyx_v__L, __pyx_v_n, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14359
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunan(_L, n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunartin(self, nf, gal, rho, long n, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14342
 *         return new_gen(_ret)
 * 
 *     def lfunan(self, L, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the first :math:`n` terms of the Dirichlet series attached to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14361
 *         return new_gen(_ret)
 * 
 *     def lfunartin(self, nf, gal, rho, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_811lfunartin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_810lfunartin[] = "\n        Returns the :literal:`Ldata` structure attached to the\n        Artin :math:`L`-function provided by the representation :math:`\\rho` of the Galois group\n        of the extension :math:`K/\\mathbb{Q}`, defined over the cyclotomic field :math:`\\mathbb{Q} (\\zeta_n)`,\n        where :emphasis:`nf` is the nfinit structure attached to :math:`K`,\n        :emphasis:`gal` is the galoisinit structure attached to :math:`K/\\mathbb{Q}`, and :emphasis:`rho` is\n        given either\n        \n        - by the values of its character on the conjugacy classes\n          (see :literal:`galoisconjclasses` and :literal:`galoischartable`)\n        \n        - or by the matrices that are the images of the generators\n          :literal:`:emphasis:`gal`.gen`.\n        \n        Cyclotomic numbers in :literal:`rho` are represented by polynomials, whose\n        variable is understood as the complex number :math:`\\exp (2 i \\pi/n)`.\n        \n        In the following example we build the Artin :math:`L`-functions attached to the two\n        irreducible degree :math:`2` representations of the dihedral group :math:`D_{10}` defined\n        over :math:`\\mathbb{Q} (\\zeta_5)`, for the extension :math:`H/\\mathbb{Q}` where :math:`H` is the Hilbert class\n        field of :math:`\\mathbb{Q} (\\sqrt{-47})`.\n        We show numerically some identities involving Dedekind :math:`\\zeta` functions and\n        Hecke :math:`L` series.\n        \n        ::\n        \n            ? P = quadhilbert(-47)\n            %1 = x^5 + 2*x^4 + 2*x^3 + x^2 - 1\n            ? N = nfinit(nfsplitting(P));\n            ? G = galoisinit(N); \\\\ D_10\n            ? [T,n] = galoischartable(G);\n            ? T \\\\ columns give the irreducible characters\n            %5 =\n            [1 1 2 2]\n            \n            [1 -1 0 0]\n            \n            [1 1 -y^3 - y^2 - 1 y^3 + y^2]\n            \n            [1 1 y^3 + y^2 -y^3 - y^2 - 1]\n            ? n\n            %6 = 5\n            ? L""2 = lfunartin(N,G, T[,2], n);\n            ? L3 = lfunartin(N,G, T[,3], n);\n            ? L4 = lfunartin(N,G, T[,4], n);\n            ? s = 1 + x + O(x^4);\n            ? lfun(-47,s) - lfun(L2,s)\n            %11 ~ 0\n            ? lfun(1,s)*lfun(-47,s)*lfun(L3,s)^2*lfun(L4,s)^2 - lfun(N,s)\n            %12 ~ 0\n            ? lfun(1,s)*lfun(L3,s)*lfun(L4,s) - lfun(P,s)\n            %13 ~ 0\n            ? bnr = bnrinit(bnfinit(x^2+47),1,1);\n            ? bnr.cyc\n            %15 = [5] \\\\ Z/5Z: 4 non-trivial ray class characters\n            ? lfun([bnr,[1]], s) - lfun(L3, s)\n            %16 ~ 0\n            ? lfun([bnr,[2]], s) - lfun(L4, s)\n            %17 ~ 0\n            ? lfun([bnr,[3]], s) - lfun(L3, s)\n            %18 ~ 0\n            ? lfun([bnr,[4]], s) - lfun(L4, s)\n            %19 ~ 0\n        \n        The first identity identifies the non-trivial abelian character with\n        :math:`(-47,.)`; the second is the factorization of the regular representation of\n        :math:`D_{10}`; the third is the factorization of the natural representation of\n        :math:`D_{10}\\subset S_5`; and the final four are the expressions of the degree :math:`2`\n        representations as induced from degree :math:`1` representations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_811lfunartin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_rho = 0;
  long __pyx_v_n;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunartin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_gal,&__pyx_n_s_rho,&__pyx_n_s_n,&__pyx_n_s_precision,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_gal)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunartin", 0, 4, 5, 1); __PYX_ERR(4, 14361, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunartin", 0, 4, 5, 2); __PYX_ERR(4, 14361, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunartin", 0, 4, 5, 3); __PYX_ERR(4, 14361, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunartin") < 0)) __PYX_ERR(4, 14361, __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);
        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_nf = values[0];
    __pyx_v_gal = values[1];
    __pyx_v_rho = values[2];
    __pyx_v_n = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14361, __pyx_L3_error)
    if (values[4]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14361, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunartin", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14361, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunartin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_810lfunartin(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_gal, __pyx_v_rho, __pyx_v_n, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_810lfunartin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_rho, long __pyx_v_n, long __pyx_v_precision) {
  GEN __pyx_v__nf;
  GEN __pyx_v__gal;
  GEN __pyx_v__rho;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunartin", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_rho);

  /* "cypari/auto_instance.pxi":14432
 *         representations as induced from degree :math:`1` representations.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         gal = objtogen(gal)
 *         rho = objtogen(rho)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14433
 *         '''
 *         nf = objtogen(nf)
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         rho = objtogen(rho)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14434
 *         nf = objtogen(nf)
 *         gal = objtogen(gal)
 *         rho = objtogen(rho)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rho, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rho, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14435
 *         gal = objtogen(gal)
 *         rho = objtogen(rho)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14435, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14436
 *         rho = objtogen(rho)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14437
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14438
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rho)->__pyx_base.g;
  __pyx_v__rho = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14439
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":14440
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14439
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14441
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunartin(__pyx_v__nf, __pyx_v__gal, __pyx_v__rho, __pyx_v_n, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14442
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuncheckfeq(self, L, t=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14361
 *         return new_gen(_ret)
 * 
 *     def lfunartin(self, nf, gal, rho, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunartin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_rho);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14444
 *         return new_gen(_ret)
 * 
 *     def lfuncheckfeq(self, L, t=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the data attached to an :math:`L`-function (:literal:`Lmath`, :literal:`Ldata`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_813lfuncheckfeq(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_812lfuncheckfeq[] = "\n        Given the data attached to an :math:`L`-function (:literal:`Lmath`, :literal:`Ldata`\n        or :literal:`Linit`), check whether the functional equation is satisfied.\n        This is most useful for an :literal:`Ldata` constructed \"by hand\", via\n        :literal:`lfuncreate`, to detect mistakes.\n        \n        If the function has poles, the polar part must be specified. The routine\n        returns a bit accuracy :math:`b` such that :math:`\\|w - ^{w}\\| < 2^{b}`, where :math:`w` is\n        the root number contained in :literal:`data`, and\n        \n        .. MATH::\n        \n            ^{w} = \\theta (1/t) t^{-k} / \\overline{\\theta}(t)\n        \n        is a computed value\n        derived from the assumed functional equation. If the parameter :math:`t` is\n        omitted, we try random samples on the real line in the segment\n        :math:`[1, 1.25]`. Of course, a large negative value of the order of\n        :literal:`realbitprecision` is expected but if :math:`\\overline{\\theta}` is very small\n        all over the sampled segment, you should first increase\n        :literal:`realbitprecision` by :math:`-\\log_2 \\|\\overline{\\theta}(t)\\|` (which is\n        positive if :math:`\\theta` is small) to get a meaningful result.\n        \n        If :math:`t` is given, it should be close to the unit disc for efficiency and\n        such that :math:`\\overline{\\theta}(t) != 0`. We then check the functional\n        equation at that :math:`t`. Again, if :math:`\\overline{\\theta}(t)` is very small, you\n        should first increase :literal:`realbitprecision` to get a useful result.\n        \n        ::\n        \n            ? \\pb 128 \\\\ 128 bits of accuracy\n            ? default(realbitprecision)\n            %1 = 128\n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? lfuncheckfeq(L)\n            %3 = -124\n        \n        i.e. the given data is consistent to within 4 bits for the\n        particular check cons""isting of estimating the root number from all other\n        given quantities. Checking away from the unit disc will either fail with\n        a precision error, or give disappointing results (if :math:`\\theta (1/t)` is\n        large it will be computed with a large absolute error)\n        \n        ::\n        \n            ? lfuncheckfeq(L, 2+I)\n            %4 = -115\n            ? lfuncheckfeq(L,10)\n             *** at top-level: lfuncheckfeq(L,10)\n             *** ^------------------\n             *** lfuncheckfeq: precision too low in lfuncheckfeq.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_813lfuncheckfeq(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_t = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuncheckfeq (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_t,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuncheckfeq") < 0)) __PYX_ERR(4, 14444, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    __pyx_v_t = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14444, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuncheckfeq", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14444, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuncheckfeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_812lfuncheckfeq(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_t, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_812lfuncheckfeq(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision) {
  int __pyx_v__have_t;
  GEN __pyx_v__L;
  GEN __pyx_v__t;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuncheckfeq", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":14497
 *              *** lfuncheckfeq: precision too low in lfuncheckfeq.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         cdef bint _have_t = (t is not None)
 *         if _have_t:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14498
 *         '''
 *         L = objtogen(L)
 *         cdef bint _have_t = (t is not None)             # <<<<<<<<<<<<<<
 *         if _have_t:
 *             t = objtogen(t)
 */
  __pyx_t_2 = (__pyx_v_t != Py_None);
  __pyx_v__have_t = __pyx_t_2;

  /* "cypari/auto_instance.pxi":14499
 *         L = objtogen(L)
 *         cdef bint _have_t = (t is not None)
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_t != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14500
 *         cdef bint _have_t = (t is not None)
 *         if _have_t:
 *             t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":14499
 *         L = objtogen(L)
 *         cdef bint _have_t = (t is not None)
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             t = objtogen(t)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":14501
 *         if _have_t:
 *             t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 14501, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14502
 *             t = objtogen(t)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = NULL
 *         if _have_t:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_instance.pxi":14503
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL             # <<<<<<<<<<<<<<
 *         if _have_t:
 *             _t = (<Gen>t).g
 */
  __pyx_v__t = NULL;

  /* "cypari/auto_instance.pxi":14504
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_t != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14505
 *         cdef GEN _t = NULL
 *         if _have_t:
 *             _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
    __pyx_v__t = __pyx_t_4;

    /* "cypari/auto_instance.pxi":14504
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             _t = (<Gen>t).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":14506
 *         if _have_t:
 *             _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14507
 *             _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 *         clear_stack()
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14506
 *         if _have_t:
 *             _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14508
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lfuncheckfeq(__pyx_v__L, __pyx_v__t, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14509
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":14510
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfunconductor(self, L, ab=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14444
 *         return new_gen(_ret)
 * 
 *     def lfuncheckfeq(self, L, t=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the data attached to an :math:`L`-function (:literal:`Lmath`, :literal:`Ldata`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuncheckfeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14512
 *         return _ret
 * 
 *     def lfunconductor(self, L, ab=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the conductor of the given :math:`L`-function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_815lfunconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_814lfunconductor[] = "\n        Compute the conductor of the given :math:`L`-function\n        (if the structure contains a conductor, it is ignored);\n        :math:`ab = [a,b]` is the interval where we expect to find the conductor;\n        it may be given as a single scalar :math:`b`, in which case we look in :math:`[1,b]`.\n        Increasing :literal:`ab` slows down the program but gives better accuracy for the\n        result.\n        \n        If :literal:`flag` is :math:`0` (default), give either the conductor found as an\n        integer, or a vector (possibly empty) of conductors found. If :literal:`flag` is\n        :math:`1`, same but give the computed floating point approximations to the\n        conductors found, without rounding to integers. It :literal:`flag` is :math:`2`, give\n        all the conductors found, even those far from integers.\n        \n        :strong:`Caveat.` This is a heuristic program and the result is not\n        proven in any way:\n        \n        ::\n        \n             ? L = lfuncreate(857); \\\\ Dirichlet L function for kronecker(857,.)\n             ? \\p19\n             realprecision = 19 significant digits\n             ? lfunconductor(L)\n             %2 = [17, 857]\n             ? lfunconductor(L,,1) \\\\ don't round\n             %3 = [16.99999999999999999, 857.0000000000000000]\n            \n             ? \\p38\n             realprecision = 38 significant digits\n             ? lfunconductor(L)\n             %4 = 857\n        \n        :strong:`Note.` This program should only be used if the primes dividing the\n        conductor are unknown, which is rare. If they are known, a direct\n        search through possible prime exponents using :literal:`lfuncheckfeq` will\n        be more efficient and rigorous:\n        \n        ::\n        \n             ? E = ellinit([0,0,0,4,0]); /* Elliptic curve y^2 = x^3+4x */\n             ? E.disc \\\\ |disc E| = 2^12\n             %2 = -4096\n             \\\\ create Ldata by hand. Guess that"" root number is 1 and conductor N\n             ? L(N) = lfuncreate([n->ellan(E,n), 0, [0,1], 2, N, 1]);\n             ? fordiv(E.disc, d, print(d,\": \",lfuncheckfeq(L(d))))\n             1: 0\n             2: 0\n             4: -1\n             8: -2\n             16: -3\n             32: -127\n             64: -3\n             128: -2\n             256: -2\n             512: -1\n             1024: -1\n             2048: 0\n             4096: 0\n             ? lfunconductor(L(1)) \\\\ lfunconductor ignores conductor = 1 in Ldata !\n             %5 = 32\n        \n        The above code assumed that root number was :math:`1`;\n        had we set it to :math:`-1`, none of the :literal:`lfuncheckfeq` values would have been\n        acceptable:\n        \n        ::\n        \n             ? L2(N) = lfuncreate([n->ellan(E,n), 0, [0,1], 2, N, -1]);\n             ? [ lfuncheckfeq(L2(d)) | d<-divisors(E.disc) ]\n             %7 = [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_815lfunconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_ab = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_ab,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ab);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunconductor") < 0)) __PYX_ERR(4, 14512, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    __pyx_v_ab = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14512, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14512, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunconductor", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14512, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_814lfunconductor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_ab, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_814lfunconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_ab, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_ab;
  GEN __pyx_v__L;
  GEN __pyx_v__ab;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunconductor", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_ab);

  /* "cypari/auto_instance.pxi":14584
 *              %7 = [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1]
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14585
 *         '''
 *         L = objtogen(L)
 *         cdef bint _have_ab = (ab is not None)             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             ab = objtogen(ab)
 */
  __pyx_t_2 = (__pyx_v_ab != Py_None);
  __pyx_v__have_ab = __pyx_t_2;

  /* "cypari/auto_instance.pxi":14586
 *         L = objtogen(L)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14587
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 *             ab = objtogen(ab)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ab, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14587, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ab, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":14586
 *         L = objtogen(L)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":14588
 *         if _have_ab:
 *             ab = objtogen(ab)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 14588, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14589
 *             ab = objtogen(ab)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_instance.pxi":14590
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 */
  __pyx_v__ab = NULL;

  /* "cypari/auto_instance.pxi":14591
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14592
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 *             _ab = (<Gen>ab).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ab)->__pyx_base.g;
    __pyx_v__ab = __pyx_t_4;

    /* "cypari/auto_instance.pxi":14591
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":14593
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14594
 *             _ab = (<Gen>ab).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14593
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14595
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunconductor(__pyx_v__L, __pyx_v__ab, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14596
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuncost(self, L, sdom=None, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14512
 *         return _ret
 * 
 *     def lfunconductor(self, L, ab=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the conductor of the given :math:`L`-function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_ab);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14598
 *         return new_gen(_ret)
 * 
 *     def lfuncost(self, L, sdom=None, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Estimate the cost of running
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_817lfuncost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_816lfuncost[] = "\n        Estimate the cost of running\n        :literal:`lfuninit(L,sdom,der)` at current bit precision. Returns :math:`[t,b]`, to\n        indicate that :math:`t` coefficients :math:`a_n` will be computed, as well as :math:`t` values of\n        :literal:`gammamellininv`, all at bit accuracy :math:`b`.\n        A subsequent call to :literal:`lfun` at :math:`s` evaluates a polynomial of degree :math:`t`\n        at :math:`\\exp (h s)` for some real parameter :math:`h`, at the same bit accuracy :math:`b`.\n        If :math:`L` is already an :literal:`Linit`, then :emphasis:`sdom` and :emphasis:`der` are ignored\n        and are best left omitted; the bit accuracy is also inferred from :math:`L`: in\n        short we get an estimate of the cost of using that particular :literal:`Linit`.\n        \n        ::\n        \n            ? \\pb 128\n            ? lfuncost(1, [100]) \\\\ for zeta(1/2+I*t), |t| < 100\n            %1 = [7, 242] \\\\ 7 coefficients, 242 bits\n            ? lfuncost(1, [1/2, 100]) \\\\ for zeta(s) in the critical strip, |Im s| < 100\n            %2 = [7, 246] \\\\ now 246 bits\n            ? lfuncost(1, [100], 10) \\\\ for zeta(1/2+I*t), |t| < 100\n            %3 = [8, 263] \\\\ 10th derivative increases the cost by a small amount\n            ? lfuncost(1, [10^5])\n            %3 = [158, 113438] \\\\ larger imaginary part: huge accuracy increase\n            \n            ? L = lfuncreate(polcyclo(5)); \\\\ Dedekind zeta for Q(zeta_5)\n            ? lfuncost(L, [100]) \\\\ at s = 1/2+I*t), |t| < 100\n            %5 = [11457, 582]\n            ? lfuncost(L, [200]) \\\\ twice higher\n            %6 = [36294, 1035]\n            ? lfuncost(L, [10^4]) \\\\ much higher: very costly !\n            %7 = [70256473, 45452]\n            ? \\pb 256\n            ? lfuncost(L, [100]); \\\\ doubling bit accuracy\n            %8 = [17080, 710]\n        \n        In fact, some :math:`L` functions can be factorized algebraically\n        by the :literal:`lfunini""t` call, e.g. the Dedekind zeta function of abelian\n        fields, leading to much faster evaluations than the above upper bounds.\n        In that case, the function returns a vector of costs as above for each\n        individual function in the product actually evaluated:\n        \n        ::\n        \n            ? L = lfuncreate(polcyclo(5)); \\\\ Dedekind zeta for Q(zeta_5)\n            ? lfuncost(L, [100]) \\\\ a priori cost\n            %2 = [11457, 582]\n            ? L = lfuninit(L, [100]); \\\\ actually perform all initializations\n            ? lfuncost(L)\n            %4 = [[16, 242], [16, 242], [7, 242]]\n        \n        The Dedekind function of this abelian quartic field\n        is the product of four Dirichlet :math:`L`-functions attached to the trivial\n        character, a non-trivial real character and two complex conjugate\n        characters. The non-trivial characters happen to have the same conductor\n        (hence same evaluation costs), and correspond to two evaluations only\n        since the two conjugate characters are evaluated simultaneously.\n        For a total of three :math:`L`-functions evaluations, which explains the three\n        components above. Note that the actual cost is much lower than the a priori\n        cost in this case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_817lfuncost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_sdom = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuncost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_sdom,&__pyx_n_s_der,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sdom);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuncost") < 0)) __PYX_ERR(4, 14598, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    __pyx_v_sdom = values[1];
    if (values[2]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14598, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14598, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuncost", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14598, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuncost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_816lfuncost(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_sdom, __pyx_v_der, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_816lfuncost(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision) {
  int __pyx_v__have_sdom;
  GEN __pyx_v__L;
  GEN __pyx_v__sdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuncost", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_sdom);

  /* "cypari/auto_instance.pxi":14658
 *         cost in this case.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         cdef bint _have_sdom = (sdom is not None)
 *         if _have_sdom:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14659
 *         '''
 *         L = objtogen(L)
 *         cdef bint _have_sdom = (sdom is not None)             # <<<<<<<<<<<<<<
 *         if _have_sdom:
 *             sdom = objtogen(sdom)
 */
  __pyx_t_2 = (__pyx_v_sdom != Py_None);
  __pyx_v__have_sdom = __pyx_t_2;

  /* "cypari/auto_instance.pxi":14660
 *         L = objtogen(L)
 *         cdef bint _have_sdom = (sdom is not None)
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             sdom = objtogen(sdom)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_sdom != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14661
 *         cdef bint _have_sdom = (sdom is not None)
 *         if _have_sdom:
 *             sdom = objtogen(sdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sdom, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14661, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_sdom, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":14660
 *         L = objtogen(L)
 *         cdef bint _have_sdom = (sdom is not None)
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             sdom = objtogen(sdom)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":14662
 *         if _have_sdom:
 *             sdom = objtogen(sdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 14662, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14663
 *             sdom = objtogen(sdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_instance.pxi":14664
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL             # <<<<<<<<<<<<<<
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g
 */
  __pyx_v__sdom = NULL;

  /* "cypari/auto_instance.pxi":14665
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_sdom != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14666
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sdom)->__pyx_base.g;
    __pyx_v__sdom = __pyx_t_4;

    /* "cypari/auto_instance.pxi":14665
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":14667
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":14668
 *             _sdom = (<Gen>sdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14667
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14669
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuncost0(__pyx_v__L, __pyx_v__sdom, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14670
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuncreate(self, obj):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14598
 *         return new_gen(_ret)
 * 
 *     def lfuncost(self, L, sdom=None, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Estimate the cost of running
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuncost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_sdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14672
 *         return new_gen(_ret)
 * 
 *     def lfuncreate(self, obj):             # <<<<<<<<<<<<<<
 *         r'''
 *         This low-level routine creates :literal:`Ldata` structures, needed by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_819lfuncreate(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_818lfuncreate[] = "\n        This low-level routine creates :literal:`Ldata` structures, needed by\n        :emphasis:`lfun` functions, describing an :math:`L`-function and its functional equation.\n        You are urged to use a high-level constructor when one is available,\n        and this function accepts them, see :literal:`\077\077lfun`:\n        \n        ::\n        \n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? L = lfuncreate(5); \\\\ Dirichlet L-function for quadratic character (5/.)\n            ? L = lfuncreate(x^2+1); \\\\ Dedekind zeta for Q(i)\n            ? L = lfuncreate(ellinit([0,1])); \\\\ L-function of E/Q: y^2=x^3+1\n        \n        One can then use, e.g., :literal:`Lfun(L,s)` to directly\n        evaluate the respective :math:`L`-functions at :math:`s`, or :literal:`lfuninit(L, [c,w,h]`\n        to initialize computations in the rectangular box :math:`\\Re (s-c) <= w`,\n        :math:`\\Im (s) <= h`.\n        \n        We now describe the low-level interface, used to input non-builtin\n        :math:`L`-functions. The input is now a :math:`6` or :math:`7` component vector\n        :math:`V = [a, astar, Vga, k, N, eps, poles]`, whose components are as follows:\n        \n        - :literal:`V[1] = a` encodes the Dirichlet series coefficients :math:`(a_n)`. The\n          preferred format is a closure of arity 1: :literal:`n- > vector(n,i,a(i))` giving\n          the vector of the first :math:`n` coefficients. The closure is allowed to return\n          a vector of more than :math:`n` coefficients (only the first :math:`n` will be\n          considered) or even less than :math:`n`, in which case loss of accuracy will occur\n          and a warning that :literal:`\\#an` is less than expected is issued. This\n          allows to precompute and store a fixed large number of Dirichlet\n          coefficients in a vector :math:`v` and use the closure :literal:`n- > v`, which\n          does not depend on :math:`n`. As a shorthand for this latter ""case, you can input\n          the vector :math:`v` itself instead of the closure.\n        \n        ::\n        \n            ? z = lfuncreate([n->vector(n,i,1), 1, [0], 1, 1, 1, 1]); \\\\ Riemann zeta\n            ? lfun(z,2) - Pi^2/6\n            %2 = -5.877471754111437540 E-39\n        \n        A second format is limited to :math:`L`-functions affording an\n        Euler product. It is a closure of arity 2 :literal:`(p,d)- > F(p)` giving the\n        local factor :math:`L_p(X)` at :math:`p` as a rational function, to be evaluated at\n        :math:`p^{-s}` as in :literal:`direuler`; :math:`d` is set to :literal:`logint`:math:`(n,p)` + 1, where\n        :math:`n` is the total number of Dirichlet coefficients :math:`(a_1,...,a_n)` that will\n        be computed. In other words, the smallest integer :math:`d` such that :math:`p^d > n`.\n        This parameter :math:`d` allows to compute only part of\n        :math:`L_p` when :math:`p` is large and :math:`L_p` expensive to compute: any polynomial\n        (or :literal:`t_SER`) congruent to :math:`L_p` modulo :math:`X^d` is acceptable since only\n        the coefficients of :math:`X^0,..., X^{d-1}` are needed to expand the Dirichlet\n        series. The closure can of course ignore this parameter:\n        \n        ::\n        \n            ? z = lfuncreate([(p,d)->1/(1-x), 1, [0], 1, 1, 1, 1]); \\\\ Riemann zeta\n            ? lfun(z,2) - Pi^2/6\n            %4 = -5.877471754111437540 E-39\n        \n        One can describe separately the generic local factors coefficients\n        and the bad local factors by setting :math:`dir = [F, L_{bad}]`,\n        were :math:`L_{bad} = [[p_1,L_{p_1}],...,[p_k,L_{p_k}]]`, where :math:`F`\n        describes the generic local factors as above, except that when :math:`p = p_i`\n        for some :math:`i <= k`, the coefficient :math:`a_p` is directly set to :math:`L_{p_i}`\n        instead of calling :math:`F`.\n        \n        ::\n        \n            N = 15;\n            ""E = ellinit([1, 1, 1, -10, -10]); \\\\ = \"15a1\"\n            F(p,d) = 1 / (1 - ellap(E,p)*'x + p*'x^2);\n            Lbad = [[3, 1/(1+'x)], [5, 1/(1-'x)]];\n            L = lfuncreate([[F,Lbad], 0, [0,1], 2, N, ellrootno(E)]);\n        \n        Of course, in this case, :literal:`lfuncreate(E)` is preferable!\n        \n        - :literal:`V[2] = astar` is the Dirichlet series coefficients of the dual\n          function, encoded as :literal:`a` above. The sentinel values :math:`0` and :math:`1` may\n          be used for the special cases where :math:`a = a^*` and :math:`a = \\overline{a^*}`,\n          respectively.\n        \n        - :literal:`V[3] = Vga` is the vector of :math:`\\alpha_j` such that the gamma\n          factor of the :math:`L`-function is equal to\n          \n        \n        .. MATH::\n        \n            \\gamma_A(s) = \\prod_{1 <= j <= d}\\Gamma_{\\mathbb{R}}(s+\\alpha_j),\n        \n          where :math:`\\Gamma_{\\mathbb{R}}(s) = \\pi^{-s/2}\\Gamma (s/2)`.\n          This same syntax is used in the :literal:`gammamellininv` functions.\n          In particular the length :math:`d` of :literal:`Vga` is the degree of the :math:`L`-function.\n          In the present implementation, the :math:`\\alpha_j` are assumed to be exact\n          rational numbers. However when calling theta functions with :emphasis:`complex`\n          (as opposed to real) arguments, determination problems occur which may\n          give wrong results when the :math:`\\alpha_j` are not integral.\n        \n        - :literal:`V[4] = k` is a positive integer :math:`k`. The functional equation relates\n          values at :math:`s` and :math:`k-s`. For instance, for an Artin :math:`L`-series such as a\n          Dedekind zeta function we have :math:`k = 1`, for an elliptic curve :math:`k = 2`, and\n          for a modular form, :math:`k` is its weight. For motivic :math:`L`-functions, the\n          :emphasis:`motivic` weight :math:`w` is :math:`w = k-1`.\n      ""  \n        By default we assume that :math:`a_n = O_\\epsilon (n^{k_1+\\epsilon})`, where\n        :math:`k_1 = w` and even :math:`k_1 = w/2` when the :math:`L` function has no pole\n        (Ramanujan-Petersson). If this is not the case, you can replace the\n        :math:`k` argument by a vector :math:`[k,k_1]`, where :math:`k_1` is the upper bound you can\n        assume.\n        \n        - :literal:`V[5] = N` is the conductor, an integer :math:`N >= 1`, such that\n          :math:`\\Lambda (s) = N^{s/2}\\gamma_A(s)L(s)` with :math:`\\gamma_A(s)` as above.\n        \n        - :literal:`V[6] = eps` is the root number :math:`\\varepsilon`, i.e., the\n          complex number (usually of modulus :math:`1`) such that\n          :math:`\\Lambda (a, k-s) = \\varepsilon \\Lambda (a^*, s)`.\n        \n        - The last optional component :literal:`V[7] = poles` encodes the poles of the\n          :math:`L` or :math:`\\Lambda`-functions, and is omitted if they have no poles.\n          A polar part is given by a list of :math:`2`-component vectors\n          :math:`[\\beta,P_{\\beta}(x)]`, where\n          :math:`\\beta` is a pole and the power series :math:`P_{\\beta}(x)` describes\n          the attached polar part, such that :math:`L(s) - P_\\beta (s-\\beta)` is holomorphic\n          in a neighbourhood of :math:`\\beta`. For instance :math:`P_\\beta = r/x+O(1)` for a\n          simple pole at :math:`\\beta` or :math:`r_1/x^2+r_2/x+O(1)` for a double pole.\n          The type of the list describing the polar part allows to distinguish between\n          :math:`L` and :math:`\\Lambda`: a :literal:`t_VEC` is attached to :math:`L`, and a :literal:`t_COL`\n          is attached to :math:`\\Lambda`. Unless :math:`a = \\overline{a^*}` (coded by :literal:`astar`\n          equal to :math:`0` or :math:`1`), it is mandatory to specify the polar part of :math:`\\Lambda`\n          rather than those of :math:`L` since the poles of :math:`L^*` cannot be infered from the\n    ""      latter ! Whereas the functional equation allows to deduce the polar part of\n          :math:`\\Lambda^*` from the polar part of :math:`\\Lambda`.\n        \n        Finally, if :math:`a = \\overline{a^*}`, we allow a shortcut to describe\n        the frequent situation where :math:`L` has at most simple pole, at :math:`s = k`,\n        with residue :math:`r` a complex scalar: you may then input :math:`poles = r`.\n        This value :math:`r` can be set to :math:`0` if unknown and it will be computed.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_819lfuncreate(PyObject *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuncreate (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_818lfuncreate(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_obj));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_818lfuncreate(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_obj) {
  GEN __pyx_v__obj;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfuncreate", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "cypari/auto_instance.pxi":14808
 *         This value :math:`r` can be set to :math:`0` if unknown and it will be computed.
 *         '''
 *         obj = objtogen(obj)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _obj = (<Gen>obj).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_obj, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14809
 *         '''
 *         obj = objtogen(obj)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _obj = (<Gen>obj).g
 *         cdef GEN _ret = lfuncreate(_obj)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14809, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14810
 *         obj = objtogen(obj)
 *         sig_on()
 *         cdef GEN _obj = (<Gen>obj).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuncreate(_obj)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_obj)->__pyx_base.g;
  __pyx_v__obj = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14811
 *         sig_on()
 *         cdef GEN _obj = (<Gen>obj).g
 *         cdef GEN _ret = lfuncreate(_obj)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuncreate(__pyx_v__obj);

  /* "cypari/auto_instance.pxi":14812
 *         cdef GEN _obj = (<Gen>obj).g
 *         cdef GEN _ret = lfuncreate(_obj)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfundiv(self, L1, L2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14672
 *         return new_gen(_ret)
 * 
 *     def lfuncreate(self, obj):             # <<<<<<<<<<<<<<
 *         r'''
 *         This low-level routine creates :literal:`Ldata` structures, needed by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuncreate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14814
 *         return new_gen(_ret)
 * 
 *     def lfundiv(self, L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_821lfundiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_820lfundiv[] = "\n        Creates the :literal:`Ldata` structure (without initialization) corresponding\n        to the quotient of the Dirichlet series :math:`L_1` and :math:`L_2` given by\n        :literal:`L1` and :literal:`L2`. Assume that :math:`v_z(L_1) >= v_z(L_2)` at all\n        complex numbers :math:`z`: the construction may not create new poles, nor increase\n        the order of existing ones.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_821lfundiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L1 = 0;
  PyObject *__pyx_v_L2 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfundiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L1,&__pyx_n_s_L2,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L1)) != 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_L2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfundiv", 0, 2, 3, 1); __PYX_ERR(4, 14814, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfundiv") < 0)) __PYX_ERR(4, 14814, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_L1 = values[0];
    __pyx_v_L2 = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14814, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfundiv", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14814, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfundiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_820lfundiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L1, __pyx_v_L2, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_820lfundiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision) {
  GEN __pyx_v__L1;
  GEN __pyx_v__L2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfundiv", 0);
  __Pyx_INCREF(__pyx_v_L1);
  __Pyx_INCREF(__pyx_v_L2);

  /* "cypari/auto_instance.pxi":14822
 *         the order of existing ones.
 *         '''
 *         L1 = objtogen(L1)             # <<<<<<<<<<<<<<
 *         L2 = objtogen(L2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14823
 *         '''
 *         L1 = objtogen(L1)
 *         L2 = objtogen(L2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14824
 *         L1 = objtogen(L1)
 *         L2 = objtogen(L2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14824, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14825
 *         L2 = objtogen(L2)
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L1)->__pyx_base.g;
  __pyx_v__L1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14826
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L2)->__pyx_base.g;
  __pyx_v__L2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14827
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":14828
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14827
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14829
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfundiv(__pyx_v__L1, __pyx_v__L2, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14830
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunetaquo(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14814
 *         return new_gen(_ret)
 * 
 *     def lfundiv(self, L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfundiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L1);
  __Pyx_XDECREF(__pyx_v_L2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14832
 *         return new_gen(_ret)
 * 
 *     def lfunetaquo(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_823lfunetaquo(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_822lfunetaquo[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`L` function\n        attached to the modular form\n        :math:`z:--->\\prod_{i = 1}^n \\eta (M_{i,1} z)^{M_{i,2}}`\n        It is currently assumed that :math:`f` is a self-dual cuspidal form on\n        :math:`\\Gamma_0(N)` for some :math:`N`.\n        For instance, the :math:`L`-function :math:`\\sum \\tau (n) n^{-s}`\n        attached to Ramanujan's :math:`\\Delta` function is encoded as follows\n        \n        ::\n        \n            ? L = lfunetaquo(Mat([1,24]));\n            ? lfunan(L, 100) \\\\ first 100 values of tau(n)\n        \n        For convenience, a :literal:`t_VEC` is also accepted instead of\n        a factorization matrix with a single row:\n        \n        ::\n        \n            ? L = lfunetaquo([1,24]); \\\\ same as above\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_823lfunetaquo(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunetaquo (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_822lfunetaquo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_822lfunetaquo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfunetaquo", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":14854
 *             ? L = lfunetaquo([1,24]); \\ same as above
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14855
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = lfunetaquo(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14855, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14856
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunetaquo(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14857
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = lfunetaquo(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunetaquo(__pyx_v__M);

  /* "cypari/auto_instance.pxi":14858
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = lfunetaquo(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfungenus2(self, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14832
 *         return new_gen(_ret)
 * 
 *     def lfunetaquo(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunetaquo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14860
 *         return new_gen(_ret)
 * 
 *     def lfungenus2(self, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_825lfungenus2(PyObject *__pyx_v_self, PyObject *__pyx_v_F); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_824lfungenus2[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`L` function\n        attached to the genus-2 curve defined by :math:`y^2 = F(x)` or\n        :math:`y^2+Q(x) y = P(x)` if :math:`F = [P,Q]`.\n        Currently, the model needs to be minimal at 2, and if the conductor\n        is even, its valuation at :math:`2` might be incorrect (a warning is issued).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_825lfungenus2(PyObject *__pyx_v_self, PyObject *__pyx_v_F) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfungenus2 (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_824lfungenus2(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_F));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_824lfungenus2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfungenus2", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":14868
 *         is even, its valuation at :math:`2` might be incorrect (a warning is issued).
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14869
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = lfungenus2(_F)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14869, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14870
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfungenus2(_F)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14871
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = lfungenus2(_F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfungenus2(__pyx_v__F);

  /* "cypari/auto_instance.pxi":14872
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = lfungenus2(_F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunhardy(self, L, t, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14860
 *         return new_gen(_ret)
 * 
 *     def lfungenus2(self, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfungenus2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14874
 *         return new_gen(_ret)
 * 
 *     def lfunhardy(self, L, t, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variant of the Hardy :math:`Z`-function given by :literal:`L`, used for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_827lfunhardy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_826lfunhardy[] = "\n        Variant of the Hardy :math:`Z`-function given by :literal:`L`, used for\n        plotting or locating zeros of :math:`L(k/2+it)` on the critical line.\n        The precise definition is as\n        follows: if as usual :math:`k/2` is the center of the critical strip, :math:`d` is the\n        degree, :math:`\\alpha_j` the entries of :literal:`Vga` giving the gamma factors,\n        and :math:`\\varepsilon` the root number, then if we set\n        :math:`s = k/2+it = \\rho e^{i\\theta}` and\n        :math:`E = (d(k/2-1)+\\sum_{1 <= j <= d}\\alpha_j)/2`, the computed function at :math:`t` is\n        equal to\n        \n        .. MATH::\n        \n            Z(t) = \\varepsilon^{-1/2}\\Lambda (s).\\|s\\|^{-E}e^{dt\\theta/2} ,\n        \n        which is a real function of :math:`t` for self-dual :math:`\\Lambda`,\n        vanishing exactly when :math:`L(k/2+it)` does on the critical line. The\n        normalizing factor :math:`\\|s\\|^{-E}e^{dt\\theta/2}` compensates the\n        exponential decrease of :math:`\\gamma_A(s)` as :math:`t\\to oo` so that\n        :math:`Z(t) ~ 1`.\n        \n        ::\n        \n            ? T = 100; \\\\ maximal height\n            ? L = lfuninit(1, [T]); \\\\ initialize for zeta(1/2+it), |t|<T\n            ? \\p19 \\\\ no need for large accuracy\n            ? ploth(t = 0, T, lfunhardy(L,t))\n        \n        Using :literal:`lfuninit` is critical for this particular\n        applications since thousands of values are computed. Make sure to initialize\n        up to the maximal :math:`t` needed: otherwise expect to see many warnings for\n        unsufficient initialization and suffer major slowdowns.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_827lfunhardy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_t = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunhardy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_t,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 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_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunhardy", 0, 2, 3, 1); __PYX_ERR(4, 14874, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunhardy") < 0)) __PYX_ERR(4, 14874, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_L = values[0];
    __pyx_v_t = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14874, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunhardy", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14874, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunhardy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_826lfunhardy(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_t, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_826lfunhardy(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunhardy", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":14908
 *         unsufficient initialization and suffer major slowdowns.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14909
 *         '''
 *         L = objtogen(L)
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14910
 *         L = objtogen(L)
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14910, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14911
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14912
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14913
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":14914
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14913
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14915
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunhardy(__pyx_v__L, __pyx_v__t, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14916
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuninit(self, L, sdom, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14874
 *         return new_gen(_ret)
 * 
 *     def lfunhardy(self, L, t, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variant of the Hardy :math:`Z`-function given by :literal:`L`, used for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunhardy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14918
 *         return new_gen(_ret)
 * 
 *     def lfuninit(self, L, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for all functions linked to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_829lfuninit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_828lfuninit[] = "\n        Initalization function for all functions linked to the\n        computation of the :math:`L`-function :math:`L(s)` encoded by :literal:`L`, where\n        :math:`s` belongs to the rectangular domain :math:`sdom = [center,w,h]`\n        centered on the real axis, :math:`\\|\\Re (s)-center\\| <= w`, :math:`\\|\\Im (s)\\| <= h`,\n        where all three components of :literal:`sdom` are real and :math:`w`, :math:`h` are\n        non-negative. :literal:`der` is the maximum order of derivation that will be used.\n        The subdomain :math:`[k/2, 0, h]` on the critical line (up to height :math:`h`)\n        can be encoded as :math:`[h]` for brevity. The subdomain :math:`[k/2, w, h]`\n        centered on the critical line can be encoded as :math:`[w, h]` for brevity.\n        \n        The argument :literal:`L` is an :literal:`Lmath`, an :literal:`Ldata` or an :literal:`Linit`. See\n        :literal:`\077\077Ldata` and :literal:`\077\077lfuncreate` for how to create it.\n        \n        The height :math:`h` of the domain is a :emphasis:`crucial` parameter: if you only\n        need :math:`L(s)` for real :math:`s`, set :math:`h` to\302\2400.\n        The running time is roughly proportional to\n        \n        .. MATH::\n        \n            (B / d+\\pi h/4)^{d/2+3}N^{1/2},\n        \n        where :math:`B` is the default bit accuracy, :math:`d` is the degree of the\n        :math:`L`-function, and :math:`N` is the conductor (the exponent :math:`d/2+3` is reduced\n        to :math:`d/2+2` when :math:`d = 1` and :math:`d = 2`). There is also a dependency on :math:`w`,\n        which is less crucial, but make sure to use the smallest rectangular\n        domain that you need.\n        \n        ::\n        \n            ? L0 = lfuncreate(1); \\\\ Riemann zeta\n            ? L = lfuninit(L0, [1/2, 0, 100]); \\\\ for zeta(1/2+it), |t| < 100\n            ? lfun(L, 1/2 + I)\n            ? L = lfuninit(L0, [100]); \\\\ same as above !\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_829lfuninit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_sdom = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuninit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_sdom,&__pyx_n_s_der,&__pyx_n_s_precision,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_L)) != 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_sdom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfuninit", 0, 2, 4, 1); __PYX_ERR(4, 14918, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuninit") < 0)) __PYX_ERR(4, 14918, __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);
        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_L = values[0];
    __pyx_v_sdom = values[1];
    if (values[2]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14918, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14918, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuninit", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14918, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_828lfuninit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_sdom, __pyx_v_der, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_828lfuninit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__sdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuninit", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_sdom);

  /* "cypari/auto_instance.pxi":14954
 *             ? L = lfuninit(L0, [100]); \\ same as above !
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sdom = objtogen(sdom)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14955
 *         '''
 *         L = objtogen(L)
 *         sdom = objtogen(sdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sdom, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sdom, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14956
 *         L = objtogen(L)
 *         sdom = objtogen(sdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14956, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14957
 *         sdom = objtogen(sdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14958
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sdom)->__pyx_base.g;
  __pyx_v__sdom = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14959
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":14960
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14959
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14961
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuninit0(__pyx_v__L, __pyx_v__sdom, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14962
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunlambda(self, L, s, long D=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14918
 *         return new_gen(_ret)
 * 
 *     def lfuninit(self, L, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for all functions linked to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_sdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14964
 *         return new_gen(_ret)
 * 
 *     def lfunlambda(self, L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the completed :math:`L`-function :math:`\Lambda (s) = N^{s/2}\gamma (s)L(s)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_831lfunlambda(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_830lfunlambda[] = "\n        Compute the completed :math:`L`-function :math:`\\Lambda (s) = N^{s/2}\\gamma (s)L(s)`,\n        or if :literal:`D` is set, the derivative of order :literal:`D` at :math:`s`.\n        The parameter :literal:`L` is either an :literal:`Lmath`, an :literal:`Ldata` (created by\n        :literal:`lfuncreate`, or an :literal:`Linit` (created by :literal:`lfuninit`), preferrably the\n        latter if many values are to be computed.\n        \n        The result is given with absolute error less than :math:`2^{-B}\\|\\gamma (s)N^{s/2}\\|`,\n        where :math:`B = realbitprecision`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_831lfunlambda(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_s = 0;
  long __pyx_v_D;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunlambda (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_s,&__pyx_n_s_D,&__pyx_n_s_precision,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_L)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunlambda", 0, 2, 4, 1); __PYX_ERR(4, 14964, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunlambda") < 0)) __PYX_ERR(4, 14964, __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);
        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_L = values[0];
    __pyx_v_s = values[1];
    if (values[2]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14964, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14964, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunlambda", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14964, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunlambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_830lfunlambda(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_s, __pyx_v_D, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_830lfunlambda(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunlambda", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":14975
 *         where :math:`B = realbitprecision`.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14976
 *         '''
 *         L = objtogen(L)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":14977
 *         L = objtogen(L)
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 14977, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":14978
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14979
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":14980
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":14981
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":14980
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 */
  }

  /* "cypari/auto_instance.pxi":14982
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunlambda0(__pyx_v__L, __pyx_v__s, __pyx_v_D, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":14983
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunmf(self, mf, F=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14964
 *         return new_gen(_ret)
 * 
 *     def lfunlambda(self, L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the completed :math:`L`-function :math:`\Lambda (s) = N^{s/2}\gamma (s)L(s)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunlambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":14985
 *         return new_gen(_ret)
 * 
 *     def lfunmf(self, mf, F=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form in :literal:`mf`, output the L-functions
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_833lfunmf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_832lfunmf[] = "\n        If :math:`F` is a modular form in :literal:`mf`, output the L-functions\n        corresponding to its :math:`[\\mathbb{Q} (F):\\mathbb{Q} (\\chi)]` complex embeddings, ready for use with\n        the :literal:`lfun` package. If :math:`F` is omitted, output the :math:`L`-functions attached\n        to all eigenforms in the new space; the result is a vector whose length is\n        the number of Galois orbits of newforms. Each entry contains the vector of\n        :math:`L`-functions corresponding to the :math:`d` complex embeddings of an orbit of\n        dimension :math:`d` over :math:`\\mathbb{Q} (\\chi)`.\n        \n        ::\n        \n            ? mf = mfinit([35,2],0);mffields(mf)\n            %1 = [y, y^2 - y - 4]\n            ? f = mfeigenbasis(mf)[2]; mfparams(f) \\\\ orbit of dimension two\n            %2 = [35, 2, 1, y^2 - y - 4]\n            ? [L1,L2] = lfunmf(mf, f); \\\\ Two L-functions\n            ? lfun(L1,1)\n            %4 = 0.81018461849460161754947375433874745585\n            ? lfun(L2,1)\n            %5 = 0.46007635204895314548435893464149369804\n            ? [ lfun(L,1) | L <- concat(lfunmf(mf)) ]\n            %6 = [0.70291..., 0.81018..., 0.46007...]\n        \n        The :literal:`concat` instruction concatenates the vectors\n        corresponding to the various (here two) orbits, so that we obtain the vector\n        of all the :math:`L`-functions attached to eigenforms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_833lfunmf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunmf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_mf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunmf") < 0)) __PYX_ERR(4, 14985, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mf = values[0];
    __pyx_v_F = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 14985, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunmf", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 14985, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunmf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_832lfunmf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_832lfunmf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_precision) {
  int __pyx_v__have_F;
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunmf", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":15013
 *         of all the :math:`L`-functions attached to eigenforms.
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15014
 *         '''
 *         mf = objtogen(mf)
 *         cdef bint _have_F = (F is not None)             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             F = objtogen(F)
 */
  __pyx_t_2 = (__pyx_v_F != Py_None);
  __pyx_v__have_F = __pyx_t_2;

  /* "cypari/auto_instance.pxi":15015
 *         mf = objtogen(mf)
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_F != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15016
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 *             F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15016, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":15015
 *         mf = objtogen(mf)
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":15017
 *         if _have_F:
 *             F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 15017, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15018
 *             F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = NULL
 *         if _have_F:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":15019
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             _F = (<Gen>F).g
 */
  __pyx_v__F = NULL;

  /* "cypari/auto_instance.pxi":15020
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_F != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15021
 *         cdef GEN _F = NULL
 *         if _have_F:
 *             _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
    __pyx_v__F = __pyx_t_4;

    /* "cypari/auto_instance.pxi":15020
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":15022
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15023
 *             _F = (<Gen>F).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15022
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15024
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunmf(__pyx_v__mf, __pyx_v__F, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15025
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunmfspec(self, L, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":14985
 *         return new_gen(_ret)
 * 
 *     def lfunmf(self, mf, F=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form in :literal:`mf`, output the L-functions
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunmf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15027
 *         return new_gen(_ret)
 * 
 *     def lfunmfspec(self, L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :literal:`[valeven,valodd,omminus,omplus]`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_835lfunmfspec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_834lfunmfspec[] = "\n        Returns :literal:`[valeven,valodd,omminus,omplus]`,\n        where :literal:`valeven` (resp., :literal:`valodd`) is the vector of even (resp., odd)\n        periods of the modular form given by :literal:`L`, and :literal:`omminus` and\n        :literal:`omplus` the corresponding real numbers :math:`\\omega^-` and :math:`\\omega^+`\n        normalized in a noncanonical way. For the moment, only for modular forms of even weight.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_835lfunmfspec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunmfspec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_precision,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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunmfspec") < 0)) __PYX_ERR(4, 15027, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15027, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunmfspec", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15027, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunmfspec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_834lfunmfspec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_834lfunmfspec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunmfspec", 0);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":15035
 *         normalized in a noncanonical way. For the moment, only for modular forms of even weight.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15036
 *         '''
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15036, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15037
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15038
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":15039
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15038
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15040
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunmfspec(__pyx_v__L, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15041
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunmul(self, L1, L2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15027
 *         return new_gen(_ret)
 * 
 *     def lfunmfspec(self, L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :literal:`[valeven,valodd,omminus,omplus]`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunmfspec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15043
 *         return new_gen(_ret)
 * 
 *     def lfunmul(self, L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_837lfunmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_836lfunmul[] = "\n        Creates the :literal:`Ldata` structure (without initialization) corresponding\n        to the product of the Dirichlet series given by :literal:`L1` and\n        :literal:`L2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_837lfunmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L1 = 0;
  PyObject *__pyx_v_L2 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L1,&__pyx_n_s_L2,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L1)) != 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_L2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunmul", 0, 2, 3, 1); __PYX_ERR(4, 15043, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunmul") < 0)) __PYX_ERR(4, 15043, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_L1 = values[0];
    __pyx_v_L2 = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15043, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunmul", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15043, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_836lfunmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L1, __pyx_v_L2, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_836lfunmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision) {
  GEN __pyx_v__L1;
  GEN __pyx_v__L2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunmul", 0);
  __Pyx_INCREF(__pyx_v_L1);
  __Pyx_INCREF(__pyx_v_L2);

  /* "cypari/auto_instance.pxi":15049
 *         :literal:`L2`.
 *         '''
 *         L1 = objtogen(L1)             # <<<<<<<<<<<<<<
 *         L2 = objtogen(L2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15050
 *         '''
 *         L1 = objtogen(L1)
 *         L2 = objtogen(L2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15051
 *         L1 = objtogen(L1)
 *         L2 = objtogen(L2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15051, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15052
 *         L2 = objtogen(L2)
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L1)->__pyx_base.g;
  __pyx_v__L1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15053
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L2)->__pyx_base.g;
  __pyx_v__L2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15054
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":15055
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15054
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15056
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunmul(__pyx_v__L1, __pyx_v__L2, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15057
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunorderzero(self, L, long m=-1, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15043
 *         return new_gen(_ret)
 * 
 *     def lfunmul(self, L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L1);
  __Pyx_XDECREF(__pyx_v_L2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15059
 *         return new_gen(_ret)
 * 
 *     def lfunorderzero(self, L, long m=-1, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the order of the possible zero of the :math:`L`-function at the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_839lfunorderzero(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_838lfunorderzero[] = "\n        Computes the order of the possible zero of the :math:`L`-function at the\n        center :math:`k/2` of the critical strip; return :math:`0` if :math:`L(k/2)` does not vanish.\n        \n        If :math:`m` is given and has a non-negative value, assumes the order is at most :math:`m`.\n        Otherwise, the algorithm chooses a sensible default:\n        \n        - if the :math:`L` argument is an :literal:`Linit`, assume that a multiple zero at\n          :math:`s = k / 2` has order less than or equal to the maximal allowed derivation\n          order.\n        \n        - else assume the order is less than :math:`4`.\n        \n        You may explicitly increase this value using optional argument\302\240:math:`m`; this\n        overrides the default value above. (Possibly forcing a recomputation\n        of the :literal:`Linit`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_839lfunorderzero(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunorderzero (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunorderzero") < 0)) __PYX_ERR(4, 15059, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15059, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)-1L);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15059, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunorderzero", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15059, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunorderzero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_838lfunorderzero(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_m, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_838lfunorderzero(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__L;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunorderzero", 0);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":15077
 *         of the :literal:`Linit`.)
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15078
 *         '''
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15078, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15079
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15080
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":15081
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 *         clear_stack()
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15080
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15082
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lfunorderzero(__pyx_v__L, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15083
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15084
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfunqf(self, Q, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15059
 *         return new_gen(_ret)
 * 
 *     def lfunorderzero(self, L, long m=-1, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the order of the possible zero of the :math:`L`-function at the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunorderzero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15086
 *         return _ret
 * 
 *     def lfunqf(self, Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`\Theta` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_841lfunqf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_840lfunqf[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`\\Theta` function\n        of the lattice attached to the definite positive quadratic form :math:`Q`.\n        \n        ::\n        \n            ? L = lfunqf(matid(2));\n            ? lfunqf(L,2)\n            %2 = 6.0268120396919401235462601927282855839\n            ? lfun(x^2+1,2)*4\n            %3 = 6.0268120396919401235462601927282855839\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_841lfunqf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Q = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunqf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_precision,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_Q)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunqf") < 0)) __PYX_ERR(4, 15086, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Q = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15086, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunqf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15086, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_840lfunqf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Q, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_840lfunqf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, long __pyx_v_precision) {
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfunqf", 0);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":15099
 *             %3 = 6.0268120396919401235462601927282855839
 *         '''
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15100
 *         '''
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15100, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15101
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunqf(_Q, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15102
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunqf(_Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":15103
 *         cdef GEN _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunqf(_Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunqf(__pyx_v__Q, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15104
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunqf(_Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunrootres(self, data, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15086
 *         return _ret
 * 
 *     def lfunqf(self, Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`\Theta` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15106
 *         return new_gen(_ret)
 * 
 *     def lfunrootres(self, data, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the :literal:`Ldata` attached to an :math:`L`-function (or the output of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_843lfunrootres(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_842lfunrootres[] = "\n        Given the :literal:`Ldata` attached to an :math:`L`-function (or the output of\n        :literal:`lfunthetainit`), compute the root number and the residues.\n        \n        The output is a 3-component vector\n        :math:`[[[a_1,r_1],...,[a_n, r_n], [[b_1, R_1],...,[b_m, R_m]], w]`,\n        where :math:`r_i` is the\n        polar part of :math:`L(s)` at :math:`a_i`, :math:`R_i` is is the polar part of :math:`\\Lambda (s)` at\n        :math:`b_i` or :math:`[0,0,r]` if there is no pole,\n        and :math:`w` is the root number. In the present implementation,\n        \n        - either the polar part must be completely known (and is then arbitrary):\n          the function determines the root number,\n        \n        ::\n        \n            ? L = lfunmul(1,1); \\\\ zeta^2\n            ? [r,R,w] = lfunrootres(L);\n            ? r \\\\ single pole at 1, double\n            %3 = [[1, 1.[...]*x^-2 + 1.1544[...]*x^-1 + O(x^0)]]\n            ? w\n            %4 = 1\n            ? R \\\\ double pole at 0 and 1\n            %5 = [[1,[...]], [0,[...]]\n        \n        - or at most a single pole is allowed: the function computes both\n          the root number and the residue (:math:`0` if no pole).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_843lfunrootres(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunrootres (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_precision,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_data)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunrootres") < 0)) __PYX_ERR(4, 15106, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_data = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15106, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunrootres", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15106, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunrootres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_842lfunrootres(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_data, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_842lfunrootres(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_data, long __pyx_v_precision) {
  GEN __pyx_v__data;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunrootres", 0);
  __Pyx_INCREF(__pyx_v_data);

  /* "cypari/auto_instance.pxi":15135
 *           the root number and the residue (:math:`0` if no pole).
 *         '''
 *         data = objtogen(data)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15136
 *         '''
 *         data = objtogen(data)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15136, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15137
 *         data = objtogen(data)
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_data)->__pyx_base.g;
  __pyx_v__data = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15138
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":15139
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunrootres(_data, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15138
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15140
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunrootres(__pyx_v__data, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15141
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunsympow(self, E, unsigned long m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15106
 *         return new_gen(_ret)
 * 
 *     def lfunrootres(self, data, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the :literal:`Ldata` attached to an :math:`L`-function (or the output of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunrootres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15143
 *         return new_gen(_ret)
 * 
 *     def lfunsympow(self, E, unsigned long m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_845lfunsympow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_844lfunsympow[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`L` function\n        attached to the :math:`m`-th symmetric power of the elliptic curve :math:`E` defined over\n        the rationals.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_845lfunsympow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  unsigned long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunsympow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_m,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_E)) != 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_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunsympow", 1, 2, 2, 1); __PYX_ERR(4, 15143, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunsympow") < 0)) __PYX_ERR(4, 15143, __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_E = values[0];
    __pyx_v_m = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_m == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15143, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunsympow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15143, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunsympow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_844lfunsympow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_844lfunsympow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, unsigned long __pyx_v_m) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfunsympow", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":15149
 *         the rationals.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15150
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = lfunsympow(_E, m)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15150, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15151
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunsympow(_E, m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15152
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = lfunsympow(_E, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunsympow(__pyx_v__E, __pyx_v_m);

  /* "cypari/auto_instance.pxi":15153
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = lfunsympow(_E, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuntheta(self, data, t, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15143
 *         return new_gen(_ret)
 * 
 *     def lfunsympow(self, E, unsigned long m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunsympow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15155
 *         return new_gen(_ret)
 * 
 *     def lfuntheta(self, data, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of the :math:`m`-th derivative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_847lfuntheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_846lfuntheta[] = "\n        Compute the value of the :math:`m`-th derivative\n        at :math:`t` of the theta function attached to the :math:`L`-function given by :literal:`data`.\n        :literal:`data` can be either the standard :math:`L`-function data, or the output of\n        :literal:`lfunthetainit`. The result is given with absolute error less than\n        :math:`2^{-B}`, where :math:`B = realbitprecision`.\n        \n        The theta function is defined by the formula\n        :math:`\\Theta (t) = \\sum_{n >= 1}a(n)K(nt/\\sqrt (N))`, where :math:`a(n)` are the coefficients\n        of the Dirichlet series, :math:`N` is the conductor, and :math:`K` is the inverse Mellin\n        transform of the gamma product defined by the :literal:`Vga` component.\n        Its Mellin transform is equal to :math:`\\Lambda (s)-P(s)`, where :math:`\\Lambda (s)`\n        is the completed :math:`L`-function and the rational function :math:`P(s)` its polar part.\n        In particular, if the :math:`L`-function is the :math:`L`-function of a modular form\n        :math:`f(\\tau) = \\sum_{n >= 0}a(n)q^n` with :math:`q = \\exp (2\\pi i\\tau)`, we have\n        :math:`\\Theta (t) = 2(f(it/\\sqrt{N})-a(0))`. Note that :math:`a(0) = -L(f,0)` in this case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_847lfuntheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_t = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuntheta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,&__pyx_n_s_t,&__pyx_n_s_m,&__pyx_n_s_precision,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_data)) != 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_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfuntheta", 0, 2, 4, 1); __PYX_ERR(4, 15155, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuntheta") < 0)) __PYX_ERR(4, 15155, __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);
        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_data = values[0];
    __pyx_v_t = values[1];
    if (values[2]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15155, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15155, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuntheta", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15155, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuntheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_846lfuntheta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_data, __pyx_v_t, __pyx_v_m, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_846lfuntheta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_data, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__data;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuntheta", 0);
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_instance.pxi":15173
 *         :math:`\Theta (t) = 2(f(it/\sqrt{N})-a(0))`. Note that :math:`a(0) = -L(f,0)` in this case.
 *         '''
 *         data = objtogen(data)             # <<<<<<<<<<<<<<
 *         t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15174
 *         '''
 *         data = objtogen(data)
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15175
 *         data = objtogen(data)
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15175, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15176
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_data)->__pyx_base.g;
  __pyx_v__data = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15177
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15178
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":15179
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15178
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15180
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuntheta(__pyx_v__data, __pyx_v__t, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15181
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunthetacost(self, L, tdom=None, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15155
 *         return new_gen(_ret)
 * 
 *     def lfuntheta(self, data, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of the :math:`m`-th derivative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuntheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15183
 *         return new_gen(_ret)
 * 
 *     def lfunthetacost(self, L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function estimates the cost of running
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_849lfunthetacost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_848lfunthetacost[] = "\n        This function estimates the cost of running\n        :literal:`lfunthetainit(L,tdom,m)` at current bit precision. Returns the number of\n        coefficients :math:`a_n` that would be computed. This also estimates the\n        cost of a subsequent evaluation :literal:`lfuntheta`, which must compute\n        that many values of :literal:`gammamellininv` at the current bit precision.\n        If :math:`L` is already an :literal:`Linit`, then :emphasis:`tdom` and :math:`m` are ignored\n        and are best left omitted: we get an estimate of the cost of using that\n        particular :literal:`Linit`.\n        \n        ::\n        \n            ? \\pb 1000\n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? lfunthetacost(L); \\\\ cost for theta(t), t real >= 1\n            %1 = 15\n            ? lfunthetacost(L, 1 + I); \\\\ cost for theta(1+I). Domain error !\n             *** at top-level: lfunthetacost(1,1+I)\n             *** ^--------------------\n             *** lfunthetacost: domain error in lfunthetaneed: arg t > 0.785\n            ? lfunthetacost(L, 1 + I/2) \\\\ for theta(1+I/2).\n            %2 = 23\n            ? lfunthetacost(L, 1 + I/2, 10) \\\\ for theta^((10))(1+I/2).\n            %3 = 24\n            ? lfunthetacost(L, [2, 1/10]) \\\\ cost for theta(t), |t| >= 2, |arg(t)| < 1/10\n            %4 = 8\n            \n            ? L = lfuncreate( ellinit([1,1]) );\n            ? lfunthetacost(L) \\\\ for t >= 1\n            %6 = 2471\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_849lfunthetacost(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_tdom = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunthetacost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_tdom,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tdom);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunthetacost") < 0)) __PYX_ERR(4, 15183, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    __pyx_v_tdom = values[1];
    if (values[2]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15183, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15183, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunthetacost", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15183, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunthetacost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_848lfunthetacost(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_tdom, __pyx_v_m, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_848lfunthetacost(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision) {
  int __pyx_v__have_tdom;
  GEN __pyx_v__L;
  GEN __pyx_v__tdom;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunthetacost", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_tdom);

  /* "cypari/auto_instance.pxi":15215
 *             %6 = 2471
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15216
 *         '''
 *         L = objtogen(L)
 *         cdef bint _have_tdom = (tdom is not None)             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 */
  __pyx_t_2 = (__pyx_v_tdom != Py_None);
  __pyx_v__have_tdom = __pyx_t_2;

  /* "cypari/auto_instance.pxi":15217
 *         L = objtogen(L)
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15218
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:
 *             tdom = objtogen(tdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tdom, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_tdom, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":15217
 *         L = objtogen(L)
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":15219
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 15219, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15220
 *             tdom = objtogen(tdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_instance.pxi":15221
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 */
  __pyx_v__tdom = NULL;

  /* "cypari/auto_instance.pxi":15222
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15223
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tdom)->__pyx_base.g;
    __pyx_v__tdom = __pyx_t_4;

    /* "cypari/auto_instance.pxi":15222
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":15224
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15225
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 *         clear_stack()
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15224
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15226
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lfunthetacost0(__pyx_v__L, __pyx_v__tdom, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15227
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15228
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfunthetainit(self, L, tdom=None, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15183
 *         return new_gen(_ret)
 * 
 *     def lfunthetacost(self, L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function estimates the cost of running
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunthetacost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_tdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15230
 *         return _ret
 * 
 *     def lfunthetainit(self, L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for evaluating the :math:`m`-th derivative of theta
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_851lfunthetainit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_850lfunthetainit[] = "\n        Initalization function for evaluating the :math:`m`-th derivative of theta\n        functions with argument :math:`t` in domain :emphasis:`tdom`. By default (:emphasis:`tdom`\n        omitted), :math:`t` is real, :math:`t >= 1`. Otherwise, :emphasis:`tdom` may be\n        \n        - a positive real scalar :math:`\\rho`: :math:`t` is real, :math:`t >= \\rho`.\n        \n        - a non-real complex number: compute at this particular :math:`t`; this\n          allows to compute :math:`\\theta (z)` for any complex :math:`z` satisfying :math:`\\|z\\| >= \\|t\\|`\n          and :math:`\\|\\arg z\\| <= \\|\\arg t\\|`; we must have :math:`\\|2 \\arg z / d\\| < \\pi/2`, where\n          :math:`d` is the degree of the :math:`\\Gamma` factor.\n        \n        - a pair :math:`[\\rho,\\alpha]`: assume that :math:`\\|t\\| >= \\rho` and :math:`\\|\\arg t\\| \\leq\n          \\alpha`; we must have :math:`\\|2\\alpha / d\\| < \\pi/2`, where :math:`d` is the degree of\n          the :math:`\\Gamma` factor.\n        \n        ::\n        \n            ? \\p500\n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? t = 1+I/2;\n            ? lfuntheta(L, t); \\\\ direct computation\n            time = 30 ms.\n            ? T = lfunthetainit(L, 1+I/2);\n            time = 30 ms.\n            ? lfuntheta(T, t); \\\\ instantaneous\n        \n        The :math:`T` structure would allow to quickly compute :math:`\\theta (z)`\n        for any :math:`z` in the cone delimited by :math:`t` as explained above. On the other hand\n        \n        ::\n        \n            ? lfuntheta(T,I)\n             *** at top-level: lfuntheta(T,I)\n             *** ^--------------\n             *** lfuntheta: domain error in lfunthetaneed: arg t > 0.785398163397448\n        \n        The initialization is equivalent to\n        \n        ::\n        \n            ? lfunthetainit(L, [abs(t), arg(t)])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_851lfunthetainit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_tdom = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunthetainit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_tdom,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tdom);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunthetainit") < 0)) __PYX_ERR(4, 15230, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    __pyx_v_tdom = values[1];
    if (values[2]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15230, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15230, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunthetainit", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15230, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunthetainit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_850lfunthetainit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_tdom, __pyx_v_m, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_850lfunthetainit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision) {
  int __pyx_v__have_tdom;
  GEN __pyx_v__L;
  GEN __pyx_v__tdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunthetainit", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_tdom);

  /* "cypari/auto_instance.pxi":15274
 *             ? lfunthetainit(L, [abs(t), arg(t)])
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15275
 *         '''
 *         L = objtogen(L)
 *         cdef bint _have_tdom = (tdom is not None)             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 */
  __pyx_t_2 = (__pyx_v_tdom != Py_None);
  __pyx_v__have_tdom = __pyx_t_2;

  /* "cypari/auto_instance.pxi":15276
 *         L = objtogen(L)
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15277
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:
 *             tdom = objtogen(tdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tdom, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_tdom, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":15276
 *         L = objtogen(L)
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":15278
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 15278, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15279
 *             tdom = objtogen(tdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_instance.pxi":15280
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 */
  __pyx_v__tdom = NULL;

  /* "cypari/auto_instance.pxi":15281
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15282
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tdom)->__pyx_base.g;
    __pyx_v__tdom = __pyx_t_4;

    /* "cypari/auto_instance.pxi":15281
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":15283
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15284
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15283
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15285
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunthetainit(__pyx_v__L, __pyx_v__tdom, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15286
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuntwist(self, L, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15230
 *         return _ret
 * 
 *     def lfunthetainit(self, L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for evaluating the :math:`m`-th derivative of theta
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunthetainit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_tdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15288
 *         return new_gen(_ret)
 * 
 *     def lfuntwist(self, L, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the Ldata structure (without initialization) corresponding to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_853lfuntwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_852lfuntwist[] = "\n        Creates the Ldata structure (without initialization) corresponding to the\n        twist of L by the primitive character attached to the Dirichlet character\n        :literal:`chi`. The conductor of the character must be coprime to the conductor\n        of the L-function :math:`L`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_853lfuntwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuntwist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_chi,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_L)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfuntwist", 1, 2, 2, 1); __PYX_ERR(4, 15288, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuntwist") < 0)) __PYX_ERR(4, 15288, __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_L = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuntwist", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15288, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuntwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_852lfuntwist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_chi);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_852lfuntwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_chi) {
  GEN __pyx_v__L;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfuntwist", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":15295
 *         of the L-function :math:`L`.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15296
 *         '''
 *         L = objtogen(L)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15297
 *         L = objtogen(L)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15297, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15298
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = lfuntwist(_L, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15299
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuntwist(_L, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15300
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = lfuntwist(_L, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuntwist(__pyx_v__L, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":15301
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = lfuntwist(_L, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunzeros(self, L, lim, long divz=8, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15288
 *         return new_gen(_ret)
 * 
 *     def lfuntwist(self, L, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the Ldata structure (without initialization) corresponding to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfuntwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15303
 *         return new_gen(_ret)
 * 
 *     def lfunzeros(self, L, lim, long divz=8, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`lim` being either a positive upper limit or a non-empty real
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_855lfunzeros(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_854lfunzeros[] = "\n        :literal:`lim` being either a positive upper limit or a non-empty real\n        interval inside :math:`[0,+ oo [`, computes an\n        ordered list of zeros of :math:`L(s)` on the critical line up to the given\n        upper limit or in the given interval. Use a naive algorithm which may miss\n        some zeros: it assumes that two consecutive zeros at height :math:`T >= 1`\n        differ at least by :math:`2\\pi/\\omega`, where\n        \n        .. MATH::\n        \n            \\omega := divz.(d\\log (T/2\\pi) +d+ 2\\log (N/(\\pi/2)^d)).\n        \n        To use a finer search mesh, set divz to some integral value\n        larger than the default ( = 8).\n        \n        ::\n        \n            ? lfunzeros(1, 30) \\\\ zeros of Rieman zeta up to height 30\n            %1 = [14.134[...], 21.022[...], 25.010[...]]\n            ? #lfunzeros(1, [100,110]) \\\\ count zeros with 100 <= Im(s) <= 110\n            %2 = 4\n        \n        The algorithm also assumes that all zeros are simple except\n        possibly on the real axis at :math:`s = k/2` and that there are no poles in the\n        search interval. (The possible zero at :math:`s = k/2` is repeated according to\n        its multiplicity.)\n        \n        Should you pass an :literal:`Linit` argument to the function, beware that the\n        algorithm needs at least\n        \n        ::\n        \n             L = lfuninit(Ldata, [T+1])\n        \n        where :math:`T` is the upper bound of the interval defined by\n        :literal:`lim`: this allows to detect zeros near :math:`T`. Make sure that your\n        :literal:`Linit` domain contains this one, i.e. a domain :math:`[1,T+1]` is fine but\n        :math:`[0, T]` is not! The algorithm assumes that a multiple zero at :math:`s = k / 2`\n        has order less than or equal to the maximal derivation order allowed by the\n        :literal:`Linit`. You may increase that value in the :literal:`Linit` but this is\n        costly: only do it f""or zeros of low height or in :literal:`lfunorderzero` instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_855lfunzeros(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_lim = 0;
  long __pyx_v_divz;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunzeros (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_lim,&__pyx_n_s_divz,&__pyx_n_s_precision,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_L)) != 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_lim)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunzeros", 0, 2, 4, 1); __PYX_ERR(4, 15303, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_divz);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunzeros") < 0)) __PYX_ERR(4, 15303, __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);
        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_L = values[0];
    __pyx_v_lim = values[1];
    if (values[2]) {
      __pyx_v_divz = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_divz == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15303, __pyx_L3_error)
    } else {
      __pyx_v_divz = ((long)8);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15303, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunzeros", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15303, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunzeros", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_854lfunzeros(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_lim, __pyx_v_divz, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_854lfunzeros(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_lim, long __pyx_v_divz, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__lim;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunzeros", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_lim);

  /* "cypari/auto_instance.pxi":15346
 *         costly: only do it for zeros of low height or in :literal:`lfunorderzero` instead.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         lim = objtogen(lim)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15347
 *         '''
 *         L = objtogen(L)
 *         lim = objtogen(lim)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lim, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lim, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15348
 *         L = objtogen(L)
 *         lim = objtogen(lim)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15348, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15349
 *         lim = objtogen(lim)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15350
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lim)->__pyx_base.g;
  __pyx_v__lim = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15351
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":15352
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":15351
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 */
  }

  /* "cypari/auto_instance.pxi":15353
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunzeros(__pyx_v__L, __pyx_v__lim, __pyx_v_divz, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15354
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lift(self, x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15303
 *         return new_gen(_ret)
 * 
 *     def lfunzeros(self, L, lim, long divz=8, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`lim` being either a positive upper limit or a non-empty real
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lfunzeros", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_lim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15356
 *         return new_gen(_ret)
 * 
 *     def lift(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`v` is omitted, lifts intmods from :math:`\mathbb{Z}/n\mathbb{Z}` in :math:`\mathbb{Z}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_857lift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_856lift[] = "\n        If :math:`v` is omitted, lifts intmods from :math:`\\mathbb{Z}/n\\mathbb{Z}` in :math:`\\mathbb{Z}`,\n        :math:`p`-adics from :math:`\\mathbb{Q}_p` to :math:`\\mathbb{Q}` (as :literal:`truncate`), and polmods to\n        polynomials. Otherwise, lifts only polmods whose modulus has main\n        variable\302\240:math:`v`. :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(lift,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? lift(Mod(5,3))\n            %1 = 2\n            ? lift(3 + O(3^9))\n            %2 = 3\n            ? lift(Mod(x,x^2+1))\n            %3 = x\n            ? lift(Mod(x,x^2+1))\n            %4 = x\n        \n        Lifts are performed recursively on an object components, but only\n        by :emphasis:`one level`: once a :literal:`t_POLMOD` is lifted, the components of\n        the result are :emphasis:`not` lifted further.\n        \n        ::\n        \n            ? lift(x * Mod(1,3) + Mod(2,3))\n            %4 = x + 2\n            ? lift(x * Mod(y,y^2+1) + Mod(2,3))\n            %5 = y*x + Mod(2, 3) \\\\ do you understand this one?\n            ? lift(x * Mod(y,y^2+1) + Mod(2,3), 'x)\n            %6 = Mod(y, y^2 + 1)*x + Mod(Mod(2, 3), y^2 + 1)\n            ? lift(%, y)\n            %7 = y*x + Mod(2, 3)\n        \n        To recursively lift all components not only by one level,\n        but as long as possible, use :literal:`liftall`. To lift only :literal:`t_INTMOD`\302\240s and\n        :literal:`t_PADIC`\302\240s components, use :literal:`liftint`. To lift only :literal:`t_POLMOD`\302\240s\n        components, use :literal:`liftpol`. Finally, :literal:`centerlift` allows to lift\n        :literal:`t_INTMOD`\302\240s and :literal:`t_PADIC`\302\240s using centered residues (lift of smallest\n        absolute value)"".\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_857lift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lift") < 0)) __PYX_ERR(4, 15356, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lift", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15356, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_856lift(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_856lift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("lift", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15399
 *         absolute value).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15400
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":15401
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":15402
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 15402, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":15401
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":15403
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = lift0(_x, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 15403, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15404
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lift0(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":15405
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = lift0(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lift0(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":15406
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = lift0(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def liftall(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15356
 *         return new_gen(_ret)
 * 
 *     def lift(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`v` is omitted, lifts intmods from :math:`\mathbb{Z}/n\mathbb{Z}` in :math:`\mathbb{Z}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15408
 *         return new_gen(_ret)
 * 
 *     def liftall(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_859liftall(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_858liftall[] = "\n        Recursively lift all components of :math:`x` from :math:`\\mathbb{Z}/n\\mathbb{Z}` to :math:`\\mathbb{Z}`,\n        from :math:`\\mathbb{Q}_p` to :math:`\\mathbb{Q}` (as :literal:`truncate`), and polmods to\n        polynomials. :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(liftall,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? liftall(x * (1 + O(3)) + Mod(2,3))\n            %1 = x + 2\n            ? liftall(x * Mod(y,y^2+1) + Mod(2,3)*Mod(z,z^2))\n            %2 = y*x + 2*z\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_859liftall(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("liftall (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_858liftall(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_858liftall(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("liftall", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15424
 *             %2 = y*x + 2*z
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15425
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftall(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15425, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15426
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = liftall(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15427
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftall(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = liftall(__pyx_v__x);

  /* "cypari/auto_instance.pxi":15428
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftall(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def liftint(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15408
 *         return new_gen(_ret)
 * 
 *     def liftall(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.liftall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15430
 *         return new_gen(_ret)
 * 
 *     def liftint(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_861liftint(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_860liftint[] = "\n        Recursively lift all components of :math:`x` from :math:`\\mathbb{Z}/n\\mathbb{Z}` to :math:`\\mathbb{Z}` and\n        from :math:`\\mathbb{Q}_p` to :math:`\\mathbb{Q}` (as :literal:`truncate`).\n        :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(liftint,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? liftint(x * (1 + O(3)) + Mod(2,3))\n            %1 = x + 2\n            ? liftint(x * Mod(y,y^2+1) + Mod(2,3)*Mod(z,z^2))\n            %2 = Mod(y, y^2 + 1)*x + Mod(Mod(2*z, z^2), y^2 + 1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_861liftint(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("liftint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_860liftint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_860liftint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("liftint", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15446
 *             %2 = Mod(y, y^2 + 1)*x + Mod(Mod(2*z, z^2), y^2 + 1)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15447
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftint(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15447, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15448
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = liftint(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15449
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftint(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = liftint(__pyx_v__x);

  /* "cypari/auto_instance.pxi":15450
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftint(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def liftpol(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15430
 *         return new_gen(_ret)
 * 
 *     def liftint(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.liftint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15452
 *         return new_gen(_ret)
 * 
 *     def liftpol(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` which are polmods to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_863liftpol(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_862liftpol[] = "\n        Recursively lift all components of :math:`x` which are polmods to\n        polynomials. :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(liftpol,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? liftpol(x * (1 + O(3)) + Mod(2,3))\n            %1 = (1 + O(3))*x + Mod(2, 3)\n            ? liftpol(x * Mod(y,y^2+1) + Mod(2,3)*Mod(z,z^2))\n            %2 = y*x + Mod(2, 3)*z\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_863liftpol(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("liftpol (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_862liftpol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_862liftpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("liftpol", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15467
 *             %2 = y*x + Mod(2, 3)*z
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15468
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftpol(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15468, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15469
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = liftpol(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15470
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftpol(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = liftpol(__pyx_v__x);

  /* "cypari/auto_instance.pxi":15471
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftpol(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def limitnum(self, expr, long k=0, alpha=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15452
 *         return new_gen(_ret)
 * 
 *     def liftpol(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` which are polmods to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.liftpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15473
 *         return new_gen(_ret)
 * 
 *     def limitnum(self, expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lagrange-Zagier numerical extrapolation of :emphasis:`expr`, corresponding to a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_865limitnum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_864limitnum[] = "\n        Lagrange-Zagier numerical extrapolation of :emphasis:`expr`, corresponding to a\n        sequence\n        :math:`u_n`, either given by a closure :literal:`n- > u(n)` or by a vector of values\n        I.e., assuming that :math:`u_n` tends to a finite limit :math:`\\ell`, try to determine\n        :math:`\\ell`. This routine is purely numerical and heuristic, thus may or may not\n        work on your examples; :math:`k` is ignored if :math:`u` is given by a vector,\n        and otherwise is a multiplier such that we extrapolate from :math:`u(kn)`.\n        \n        Assume that :math:`u_n` has an asymptotic expansion in :math:`n^{-\\alpha}` :\n        \n        .. MATH::\n        \n            u_n = \\ell + \\sum_{i >= 1} a_i n^{-i\\alpha}\n        \n        for some :math:`a_i`.\n        \n        ::\n        \n            ? limitnum(n -> n*sin(1/n))\n            %1 = 1.0000000000000000000000000000000000000\n            \n            ? limitnum(n -> (1+1/n)^n) - exp(1)\n            %2 = 0.E-37\n            \n            ? limitnum(n -> 2^(4*n+1)*(n!)^4 / (2*n)! /(2*n+1)! )\n            %3 = 3.1415926535897932384626433832795028842\n            ? Pi\n            %4 = 3.1415926535897932384626433832795028842\n        \n        If :math:`u_n` is given by a vector, it must be long enough for the extrapolation\n        to make sense: at least :math:`k` times the current :literal:`realprecision`. The\n        preferred format is thus a closure, although it becomes inconvenient\n        when :math:`u_n` cannot be directly computed in time polynomial in :math:`\\log n`,\n        for instance if it is defined as a sum or by induction. In that case,\n        passing a vector of values is the best option. It usually pays off to\n        interpolate :math:`u(kn)` for some :math:`k > 1`:\n        \n        ::\n        \n            ? limitnum(vector(10,n,(1+1/n)^n))\n             *** ^--------------------\n             *** limitnum: non-existent component in limitnum: in""dex < 20\n            \\\\ at this accuracy, we must have at least 20 values\n            ? limitnum(vector(20,n,(1+1/n)^n)) - exp(1)\n            %5 = -2.05... E-20\n            ? limitnum(vector(20,n, m=10*n;(1+1/m)^m)) - exp(1) \\\\ better accuracy\n            %6 = 0.E-37\n            \n            ? v = vector(20); s = 0;\n            ? for(i=1,#v, s += 1/i; v[i]= s - log(i));\n            ? limitnum(v) - Euler\n            %9 = -1.6... E-19\n            \n            ? V = vector(200); s = 0;\n            ? for(i=1,#V, s += 1/i; V[i]= s);\n            ? v = vector(#V \\ 10, i, V[10*i] - log(10*i));\n            ? limitnum(v) - Euler\n            %13 = 6.43... E-29\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_865limitnum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_expr = 0;
  long __pyx_v_k;
  PyObject *__pyx_v_alpha = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("limitnum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_expr,&__pyx_n_s_k,&__pyx_n_s_alpha,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_expr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "limitnum") < 0)) __PYX_ERR(4, 15473, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_expr = values[0];
    if (values[1]) {
      __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15473, __pyx_L3_error)
    } else {
      __pyx_v_k = ((long)0);
    }
    __pyx_v_alpha = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15473, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("limitnum", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15473, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.limitnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_864limitnum(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_expr, __pyx_v_k, __pyx_v_alpha, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_864limitnum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision) {
  int __pyx_v__have_alpha;
  GEN __pyx_v__expr;
  GEN __pyx_v__alpha;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("limitnum", 0);
  __Pyx_INCREF(__pyx_v_expr);
  __Pyx_INCREF(__pyx_v_alpha);

  /* "cypari/auto_instance.pxi":15534
 *             %13 = 6.43... E-29
 *         '''
 *         expr = objtogen(expr)             # <<<<<<<<<<<<<<
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_expr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_expr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15535
 *         '''
 *         expr = objtogen(expr)
 *         cdef bint _have_alpha = (alpha is not None)             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 */
  __pyx_t_2 = (__pyx_v_alpha != Py_None);
  __pyx_v__have_alpha = __pyx_t_2;

  /* "cypari/auto_instance.pxi":15536
 *         expr = objtogen(expr)
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15537
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:
 *             alpha = objtogen(alpha)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_alpha, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15537, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":15536
 *         expr = objtogen(expr)
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":15538
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 15538, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15539
 *             alpha = objtogen(alpha)
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_expr)->__pyx_base.g;
  __pyx_v__expr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":15540
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 */
  __pyx_v__alpha = NULL;

  /* "cypari/auto_instance.pxi":15541
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":15542
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_alpha)->__pyx_base.g;
    __pyx_v__alpha = __pyx_t_4;

    /* "cypari/auto_instance.pxi":15541
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":15543
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":15544
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = limitnum0(__pyx_v__expr, __pyx_v_k, __pyx_v__alpha, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15545
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lindep(self, v, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15473
 *         return new_gen(_ret)
 * 
 *     def limitnum(self, expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lagrange-Zagier numerical extrapolation of :emphasis:`expr`, corresponding to a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.limitnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_expr);
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15547
 *         return new_gen(_ret)
 * 
 *     def lindep(self, v, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a small non-trivial integral linear
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_867lindep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_866lindep[] = "\n        finds a small non-trivial integral linear\n        combination between components of :math:`v`. If none can be found return an empty\n        vector.\n        \n        If :math:`v` is a vector with real/complex entries we use a floating point\n        (variable precision) LLL algorithm. If :math:`flag = 0` the accuracy is chosen\n        internally using a crude heuristic. If :math:`flag > 0` the computation is done with\n        an accuracy of :math:`flag` decimal digits. To get meaningful results in the latter\n        case, the parameter :math:`flag` should be smaller than the number of correct\n        decimal digits in the input.\n        \n        ::\n        \n            ? lindep([sqrt(2), sqrt(3), sqrt(2)+sqrt(3)])\n            %1 = [-1, -1, 1]~\n        \n        If :math:`v` is :math:`p`-adic, :math:`flag` is ignored and the algorithm LLL-reduces a\n        suitable (dual) lattice.\n        \n        ::\n        \n            ? lindep([1, 2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)])\n            %2 = [1, -2]~\n        \n        If :math:`v` is a matrix (or a vector of column vectors, or a vector of row\n        vectors), :math:`flag` is ignored and the function returns a non trivial kernel\n        vector if one exists, else an empty vector.\n        \n        ::\n        \n            ? lindep([1,2,3;4,5,6;7,8,9])\n            %3 = [1, -2, 1]~\n            ? lindep([[1,0], [2,0]])\n            %4 = [2, -1]~\n            ? lindep([[1,0], [0,1]])\n            %5 = []~\n        \n        If :math:`v` contains polynomials or power series over some base field, finds a\n        linear relation with coefficients in the field.\n        \n        ::\n        \n            ? lindep([x*y, x^2 + y, x^2*y + x*y^2, 1])\n            %4 = [y, y, -1, -y^2]~\n        \n        For better control, it is preferable to use :literal:`t_POL` rather\n        than :literal:`t_SER` in the input, otherwise one gets a linear combination which is\n        :math:`t`-adically small, ""but not necessarily :math:`0`. Indeed, power series are first\n        converted to the minimal absolute accuracy occurring among the entries of :math:`v`\n        (which can cause some coefficients to be ignored), then truncated to\n        polynomials:\n        \n        ::\n        \n            ? v = [t^2+O(t^4), 1+O(t^2)]; L=lindep(v)\n            %1 = [1, 0]~\n            ? v*L\n            %2 = t^2+O(t^4) \\\\ small but not 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_867lindep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lindep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_flag,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_v)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lindep") < 0)) __PYX_ERR(4, 15547, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15547, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lindep", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15547, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lindep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_866lindep(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_v, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_866lindep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v, long __pyx_v_flag) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lindep", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":15608
 *             %2 = t^2+O(t^4) \\ small but not 0
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15609
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = lindep0(_v, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15609, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15610
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lindep0(_v, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15611
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = lindep0(_v, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lindep0(__pyx_v__v, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":15612
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = lindep0(_v, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def listinsert(self, L, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15547
 *         return new_gen(_ret)
 * 
 *     def lindep(self, v, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a small non-trivial integral linear
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lindep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15614
 *         return new_gen(_ret)
 * 
 *     def listinsert(self, L, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inserts the object :math:`x` at
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_869listinsert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_868listinsert[] = "\n        Inserts the object :math:`x` at\n        position :math:`n` in :math:`L` (which must be of type :literal:`t_LIST`). This has\n        complexity :math:`O(\\#L - n + 1)`: all the\n        remaining elements of :emphasis:`list` (from position :math:`n+1` onwards) are shifted\n        to the right.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_869listinsert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listinsert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_x,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("listinsert", 1, 3, 3, 1); __PYX_ERR(4, 15614, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("listinsert", 1, 3, 3, 2); __PYX_ERR(4, 15614, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listinsert") < 0)) __PYX_ERR(4, 15614, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_L = values[0];
    __pyx_v_x = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15614, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listinsert", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15614, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listinsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_868listinsert(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_868listinsert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__L;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("listinsert", 0);
  __Pyx_INCREF(__pyx_v_L);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15622
 *         to the right.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15623
 *         '''
 *         L = objtogen(L)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15624
 *         L = objtogen(L)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15624, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15625
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listinsert(_L, _x, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15626
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = listinsert(_L, _x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15627
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listinsert(_L, _x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = listinsert(__pyx_v__L, __pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":15628
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listinsert(_L, _x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def listkill(self, L):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15614
 *         return new_gen(_ret)
 * 
 *     def listinsert(self, L, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inserts the object :math:`x` at
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listinsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15630
 *         return new_gen(_ret)
 * 
 *     def listkill(self, L):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, retained for backward compatibility. Just use :literal:`L = List()`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_871listkill(PyObject *__pyx_v_self, PyObject *__pyx_v_L); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_870listkill[] = "\n        Obsolete, retained for backward compatibility. Just use :literal:`L = List()`\n        instead of :literal:`listkill(L)`. In most cases, you won't even need that, e.g.\n        local variables are automatically cleared when a user function returns.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_871listkill(PyObject *__pyx_v_self, PyObject *__pyx_v_L) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listkill (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_870listkill(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_L));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_870listkill(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__L;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("listkill", 0);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":15636
 *         local variables are automatically cleared when a user function returns.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)
 *         L = objtogen(L)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 15636, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":15637
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         L = objtogen(L)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 15637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":15638
 *         from warnings import warn
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 15638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":15639
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         listkill(_L)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 15639, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15640
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         listkill(_L)
 *         clear_stack()
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_instance.pxi":15641
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         listkill(_L)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  listkill(__pyx_v__L);

  /* "cypari/auto_instance.pxi":15642
 *         cdef GEN _L = (<Gen>L).g
 *         listkill(_L)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def listpop(self, list, long n=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15630
 *         return new_gen(_ret)
 * 
 *     def listkill(self, L):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, retained for backward compatibility. Just use :literal:`L = List()`
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listkill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15644
 *         clear_stack()
 * 
 *     def listpop(self, list, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the :math:`n`-th element of the list
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_873listpop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_872listpop[] = "\n        Removes the :math:`n`-th element of the list\n        :emphasis:`list` (which must be of type :literal:`t_LIST`). If :math:`n` is omitted,\n        or greater than the list current length, removes the last element.\n        If the list is already empty, do nothing. This runs in time :math:`O(\\#L - n + 1)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_873listpop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_list = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listpop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_list,&__pyx_n_s_n,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_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listpop") < 0)) __PYX_ERR(4, 15644, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_list = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15644, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listpop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15644, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listpop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_872listpop(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_list, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_872listpop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_list, long __pyx_v_n) {
  GEN __pyx_v__list;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("listpop", 0);
  __Pyx_INCREF(__pyx_v_list);

  /* "cypari/auto_instance.pxi":15651
 *         If the list is already empty, do nothing. This runs in time :math:`O(\#L - n + 1)`.
 *         '''
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15652
 *         '''
 *         list = objtogen(list)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         listpop0(_list, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15652, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15653
 *         list = objtogen(list)
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         listpop0(_list, n)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15654
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 *         listpop0(_list, n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  listpop0(__pyx_v__list, __pyx_v_n);

  /* "cypari/auto_instance.pxi":15655
 *         cdef GEN _list = (<Gen>list).g
 *         listpop0(_list, n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def listput(self, list, x, long n=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15644
 *         clear_stack()
 * 
 *     def listpop(self, list, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the :math:`n`-th element of the list
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listpop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15657
 *         clear_stack()
 * 
 *     def listput(self, list, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sets the :math:`n`-th element of the list
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_875listput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_874listput[] = "\n        Sets the :math:`n`-th element of the list\n        :emphasis:`list` (which must be of type :literal:`t_LIST`) equal to :math:`x`. If :math:`n` is omitted,\n        or greater than the list length, appends :math:`x`. The function returns the\n        inserted element.\n        \n        ::\n        \n            ? L = List();\n            ? listput(L, 1)\n            %2 = 1\n            ? listput(L, 2)\n            %3 = 2\n            ? L\n            %4 = List([1, 2])\n        \n        You may put an element into an occupied cell (not changing the\n        list length), but it is easier to use the standard :literal:`list[n] = x`\n        construct.\n        \n        ::\n        \n            ? listput(L, 3, 1) \\\\ insert at position 1\n            %5 = 3\n            ? L\n            %6 = List([3, 2])\n            ? L[2] = 4 \\\\ simpler\n            %7 = List([3, 4])\n            ? L[10] = 1 \\\\ can't insert beyond the end of the list\n             *** at top-level: L[10]=1\n             *** ^------\n             *** non-existent component: index > 2\n            ? listput(L, 1, 10) \\\\ but listput can\n            %8 = 1\n            ? L\n            %9 = List([3, 2, 1])\n        \n        This function runs in time :math:`O(\\#L)` in the worst case (when the list must\n        be reallocated), but in time :math:`O(1)` on average: any number of successive\n        :literal:`listput`\302\240s run in time :math:`O(\\#L)`, where :math:`\\#L` denotes the list\n        :emphasis:`final` length.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_875listput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_list = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listput (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_list,&__pyx_n_s_x,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_list)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("listput", 0, 2, 3, 1); __PYX_ERR(4, 15657, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listput") < 0)) __PYX_ERR(4, 15657, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_list = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15657, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listput", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15657, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_874listput(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_list, __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_874listput(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_list, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__list;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("listput", 0);
  __Pyx_INCREF(__pyx_v_list);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15700
 *         :emphasis:`final` length.
 *         '''
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15701
 *         '''
 *         list = objtogen(list)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15702
 *         list = objtogen(list)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15702, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15703
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listput0(_list, _x, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15704
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = listput0(_list, _x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15705
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listput0(_list, _x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = listput0(__pyx_v__list, __pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":15706
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listput0(_list, _x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def listsort(self, L, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15657
 *         clear_stack()
 * 
 *     def listput(self, list, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sets the :math:`n`-th element of the list
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15708
 *         return new_gen(_ret)
 * 
 *     def listsort(self, L, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the :literal:`t_LIST` :emphasis:`list` in place, with respect to the (somewhat
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_877listsort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_876listsort[] = "\n        Sorts the :literal:`t_LIST` :emphasis:`list` in place, with respect to the (somewhat\n        arbitrary) universal comparison function :literal:`cmp`. In particular, the\n        ordering is the same as for sets and :literal:`setsearch` can be used on a sorted\n        list.\n        \n        ::\n        \n            ? L = List([1,2,4,1,3,-1]); listsort(L); L\n            %1 = List([-1, 1, 1, 2, 3, 4])\n            ? setsearch(L, 4)\n            %2 = 6\n            ? setsearch(L, -2)\n            %3 = 0\n        \n        This is faster than the :literal:`vecsort` command since the list\n        is sorted in place: no copy is made. No value returned.\n        \n        If :math:`flag` is non-zero, suppresses all repeated coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_877listsort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listsort (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_flag,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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listsort") < 0)) __PYX_ERR(4, 15708, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15708, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listsort", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15708, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_876listsort(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_876listsort(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_flag) {
  GEN __pyx_v__L;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("listsort", 0);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":15729
 *         If :math:`flag` is non-zero, suppresses all repeated coefficients.
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15730
 *         '''
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         listsort(_L, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15730, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15731
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         listsort(_L, flag)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15732
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         listsort(_L, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  listsort(__pyx_v__L, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":15733
 *         cdef GEN _L = (<Gen>L).g
 *         listsort(_L, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def lngamma(self, x, long precision=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15708
 *         return new_gen(_ret)
 * 
 *     def listsort(self, L, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the :literal:`t_LIST` :emphasis:`list` in place, with respect to the (somewhat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.listsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15735
 *         clear_stack()
 * 
 *     def lngamma(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the logarithm of the gamma function of :math:`x`. This
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_879lngamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_878lngamma[] = "\n        Principal branch of the logarithm of the gamma function of :math:`x`. This\n        function is analytic on the complex plane with non-positive integers\n        removed, and can have much larger arguments than :literal:`gamma` itself.\n        \n        For :math:`x` a power series such that :math:`x(0)` is not a pole of :literal:`gamma`,\n        compute the Taylor expansion. (PARI only knows about regular power series\n        and can't include logarithmic terms.)\n        \n        ::\n        \n            ? lngamma(1+x+O(x^2))\n            %1 = -0.57721566490153286060651209008240243104*x + O(x^2)\n            ? lngamma(x+O(x^2))\n             *** at top-level: lngamma(x+O(x^2))\n             *** ^-----------------\n             *** lngamma: domain error in lngamma: valuation != 0\n            ? lngamma(-1+x+O(x^2))\n             *** lngamma: Warning: normalizing a series with 0 leading term.\n             *** at top-level: lngamma(-1+x+O(x^2))\n             *** ^--------------------\n             *** lngamma: domain error in intformal: residue(series, pole) != 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_879lngamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lngamma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lngamma") < 0)) __PYX_ERR(4, 15735, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15735, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lngamma", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15735, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lngamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_878lngamma(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_878lngamma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lngamma", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15759
 *              *** lngamma: domain error in intformal: residue(series, pole) != 0
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15760
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15760, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15761
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glngamma(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15762
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glngamma(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":15763
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glngamma(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glngamma(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15764
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glngamma(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def localbitprec(self, long p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15735
 *         clear_stack()
 * 
 *     def lngamma(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the logarithm of the gamma function of :math:`x`. This
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.lngamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15766
 *         return new_gen(_ret)
 * 
 *     def localbitprec(self, long p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Set the real precision to :math:`p` bits in the dynamic scope. All computations
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_881localbitprec(PyObject *__pyx_v_self, PyObject *__pyx_arg_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_880localbitprec[] = "\n        Set the real precision to :math:`p` bits in the dynamic scope. All computations\n        are performed as if :literal:`realbitprecision` was :math:`p`:\n        transcendental constants (e.g.\302\240:literal:`Pi`) and\n        conversions from exact to floating point inexact data use :math:`p` bits, as well as\n        iterative routines implicitly using a floating point\n        accuracy as a termination criterion (e.g.\302\240:literal:`solve` or :literal:`intnum`).\n        But :literal:`realbitprecision` itself is unaffected\n        and is \"unmasked\" when we exit the dynamic (:emphasis:`not` lexical) scope.\n        In effect, this is similar to\n        \n        ::\n        \n            my(bit = default(realbitprecision));\n            default(realbitprecision,p);\n            ...\n            default(realbitprecision, bit);\n        \n        but is both less cumbersome, cleaner (no need to manipulate\n        a global variable, which in fact never changes and is only temporarily masked)\n        and more robust: if the above computation is interrupted or an exception\n        occurs, :literal:`realbitprecision` will not be restored as intended.\n        \n        Such :literal:`localbitprec` statements can be nested, the innermost one taking\n        precedence as expected. Beware that :literal:`localbitprec` follows the semantic of\n        :literal:`local`, not :literal:`my`: a subroutine called from :literal:`localbitprec` scope\n        uses the local accuracy:\n        \n        ::\n        \n            ? f()=bitprecision(1.0);\n            ? f()\n            %2 = 128\n            ? localbitprec(1000); f()\n            %3 = 1024\n        \n        Note that the bit precision of :emphasis:`data` (:literal:`1.0` in the\n        above example) increases by steps of 64 (32 on a 32-bit machine) so we get\n        :math:`1024` instead of the expected :math:`1000`; :literal:`localbitprec` bounds the\n        relative error exactly as specified in"" functions that support that\n        granularity (e.g.\302\240:literal:`lfun`), and rounded to the next multiple of 64\n        (resp.\302\24032) everywhere else.\n        \n        :strong:`Warning.` Changing :literal:`realbitprecision` or :literal:`realprecision`\n        in programs is deprecated in favor of :literal:`localbitprec` and\n        :literal:`localprec`. Think about the :literal:`realprecision` and\n        :literal:`realbitprecision` defaults as interactive commands for the :literal:`gp`\n        interpreter, best left out of GP programs. Indeed, the above rules imply that\n        mixing both constructs yields surprising results:\n        \n        ::\n        \n            ? \\p38\n            ? localprec(19); default(realprecision,1000); Pi\n            %1 = 3.141592653589793239\n            ? \\p\n             realprecision = 1001 significant digits (1000 digits displayed)\n        \n        Indeed, :literal:`realprecision` itself is ignored within\n        :literal:`localprec` scope, so :literal:`Pi` is computed to a low accuracy. And when\n        we leave the :literal:`localprec` scope, :literal:`realprecision` only regains precedence,\n        it is not \"restored\" to the original value.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_881localbitprec(PyObject *__pyx_v_self, PyObject *__pyx_arg_p) {
  long __pyx_v_p;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("localbitprec (wrapper)", 0);
  assert(__pyx_arg_p); {
    __pyx_v_p = __Pyx_PyInt_As_long(__pyx_arg_p); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15766, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.localbitprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_880localbitprec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_p));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_880localbitprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("localbitprec", 0);

  /* "cypari/auto_instance.pxi":15830
 *         it is not "restored" to the original value.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         localbitprec(p)
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 15830, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15831
 *         '''
 *         sig_on()
 *         localbitprec(p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  localbitprec(__pyx_v_p);

  /* "cypari/auto_instance.pxi":15832
 *         sig_on()
 *         localbitprec(p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def localprec(self, long p):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15766
 *         return new_gen(_ret)
 * 
 *     def localbitprec(self, long p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Set the real precision to :math:`p` bits in the dynamic scope. All computations
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.localbitprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15834
 *         clear_stack()
 * 
 *     def localprec(self, long p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Set the real precision to :math:`p` in the dynamic scope. All computations
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_883localprec(PyObject *__pyx_v_self, PyObject *__pyx_arg_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_882localprec[] = "\n        Set the real precision to :math:`p` in the dynamic scope. All computations\n        are performed as if :literal:`realprecision` was :math:`p`:\n        transcendental constants (e.g.\302\240:literal:`Pi`) and\n        conversions from exact to floating point inexact data use :math:`p` decimal\n        digits, as well as iterative routines implicitly using a floating point\n        accuracy as a termination criterion (e.g.\302\240:literal:`solve` or :literal:`intnum`).\n        But :literal:`realprecision` itself is unaffected\n        and is \"unmasked\" when we exit the dynamic (:emphasis:`not` lexical) scope.\n        In effect, this is similar to\n        \n        ::\n        \n            my(prec = default(realprecision));\n            default(realprecision,p);\n            ...\n            default(realprecision, prec);\n        \n        but is both less cumbersome, cleaner (no need to manipulate\n        a global variable, which in fact never changes and is only temporarily masked)\n        and more robust: if the above computation is interrupted or an exception\n        occurs, :literal:`realprecision` will not be restored as intended.\n        \n        Such :literal:`localprec` statements can be nested, the innermost one taking\n        precedence as expected. Beware that :literal:`localprec` follows the semantic of\n        :literal:`local`, not :literal:`my`: a subroutine called from :literal:`localprec` scope\n        uses the local accuracy:\n        \n        ::\n        \n            ? f()=precision(1.);\n            ? f()\n            %2 = 38\n            ? localprec(19); f()\n            %3 = 19\n        \n        :strong:`Warning.` Changing :literal:`realprecision` itself in programs is\n        now deprecated in favor of :literal:`localprec`. Think about the\n        :literal:`realprecision` default as an interactive command for the :literal:`gp`\n        interpreter, best left out of GP programs. Indeed, the above rules\n        imply"" that mixing both constructs yields surprising results:\n        \n        ::\n        \n            ? \\p38\n            ? localprec(19); default(realprecision,100); Pi\n            %1 = 3.141592653589793239\n            ? \\p\n             realprecision = 115 significant digits (100 digits displayed)\n        \n        Indeed, :literal:`realprecision` itself is ignored within\n        :literal:`localprec` scope, so :literal:`Pi` is computed to a low accuracy. And when\n        we leave :literal:`localprec` scope, :literal:`realprecision` only regains precedence,\n        it is not \"restored\" to the original value.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_883localprec(PyObject *__pyx_v_self, PyObject *__pyx_arg_p) {
  long __pyx_v_p;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("localprec (wrapper)", 0);
  assert(__pyx_arg_p); {
    __pyx_v_p = __Pyx_PyInt_As_long(__pyx_arg_p); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15834, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.localprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_882localprec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_p));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_882localprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_p) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("localprec", 0);

  /* "cypari/auto_instance.pxi":15890
 *         it is not "restored" to the original value.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         localprec(p)
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 15890, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15891
 *         '''
 *         sig_on()
 *         localprec(p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  localprec(__pyx_v_p);

  /* "cypari/auto_instance.pxi":15892
 *         sig_on()
 *         localprec(p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def log(self, x, long precision=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15834
 *         clear_stack()
 * 
 *     def localprec(self, long p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Set the real precision to :math:`p` in the dynamic scope. All computations
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.localprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15894
 *         clear_stack()
 * 
 *     def log(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the natural logarithm of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_885log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_884log[] = "\n        Principal branch of the natural logarithm of\n        :math:`x \\in \\mathbb{C}^*`, i.e.\302\240such that :math:`\\Im (\\log (x))\\in ]-\\pi,\\pi]`.\n        The branch cut lies\n        along the negative real axis, continuous with quadrant 2, i.e.\302\240such that\n        :math:`\\lim_{b\\to 0^+} \\log (a+bi) = \\log a` for :math:`a \\in\\mathbb{R}^*`. The result is complex\n        (with imaginary part equal to :math:`\\pi`) if :math:`x\\in \\mathbb{R}` and :math:`x < 0`. In general,\n        the algorithm uses the formula\n        \n        .. MATH::\n        \n            \\log (x) ~ (\\pi)/(2agm(1, 4/s)) - m \\log 2,\n        \n        if :math:`s = x 2^m` is large enough. (The result is exact to :math:`B` bits provided\n        :math:`s > 2^{B/2}`.) At low accuracies, the series expansion near :math:`1` is used.\n        \n        :math:`p`-adic arguments are also accepted for :math:`x`, with the convention that\n        :math:`\\log (p) = 0`. Hence in particular :math:`\\exp (\\log (x))/x` is not in general equal to\n        1 but to a :math:`(p-1)`-th root of unity (or :math:`\302\2611` if :math:`p = 2`) times a power of :math:`p`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_885log(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "log") < 0)) __PYX_ERR(4, 15894, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15894, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15894, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_884log(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_884log(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("log", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15915
 *         1 but to a :math:`(p-1)`-th root of unity (or :math:`1` if :math:`p = 2`) times a power of :math:`p`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15916
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15916, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15917
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15918
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glog(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":15919
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glog(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15920
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def log1p(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15894
 *         clear_stack()
 * 
 *     def log(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the natural logarithm of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15922
 *         return new_gen(_ret)
 * 
 *     def log1p(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\log (1+x)`, computed in a way that is also accurate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_887log1p(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_886log1p[] = "\n        Return :math:`\\log (1+x)`, computed in a way that is also accurate\n        when the real part of :math:`x` is near :math:`0`. This is the reciprocal function\n        of :literal:`expm1`:math:`(x) = \\exp (x)-1`.\n        \n        ::\n        \n            ? default(realprecision, 10000); x = Pi*1e-100;\n            ? (expm1(log1p(x)) - x) / x\n            %2 = -7.668242895059371866 E-10019\n            ? (log1p(expm1(x)) - x) / x\n            %3 = -7.668242895059371866 E-10019\n        \n        When :math:`x` is small, this function is both faster and more\n        accurate than :math:`\\log (1+x)`:\n        \n        ::\n        \n            ? \\p38\n            ? x = 1e-20;\n            ? localprec(100); c = log1p(x); \\\\ reference point\n            ? a = log1p(x); abs((a - c)/c)\n            %6 = 0.E-38\n            ? b = log(1+x); abs((b - c)/c) \\\\ slightly less accurate\n            %7 = 1.5930919111324522770 E-38\n            ? for (i=1,10^5,log1p(x))\n            time = 81 ms.\n            ? for (i=1,10^5,log(1+x))\n            time = 100 ms. \\\\ slower, too\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_887log1p(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log1p (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "log1p") < 0)) __PYX_ERR(4, 15922, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 15922, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log1p", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15922, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.log1p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_886log1p(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_886log1p(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("log1p", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15953
 *             time = 100 ms. \\ slower, too
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15954
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15954, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15955
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog1p(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15956
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glog1p(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":15957
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog1p(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glog1p(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":15958
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog1p(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mapdelete(self, M, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15922
 *         return new_gen(_ret)
 * 
 *     def log1p(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\log (1+x)`, computed in a way that is also accurate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.log1p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15960
 *         return new_gen(_ret)
 * 
 *     def mapdelete(self, M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes :math:`x` from the domain of the map :math:`M`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_889mapdelete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_888mapdelete[] = "\n        Removes :math:`x` from the domain of the map :math:`M`.\n        \n        ::\n        \n            ? M = Map([\"a\",1; \"b\",3; \"c\",7]);\n            ? mapdelete(M,\"b\");\n            ? Mat(M)\n            [\"a\" 1]\n            \n            [\"c\" 7]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_889mapdelete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mapdelete (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_x,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_M)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mapdelete", 1, 2, 2, 1); __PYX_ERR(4, 15960, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mapdelete") < 0)) __PYX_ERR(4, 15960, __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_M = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mapdelete", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15960, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mapdelete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_888mapdelete(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_888mapdelete(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_x) {
  GEN __pyx_v__M;
  GEN __pyx_v__x;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mapdelete", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":15973
 *             ["c" 7]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15974
 *         '''
 *         M = objtogen(M)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":15975
 *         M = objtogen(M)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 15975, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":15976
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         mapdelete(_M, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15977
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         mapdelete(_M, _x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":15978
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 *         mapdelete(_M, _x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  mapdelete(__pyx_v__M, __pyx_v__x);

  /* "cypari/auto_instance.pxi":15979
 *         cdef GEN _x = (<Gen>x).g
 *         mapdelete(_M, _x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def mapget(self, M, x):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":15960
 *         return new_gen(_ret)
 * 
 *     def mapdelete(self, M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes :math:`x` from the domain of the map :math:`M`.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mapdelete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":15981
 *         clear_stack()
 * 
 *     def mapget(self, M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the image of :math:`x` by the map :math:`M`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_891mapget(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_890mapget[] = "\n        Returns the image of :math:`x` by the map :math:`M`.\n        \n        ::\n        \n            ? M=Map([\"a\",23;\"b\",43]);\n            ? mapget(M,\"a\")\n            %2 = 23\n            ? mapget(M,\"b\")\n            %3 = 43\n        \n        Raises an exception when the key :math:`x` is not present in :math:`M`.\n        \n        ::\n        \n            ? mapget(M,\"c\")\n             *** at top-level: mapget(M,\"c\")\n             *** ^-------------\n             *** mapget: non-existent component in mapget: index not in map\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_891mapget(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mapget (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_x,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_M)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mapget", 1, 2, 2, 1); __PYX_ERR(4, 15981, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mapget") < 0)) __PYX_ERR(4, 15981, __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_M = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mapget", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 15981, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mapget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_890mapget(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_890mapget(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_x) {
  GEN __pyx_v__M;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mapget", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16002
 *              *** mapget: non-existent component in mapget: index not in map
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16003
 *         '''
 *         M = objtogen(M)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16004
 *         M = objtogen(M)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16004, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16005
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = mapget(_M, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16006
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mapget(_M, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16007
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = mapget(_M, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mapget(__pyx_v__M, __pyx_v__x);

  /* "cypari/auto_instance.pxi":16008
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = mapget(_M, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mapput(self, M, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":15981
 *         clear_stack()
 * 
 *     def mapget(self, M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the image of :math:`x` by the map :math:`M`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mapget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16010
 *         return new_gen(_ret)
 * 
 *     def mapput(self, M, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Associates :math:`x` to :math:`y` in the map :math:`M`. The value :math:`y` can be retrieved
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_893mapput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_892mapput[] = "\n        Associates :math:`x` to :math:`y` in the map :math:`M`. The value :math:`y` can be retrieved\n        with :literal:`mapget`.\n        \n        ::\n        \n            ? M = Map();\n            ? mapput(M, \"foo\", 23);\n            ? mapput(M, 7718, \"bill\");\n            ? mapget(M, \"foo\")\n            %4 = 23\n            ? mapget(M, 7718)\n            %5 = \"bill\"\n            ? Vec(M) \\\\ keys\n            %6 = [7718, \"foo\"]\n            ? Mat(M)\n            %7 =\n            [ 7718 \"bill\"]\n            \n            [\"foo\" 23]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_893mapput(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mapput (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mapput", 1, 3, 3, 1); __PYX_ERR(4, 16010, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mapput", 1, 3, 3, 2); __PYX_ERR(4, 16010, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mapput") < 0)) __PYX_ERR(4, 16010, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_M = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mapput", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16010, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mapput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_892mapput(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_892mapput(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__M;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mapput", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":16032
 *             ["foo" 23]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16033
 *         '''
 *         M = objtogen(M)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16034
 *         M = objtogen(M)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16035
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16035, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16036
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16037
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         mapput(_M, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16038
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         mapput(_M, _x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16039
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         mapput(_M, _x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  mapput(__pyx_v__M, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":16040
 *         cdef GEN _y = (<Gen>y).g
 *         mapput(_M, _x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def matadjoint(self, M, long flag=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":16010
 *         return new_gen(_ret)
 * 
 *     def mapput(self, M, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Associates :math:`x` to :math:`y` in the map :math:`M`. The value :math:`y` can be retrieved
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mapput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16042
 *         clear_stack()
 * 
 *     def matadjoint(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         adjoint matrix of :math:`M`, i.e.a matrix :math:`N`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_895matadjoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_894matadjoint[] = "\n        adjoint matrix of :math:`M`, i.e.\302\240a matrix :math:`N`\n        of cofactors of :math:`M`, satisfying :math:`M*N = \\det (M)*\\mathrm{Id}`. :math:`M` must be a\n        (non-necessarily invertible) square matrix of dimension :math:`n`.\n        If :math:`flag` is 0 or omitted, we try to use Leverrier-Faddeev's algorithm,\n        which assumes that :math:`n!` invertible. If it fails or :math:`flag = 1`,\n        compute :math:`T = charpoly (M)` independently first and return\n        :math:`(-1)^{n-1} (T(x)-T(0))/x` evaluated at :math:`M`.\n        \n        ::\n        \n            ? a = [1,2,3;3,4,5;6,7,8] * Mod(1,4);\n            %2 =\n            [Mod(1, 4) Mod(2, 4) Mod(3, 4)]\n            \n            [Mod(3, 4) Mod(0, 4) Mod(1, 4)]\n            \n            [Mod(2, 4) Mod(3, 4) Mod(0, 4)]\n        \n        Both algorithms use :math:`O(n^4)` operations in the base ring, and are usually\n        slower than computing the characteristic polynomial or the inverse of :math:`M`\n        directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_895matadjoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matadjoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_flag,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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matadjoint") < 0)) __PYX_ERR(4, 16042, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16042, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matadjoint", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16042, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matadjoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_894matadjoint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_894matadjoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matadjoint", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":16066
 *         directly.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16067
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matadjoint0(_M, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16067, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16068
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matadjoint0(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16069
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matadjoint0(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matadjoint0(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":16070
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matadjoint0(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matalgtobasis(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16042
 *         clear_stack()
 * 
 *     def matadjoint(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         adjoint matrix of :math:`M`, i.e.a matrix :math:`N`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matadjoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16072
 *         return new_gen(_ret)
 * 
 *     def matalgtobasis(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_897matalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_896matalgtobasis[] = "\n        This function is deprecated, use :literal:`apply`.\n        \n        :math:`nf` being a number field in :literal:`nfinit` format, and :math:`x` a\n        (row or column) vector or matrix, apply :literal:`nfalgtobasis` to each entry\n        of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_897matalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matalgtobasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matalgtobasis", 1, 2, 2, 1); __PYX_ERR(4, 16072, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matalgtobasis") < 0)) __PYX_ERR(4, 16072, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matalgtobasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16072, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_896matalgtobasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_896matalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("matalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16080
 *         of :math:`x`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16080, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16081
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16082
 *         from warnings import warn
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16083
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16084
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 16084, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16085
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matalgtobasis(_nf, _x)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":16086
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matalgtobasis(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":16087
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matalgtobasis(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matalgtobasis(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":16088
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matalgtobasis(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matbasistoalg(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16072
 *         return new_gen(_ret)
 * 
 *     def matalgtobasis(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16090
 *         return new_gen(_ret)
 * 
 *     def matbasistoalg(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_899matbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_898matbasistoalg[] = "\n        This function is deprecated, use :literal:`apply`.\n        \n        :math:`nf` being a number field in :literal:`nfinit` format, and :math:`x` a\n        (row or column) vector or matrix, apply :literal:`nfbasistoalg` to each entry\n        of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_899matbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matbasistoalg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matbasistoalg", 1, 2, 2, 1); __PYX_ERR(4, 16090, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matbasistoalg") < 0)) __PYX_ERR(4, 16090, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matbasistoalg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16090, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_898matbasistoalg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_898matbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("matbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16098
 *         of :math:`x`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16098, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16099
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16100
 *         from warnings import warn
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16101
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":16102
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 16102, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16103
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matbasistoalg(_nf, _x)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":16104
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matbasistoalg(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":16105
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matbasistoalg(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matbasistoalg(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":16106
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matbasistoalg(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matcompanion(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16090
 *         return new_gen(_ret)
 * 
 *     def matbasistoalg(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16108
 *         return new_gen(_ret)
 * 
 *     def matcompanion(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The left companion matrix to the non-zero polynomial :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_901matcompanion(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_900matcompanion[] = "\n        The left companion matrix to the non-zero polynomial :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_901matcompanion(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matcompanion (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_900matcompanion(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_900matcompanion(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matcompanion", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16112
 *         The left companion matrix to the non-zero polynomial :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16113
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matcompanion(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16113, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16114
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matcompanion(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16115
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matcompanion(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matcompanion(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16116
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matcompanion(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matconcat(self, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16108
 *         return new_gen(_ret)
 * 
 *     def matcompanion(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The left companion matrix to the non-zero polynomial :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matcompanion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16118
 *         return new_gen(_ret)
 * 
 *     def matconcat(self, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a :literal:`t_MAT` built from the entries of :math:`v`, which may
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_903matconcat(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_902matconcat[] = "\n        Returns a :literal:`t_MAT` built from the entries of :math:`v`, which may\n        be a :literal:`t_VEC` (concatenate horizontally), a :literal:`t_COL` (concatenate\n        vertically), or a :literal:`t_MAT` (concatenate vertically each column, and\n        concatenate vertically the resulting matrices). The entries of :math:`v` are always\n        considered as matrices: they can themselves be :literal:`t_VEC` (seen as a row\n        matrix), a :literal:`t_COL` seen as a column matrix), a :literal:`t_MAT`, or a scalar (seen\n        as an :math:`1 x 1` matrix).\n        \n        ::\n        \n            ? A=[1,2;3,4]; B=[5,6]~; C=[7,8]; D=9;\n            ? matconcat([A, B]) \\\\ horizontal\n            %1 =\n            [1 2 5]\n            \n            [3 4 6]\n            ? matconcat([A, C]~) \\\\ vertical\n            %2 =\n            [1 2]\n            \n            [3 4]\n            \n            [7 8]\n            ? matconcat([A, B; C, D]) \\\\ block matrix\n            %3 =\n            [1 2 5]\n            \n            [3 4 6]\n            \n            [7 8 9]\n        \n        If the dimensions of the entries to concatenate do not match up, the above\n        rules are extended as follows:\n        \n        - each entry :math:`v_{i,j}` of :math:`v` has a natural length and height: :math:`1 x\n          1` for a scalar, :math:`1 x n` for a :literal:`t_VEC` of length :math:`n`, :math:`n x 1`\n          for a :literal:`t_COL`, :math:`m x n` for an :math:`m x n` :literal:`t_MAT`\n        \n        - let :math:`H_i` be the maximum over :math:`j` of the lengths of the :math:`v_{i,j}`,\n          let :math:`L_j` be the maximum over :math:`i` of the heights of the :math:`v_{i,j}`.\n          The dimensions of the :math:`(i,j)`-th block in the concatenated matrix are\n          :math:`H_i x L_j`.\n        \n        - a scalar :math:`s = v_{i,j}` is considered as :math:`s` times an identity matrix\n          of the block dimension :math:`\\min (H""_i,L_j)`\n        \n        - blocks are extended by 0 columns on the right and 0 rows at the\n          bottom, as needed.\n        \n        ::\n        \n            ? matconcat([1, [2,3]~, [4,5,6]~]) \\\\ horizontal\n            %4 =\n            [1 2 4]\n            \n            [0 3 5]\n            \n            [0 0 6]\n            ? matconcat([1, [2,3], [4,5,6]]~) \\\\ vertical\n            %5 =\n            [1 0 0]\n            \n            [2 3 0]\n            \n            [4 5 6]\n            ? matconcat([B, C; A, D]) \\\\ block matrix\n            %6 =\n            [5 0 7 8]\n            \n            [6 0 0 0]\n            \n            [1 2 9 0]\n            \n            [3 4 0 9]\n            ? U=[1,2;3,4]; V=[1,2,3;4,5,6;7,8,9];\n            ? matconcat(matdiagonal([U, V])) \\\\ block diagonal\n            %7 =\n            [1 2 0 0 0]\n            \n            [3 4 0 0 0]\n            \n            [0 0 1 2 3]\n            \n            [0 0 4 5 6]\n            \n            [0 0 7 8 9]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_903matconcat(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matconcat (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_902matconcat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_v));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_902matconcat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matconcat", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":16207
 *             [0 0 7 8 9]
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16208
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = matconcat(_v)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16208, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16209
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matconcat(_v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16210
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = matconcat(_v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matconcat(__pyx_v__v);

  /* "cypari/auto_instance.pxi":16211
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = matconcat(_v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdet(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16118
 *         return new_gen(_ret)
 * 
 *     def matconcat(self, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a :literal:`t_MAT` built from the entries of :math:`v`, which may
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matconcat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16213
 *         return new_gen(_ret)
 * 
 *     def matdet(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determinant of the square matrix :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_905matdet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_904matdet[] = "\n        Determinant of the square matrix :math:`x`.\n        \n        If :math:`flag = 0`, uses an appropriate algorithm depending on the coefficients:\n        \n        - integer entries: modular method due to Dixon, Pernet and Stein.\n        \n        - real or :math:`p`-adic entries: classical Gaussian elimination using maximal\n          pivot.\n        \n        - intmod entries: classical Gaussian elimination using first non-zero\n          pivot.\n        \n        - other cases: Gauss-Bareiss.\n        \n        If :math:`flag = 1`, uses classical Gaussian elimination with appropriate pivoting\n        strategy (maximal pivot for real or :math:`p`-adic coefficients). This is usually\n        worse than the default.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_905matdet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdet (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matdet") < 0)) __PYX_ERR(4, 16213, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16213, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matdet", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matdet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_904matdet(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_904matdet(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matdet", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16233
 *         worse than the default.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16234
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = det0(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16234, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16235
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = det0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16236
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = det0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = det0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":16237
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = det0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdetint(self, B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16213
 *         return new_gen(_ret)
 * 
 *     def matdet(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determinant of the square matrix :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matdet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16239
 *         return new_gen(_ret)
 * 
 *     def matdetint(self, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`B` be an :math:`m x n` matrix with integer coefficients. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_907matdetint(PyObject *__pyx_v_self, PyObject *__pyx_v_B); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_906matdetint[] = "\n        Let :math:`B` be an :math:`m x n` matrix with integer coefficients. The\n        :emphasis:`determinant` :math:`D` of the lattice generated by the columns of :math:`B` is\n        the square root of :math:`\\det (B^T B)` if :math:`B` has maximal rank :math:`m`, and :math:`0`\n        otherwise.\n        \n        This function uses the Gauss-Bareiss algorithm to compute a positive\n        :emphasis:`multiple` of :math:`D`. When :math:`B` is square, the function actually returns\n        :math:`D = \\|\\det B\\|`.\n        \n        This function is useful in conjunction with :literal:`mathnfmod`, which needs to\n        know such a multiple. If the rank is maximal and the matrix non-square,\n        you can obtain :math:`D` exactly using\n        \n        ::\n        \n             matdet( mathnfmod(B, matdetint(B)) )\n        \n        Note that as soon as one of the dimensions gets large (:math:`m` or :math:`n` is larger\n        than 20, say), it will often be much faster to use :literal:`mathnf(B, 1)` or\n        :literal:`mathnf(B, 4)` directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_907matdetint(PyObject *__pyx_v_self, PyObject *__pyx_v_B) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdetint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_906matdetint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_B));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_906matdetint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_B) {
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matdetint", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":16262
 *         :literal:`mathnf(B, 4)` directly.
 *         '''
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16263
 *         '''
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = detint(_B)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16263, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16264
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = detint(_B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16265
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = detint(_B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = detint(__pyx_v__B);

  /* "cypari/auto_instance.pxi":16266
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = detint(_B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdetmod(self, x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16239
 *         return new_gen(_ret)
 * 
 *     def matdetint(self, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`B` be an :math:`m x n` matrix with integer coefficients. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matdetint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16268
 *         return new_gen(_ret)
 * 
 *     def matdetmod(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` with :literal:`t_INT` entries and :math:`d` an arbitrary positive
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_909matdetmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_908matdetmod[] = "\n        Given a matrix :math:`x` with :literal:`t_INT` entries and :math:`d` an arbitrary positive\n        integer, return the determinant of :math:`x` modulo :math:`d`.\n        \n        ::\n        \n            ? A = [4,2,3; 4,5,6; 7,8,9]\n            \n            ? matdetmod(A,27)\n            %2 = 9\n        \n        Note that using the generic function :literal:`matdet` on a matrix with\n        :literal:`t_INTMOD` entries uses Gaussian reduction and will fail in general when\n        the modulus is not prime.\n        \n        ::\n        \n            ? matdet(A * Mod(1,27))\n             *** at top-level: matdet(A*Mod(1,27))\n             *** ^------------------\n             *** matdet: impossible inverse in Fl_inv: Mod(3, 27).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_909matdetmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdetmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_d,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matdetmod", 1, 2, 2, 1); __PYX_ERR(4, 16268, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matdetmod") < 0)) __PYX_ERR(4, 16268, __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_x = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matdetmod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16268, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matdetmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_908matdetmod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_908matdetmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matdetmod", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":16291
 *              *** matdet: impossible inverse in Fl_inv: Mod(3, 27).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16292
 *         '''
 *         x = objtogen(x)
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16293
 *         x = objtogen(x)
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16293, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16294
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matdetmod(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16295
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matdetmod(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16296
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matdetmod(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matdetmod(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_instance.pxi":16297
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matdetmod(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdiagonal(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16268
 *         return new_gen(_ret)
 * 
 *     def matdetmod(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` with :literal:`t_INT` entries and :math:`d` an arbitrary positive
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matdetmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16299
 *         return new_gen(_ret)
 * 
 *     def matdiagonal(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector, creates the diagonal matrix
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_911matdiagonal(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_910matdiagonal[] = "\n        :math:`x` being a vector, creates the diagonal matrix\n        whose diagonal entries are those of :math:`x`.\n        \n        ::\n        \n            ? matdiagonal([1,2,3]);\n            %1 =\n            [1 0 0]\n            \n            [0 2 0]\n            \n            [0 0 3]\n        \n        Block diagonal matrices are easily created using\n        :literal:`matconcat`:\n        \n        ::\n        \n            ? U=[1,2;3,4]; V=[1,2,3;4,5,6;7,8,9];\n            ? matconcat(matdiagonal([U, V]))\n            %1 =\n            [1 2 0 0 0]\n            \n            [3 4 0 0 0]\n            \n            [0 0 1 2 3]\n            \n            [0 0 4 5 6]\n            \n            [0 0 7 8 9]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_911matdiagonal(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdiagonal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_910matdiagonal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_910matdiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matdiagonal", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16332
 *             [0 0 7 8 9]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16333
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = diagonal(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16333, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16334
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = diagonal(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16335
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = diagonal(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = diagonal(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16336
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = diagonal(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mateigen(self, x, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16299
 *         return new_gen(_ret)
 * 
 *     def matdiagonal(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector, creates the diagonal matrix
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matdiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16338
 *         return new_gen(_ret)
 * 
 *     def mateigen(self, x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the (complex) eigenvectors of :math:`x` as columns of a matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_913mateigen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_912mateigen[] = "\n        Returns the (complex) eigenvectors of :math:`x` as columns of a matrix.\n        If :math:`flag = 1`, return :math:`[L,H]`, where :math:`L` contains the\n        eigenvalues and :math:`H` the corresponding eigenvectors; multiple eigenvalues are\n        repeated according to the eigenspace dimension (which may be less\n        than the eigenvalue multiplicity in the characteristic polynomial).\n        \n        This function first computes the characteristic polynomial of :math:`x` and\n        approximates its complex roots :math:`(\\lambda_i)`, then tries to compute the\n        eigenspaces as kernels of the :math:`x - \\lambda_i`. This algorithm is\n        ill-conditioned and is likely to miss kernel vectors if some roots of the\n        characteristic polynomial are close, in particular if it has multiple roots.\n        \n        ::\n        \n            ? A = [13,2; 10,14]; mateigen(A)\n            %1 =\n            [-1/2 2/5]\n            \n            [ 1 1]\n            ? [L,H] = mateigen(A, 1);\n            ? L\n            %3 = [9, 18]\n            ? H\n            %4 =\n            [-1/2 2/5]\n            \n            [ 1 1]\n        \n        For symmetric matrices, use :literal:`qfjacobi` instead; for Hermitian matrices,\n        compute\n        \n        ::\n        \n             A = real(x);\n             B = imag(x);\n             y = matconcat([A, -B; B, A]);\n        \n        and apply :literal:`qfjacobi` to :math:`y`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_913mateigen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mateigen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mateigen") < 0)) __PYX_ERR(4, 16338, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16338, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16338, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mateigen", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16338, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mateigen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_912mateigen(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_912mateigen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mateigen", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16379
 *         and apply :literal:`qfjacobi` to :math:`y`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16380
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16380, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16381
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mateigen(_x, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16382
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mateigen(_x, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":16383
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mateigen(_x, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mateigen(__pyx_v__x, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":16384
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mateigen(_x, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matfrobenius(self, M, long flag=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16338
 *         return new_gen(_ret)
 * 
 *     def mateigen(self, x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the (complex) eigenvectors of :math:`x` as columns of a matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mateigen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16386
 *         return new_gen(_ret)
 * 
 *     def matfrobenius(self, M, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Frobenius form of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_915matfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_914matfrobenius[] = "\n        Returns the Frobenius form of\n        the square matrix :literal:`M`. If :math:`flag = 1`, returns only the elementary divisors as\n        a vector of polynomials in the variable :literal:`v`. If :math:`flag = 2`, returns a\n        two-components vector [F,B] where :literal:`F` is the Frobenius form and :literal:`B` is\n        the basis change so that :math:`M = B^{-1}FB`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_915matfrobenius(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_flag,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matfrobenius") < 0)) __PYX_ERR(4, 16386, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16386, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matfrobenius", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16386, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_914matfrobenius(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_flag, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_914matfrobenius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("matfrobenius", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":16394
 *         the basis change so that :math:`M = B^{-1}FB`.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16395
 *         '''
 *         M = objtogen(M)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":16396
 *         M = objtogen(M)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":16397
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 16397, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":16396
 *         M = objtogen(M)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":16398
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 16398, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16399
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_6;

  /* "cypari/auto_instance.pxi":16400
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matfrobenius(__pyx_v__M, __pyx_v_flag, __pyx_v__v);

  /* "cypari/auto_instance.pxi":16401
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathess(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16386
 *         return new_gen(_ret)
 * 
 *     def matfrobenius(self, M, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Frobenius form of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16403
 *         return new_gen(_ret)
 * 
 *     def mathess(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a matrix similar to the square matrix :math:`x`, which is in upper Hessenberg
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_917mathess(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_916mathess[] = "\n        Returns a matrix similar to the square matrix :math:`x`, which is in upper Hessenberg\n        form (zero entries below the first subdiagonal).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_917mathess(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathess (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_916mathess(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_916mathess(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathess", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16408
 *         form (zero entries below the first subdiagonal).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16409
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hess(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16409, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16410
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hess(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16411
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hess(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hess(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16412
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hess(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathilbert(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16403
 *         return new_gen(_ret)
 * 
 *     def mathess(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a matrix similar to the square matrix :math:`x`, which is in upper Hessenberg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16414
 *         return new_gen(_ret)
 * 
 *     def mathilbert(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a :literal:`long`, creates the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_919mathilbert(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_918mathilbert[] = "\n        :math:`x` being a :literal:`long`, creates the\n        Hilbert matrixof order :math:`x`, i.e.\302\240the matrix whose coefficient\n        (:math:`i`,:math:`j`) is :math:`1/ (i+j-1)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_919mathilbert(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathilbert (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16414, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_918mathilbert(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_918mathilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mathilbert", 0);

  /* "cypari/auto_instance.pxi":16420
 *         (:math:`i`,:math:`j`) is :math:`1/ (i+j-1)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mathilbert(n)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 16420, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16421
 *         '''
 *         sig_on()
 *         cdef GEN _ret = mathilbert(n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mathilbert(__pyx_v_n);

  /* "cypari/auto_instance.pxi":16422
 *         sig_on()
 *         cdef GEN _ret = mathilbert(n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathnf(self, M, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16414
 *         return new_gen(_ret)
 * 
 *     def mathilbert(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a :literal:`long`, creates the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16424
 *         return new_gen(_ret)
 * 
 *     def mathnf(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`R` be a Euclidean ring, equal to :math:`\mathbb{Z}` or to :math:`K[X]` for some field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_921mathnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_920mathnf[] = "\n        Let :math:`R` be a Euclidean ring, equal to :math:`\\mathbb{Z}` or to :math:`K[X]` for some field\n        :math:`K`. If :math:`M` is a (not necessarily square) matrix with entries in :math:`R`, this\n        routine finds the :emphasis:`upper triangular` Hermite normal form of :math:`M`.\n        If the rank of :math:`M` is equal to its number of rows, this is a square\n        matrix. In general, the columns of the result form a basis of the :math:`R`-module\n        spanned by the columns of :math:`M`.\n        \n        The values of :math:`flag` are:\n        \n        - 0 (default): only return the Hermite normal form :math:`H`\n        \n        - 1 (complete output): return :math:`[H,U]`, where :math:`H` is the Hermite\n          normal form of :math:`M`, and :math:`U` is a transformation matrix such that :math:`MU = [0\\|H]`.\n          The matrix :math:`U` belongs to :math:`GL(R)`. When :math:`M` has a large kernel, the\n          entries of :math:`U` are in general huge.\n        \n        For these two values, we use a naive algorithm, which behaves well\n        in small dimension only. Larger values correspond to different algorithms,\n        are restricted to :emphasis:`integer` matrices, and all output the unimodular\n        matrix :math:`U`. From now on all matrices have integral entries.\n        \n        - :math:`flag = 4`, returns :math:`[H,U]` as in \"complete output\" above, using a\n          variant of LLL reduction along the way. The matrix :math:`U` is provably\n          small in the :math:`L_2` sense, and often close to optimal; but the\n          reduction is in general slow, although provably polynomial-time.\n        \n        If :math:`flag = 5`, uses Batut's algorithm and output :math:`[H,U,P]`, such that :math:`H` and\n        :math:`U` are as before and :math:`P` is a permutation of the rows such that :math:`P` applied\n        to :math:`MU` gives :math:`H`. This is in general faster than :math:`flag = 4` but the matri""x :math:`U`\n        is usually worse; it is heuristically smaller than with the default algorithm.\n        \n        When the matrix is dense and the dimension is large (bigger than 100, say),\n        :math:`flag = 4` will be fastest. When :math:`M` has maximal rank, then\n        \n        ::\n        \n             H = mathnfmod(M, matdetint(M))\n        \n        will be even faster. You can then recover :math:`U` as :math:`M^{-1}H`.\n        \n        ::\n        \n            ? M = matrix(3,4,i,j,random([-5,5]))\n            %1 =\n            [ 0 2 3 0]\n            \n            [-5 3 -5 -5]\n            \n            [ 4 3 -5 4]\n            \n            ? [H,U] = mathnf(M, 1);\n            ? U\n            %3 =\n            [-1 0 -1 0]\n            \n            [ 0 5 3 2]\n            \n            [ 0 3 1 1]\n            \n            [ 1 0 0 0]\n            \n            ? H\n            %5 =\n            [19 9 7]\n            \n            [ 0 9 1]\n            \n            [ 0 0 1]\n            \n            ? M*U\n            %6 =\n            [0 19 9 7]\n            \n            [0 0 9 1]\n            \n            [0 0 0 1]\n        \n        For convenience, :math:`M` is allowed to be a :literal:`t_VEC`, which is then\n        automatically converted to a :literal:`t_MAT`, as per the :literal:`Mat` function.\n        For instance to solve the generalized extended gcd problem, one may use\n        \n        ::\n        \n            ? v = [116085838, 181081878, 314252913,10346840];\n            ? [H,U] = mathnf(v, 1);\n            ? U\n            %2 =\n            [ 103 -603 15 -88]\n            \n            [-146 13 -1208 352]\n            \n            [ 58 220 678 -167]\n            \n            [-362 -144 381 -101]\n            ? v*U\n            %3 = [0, 0, 0, 1]\n        \n        This also allows to input a matrix as a :literal:`t_VEC` of\n        :literal:`t_COL`\302\240s of the same length (which :literal:`Mat` would concatenate to""\n        the :literal:`t_MAT` having those columns):\n        \n        ::\n        \n            ? v = [[1,0,4]~, [3,3,4]~, [0,-4,-5]~]; mathnf(v)\n            %1 =\n            [47 32 12]\n            \n            [ 0 1 0]\n            \n            [ 0 0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_921mathnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_flag,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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mathnf") < 0)) __PYX_ERR(4, 16424, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16424, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mathnf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16424, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_920mathnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_920mathnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathnf", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":16537
 *             [ 0 0 1]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16538
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mathnf0(_M, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16538, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16539
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mathnf0(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16540
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mathnf0(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mathnf0(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":16541
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mathnf0(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathnfmod(self, x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16424
 *         return new_gen(_ret)
 * 
 *     def mathnf(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`R` be a Euclidean ring, equal to :math:`\mathbb{Z}` or to :math:`K[X]` for some field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16543
 *         return new_gen(_ret)
 * 
 *     def mathnfmod(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a (not necessarily square) matrix of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_923mathnfmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_922mathnfmod[] = "\n        If :math:`x` is a (not necessarily square) matrix of\n        maximal rank with integer entries, and :math:`d` is a multiple of the (non-zero)\n        determinant of the lattice spanned by the columns of :math:`x`, finds the\n        :emphasis:`upper triangular` Hermite normal form of :math:`x`.\n        \n        If the rank of :math:`x` is equal to its number of rows, the result is a square\n        matrix. In general, the columns of the result form a basis of the lattice\n        spanned by the columns of :math:`x`. Even when :math:`d` is known, this is in general\n        slower than :literal:`mathnf` but uses much less memory.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_923mathnfmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathnfmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_d,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mathnfmod", 1, 2, 2, 1); __PYX_ERR(4, 16543, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mathnfmod") < 0)) __PYX_ERR(4, 16543, __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_x = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mathnfmod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16543, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathnfmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_922mathnfmod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_922mathnfmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathnfmod", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":16555
 *         slower than :literal:`mathnf` but uses much less memory.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16556
 *         '''
 *         x = objtogen(x)
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16557
 *         x = objtogen(x)
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16557, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16558
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmod(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16559
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hnfmod(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16560
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmod(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hnfmod(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_instance.pxi":16561
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmod(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathnfmodid(self, x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16543
 *         return new_gen(_ret)
 * 
 *     def mathnfmod(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a (not necessarily square) matrix of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathnfmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16563
 *         return new_gen(_ret)
 * 
 *     def mathnfmodid(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the (upper triangular)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_925mathnfmodid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_924mathnfmodid[] = "\n        Outputs the (upper triangular)\n        Hermite normal form of :math:`x` concatenated with the diagonal\n        matrix with diagonal :math:`d`. Assumes that :math:`x` has integer entries.\n        Variant: if :math:`d` is an integer instead of a vector, concatenate :math:`d` times the\n        identity matrix.\n        \n        ::\n        \n            ? m=[0,7;-1,0;-1,-1]\n            %1 =\n            [ 0 7]\n            \n            [-1 0]\n            \n            [-1 -1]\n            ? mathnfmodid(m, [6,2,2])\n            %2 =\n            [2 1 1]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? mathnfmodid(m, 10)\n            %3 =\n            [10 7 3]\n            \n            [ 0 1 0]\n            \n            [ 0 0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_925mathnfmodid(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathnfmodid (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_d,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mathnfmodid", 1, 2, 2, 1); __PYX_ERR(4, 16563, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mathnfmodid") < 0)) __PYX_ERR(4, 16563, __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_x = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mathnfmodid", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16563, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathnfmodid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_924mathnfmodid(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_924mathnfmodid(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathnfmodid", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":16595
 *             [ 0 0 1]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16596
 *         '''
 *         x = objtogen(x)
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16597
 *         x = objtogen(x)
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16597, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16598
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmodid(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16599
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hnfmodid(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16600
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmodid(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hnfmodid(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_instance.pxi":16601
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmodid(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathouseholder(self, Q, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16563
 *         return new_gen(_ret)
 * 
 *     def mathnfmodid(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the (upper triangular)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathnfmodid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16603
 *         return new_gen(_ret)
 * 
 *     def mathouseholder(self, Q, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         applies a sequence :math:`Q` of Householder
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_927mathouseholder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_926mathouseholder[] = "\n        applies a sequence :math:`Q` of Householder\n        transforms, as returned by :literal:`matqr`:math:`(M,1)` to the vector or matrix :math:`v`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_927mathouseholder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathouseholder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_v,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_Q)) != 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_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mathouseholder", 1, 2, 2, 1); __PYX_ERR(4, 16603, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mathouseholder") < 0)) __PYX_ERR(4, 16603, __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_Q = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mathouseholder", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16603, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathouseholder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_926mathouseholder(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Q, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_926mathouseholder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, PyObject *__pyx_v_v) {
  GEN __pyx_v__Q;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathouseholder", 0);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":16608
 *         transforms, as returned by :literal:`matqr`:math:`(M,1)` to the vector or matrix :math:`v`.
 *         '''
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16609
 *         '''
 *         Q = objtogen(Q)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16610
 *         Q = objtogen(Q)
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16610, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16611
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mathouseholder(_Q, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16612
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mathouseholder(_Q, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16613
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mathouseholder(_Q, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mathouseholder(__pyx_v__Q, __pyx_v__v);

  /* "cypari/auto_instance.pxi":16614
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mathouseholder(_Q, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matid(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16603
 *         return new_gen(_ret)
 * 
 *     def mathouseholder(self, Q, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         applies a sequence :math:`Q` of Householder
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mathouseholder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16616
 *         return new_gen(_ret)
 * 
 *     def matid(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :math:`n x n` identity matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_929matid(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_928matid[] = "\n        Creates the :math:`n x n` identity matrix.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_929matid(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matid (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16616, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_928matid(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_928matid(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("matid", 0);

  /* "cypari/auto_instance.pxi":16620
 *         Creates the :math:`n x n` identity matrix.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matid(n)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 16620, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16621
 *         '''
 *         sig_on()
 *         cdef GEN _ret = matid(n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matid(__pyx_v_n);

  /* "cypari/auto_instance.pxi":16622
 *         sig_on()
 *         cdef GEN _ret = matid(n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matimage(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16616
 *         return new_gen(_ret)
 * 
 *     def matid(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :math:`n x n` identity matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16624
 *         return new_gen(_ret)
 * 
 *     def matimage(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the image of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_931matimage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_930matimage[] = "\n        Gives a basis for the image of the\n        matrix :math:`x` as columns of a matrix. A priori the matrix can have entries of\n        any type. If :math:`flag = 0`, use standard Gauss pivot. If :math:`flag = 1`, use\n        :literal:`matsupplement` (much slower: keep the default flag!).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_931matimage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matimage (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matimage") < 0)) __PYX_ERR(4, 16624, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16624, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matimage", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16624, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matimage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_930matimage(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_930matimage(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matimage", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16631
 *         :literal:`matsupplement` (much slower: keep the default flag!).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16632
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matimage0(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16632, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16633
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matimage0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16634
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matimage0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matimage0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":16635
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matimage0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matimagecompl(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16624
 *         return new_gen(_ret)
 * 
 *     def matimage(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the image of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matimage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16637
 *         return new_gen(_ret)
 * 
 *     def matimagecompl(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the column indices which
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_933matimagecompl(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_932matimagecompl[] = "\n        Gives the vector of the column indices which\n        are not extracted by the function :literal:`matimage`, as a permutation\n        (:literal:`t_VECSMALL`). Hence the number of\n        components of :literal:`matimagecompl(x)` plus the number of columns of\n        :literal:`matimage(x)` is equal to the number of columns of the matrix :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_933matimagecompl(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matimagecompl (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_932matimagecompl(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_932matimagecompl(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matimagecompl", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16645
 *         :literal:`matimage(x)` is equal to the number of columns of the matrix :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16646
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = imagecompl(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16646, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16647
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = imagecompl(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16648
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = imagecompl(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = imagecompl(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16649
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = imagecompl(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matindexrank(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16637
 *         return new_gen(_ret)
 * 
 *     def matimagecompl(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the column indices which
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matimagecompl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16651
 *         return new_gen(_ret)
 * 
 *     def matindexrank(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a matrix of rank :math:`r`, returns a vector with two
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_935matindexrank(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_934matindexrank[] = "\n        :math:`M` being a matrix of rank :math:`r`, returns a vector with two\n        :literal:`t_VECSMALL` components :math:`y` and :math:`z` of length :math:`r` giving a list of rows\n        and columns respectively (starting from 1) such that the extracted matrix\n        obtained from these two vectors using :math:`vecextract (M,y,z)` is\n        invertible. The vectors :math:`y` and :math:`z` are sorted in increasing order.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_935matindexrank(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matindexrank (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_934matindexrank(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_934matindexrank(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matindexrank", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":16659
 *         invertible. The vectors :math:`y` and :math:`z` are sorted in increasing order.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16660
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = indexrank(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16660, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16661
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = indexrank(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16662
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = indexrank(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = indexrank(__pyx_v__M);

  /* "cypari/auto_instance.pxi":16663
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = indexrank(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matintersect(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16651
 *         return new_gen(_ret)
 * 
 *     def matindexrank(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a matrix of rank :math:`r`, returns a vector with two
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matindexrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16665
 *         return new_gen(_ret)
 * 
 *     def matintersect(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two matrices with the same
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_937matintersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_936matintersect[] = "\n        :math:`x` and :math:`y` being two matrices with the same\n        number of rows each of whose columns are independent, finds a basis of the\n        :math:`\\mathbb{Q}`-vector space equal to the intersection of the spaces spanned by the\n        columns of :math:`x` and :math:`y` respectively. The faster function\n        :literal:`idealintersect` can be used to intersect fractional ideals (projective\n        :math:`\\mathbb{Z}_K` modules of rank :math:`1`); the slower but much more general function\n        :literal:`nfhnf` can be used to intersect general :math:`\\mathbb{Z}_K`-modules.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_937matintersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matintersect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matintersect", 1, 2, 2, 1); __PYX_ERR(4, 16665, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matintersect") < 0)) __PYX_ERR(4, 16665, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matintersect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16665, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_936matintersect(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_936matintersect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matintersect", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":16675
 *         :literal:`nfhnf` can be used to intersect general :math:`\mathbb{Z}_K`-modules.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16676
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16677
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16677, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16678
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = intersect(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16679
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = intersect(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16680
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = intersect(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = intersect(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":16681
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = intersect(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matinverseimage(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16665
 *         return new_gen(_ret)
 * 
 *     def matintersect(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two matrices with the same
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16683
 *         return new_gen(_ret)
 * 
 *     def matinverseimage(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_939matinverseimage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_938matinverseimage[] = "\n        Given a matrix :math:`x` and\n        a column vector or matrix :math:`y`, returns a preimage :math:`z` of :math:`y` by :math:`x` if one\n        exists (i.e such that :math:`x z = y`), an empty vector or matrix otherwise. The\n        complete inverse image is :math:`z + Ker x`, where a basis of the kernel of\n        :math:`x` may be obtained by :literal:`matker`.\n        \n        ::\n        \n            ? M = [1,2;2,4];\n            ? matinverseimage(M, [1,2]~)\n            %2 = [1, 0]~\n            ? matinverseimage(M, [3,4]~)\n            %3 = []~ \\\\ no solution\n            ? matinverseimage(M, [1,3,6;2,6,12])\n            %4 =\n            [1 3 6]\n            \n            [0 0 0]\n            ? matinverseimage(M, [1,2;3,4])\n            %5 = [;] \\\\ no solution\n            ? K = matker(M)\n            %6 =\n            [-2]\n            \n            [1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_939matinverseimage(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matinverseimage (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matinverseimage", 1, 2, 2, 1); __PYX_ERR(4, 16683, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matinverseimage") < 0)) __PYX_ERR(4, 16683, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matinverseimage", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16683, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matinverseimage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_938matinverseimage(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_938matinverseimage(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matinverseimage", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":16711
 *             [1]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16712
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16713
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16713, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16714
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = inverseimage(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16715
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = inverseimage(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16716
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = inverseimage(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = inverseimage(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":16717
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = inverseimage(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matinvmod(self, x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16683
 *         return new_gen(_ret)
 * 
 *     def matinverseimage(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matinverseimage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16719
 *         return new_gen(_ret)
 * 
 *     def matinvmod(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a left inverse of the matrix:math:`x` modulo:math:`d`. The matrix :math:`x` must
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_941matinvmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_940matinvmod[] = "\n        Computes a left inverse of the matrix\302\240:math:`x` modulo\302\240:math:`d`. The matrix :math:`x` must\n        have :literal:`t_INT` entries, and :math:`d` can be an arbitrary positive integer.\n        \n        ::\n        \n            ? A = [3,1,2;1,2,1;3,1,1];\n            ? U = matinvmod(A,6)\n            %2 =\n            [1 1 3]\n            \n            [2 3 5]\n            \n            [1 0 5]\n            \n            ? (U*A)%6\n            %3 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? matinvmod(A,5)\n             *** at top-level: matinvmod(A,5)\n             *** ^--------------\n             *** matinvmod: impossible inverse in gen_inv: 0.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_941matinvmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matinvmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_d,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matinvmod", 1, 2, 2, 1); __PYX_ERR(4, 16719, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matinvmod") < 0)) __PYX_ERR(4, 16719, __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_x = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matinvmod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16719, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matinvmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_940matinvmod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_940matinvmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matinvmod", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":16747
 *              *** matinvmod: impossible inverse in gen_inv: 0.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16748
 *         '''
 *         x = objtogen(x)
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16749
 *         x = objtogen(x)
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16749, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16750
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matinvmod(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16751
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matinvmod(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16752
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matinvmod(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matinvmod(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_instance.pxi":16753
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matinvmod(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matisdiagonal(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16719
 *         return new_gen(_ret)
 * 
 *     def matinvmod(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a left inverse of the matrix:math:`x` modulo:math:`d`. The matrix :math:`x` must
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matinvmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16755
 *         return new_gen(_ret)
 * 
 *     def matisdiagonal(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_943matisdiagonal(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_942matisdiagonal[] = "\n        Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_943matisdiagonal(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matisdiagonal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_942matisdiagonal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_942matisdiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matisdiagonal", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16759
 *         Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16760
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = isdiagonal(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16760, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16761
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = isdiagonal(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16762
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = isdiagonal(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isdiagonal(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16763
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = isdiagonal(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":16764
 *         cdef int _ret = isdiagonal(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def matker(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16755
 *         return new_gen(_ret)
 * 
 *     def matisdiagonal(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matisdiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16766
 *         return _ret
 * 
 *     def matker(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the kernel of the matrix :math:`x` as columns of a matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_945matker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_944matker[] = "\n        Gives a basis for the kernel of the matrix :math:`x` as columns of a matrix.\n        The matrix can have entries of any type, provided they are compatible with\n        the generic arithmetic operations (:math:`+`, :math:`x` and :math:`/`).\n        \n        If :math:`x` is known to have integral entries, set :math:`flag = 1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_945matker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matker (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matker") < 0)) __PYX_ERR(4, 16766, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16766, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matker", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16766, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_944matker(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_944matker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matker", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16774
 *         If :math:`x` is known to have integral entries, set :math:`flag = 1`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16775
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matker0(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16775, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16776
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matker0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16777
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matker0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matker0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":16778
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matker0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matkerint(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16766
 *         return _ret
 * 
 *     def matker(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the kernel of the matrix :math:`x` as columns of a matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16780
 *         return new_gen(_ret)
 * 
 *     def matkerint(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives an LLL-reduced :math:`\mathbb{Z}`-basis
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_947matkerint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_946matkerint[] = "\n        Gives an LLL-reduced :math:`\\mathbb{Z}`-basis\n        for the lattice equal to the kernel of the matrix :math:`x` with rational entries.\n        \n        :emphasis:`flag` is deprecated, kept for backward compatibility.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_947matkerint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matkerint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matkerint") < 0)) __PYX_ERR(4, 16780, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16780, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matkerint", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16780, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matkerint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_946matkerint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_946matkerint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matkerint", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16787
 *         :emphasis:`flag` is deprecated, kept for backward compatibility.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16788
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matkerint0(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16788, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16789
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matkerint0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16790
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matkerint0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matkerint0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":16791
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matkerint0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matmuldiagonal(self, x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16780
 *         return new_gen(_ret)
 * 
 *     def matkerint(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives an LLL-reduced :math:`\mathbb{Z}`-basis
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matkerint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16793
 *         return new_gen(_ret)
 * 
 *     def matmuldiagonal(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrix :math:`x` by the diagonal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_949matmuldiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_948matmuldiagonal[] = "\n        Product of the matrix :math:`x` by the diagonal\n        matrix whose diagonal entries are those of the vector :math:`d`. Equivalent to,\n        but much faster than :math:`x*matdiagonal (d)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_949matmuldiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matmuldiagonal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_d,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmuldiagonal", 1, 2, 2, 1); __PYX_ERR(4, 16793, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matmuldiagonal") < 0)) __PYX_ERR(4, 16793, __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_x = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matmuldiagonal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16793, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matmuldiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_948matmuldiagonal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_948matmuldiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matmuldiagonal", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":16799
 *         but much faster than :math:`x*matdiagonal (d)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16800
 *         '''
 *         x = objtogen(x)
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16801
 *         x = objtogen(x)
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16801, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16802
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matmuldiagonal(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16803
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matmuldiagonal(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16804
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matmuldiagonal(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matmuldiagonal(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_instance.pxi":16805
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matmuldiagonal(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matmultodiagonal(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16793
 *         return new_gen(_ret)
 * 
 *     def matmuldiagonal(self, x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrix :math:`x` by the diagonal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matmuldiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16807
 *         return new_gen(_ret)
 * 
 *     def matmultodiagonal(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrices :math:`x` and :math:`y` assuming that the result is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_951matmultodiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_950matmultodiagonal[] = "\n        Product of the matrices :math:`x` and :math:`y` assuming that the result is a\n        diagonal matrix. Much faster than :math:`x*y` in that case. The result is\n        undefined if :math:`x*y` is not diagonal.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_951matmultodiagonal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matmultodiagonal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matmultodiagonal", 1, 2, 2, 1); __PYX_ERR(4, 16807, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matmultodiagonal") < 0)) __PYX_ERR(4, 16807, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matmultodiagonal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16807, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matmultodiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_950matmultodiagonal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_950matmultodiagonal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matmultodiagonal", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":16813
 *         undefined if :math:`x*y` is not diagonal.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16814
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16815
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16815, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16816
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = matmultodiagonal(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16817
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matmultodiagonal(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16818
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = matmultodiagonal(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matmultodiagonal(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":16819
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = matmultodiagonal(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matpascal(self, long n, q=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16807
 *         return new_gen(_ret)
 * 
 *     def matmultodiagonal(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrices :math:`x` and :math:`y` assuming that the result is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matmultodiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16821
 *         return new_gen(_ret)
 * 
 *     def matpascal(self, long n, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates as a matrix the lower triangular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_953matpascal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_952matpascal[] = "\n        Creates as a matrix the lower triangular\n        Pascal triangle of order :math:`x+1` (i.e.\302\240with binomial coefficients\n        up to :math:`x`). If :math:`q` is given, compute the :math:`q`-Pascal triangle (i.e.\302\240using\n        :math:`q`-binomial coefficients).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_953matpascal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matpascal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_q,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matpascal") < 0)) __PYX_ERR(4, 16821, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16821, __pyx_L3_error)
    __pyx_v_q = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matpascal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16821, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matpascal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_952matpascal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_q);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_952matpascal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_q) {
  int __pyx_v__have_q;
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("matpascal", 0);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_instance.pxi":16828
 *         :math:`q`-binomial coefficients).
 *         '''
 *         cdef bint _have_q = (q is not None)             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             q = objtogen(q)
 */
  __pyx_t_1 = (__pyx_v_q != Py_None);
  __pyx_v__have_q = __pyx_t_1;

  /* "cypari/auto_instance.pxi":16829
 *         '''
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_q != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":16830
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 *             q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":16829
 *         '''
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":16831
 *         if _have_q:
 *             q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = NULL
 *         if _have_q:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 16831, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16832
 *             q = objtogen(q)
 *         sig_on()
 *         cdef GEN _q = NULL             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             _q = (<Gen>q).g
 */
  __pyx_v__q = NULL;

  /* "cypari/auto_instance.pxi":16833
 *         sig_on()
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = matqpascal(n, _q)
 */
  __pyx_t_1 = (__pyx_v__have_q != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":16834
 *         cdef GEN _q = NULL
 *         if _have_q:
 *             _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matqpascal(n, _q)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
    __pyx_v__q = __pyx_t_4;

    /* "cypari/auto_instance.pxi":16833
 *         sig_on()
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = matqpascal(n, _q)
 */
  }

  /* "cypari/auto_instance.pxi":16835
 *         if _have_q:
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = matqpascal(n, _q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matqpascal(__pyx_v_n, __pyx_v__q);

  /* "cypari/auto_instance.pxi":16836
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = matqpascal(n, _q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matpermanent(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 16836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16821
 *         return new_gen(_ret)
 * 
 *     def matpascal(self, long n, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates as a matrix the lower triangular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matpascal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16838
 *         return new_gen(_ret)
 * 
 *     def matpermanent(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Permanent of the square matrix :math:`x` using Ryser's formula in Gray code
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_955matpermanent(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_954matpermanent[] = "\n        Permanent of the square matrix :math:`x` using Ryser's formula in Gray code\n        order.\n        \n        ::\n        \n            ? n = 20; m = matrix(n,n,i,j, i!=j);\n            ? matpermanent(m)\n            %2 = 895014631192902121\n            ? n! * sum(i=0,n, (-1)^i/i!)\n            %3 = 895014631192902121\n        \n        This function runs in time :math:`O(2^n n)` for a matrix of size\n        :math:`n` and is not implemented for :math:`n` large.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_955matpermanent(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matpermanent (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_954matpermanent(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_954matpermanent(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matpermanent", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16854
 *         :math:`n` and is not implemented for :math:`n` large.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16855
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matpermanent(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16855, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16856
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matpermanent(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16857
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matpermanent(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matpermanent(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16858
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matpermanent(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matqr(self, M, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16838
 *         return new_gen(_ret)
 * 
 *     def matpermanent(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Permanent of the square matrix :math:`x` using Ryser's formula in Gray code
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matpermanent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16860
 *         return new_gen(_ret)
 * 
 *     def matqr(self, M, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[Q,R]`, the QR-decomposition of the square invertible
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_957matqr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_956matqr[] = "\n        Returns :math:`[Q,R]`, the QR-decomposition of the square invertible\n        matrix :math:`M` with real entries: :math:`Q` is orthogonal and :math:`R` upper triangular. If\n        :math:`flag = 1`, the orthogonal matrix is returned as a sequence of Householder\n        transforms: applying such a sequence is stabler and faster than\n        multiplication by the corresponding :math:`Q` matrix.\n        More precisely, if\n        \n        ::\n        \n             [Q,R] = matqr(M);\n             [q,r] = matqr(M, 1);\n        \n        then :math:`r = R` and :literal:`mathouseholder`:math:`(q, M)` is\n        (close to) :math:`R`; furthermore\n        \n        ::\n        \n             mathouseholder(q, matid(#M)) == Q~\n        \n        the inverse of :math:`Q`. This function raises an error if the\n        precision is too low or :math:`x` is singular.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_957matqr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matqr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matqr") < 0)) __PYX_ERR(4, 16860, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16860, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16860, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matqr", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16860, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_956matqr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_956matqr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matqr", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":16884
 *         precision is too low or :math:`x` is singular.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16885
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16885, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16886
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = matqr(_M, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16887
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matqr(_M, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":16888
 *         cdef GEN _M = (<Gen>M).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = matqr(_M, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matqr(__pyx_v__M, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":16889
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = matqr(_M, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matrank(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16860
 *         return new_gen(_ret)
 * 
 *     def matqr(self, M, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[Q,R]`, the QR-decomposition of the square invertible
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16891
 *         return new_gen(_ret)
 * 
 *     def matrank(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Rank of the matrix :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_959matrank(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_958matrank[] = "\n        Rank of the matrix :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_959matrank(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matrank (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_958matrank(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_958matrank(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matrank", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16895
 *         Rank of the matrix :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16896
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rank(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16896, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16897
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rank(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16898
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rank(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rank(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16899
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rank(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":16900
 *         cdef long _ret = rank(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def matrixqz(self, A, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16900, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16891
 *         return new_gen(_ret)
 * 
 *     def matrank(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Rank of the matrix :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16902
 *         return _ret
 * 
 *     def matrixqz(self, A, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A` being an :math:`m x n` matrix in :math:`M_{m,n}(\mathbb{Q})`, let
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_961matrixqz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_960matrixqz[] = "\n        :math:`A` being an :math:`m x n` matrix in :math:`M_{m,n}(\\mathbb{Q})`, let\n        :math:`Im_\\mathbb{Q} A` (resp.\302\240:math:`Im_\\mathbb{Z} A`) the :math:`\\mathbb{Q}`-vector space\n        (resp.\302\240the :math:`\\mathbb{Z}`-module) spanned by the columns of :math:`A`. This function has\n        varying behavior depending on the sign of :math:`p`:\n        \n        If :math:`p >= 0`, :math:`A` is assumed to have maximal rank :math:`n <= m`. The function\n        returns a matrix :math:`B\\in M_{m,n}(\\mathbb{Z})`, with :math:`Im_\\mathbb{Q} B = Im_\\mathbb{Q} A`,\n        such that the GCD of all its :math:`n x n` minors is coprime to\n        :math:`p`; in particular, if :math:`p = 0` (default), this GCD is :math:`1`.\n        \n        ::\n        \n            ? minors(x) = vector(#x[,1], i, matdet(x[^i,]));\n            ? A = [3,1/7; 5,3/7; 7,5/7]; minors(A)\n            %1 = [4/7, 8/7, 4/7] \\\\ determinants of all 2x2 minors\n            ? B = matrixqz(A)\n            %2 =\n            [3 1]\n            \n            [5 2]\n            \n            [7 3]\n            ? minors(%)\n            %3 = [1, 2, 1] \\\\ B integral with coprime minors\n        \n        If :math:`p = -1`, returns the HNF basis of the lattice :math:`\\mathbb{Z}^n \\cap Im_\\mathbb{Z} A`.\n        \n        If :math:`p = -2`, returns the HNF basis of the lattice :math:`\\mathbb{Z}^n \\cap Im_\\mathbb{Q} A`.\n        \n        ::\n        \n            ? matrixqz(A,-1)\n            %4 =\n            [8 5]\n            \n            [4 3]\n            \n            [0 1]\n            \n            ? matrixqz(A,-2)\n            %5 =\n            [2 -1]\n            \n            [1 0]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_961matrixqz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matrixqz (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matrixqz") < 0)) __PYX_ERR(4, 16902, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matrixqz", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16902, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matrixqz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_960matrixqz(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_960matrixqz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__A;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("matrixqz", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":16951
 *             [0 1]
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16952
 *         '''
 *         A = objtogen(A)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":16953
 *         A = objtogen(A)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":16954
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":16953
 *         A = objtogen(A)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":16955
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 16955, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16956
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_instance.pxi":16957
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":16958
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":16959
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matrixqz0(_A, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":16958
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)
 */
  }

  /* "cypari/auto_instance.pxi":16960
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matrixqz0(__pyx_v__A, __pyx_v__p);

  /* "cypari/auto_instance.pxi":16961
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsize(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16902
 *         return _ret
 * 
 *     def matrixqz(self, A, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A` being an :math:`m x n` matrix in :math:`M_{m,n}(\mathbb{Q})`, let
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matrixqz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16963
 *         return new_gen(_ret)
 * 
 *     def matsize(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector or matrix, returns a row vector
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_963matsize(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_962matsize[] = "\n        :math:`x` being a vector or matrix, returns a row vector\n        with two components, the first being the number of rows (1 for a row vector),\n        the second the number of columns (1 for a column vector).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_963matsize(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsize (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_962matsize(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_962matsize(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matsize", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":16969
 *         the second the number of columns (1 for a column vector).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":16970
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matsize(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 16970, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":16971
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matsize(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":16972
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matsize(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matsize(__pyx_v__x);

  /* "cypari/auto_instance.pxi":16973
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matsize(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsnf(self, X, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 16973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16963
 *         return new_gen(_ret)
 * 
 *     def matsize(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector or matrix, returns a row vector
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":16975
 *         return new_gen(_ret)
 * 
 *     def matsnf(self, X, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`X` is a (singular or non-singular) matrix outputs the vector of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_965matsnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_964matsnf[] = "\n        If :math:`X` is a (singular or non-singular) matrix outputs the vector of\n        elementary divisors of :math:`X`, i.e.\302\240the diagonal of the\n        Smith normal form of :math:`X`, normalized so that :math:`d_n \\| d_{n-1} \\|\n        ... \\| d_1`.\n        \n        The binary digits of :emphasis:`flag` mean:\n        \n        1 (complete output): if set, outputs :math:`[U,V,D]`, where :math:`U` and :math:`V` are two\n        unimodular matrices such that :math:`UXV` is the diagonal matrix :math:`D`. Otherwise\n        output only the diagonal of :math:`D`. If :math:`X` is not a square matrix, then :math:`D`\n        will be a square diagonal matrix padded with zeros on the left or the top.\n        \n        2 (generic input): if set, allows polynomial entries, in which case the\n        input matrix must be square. Otherwise, assume that :math:`X` has integer\n        coefficients with arbitrary shape.\n        \n        4 (cleanup): if set, cleans up the output. This means that elementary\n        divisors equal to :math:`1` will be deleted, i.e.\302\240outputs a shortened vector :math:`D'`\n        instead of :math:`D`. If complete output was required, returns :math:`[U',V',D']` so\n        that :math:`U'XV' = D'` holds. If this flag is set, :math:`X` is allowed to be of the\n        form `vector of elementary divisors' or :math:`[U,V,D]` as would normally be output with the cleanup flag\n        unset.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_965matsnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_flag,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_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matsnf") < 0)) __PYX_ERR(4, 16975, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_X = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 16975, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matsnf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 16975, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_964matsnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_X, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_964matsnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X, long __pyx_v_flag) {
  GEN __pyx_v__X;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matsnf", 0);
  __Pyx_INCREF(__pyx_v_X);

  /* "cypari/auto_instance.pxi":17000
 *         unset.
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17001
 *         '''
 *         X = objtogen(X)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = matsnf0(_X, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17001, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17002
 *         X = objtogen(X)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matsnf0(_X, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17003
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = matsnf0(_X, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matsnf0(__pyx_v__X, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":17004
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = matsnf0(_X, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsolve(self, M, B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17004, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":16975
 *         return new_gen(_ret)
 * 
 *     def matsnf(self, X, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`X` is a (singular or non-singular) matrix outputs the vector of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17006
 *         return new_gen(_ret)
 * 
 *     def matsolve(self, M, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a left-invertible matrix and :math:`B` a column vector
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_967matsolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_966matsolve[] = "\n        Let :math:`M` be a left-invertible matrix and :math:`B` a column vector\n        such that there exists a solution :math:`X` to the system of linear equations\n        :math:`MX = B`; return the (unique) solution :math:`X`. This has the same effect as, but\n        is faster, than :math:`M^{-1}*B`. Uses Dixon :math:`p`-adic lifting method if :math:`M` and\n        :math:`B` are integral and Gaussian elimination otherwise. When there is no\n        solution, the function returns an :math:`X` such that :math:`MX - B` is non-zero\n        although it has at least :math:`\\#M` zero entries:\n        \n        ::\n        \n            ? M = [1,2;3,4;5,6];\n            ? B = [4,6,8]~; X = matsolve(M, B)\n            %2 = [-2, 3]~\n            ? M*X == B\n            %3 = 1\n            ? B = [1,2,4]~; X = matsolve(M, [1,2,4]~)\n            %4 = [0, 1/2]~\n            ? M*X - B\n            %5 = [0, 0, -1]~\n        \n        Raises an exception if :math:`M` is not left-invertible, even if\n        there is a solution:\n        \n        ::\n        \n            ? M = [1,1;1,1]; matsolve(M, [1,1]~)\n             *** at top-level: matsolve(M,[1,1]~)\n             *** ^------------------\n             *** matsolve: impossible inverse in gauss: [1, 1; 1, 1].\n        \n        The function also works when :math:`B` is a matrix and we return\n        the unique matrix solution :math:`X` provided it exists.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_967matsolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsolve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_B,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_M)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matsolve", 1, 2, 2, 1); __PYX_ERR(4, 17006, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matsolve") < 0)) __PYX_ERR(4, 17006, __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_M = values[0];
    __pyx_v_B = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matsolve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17006, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_966matsolve(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_B);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_966matsolve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_B) {
  GEN __pyx_v__M;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matsolve", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":17041
 *         the unique matrix solution :math:`X` provided it exists.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17042
 *         '''
 *         M = objtogen(M)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17043
 *         M = objtogen(M)
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17043, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17044
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = gauss(_M, _B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17045
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gauss(_M, _B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17046
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = gauss(_M, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gauss(__pyx_v__M, __pyx_v__B);

  /* "cypari/auto_instance.pxi":17047
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = gauss(_M, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsolvemod(self, M, D, B, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17006
 *         return new_gen(_ret)
 * 
 *     def matsolve(self, M, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a left-invertible matrix and :math:`B` a column vector
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17049
 *         return new_gen(_ret)
 * 
 *     def matsolvemod(self, M, D, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being any integral matrix,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_969matsolvemod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_968matsolvemod[] = "\n        :math:`M` being any integral matrix,\n        :math:`D` a column vector of non-negative integer moduli, and :math:`B` an integral\n        column vector, gives an integer solution to the system of congruences\n        :math:`\\sum_i m_{i,j}x_j = b_i (mod d_i)` if one exists, otherwise returns\n        zero. Shorthand notation: :math:`B` (resp.\302\240:math:`D`) can be given as a single integer,\n        in which case all the :math:`b_i` (resp.\302\240:math:`d_i`) above are taken to be equal to :math:`B`\n        (resp.\302\240:math:`D`).\n        \n        ::\n        \n            ? M = [1,2;3,4];\n            ? matsolvemod(M, [3,4]~, [1,2]~)\n            %2 = [10, 0]~\n            ? matsolvemod(M, 3, 1) \\\\ M X = [1,1]~ over F_3\n            %3 = [2, 1]~\n            ? matsolvemod(M, [3,0]~, [1,2]~) \\\\ x + 2y = 1 (mod 3), 3x + 4y = 2 (in Z)\n            %4 = [6, -4]~\n        \n        If :math:`flag = 1`, all solutions are returned in the form of a two-component row\n        vector :math:`[x,u]`, where :math:`x` is an integer solution to the system of\n        congruences and :math:`u` is a matrix whose columns give a basis of the homogeneous\n        system (so that all solutions can be obtained by adding :math:`x` to any linear\n        combination of columns of :math:`u`). If no solution exists, returns zero.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_969matsolvemod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_v_B = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsolvemod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_D,&__pyx_n_s_B,&__pyx_n_s_flag,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_M)) != 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_D)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matsolvemod", 0, 3, 4, 1); __PYX_ERR(4, 17049, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matsolvemod", 0, 3, 4, 2); __PYX_ERR(4, 17049, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matsolvemod") < 0)) __PYX_ERR(4, 17049, __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_M = values[0];
    __pyx_v_D = values[1];
    __pyx_v_B = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17049, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matsolvemod", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17049, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsolvemod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_968matsolvemod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_D, __pyx_v_B, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_968matsolvemod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_D, PyObject *__pyx_v_B, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__D;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matsolvemod", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_D);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":17075
 *         combination of columns of :math:`u`). If no solution exists, returns zero.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         D = objtogen(D)
 *         B = objtogen(B)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17076
 *         '''
 *         M = objtogen(M)
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17077
 *         M = objtogen(M)
 *         D = objtogen(D)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17078
 *         D = objtogen(D)
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17078, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17079
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17080
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17081
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17082
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matsolvemod(__pyx_v__M, __pyx_v__D, __pyx_v__B, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":17083
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsupplement(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17083, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17049
 *         return new_gen(_ret)
 * 
 *     def matsolvemod(self, M, D, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being any integral matrix,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsolvemod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17085
 *         return new_gen(_ret)
 * 
 *     def matsupplement(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Assuming that the columns of the matrix :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_971matsupplement(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_970matsupplement[] = "\n        Assuming that the columns of the matrix :math:`x`\n        are linearly independent (if they are not, an error message is issued), finds\n        a square invertible matrix whose first columns are the columns of :math:`x`,\n        i.e.\302\240supplement the columns of :math:`x` to a basis of the whole space.\n        \n        ::\n        \n            ? matsupplement([1;2])\n            %1 =\n            [1 0]\n            \n            [2 1]\n        \n        Raises an error if :math:`x` has 0 columns, since (due to a long standing design\n        bug), the dimension of the ambient space (the number of rows) is unknown in\n        this case:\n        \n        ::\n        \n            ? matsupplement(matrix(2,0))\n             *** at top-level: matsupplement(matrix\n             *** ^--------------------\n             *** matsupplement: sorry, suppl [empty matrix] is not yet implemented.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_971matsupplement(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsupplement (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_970matsupplement(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_970matsupplement(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matsupplement", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":17111
 *              *** matsupplement: sorry, suppl [empty matrix] is not yet implemented.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17112
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = suppl(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17112, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17113
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = suppl(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17114
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = suppl(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = suppl(__pyx_v__x);

  /* "cypari/auto_instance.pxi":17115
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = suppl(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mattranspose(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17085
 *         return new_gen(_ret)
 * 
 *     def matsupplement(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Assuming that the columns of the matrix :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.matsupplement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17117
 *         return new_gen(_ret)
 * 
 *     def mattranspose(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transpose of :math:`x` (also :math:`x~`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_973mattranspose(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_972mattranspose[] = "\n        Transpose of :math:`x` (also :math:`x~`).\n        This has an effect only on vectors and matrices.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_973mattranspose(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mattranspose (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_972mattranspose(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_972mattranspose(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mattranspose", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":17122
 *         This has an effect only on vectors and matrices.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17123
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrans(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17123, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17124
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtrans(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17125
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrans(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtrans(__pyx_v__x);

  /* "cypari/auto_instance.pxi":17126
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrans(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def max(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17117
 *         return new_gen(_ret)
 * 
 *     def mattranspose(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transpose of :math:`x` (also :math:`x~`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mattranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17128
 *         return new_gen(_ret)
 * 
 *     def max(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_975max(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_974max[] = "\n        Creates the maximum of :math:`x` and :math:`y` when they can be compared.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_975max(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("max (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("max", 1, 2, 2, 1); __PYX_ERR(4, 17128, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "max") < 0)) __PYX_ERR(4, 17128, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("max", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_974max(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_974max(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("max", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":17132
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17133
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17134
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17134, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17135
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmax(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17136
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmax(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17137
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmax(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmax(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":17138
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmax(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfDelta(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17128
 *         return new_gen(_ret)
 * 
 *     def max(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17140
 *         return new_gen(_ret)
 * 
 *     def mfDelta(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Mf structure corresponding to the Ramanujan Delta function :math:`\Delta`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_977mfDelta(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_976mfDelta[] = "\n        Mf structure corresponding to the Ramanujan Delta function :math:`\\Delta`.\n        \n        ::\n        \n            ? mfcoefs(mfDelta(),4)\n            %1 = [0, 1, -24, 252, -1472]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_977mfDelta(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfDelta (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_976mfDelta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_976mfDelta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mfDelta", 0);

  /* "cypari/auto_instance.pxi":17149
 *             %1 = [0, 1, -24, 252, -1472]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfDelta()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 17149, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17150
 *         '''
 *         sig_on()
 *         cdef GEN _ret = mfDelta()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfDelta();

  /* "cypari/auto_instance.pxi":17151
 *         sig_on()
 *         cdef GEN _ret = mfDelta()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfEH(self, k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 17151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17140
 *         return new_gen(_ret)
 * 
 *     def mfDelta(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Mf structure corresponding to the Ramanujan Delta function :math:`\Delta`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfDelta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17153
 *         return new_gen(_ret)
 * 
 *     def mfEH(self, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being in :math:`1/2+\mathbb{Z}`, returns the Cohen-Eisenstein series :math:`H_k` of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_979mfEH(PyObject *__pyx_v_self, PyObject *__pyx_v_k); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_978mfEH[] = "\n        :math:`k` being in :math:`1/2+\\mathbb{Z}`, returns the Cohen-Eisenstein series :math:`H_k` of\n        weight :math:`k` on :math:`\\Gamma_0(4)`.\n        \n        ::\n        \n            ? H = mfEH(13/2); mfcoefs(H,4)\n            %1 = [691/32760, -1/252, 0, 0, -2017/252]\n        \n        The coefficients of :math:`H` are given by the Cohen-Hurwitz function\n        :math:`H(k-1/2,N)` and can be obtained for moderately large values of :math:`N` (the\n        algorithm uses :math:`~{O}(N)` time):\n        \n        ::\n        \n            ? mfcoef(H,10^5+1)\n            time = 55 ms.\n            %2 = -12514802881532791504208348\n            ? mfcoef(H,10^7+1)\n            time = 6,044 ms.\n            %3 = -1251433416009877455212672599325104476\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_979mfEH(PyObject *__pyx_v_self, PyObject *__pyx_v_k) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfEH (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_978mfEH(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_k));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_978mfEH(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_k) {
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfEH", 0);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_instance.pxi":17176
 *             %3 = -1251433416009877455212672599325104476
 *         '''
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17177
 *         '''
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = mfEH(_k)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17177, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17178
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfEH(_k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17179
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = mfEH(_k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfEH(__pyx_v__k);

  /* "cypari/auto_instance.pxi":17180
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = mfEH(_k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfEk(self, long k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17153
 *         return new_gen(_ret)
 * 
 *     def mfEH(self, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being in :math:`1/2+\mathbb{Z}`, returns the Cohen-Eisenstein series :math:`H_k` of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfEH", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17182
 *         return new_gen(_ret)
 * 
 *     def mfEk(self, long k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Mf structure corresponding to the standard Eisenstein series :math:`E_k`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_981mfEk(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_980mfEk[] = "\n        Mf structure corresponding to the standard Eisenstein series :math:`E_k`.\n        \n        ::\n        \n            ? mfcoefs(mfEk(8),4)\n            %1 = [1, 480, 61920, 1050240, 7926240]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_981mfEk(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) {
  long __pyx_v_k;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfEk (wrapper)", 0);
  assert(__pyx_arg_k); {
    __pyx_v_k = __Pyx_PyInt_As_long(__pyx_arg_k); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17182, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfEk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_980mfEk(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_k));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_980mfEk(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mfEk", 0);

  /* "cypari/auto_instance.pxi":17191
 *             %1 = [1, 480, 61920, 1050240, 7926240]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfEk(k)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 17191, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17192
 *         '''
 *         sig_on()
 *         cdef GEN _ret = mfEk(k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfEk(__pyx_v_k);

  /* "cypari/auto_instance.pxi":17193
 *         sig_on()
 *         cdef GEN _ret = mfEk(k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfTheta(self, psi=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 17193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17182
 *         return new_gen(_ret)
 * 
 *     def mfEk(self, long k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Mf structure corresponding to the standard Eisenstein series :math:`E_k`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfEk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17195
 *         return new_gen(_ret)
 * 
 *     def mfTheta(self, psi=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The unary theta function corresponding to the primitive Dirichlet
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_983mfTheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_982mfTheta[] = "\n        The unary theta function corresponding to the primitive Dirichlet\n        character :math:`\\psi`, hence of weight :math:`1/2` if :math:`\\psi` is even, of weight :math:`3/2`\n        if :math:`\\psi` is odd.\n        \n        ::\n        \n            ? Ser(mfcoefs(mfTheta(),30))\n            %1 = 1 + 2*x + 2*x^4 + 2*x^9 + 2*x^16 + 2*x^25 + O(x^31)\n            ? Ser(mfcoefs(mfTheta(8),30))\n            %2 = 2*x - 2*x^9 - 2*x^25 + O(x^31)\n            ? Ser(mfcoefs(mfTheta(-8),30))\n            %3 = 2*x + 6*x^9 - 10*x^25 + O(x^31)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_983mfTheta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_psi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfTheta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_psi,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_psi);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfTheta") < 0)) __PYX_ERR(4, 17195, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_psi = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfTheta", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17195, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfTheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_982mfTheta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_psi);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_982mfTheta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_psi) {
  int __pyx_v__have_psi;
  GEN __pyx_v__psi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfTheta", 0);
  __Pyx_INCREF(__pyx_v_psi);

  /* "cypari/auto_instance.pxi":17210
 *             %3 = 2*x + 6*x^9 - 10*x^25 + O(x^31)
 *         '''
 *         cdef bint _have_psi = (psi is not None)             # <<<<<<<<<<<<<<
 *         if _have_psi:
 *             psi = objtogen(psi)
 */
  __pyx_t_1 = (__pyx_v_psi != Py_None);
  __pyx_v__have_psi = __pyx_t_1;

  /* "cypari/auto_instance.pxi":17211
 *         '''
 *         cdef bint _have_psi = (psi is not None)
 *         if _have_psi:             # <<<<<<<<<<<<<<
 *             psi = objtogen(psi)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_psi != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":17212
 *         cdef bint _have_psi = (psi is not None)
 *         if _have_psi:
 *             psi = objtogen(psi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _psi = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_psi, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 17212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_psi, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":17211
 *         '''
 *         cdef bint _have_psi = (psi is not None)
 *         if _have_psi:             # <<<<<<<<<<<<<<
 *             psi = objtogen(psi)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":17213
 *         if _have_psi:
 *             psi = objtogen(psi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _psi = NULL
 *         if _have_psi:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 17213, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17214
 *             psi = objtogen(psi)
 *         sig_on()
 *         cdef GEN _psi = NULL             # <<<<<<<<<<<<<<
 *         if _have_psi:
 *             _psi = (<Gen>psi).g
 */
  __pyx_v__psi = NULL;

  /* "cypari/auto_instance.pxi":17215
 *         sig_on()
 *         cdef GEN _psi = NULL
 *         if _have_psi:             # <<<<<<<<<<<<<<
 *             _psi = (<Gen>psi).g
 *         cdef GEN _ret = mfTheta(_psi)
 */
  __pyx_t_1 = (__pyx_v__have_psi != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":17216
 *         cdef GEN _psi = NULL
 *         if _have_psi:
 *             _psi = (<Gen>psi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfTheta(_psi)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_psi)->__pyx_base.g;
    __pyx_v__psi = __pyx_t_4;

    /* "cypari/auto_instance.pxi":17215
 *         sig_on()
 *         cdef GEN _psi = NULL
 *         if _have_psi:             # <<<<<<<<<<<<<<
 *             _psi = (<Gen>psi).g
 *         cdef GEN _ret = mfTheta(_psi)
 */
  }

  /* "cypari/auto_instance.pxi":17217
 *         if _have_psi:
 *             _psi = (<Gen>psi).g
 *         cdef GEN _ret = mfTheta(_psi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfTheta(__pyx_v__psi);

  /* "cypari/auto_instance.pxi":17218
 *             _psi = (<Gen>psi).g
 *         cdef GEN _ret = mfTheta(_psi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfatkin(self, mfatk, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 17218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17195
 *         return new_gen(_ret)
 * 
 *     def mfTheta(self, psi=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The unary theta function corresponding to the primitive Dirichlet
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfTheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_psi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17220
 *         return new_gen(_ret)
 * 
 *     def mfatkin(self, mfatk, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :literal:`mfatk` output by :literal:`mfatk = mfatkininit(mf,Q)` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_985mfatkin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_984mfatkin[] = "\n        Given a :literal:`mfatk` output by :literal:`mfatk = mfatkininit(mf,Q)` and\n        a modular form :math:`F` belonging to the pace :literal:`mf`, returns the modular\n        form :math:`C*F\\|W_Q`, which has :literal:`polmod` coefficients in :math:`\\mathbb{Q} (F)`;\n        :literal:`mfatk[3]` gives the constant :math:`C`, and :literal:`mfatk[1]` gives\n        the modular form space to which :math:`F\\|W_Q` belongs (or is set to :math:`0` if\n        it is :literal:`mf`).\n        \n        ::\n        \n            ? mf = mfinit([35,2],0); vecF = mfbasis(mf); F = vecF[1];\n            ? mfcoefs(F, 4)\n            %2 = [0, 3, -1, 0, 3]\n            ? mfatk = mfatkininit(mf,7);\n            ? wF = mfatkin(mfatk, F); mfcoefs(wF, 4)\n            %4 = [0, 1, -1, -2, 7]\n            ? mfatk = mfatkininit(mf,35);\n            ? wF = mfatkin(mfatk, F); mfcoefs(wF, 4)\n            %6 = [0, -3, 1, 0, -3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_985mfatkin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mfatk = 0;
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfatkin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mfatk,&__pyx_n_s_F,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_mfatk)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfatkin", 1, 2, 2, 1); __PYX_ERR(4, 17220, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfatkin") < 0)) __PYX_ERR(4, 17220, __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_mfatk = values[0];
    __pyx_v_F = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfatkin", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17220, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfatkin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_984mfatkin(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mfatk, __pyx_v_F);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_984mfatkin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mfatk, PyObject *__pyx_v_F) {
  GEN __pyx_v__mfatk;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfatkin", 0);
  __Pyx_INCREF(__pyx_v_mfatk);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":17241
 *             %6 = [0, -3, 1, 0, -3]
 *         '''
 *         mfatk = objtogen(mfatk)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mfatk, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mfatk, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17242
 *         '''
 *         mfatk = objtogen(mfatk)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17243
 *         mfatk = objtogen(mfatk)
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17243, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17244
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mfatk = (<Gen>mfatk).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfatkin(_mfatk, _F)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mfatk)->__pyx_base.g;
  __pyx_v__mfatk = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17245
 *         sig_on()
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfatkin(_mfatk, _F)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17246
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfatkin(_mfatk, _F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfatkin(__pyx_v__mfatk, __pyx_v__F);

  /* "cypari/auto_instance.pxi":17247
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfatkin(_mfatk, _F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfatkineigenvalues(self, mf, long Q, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17220
 *         return new_gen(_ret)
 * 
 *     def mfatkin(self, mfatk, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :literal:`mfatk` output by :literal:`mfatk = mfatkininit(mf,Q)` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfatkin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mfatk);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17249
 *         return new_gen(_ret)
 * 
 *     def mfatkineigenvalues(self, mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space :literal:`mf` of integral weight :math:`k` and a primitive
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_987mfatkineigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_986mfatkineigenvalues[] = "\n        Given a modular form space :literal:`mf` of integral weight :math:`k` and a primitive\n        divisor :math:`Q` of the level :math:`N` of :literal:`mf`, outputs the Atkin-Lehner\n        eigenvalues of :math:`w_Q` on the new space, grouped by orbit. If :math:`\\chi` is a\n        (trivial or) quadratic character defined modulo :math:`N/Q`, the result is rounded\n        and the eigenvalues are :math:`\302\261 i^k`.\n        \n        ::\n        \n            ? mf = mfinit([35,2],0); mffields(mf)\n            %1 = [y, y^2 - y - 4] \\\\ two orbits, dimension 1 and 2\n            ? mfatkineigenvalues(mf,5)\n            %2 = [[1], [-1, -1]]\n            ? mf = mfinit([12,7,Mod(3,4)],0);\n            ? mfatkineigenvalues(mf,3)\n            %4 = [[I, -I, -I, I, I, -I]] \\\\ one orbit\n        \n        If you want the eigenvalues on a larger space than the new space,\n        e.g. the full space, you can directly call :literal:`[mfB,M,C] = mfatkininit` and\n        compute the eigenvalues as the roots of the characteristic polynomial of\n        :math:`M/C`, i.e. by dividing the roots of :literal:`charpoly(M)` by :math:`C`. Note that the\n        characteristic polynomial is computed exactly since :math:`M` has coefficients in\n        :math:`\\mathbb{Q} (\\chi)`, whereas :math:`C` may be given by a complex number. If the coefficients\n        of the characteristic polynomial are polmods modulo :math:`T` they must be embedded\n        to :math:`\\mathbb{C}` first using :literal:`subst(lift(), t, exp(2*I*Pi/n))`, when :math:`T` is\n        :literal:`poliscyclo(n)`; note that :math:`T = mf.mod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_987mfatkineigenvalues(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  long __pyx_v_Q;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfatkineigenvalues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_Q,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mf)) != 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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfatkineigenvalues", 0, 2, 3, 1); __PYX_ERR(4, 17249, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfatkineigenvalues") < 0)) __PYX_ERR(4, 17249, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_mf = values[0];
    __pyx_v_Q = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_Q == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17249, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17249, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfatkineigenvalues", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17249, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfatkineigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_986mfatkineigenvalues(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_Q, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_986mfatkineigenvalues(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfatkineigenvalues", 0);
  __Pyx_INCREF(__pyx_v_mf);

  /* "cypari/auto_instance.pxi":17277
 *         :literal:`poliscyclo(n)`; note that :math:`T = mf.mod`.
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17278
 *         '''
 *         mf = objtogen(mf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17278, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17279
 *         mf = objtogen(mf)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17280
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":17281
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfatkineigenvalues(__pyx_v__mf, __pyx_v_Q, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":17282
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfatkininit(self, mf, long Q, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17249
 *         return new_gen(_ret)
 * 
 *     def mfatkineigenvalues(self, mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space :literal:`mf` of integral weight :math:`k` and a primitive
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfatkineigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17284
 *         return new_gen(_ret)
 * 
 *     def mfatkininit(self, mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space with parameters :math:`N,k,\chi` and a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_989mfatkininit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_988mfatkininit[] = "\n        Given a modular form space with parameters :math:`N,k,\\chi` and a\n        primitive divisor :math:`Q` of the level :math:`N`, initializes data necessary for\n        working with the Atkin-Lehner operator :math:`W_Q`, for now only the function\n        :literal:`mfatkin`. We write :math:`\\chi ~ \\chi_Q \\chi_{N/Q}` where\n        the two characters are primitive with (coprime) conductors dividing\n        :math:`Q` and :math:`N/Q` respectively. For :math:`F\\in M_k(\\Gamma_0(N),\\chi)`,\n        the form :math:`F \\| W_Q` still has level :math:`N` and weight :math:`k` but its\n        Nebentypus may no longer be :math:`\\chi`: it becomes :math:`\\overline{\\chi_Q} \\chi_{N/Q})`\n        if :math:`k` is integral and :math:`\\overline{\\chi_Q} \\chi_{N/Q})(4Q/.)` if not.\n        \n        The result is a technical 4-component vector :literal:`[mfB, CM, C, mf]`, where\n        \n        - :literal:`mfB` encodes the modular form space to which\n          :math:`F\\|W_Q` belongs when :math:`F \\in M_k(\\Gamma_0(N), \\chi)`: an :literal:`mfinit`\n          corresponding to a new Nebentypus or the integer :math:`0` when the character does\n          not change. This does not depend on :math:`F`.\n        \n        - :literal:`CM` is the matrix of :math:`W_Q` on the bases of :literal:`mf` and :literal:`mfB`\n          multiplied by a normalizing constant :math:`C(k,\\chi,Q)`. This matrix has polmod\n          coefficients in :math:`\\mathbb{Q} (\\chi)`.\n        \n        - :literal:`C` is the complex constant :math:`C(k,\\chi,Q)`. For :math:`k`\n          integral, let :math:`A(k,\\chi, Q) = Q^{\\varepsilon}/g(\\chi_Q)`, where\n          :math:`\\varepsilon = 0` for :math:`k` even and :math:`1/2` for :math:`k` odd and\n          where :math:`g(\\chi_Q)` is the Gauss sum attached to :math:`\\chi_Q`). (A similar, more\n          complicated, definition holds in half-integral weight depending on the parity\n          of :math:`k - 1/2`.) Then if :math:`M` denote""s the matrix of :math:`W_Q` on the bases\n          of :literal:`mf` and :literal:`mfB`, :math:`A.M` has coefficients in :math:`\\mathbb{Q} (\\chi)`.\n          If :math:`A` is rational, we let :math:`C = 1` and :math:`C = A` as a floating point complex\n          number otherwise, and finally :math:`MC := M.C`.\n        \n        ::\n        \n            ? mf=mfinit([32,4],0); [mfB,MC,C]=mfatkininit(mf,32); MC\n            %1 =\n            [5/16 11/2 55/8]\n            \n            [ 1/8 0 -5/4]\n            \n            [1/32 -1/4 11/16]\n            \n            ? C\n            %2 = 1\n            ? mf=mfinit([32,4,8],0); [mfB,MC,C]=mfatkininit(mf,32); MC\n            %3 =\n            [ 1/8 -7/4]\n            \n            [-1/16 -1/8]\n            ? C\n            %4 = 0.35355339059327376220042218105242451964\n            ? algdep(C,2) \\\\ C = 1/sqrt(8)\n            %5 = 8*x^2 - 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_989mfatkininit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  long __pyx_v_Q;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfatkininit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_Q,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mf)) != 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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfatkininit", 0, 2, 3, 1); __PYX_ERR(4, 17284, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfatkininit") < 0)) __PYX_ERR(4, 17284, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_mf = values[0];
    __pyx_v_Q = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_Q == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17284, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17284, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfatkininit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17284, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfatkininit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_988mfatkininit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_Q, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_988mfatkininit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfatkininit", 0);
  __Pyx_INCREF(__pyx_v_mf);

  /* "cypari/auto_instance.pxi":17339
 *             %5 = 8*x^2 - 1
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17340
 *         '''
 *         mf = objtogen(mf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17340, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17341
 *         mf = objtogen(mf)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17342
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":17343
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfatkininit(__pyx_v__mf, __pyx_v_Q, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":17344
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfbasis(self, NK, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17284
 *         return new_gen(_ret)
 * 
 *     def mfatkininit(self, mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space with parameters :math:`N,k,\chi` and a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfatkininit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17346
 *         return new_gen(_ret)
 * 
 *     def mfbasis(self, NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives a basis of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_991mfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_990mfbasis[] = "\n        If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives a basis of the\n        corresponding subspace of :math:`M_k(\\Gamma_0(N),\\chi)`. :math:`NK` can also be the\n        output of :literal:`mfinit`, in which case :literal:`space` can be omitted.\n        To obtain the eigenforms, use :literal:`mfeigenbasis`.\n        \n        If :literal:`space` is a full space :math:`M_k`, the output is the union of first, a\n        basis of the space of Eisenstein series, and second, a basis of the cuspidal\n        space.\n        \n        ::\n        \n            ? see(L) = apply(f->mfcoefs(f,3), L);\n            ? mf = mfinit([35,2],0);\n            ? see( mfbasis(mf) )\n            %2 = [[0, 3, -1, 0], [0, -1, 9, -8], [0, 0, -8, 10]]\n            ? see( mfeigenbasis(mf) )\n            %3 = [[0, 1, 0, 1], [Mod(0, z^2 - z - 4), Mod(1, z^2 - z - 4), \\\n             Mod(-z, z^2 - z - 4), Mod(z - 1, z^2 - z - 4)]]\n            ? mf = mfinit([35,2]);\n            ? see( mfbasis(mf) )\n            %5 = [[1/6, 1, 3, 4], [1/4, 1, 3, 4], [17/12, 1, 3, 4], \\\n             [0, 3, -1, 0], [0, -1, 9, -8], [0, 0, -8, 10]]\n            ? see( mfbasis([48,4],0) )\n            %6 = [[0, 3, 0, -3], [0, -3, 0, 27], [0, 2, 0, 30]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_991mfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfbasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_space,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_NK)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfbasis") < 0)) __PYX_ERR(4, 17346, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_NK = values[0];
    if (values[1]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17346, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfbasis", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17346, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_990mfbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_space);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_990mfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfbasis", 0);
  __Pyx_INCREF(__pyx_v_NK);

  /* "cypari/auto_instance.pxi":17373
 *             %6 = [[0, 3, 0, -3], [0, -3, 0, 27], [0, 2, 0, 30]]
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17374
 *         '''
 *         NK = objtogen(NK)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfbasis(_NK, space)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17374, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17375
 *         NK = objtogen(NK)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfbasis(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17376
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfbasis(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfbasis(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_instance.pxi":17377
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfbasis(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfbd(self, F, long d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17346
 *         return new_gen(_ret)
 * 
 *     def mfbasis(self, NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives a basis of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17379
 *         return new_gen(_ret)
 * 
 *     def mfbd(self, F, long d):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, return :math:`B(d)(F)`, where :math:`B(d)` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_993mfbd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_992mfbd[] = "\n        :math:`F` being a generalized modular form, return :math:`B(d)(F)`, where :math:`B(d)` is\n        the expanding operator :math:`\\tau:--->\302\240d\\tau`.\n        \n        ::\n        \n            ? D2=mfbd(mfDelta(),2); mfcoefs(D2, 6)\n            %1 = [0, 0, 1, 0, -24, 0, 252]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_993mfbd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_d;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfbd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_d,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_F)) != 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_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfbd", 1, 2, 2, 1); __PYX_ERR(4, 17379, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfbd") < 0)) __PYX_ERR(4, 17379, __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_F = values[0];
    __pyx_v_d = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17379, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfbd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfbd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_992mfbd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_992mfbd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_d) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfbd", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":17389
 *             %1 = [0, 0, 1, 0, -24, 0, 252]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17390
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfbd(_F, d)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17390, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17391
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfbd(_F, d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17392
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfbd(_F, d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfbd(__pyx_v__F, __pyx_v_d);

  /* "cypari/auto_instance.pxi":17393
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfbd(_F, d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfbracket(self, F, G, long m=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17379
 *         return new_gen(_ret)
 * 
 *     def mfbd(self, F, long d):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, return :math:`B(d)(F)`, where :math:`B(d)` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfbd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17395
 *         return new_gen(_ret)
 * 
 *     def mfbracket(self, F, G, long m=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`m`-th Rankin-Cohen bracket of the generalized modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_995mfbracket(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_994mfbracket[] = "\n        Compute the :math:`m`-th Rankin-Cohen bracket of the generalized modular\n        forms :math:`F` and :math:`G`.\n        \n        ::\n        \n            ? E4 = mfEk(4); E6 = mfEk(6);\n            ? D1 = mfbracket(E4,E4,2); mfcoefs(D1,5)/4800\n            %2 = [0, 1, -24, 252, -1472, 4830]\n            ? D2 = mfbracket(E4,E6,1); mfcoefs(D2,10)/(-3456)\n            %3 = [0, 1, -24, 252, -1472, 4830]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_995mfbracket(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_G = 0;
  long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfbracket (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_G,&__pyx_n_s_m,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F)) != 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_G)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfbracket", 0, 2, 3, 1); __PYX_ERR(4, 17395, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfbracket") < 0)) __PYX_ERR(4, 17395, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_F = values[0];
    __pyx_v_G = values[1];
    if (values[2]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17395, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfbracket", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17395, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfbracket", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_994mfbracket(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_G, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_994mfbracket(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_m) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfbracket", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":17408
 *             %3 = [0, 1, -24, 252, -1472, 4830]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         G = objtogen(G)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17409
 *         '''
 *         F = objtogen(F)
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17410
 *         F = objtogen(F)
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17410, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17411
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfbracket(_F, _G, m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17412
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfbracket(_F, _G, m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17413
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfbracket(_F, _G, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfbracket(__pyx_v__F, __pyx_v__G, __pyx_v_m);

  /* "cypari/auto_instance.pxi":17414
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfbracket(_F, _G, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcoef(self, F, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17395
 *         return new_gen(_ret)
 * 
 *     def mfbracket(self, F, G, long m=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`m`-th Rankin-Cohen bracket of the generalized modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfbracket", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17416
 *         return new_gen(_ret)
 * 
 *     def mfcoef(self, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`n`-th Fourier coefficient of the generalized modular form :math:`F`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_997mfcoef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_996mfcoef[] = "\n        Compute the :math:`n`-th Fourier coefficient of the generalized modular form :math:`F`.\n        Note that this is the :math:`n+1`-st component of the vector\n        :literal:`mfcoefs(F,n)` as well as the second component of :literal:`mfcoefs(F,1,n)`.\n        \n        ::\n        \n            ? mfcoef(mfDelta(),10)\n            %1 = -115920\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_997mfcoef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcoef (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_n,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfcoef", 1, 2, 2, 1); __PYX_ERR(4, 17416, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfcoef") < 0)) __PYX_ERR(4, 17416, __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_F = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17416, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfcoef", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17416, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_996mfcoef(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_996mfcoef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcoef", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":17427
 *             %1 = -115920
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17428
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoef(_F, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17428, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17429
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcoef(_F, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17430
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoef(_F, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcoef(__pyx_v__F, __pyx_v_n);

  /* "cypari/auto_instance.pxi":17431
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoef(_F, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcoefs(self, F, long n, long d=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17431, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17416
 *         return new_gen(_ret)
 * 
 *     def mfcoef(self, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`n`-th Fourier coefficient of the generalized modular form :math:`F`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17433
 *         return new_gen(_ret)
 * 
 *     def mfcoefs(self, F, long n, long d=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the vector of Fourier coefficients :math:`[a[0],a[d],...,a[nd]]` of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_999mfcoefs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_998mfcoefs[] = "\n        Compute the vector of Fourier coefficients :math:`[a[0],a[d],...,a[nd]]` of the\n        generalized modular form :math:`F`; :math:`d` must be positive and :math:`d = 1` by default.\n        \n        ::\n        \n            ? D = mfDelta();\n            ? mfcoefs(D,10)\n            %2 = [0, 1, -24, 252, -1472, 4830, -6048, -16744, 84480, -113643, -115920]\n            ? mfcoefs(D,5,2)\n            %3 = [0, -24, -1472, -6048, 84480, -115920]\n            ? mfcoef(D,10)\n            %4 = -115920\n        \n        This function also applies when :math:`F` is a modular form space as output by\n        :literal:`mfinit`; it then returns the matrix whose columns give the Fourier\n        expansions of the elements of :literal:`mfbasis`:math:`(F)`:\n        \n        ::\n        \n            ? mf = mfinit([1,12]);\n            ? mfcoefs(mf,5)\n            %2 =\n            [691/65520 0]\n            \n            [ 1 1]\n            \n            [ 2049 -24]\n            \n            [ 177148 252]\n            \n            [ 4196353 -1472]\n            \n            [ 48828126 4830]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_999mfcoefs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_n;
  long __pyx_v_d;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcoefs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_n,&__pyx_n_s_d,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfcoefs", 0, 2, 3, 1); __PYX_ERR(4, 17433, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfcoefs") < 0)) __PYX_ERR(4, 17433, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_F = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17433, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_d = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17433, __pyx_L3_error)
    } else {
      __pyx_v_d = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfcoefs", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17433, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcoefs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_998mfcoefs(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_n, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_998mfcoefs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n, long __pyx_v_d) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcoefs", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":17469
 *             [ 48828126 4830]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17470
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoefs(_F, n, d)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17470, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17471
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcoefs(_F, n, d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17472
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoefs(_F, n, d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcoefs(__pyx_v__F, __pyx_v_n, __pyx_v_d);

  /* "cypari/auto_instance.pxi":17473
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoefs(_F, n, d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfconductor(self, mf, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17433
 *         return new_gen(_ret)
 * 
 *     def mfcoefs(self, F, long n, long d=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the vector of Fourier coefficients :math:`[a[0],a[d],...,a[nd]]` of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcoefs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17475
 *         return new_gen(_ret)
 * 
 *     def mfconductor(self, mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being output by :literal:`mfinit` for the cuspidal space and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1001mfconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1000mfconductor[] = "\n        :literal:`mf` being output by :literal:`mfinit` for the cuspidal space and\n        :math:`F` a modular form, gives the smallest level on which :math:`F` is defined.\n        \n        ::\n        \n            ? mf=mfinit([96,6],1); vF = mfbasis(mf); mfdim(mf)\n            %1 = 72\n            ? vector(10,i, mfconductor(mf, vF[i]))\n            %2 = [3, 6, 12, 24, 48, 96, 4, 8, 12, 16]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1001mfconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,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_mf)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfconductor", 1, 2, 2, 1); __PYX_ERR(4, 17475, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfconductor") < 0)) __PYX_ERR(4, 17475, __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_mf = values[0];
    __pyx_v_F = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfconductor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17475, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1000mfconductor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1000mfconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfconductor", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":17487
 *             %2 = [3, 6, 12, 24, 48, 96, 4, 8, 12, 16]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17488
 *         '''
 *         mf = objtogen(mf)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17489
 *         mf = objtogen(mf)
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17489, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17490
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef long _ret = mfconductor(_mf, _F)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17491
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfconductor(_mf, _F)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17492
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef long _ret = mfconductor(_mf, _F)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfconductor(__pyx_v__mf, __pyx_v__F);

  /* "cypari/auto_instance.pxi":17493
 *         cdef GEN _F = (<Gen>F).g
 *         cdef long _ret = mfconductor(_mf, _F)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":17494
 *         cdef long _ret = mfconductor(_mf, _F)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfcosets(self, N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17475
 *         return new_gen(_ret)
 * 
 *     def mfconductor(self, mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being output by :literal:`mfinit` for the cuspidal space and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17496
 *         return _ret
 * 
 *     def mfcosets(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of right cosets of :math:`\Gamma_0(N) \\Gamma`, i.e., matrices
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1003mfcosets(PyObject *__pyx_v_self, PyObject *__pyx_v_N); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1002mfcosets[] = "\n        List of right cosets of :math:`\\Gamma_0(N) \\\\Gamma`, i.e., matrices\n        :math:`\\gamma_j \\in \\Gamma` such that :math:`\\Gamma = \\bigsqcup_j \\Gamma_0(N) \\gamma_j`.\n        The :math:`\\gamma_j` are chosen in the form :math:`[a,b;c,d]` with :math:`c \\| N`.\n        :math:`N` can be either a positive integer or a modular form space.\n        \n        ::\n        \n            ? mfcosets(4)\n            %1 = [[0, -1; 1, 0], [1, 0; 1, 1], [0, -1; 1, 2], [0, -1; 1, 3],\\\n             [1, 0; 2, 1], [1, 0; 4, 1]]\n        \n        :strong:`Warning.` in the present implementation, the trivial coset is\n        represented by :math:`[1,0;N,1]` and is the last in the list.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1003mfcosets(PyObject *__pyx_v_self, PyObject *__pyx_v_N) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcosets (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1002mfcosets(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_N));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1002mfcosets(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcosets", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":17512
 *         represented by :math:`[1,0;N,1]` and is the last in the list.
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17513
 *         '''
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcosets(_N)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17513, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17514
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcosets(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17515
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcosets(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcosets(__pyx_v__N);

  /* "cypari/auto_instance.pxi":17516
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcosets(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcuspisregular(self, NK, cusp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17496
 *         return _ret
 * 
 *     def mfcosets(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of right cosets of :math:`\Gamma_0(N) \\Gamma`, i.e., matrices
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcosets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17518
 *         return new_gen(_ret)
 * 
 *     def mfcuspisregular(self, NK, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         In the space defined by :literal:`NK = [N,k,CHI]` or :literal:`NK = mf`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1005mfcuspisregular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1004mfcuspisregular[] = "\n        In the space defined by :literal:`NK = [N,k,CHI]` or :literal:`NK = mf`,\n        determine if :literal:`cusp` in canonical format (oo or denominator\n        dividing :math:`N`) is regular or not.\n        \n        ::\n        \n            ? mfcuspisregular([4,3,-4],1/2)\n            %1 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1005mfcuspisregular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  PyObject *__pyx_v_cusp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcuspisregular (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_cusp,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_NK)) != 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_cusp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfcuspisregular", 1, 2, 2, 1); __PYX_ERR(4, 17518, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfcuspisregular") < 0)) __PYX_ERR(4, 17518, __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_NK = values[0];
    __pyx_v_cusp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfcuspisregular", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17518, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcuspisregular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1004mfcuspisregular(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_cusp);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1004mfcuspisregular(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_cusp) {
  GEN __pyx_v__NK;
  GEN __pyx_v__cusp;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcuspisregular", 0);
  __Pyx_INCREF(__pyx_v_NK);
  __Pyx_INCREF(__pyx_v_cusp);

  /* "cypari/auto_instance.pxi":17529
 *             %1 = 0
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         cusp = objtogen(cusp)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17530
 *         '''
 *         NK = objtogen(NK)
 *         cusp = objtogen(cusp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cusp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cusp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17531
 *         NK = objtogen(NK)
 *         cusp = objtogen(cusp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17531, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17532
 *         cusp = objtogen(cusp)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17533
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _cusp = (<Gen>cusp).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cusp)->__pyx_base.g;
  __pyx_v__cusp = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17534
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfcuspisregular(__pyx_v__NK, __pyx_v__cusp);

  /* "cypari/auto_instance.pxi":17535
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":17536
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfcusps(self, N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17518
 *         return new_gen(_ret)
 * 
 *     def mfcuspisregular(self, NK, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         In the space defined by :literal:`NK = [N,k,CHI]` or :literal:`NK = mf`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcuspisregular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XDECREF(__pyx_v_cusp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17538
 *         return _ret
 * 
 *     def mfcusps(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of cusps of :math:`\Gamma_0(N)` in the form :math:`a/b` with :math:`b \| N`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1007mfcusps(PyObject *__pyx_v_self, PyObject *__pyx_v_N); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1006mfcusps[] = "\n        List of cusps of :math:`\\Gamma_0(N)` in the form :math:`a/b` with :math:`b \\| N`.\n        :math:`N` can be either an integer of a modular form space.\n        \n        ::\n        \n            ? mfcusps(24)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1007mfcusps(PyObject *__pyx_v_self, PyObject *__pyx_v_N) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcusps (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1006mfcusps(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_N));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1006mfcusps(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcusps", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":17548
 *             %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17549
 *         '''
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcusps(_N)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17549, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17550
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcusps(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17551
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcusps(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcusps(__pyx_v__N);

  /* "cypari/auto_instance.pxi":17552
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcusps(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcuspval(self, mf, F, cusp, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17538
 *         return _ret
 * 
 *     def mfcusps(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of cusps of :math:`\Gamma_0(N)` in the form :math:`a/b` with :math:`b \| N`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcusps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17554
 *         return new_gen(_ret)
 * 
 *     def mfcuspval(self, mf, F, cusp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Valuation of modular form :math:`F` in the space :literal:`mf` at
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1009mfcuspval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1008mfcuspval[] = "\n        Valuation of modular form :math:`F` in the space :literal:`mf` at\n        :literal:`cusp`, which can be either :math:`oo` or any rational number, and the\n        result is either a rational number or :math:`oo` if :math:`F` is zero. If :math:`\\mathbb{Q} (F)\n        != \\mathbb{Q} (\\chi)`, return the vector of valuations attached to the\n        :math:`[\\mathbb{Q} (F):\\mathbb{Q} (chi)]` complex embeddings of :math:`F`.\n        \n        ::\n        \n            ? T=mfTheta();mf=mfinit([12,1/2]);mfcusps(12)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/12]\n            ? apply(x->mfcuspval(mf,T,x),%1)\n            %2 = [0, 1/4, 0, 0, 1/4, 0]\n            ? mf=mfinit([12,6,12],1);F=mfbasis(mf)[5];\n            ? apply(x->mfcuspval(mf,F,x),%1)\n            %4 = [1/12, 1/6, 1/2, 2/3, 1/2, 2]\n            ? mf=mfinit([12,3,-4],1);F=mfbasis(mf)[1];\n            ? apply(x->mfcuspval(mf,F,x),%1)\n            %6 = [1/12, 1/6, 1/4, 2/3, 1/2, 1]\n            \n            ? mf = mfinit([625,2],0); [F] = mfeigenbasis(mf); mfparams(F)\n            %7 = [625, 2, 1, y^2 - y - 1] \\\\ [Q(F):Q(chi)] = poldegree(y^2-y-1)\n            ? mfcuspval(mf, F, 1/25)\n            %8 = [1, 2] \\\\ one conjugate has valuation 1, and the other is 2\n            ? mfcuspval(mf, F, 1/5)\n            %9 = [1/25, 1/25]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1009mfcuspval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_cusp = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcuspval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,&__pyx_n_s_cusp,&__pyx_n_s_precision,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_mf)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfcuspval", 0, 3, 4, 1); __PYX_ERR(4, 17554, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cusp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfcuspval", 0, 3, 4, 2); __PYX_ERR(4, 17554, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfcuspval") < 0)) __PYX_ERR(4, 17554, __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_mf = values[0];
    __pyx_v_F = values[1];
    __pyx_v_cusp = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17554, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfcuspval", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17554, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcuspval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1008mfcuspval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F, __pyx_v_cusp, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1008mfcuspval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_cusp, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__cusp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mfcuspval", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_cusp);

  /* "cypari/auto_instance.pxi":17582
 *             %9 = [1/25, 1/25]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         cusp = objtogen(cusp)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17583
 *         '''
 *         mf = objtogen(mf)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         cusp = objtogen(cusp)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17584
 *         mf = objtogen(mf)
 *         F = objtogen(F)
 *         cusp = objtogen(cusp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cusp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cusp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17585
 *         F = objtogen(F)
 *         cusp = objtogen(cusp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17585, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17586
 *         cusp = objtogen(cusp)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17587
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17588
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cusp)->__pyx_base.g;
  __pyx_v__cusp = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17589
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":17590
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":17589
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 */
  }

  /* "cypari/auto_instance.pxi":17591
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcuspval(__pyx_v__mf, __pyx_v__F, __pyx_v__cusp, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":17592
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcuspwidth(self, N, cusp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17554
 *         return new_gen(_ret)
 * 
 *     def mfcuspval(self, mf, F, cusp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Valuation of modular form :math:`F` in the space :literal:`mf` at
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcuspval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_cusp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17594
 *         return new_gen(_ret)
 * 
 *     def mfcuspwidth(self, N, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         Width of :literal:`cusp` in :math:`\Gamma_0(N)`, :math:`N` being either an integer or a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1011mfcuspwidth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1010mfcuspwidth[] = "\n        Width of :literal:`cusp` in :math:`\\Gamma_0(N)`, :math:`N` being either an integer or a\n        modular form space.\n        \n        ::\n        \n            ? mfcusps(12)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/12]\n            ? [mfcuspwidth(12,c) | c <- mfcusps(12)]\n            %2 = [12, 3, 4, 3, 1, 1]\n            ? mfcuspwidth(12, oo)\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1011mfcuspwidth(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_cusp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcuspwidth (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_cusp,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_N)) != 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_cusp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfcuspwidth", 1, 2, 2, 1); __PYX_ERR(4, 17594, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfcuspwidth") < 0)) __PYX_ERR(4, 17594, __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_N = values[0];
    __pyx_v_cusp = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfcuspwidth", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17594, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcuspwidth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1010mfcuspwidth(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N, __pyx_v_cusp);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1010mfcuspwidth(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, PyObject *__pyx_v_cusp) {
  GEN __pyx_v__N;
  GEN __pyx_v__cusp;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcuspwidth", 0);
  __Pyx_INCREF(__pyx_v_N);
  __Pyx_INCREF(__pyx_v_cusp);

  /* "cypari/auto_instance.pxi":17608
 *             %3 = 1
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         cusp = objtogen(cusp)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17609
 *         '''
 *         N = objtogen(N)
 *         cusp = objtogen(cusp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cusp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cusp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17610
 *         N = objtogen(N)
 *         cusp = objtogen(cusp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17610, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17611
 *         cusp = objtogen(cusp)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17612
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _cusp = (<Gen>cusp).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cusp)->__pyx_base.g;
  __pyx_v__cusp = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17613
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspwidth(_N, _cusp)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfcuspwidth(__pyx_v__N, __pyx_v__cusp);

  /* "cypari/auto_instance.pxi":17614
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":17615
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfderiv(self, F, long m=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17594
 *         return new_gen(_ret)
 * 
 *     def mfcuspwidth(self, N, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         Width of :literal:`cusp` in :math:`\Gamma_0(N)`, :math:`N` being either an integer or a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfcuspwidth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XDECREF(__pyx_v_cusp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17617
 *         return _ret
 * 
 *     def mfderiv(self, F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m`-th formal derivative of the power series corresponding to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1013mfderiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1012mfderiv[] = "\n        :math:`m`-th formal derivative of the power series corresponding to\n        the generalized modular form :math:`F`, with respect to the differential operator\n        :math:`qd/dq` (default :math:`m = 1`).\n        \n        ::\n        \n            ? D=mfDelta();\n            ? mfcoefs(D, 4)\n            %2 = [0, 1, -24, 252, -1472]\n            ? mfcoefs(mfderiv(D), 4)\n            %3 = [0, 1, -48, 756, -5888]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1013mfderiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfderiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_m,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfderiv") < 0)) __PYX_ERR(4, 17617, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_F = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17617, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfderiv", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17617, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfderiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1012mfderiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1012mfderiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_m) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfderiv", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":17631
 *             %3 = [0, 1, -48, 756, -5888]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17632
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderiv(_F, m)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17632, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17633
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfderiv(_F, m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17634
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderiv(_F, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfderiv(__pyx_v__F, __pyx_v_m);

  /* "cypari/auto_instance.pxi":17635
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderiv(_F, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfderivE2(self, F, long m=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17617
 *         return _ret
 * 
 *     def mfderiv(self, F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m`-th formal derivative of the power series corresponding to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfderiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17637
 *         return new_gen(_ret)
 * 
 *     def mfderivE2(self, F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the Serre derivative :math:`(q.d/dq)F - kE_2F/12`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1015mfderivE2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1014mfderivE2[] = "\n        Compute the Serre derivative :math:`(q.d/dq)F - kE_2F/12`\n        of the generalized modular form :math:`F`, which has weight :math:`k+2`;\n        if :math:`F` is a true modular form, then its Serre derivative is also modular.\n        If :math:`m > 1`, compute the :math:`m`-th iterate, of weight :math:`k + 2m`.\n        \n        ::\n        \n            ? mfcoefs(mfderivE2(mfEk(4)),5)*(-3)\n            %1 = [1, -504, -16632, -122976, -532728]\n            ? mfcoefs(mfEk(6),5)\n            %2 = [1, -504, -16632, -122976, -532728]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1015mfderivE2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfderivE2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_m,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfderivE2") < 0)) __PYX_ERR(4, 17637, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_F = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17637, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfderivE2", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17637, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfderivE2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1014mfderivE2(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1014mfderivE2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_m) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfderivE2", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":17651
 *             %2 = [1, -504, -16632, -122976, -532728]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17652
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderivE2(_F, m)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17652, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17653
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfderivE2(_F, m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17654
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderivE2(_F, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfderivE2(__pyx_v__F, __pyx_v_m);

  /* "cypari/auto_instance.pxi":17655
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderivE2(_F, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfdim(self, NK, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17637
 *         return new_gen(_ret)
 * 
 *     def mfderivE2(self, F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the Serre derivative :math:`(q.d/dq)F - kE_2F/12`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfderivE2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17657
 *         return new_gen(_ret)
 * 
 *     def mfdim(self, NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives the dimension of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1017mfdim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1016mfdim[] = "\n        If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives the dimension of the\n        corresponding subspace of :math:`M_k(\\Gamma_0(N),\\chi)`. :math:`NK` can also be the\n        output of :literal:`mfinit`, in which case space must be omitted.\n        \n        The subspace is described by the small integer :literal:`space`: :math:`0` for the\n        newspace :math:`S_k^{new}(\\Gamma_0(N),\\chi)`, :math:`1` for the cuspidal\n        space :math:`S_k`, :math:`2` for the oldspace :math:`S_k^{old}`, :math:`3` for the space of\n        Eisenstein series :math:`E_k` and :math:`4` for the full space :math:`M_k`.\n        \n        :strong:`Wildcards.`\n        As in :literal:`mfinit`, :emphasis:`CHI` may be the wildcard 0\n        (all Galois orbits of characters); in this case, the output is a vector of\n        :math:`[order, conrey, dim, dimdih]` corresponding\n        to the non-trivial spaces, where\n        \n        - :emphasis:`order` is the order of the character,\n        \n        - :emphasis:`conrey` its Conrey label from which the character may be recovered\n          via :literal:`znchar`:math:`(conrey)`,\n        \n        - :emphasis:`dim` the dimension of the corresponding space,\n        \n        - :emphasis:`dimdih` the dimension of the subspace of dihedral forms\n          corresponding to Hecke characters if :math:`k = 1` (this is not implemented for\n          the old space and set to :math:`-1` for the time being) and 0 otherwise.\n        \n        The spaces are sorted by increasing order of the character; the characters are\n        taken up to Galois conjugation and the Conrey number is the minimal one among\n        Galois conjugates. In weight :math:`1`, this is only implemented when\n        the space is 0 (newspace), 1 (cusp space), 2(old space) or 3(Eisenstein\n        series).\n        \n        :strong:`Wildcards for sets of characters.` :emphasis:`CHI` may be a set\n        of characters, and we return the set of :math:`""[dim,dimdih]`.\n        \n        :strong:`Wildcard for :math:`M_k(\\Gamma_1(N))`.`\n        Additionally, the wildcard :math:`CHI = -1` is available in which case we\n        output the total dimension of the corresponding\n        subspace of :math:`M_k(\\Gamma_1(N))`. In weight :math:`1`, this is not implemented\n        when the space is 4 (fullspace).\n        \n        ::\n        \n            ? mfdim([23,2], 0) \\\\ new space\n            %1 = 2\n            ? mfdim([96,6], 0)\n            %2 = 10\n            ? mfdim([10^9,4], 3) \\\\ Eisenstein space\n            %1 = 40000\n            ? mfdim([10^9+7,4], 3)\n            %2 = 2\n            ? mfdim([68,1,-1],0)\n            %3 = 3\n            ? mfdim([68,1,0],0)\n            %4 = [[2, Mod(67, 68), 1, 1], [4, Mod(47, 68), 1, 1]]\n            ? mfdim([124,1,0],0)\n            %5 = [[6, Mod(67, 124), 2, 0]]\n        \n        This last example shows that there exists a nondihedral form of weight 1\n        in level 124.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1017mfdim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfdim (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_space,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_NK)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfdim") < 0)) __PYX_ERR(4, 17657, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_NK = values[0];
    if (values[1]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17657, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfdim", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17657, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1016mfdim(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_space);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1016mfdim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfdim", 0);
  __Pyx_INCREF(__pyx_v_NK);

  /* "cypari/auto_instance.pxi":17720
 *         in level 124.
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17721
 *         '''
 *         NK = objtogen(NK)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfdim(_NK, space)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17721, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17722
 *         NK = objtogen(NK)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfdim(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17723
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfdim(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfdim(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_instance.pxi":17724
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfdim(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfdiv(self, F, G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17657
 *         return new_gen(_ret)
 * 
 *     def mfdim(self, NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives the dimension of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17726
 *         return new_gen(_ret)
 * 
 *     def mfdiv(self, F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two generalized modular forms :math:`F` and :math:`G`, compute :math:`F/G` assuming
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1019mfdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1018mfdiv[] = "\n        Given two generalized modular forms :math:`F` and :math:`G`, compute :math:`F/G` assuming\n        that the quotient will not have poles at infinity. If this is the\n        case, use :literal:`mfshift` before doing the division.\n        \n        ::\n        \n            ? D = mfDelta(); \\\\ Delta\n            ? H = mfpow(mfEk(4), 3);\n            ? J = mfdiv(H, D)\n             *** at top-level: J=mfdiv(H,mfdeltac\n             *** ^--------------------\n             *** mfdiv: domain error in mfdiv: ord(G) > ord(F)\n            ? J = mfdiv(H, mfshift(D,1));\n            ? mfcoefs(J, 4)\n            %4 = [1, 744, 196884, 21493760, 864299970]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1019mfdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfdiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_G,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_F)) != 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_G)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfdiv", 1, 2, 2, 1); __PYX_ERR(4, 17726, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfdiv") < 0)) __PYX_ERR(4, 17726, __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_F = values[0];
    __pyx_v_G = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfdiv", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17726, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1018mfdiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_G);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1018mfdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfdiv", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":17744
 *             %4 = [1, 744, 196884, 21493760, 864299970]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         G = objtogen(G)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17745
 *         '''
 *         F = objtogen(F)
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17746
 *         F = objtogen(F)
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17746, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17747
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfdiv(_F, _G)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17748
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfdiv(_F, _G)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17749
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfdiv(_F, _G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfdiv(__pyx_v__F, __pyx_v__G);

  /* "cypari/auto_instance.pxi":17750
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfdiv(_F, _G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfeigenbasis(self, mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17726
 *         return new_gen(_ret)
 * 
 *     def mfdiv(self, F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two generalized modular forms :math:`F` and :math:`G`, compute :math:`F/G` assuming
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17752
 *         return new_gen(_ret)
 * 
 *     def mfeigenbasis(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of the eigenforms for the space :literal:`mf`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1021mfeigenbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_mf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1020mfeigenbasis[] = "\n        Vector of the eigenforms for the space :literal:`mf`.\n        The initial basis of forms computed by :literal:`mfinit` before splitting\n        is also available via :literal:`mfbasis`.\n        \n        ::\n        \n            ? mf = mfinit([26,2],0);\n            ? see(L) = for(i=1,#L,print(mfcoefs(L[i],6)));\n            ? see( mfeigenbasis(mf) )\n            [0, 1, -1, 1, 1, -3, -1]\n            [0, 1, 1, -3, 1, -1, -3]\n            ? see( mfbasis(mf) )\n            [0, 2, 0, -2, 2, -4, -4]\n            [0, -2, -4, 10, -2, 0, 8]\n        \n        The eigenforms are internally expressed as (algebraic) linear combinations of\n        :literal:`mfbasis(mf)` and it is very inefficient to compute many coefficients\n        of those forms individually: you should rather use :literal:`mfcoefs(mf)`\n        to expand the basis once and for all, then multiply by :literal:`mftobasis(mf,f)`\n        for the forms you're interested in:\n        \n        ::\n        \n            ? mf = mfinit([96,6],0); B = mfeigenbasis(mf); #B\n            %1 = 8;\n            ? vector(#B, i, mfcoefs(B[i],1000)); \\\\ expanded individually: slow\n            time = 7,881 ms.\n            ? M = mfcoefs(mf, 1000); \\\\ initialize once\n            time = 982 ms.\n            ? vector(#B, i, M * mftobasis(mf,B[i])); \\\\ then expand: much faster\n            time = 623 ms.\n        \n        When the eigenforms are defined over an extension field of :math:`\\mathbb{Q} (\\chi)` for a\n        non-rational character, their coefficients are hard to read and you may want\n        to lift them or to express them in an absolute number field. In the\n        construction below :math:`T` defines :math:`\\mathbb{Q} (f)` over :math:`\\mathbb{Q}`, :math:`a` is the image of the\n        generator :literal:`Mod`:math:`(t, t^2+t+1)` of :math:`\\mathbb{Q} (\\chi)` in :math:`\\mathbb{Q} (f)`\n        and :math:`y - ka` is the image of the root :math:`y` of :literal:`f.mod`:\n        \n      ""  ::\n        \n            ? mf = mfinit([31, 2, Mod(25,31)], 0); [f] = mfeigenbasis(mf);\n            ? f.mod\n            %2 = Mod(1, t^2 + t + 1)*y^2 + Mod(2*t + 2, t^2 + t + 1)\n            ? v = liftpol(mfcoefs(f,5))\n            %3 = [0, 1, (-t - 1)*y - 1, t*y + (t + 1), (2*t + 2)*y + 1, t]\n            ? [T,a,k] = rnfequation(mf.mod, f.mod, 1)\n            %4 = [y^4 + 2*y^2 + 4, Mod(-1/2*y^2 - 1, y^4 + 2*y^2 + 4), 0]\n            ? liftpol(substvec(v, [t,y], [a, y-k*a]))\n            %5 = [0, 1, 1/2*y^3 - 1, -1/2*y^3 - 1/2*y^2 - y, -y^3 + 1, -1/2*y^2 - 1]\n        \n        Beware that the meaning of :math:`y` has changed in the last line\n        is different: it now represents of root of :math:`T`, no longer of :literal:`f.mod`\n        (the notions coincide if :math:`k = 0` as here but it will not always be the case).\n        This can be avoided with an extra variable substitution, for instance\n        \n        ::\n        \n            ? [T,a,k] = rnfequation(mf.mod, subst(f.mod,'y,'x), 1)\n            %6 = [x^4 + 2*x^2 + 4, Mod(-1/2*x^2 - 1, x^4 + 2*x^2 + 4), 0]\n            ? liftpol(substvec(v, [t,y], [a, x-k*a]))\n            %7 = [0, 1, 1/2*x^3 - 1, -1/2*x^3 - 1/2*x^2 - x, -x^3 + 1, -1/2*x^2 - 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1021mfeigenbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_mf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfeigenbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1020mfeigenbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_mf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1020mfeigenbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfeigenbasis", 0);
  __Pyx_INCREF(__pyx_v_mf);

  /* "cypari/auto_instance.pxi":17817
 *             %7 = [0, 1, 1/2*x^3 - 1, -1/2*x^3 - 1/2*x^2 - x, -x^3 + 1, -1/2*x^2 - 1]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17818
 *         '''
 *         mf = objtogen(mf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfeigenbasis(_mf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 17818, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17819
 *         mf = objtogen(mf)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfeigenbasis(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":17820
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfeigenbasis(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfeigenbasis(__pyx_v__mf);

  /* "cypari/auto_instance.pxi":17821
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfeigenbasis(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfeigensearch(self, NK, AP=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17752
 *         return new_gen(_ret)
 * 
 *     def mfeigenbasis(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of the eigenforms for the space :literal:`mf`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfeigenbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17823
 *         return new_gen(_ret)
 * 
 *     def mfeigensearch(self, NK, AP=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Search for a normalized rational eigen cuspform with quadratic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1023mfeigensearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1022mfeigensearch[] = "\n        Search for a normalized rational eigen cuspform with quadratic\n        character given restrictions on a few initial coefficients. The meaning of\n        the parameters is as follows:\n        \n        - :literal:`NK` governs the limits of the search: it is of the form\n          :math:`[N,k]`: search for given level :math:`N`, weight :math:`k` and quadratic\n          character; note that the character :math:`(D/.)` is uniquely determined by :math:`(N,k)`.\n          The level :math:`N` can be replaced by a vector of allowed levels.\n        \n        - :literal:`AP` is the search criterion, which can be omitted: a list of\n          pairs :math:`[..., [p,a_p],...]`, where :math:`p` is a prime number and :math:`a_p` is\n          either a :literal:`t_INT` (the :math:`p`-th Fourier coefficient must match :math:`a_p` exactly)\n          or a :literal:`t_INTMOD` :literal:`Mod`:math:`(a,b)` (the :math:`p`-th coefficient must be congruent\n          to :math:`a` modulo :math:`b`).\n        \n        The result is a vector of newforms :math:`f` matching the search criteria, sorted\n        by increasing level then increasing :math:`\\|D\\|`.\n        \n        ::\n        \n            ? #mfeigensearch([[1..80],2], [[2,2],[3,-1]])\n            %1 = 1\n            ? #mfeigensearch([[1..80],2], [[2,2],[5,2]])\n            %2 = 1\n            ? v = mfeigensearch([[1..20],2], [[3,Mod(2,3)],[7,Mod(5,7)]]); #v\n            %3 = 1\n            ? F=v[1]; [mfparams(F)[1], mfcoefs(F,15)]\n            %4 = [11, [0, 1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1023mfeigensearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  PyObject *__pyx_v_AP = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfeigensearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_AP,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_NK)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_AP);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfeigensearch") < 0)) __PYX_ERR(4, 17823, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_NK = values[0];
    __pyx_v_AP = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfeigensearch", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17823, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfeigensearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1022mfeigensearch(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_AP);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1022mfeigensearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_AP) {
  int __pyx_v__have_AP;
  GEN __pyx_v__NK;
  GEN __pyx_v__AP;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfeigensearch", 0);
  __Pyx_INCREF(__pyx_v_NK);
  __Pyx_INCREF(__pyx_v_AP);

  /* "cypari/auto_instance.pxi":17854
 *             %4 = [11, [0, 1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1]]
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         cdef bint _have_AP = (AP is not None)
 *         if _have_AP:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17855
 *         '''
 *         NK = objtogen(NK)
 *         cdef bint _have_AP = (AP is not None)             # <<<<<<<<<<<<<<
 *         if _have_AP:
 *             AP = objtogen(AP)
 */
  __pyx_t_2 = (__pyx_v_AP != Py_None);
  __pyx_v__have_AP = __pyx_t_2;

  /* "cypari/auto_instance.pxi":17856
 *         NK = objtogen(NK)
 *         cdef bint _have_AP = (AP is not None)
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             AP = objtogen(AP)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_AP != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":17857
 *         cdef bint _have_AP = (AP is not None)
 *         if _have_AP:
 *             AP = objtogen(AP)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_AP, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_AP, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":17856
 *         NK = objtogen(NK)
 *         cdef bint _have_AP = (AP is not None)
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             AP = objtogen(AP)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":17858
 *         if _have_AP:
 *             AP = objtogen(AP)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 17858, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17859
 *             AP = objtogen(AP)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _AP = NULL
 *         if _have_AP:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_4;

  /* "cypari/auto_instance.pxi":17860
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL             # <<<<<<<<<<<<<<
 *         if _have_AP:
 *             _AP = (<Gen>AP).g
 */
  __pyx_v__AP = NULL;

  /* "cypari/auto_instance.pxi":17861
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 */
  __pyx_t_2 = (__pyx_v__have_AP != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":17862
 *         cdef GEN _AP = NULL
 *         if _have_AP:
 *             _AP = (<Gen>AP).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_AP)->__pyx_base.g;
    __pyx_v__AP = __pyx_t_4;

    /* "cypari/auto_instance.pxi":17861
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 */
  }

  /* "cypari/auto_instance.pxi":17863
 *         if _have_AP:
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfeigensearch(__pyx_v__NK, __pyx_v__AP);

  /* "cypari/auto_instance.pxi":17864
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfeisenstein(self, long k, CHI1=None, CHI2=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17823
 *         return new_gen(_ret)
 * 
 *     def mfeigensearch(self, NK, AP=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Search for a normalized rational eigen cuspform with quadratic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfeigensearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XDECREF(__pyx_v_AP);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17866
 *         return new_gen(_ret)
 * 
 *     def mfeisenstein(self, long k, CHI1=None, CHI2=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Create the Eisenstein series :math:`E_k(\chi_1,\chi_2)`, where :math:`k >= 1`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1025mfeisenstein(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1024mfeisenstein[] = "\n        Create the Eisenstein series :math:`E_k(\\chi_1,\\chi_2)`, where :math:`k >= 1`,\n        :math:`\\chi_i` are Dirichlet characters and an omitted character is considered as\n        trivial.\n        \n        ::\n        \n            ? CHI = Mod(3,4);\n            ? E = mfeisenstein(3, CHI);\n            ? mfcoefs(E, 6)\n            %2 = [-1/4, 1, 1, -8, 1, 26, -8]\n            ? CHI2 = Mod(4,5);\n            ? mfcoefs(mfeisenstein(3,CHI,CHI2), 6)\n            %3 = [0, 1, -1, -10, 1, 25, 10]\n            ? mfcoefs(mfeisenstein(4,CHI,CHI), 6)\n            %4 = [0, 1, 0, -28, 0, 126, 0]\n            ? mfcoefs(mfeisenstein(4), 6)\n            %5 = [1/240, 1, 9, 28, 73, 126, 252]\n        \n        Note that :literal:`meisenstein`:math:`(k)` is 0 for :math:`k` odd and\n        :math:`-B_{k}/(2k).E_k` for :math:`k` even, where\n        \n        .. MATH::\n        \n            E_k(q) = 1 - (2k/B_k)\\sum_{n >= 1} \\sigma_{k-1}(n) q^n\n        \n        is the standard Eisenstein series. In other words it is normalized so that its\n        linear coefficient is :math:`1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1025mfeisenstein(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  PyObject *__pyx_v_CHI1 = 0;
  PyObject *__pyx_v_CHI2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfeisenstein (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_CHI1,&__pyx_n_s_CHI2,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_k)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_CHI1);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_CHI2);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfeisenstein") < 0)) __PYX_ERR(4, 17866, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17866, __pyx_L3_error)
    __pyx_v_CHI1 = values[1];
    __pyx_v_CHI2 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfeisenstein", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17866, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfeisenstein", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1024mfeisenstein(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_k, __pyx_v_CHI1, __pyx_v_CHI2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1024mfeisenstein(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k, PyObject *__pyx_v_CHI1, PyObject *__pyx_v_CHI2) {
  int __pyx_v__have_CHI1;
  int __pyx_v__have_CHI2;
  GEN __pyx_v__CHI1;
  GEN __pyx_v__CHI2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfeisenstein", 0);
  __Pyx_INCREF(__pyx_v_CHI1);
  __Pyx_INCREF(__pyx_v_CHI2);

  /* "cypari/auto_instance.pxi":17896
 *         linear coefficient is :math:`1`.
 *         '''
 *         cdef bint _have_CHI1 = (CHI1 is not None)             # <<<<<<<<<<<<<<
 *         if _have_CHI1:
 *             CHI1 = objtogen(CHI1)
 */
  __pyx_t_1 = (__pyx_v_CHI1 != Py_None);
  __pyx_v__have_CHI1 = __pyx_t_1;

  /* "cypari/auto_instance.pxi":17897
 *         '''
 *         cdef bint _have_CHI1 = (CHI1 is not None)
 *         if _have_CHI1:             # <<<<<<<<<<<<<<
 *             CHI1 = objtogen(CHI1)
 *         cdef bint _have_CHI2 = (CHI2 is not None)
 */
  __pyx_t_1 = (__pyx_v__have_CHI1 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":17898
 *         cdef bint _have_CHI1 = (CHI1 is not None)
 *         if _have_CHI1:
 *             CHI1 = objtogen(CHI1)             # <<<<<<<<<<<<<<
 *         cdef bint _have_CHI2 = (CHI2 is not None)
 *         if _have_CHI2:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_CHI1, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 17898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_CHI1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":17897
 *         '''
 *         cdef bint _have_CHI1 = (CHI1 is not None)
 *         if _have_CHI1:             # <<<<<<<<<<<<<<
 *             CHI1 = objtogen(CHI1)
 *         cdef bint _have_CHI2 = (CHI2 is not None)
 */
  }

  /* "cypari/auto_instance.pxi":17899
 *         if _have_CHI1:
 *             CHI1 = objtogen(CHI1)
 *         cdef bint _have_CHI2 = (CHI2 is not None)             # <<<<<<<<<<<<<<
 *         if _have_CHI2:
 *             CHI2 = objtogen(CHI2)
 */
  __pyx_t_1 = (__pyx_v_CHI2 != Py_None);
  __pyx_v__have_CHI2 = __pyx_t_1;

  /* "cypari/auto_instance.pxi":17900
 *             CHI1 = objtogen(CHI1)
 *         cdef bint _have_CHI2 = (CHI2 is not None)
 *         if _have_CHI2:             # <<<<<<<<<<<<<<
 *             CHI2 = objtogen(CHI2)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_CHI2 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":17901
 *         cdef bint _have_CHI2 = (CHI2 is not None)
 *         if _have_CHI2:
 *             CHI2 = objtogen(CHI2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _CHI1 = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_CHI2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 17901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_CHI2, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":17900
 *             CHI1 = objtogen(CHI1)
 *         cdef bint _have_CHI2 = (CHI2 is not None)
 *         if _have_CHI2:             # <<<<<<<<<<<<<<
 *             CHI2 = objtogen(CHI2)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":17902
 *         if _have_CHI2:
 *             CHI2 = objtogen(CHI2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _CHI1 = NULL
 *         if _have_CHI1:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 17902, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17903
 *             CHI2 = objtogen(CHI2)
 *         sig_on()
 *         cdef GEN _CHI1 = NULL             # <<<<<<<<<<<<<<
 *         if _have_CHI1:
 *             _CHI1 = (<Gen>CHI1).g
 */
  __pyx_v__CHI1 = NULL;

  /* "cypari/auto_instance.pxi":17904
 *         sig_on()
 *         cdef GEN _CHI1 = NULL
 *         if _have_CHI1:             # <<<<<<<<<<<<<<
 *             _CHI1 = (<Gen>CHI1).g
 *         cdef GEN _CHI2 = NULL
 */
  __pyx_t_1 = (__pyx_v__have_CHI1 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":17905
 *         cdef GEN _CHI1 = NULL
 *         if _have_CHI1:
 *             _CHI1 = (<Gen>CHI1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _CHI2 = NULL
 *         if _have_CHI2:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_CHI1)->__pyx_base.g;
    __pyx_v__CHI1 = __pyx_t_4;

    /* "cypari/auto_instance.pxi":17904
 *         sig_on()
 *         cdef GEN _CHI1 = NULL
 *         if _have_CHI1:             # <<<<<<<<<<<<<<
 *             _CHI1 = (<Gen>CHI1).g
 *         cdef GEN _CHI2 = NULL
 */
  }

  /* "cypari/auto_instance.pxi":17906
 *         if _have_CHI1:
 *             _CHI1 = (<Gen>CHI1).g
 *         cdef GEN _CHI2 = NULL             # <<<<<<<<<<<<<<
 *         if _have_CHI2:
 *             _CHI2 = (<Gen>CHI2).g
 */
  __pyx_v__CHI2 = NULL;

  /* "cypari/auto_instance.pxi":17907
 *             _CHI1 = (<Gen>CHI1).g
 *         cdef GEN _CHI2 = NULL
 *         if _have_CHI2:             # <<<<<<<<<<<<<<
 *             _CHI2 = (<Gen>CHI2).g
 *         cdef GEN _ret = mfeisenstein(k, _CHI1, _CHI2)
 */
  __pyx_t_1 = (__pyx_v__have_CHI2 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":17908
 *         cdef GEN _CHI2 = NULL
 *         if _have_CHI2:
 *             _CHI2 = (<Gen>CHI2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfeisenstein(k, _CHI1, _CHI2)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_CHI2)->__pyx_base.g;
    __pyx_v__CHI2 = __pyx_t_4;

    /* "cypari/auto_instance.pxi":17907
 *             _CHI1 = (<Gen>CHI1).g
 *         cdef GEN _CHI2 = NULL
 *         if _have_CHI2:             # <<<<<<<<<<<<<<
 *             _CHI2 = (<Gen>CHI2).g
 *         cdef GEN _ret = mfeisenstein(k, _CHI1, _CHI2)
 */
  }

  /* "cypari/auto_instance.pxi":17909
 *         if _have_CHI2:
 *             _CHI2 = (<Gen>CHI2).g
 *         cdef GEN _ret = mfeisenstein(k, _CHI1, _CHI2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfeisenstein(__pyx_v_k, __pyx_v__CHI1, __pyx_v__CHI2);

  /* "cypari/auto_instance.pxi":17910
 *             _CHI2 = (<Gen>CHI2).g
 *         cdef GEN _ret = mfeisenstein(k, _CHI1, _CHI2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfembed(self, f, v=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 17910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17866
 *         return new_gen(_ret)
 * 
 *     def mfeisenstein(self, long k, CHI1=None, CHI2=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Create the Eisenstein series :math:`E_k(\chi_1,\chi_2)`, where :math:`k >= 1`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfeisenstein", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_CHI1);
  __Pyx_XDECREF(__pyx_v_CHI2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":17912
 *         return new_gen(_ret)
 * 
 *     def mfembed(self, f, v=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` be a generalized modular form with parameters :math:`[N,k,\chi,P]` (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1027mfembed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1026mfembed[] = "\n        Let :math:`f` be a generalized modular form with parameters :math:`[N,k,\\chi,P]` (see\n        :literal:`mfparams`, we denote :math:`\\mathbb{Q} (\\chi)` the subfield of :math:`\\mathbb{C}` generated by the\n        values of :math:`\\chi` and :math:`\\mathbb{Q} (f)` the field of definition of :math:`f`. In this context\n        :math:`\\mathbb{Q} (\\chi)` has a single canonical complex embeding given by\n        :math:`s: Mod(t, polcyclo(n,t)) :--->\\exp (2i\\pi/n)` and the number field\n        :math:`\\mathbb{Q} (f)` has :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]` induced embeddings attached to the complex\n        roots of the polynomial :math:`s(P)`. If :math:`\\mathbb{Q} (f)` is stricly larger than :math:`\\mathbb{Q} (\\chi)`\n        we only allow an :math:`f` which is an eigenform, produced by :literal:`mfeigenbasis`.\n        \n        This function is meant to create embeddings of :math:`\\mathbb{Q} (f)` and/or apply them\n        to the object :math:`v`, typically a vector of Fourier coefficients of :math:`f`\n        from :literal:`mfcoefs`.\n        \n        - If :math:`v` is omitted and :math:`f` is a modular form as above, we return the\n          embedding of :math:`\\mathbb{Q} (\\chi)` if :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q} (f)` and a vector containing\n          :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]` embeddings of :math:`\\mathbb{Q} (f)` otherwise.\n        \n        - If :math:`v` is given, it must be a scalar in :math:`\\mathbb{Q} (f)`, or a vector/matrix of\n          such, we apply the embeddings coefficientwise and return either\n          a single result if :math:`\\mathbb{Q} (f) = \\mathbb{Q} (\\chi)` and a vector of :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]`\n          results otherwise.\n        \n        - Finally :math:`f` can be replaced by a single embedding produced by\n          :literal:`mfembed`:math:`(f)` (:math:`v` was omitted) and we apply that particular embedding\n          to :math:`v`.\n        ""\n        ::\n        \n            ? mf = mfinit([35,2,Mod(11,35)], 0);\n            ? [f] = mfbasis(mf);\n            ? f.mod \\\\ Q (chi) = Q (zeta_3)\n            %3 = t^2 + t + 1\n            ? v = mfcoefs(f,5); lift(v) \\\\ coefficients in Q (chi)\n            %4 = [0, 2, -2*t - 2, 2*t, 2*t, -2*t - 2]\n            ? mfembed(f, v) \\\\ single embedding\n            %5 = [0, 2, -1 - 1.7320...*I, -1 + 1.73205...*I, -1 + 1.7320...*I, ...]\n            \n            ? [F] = mfeigenbasis(mf);\n            ? mffields(mf)\n            %7 = [y^2 + Mod(-2*t, t^2 + t + 1)] \\\\ [Q (f):Q (chi)] = 2\n            ? V = liftpol( mfcoefs(F,5) );\n            %8 = [0, 1, y + (-t - 1), (t + 1)*y + t, (-2*t - 2)*y + t, -t - 1]\n            ? vall = mfembed(F, V); #vall\n            %9 = 2 \\\\ 2 embeddings, both applied to V\n            ? vall[1] \\\\ the first\n            %10 = [0, 1, -1.2071... - 2.0907...*I, 0.2071... - 0.3587...*I, ...]\n            ? vall[2] \\\\ and the second one\n            %11 = [0, 1, 0.2071... + 0.3587...*I, -1.2071... + 2.0907...*I, ...]\n            \n            ? vE = mfembed(F); #vE \\\\ same 2 embeddings\n            %12 = 2\n            ? mfembed(vE[1], V) \\\\ apply first embedding to V\n            %13 = [0, 1, -1.2071... - 2.0907...*I, 0.2071... - 0.3587...*I, ...]\n        \n        For convenience, we also allow a modular form space from :literal:`mfinit`\n        instead of :math:`f`, corresponding to the single embedding of :math:`\\mathbb{Q} (\\chi)`.\n        \n        ::\n        \n            ? [mfB,MC,C] = mfatkininit(mf,7); MC \\\\ coefs in Q (chi)\n            %13 =\n            [ Mod(2/7*t, t^2 + t + 1) Mod(-1/7*t - 2/7, t^2 + t + 1)]\n            \n            [Mod(-1/7*t - 2/7, t^2 + t + 1) Mod(2/7*t, t^2 + t + 1)]\n            \n            ? C \\\\ normalizing constant\n            %14 = 0.33863... - 0.16787*I\n            ? M = mfembed(mf, MC) / C \\\\ the true matrix for the action of w_7\n            [-0.6294... + 0.418""6...*I -0.3625... - 0.5450...*I]\n            \n            [-0.3625... - 0.5450...*I -0.6294... + 0.4186...*I]\n            \n            ? exponent(M*conj(M) - 1) \\\\ M * conj(M) is close to 1\n            %16 = -126\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1027mfembed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfembed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_v,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfembed") < 0)) __PYX_ERR(4, 17912, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_v = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 17912, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfembed", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 17912, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1026mfembed(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_v, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1026mfembed(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_v, long __pyx_v_precision) {
  int __pyx_v__have_v;
  GEN __pyx_v__f;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfembed", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":17989
 *             %16 = -126
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":17990
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_2;

  /* "cypari/auto_instance.pxi":17991
 *         f = objtogen(f)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":17992
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17992, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":17991
 *         f = objtogen(f)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":17993
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 17993, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":17994
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":17995
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_instance.pxi":17996
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":17997
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfembed0(_f, _v, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":17996
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":17998
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfembed0(_f, _v, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":17999
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfembed0(_f, _v, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfembed0(__pyx_v__f, __pyx_v__v, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":18000
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfembed0(_f, _v, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfeval(self, mf, F, vtau, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":17912
 *         return new_gen(_ret)
 * 
 *     def mfembed(self, f, v=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` be a generalized modular form with parameters :math:`[N,k,\chi,P]` (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18002
 *         return new_gen(_ret)
 * 
 *     def mfeval(self, mf, F, vtau, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the numerical value of the modular form :math:`F`, belonging
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1029mfeval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1028mfeval[] = "\n        Computes the numerical value of the modular form :math:`F`, belonging\n        to :emphasis:`mf`, at the complex number :literal:`vtau` or the vector :literal:`vtau`\n        of complex numbers in the completed upper-half plane. The result is given\n        with absolute error less than :math:`2^{-B}`, where :math:`B = realbitprecision`.\n        \n        If the field of definition :math:`\\mathbb{Q} (F)` is larger than :math:`\\mathbb{Q} (\\chi)` then :math:`F` may be\n        embedded into :math:`\\mathbb{C}` in :math:`d = [\\mathbb{Q} (F):\\mathbb{Q} (\\chi)]` ways, in which case a vector of\n        the :math:`d` results is returned.\n        \n        ::\n        \n            ? mf = mfinit([11,2],0); F = mfbasis(mf)[1]; mfparams(F)\n            %1 = [11, 2, 1, y] \\\\ Q(F) = Q(chi) = Q\n            ? mfeval(mf,F,I/2)\n            %2 = 0.039405471130100890402470386372028382117\n            ? mf = mfinit([35,2],0); F = mfeigenbasis(mf)[2]; mfparams(F)\n            %3 = [35, 2, 1, y^2 - y - 4] \\\\ [Q(F) : Q(chi)] = 2\n            ? mfeval(mf,F,I/2)\n            %4 = [0.045..., 0.0385...] \\\\ sigma_1(F) and sigma_2(F) at I/2\n            ? mf = mfinit([12,4],1); F = mfbasis(mf)[1];\n            ? mfeval(mf, F, 0.318+10^(-7)*I)\n            %6 = 3.379... E-21 + 6.531... E-21*I \\\\ instantaneous !\n        \n        In order to maximize the imaginary part of the argument,\n        the function computes :math:`(f \\| _k \\gamma)(\\gamma^{-1}.\\tau)` for a\n        suitable :math:`\\gamma` not necessarily in :math:`\\Gamma_0(N)` (in which case :math:`f \\|\n        \\gamma` is evaluated using :literal:`mfslashexpansion`).\n        \n        ::\n        \n            ? T = mfTheta(); mf = mfinit(T); mfeval(mf,T,[0,1/2,1,oo])\n            %1 = [1/2 - 1/2*I, 0, 1/2 - 1/2*I, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1029mfeval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_vtau = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfeval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,&__pyx_n_s_vtau,&__pyx_n_s_precision,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_mf)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfeval", 0, 3, 4, 1); __PYX_ERR(4, 18002, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vtau)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfeval", 0, 3, 4, 2); __PYX_ERR(4, 18002, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfeval") < 0)) __PYX_ERR(4, 18002, __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_mf = values[0];
    __pyx_v_F = values[1];
    __pyx_v_vtau = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18002, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfeval", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18002, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1028mfeval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F, __pyx_v_vtau, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1028mfeval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_vtau, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__vtau;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mfeval", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_vtau);

  /* "cypari/auto_instance.pxi":18037
 *             %1 = [1/2 - 1/2*I, 0, 1/2 - 1/2*I, 1]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         vtau = objtogen(vtau)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18038
 *         '''
 *         mf = objtogen(mf)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         vtau = objtogen(vtau)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18039
 *         mf = objtogen(mf)
 *         F = objtogen(F)
 *         vtau = objtogen(vtau)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_vtau, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vtau, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18040
 *         F = objtogen(F)
 *         vtau = objtogen(vtau)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18040, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18041
 *         vtau = objtogen(vtau)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18042
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18043
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vtau)->__pyx_base.g;
  __pyx_v__vtau = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18044
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":18045
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":18044
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 */
  }

  /* "cypari/auto_instance.pxi":18046
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfeval(__pyx_v__mf, __pyx_v__F, __pyx_v__vtau, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":18047
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffields(self, mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18002
 *         return new_gen(_ret)
 * 
 *     def mfeval(self, mf, F, vtau, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the numerical value of the modular form :math:`F`, belonging
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_vtau);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18049
 *         return new_gen(_ret)
 * 
 *     def mffields(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`mf` as output by :literal:`mfinit` with parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1031mffields(PyObject *__pyx_v_self, PyObject *__pyx_v_mf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1030mffields[] = "\n        Given :literal:`mf` as output by :literal:`mfinit` with parameters\n        :math:`(N,k,\\chi)`, returns the vector of polynomials defining each Galois orbit of\n        newforms over :math:`\\mathbb{Q} (\\chi)`.\n        \n        ::\n        \n            ? mf = mfinit([35,2],0); mffields(mf)\n            %1 = [y, y^2 - y - 4]\n        \n        Here the character is trivial so :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q})` and there\n        are 3 newforms: one is rational (corresponding to :math:`y`), the other two are\n        conjugate and defined over the quadratic field :math:`\\mathbb{Q}[y]/(y^2-y-4)`.\n        \n        ::\n        \n            ? [G,chi] = znchar(Mod(3,35));\n            ? zncharconductor(G,chi)\n            %2 = 35\n            ? charorder(G,chi)\n            %3 = 12\n            ? mf = mfinit([35, 2, [G,chi]],0); mffields(mf)\n            %4 = [y, y]\n        \n        Here the character is primitive of order 12 and the two newforms are\n        defined over :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q} (\\zeta_{12})`.\n        \n        ::\n        \n            ? mf = mfinit([35, 2, Mod(13,35)],0); mffields(mf)\n            %3 = [y^2 + Mod(5*t, t^2 + 1)]\n        \n        This time the character has order 4 and there are two conjugate\n        newforms over :math:`\\mathbb{Q} (\\chi) = Q(i)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1031mffields(PyObject *__pyx_v_self, PyObject *__pyx_v_mf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffields (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1030mffields(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_mf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1030mffields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mffields", 0);
  __Pyx_INCREF(__pyx_v_mf);

  /* "cypari/auto_instance.pxi":18085
 *         newforms over :math:`\mathbb{Q} (\chi) = Q(i)`.
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18086
 *         '''
 *         mf = objtogen(mf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mffields(_mf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18086, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18087
 *         mf = objtogen(mf)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffields(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18088
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mffields(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffields(__pyx_v__mf);

  /* "cypari/auto_instance.pxi":18089
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mffields(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffromell(self, E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18049
 *         return new_gen(_ret)
 * 
 *     def mffields(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`mf` as output by :literal:`mfinit` with parameters
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18091
 *         return new_gen(_ret)
 * 
 *     def mffromell(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over :math:`Q` given by an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1033mffromell(PyObject *__pyx_v_self, PyObject *__pyx_v_E); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1032mffromell[] = "\n        :math:`E` being an elliptic curve defined over :math:`Q` given by an\n        integral model in :literal:`ellinit` format, computes a 3-component vector\n        :literal:`[mf,F,v]`, where :math:`F` is the newform corresponding to :math:`E` by\n        modularity, :literal:`mf` is the newspace to which :math:`F` belongs, and\n        :literal:`v` gives the coefficients of :math:`F` on :literal:`mfbasis(mf)`.\n        \n        ::\n        \n            ? E = ellinit(\"26a1\");\n            ? [mf,F,co] = mffromell(E);\n            ? co\n            %2 = [3/4, 1/4]~\n            ? mfcoefs(F, 5)\n            %3 = [0, 1, -1, 1, 1, -3]\n            ? ellan(E, 5)\n            %4 = [1, -1, 1, 1, -3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1033mffromell(PyObject *__pyx_v_self, PyObject *__pyx_v_E) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffromell (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1032mffromell(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_E));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1032mffromell(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mffromell", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":18110
 *             %4 = [1, -1, 1, 1, -3]
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18111
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = mffromell(_E)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18111, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18112
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffromell(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18113
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = mffromell(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffromell(__pyx_v__E);

  /* "cypari/auto_instance.pxi":18114
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = mffromell(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffrometaquo(self, eta, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18091
 *         return new_gen(_ret)
 * 
 *     def mffromell(self, E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over :math:`Q` given by an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffromell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18116
 *         return new_gen(_ret)
 * 
 *     def mffrometaquo(self, eta, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Modular form corresponding to the eta quotient matrix :literal:`eta`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1035mffrometaquo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1034mffrometaquo[] = "\n        Modular form corresponding to the eta quotient matrix :literal:`eta`.\n        If the valuation :math:`v` at infinity is fractional, return :math:`0`. If the eta\n        quotient is not holomorphic but simply meromorphic, return :math:`0` if\n        :literal:`flag = 0`, return the eta quotient (divided by :math:`q` to the power :math:`-v` if\n        :math:`v < 0`, i.e., with valuation :math:`0`) if flag is set.\n        \n        ::\n        \n            ? mffrometaquo(Mat([1,1]),1)\n            %1 = 0\n            ? mfcoefs(mffrometaquo(Mat([1,24])),6)\n            %2 = [0, 1, -24, 252, -1472, 4830, -6048]\n            ? mfcoefs(mffrometaquo([1,1;23,1]),10)\n            %3 = [0, 1, -1, -1, 0, 0, 1, 0, 1, 0, 0]\n            ? F = mffrometaquo([1,2;2,-1]); mfparams(F)\n            %4 = [16,1/2,1,y]\n            ? mfcoefs(F,10)\n            %5 = [1, -2, 0, 0, 2, 0, 0, 0, 0, -2, 0]\n            ? mffrometaquo(Mat([1,-24]))\n            %6 = 0\n            ? f = mffrometaquo(Mat([1,-24]),1); mfcoefs(f,6)\n            %7 = [1, 24, 324, 3200, 25650, 176256, 1073720]\n        \n        For convenience, a :literal:`t_VEC` is also accepted instead of\n        a factorization matrix with a single row:\n        \n        ::\n        \n            ? f = mffrometaquo([1,24]); \\\\ also valid\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1035mffrometaquo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_eta = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffrometaquo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_eta,&__pyx_n_s_flag,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_eta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mffrometaquo") < 0)) __PYX_ERR(4, 18116, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_eta = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18116, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mffrometaquo", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18116, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffrometaquo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1034mffrometaquo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_eta, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1034mffrometaquo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_eta, long __pyx_v_flag) {
  GEN __pyx_v__eta;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mffrometaquo", 0);
  __Pyx_INCREF(__pyx_v_eta);

  /* "cypari/auto_instance.pxi":18148
 *             ? f = mffrometaquo([1,24]); \\ also valid
 *         '''
 *         eta = objtogen(eta)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _eta = (<Gen>eta).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_eta, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_eta, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18149
 *         '''
 *         eta = objtogen(eta)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _eta = (<Gen>eta).g
 *         cdef GEN _ret = mffrometaquo(_eta, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18149, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18150
 *         eta = objtogen(eta)
 *         sig_on()
 *         cdef GEN _eta = (<Gen>eta).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffrometaquo(_eta, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_eta)->__pyx_base.g;
  __pyx_v__eta = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18151
 *         sig_on()
 *         cdef GEN _eta = (<Gen>eta).g
 *         cdef GEN _ret = mffrometaquo(_eta, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffrometaquo(__pyx_v__eta, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":18152
 *         cdef GEN _eta = (<Gen>eta).g
 *         cdef GEN _ret = mffrometaquo(_eta, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffromlfun(self, L, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18116
 *         return new_gen(_ret)
 * 
 *     def mffrometaquo(self, eta, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Modular form corresponding to the eta quotient matrix :literal:`eta`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffrometaquo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_eta);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18154
 *         return new_gen(_ret)
 * 
 *     def mffromlfun(self, L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`L` being an :math:`L`-function in any of the :literal:`lfun` formats representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1037mffromlfun(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1036mffromlfun[] = "\n        Let :math:`L` being an :math:`L`-function in any of the :literal:`lfun` formats representing\n        a self-dual modular form (for instance an eigenform). Return\n        :literal:`[NK,space,v]` when :literal:`mf = mfinit(NK,space)` is the modular\n        form space containing the form and :literal:`mftobasis(mf, v)` will represent it\n        on the space basis. If :math:`L` has rational coefficients, this will be enough\n        to recognize the modular form in :emphasis:`mf`:\n        \n        ::\n        \n            ? L = lfuncreate(x^2+1);\n            ? lfunan(L,10)\n            %2 = [1, 1, 0, 1, 2, 0, 0, 1, 1, 2]\n            ? [NK,space,v] = mffromlfun(L); NK\n            %4 = [4, 1, -4]\n            ? mf=mfinit(NK,space); w = mftobasis(mf,v)\n            %5 = [1.0000000000000000000000000000000000000]~\n            ? [f] = mfbasis(mf); mfcoefs(f,10) \\\\ includes a_0 !\n            %6 = [1/4, 1, 1, 0, 1, 2, 0, 0, 1, 1, 2]\n        \n        If :math:`L` has inexact complex coefficients, one can for instance\n        compute an eigenbasis for :emphasis:`mf` and check whether one of the attached\n        :math:`L`-function is reasonably close to :math:`L`. In the example, we cheat by\n        producing the :math:`L` function from an eigenform in a known space, but the\n        function does not use this information:\n        \n        ::\n        \n            ? mf = mfinit([32,6,Mod(5,32)],0);\n            ? [poldegree(K) | K<-mffields(mf)]\n            %2 = [19] \\\\ one orbit, [Q(F) : Q(chi)] = 19\n            ? L = lfunmf(mf)[1][1]; \\\\ one of the 19 L-functions attached to F\n            ? lfunan(L,3)\n            %4 = [1, 5.654... - 0.1812...*I, -7.876... - 19.02...*I]\n            ? [NK,space,v] = mffromlfun(L); NK\n            %5 = [32, 6, Mod(5, 32)]\n            ? vL = concat(lfunmf(mf)); \\\\ L functions for all cuspidal eigenforms\n            ? an = lfunan(L,10);\n            ? for (i = 1, #vL, if (normlp(lfunan(vL[i],10) - an, oo)"" < 1e-10, print(i)));\n            1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1037mffromlfun(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffromlfun (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_precision,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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mffromlfun") < 0)) __PYX_ERR(4, 18154, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18154, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mffromlfun", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18154, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffromlfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1036mffromlfun(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1036mffromlfun(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_L, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mffromlfun", 0);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":18196
 *             1
 *         '''
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18197
 *         '''
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18197, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18198
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mffromlfun(_L, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18199
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffromlfun(_L, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":18200
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mffromlfun(_L, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffromlfun(__pyx_v__L, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":18201
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mffromlfun(_L, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffromqf(self, Q, P=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18154
 *         return new_gen(_ret)
 * 
 *     def mffromlfun(self, L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`L` being an :math:`L`-function in any of the :literal:`lfun` formats representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffromlfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18203
 *         return new_gen(_ret)
 * 
 *     def mffromqf(self, Q, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being an even integral positive definite quadratic form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1039mffromqf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1038mffromqf[] = "\n        :math:`Q` being an even integral positive definite quadratic form\n        and :math:`P` a homogeneous spherical polynomial for :math:`Q`, computes\n        a 3-component vector :math:`[mf,F,v]`, where :math:`F` is the theta function\n        corresponding to :math:`(Q,P)`, :emphasis:`mf` is the corresponding space of modular\n        forms (from :literal:`mfinit`), and :math:`v` gives the coefficients of :math:`F` on\n        :literal:`mfbasis(mf)`.\n        \n        ::\n        \n            ? [mf,F,v] = mffromqf(2*matid(10)); v\n            %1 = [64/5, 4/5, 32/5]~\n            ? mfcoefs(F, 5)\n            %2 = [1, 20, 180, 960, 3380, 8424]\n            ? mfcoef(F, 10000) \\\\ number of ways of writing 10000 as sum of 10 squares\n            %3 = 128205250571893636\n            ? mfcoefs(F, 10000); \\\\ fast !\n            time = 220ms\n            ? [mf,F,v] = mffromqf([2,0;0,2],x^4-6*x^2*y^2+y^4);\n            ? mfcoefs(F,10)\n            %6 = [0, 4, -16, 0, 64, -56, 0, 0, -256, 324, 224]\n            ? mfcoef(F,100000) \\\\ instantaneous\n            %7 = 41304367104\n        \n        Odd dimensions are supported, corresponding to forms of half-integral weight:\n        \n        ::\n        \n            ? [mf,F,v] = mffromqf(2*matid(3));\n            ? mfisequal(F, mfpow(mfTheta(),3))\n            %2 = 1\n            ? mfcoefs(F, 32) \\\\ illustrate Legendre's 3-square theorem\n            %3 = [ 1,\n             6, 12, 8, 6, 24, 24, 0, 12,\n             30, 24, 24, 8, 24, 48, 0, 6,\n             48, 36, 24,24, 48, 24, 0, 24,\n             30, 72, 32, 0, 72, 48, 0, 12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1039mffromqf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffromqf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_P,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_Q)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mffromqf") < 0)) __PYX_ERR(4, 18203, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Q = values[0];
    __pyx_v_P = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mffromqf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18203, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffromqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1038mffromqf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Q, __pyx_v_P);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1038mffromqf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, PyObject *__pyx_v_P) {
  int __pyx_v__have_P;
  GEN __pyx_v__Q;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mffromqf", 0);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":18242
 *              30, 72, 32, 0, 72, 48, 0, 12]
 *         '''
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18243
 *         '''
 *         Q = objtogen(Q)
 *         cdef bint _have_P = (P is not None)             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             P = objtogen(P)
 */
  __pyx_t_2 = (__pyx_v_P != Py_None);
  __pyx_v__have_P = __pyx_t_2;

  /* "cypari/auto_instance.pxi":18244
 *         Q = objtogen(Q)
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_P != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":18245
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:
 *             P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":18244
 *         Q = objtogen(Q)
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":18246
 *         if _have_P:
 *             P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 18246, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18247
 *             P = objtogen(P)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = NULL
 *         if _have_P:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_4;

  /* "cypari/auto_instance.pxi":18248
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             _P = (<Gen>P).g
 */
  __pyx_v__P = NULL;

  /* "cypari/auto_instance.pxi":18249
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)
 */
  __pyx_t_2 = (__pyx_v__have_P != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":18250
 *         cdef GEN _P = NULL
 *         if _have_P:
 *             _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffromqf(_Q, _P)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
    __pyx_v__P = __pyx_t_4;

    /* "cypari/auto_instance.pxi":18249
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)
 */
  }

  /* "cypari/auto_instance.pxi":18251
 *         if _have_P:
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffromqf(__pyx_v__Q, __pyx_v__P);

  /* "cypari/auto_instance.pxi":18252
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfgaloistype(self, NK, F=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18203
 *         return new_gen(_ret)
 * 
 *     def mffromqf(self, Q, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being an even integral positive definite quadratic form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mffromqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18254
 *         return new_gen(_ret)
 * 
 *     def mfgaloistype(self, NK, F=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being either :literal:`[N,1,CHI]` or an :literal:`mf` output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1041mfgaloistype(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1040mfgaloistype[] = "\n        :literal:`NK` being either :literal:`[N,1,CHI]` or an :literal:`mf` output by\n        :literal:`mfinit` in weight :math:`1`, gives the vector of types of Galois\n        representations attached to each cuspidal eigenform,\n        unless the modular form :literal:`F` is specified, in which case only for :literal:`F`\n        (note that it is not tested whether :literal:`F` belongs to the correct modular\n        form space, nor whether it is a cuspidal eigenform). Types :math:`A_4`, :math:`S_4`,\n        :math:`A_5` are represented by minus their cardinality :math:`-12`, :math:`-24`, or :math:`-60`,\n        and type :math:`D_n` is represented by its cardinality, the integer :math:`2n`:\n        \n        ::\n        \n            ? mfgaloistype([124,1, Mod(67,124)]) \\\\ A4\n            %1 = [-12]\n            ? mfgaloistype([148,1, Mod(105,148)]) \\\\ S4\n            %2 = [-24]\n            ? mfgaloistype([633,1, Mod(71,633)]) \\\\ D10, A5\n            %3 = [10, -60]\n            ? mfgaloistype([239,1, -239]) \\\\ D6, D10, D30\n            %4 = [6, 10, 30]\n            ? mfgaloistype([71,1, -71])\n            %5 = [14]\n            ? mf = mfinit([239,1, -239],0); F = mfeigenbasis(mf)[2];\n            ? mfgaloistype(mf, F)\n            %7 = 10\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1041mfgaloistype(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfgaloistype (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_F,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_NK)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfgaloistype") < 0)) __PYX_ERR(4, 18254, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_NK = values[0];
    __pyx_v_F = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfgaloistype", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18254, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfgaloistype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1040mfgaloistype(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_F);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1040mfgaloistype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_F) {
  int __pyx_v__have_F;
  GEN __pyx_v__NK;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfgaloistype", 0);
  __Pyx_INCREF(__pyx_v_NK);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":18281
 *             %7 = 10
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18282
 *         '''
 *         NK = objtogen(NK)
 *         cdef bint _have_F = (F is not None)             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             F = objtogen(F)
 */
  __pyx_t_2 = (__pyx_v_F != Py_None);
  __pyx_v__have_F = __pyx_t_2;

  /* "cypari/auto_instance.pxi":18283
 *         NK = objtogen(NK)
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_F != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":18284
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 *             F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18284, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":18283
 *         NK = objtogen(NK)
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":18285
 *         if _have_F:
 *             F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 18285, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18286
 *             F = objtogen(F)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = NULL
 *         if _have_F:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_4;

  /* "cypari/auto_instance.pxi":18287
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             _F = (<Gen>F).g
 */
  __pyx_v__F = NULL;

  /* "cypari/auto_instance.pxi":18288
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 */
  __pyx_t_2 = (__pyx_v__have_F != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":18289
 *         cdef GEN _F = NULL
 *         if _have_F:
 *             _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
    __pyx_v__F = __pyx_t_4;

    /* "cypari/auto_instance.pxi":18288
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 */
  }

  /* "cypari/auto_instance.pxi":18290
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfgaloistype(__pyx_v__NK, __pyx_v__F);

  /* "cypari/auto_instance.pxi":18291
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfhecke(self, mf, F, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18254
 *         return new_gen(_ret)
 * 
 *     def mfgaloistype(self, NK, F=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being either :literal:`[N,1,CHI]` or an :literal:`mf` output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfgaloistype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18293
 *         return new_gen(_ret)
 * 
 *     def mfhecke(self, mf, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form in modular form space :emphasis:`mf`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1043mfhecke(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1042mfhecke[] = "\n        :math:`F` being a modular form in modular form space :emphasis:`mf`, returns\n        :math:`T(n)F`, where :math:`T(n)` is the :math:`n`-th Hecke operator.\n        \n        :strong:`Warning.` If :math:`F` is of level :math:`M < N`, then :math:`T(n)F`\n        is in general not the same in :math:`M_k(\\Gamma_0(M),\\chi)` and in\n        :math:`M_k(\\Gamma_0(N),\\chi)`. We take :math:`T(n)` at the same level as the one used in\n        :literal:`mf`.\n        \n        ::\n        \n            ? mf = mfinit([26,2],0); F = mfbasis(mf)[1]; mftobasis(mf,F)\n            %1 = [1, 0]~\n            ? G2 = mfhecke(mf,F,2); mftobasis(mf,G2)\n            %2 = [0, 1]~\n            ? G5 = mfhecke(mf,F,5); mftobasis(mf,G5)\n            %3 = [-2, 1]~\n        \n        Modular forms of half-integral weight are supported, in\n        which case :math:`n` must be a perfect square, else :math:`T_n` will act as :math:`0` (the\n        operator :math:`T_p` for :math:`p \\| N` is not supported yet):\n        \n        ::\n        \n            ? F = mfpow(mfTheta(),3); mf = mfinit(F);\n            ? mfisequal(mfhecke(mf,F,9), mflinear([F],[4]))\n            %2 = 1\n        \n        (:math:`F` is an eigenvector of all :math:`T_{p^2}`, with eigenvalue :math:`p+1` for\n        odd :math:`p`.)\n        \n        :strong:`Warning.` When :math:`n` is a large composite, resp.\302\240the square of a large\n        composite in half-integral weight, it is in general more efficient to use\n        :literal:`mfheckemat` on the :literal:`mftobasis` coefficients:\n        \n        ::\n        \n            ? mfcoefs(mfhecke(mf,F,3^10), 10)\n            time = 917 ms.\n            %3 = [324, 1944, 3888, 2592, 1944, 7776, 7776, 0, 3888, 9720, 7776]\n            ? M = mfheckemat(mf,3^10) \\\\ instantaneous\n            %4 =\n            [324]\n            ? G = mflinear(mf, M*mftobasis(mf,F));\n            ? mfcoefs(G, 10) \\\\ instantaneous\n            %6 = [324, 1944, 3888, 2592, 1944,"" 7776, 7776, 0, 3888, 9720, 7776]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1043mfhecke(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfhecke (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mf)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfhecke", 1, 3, 3, 1); __PYX_ERR(4, 18293, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfhecke", 1, 3, 3, 2); __PYX_ERR(4, 18293, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfhecke") < 0)) __PYX_ERR(4, 18293, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_mf = values[0];
    __pyx_v_F = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18293, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfhecke", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18293, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1042mfhecke(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1042mfhecke(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_n) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfhecke", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":18341
 *             %6 = [324, 1944, 3888, 2592, 1944, 7776, 7776, 0, 3888, 9720, 7776]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18342
 *         '''
 *         mf = objtogen(mf)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18343
 *         mf = objtogen(mf)
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18343, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18344
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfhecke(_mf, _F, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18345
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfhecke(_mf, _F, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18346
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfhecke(_mf, _F, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfhecke(__pyx_v__mf, __pyx_v__F, __pyx_v_n);

  /* "cypari/auto_instance.pxi":18347
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfhecke(_mf, _F, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfheckemat(self, mf, vecn):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18293
 *         return new_gen(_ret)
 * 
 *     def mfhecke(self, mf, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form in modular form space :emphasis:`mf`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18349
 *         return new_gen(_ret)
 * 
 *     def mfheckemat(self, mf, vecn):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :literal:`vecn` is an integer, matrix of the Hecke operator :math:`T(n)` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1045mfheckemat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1044mfheckemat[] = "\n        If :literal:`vecn` is an integer, matrix of the Hecke operator :math:`T(n)` on the\n        basis formed by :literal:`mfbasis(mf)`. If it is a vector, vector of\n        such matrices, usually faster than calling each one individually.\n        \n        ::\n        \n            ? mf=mfinit([32,4],0); mfheckemat(mf,3)\n            %1 =\n            [0 44 0]\n            \n            [1 0 -10]\n            \n            [0 -2 0]\n            ? mfheckemat(mf,[5,7])\n            %2 = [[0, 0, 220; 0, -10, 0; 1, 0, 12], [0, 88, 0; 2, 0, -20; 0, -4, 0]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1045mfheckemat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_vecn = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfheckemat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_vecn,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_mf)) != 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_vecn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfheckemat", 1, 2, 2, 1); __PYX_ERR(4, 18349, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfheckemat") < 0)) __PYX_ERR(4, 18349, __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_mf = values[0];
    __pyx_v_vecn = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfheckemat", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18349, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfheckemat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1044mfheckemat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_vecn);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1044mfheckemat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_vecn) {
  GEN __pyx_v__mf;
  GEN __pyx_v__vecn;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfheckemat", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_vecn);

  /* "cypari/auto_instance.pxi":18367
 *             %2 = [[0, 0, 220; 0, -10, 0; 1, 0, 12], [0, 88, 0; 2, 0, -20; 0, -4, 0]]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         vecn = objtogen(vecn)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18368
 *         '''
 *         mf = objtogen(mf)
 *         vecn = objtogen(vecn)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_vecn, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vecn, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18369
 *         mf = objtogen(mf)
 *         vecn = objtogen(vecn)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _vecn = (<Gen>vecn).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18369, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18370
 *         vecn = objtogen(vecn)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _vecn = (<Gen>vecn).g
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18371
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _vecn = (<Gen>vecn).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vecn)->__pyx_base.g;
  __pyx_v__vecn = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18372
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _vecn = (<Gen>vecn).g
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfheckemat(__pyx_v__mf, __pyx_v__vecn);

  /* "cypari/auto_instance.pxi":18373
 *         cdef GEN _vecn = (<Gen>vecn).g
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfinit(self, NK, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18373, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18349
 *         return new_gen(_ret)
 * 
 *     def mfheckemat(self, mf, vecn):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :literal:`vecn` is an integer, matrix of the Hecke operator :math:`T(n)` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfheckemat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_vecn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18375
 *         return new_gen(_ret)
 * 
 *     def mfinit(self, NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Create the space of modular forms corresponding to the data contained in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1047mfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1046mfinit[] = "\n        Create the space of modular forms corresponding to the data contained in\n        :literal:`NK` and :literal:`space`. :literal:`NK` is a vector which can be\n        either :math:`[N,k]` (:math:`N` level, :math:`k` weight) corresponding to a subspace of\n        :math:`M_k(\\Gamma_0(N))`, or :math:`[N,k,CHI]` (:emphasis:`CHI` a character)\n        corresponding to a subspace of :math:`M_k(\\Gamma_0(N),\\chi)`. Alternatively,\n        it can be a modular form :math:`F` or modular form space, in which case we use\n        :literal:`mfparams` to define the space parameters.\n        \n        The subspace is described by the small integer :literal:`space`: :math:`0` for the\n        newspace :math:`S_k^{new}(\\Gamma_0(N),\\chi)`, :math:`1` for the cuspidal\n        space :math:`S_k`, :math:`2` for the oldspace :math:`S_k^{old}`, :math:`3` for the space of\n        Eisenstein series :math:`E_k` and :math:`4` for the full space :math:`M_k`.\n        \n        :strong:`Wildcards.` For given level and weight, it is advantageous to\n        compute simultaneously spaces attached to different Galois orbits\n        of characters, especially in weight :math:`1`. The parameter :emphasis:`CHI` may be set\n        to 0 (wildcard), in which case we return a vector of all :literal:`mfinit` (s) of\n        non trivial spaces in :math:`S_k(\\Gamma_1(N))`, one for each Galois orbit\n        (see :literal:`znchargalois`). One may also set :emphasis:`CHI` to a vector of\n        characters and we return a vector of all mfinits of subspaces of\n        :math:`M_k(G_0(N),\\chi)` for :math:`\\chi` in the list, in the same order. In weight :math:`1`,\n        only :math:`S_1^{new}`, :math:`S_1` and :math:`E_1` support wildcards.\n        \n        The output is a technical structure :math:`S`, or a vector of structures if\n        :emphasis:`CHI` was a wildcard, which contains the following information:\n        :math:`[N,k,\\chi]` is given by :literal:`mfparams`:math:`(S)`, the ""space\n        dimension is :literal:`mfdim`:math:`(S)` and a :math:`\\mathbb{C}`-basis for the space is\n        :literal:`mfbasis`:math:`(S)`. The structure is entirely algebraic and does not depend\n        on the current :literal:`realbitprecision`.\n        \n        ::\n        \n            ? S = mfinit([36,2], 0); \\\\ new space\n            ? mfdim(S)\n            %2 = 1\n            ? mfparams\n            %3 = [36, 2, 1, y] \\\\ trivial character\n            ? f = mfbasis(S)[1]; mfcoefs(f,10)\n            %4 = [0, 1, 0, 0, 0, 0, 0, -4, 0, 0, 0]\n            \n            ? vS = mfinit([36,2,0],0); \\\\ with wildcard\n            ? #vS\n            %6 = 4 \\\\ 4 non trivial spaces (mod Galois action)\n            ? apply(mfdim,vS)\n            %7 = [1, 2, 1, 4]\n            ? mfdim([36,2,0], 0)\n            %8 = [[1, Mod(1, 36), 1, 0], [2, Mod(35, 36), 2, 0], [3, Mod(13, 36), 1, 0],\n             [6, Mod(11, 36), 4, 0]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1047mfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_space,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_NK)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfinit") < 0)) __PYX_ERR(4, 18375, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_NK = values[0];
    if (values[1]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18375, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18375, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1046mfinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_space);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1046mfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfinit", 0);
  __Pyx_INCREF(__pyx_v_NK);

  /* "cypari/auto_instance.pxi":18426
 *              [6, Mod(11, 36), 4, 0]]
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18427
 *         '''
 *         NK = objtogen(NK)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfinit(_NK, space)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18427, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18428
 *         NK = objtogen(NK)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfinit(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18429
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfinit(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfinit(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_instance.pxi":18430
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfinit(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfisCM(self, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18375
 *         return new_gen(_ret)
 * 
 *     def mfinit(self, NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Create the space of modular forms corresponding to the data contained in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18432
 *         return new_gen(_ret)
 * 
 *     def mfisCM(self, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tests whether the eigenform :math:`F` is a CM form. The answer
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1049mfisCM(PyObject *__pyx_v_self, PyObject *__pyx_v_F); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1048mfisCM[] = "\n        Tests whether the eigenform :math:`F` is a CM form. The answer\n        is :math:`0` if it is not, and if it is, either the unique negative discriminant\n        of the CM field, or the pair of two negative discriminants of CM fields,\n        this latter case occuring only in weight :math:`1` when the projective image is\n        :math:`D_2 = C_2 x C_2`, i.e., coded :math:`4` by :literal:`mfgaloistype`.\n        \n        ::\n        \n            ? F = mffromell(ellinit([0,1]))[2]; mfisCM(F)\n            %1 = -3\n            ? mf = mfinit([39,1,-39],0); F=mfeigenbasis(mf)[1]; mfisCM(F)\n            %2 = Vecsmall([-3, -39])\n            ? mfgaloistype(mf)\n            %3 = [4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1049mfisCM(PyObject *__pyx_v_self, PyObject *__pyx_v_F) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfisCM (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1048mfisCM(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_F));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1048mfisCM(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfisCM", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":18449
 *             %3 = [4]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18450
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfisCM(_F)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18450, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18451
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfisCM(_F)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18452
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfisCM(_F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfisCM(__pyx_v__F);

  /* "cypari/auto_instance.pxi":18453
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfisCM(_F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfisequal(self, F, G, long lim=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18432
 *         return new_gen(_ret)
 * 
 *     def mfisCM(self, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tests whether the eigenform :math:`F` is a CM form. The answer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfisCM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18455
 *         return new_gen(_ret)
 * 
 *     def mfisequal(self, F, G, long lim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Checks whether the modular forms :math:`F` and :math:`G` are equal. If :literal:`lim`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1051mfisequal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1050mfisequal[] = "\n        Checks whether the modular forms :math:`F` and :math:`G` are equal. If :literal:`lim`\n        is nonzero, only check equality of the first :math:`lim+1` Fourier coefficients\n        and the function then also applies to generalized modular forms.\n        \n        ::\n        \n            ? D = mfDelta(); F = mfderiv(D);\n            ? G = mfmul(mfEk(2), D);\n            ? mfisequal(F, G)\n            %2 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1051mfisequal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_G = 0;
  long __pyx_v_lim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfisequal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_G,&__pyx_n_s_lim,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F)) != 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_G)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfisequal", 0, 2, 3, 1); __PYX_ERR(4, 18455, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfisequal") < 0)) __PYX_ERR(4, 18455, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_F = values[0];
    __pyx_v_G = values[1];
    if (values[2]) {
      __pyx_v_lim = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_lim == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18455, __pyx_L3_error)
    } else {
      __pyx_v_lim = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfisequal", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18455, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfisequal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1050mfisequal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_G, __pyx_v_lim);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1050mfisequal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_lim) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfisequal", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":18468
 *             %2 = 1
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         G = objtogen(G)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18469
 *         '''
 *         F = objtogen(F)
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18470
 *         F = objtogen(F)
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18470, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18471
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef long _ret = mfisequal(_F, _G, lim)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18472
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfisequal(_F, _G, lim)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18473
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef long _ret = mfisequal(_F, _G, lim)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfisequal(__pyx_v__F, __pyx_v__G, __pyx_v_lim);

  /* "cypari/auto_instance.pxi":18474
 *         cdef GEN _G = (<Gen>G).g
 *         cdef long _ret = mfisequal(_F, _G, lim)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":18475
 *         cdef long _ret = mfisequal(_F, _G, lim)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfkohnenbasis(self, mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18455
 *         return new_gen(_ret)
 * 
 *     def mfisequal(self, F, G, long lim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Checks whether the modular forms :math:`F` and :math:`G` are equal. If :literal:`lim`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfisequal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18477
 *         return _ret
 * 
 *     def mfkohnenbasis(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1053mfkohnenbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_mf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1052mfkohnenbasis[] = "\n        :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2`\n        with level :math:`N` and character :math:`\\chi`, gives a\n        basis :math:`B` of the Kohnen :math:`+`-space of :literal:`mf` as a matrix whose columns are\n        the coefficients of :math:`B` on the basis of :literal:`mf`. The conductor of either\n        :math:`\\chi` or :math:`\\chi.(-4/.)` must divide :math:`N/4`.\n        \n        ::\n        \n            ? mf = mfinit([36,5/2],1); K = mfkohnenbasis(mf); K~\n            %1 =\n            [-1 0 0 2 0 0]\n            \n            [ 0 0 0 0 1 0]\n            ? (mfcoefs(mf,20) * K)~\n            %4 =\n            [0 -1 0 0 2 0 0 0 0 0 0 0 0 -6 0 0 8 0 0 0 0]\n            \n            [0 0 0 0 0 1 0 0 -2 0 0 0 0 0 0 0 0 1 0 0 2]\n            \n            ? mf = mfinit([40,3/2,8],1); mfkohnenbasis(mf)\n             *** at top-level: mfkohnenbasis(mf)\n             *** ^-----------------\n             *** mfkohnenbasis: incorrect type in mfkohnenbasis [incorrect CHI] (t_VEC).\n        \n        In the final example both :math:`\\chi = (8/.)` and :math:`\\chi.(-4/.)`\n        have conductor :math:`8`, which does not divide N/4 = 10.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1053mfkohnenbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_mf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfkohnenbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1052mfkohnenbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_mf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1052mfkohnenbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfkohnenbasis", 0);
  __Pyx_INCREF(__pyx_v_mf);

  /* "cypari/auto_instance.pxi":18506
 *         have conductor :math:`8`, which does not divide N/4 = 10.
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18507
 *         '''
 *         mf = objtogen(mf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbasis(_mf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18507, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18508
 *         mf = objtogen(mf)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfkohnenbasis(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18509
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbasis(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfkohnenbasis(__pyx_v__mf);

  /* "cypari/auto_instance.pxi":18510
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbasis(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfkohnenbijection(self, mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18477
 *         return _ret
 * 
 *     def mfkohnenbasis(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfkohnenbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18512
 *         return new_gen(_ret)
 * 
 *     def mfkohnenbijection(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1055mfkohnenbijection(PyObject *__pyx_v_self, PyObject *__pyx_v_mf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1054mfkohnenbijection[] = "\n        :literal:`mf` being a cuspidal space of half-integral weight, returns\n        :literal:`[mf2,M,K,shi]`, where :math:`M` is a matrix giving a Hecke-module\n        isomorphism from the cuspidal space :literal:`mf2` giving\n        :math:`S_{2k-1}(\\Gamma_0(N),\\chi^2)` to the\n        Kohnen :math:`+`-space :math:`S_k^+(\\Gamma_0(4N),\\chi)`, :literal:`K` represents a basis :math:`B`\n        of the Kohnen :math:`+`-space as a matrix whose columns are the coefficients of :math:`B`\n        on the basis of :literal:`mf`, and :literal:`shi` gives the linear combination of\n        Shimura lifts giving :math:`M^{-1}`.\n        \n        ::\n        \n            ? mf=mfinit([60,5/2],1); [mf2,M,K,shi]=mfkohnenbijection(mf); M\n            %1 =\n            [ -5/14 -1/14 1/2 3/2]\n            \n            [ 37/84 -1/84 1/2 1/2]\n            \n            [-17/84 5/84 -3/2 -9/2]\n            \n            [ 0 0 -1/2 -1/2]\n            \n            ? shi\n            %2 = Vecsmall([1, 5])\n        \n        This last command shows that the map giving the bijection is the sum of the\n        Shimura lift with :math:`D = 1` and the one with :math:`D = 5`.\n        \n        Since it gives a bijection of Hecke modules, this matrix can be used to\n        transport modular form data from the easily computed space of level :math:`N`\n        and weight :math:`2k-1` to the more difficult space of level :math:`4N` and weight\n        :math:`k`: matrices of Hecke operators, new space, splitting into eigenspaces and\n        eigenforms. Examples:\n        \n        ::\n        \n            ? K^(-1)*mfheckemat(mf,121)*K /* matrix of T_11^2 on K. Slowish. */\n            time = 1,280 ms.\n            %1 =\n            [ 48 24 24 24]\n            \n            [ 0 32 0 -20]\n            \n            [-48 -72 -40 -72]\n            \n            [ 0 0 0 52]\n            ? M*mfheckemat(mf2,11)*M^(-1) /* instantaneous via T_11 on S_{2k-1} */\n            time = 0 ms.\n      ""      %2 =\n            [ 48 24 24 24]\n            \n            [ 0 32 0 -20]\n            \n            [-48 -72 -40 -72]\n            \n            [ 0 0 0 52]\n            ? mf20=mfinit(mf2,0); [mftobasis(mf2,b) | b<-mfbasis(mf20)]\n            %3 = [[0, 0, 1, 0]~, [0, 0, 0, 1]~]\n            ? F1=M*[0,0,1,0]~\n            %4 = [1/2, 1/2, -3/2, -1/2]~\n            ? F2=M*[0,0,0,1]~\n            %5 = [3/2, 1/2, -9/2, -1/2]\n            ? K*F1\n            %6 = [1, 0, 0, 1, 1, 0, 0, 1, -3, 0, 0, -3, 0, 0]~\n            ? K*F2\n            %7 = [3, 0, 0, 3, 1, 0, 0, 1, -9, 0, 0, -3, 0, 0]~\n        \n        This gives a basis of the new space of :math:`S_{5/2}^+(\\Gamma_0(60))` expressed\n        on the initial basis of :math:`S_{5/2}(\\Gamma_0(60))`. If we want the eigenforms, we\n        write instead:\n        \n        ::\n        \n            ? BE=mfeigenbasis(mf20);[E1,E2]=apply(x->K*M*mftobasis(mf2,x),BE)\n            %1 = [[1, 0, 0, 1, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0]~,\\\n             [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, -3, 0, 0]~\n            ? EI1 = mflinear(mf, E1); EI2=mflinear(mf, E2);\n        \n        These are the two eigenfunctions in the space :literal:`mf`, the first (resp.,\n        second) will have Shimura image a multiple of :math:`BE[1]` (resp., :math:`BE[2]`).\n        The function :literal:`mfkohneneigenbasis` does this directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1055mfkohnenbijection(PyObject *__pyx_v_self, PyObject *__pyx_v_mf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfkohnenbijection (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1054mfkohnenbijection(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_mf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1054mfkohnenbijection(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfkohnenbijection", 0);
  __Pyx_INCREF(__pyx_v_mf);

  /* "cypari/auto_instance.pxi":18595
 *         The function :literal:`mfkohneneigenbasis` does this directly.
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18596
 *         '''
 *         mf = objtogen(mf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbijection(_mf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18596, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18597
 *         mf = objtogen(mf)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfkohnenbijection(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18598
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbijection(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfkohnenbijection(__pyx_v__mf);

  /* "cypari/auto_instance.pxi":18599
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbijection(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfkohneneigenbasis(self, mf, bij):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18512
 *         return new_gen(_ret)
 * 
 *     def mfkohnenbijection(self, mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfkohnenbijection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18601
 *         return new_gen(_ret)
 * 
 *     def mfkohneneigenbasis(self, mf, bij):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1057mfkohneneigenbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1056mfkohneneigenbasis[] = "\n        :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2` and\n        :literal:`bij` being the output of :literal:`mfkohnenbijection(mf)`, outputs a\n        :math:`3`-component vector :literal:`[mf0,BNEW,BEIGEN]`, where :literal:`BNEW` and\n        :literal:`BEIGEN` are two matrices whose columns are the coefficients\n        of a basis of the Kohnen new space and of the eigenforms on the basis of\n        :literal:`mf` respectively, and :literal:`mf0` is the corresponding new space of\n        integral weight :math:`2k-1`.\n        \n        ::\n        \n            ? mf=mfinit([44,5/2],1);bij=mfkohnenbijection(mf);\n            ? [mf0,BN,BE]=mfkohneneigenbasis(mf,bij);\n            ? BN~\n            %2 =\n            [2 0 0 -2 2 0 -8]\n            \n            [2 0 0 4 14 0 -32]\n            \n            ? BE~\n            %3 = [Mod(1, y^2 - 3) Mod(0, y^2 - 3) Mod(0, y^2 - 3) Mod(y - 1, y^2 - 3)\\\n             Mod(2*y + 1, y^2 - 3) Mod(0, y^2 - 3) Mod(-4*y - 4, y^2 - 3)]\n            ? lift(mfcoefs(mf,20)*BE[,1])\n            %4 = [0, 1, 0, 0, y - 1, 2*y + 1, 0, 0, 0, -4*y - 4, 0, 0,\\\n             -5*y + 3, 0, 0, 0, -6, 0, 0, 0, 7*y + 9]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1057mfkohneneigenbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_bij = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfkohneneigenbasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_bij,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_mf)) != 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_bij)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfkohneneigenbasis", 1, 2, 2, 1); __PYX_ERR(4, 18601, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfkohneneigenbasis") < 0)) __PYX_ERR(4, 18601, __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_mf = values[0];
    __pyx_v_bij = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfkohneneigenbasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18601, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfkohneneigenbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1056mfkohneneigenbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_bij);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1056mfkohneneigenbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_bij) {
  GEN __pyx_v__mf;
  GEN __pyx_v__bij;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfkohneneigenbasis", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_bij);

  /* "cypari/auto_instance.pxi":18628
 *              -5*y + 3, 0, 0, 0, -6, 0, 0, 0, 7*y + 9]~
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         bij = objtogen(bij)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18629
 *         '''
 *         mf = objtogen(mf)
 *         bij = objtogen(bij)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bij, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bij, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18630
 *         mf = objtogen(mf)
 *         bij = objtogen(bij)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _bij = (<Gen>bij).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18630, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18631
 *         bij = objtogen(bij)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bij = (<Gen>bij).g
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18632
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _bij = (<Gen>bij).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bij)->__pyx_base.g;
  __pyx_v__bij = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18633
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _bij = (<Gen>bij).g
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfkohneneigenbasis(__pyx_v__mf, __pyx_v__bij);

  /* "cypari/auto_instance.pxi":18634
 *         cdef GEN _bij = (<Gen>bij).g
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mflinear(self, vF, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18601
 *         return new_gen(_ret)
 * 
 *     def mfkohneneigenbasis(self, mf, bij):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfkohneneigenbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_bij);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18636
 *         return new_gen(_ret)
 * 
 *     def mflinear(self, vF, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`vF` being a vector of generalized modular forms and :literal:`v`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1059mflinear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1058mflinear[] = "\n        :literal:`vF` being a vector of generalized modular forms and :literal:`v`\n        a vector of coefficients of same length, compute the linear\n        combination of the entries of :literal:`vF` with coefficients :literal:`v`.\n        :strong:`Note.` Use this in particular to subtract two forms :math:`F` and :math:`G`\n        (with :math:`vF = [F,G]` and :math:`v = [1,-1]`), or to multiply an form by\n        a scalar :math:`\\lambda` (with :math:`vF = [F]` and :math:`v = [\\lambda]`).\n        \n        ::\n        \n            ? D = mfDelta(); G = mflinear([D],[-3]);\n            ? mfcoefs(G,4)\n            %2 = [0, -3, 72, -756, 4416]\n        \n        For user convenience, we allow\n        \n        - a modular form space :literal:`mf` as a :literal:`vF` argument, which is\n          understood as :literal:`mfbasis(mf)`;\n        \n        - in this case, we also allow a modular form :math:`f` as :math:`v`, which\n          is understood as :literal:`mftobasis`:math:`(mf, f)`.\n        \n        ::\n        \n            ? T = mfpow(mfTheta(),7); F = mfShimura(T,-3); \\\\ Shimura lift for D=-3\n            ? mfcoefs(F,8)\n            %2 = [-5/9, 280, 9240, 68320, 295960, 875280, 2254560, 4706240, 9471000]\n            ? mf = mfinit(F); G = mflinear(mf,F);\n            ? mfcoefs(G,8)\n            %4 = [-5/9, 280, 9240, 68320, 295960, 875280, 2254560, 4706240, 9471000]\n        \n        This last construction allows to replace a general modular\n        form by a simpler linear combination of basis functions, which is often\n        more efficient:\n        \n        ::\n        \n            ? T10=mfpow(mfTheta(),10); mfcoef(T10, 10^4) \\\\ direct evaluation\n            time = 399 ms.\n            %5 = 128205250571893636\n            ? mf=mfinit(T10); F=mflinear(mf,T10); \\\\ instantaneous\n            ? mfcoef(F, 10^4) \\\\ after linearization\n            time = 67 ms.\n            %7 = 128205250571893636\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1059mflinear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_vF = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mflinear (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vF,&__pyx_n_s_v,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_vF)) != 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_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mflinear", 1, 2, 2, 1); __PYX_ERR(4, 18636, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mflinear") < 0)) __PYX_ERR(4, 18636, __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_vF = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mflinear", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18636, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mflinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1058mflinear(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_vF, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1058mflinear(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_vF, PyObject *__pyx_v_v) {
  GEN __pyx_v__vF;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mflinear", 0);
  __Pyx_INCREF(__pyx_v_vF);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":18682
 *             %7 = 128205250571893636
 *         '''
 *         vF = objtogen(vF)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_vF, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vF, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18683
 *         '''
 *         vF = objtogen(vF)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _vF = (<Gen>vF).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18684
 *         vF = objtogen(vF)
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _vF = (<Gen>vF).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18684, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18685
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _vF = (<Gen>vF).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mflinear(_vF, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vF)->__pyx_base.g;
  __pyx_v__vF = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18686
 *         sig_on()
 *         cdef GEN _vF = (<Gen>vF).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mflinear(_vF, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18687
 *         cdef GEN _vF = (<Gen>vF).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mflinear(_vF, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mflinear(__pyx_v__vF, __pyx_v__v);

  /* "cypari/auto_instance.pxi":18688
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mflinear(_vF, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfmanin(self, FS, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18636
 *         return new_gen(_ret)
 * 
 *     def mflinear(self, vF, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`vF` being a vector of generalized modular forms and :literal:`v`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mflinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vF);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18690
 *         return new_gen(_ret)
 * 
 *     def mfmanin(self, FS, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the modular symbol :math:`FS` associated to an eigenform :math:`F` by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1061mfmanin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1060mfmanin[] = "\n        Given the modular symbol :math:`FS` associated to an eigenform :math:`F` by\n        :literal:`mfsymbol(mf,F)`, computes the even and odd special polynomials as well\n        as the even and odd periods :math:`\\omega^+` and :math:`\\omega^-` as a vector\n        :math:`[[P^+,P^-],[\\omega^+,\\omega^-,r]]`, where\n        :math:`r = \\Im (\\omega^+\\overline{\\omega^-})/ < F,F >`. If :math:`F` has several embeddings\n        into :math:`\\mathbb{C}`, give the vector of results corresponding to each embedding.\n        \n        ::\n        \n            ? D=mfDelta(); mf=mfinit(D); DS=mfsymbol(mf,D);\n            ? [pols,oms]=mfmanin(DS); pols\n            %2 = [[4*x^9 - 25*x^7 + 42*x^5 - 25*x^3 + 4*x],\\\n             [-36*x^10 + 691*x^8 - 2073*x^6 + 2073*x^4 - 691*x^2 + 36]]\n            ? oms\n            %3 = [0.018538552324740326472516069364750571812,\\\n             -0.00033105361053212432521308691198949874026*I, 4096/691]\n            ? mf=mfinit([11,2],0); F=mfeigenbasis(mf)[1]; FS=mfsymbol(mf,F);\n            ? [pols,oms]=mfmanin(FS);pols\n            %5 = [[0, 0, 0, 1, 1, 0, 0, -1, -1, 0, 0, 0],\\\n             [2, 0, 10, 5, -5, -10, -10, -5, 5, 10, 0, -2]]\n            ? oms[3]\n            %6 = 24/5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1061mfmanin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_FS = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfmanin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_FS,&__pyx_n_s_precision,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_FS)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfmanin") < 0)) __PYX_ERR(4, 18690, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_FS = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18690, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfmanin", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18690, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfmanin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1060mfmanin(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_FS, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1060mfmanin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_FS, long __pyx_v_precision) {
  GEN __pyx_v__FS;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mfmanin", 0);
  __Pyx_INCREF(__pyx_v_FS);

  /* "cypari/auto_instance.pxi":18715
 *             %6 = 24/5
 *         '''
 *         FS = objtogen(FS)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _FS = (<Gen>FS).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_FS, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_FS, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18716
 *         '''
 *         FS = objtogen(FS)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18716, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18717
 *         FS = objtogen(FS)
 *         sig_on()
 *         cdef GEN _FS = (<Gen>FS).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_FS)->__pyx_base.g;
  __pyx_v__FS = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18718
 *         sig_on()
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":18719
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfmanin(_FS, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":18718
 *         sig_on()
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)
 */
  }

  /* "cypari/auto_instance.pxi":18720
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfmanin(__pyx_v__FS, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":18721
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfmul(self, F, G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18690
 *         return new_gen(_ret)
 * 
 *     def mfmanin(self, FS, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the modular symbol :math:`FS` associated to an eigenform :math:`F` by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfmanin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_FS);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18723
 *         return new_gen(_ret)
 * 
 *     def mfmul(self, F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiply the two generalized modular forms :math:`F` and :math:`G`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1063mfmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1062mfmul[] = "\n        Multiply the two generalized modular forms :math:`F` and :math:`G`.\n        \n        ::\n        \n            ? E4 = mfEk(4); G = mfmul(mfmul(E4,E4),E4);\n            ? mfcoefs(G, 4)\n            %2 = [1, 720, 179280, 16954560, 396974160]\n            ? mfcoefs(mfpow(E4,3), 4)\n            %3 = [1, 720, 179280, 16954560, 396974160]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1063mfmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_G,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_F)) != 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_G)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfmul", 1, 2, 2, 1); __PYX_ERR(4, 18723, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfmul") < 0)) __PYX_ERR(4, 18723, __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_F = values[0];
    __pyx_v_G = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18723, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1062mfmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_G);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1062mfmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_G) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfmul", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":18735
 *             %3 = [1, 720, 179280, 16954560, 396974160]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         G = objtogen(G)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18736
 *         '''
 *         F = objtogen(F)
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18737
 *         F = objtogen(F)
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18737, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18738
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfmul(_F, _G)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18739
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfmul(_F, _G)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18740
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfmul(_F, _G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfmul(__pyx_v__F, __pyx_v__G);

  /* "cypari/auto_instance.pxi":18741
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfmul(_F, _G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfnumcusps(self, N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18723
 *         return new_gen(_ret)
 * 
 *     def mfmul(self, F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiply the two generalized modular forms :math:`F` and :math:`G`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18743
 *         return new_gen(_ret)
 * 
 *     def mfnumcusps(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of cusps of :math:`\Gamma_0(N)`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1065mfnumcusps(PyObject *__pyx_v_self, PyObject *__pyx_v_N); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1064mfnumcusps[] = "\n        Number of cusps of :math:`\\Gamma_0(N)`\n        \n        ::\n        \n            ? mfnumcusps(24)\n            %1 = 8\n            ? mfcusps(24)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1065mfnumcusps(PyObject *__pyx_v_self, PyObject *__pyx_v_N) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfnumcusps (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1064mfnumcusps(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_N));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1064mfnumcusps(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfnumcusps", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":18754
 *             %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18755
 *         '''
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfnumcusps(_N)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18755, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18756
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfnumcusps(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18757
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfnumcusps(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfnumcusps(__pyx_v__N);

  /* "cypari/auto_instance.pxi":18758
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfnumcusps(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfparams(self, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18743
 *         return new_gen(_ret)
 * 
 *     def mfnumcusps(self, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of cusps of :math:`\Gamma_0(N)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfnumcusps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18760
 *         return new_gen(_ret)
 * 
 *     def mfparams(self, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form space, returns :literal:`[N,k,CHI,space]`, level,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1067mfparams(PyObject *__pyx_v_self, PyObject *__pyx_v_F); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1066mfparams[] = "\n        If :math:`F` is a modular form space, returns :literal:`[N,k,CHI,space]`, level,\n        weight, character, and space code. If :math:`F` is a generalized modular form,\n        returns :literal:`[N,k,CHI,P]`, where :math:`P` is the (polynomial giving the) field of\n        definition of :math:`F`: in that case the level :math:`N` may be a multiple of the\n        level of :math:`F` and the polynomial :math:`P` may define a larger field than :math:`\\mathbb{Q} (F)`.\n        If you want the true level of :math:`F` from this result, use\n        :literal:`mfconductor(mfinit(F),F)`. The polynomial :math:`P` defines an extension of\n        :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q}[t]/(\\Phi (t))` for the cyclotomic polynomial of order\n        :math:`f(\\chi)`; it has coefficients in that number field (polmods in :math:`t`).\n        \n        In contrast with :literal:`mfparams(f)[4]` which always gives the polynomial\n        :math:`P` defining the relative extension :math:`\\mathbb{Q} (f)/\\mathbb{Q} (\\chi)`, the member function\n        :literal:`:math:`f`.mod` returns the polynomial used to define :math:`\\mathbb{Q} (f)` over :math:`\\mathbb{Q}`\n        (either a cyclotomic polynomial or a polynomial with cyclotomic\n        coefficients).\n        \n        ::\n        \n            ? E1 = mfeisenstein(4,-3,-4); E2 = mfeisenstein(3,5,-7); E3 = mfmul(E1,E2);\n            ? apply(mfparams, [E1,E2,E3])\n            %2 = [[12, 4, 12, y], [35, 3, -35, y], [420, 7, -420, y]]\n            \n            ? mf = mfinit([36,2,Mod(13,36)],0); [f] = mfeigenbasis(mf); mfparams(mf)\n            %3 = [36, 2, Mod(13, 36), 0]\n            ? mfparams(f)\n            %4 = [36, 2, Mod(13, 36), y]\n            ? f.mod\n            %5 = t^2 + t + 1\n            \n            ? mf = mfinit([36,4,Mod(13,36)],0); [f] = mfeigenbasis(mf);\n            ? mfparams(f)\n            %7 = [36, 4, Mod(13, 36), y^3 + Mod(2*t - 2, t^2 + t + 1)*y^2\n             + Mod(-4*t + 6, t^2+t+1)*y"" + Mod(10*t - 1, t^2+t+1)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1067mfparams(PyObject *__pyx_v_self, PyObject *__pyx_v_F) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfparams (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1066mfparams(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_F));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1066mfparams(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfparams", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":18796
 *              + Mod(-4*t + 6, t^2+t+1)*y + Mod(10*t - 1, t^2+t+1)]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18797
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfparams(_F)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18797, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18798
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfparams(_F)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18799
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfparams(_F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfparams(__pyx_v__F);

  /* "cypari/auto_instance.pxi":18800
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfparams(_F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfperiodpol(self, mf, f, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18760
 *         return new_gen(_ret)
 * 
 *     def mfparams(self, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form space, returns :literal:`[N,k,CHI,space]`, level,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfparams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18802
 *         return new_gen(_ret)
 * 
 *     def mfperiodpol(self, mf, f, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Period polynomial of the cuspidal part of the form :math:`f`, in other words
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1069mfperiodpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1068mfperiodpol[] = "\n        Period polynomial of the cuspidal part of the form :math:`f`, in other words\n        :math:`\\int_0^{i oo }(X-\\tau)^{k-2}f(\\tau)d\\tau`. If :literal:`flag` is :math:`0`, ordinary\n        period polynomial. If it is :math:`1` or :math:`-1`, even or odd part of that polynomial.\n        :math:`f` can also be the modular symbol output by :literal:`mfsymbol` (mf,f).\n        \n        ::\n        \n            ? D = mfDelta(); mf = mfinit(D,0);\n            ? PP = mfperiodpol(mf, D, -1); PP/=polcoeff(PP, 1); bestappr(PP)\n            %1 = x^9 - 25/4*x^7 + 21/2*x^5 - 25/4*x^3 + x\n            ? PM = mfperiodpol(mf, D, 1); PM/=polcoeff(PM, 0); bestappr(PM)\n            %2 = -x^10 + 691/36*x^8 - 691/12*x^6 + 691/12*x^4 - 691/36*x^2 + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1069mfperiodpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_f = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfperiodpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_f,&__pyx_n_s_flag,&__pyx_n_s_precision,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_mf)) != 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_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfperiodpol", 0, 2, 4, 1); __PYX_ERR(4, 18802, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfperiodpol") < 0)) __PYX_ERR(4, 18802, __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);
        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_mf = values[0];
    __pyx_v_f = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18802, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18802, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfperiodpol", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18802, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfperiodpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1068mfperiodpol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_f, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1068mfperiodpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mfperiodpol", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":18817
 *             %2 = -x^10 + 691/36*x^8 - 691/12*x^6 + 691/12*x^4 - 691/36*x^2 + 1
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         f = objtogen(f)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18818
 *         '''
 *         mf = objtogen(mf)
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18819
 *         mf = objtogen(mf)
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18819, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18820
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18821
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18822
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":18823
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":18822
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 */
  }

  /* "cypari/auto_instance.pxi":18824
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfperiodpol(__pyx_v__mf, __pyx_v__f, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":18825
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfperiodpolbasis(self, long k, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18802
 *         return new_gen(_ret)
 * 
 *     def mfperiodpol(self, mf, f, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Period polynomial of the cuspidal part of the form :math:`f`, in other words
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfperiodpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18827
 *         return new_gen(_ret)
 * 
 *     def mfperiodpolbasis(self, long k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Basis of period polynomials for weight k. If flag = 1 or :math:`-1`, basis of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1071mfperiodpolbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1070mfperiodpolbasis[] = "\n        Basis of period polynomials for weight k. If flag = 1 or :math:`-1`, basis of\n        odd or even period polynomials.\n        \n        ::\n        \n            ? mfperiodpolbasis(12,1)\n            %1 = [x^8 - 3*x^6 + 3*x^4 - x^2, x^10 - 1]\n            ? mfperiodpolbasis(12,-1)\n            %2 = [4*x^9 - 25*x^7 + 42*x^5 - 25*x^3 + 4*x]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1071mfperiodpolbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfperiodpolbasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_flag,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_k)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfperiodpolbasis") < 0)) __PYX_ERR(4, 18827, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18827, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18827, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfperiodpolbasis", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18827, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfperiodpolbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1070mfperiodpolbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_k, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1070mfperiodpolbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k, long __pyx_v_flag) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("mfperiodpolbasis", 0);

  /* "cypari/auto_instance.pxi":18839
 *             %2 = [4*x^9 - 25*x^7 + 42*x^5 - 25*x^3 + 4*x]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfperiodpolbasis(k, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 18839, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18840
 *         '''
 *         sig_on()
 *         cdef GEN _ret = mfperiodpolbasis(k, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfperiodpolbasis(__pyx_v_k, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":18841
 *         sig_on()
 *         cdef GEN _ret = mfperiodpolbasis(k, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfpetersson(self, fs, gs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 18841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18827
 *         return new_gen(_ret)
 * 
 *     def mfperiodpolbasis(self, long k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Basis of period polynomials for weight k. If flag = 1 or :math:`-1`, basis of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfperiodpolbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18843
 *         return new_gen(_ret)
 * 
 *     def mfpetersson(self, fs, gs=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Petersson scalar product of the modular forms :math:`f` and :math:`g` belonging to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1073mfpetersson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1072mfpetersson[] = "\n        Petersson scalar product of the modular forms :math:`f` and :math:`g` belonging to\n        the same modular form space :literal:`mf`, given by the corresponding\n        \"modular symbols\" :literal:`fs` and :literal:`gs` output by :literal:`mfsymbol`\n        (also in weight :math:`1` and half-integral weight, where symbols do not exist).\n        If :literal:`gs` is omitted it is understood to be equal to :literal:`fs`.\n        The scalar product is normalized by the factor :math:`1/[\\Gamma:\\Gamma_0(N)]`.\n        Note that :math:`f` and :math:`g` can both be noncuspidal, in which case the program\n        returns an error if the product is divergent.\n        If the fields of definition :math:`\\mathbb{Q} (f)` and :math:`\\mathbb{Q} (g)` are equal to :math:`\\mathbb{Q} (\\chi)`\n        the result is a scalar. If :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)] = d > 1` and\n        :math:`[\\mathbb{Q} (g):\\mathbb{Q} (\\chi)] = e > 1` the result is a :math:`d x e` matrix corresponding\n        to all the embeddings of :math:`f` and :math:`g`. In the intermediate cases :math:`d = 1` or\n        :math:`e = 1` the result is a row or column vector.\n        \n        ::\n        \n            ? D=mfDelta(); mf=mfinit(D); DS=mfsymbol(mf,D); mfpetersson(DS)\n            %1 = 1.0353620568043209223478168122251645932 E-6\n            ? mf=mfinit([11,6],0);B=mfeigenbasis(mf);BS=vector(#B,i,mfsymbol(mf,B[i]));\n            ? mfpetersson(BS[1])\n            %3 = 1.6190120685220988139111708455305245466 E-5\n            ? mfpetersson(BS[1],BS[2])\n            %4 = [-3.826479006582967148 E-42 - 2.801547395385577002 E-41*I,\\\n             1.6661127341163336125 E-41 + 1.1734725972345985061 E-41*I,\\\n             0.E-42 - 6.352626992842664490 E-41*I]~\n            ? mfpetersson(BS[2])\n            %5 =\n            [ 2.7576133733... E-5 2.0... E-42 6.3... E-43 ]\n            \n            [ -4.1... E-42 6.77837030070... E-5 3.3...E-42 ]\n            \n            [ -6"".32...E-43 3.6... E-42 2.27268958069... E-5]\n            \n            ? mf=mfinit([23,2],0); F=mfeigenbasis(mf)[1]; FS=mfsymbol(mf,F);\n            ? mfpetersson(FS)\n            %5 =\n            [0.0039488965740025031688548076498662860143 -3.56 ... E-40]\n            \n            [ -3.5... E-40 0.0056442542987647835101583821368582485396]\n        \n        Noncuspidal example:\n        \n        ::\n        \n            ? E1=mfeisenstein(5,1,-3);E2=mfeisenstein(5,-3,1);\n            ? mf=mfinit([12,5,-3]); cusps=mfcusps(12);\n            ? apply(x->mfcuspval(mf,E1,x),cusps)\n            %3 = [0, 0, 1, 0, 1, 1]\n            ? apply(x->mfcuspval(mf,E2,x),cusps)\n            %4 = [1/3, 1/3, 0, 1/3, 0, 0]\n            ? E1S=mfsymbol(mf,E1);E2S=mfsymbol(mf,E2);\n            ? mfpetersson(E1S,E2S)\n            %6 = -1.884821671646... E-5 - 1.9... E-43*I\n        \n        Weight 1 and 1/2-integral weight example:\n        \n        ::\n        \n            ? mf=mfinit([23,1,-23],1);F=mfbasis(mf)[1];FS=mfsymbol(mf,F);\n            ? mfpetersson(mf,FS)\n            %2 = 0.035149946790370230814006345508484787443\n            ? mf=mfinit([4,9/2],1);F=mfbasis(mf)[1];FS=mfsymbol(mf,F);\n            ? mfpetersson(FS)\n            %4 = 0.00015577084407139192774373662467908966030\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1073mfpetersson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fs = 0;
  PyObject *__pyx_v_gs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfpetersson (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fs,&__pyx_n_s_gs,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_fs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gs);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfpetersson") < 0)) __PYX_ERR(4, 18843, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fs = values[0];
    __pyx_v_gs = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfpetersson", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfpetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1072mfpetersson(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_fs, __pyx_v_gs);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1072mfpetersson(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fs, PyObject *__pyx_v_gs) {
  int __pyx_v__have_gs;
  GEN __pyx_v__fs;
  GEN __pyx_v__gs;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfpetersson", 0);
  __Pyx_INCREF(__pyx_v_fs);
  __Pyx_INCREF(__pyx_v_gs);

  /* "cypari/auto_instance.pxi":18910
 *             %4 = 0.00015577084407139192774373662467908966030
 *         '''
 *         fs = objtogen(fs)             # <<<<<<<<<<<<<<
 *         cdef bint _have_gs = (gs is not None)
 *         if _have_gs:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_fs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18911
 *         '''
 *         fs = objtogen(fs)
 *         cdef bint _have_gs = (gs is not None)             # <<<<<<<<<<<<<<
 *         if _have_gs:
 *             gs = objtogen(gs)
 */
  __pyx_t_2 = (__pyx_v_gs != Py_None);
  __pyx_v__have_gs = __pyx_t_2;

  /* "cypari/auto_instance.pxi":18912
 *         fs = objtogen(fs)
 *         cdef bint _have_gs = (gs is not None)
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             gs = objtogen(gs)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_gs != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":18913
 *         cdef bint _have_gs = (gs is not None)
 *         if _have_gs:
 *             gs = objtogen(gs)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_gs, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":18912
 *         fs = objtogen(fs)
 *         cdef bint _have_gs = (gs is not None)
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             gs = objtogen(gs)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":18914
 *         if _have_gs:
 *             gs = objtogen(gs)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 18914, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18915
 *             gs = objtogen(gs)
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gs = NULL
 *         if _have_gs:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fs)->__pyx_base.g;
  __pyx_v__fs = __pyx_t_4;

  /* "cypari/auto_instance.pxi":18916
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL             # <<<<<<<<<<<<<<
 *         if _have_gs:
 *             _gs = (<Gen>gs).g
 */
  __pyx_v__gs = NULL;

  /* "cypari/auto_instance.pxi":18917
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 */
  __pyx_t_2 = (__pyx_v__have_gs != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":18918
 *         cdef GEN _gs = NULL
 *         if _have_gs:
 *             _gs = (<Gen>gs).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gs)->__pyx_base.g;
    __pyx_v__gs = __pyx_t_4;

    /* "cypari/auto_instance.pxi":18917
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 */
  }

  /* "cypari/auto_instance.pxi":18919
 *         if _have_gs:
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfpetersson(__pyx_v__fs, __pyx_v__gs);

  /* "cypari/auto_instance.pxi":18920
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfpow(self, F, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18843
 *         return new_gen(_ret)
 * 
 *     def mfpetersson(self, fs, gs=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Petersson scalar product of the modular forms :math:`f` and :math:`g` belonging to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfpetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fs);
  __Pyx_XDECREF(__pyx_v_gs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18922
 *         return new_gen(_ret)
 * 
 *     def mfpow(self, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute :math:`F^n`, where :math:`n` is an integer and :math:`F` is a generalized modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1075mfpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1074mfpow[] = "\n        Compute :math:`F^n`, where :math:`n` is an integer and :math:`F` is a generalized modular\n        form:\n        \n        ::\n        \n            ? G = mfpow(mfEk(4), 3); \\\\ E4^3\n            ? mfcoefs(G, 4)\n            %2 = [1, 720, 179280, 16954560, 396974160]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1075mfpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_n,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfpow", 1, 2, 2, 1); __PYX_ERR(4, 18922, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfpow") < 0)) __PYX_ERR(4, 18922, __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_F = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18922, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfpow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18922, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1074mfpow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1074mfpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfpow", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":18933
 *             %2 = [1, 720, 179280, 16954560, 396974160]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18934
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfpow(_F, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18934, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18935
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfpow(_F, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18936
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfpow(_F, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfpow(__pyx_v__F, __pyx_v_n);

  /* "cypari/auto_instance.pxi":18937
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfpow(_F, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfsearch(self, NK, V, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18922
 *         return new_gen(_ret)
 * 
 *     def mfpow(self, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute :math:`F^n`, where :math:`n` is an integer and :math:`F` is a generalized modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18939
 *         return new_gen(_ret)
 * 
 *     def mfsearch(self, NK, V, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being of the form :literal:`[N,k]` with :math:`k` possibly half-integral,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1077mfsearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1076mfsearch[] = "\n        :literal:`NK` being of the form :literal:`[N,k]` with :math:`k` possibly half-integral,\n        search for a modular form with rational coefficients, of weight :math:`k` and\n        level :math:`N`, whose initial coefficients :math:`a(0)`,... are equal to :math:`V`;\n        :literal:`space` specifies the modular form spaces in which to search, in\n        :literal:`mfinit` or :literal:`mfdim` notation. The output is a list of matching forms\n        with that given level and weight. Note that the character is of the form\n        :math:`(D/.)`, where :math:`D` is a (positive or negative) fundamental discriminant\n        dividing :math:`N`. The forms are sorted by increasing :math:`\\|D\\|`.\n        \n        The parameter :math:`N` can be replaced by a vector of allowed levels, in which\n        case the list of forms is sorted by increasing level, then increasing :math:`\\|D\\|`.\n        If a form is found at level :math:`N`, any multiple of :math:`N` with the same :math:`D` is not\n        considered. Some useful possibilities are\n        \n        - :literal:`[:math:`N_1`..:math:`N_2`]`: all levels between :math:`N_1` and :math:`N_2`,\n          endpoints included;\n        \n        - :literal:`:math:`F` * [:math:`N_1`..:math:`N_2`]`: same but levels divisible by :math:`F`;\n        \n        - :literal:`divisors`:math:`(N_0)`: all levels dividing :math:`N_0`.\n        \n        Note that this is different from :literal:`mfeigensearch`, which only searches\n        for rational eigenforms.\n        \n        ::\n        \n            ? F = mfsearch([[1..40], 2], [0,1,2,3,4], 1); #F\n            %1 = 3\n            ? [ mfparams(f) | f <- F ]\n            %2 = [[38, 2, 1, y], [40, 2, 8, y], [40, 2, 40, y]]\n            ? mfcoefs(F[1],10)\n            %3 = [0, 1, 2, 3, 4, -5, -8, 1, -7, -5, 7]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1077mfsearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  PyObject *__pyx_v_V = 0;
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_V,&__pyx_n_s_space,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_NK)) != 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_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfsearch", 0, 2, 3, 1); __PYX_ERR(4, 18939, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsearch") < 0)) __PYX_ERR(4, 18939, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_NK = values[0];
    __pyx_v_V = values[1];
    if (values[2]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18939, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsearch", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18939, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1076mfsearch(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_V, __pyx_v_space);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1076mfsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, PyObject *__pyx_v_V, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__V;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfsearch", 0);
  __Pyx_INCREF(__pyx_v_NK);
  __Pyx_INCREF(__pyx_v_V);

  /* "cypari/auto_instance.pxi":18974
 *             %3 = [0, 1, 2, 3, 4, -5, -8, 1, -7, -5, 7]
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         V = objtogen(V)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18975
 *         '''
 *         NK = objtogen(NK)
 *         V = objtogen(V)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_V, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_V, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18976
 *         NK = objtogen(NK)
 *         V = objtogen(V)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _V = (<Gen>V).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18976, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18977
 *         V = objtogen(V)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = mfsearch(_NK, _V, space)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18978
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsearch(_NK, _V, space)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18979
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = mfsearch(_NK, _V, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsearch(__pyx_v__NK, __pyx_v__V, __pyx_v_space);

  /* "cypari/auto_instance.pxi":18980
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = mfsearch(_NK, _V, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfshift(self, F, long s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18939
 *         return new_gen(_ret)
 * 
 *     def mfsearch(self, NK, V, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being of the form :literal:`[N,k]` with :math:`k` possibly half-integral,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":18982
 *         return new_gen(_ret)
 * 
 *     def mfshift(self, F, long s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Divide the generalized modular form :math:`F` by :math:`q^s`, omitting the remainder
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1079mfshift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1078mfshift[] = "\n        Divide the generalized modular form :math:`F` by :math:`q^s`, omitting the remainder\n        if there is one. One can have :math:`s < 0`.\n        \n        ::\n        \n            ? D=mfDelta(); mfcoefs(mfshift(D,1), 4)\n            %1 = [1, -24, 252, -1472, 4830]\n            ? mfcoefs(mfshift(D,2), 4)\n            %2 = [-24, 252, -1472, 4830, -6048]\n            ? mfcoefs(mfshift(D,-1), 4)\n            %3 = [0, 0, 1, -24, 252]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1079mfshift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_s;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfshift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_s,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_F)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfshift", 1, 2, 2, 1); __PYX_ERR(4, 18982, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfshift") < 0)) __PYX_ERR(4, 18982, __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_F = values[0];
    __pyx_v_s = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 18982, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfshift", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 18982, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfshift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1078mfshift(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_s);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1078mfshift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_s) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfshift", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":18996
 *             %3 = [0, 0, 1, -24, 252]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 18996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":18997
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshift(_F, s)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 18997, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":18998
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfshift(_F, s)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":18999
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshift(_F, s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfshift(__pyx_v__F, __pyx_v_s);

  /* "cypari/auto_instance.pxi":19000
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshift(_F, s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfshimura(self, mf, F, long D=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19000, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":18982
 *         return new_gen(_ret)
 * 
 *     def mfshift(self, F, long s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Divide the generalized modular form :math:`F` by :math:`q^s`, omitting the remainder
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfshift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19002
 *         return new_gen(_ret)
 * 
 *     def mfshimura(self, mf, F, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form of half-integral weight :math:`k >= 3/2` and :math:`D` a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1081mfshimura(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1080mfshimura[] = "\n        :math:`F` being a modular form of half-integral weight :math:`k >= 3/2` and :math:`D` a\n        (not necessarily fundamental) discriminant of suitable sign, returns the\n        Shimura lift :math:`G` of weight :math:`2k-1` corresponding to :math:`D`. The sign of :math:`D`\n        should be equal to :math:`(-1)^{k-1/2}\\epsilon`, where :math:`\\epsilon = 1` if :math:`\\chi` is\n        defined modulo :math:`N/4`, :math:`\\epsilon = -1` if :math:`(-4/.)\\chi` is defined modulo\n        :math:`N/4` (and error otherwise). This function returns :math:`[mf2,G,v]`\n        where :emphasis:`mf2` is a modular form space containing :math:`G` and :math:`v` expresses :math:`G`\n        in terms of :literal:`mfbasis`:math:`(mf2)`; so that :math:`G` is\n        :literal:`mflinear`:math:`(mf2,v)`. By extension, we allow :math:`D` to be a positive\n        squarefree integer, but in that case if :math:`(-1)^{k-1/2}\\epsilon.D` is not a\n        discriminant, the Kohnen :math:`+`-space will in general not be sent to\n        level :math:`N/4` but only :math:`N/2`.\n        \n        ::\n        \n            ? F = mfpow(mfTheta(), 7); mf = mfinit(F);\n            ? [mf2, G, v] = mfshimura(mf, F, -3); mfcoefs(G,5)\n            %2 = [-5/9, 280, 9240, 68320, 295960, 875280]\n            ? mfparams(G)\n            %3 = [1, 6, 1, y]\n            ? mfparams(mf2)\n            %4 = [2, 6, 1, 4] \\\\ it may happen that G has lower level than expected\n            ? v\n            %5 = [280, 0]~\n            ? mfcoefs(mf2, 5)\n            %6 =\n            [-1/504 -1/504]\n            \n            [ 1 0]\n            \n            [ 33 1]\n            \n            [ 244 0]\n            \n            [ 1057 33]\n            \n            [ 3126 0]\n            ? mf = mfinit([60,5/2],1); F = mflinear(mf,mfkohnenbasis(mf)[,1]);\n            ? mfparams(mfshimura(mf,F,1)[2])\n            %8 = [15, 4, 1, y]\n            ? mfparams(mfshimura(mf,F,6)[2])\n            %9 = [30, 4, 1, y]""\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1081mfshimura(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  long __pyx_v_D;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfshimura (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,&__pyx_n_s_D,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mf)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfshimura", 0, 2, 3, 1); __PYX_ERR(4, 19002, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfshimura") < 0)) __PYX_ERR(4, 19002, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_mf = values[0];
    __pyx_v_F = values[1];
    if (values[2]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19002, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfshimura", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19002, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfshimura", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1080mfshimura(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1080mfshimura(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_D) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfshimura", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":19047
 *             %9 = [30, 4, 1, y]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19048
 *         '''
 *         mf = objtogen(mf)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19048, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19049
 *         mf = objtogen(mf)
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19049, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19050
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshimura(_mf, _F, D)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19051
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfshimura(_mf, _F, D)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19052
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshimura(_mf, _F, D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfshimura(__pyx_v__mf, __pyx_v__F, __pyx_v_D);

  /* "cypari/auto_instance.pxi":19053
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshimura(_mf, _F, D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfspace(self, mf, f=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19002
 *         return new_gen(_ret)
 * 
 *     def mfshimura(self, mf, F, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form of half-integral weight :math:`k >= 3/2` and :math:`D` a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfshimura", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19055
 *         return new_gen(_ret)
 * 
 *     def mfspace(self, mf, f=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Identify the modular space :emphasis:`mf`, resp.the modular form :math:`f` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1083mfspace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1082mfspace[] = "\n        Identify the modular space :emphasis:`mf`, resp.\302\240the modular form :math:`f` in\n        :emphasis:`mf` if present, as the flag given to :literal:`mfinit`.\n        Returns 0 (newspace), 1 (cuspidal space), 2 (old space),\n        3 (Eisenstein space) or 4 (full space).\n        \n        ::\n        \n            ? mf = mfinit([1,12],1); mfspace(mf)\n            %1 = 1\n            ? mfspace(mf, mfDelta())\n            %2 = 0 \\\\ new space\n        \n        This function returns :math:`-1` when the form :math:`f` is modular\n        but does not belong to the space.\n        \n        ::\n        \n            ? mf = mfinit([1,2]; mfspace(mf, mfEk(2))\n            %3 = -1\n        \n        When :math:`f` is not modular and is for instance only quasi-modular, the\n        function returns nonsense:\n        \n        ::\n        \n            ? M6 = mfinit([1,6]);\n            ? dE4 = mfderiv(mfEk(4)); \\\\ not modular !\n            ? mfspace(M6,dE4) \\\\ asserts (wrongly) that E4' belongs to new space\n            %3 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1083mfspace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfspace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_f,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_mf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfspace") < 0)) __PYX_ERR(4, 19055, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mf = values[0];
    __pyx_v_f = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfspace", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19055, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1082mfspace(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_f);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1082mfspace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_f) {
  int __pyx_v__have_f;
  GEN __pyx_v__mf;
  GEN __pyx_v__f;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfspace", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":19087
 *             %3 = 0
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19088
 *         '''
 *         mf = objtogen(mf)
 *         cdef bint _have_f = (f is not None)             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             f = objtogen(f)
 */
  __pyx_t_2 = (__pyx_v_f != Py_None);
  __pyx_v__have_f = __pyx_t_2;

  /* "cypari/auto_instance.pxi":19089
 *         mf = objtogen(mf)
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_f != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19090
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:
 *             f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":19089
 *         mf = objtogen(mf)
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":19091
 *         if _have_f:
 *             f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 19091, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19092
 *             f = objtogen(f)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = NULL
 *         if _have_f:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19093
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             _f = (<Gen>f).g
 */
  __pyx_v__f = NULL;

  /* "cypari/auto_instance.pxi":19094
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)
 */
  __pyx_t_2 = (__pyx_v__have_f != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19095
 *         cdef GEN _f = NULL
 *         if _have_f:
 *             _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfspace(_mf, _f)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
    __pyx_v__f = __pyx_t_4;

    /* "cypari/auto_instance.pxi":19094
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)
 */
  }

  /* "cypari/auto_instance.pxi":19096
 *         if _have_f:
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfspace(__pyx_v__mf, __pyx_v__f);

  /* "cypari/auto_instance.pxi":19097
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":19098
 *         cdef long _ret = mfspace(_mf, _f)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfsplit(self, mf, long dimlim=0, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19055
 *         return new_gen(_ret)
 * 
 *     def mfspace(self, mf, f=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Identify the modular space :emphasis:`mf`, resp.the modular form :math:`f` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19100
 *         return _ret
 * 
 *     def mfsplit(self, mf, long dimlim=0, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` from :literal:`mfinit` with integral weight containing the new space
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1085mfsplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1084mfsplit[] = "\n        :literal:`mf` from :literal:`mfinit` with integral weight containing the new space\n        (either the new space itself or the cuspidal space or the full space), and\n        preferably the newspace itself for efficiency, split the space into Galois\n        orbits of eigenforms of the newspace, satisfying various restrictions.\n        \n        The functions returns :math:`[vF, vK]`, where :math:`vF` gives (Galois orbit of)\n        eigenforms and :math:`vK` is a list of polynomials defining each Galois orbit.\n        The eigenforms are given in :literal:`mftobasis` format, i.e. as a matrix\n        whose columns give the forms with respect to :literal:`mfbasis(mf)`.\n        \n        If :literal:`dimlim` is set, only the Galois orbits of dimension :math:`<= dimlim`\n        are computed (i.e. the rational eigenforms if :math:`dimlim = 1` and the\n        character is real). This can considerably speed up the function when a Galois\n        orbit is defined over a large field.\n        \n        :literal:`flag` speeds up computations when the dimension is large: if :math:`flag = d > 0`,\n        when the dimension of the eigenspace is :math:`> d`, only the Galois polynomial is\n        computed.\n        \n        Note that the function :literal:`mfeigenbasis` returns all eigenforms in an\n        easier to use format (as modular forms which can be input as is in other\n        functions); :literal:`mfsplit` is only useful when you can restrict\n        to orbits of small dimensions, e.g. rational eigenforms.\n        \n        ::\n        \n            ? mf=mfinit([11,2],0); f=mfeigenbasis(mf)[1]; mfcoefs(f,16)\n            %1 = [0, 1, -2, -1, ...]\n            ? mf=mfinit([23,2],0); f=mfeigenbasis(mf)[1]; mfcoefs(f,16)\n            %2 = [Mod(0, z^2 - z - 1), Mod(1, z^2 - z - 1), Mod(-z, z^2 - z - 1), ...]\n            ? mf=mfinit([179,2],0); apply(poldegree, mffields(mf))\n            %3 = [1, 3, 11]\n            ? mf=mfinit([719,2],0);\n           "" ? [vF,vK] = mfsplit(mf, 5); \\\\ fast when restricting to small orbits\n            time = 192 ms.\n            ? #vF \\\\ a single orbit\n            %5 = 1\n            ? poldegree(vK[1]) \\\\ of dimension 5\n            %6 = 5\n            ? [vF,vK] = mfsplit(mf); \\\\ general case is slow\n            time = 2,104 ms.\n            ? apply(poldegree,vK)\n            %8 = [5, 10, 45] \\\\ because degree 45 is large...\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1085mfsplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  long __pyx_v_dimlim;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_dimlim,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimlim);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsplit") < 0)) __PYX_ERR(4, 19100, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mf = values[0];
    if (values[1]) {
      __pyx_v_dimlim = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_dimlim == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19100, __pyx_L3_error)
    } else {
      __pyx_v_dimlim = ((long)0);
    }
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19100, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsplit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19100, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1084mfsplit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_dimlim, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1084mfsplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, long __pyx_v_dimlim, long __pyx_v_flag) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfsplit", 0);
  __Pyx_INCREF(__pyx_v_mf);

  /* "cypari/auto_instance.pxi":19146
 *             %8 = [5, 10, 45] \\ because degree 45 is large...
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19147
 *         '''
 *         mf = objtogen(mf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19147, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19148
 *         mf = objtogen(mf)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19149
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsplit(__pyx_v__mf, __pyx_v_dimlim, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":19150
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfsturm(self, NK):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19100
 *         return _ret
 * 
 *     def mfsplit(self, mf, long dimlim=0, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` from :literal:`mfinit` with integral weight containing the new space
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19152
 *         return new_gen(_ret)
 * 
 *     def mfsturm(self, NK):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Sturm bound for modular forms on :math:`\Gamma_0(N)` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1087mfsturm(PyObject *__pyx_v_self, PyObject *__pyx_v_NK); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1086mfsturm[] = "\n        Gives the Sturm bound for modular forms on :math:`\\Gamma_0(N)` and\n        weight :math:`k`, i.e., an upper bound for the order of the zero at infinity of\n        a nonzero form. :literal:`NK` is either\n        \n        - a pair :math:`[N,k]`,\n        \n        - or the output of :literal:`mfinit` in which case the exact upper bound\n          is returned.\n        \n        ::\n        \n            ? NK = [96,6]; mfsturm(NK)\n            %1 = 97\n            ? mf=mfinit(NK,1); mfsturm(mf)\n            %2 = 76\n            ? mfdim(NK,0) \\\\ new space\n            %3 = 72\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1087mfsturm(PyObject *__pyx_v_self, PyObject *__pyx_v_NK) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsturm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1086mfsturm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_NK));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1086mfsturm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK) {
  GEN __pyx_v__NK;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfsturm", 0);
  __Pyx_INCREF(__pyx_v_NK);

  /* "cypari/auto_instance.pxi":19172
 *             %3 = 72
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19173
 *         '''
 *         NK = objtogen(NK)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef long _ret = mfsturm(_NK)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19173, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19174
 *         NK = objtogen(NK)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfsturm(_NK)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19175
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef long _ret = mfsturm(_NK)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfsturm(__pyx_v__NK);

  /* "cypari/auto_instance.pxi":19176
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef long _ret = mfsturm(_NK)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":19177
 *         cdef long _ret = mfsturm(_NK)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfsymbol(self, mf, f=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19177, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19152
 *         return new_gen(_ret)
 * 
 *     def mfsturm(self, NK):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Sturm bound for modular forms on :math:`\Gamma_0(N)` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19179
 *         return _ret
 * 
 *     def mfsymbol(self, mf, f=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for working with all period polynomials of the modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1089mfsymbol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1088mfsymbol[] = "\n        Initialize data for working with all period polynomials of the modular\n        form :math:`f`: this is essential for efficiency for functions such as\n        :literal:`mfsymboleval`, :literal:`mfmanin`, and :literal:`mfpetersson`. An :literal:`mfsymbol`\n        contains an :literal:`mf` structure and can always be used whenever an :literal:`mf`\n        would be needed.\n        \n        ::\n        \n            ? mf=mfinit([23,2],0);F=mfeigenbasis(mf)[1];\n            ? FS=mfsymbol(mf,F);\n            ? mfsymboleval(FS,[0,oo])\n            %3 = [8.762565143790690142 E-39 + 0.0877907874...*I,\n             -5.617375463602574564 E-39 + 0.0716801031...*I]\n            ? mfpetersson(FS)\n            %4 =\n            [0.0039488965740025031688548076498662860143 1.2789721111175127425 E-40]\n            \n            [1.2630501762985554269 E-40 0.0056442542987647835101583821368582485396]\n        \n        By abuse of language, initialize data for working with :literal:`mfpetersson` in\n        weight :math:`1` and half-integral weight (where no symbol exist); the :literal:`mf`\n        argument may be an :literal:`mfsymbol` attached to a form on the space,\n        which avoids recomputing data independent of the form.\n        \n        ::\n        \n            ? mf=mfinit([12,9/2],1); F=mfbasis(mf);\n            ? fs=mfsymbol(mf,F[1]);\n            time = 476 ms\n            ? mfpetersson(fs)\n            %2 = 1.9722437519492014682047692073275406145 E-5\n            ? f2s = mfsymbol(mf,F[2]);\n            time = 484 ms.\n            ? mfpetersson(f2s)\n            %4 = 1.2142222531326333658647877864573002476 E-5\n            ? gs = mfsymbol(fs,F[2]); \\\\ re-use existing symbol, a little faster\n            time = 430 ms.\n            ? mfpetersson(gs) == %4 \\\\ same value\n            %6 = 1\n        \n        For simplicity, we also allow :literal:`mfsymbol(f)` instead of\n        :literal:`mfsymbol(mfinit(f), f)`:\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1089mfsymbol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_f = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsymbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_f,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_mf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsymbol") < 0)) __PYX_ERR(4, 19179, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mf = values[0];
    __pyx_v_f = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19179, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsymbol", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19179, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsymbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1088mfsymbol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_f, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1088mfsymbol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_precision) {
  int __pyx_v__have_f;
  GEN __pyx_v__mf;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfsymbol", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":19224
 *         :literal:`mfsymbol(mfinit(f), f)`:
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19225
 *         '''
 *         mf = objtogen(mf)
 *         cdef bint _have_f = (f is not None)             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             f = objtogen(f)
 */
  __pyx_t_2 = (__pyx_v_f != Py_None);
  __pyx_v__have_f = __pyx_t_2;

  /* "cypari/auto_instance.pxi":19226
 *         mf = objtogen(mf)
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_f != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19227
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:
 *             f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":19226
 *         mf = objtogen(mf)
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":19228
 *         if _have_f:
 *             f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 19228, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19229
 *             f = objtogen(f)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = NULL
 *         if _have_f:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19230
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             _f = (<Gen>f).g
 */
  __pyx_v__f = NULL;

  /* "cypari/auto_instance.pxi":19231
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_f != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19232
 *         cdef GEN _f = NULL
 *         if _have_f:
 *             _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
    __pyx_v__f = __pyx_t_4;

    /* "cypari/auto_instance.pxi":19231
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":19233
 *         if _have_f:
 *             _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19234
 *             _f = (<Gen>f).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":19233
 *         if _have_f:
 *             _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 */
  }

  /* "cypari/auto_instance.pxi":19235
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsymbol(__pyx_v__mf, __pyx_v__f, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":19236
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfsymboleval(self, fs, path, ga=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19179
 *         return _ret
 * 
 *     def mfsymbol(self, mf, f=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for working with all period polynomials of the modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsymbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19238
 *         return new_gen(_ret)
 * 
 *     def mfsymboleval(self, fs, path, ga=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluation of the modular symbol :math:`fs` (corresponding to the modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1091mfsymboleval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1090mfsymboleval[] = "\n        Evaluation of the modular symbol :math:`fs` (corresponding to the modular\n        form :math:`f`) output by :literal:`mfsymbol` on the given path :literal:`path`, where\n        :literal:`path` is either a vector :math:`[s_1,s_2]` or an integral matrix :math:`[a,b;c,d]`\n        representing the path :math:`[a/c,b/d]`. In both cases :math:`s_1` or :math:`s_2` (or :math:`a/c` or\n        :math:`b/d`) can also be elements of the upper half-plane.\n        To avoid possibly lengthy :literal:`mfsymbol` computations, the program also\n        accepts :math:`fs` of the form :literal:`[mf,F]`, but in that case :math:`s_1` and :math:`s_2`\n        are limited to :literal:`oo` and elements of the upper half-plane.\n        The result is the polynomial equal to\n        :math:`\\int_{s_1}^{s_2}(X-\\tau)^{k-2}F(\\tau)d\\tau`, the integral being\n        computed along a geodesic joining :math:`s_1` and :math:`s_2`. If :literal:`ga` in :math:`GL_2^+(\\mathbb{Q})`\n        is given, replace :math:`F` by :math:`F\\|_{k}\\gamma`. Note that if the integral diverges,\n        the result will be a rational function.\n        If the field of definition :math:`\\mathbb{Q} (f)` is larger than :math:`\\mathbb{Q} (\\chi)` then :math:`f` can be\n        embedded into :math:`\\mathbb{C}` in :math:`d = [\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]` ways, in which case a vector of\n        the :math:`d` results is returned.\n        \n        ::\n        \n            ? mf=mfinit([35,2],1);f=mfbasis(mf)[1];fs=mfsymbol(mf,f);\n            ? mfsymboleval(fs,[0,oo])\n            %1 = 0.31404011074188471664161704390256378537*I\n            ? mfsymboleval(fs,[1,3;2,5])\n            %2 = -0.1429696291... - 0.2619975641...*I\n            ? mfsymboleval(fs,[I,2*I])\n            %3 = 0.00088969563028739893631700037491116258378*I\n            ? E2=mfEk(2);E22=mflinear([E2,mfbd(E2,2)],[1,-2]);mf=mfinit(E22);\n            ? E2S = mfsymbol(mf,E22);\n            ? mfsymboleval(E2S,[0,1])\n            %6"" = (-1.00000...*x^2 + 1.00000...*x - 0.50000...)/(x^2 - x)\n        \n        The rational function which is given in case the integral diverges is\n        easy to interpret. For instance:\n        \n        ::\n        \n            ? E4=mfEk(4);mf=mfinit(E4);ES=mfsymbol(mf,E4);\n            ? mfsymboleval(ES,[I,oo])\n            %2 = 1/3*x^3 - 0.928067...*I*x^2 - 0.833333...*x + 0.234978...*I\n            ? mfsymboleval(ES,[0,I])\n            %3 = (-0.234978...*I*x^3 - 0.833333...*x^2 + 0.928067...*I*x + 0.333333...)/x\n        \n        :literal:`mfsymboleval(ES,[a,oo])` is the limit as :math:`T\\to oo` of\n        \n        .. MATH::\n        \n            \\int_a^{iT}(X-\\tau)^{k-2}F(\\tau)d\\tau + a(0)(X-iT)^{k-1}/(k-1) ,\n        \n        where :math:`a(0)` is the :math:`0`th coefficient of :math:`F` at infinity. Similarly,\n        :literal:`mfsymboleval(ES,[0,a])` is the limit as :math:`T\\to oo` of\n        \n        .. MATH::\n        \n            \\int_{i/T}^a(X-\\tau)^{k-2}F(\\tau)d\\tau+b(0)(1+iTX)^{k-1}/(k-1) ,\n        \n        where :math:`b(0)` is the :math:`0`th coefficient of :math:`F\\|_{k} S` at infinity.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1091mfsymboleval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fs = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_ga = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsymboleval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fs,&__pyx_n_s_path,&__pyx_n_s_ga,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_fs)) != 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_path)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfsymboleval", 0, 2, 4, 1); __PYX_ERR(4, 19238, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ga);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsymboleval") < 0)) __PYX_ERR(4, 19238, __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);
        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_fs = values[0];
    __pyx_v_path = values[1];
    __pyx_v_ga = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19238, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsymboleval", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19238, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsymboleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1090mfsymboleval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_fs, __pyx_v_path, __pyx_v_ga, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1090mfsymboleval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fs, PyObject *__pyx_v_path, PyObject *__pyx_v_ga, long __pyx_v_precision) {
  int __pyx_v__have_ga;
  GEN __pyx_v__fs;
  GEN __pyx_v__path;
  GEN __pyx_v__ga;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfsymboleval", 0);
  __Pyx_INCREF(__pyx_v_fs);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_ga);

  /* "cypari/auto_instance.pxi":19297
 *         where :math:`b(0)` is the :math:`0`th coefficient of :math:`F\|_{k} S` at infinity.
 *         '''
 *         fs = objtogen(fs)             # <<<<<<<<<<<<<<
 *         path = objtogen(path)
 *         cdef bint _have_ga = (ga is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fs, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_fs, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19298
 *         '''
 *         fs = objtogen(fs)
 *         path = objtogen(path)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_path, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19299
 *         fs = objtogen(fs)
 *         path = objtogen(path)
 *         cdef bint _have_ga = (ga is not None)             # <<<<<<<<<<<<<<
 *         if _have_ga:
 *             ga = objtogen(ga)
 */
  __pyx_t_2 = (__pyx_v_ga != Py_None);
  __pyx_v__have_ga = __pyx_t_2;

  /* "cypari/auto_instance.pxi":19300
 *         path = objtogen(path)
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             ga = objtogen(ga)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_ga != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19301
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:
 *             ga = objtogen(ga)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ga, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19301, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ga, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":19300
 *         path = objtogen(path)
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             ga = objtogen(ga)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":19302
 *         if _have_ga:
 *             ga = objtogen(ga)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _path = (<Gen>path).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 19302, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19303
 *             ga = objtogen(ga)
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g             # <<<<<<<<<<<<<<
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fs)->__pyx_base.g;
  __pyx_v__fs = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19304
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _path = (<Gen>path).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ga = NULL
 *         if _have_ga:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_path)->__pyx_base.g;
  __pyx_v__path = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19305
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL             # <<<<<<<<<<<<<<
 *         if _have_ga:
 *             _ga = (<Gen>ga).g
 */
  __pyx_v__ga = NULL;

  /* "cypari/auto_instance.pxi":19306
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             _ga = (<Gen>ga).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_ga != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19307
 *         cdef GEN _ga = NULL
 *         if _have_ga:
 *             _ga = (<Gen>ga).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ga)->__pyx_base.g;
    __pyx_v__ga = __pyx_t_4;

    /* "cypari/auto_instance.pxi":19306
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             _ga = (<Gen>ga).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":19308
 *         if _have_ga:
 *             _ga = (<Gen>ga).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19309
 *             _ga = (<Gen>ga).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":19308
 *         if _have_ga:
 *             _ga = (<Gen>ga).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 */
  }

  /* "cypari/auto_instance.pxi":19310
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsymboleval(__pyx_v__fs, __pyx_v__path, __pyx_v__ga, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":19311
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftaylor(self, F, long n, long flreal=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19238
 *         return new_gen(_ret)
 * 
 *     def mfsymboleval(self, fs, path, ga=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluation of the modular symbol :math:`fs` (corresponding to the modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mfsymboleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fs);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_ga);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19313
 *         return new_gen(_ret)
 * 
 *     def mftaylor(self, F, long n, long flreal=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a form in :math:`M_k(SL_2(\mathbb{Z}))`, computes the first :math:`n+1`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1093mftaylor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1092mftaylor[] = "\n        :math:`F` being a form in :math:`M_k(SL_2(\\mathbb{Z}))`, computes the first :math:`n+1`\n        canonical Taylor expansion of :math:`F` around :math:`\\tau = I`. If :literal:`flreal = 0`,\n        computes only an algebraic equivalence class. If :literal:`flreal` is set,\n        compute :math:`p_n` such that for :math:`\\tau` close enough to :math:`I` we have\n        \n        .. MATH::\n        \n            f(\\tau) = (2I/(\\tau+I))^k\\sum_{n >= 0}p_n((\\tau-I)/(\\tau+I))^n .\n        \n        ::\n        \n            ? D=mfDelta();\n            ? mftaylor(D,8)\n            %2 = [1/1728, 0, -1/20736, 0, 1/165888, 0, 1/497664, 0, -11/3981312]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1093mftaylor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_n;
  long __pyx_v_flreal;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftaylor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_n,&__pyx_n_s_flreal,&__pyx_n_s_precision,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mftaylor", 0, 2, 4, 1); __PYX_ERR(4, 19313, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flreal);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftaylor") < 0)) __PYX_ERR(4, 19313, __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);
        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_F = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19313, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_flreal = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flreal == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19313, __pyx_L3_error)
    } else {
      __pyx_v_flreal = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19313, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftaylor", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19313, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftaylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1092mftaylor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_n, __pyx_v_flreal, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1092mftaylor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_n, long __pyx_v_flreal, long __pyx_v_precision) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftaylor", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":19330
 *             %2 = [1/1728, 0, -1/20736, 0, 1/165888, 0, 1/497664, 0, -11/3981312]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19331
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19331, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19332
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19333
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":19334
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftaylor(__pyx_v__F, __pyx_v_n, __pyx_v_flreal, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":19335
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftobasis(self, mf, F, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19313
 *         return new_gen(_ret)
 * 
 *     def mftaylor(self, F, long n, long flreal=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a form in :math:`M_k(SL_2(\mathbb{Z}))`, computes the first :math:`n+1`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftaylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19337
 *         return new_gen(_ret)
 * 
 *     def mftobasis(self, mf, F, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of the form :math:`F` on the basis given by :literal:`mfbasis(mf)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1095mftobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1094mftobasis[] = "\n        Coefficients of the form :math:`F` on the basis given by :literal:`mfbasis(mf)`.\n        A :math:`q`-expansion or vector of coefficients\n        can also be given instead of :math:`F`, but in this case an error message may occur\n        if the expansion is too short. An error message is also given if :math:`F` does not\n        belong to the modular form space. If :literal:`flag` is set, instead of\n        error messages the output is an affine space of solutions if a :math:`q`-expansion\n        or vector of coefficients is given, or the empty column otherwise.\n        \n        ::\n        \n            ? mf = mfinit([26,2],0); mfdim(mf)\n            %1 = 2\n            ? F = mflinear(mf,[a,b]); mftobasis(mf,F)\n            %2 = [a, b]~\n        \n        A :math:`q`-expansion or vector of coefficients can also be given instead of :math:`F`.\n        \n        ::\n        \n            ? Th = 1 + 2*sum(n=1, 8, q^(n^2), O(q^80));\n            ? mf = mfinit([4,5,Mod(3,4)]);\n            ? mftobasis(mf, Th^10)\n            %3 = [64/5, 4/5, 32/5]~\n        \n        If :math:`F` does not belong to the corresponding space, the result is incorrect\n        and simply matches the coefficients of :math:`F` up to some bound, and\n        the function may either return an empty column or an error message.\n        If :literal:`flag` is set, there are no error messages, and the result is\n        an empty column if :math:`F` is a modular form; if :math:`F` is supplied via a series\n        or vector of coefficients which does not contain enough information to force\n        a unique (potential) solution, the function returns :math:`[v,K]` where :math:`v` is a\n        solution and :math:`K` is a matrix of maximal rank describing the affine space of\n        potential solutions :math:`v + K.x`.\n        \n        ::\n        \n            ? mf = mfinit([4,12],1);\n            ? mftobasis(mf, q-24*q^2+O(q^3), 1)\n            %2 = [[43/64, -63/8, 800, 21/64]~, [1"", 0; 24, 0; 2048, 768; -1, 0]]\n            ? mftobasis(mf, [0,1,-24,252], 1)\n            %3 = [[1, 0, 1472, 0]~, [0; 0; 768; 0]]\n            ? mftobasis(mf, [0,1,-24,252,-1472], 1)\n            %4 = [1, 0, 0, 0]~ \\\\ now uniquely determined\n            ? mftobasis(mf, [0,1,-24,252,-1472,0], 1)\n            %5 = [1, 0, 0, 0]~ \\\\ wrong result: no such form exists\n            ? mfcoefs(mflinear(mf,%), 5) \\\\ double check\n            %6 = [0, 1, -24, 252, -1472, 4830]\n            ? mftobasis(mf, [0,1,-24,252,-1472,0])\n             *** at top-level: mftobasis(mf,[0,1,\n             *** ^--------------------\n             *** mftobasis: domain error in mftobasis: form does not belong to space\n            ? mftobasis(mf, mfEk(10))\n             *** at top-level: mftobasis(mf,mfEk(\n             *** ^--------------------\n             *** mftobasis: domain error in mftobasis: form does not belong to space\n            ? mftobasis(mf, mfEk(10), 1)\n            %7 = []~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1095mftobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftobasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mf)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mftobasis", 0, 2, 3, 1); __PYX_ERR(4, 19337, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftobasis") < 0)) __PYX_ERR(4, 19337, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_mf = values[0];
    __pyx_v_F = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19337, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftobasis", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19337, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1094mftobasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1094mftobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_flag) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftobasis", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":19397
 *             %7 = []~
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19398
 *         '''
 *         mf = objtogen(mf)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19399
 *         mf = objtogen(mf)
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19399, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19400
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19401
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19402
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftobasis(__pyx_v__mf, __pyx_v__F, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":19403
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftocoset(self, long N, M, Lcosets):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19337
 *         return new_gen(_ret)
 * 
 *     def mftobasis(self, mf, F, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of the form :math:`F` on the basis given by :literal:`mfbasis(mf)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19405
 *         return new_gen(_ret)
 * 
 *     def mftocoset(self, long N, M, Lcosets):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a matrix in :math:`SL_2(Z)` and :literal:`Lcosets` being
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1097mftocoset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1096mftocoset[] = "\n        :math:`M` being a matrix in :math:`SL_2(Z)` and :literal:`Lcosets` being\n        :literal:`mfcosets(N)`, a list of right cosets of :math:`\\Gamma_0(N)`,\n        find the coset to which :math:`M` belongs. The output is a pair\n        :math:`[\\gamma,i]` such that :math:`M = \\gamma Lcosets[i]`, :math:`\\gamma\\in\\Gamma_0(N)`.\n        \n        ::\n        \n            ? N = 4; L = mfcosets(N);\n            ? mftocoset(N, [1,1;2,3], L)\n            %2 = [[-1, 1; -4, 3], 5]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1097mftocoset(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_N;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_Lcosets = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftocoset (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_M,&__pyx_n_s_Lcosets,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N)) != 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_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mftocoset", 1, 3, 3, 1); __PYX_ERR(4, 19405, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Lcosets)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mftocoset", 1, 3, 3, 2); __PYX_ERR(4, 19405, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftocoset") < 0)) __PYX_ERR(4, 19405, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_N = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_N == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19405, __pyx_L3_error)
    __pyx_v_M = values[1];
    __pyx_v_Lcosets = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftocoset", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19405, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftocoset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1096mftocoset(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N, __pyx_v_M, __pyx_v_Lcosets);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1096mftocoset(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_N, PyObject *__pyx_v_M, PyObject *__pyx_v_Lcosets) {
  GEN __pyx_v__M;
  GEN __pyx_v__Lcosets;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftocoset", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_Lcosets);

  /* "cypari/auto_instance.pxi":19418
 *             %2 = [[-1, 1; -4, 3], 5]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         Lcosets = objtogen(Lcosets)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19419
 *         '''
 *         M = objtogen(M)
 *         Lcosets = objtogen(Lcosets)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Lcosets, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Lcosets, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19420
 *         M = objtogen(M)
 *         Lcosets = objtogen(Lcosets)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _Lcosets = (<Gen>Lcosets).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19420, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19421
 *         Lcosets = objtogen(Lcosets)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Lcosets = (<Gen>Lcosets).g
 *         cdef GEN _ret = mftocoset(N, _M, _Lcosets)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19422
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _Lcosets = (<Gen>Lcosets).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftocoset(N, _M, _Lcosets)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Lcosets)->__pyx_base.g;
  __pyx_v__Lcosets = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19423
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _Lcosets = (<Gen>Lcosets).g
 *         cdef GEN _ret = mftocoset(N, _M, _Lcosets)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftocoset(__pyx_v_N, __pyx_v__M, __pyx_v__Lcosets);

  /* "cypari/auto_instance.pxi":19424
 *         cdef GEN _Lcosets = (<Gen>Lcosets).g
 *         cdef GEN _ret = mftocoset(N, _M, _Lcosets)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftonew(self, mf, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19405
 *         return new_gen(_ret)
 * 
 *     def mftocoset(self, long N, M, Lcosets):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a matrix in :math:`SL_2(Z)` and :literal:`Lcosets` being
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftocoset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_Lcosets);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19426
 *         return new_gen(_ret)
 * 
 *     def mftonew(self, mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being being a full or cuspidal space with parameters :math:`[N,k,\chi]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1099mftonew(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1098mftonew[] = "\n        :literal:`mf` being being a full or cuspidal space with parameters :math:`[N,k,\\chi]`\n        and :math:`F` a cusp form in that space, returns a vector of 3-component vectors\n        :math:`[M,d,G]`, where :math:`f(\\chi) \\| M \\| N`, :math:`d \\| N/M`, and :math:`G` is a form\n        in :math:`S_k^{new}(\\Gamma_0(M),\\chi)` such that :math:`F` is equal to the sum of\n        the :math:`B(d)(G)` over all these 3-component vectors.\n        \n        ::\n        \n            ? mf = mfinit([96,6],1); F = mfbasis(mf)[60]; s = mftonew(mf,F); #s\n            %1 = 1\n            ? [M,d,G] = s[1]; [M,d]\n            %2 = [48, 2]\n            ? mfcoefs(F,10)\n            %3 = [0, 0, -160, 0, 0, 0, 0, 0, 0, 0, -14400]\n            ? mfcoefs(G,10)\n            %4 = [0, 0, -160, 0, 0, 0, 0, 0, 0, 0, -14400]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1099mftonew(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mf = 0;
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftonew (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mf,&__pyx_n_s_F,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_mf)) != 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_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mftonew", 1, 2, 2, 1); __PYX_ERR(4, 19426, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftonew") < 0)) __PYX_ERR(4, 19426, __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_mf = values[0];
    __pyx_v_F = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftonew", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19426, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftonew", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1098mftonew(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mf, __pyx_v_F);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1098mftonew(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mf, PyObject *__pyx_v_F) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftonew", 0);
  __Pyx_INCREF(__pyx_v_mf);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":19445
 *             %4 = [0, 0, -160, 0, 0, 0, 0, 0, 0, 0, -14400]
 *         '''
 *         mf = objtogen(mf)             # <<<<<<<<<<<<<<
 *         F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19446
 *         '''
 *         mf = objtogen(mf)
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19447
 *         mf = objtogen(mf)
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19447, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19448
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftonew(_mf, _F)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19449
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftonew(_mf, _F)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19450
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftonew(_mf, _F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftonew(__pyx_v__mf, __pyx_v__F);

  /* "cypari/auto_instance.pxi":19451
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftonew(_mf, _F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftraceform(self, NK, long space=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19426
 *         return new_gen(_ret)
 * 
 *     def mftonew(self, mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being being a full or cuspidal space with parameters :math:`[N,k,\chi]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftonew", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mf);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19453
 *         return new_gen(_ret)
 * 
 *     def mftraceform(self, NK, long space=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI,.]` as in :literal:`mfinit` with :math:`k` integral, gives the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1101mftraceform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1100mftraceform[] = "\n        If :math:`NK = [N,k,CHI,.]` as in :literal:`mfinit` with :math:`k` integral, gives the\n        trace form in the corresponding subspace of :math:`S_k(\\Gamma_0(N),\\chi)`.\n        The supported values for :literal:`space` are 0: the newspace (default),\n        1: the full cuspidal space.\n        \n        ::\n        \n            ? F = mftraceform([23,2]); mfcoefs(F,16)\n            %1 = [0, 2, -1, 0, -1, -2, -5, 2, 0, 4, 6, -6, 5, 6, 4, -10, -3]\n            ? F = mftraceform([23,1,-23]); mfcoefs(F,16)\n            %2 = [0, 1, -1, -1, 0, 0, 1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1101mftraceform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_NK = 0;
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftraceform (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_NK,&__pyx_n_s_space,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_NK)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftraceform") < 0)) __PYX_ERR(4, 19453, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_NK = values[0];
    if (values[1]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19453, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftraceform", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftraceform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1100mftraceform(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_NK, __pyx_v_space);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1100mftraceform(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftraceform", 0);
  __Pyx_INCREF(__pyx_v_NK);

  /* "cypari/auto_instance.pxi":19467
 *             %2 = [0, 1, -1, -1, 0, 0, 1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1]
 *         '''
 *         NK = objtogen(NK)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_NK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_NK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19468
 *         '''
 *         NK = objtogen(NK)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mftraceform(_NK, space)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19468, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19469
 *         NK = objtogen(NK)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftraceform(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19470
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mftraceform(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftraceform(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_instance.pxi":19471
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mftraceform(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftwist(self, F, D):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19453
 *         return new_gen(_ret)
 * 
 *     def mftraceform(self, NK, long space=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI,.]` as in :literal:`mfinit` with :math:`k` integral, gives the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftraceform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_NK);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19473
 *         return new_gen(_ret)
 * 
 *     def mftwist(self, F, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, returns the twist of :math:`F` by the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1103mftwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1102mftwist[] = "\n        :math:`F` being a generalized modular form, returns the twist of :math:`F` by the\n        integer :math:`D`, i.e., the form :math:`G` such that\n        :literal:`mfcoef(G,n) = `:math:`(D/n)`:literal:`mfcoef(F,n)`, where :math:`(D/n)` is the Kronecker\n        symbol.\n        \n        ::\n        \n            ? mf = mfinit([11,2],0); F = mfbasis(mf)[1]; mfcoefs(F, 5)\n            %1 = [0, 1, -2, -1, 2, 1]\n            ? G = mftwist(F,-3); mfcoefs(G, 5)\n            %2 = [0, 1, 2, 0, 2, -1]\n            ? mf2 = mfinit([99,2],0); mftobasis(mf2, G)\n            %3 = [1/3, 0, 1/3, 0]~\n        \n        Note that twisting multiplies the level by :math:`D^2`. In\n        particular it is not an involution:\n        \n        ::\n        \n            ? H = mftwist(G,-3); mfcoefs(H, 5)\n            %4 = [0, 1, -2, 0, 2, 1]\n            ? mfparams(G)\n            %5 = [99, 2, 1, y]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1103mftwist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftwist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_D,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_F)) != 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_D)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mftwist", 1, 2, 2, 1); __PYX_ERR(4, 19473, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftwist") < 0)) __PYX_ERR(4, 19473, __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_F = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftwist", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19473, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1102mftwist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1102mftwist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_D) {
  GEN __pyx_v__F;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftwist", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":19499
 *             %5 = [99, 2, 1, y]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19500
 *         '''
 *         F = objtogen(F)
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19501
 *         F = objtogen(F)
 *         D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19501, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19502
 *         D = objtogen(D)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = mftwist(_F, _D)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19503
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftwist(_F, _D)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19504
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = mftwist(_F, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftwist(__pyx_v__F, __pyx_v__D);

  /* "cypari/auto_instance.pxi":19505
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = mftwist(_F, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def min(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19473
 *         return new_gen(_ret)
 * 
 *     def mftwist(self, F, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, returns the twist of :math:`F` by the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mftwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19507
 *         return new_gen(_ret)
 * 
 *     def min(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1105min(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1104min[] = "\n        Creates the maximum of :math:`x` and :math:`y` when they can be compared.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1105min(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("min (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("min", 1, 2, 2, 1); __PYX_ERR(4, 19507, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "min") < 0)) __PYX_ERR(4, 19507, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("min", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19507, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1104min(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1104min(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("min", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":19511
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19512
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19513
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19513, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19514
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmin(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19515
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmin(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19516
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmin(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmin(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":19517
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmin(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def minpoly(self, A, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19507
 *         return new_gen(_ret)
 * 
 *     def min(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19519
 *         return new_gen(_ret)
 * 
 *     def minpoly(self, A, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         minimal polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1107minpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1106minpoly[] = "\n        minimal polynomial\n        of :math:`A` with respect to the variable :math:`v`., i.e. the monic polynomial :math:`P`\n        of minimal degree (in the variable :math:`v`) such that :math:`P(A) = 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1107minpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minpoly") < 0)) __PYX_ERR(4, 19519, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("minpoly", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19519, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.minpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1106minpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1106minpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("minpoly", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":19525
 *         of minimal degree (in the variable :math:`v`) such that :math:`P(A) = 0`.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19526
 *         '''
 *         A = objtogen(A)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":19527
 *         A = objtogen(A)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":19528
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 19528, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":19527
 *         A = objtogen(A)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":19529
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = minpoly(_A, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 19529, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19530
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = minpoly(_A, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_6;

  /* "cypari/auto_instance.pxi":19531
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = minpoly(_A, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = minpoly(__pyx_v__A, __pyx_v__v);

  /* "cypari/auto_instance.pxi":19532
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = minpoly(_A, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def modreverse(self, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19519
 *         return new_gen(_ret)
 * 
 *     def minpoly(self, A, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         minimal polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.minpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19534
 *         return new_gen(_ret)
 * 
 *     def modreverse(self, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`z = Mod(A, T)` be a polmod, and :math:`Q` be its minimal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1109modreverse(PyObject *__pyx_v_self, PyObject *__pyx_v_z); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1108modreverse[] = "\n        Let :math:`z = Mod(A, T)` be a polmod, and :math:`Q` be its minimal\n        polynomial, which must satisfy :math:`deg(Q) = deg(T)`.\n        Returns a \"reverse polmod\" :literal:`Mod(B, Q)`, which is a root of :math:`T`.\n        \n        This is quite useful when one changes the generating element in algebraic\n        extensions:\n        \n        ::\n        \n            ? u = Mod(x, x^3 - x -1); v = u^5;\n            ? w = modreverse(v)\n            %2 = Mod(x^2 - 4*x + 1, x^3 - 5*x^2 + 4*x - 1)\n        \n        which means that :math:`x^3 - 5x^2 + 4x -1` is another defining polynomial for the\n        cubic field\n        \n        .. MATH::\n        \n            \\mathbb{Q} (u) = \\mathbb{Q}[x]/(x^3 - x - 1) = \\mathbb{Q}[x]/(x^3 - 5x^2 + 4x - 1) = \\mathbb{Q} (v),\n        \n        and that :math:`u \\to v^2 - 4v + 1` gives an explicit isomorphism. From this, it is\n        easy to convert elements between the :math:`A(u)\\in \\mathbb{Q} (u)` and :math:`B(v)\\in \\mathbb{Q} (v)`\n        representations:\n        \n        ::\n        \n            ? A = u^2 + 2*u + 3; subst(lift(A), 'x, w)\n            %3 = Mod(x^2 - 3*x + 3, x^3 - 5*x^2 + 4*x - 1)\n            ? B = v^2 + v + 1; subst(lift(B), 'x, v)\n            %4 = Mod(26*x^2 + 31*x + 26, x^3 - x - 1)\n        \n        If the minimal polynomial of :math:`z` has lower degree than expected, the routine\n        fails\n        \n        ::\n        \n            ? u = Mod(-x^3 + 9*x, x^4 - 10*x^2 + 1)\n            ? modreverse(u)\n             *** modreverse: domain error in modreverse: deg(minpoly(z)) < 4\n             *** Break loop: type 'break' to go back to GP prompt\n            break> Vec( dbg_err() ) \\\\ ask for more info\n            [\"e_DOMAIN\", \"modreverse\", \"deg(minpoly(z))\", \"<\", 4,\n             Mod(-x^3 + 9*x, x^4 - 10*x^2 + 1)]\n            break> minpoly(u)\n            x^2 - 8\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1109modreverse(PyObject *__pyx_v_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("modreverse (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1108modreverse(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_z));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1108modreverse(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_z) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("modreverse", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":19582
 *             x^2 - 8
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19583
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = modreverse(_z)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19583, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19584
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = modreverse(_z)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19585
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = modreverse(_z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = modreverse(__pyx_v__z);

  /* "cypari/auto_instance.pxi":19586
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = modreverse(_z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def moebius(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19534
 *         return new_gen(_ret)
 * 
 *     def modreverse(self, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`z = Mod(A, T)` be a polmod, and :math:`Q` be its minimal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.modreverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19588
 *         return new_gen(_ret)
 * 
 *     def moebius(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Moebius :math:`\mu`-function of :math:`\|x\|`; :math:`x` must be a non-zero integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1111moebius(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1110moebius[] = "\n        Moebius :math:`\\mu`-function of :math:`\\|x\\|`; :math:`x` must be a non-zero integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1111moebius(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("moebius (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1110moebius(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1110moebius(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("moebius", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":19592
 *         Moebius :math:`\mu`-function of :math:`\|x\|`; :math:`x` must be a non-zero integer.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19593
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = moebius(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19593, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19594
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = moebius(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19595
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = moebius(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = moebius(__pyx_v__x);

  /* "cypari/auto_instance.pxi":19596
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = moebius(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":19597
 *         cdef long _ret = moebius(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def msatkinlehner(self, M, long Q, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19588
 *         return new_gen(_ret)
 * 
 *     def moebius(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Moebius :math:`\mu`-function of :math:`\|x\|`; :math:`x` must be a non-zero integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.moebius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19599
 *         return _ret
 * 
 *     def msatkinlehner(self, M, long Q, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a full modular symbol space of level :math:`N`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1113msatkinlehner(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1112msatkinlehner[] = "\n        Let :math:`M` be a full modular symbol space of level :math:`N`,\n        as given by :literal:`msinit`, let :math:`Q \\| N`, :math:`(Q,N/Q) = 1`,\n        and let :math:`H` be a subspace stable under the Atkin-Lehner involution :math:`w_Q`.\n        Return the matrix of :math:`w_Q` acting on :math:`H` (:math:`M` if omitted).\n        \n        ::\n        \n            ? M = msinit(36,2); \\\\ M_2(Gamma_0(36))\n            ? w = msatkinlehner(M,4); w^2 == 1\n            %2 = 1\n            ? #w \\\\ involution acts on a 13-dimensional space\n            %3 = 13\n            ? M = msinit(36,2, -1); \\\\ M_2(Gamma_0(36))^-\n            ? w = msatkinlehner(M,4); w^2 == 1\n            %5 = 1\n            ? #w\n            %6 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1113msatkinlehner(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_Q;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msatkinlehner (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_Q,&__pyx_n_s_H,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_M)) != 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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msatkinlehner", 0, 2, 3, 1); __PYX_ERR(4, 19599, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msatkinlehner") < 0)) __PYX_ERR(4, 19599, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_M = values[0];
    __pyx_v_Q = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_Q == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19599, __pyx_L3_error)
    __pyx_v_H = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msatkinlehner", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19599, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msatkinlehner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1112msatkinlehner(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_Q, __pyx_v_H);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1112msatkinlehner(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_Q, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("msatkinlehner", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":19619
 *             %6 = 4
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19620
 *         '''
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":19621
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19622
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19622, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":19621
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":19623
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 19623, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19624
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19625
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":19626
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19627
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_instance.pxi":19626
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 */
  }

  /* "cypari/auto_instance.pxi":19628
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msatkinlehner(__pyx_v__M, __pyx_v_Q, __pyx_v__H);

  /* "cypari/auto_instance.pxi":19629
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mscuspidal(self, M, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19599
 *         return _ret
 * 
 *     def msatkinlehner(self, M, long Q, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a full modular symbol space of level :math:`N`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msatkinlehner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19631
 *         return new_gen(_ret)
 * 
 *     def mscuspidal(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1115mscuspidal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1114mscuspidal[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return its cuspidal part :math:`S`. If :math:`flag = 1`, return\n        :math:`[S,E]` its decomposition into cuspidal and Eisenstein parts.\n        \n        A subspace is given by a structure allowing quick projection and\n        restriction of linear operators; its first component is\n        a matrix with integer coefficients whose columns form a :math:`\\mathbb{Q}`-basis of\n        the subspace.\n        \n        ::\n        \n            ? M = msinit(2,8, 1); \\\\ M_8(Gamma_0(2))^+\n            ? [S,E] = mscuspidal(M, 1);\n            ? E[1] \\\\ 2-dimensional\n            %3 =\n            [0 -10]\n            \n            [0 -15]\n            \n            [0 -3]\n            \n            [1 0]\n            \n            ? S[1] \\\\ 1-dimensional\n            %4 =\n            [ 3]\n            \n            [30]\n            \n            [ 6]\n            \n            [-8]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1115mscuspidal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mscuspidal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_flag,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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mscuspidal") < 0)) __PYX_ERR(4, 19631, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19631, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mscuspidal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19631, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mscuspidal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1114mscuspidal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1114mscuspidal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mscuspidal", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":19666
 *             [-8]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19667
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mscuspidal(_M, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19667, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19668
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mscuspidal(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19669
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mscuspidal(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mscuspidal(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":19670
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mscuspidal(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msdim(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19631
 *         return new_gen(_ret)
 * 
 *     def mscuspidal(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mscuspidal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19672
 *         return new_gen(_ret)
 * 
 *     def msdim(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space or subspace, for instance
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1117msdim(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1116msdim[] = "\n        :math:`M` being a full modular symbol space or subspace, for instance\n        as given by :literal:`msinit` or :literal:`mscuspidal`, return\n        its dimension as a :math:`\\mathbb{Q}`-vector space.\n        \n        ::\n        \n            ? M = msinit(11,4); msdim(M)\n            %1 = 6\n            ? M = msinit(11,4,1); msdim(M)\n            %2 = 4 \\\\ dimension of the '+' part\n            ? [S,E] = mscuspidal(M,1);\n            ? [msdim(S), msdim(E)]\n            %4 = [2, 2]\n        \n        Note that :literal:`mfdim([N,k])` is going to be much faster if\n        you only need the dimension of the space and not really to work with it.\n        This function is only useful to quickly check the dimension of an existing\n        space.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1117msdim(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msdim (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1116msdim(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1116msdim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msdim", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":19693
 *         space.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19694
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msdim(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19694, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19695
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msdim(_M)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19696
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msdim(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msdim(__pyx_v__M);

  /* "cypari/auto_instance.pxi":19697
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msdim(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":19698
 *         cdef long _ret = msdim(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mseisenstein(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19672
 *         return new_gen(_ret)
 * 
 *     def msdim(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space or subspace, for instance
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19700
 *         return _ret
 * 
 *     def mseisenstein(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1119mseisenstein(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1118mseisenstein[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return its Eisenstein subspace.\n        A subspace is given by a structure allowing quick projection and\n        restriction of linear operators; its first component is\n        a matrix with integer coefficients whose columns form a :math:`\\mathbb{Q}`-basis of\n        the subspace.\n        This is the same basis as given by the second component of\n        :literal:`mscuspidal`:math:`(M, 1)`.\n        \n        ::\n        \n            ? M = msinit(2,8, 1); \\\\ M_8(Gamma_0(2))^+\n            ? E = mseisenstein(M);\n            ? E[1] \\\\ 2-dimensional\n            %3 =\n            [0 -10]\n            \n            [0 -15]\n            \n            [0 -3]\n            \n            [1 0]\n            \n            ? E == mscuspidal(M,1)[2]\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1119mseisenstein(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mseisenstein (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1118mseisenstein(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1118mseisenstein(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mseisenstein", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":19728
 *             %4 = 1
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19729
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mseisenstein(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19729, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19730
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mseisenstein(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19731
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mseisenstein(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mseisenstein(__pyx_v__M);

  /* "cypari/auto_instance.pxi":19732
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mseisenstein(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mseval(self, M, s, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19700
 *         return _ret
 * 
 *     def mseisenstein(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mseisenstein", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19734
 *         return new_gen(_ret)
 * 
 *     def mseval(self, M, s, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1 (\mathbb{Q}))`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1121mseval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1120mseval[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1 (\\mathbb{Q}))`.\n        Let :math:`M` be a full modular symbol space, as given by :literal:`msinit`,\n        let :math:`s` be a modular symbol from :math:`M`, i.e. an element\n        of :math:`\\text{Hom}_G(\\Delta, V)`, and let :math:`p = [a,b] \\in \\Delta` be a path between\n        two elements in :math:`\\mathbb{P}^1(\\mathbb{Q})`, return :math:`s(p)\\in V`. The path extremities :math:`a` and\n        :math:`b` may be given as :literal:`t_INT`, :literal:`t_FRAC` or :math:`oo = (1:0)`; it\n        is also possible to describe the path by a :math:`2 x 2` integral matrix\n        whose columns give the two cusps. The symbol :math:`s` is either\n        \n        - a :literal:`t_COL` coding a modular symbol in terms of\n          the fixed basis of :math:`\\text{Hom}_G(\\Delta,V)` chosen in :math:`M`; if :math:`M` was\n          initialized with a non-zero :emphasis:`sign` (:math:`+` or :math:`-`), then either the\n          basis for the full symbol space or the :math:`\302\261`-part can be used (the dimension\n          being used to distinguish the two).\n        \n        - a :literal:`t_MAT` whose columns encode modular symbols as above. This is\n          much faster than evaluating individual symbols on the same path :math:`p`\n          independently.\n        \n        - a :literal:`t_VEC` :math:`(v_i)` of elements of :math:`V`, where the :math:`v_i = s(g_i)` give\n          the image of the generators :math:`g_i` of :math:`\\Delta`, see :literal:`mspathgens`.\n          We assume that :math:`s` is a proper symbol, i.e.\302\240that the :math:`v_i` satisfy\n          the :literal:`mspathgens` relations.\n        \n        If :math:`p` is omitted, convert a single symbol :math:`s` to the second form: a vector\n        of the :math:`s(g_i)`. A :literal:`t_MAT` is converted to a vector of such.\n        \n        ::\n        \n            ? M = msinit(2,8,1); \\\\ M_8(Gamma_0(2))^+\n            ? g = mspa""thgens(M)[1]\n            %2 = [[+oo, 0], [0, 1]]\n            ? N = msnew(M)[1]; #N \\\\ Q-basis of new subspace, dimension 1\n            %3 = 1\n            ? s = N[,1] \\\\ t_COL representation\n            %4 = [-3, 6, -8]~\n            ? S = mseval(M, s) \\\\ t_VEC representation\n            %5 = [64*x^6-272*x^4+136*x^2-8, 384*x^5+960*x^4+192*x^3-672*x^2-432*x-72]\n            ? mseval(M,s, g[1])\n            %6 = 64*x^6 - 272*x^4 + 136*x^2 - 8\n            ? mseval(M,S, g[1])\n            %7 = 64*x^6 - 272*x^4 + 136*x^2 - 8\n        \n        Note that the symbol should have values in\n        :math:`V = \\mathbb{Q}[x,y]_{k-2}`, we return the de-homogenized values corresponding to :math:`y\n        = 1` instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1121mseval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mseval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_s,&__pyx_n_s_p,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_M)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mseval", 0, 2, 3, 1); __PYX_ERR(4, 19734, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mseval") < 0)) __PYX_ERR(4, 19734, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_M = values[0];
    __pyx_v_s = values[1];
    __pyx_v_p = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mseval", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19734, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1120mseval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_s, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1120mseval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_s, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__M;
  GEN __pyx_v__s;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mseval", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":19783
 *         = 1` instead.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19784
 *         '''
 *         M = objtogen(M)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19785
 *         M = objtogen(M)
 *         s = objtogen(s)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":19786
 *         s = objtogen(s)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19787
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":19786
 *         s = objtogen(s)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":19788
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 19788, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19789
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19790
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19791
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":19792
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19793
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mseval(_M, _s, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":19792
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)
 */
  }

  /* "cypari/auto_instance.pxi":19794
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mseval(__pyx_v__M, __pyx_v__s, __pyx_v__p);

  /* "cypari/auto_instance.pxi":19795
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msfromcusp(self, M, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19734
 *         return new_gen(_ret)
 * 
 *     def mseval(self, M, s, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1 (\mathbb{Q}))`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19797
 *         return new_gen(_ret)
 * 
 *     def msfromcusp(self, M, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the modular symbol attached to the cusp
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1123msfromcusp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1122msfromcusp[] = "\n        Returns the modular symbol attached to the cusp\n        :math:`c`, where :math:`M` is a modular symbol space of level :math:`N`, attached to\n        :math:`G = \\Gamma_0(N)`. The cusp :math:`c` in :math:`\\mathbb{P}^1(\\mathbb{Q})/G` is given either as :literal:`oo`\n        (:math:`= (1:0)`) or as a rational number :math:`a/b` (:math:`= (a:b)`). The attached symbol maps\n        the path :math:`[b] - [a] \\in Div^0 (\\mathbb{P}^1(\\mathbb{Q}))` to :math:`E_c(b) - E_c(a)`, where\n        :math:`E_c(r)` is :math:`0` when :math:`r != c` and :math:`X^{k-2} \\| \\gamma_r` otherwise, where\n        :math:`\\gamma_r.r = (1:0)`. These symbols span the Eisenstein subspace\n        of :math:`M`.\n        \n        ::\n        \n            ? M = msinit(2,8); \\\\ M_8(Gamma_0(2))\n            ? E = mseisenstein(M);\n            ? E[1] \\\\ two-dimensional\n            %3 =\n            [0 -10]\n            \n            [0 -15]\n            \n            [0 -3]\n            \n            [1 0]\n            \n            ? s = msfromcusp(M,oo)\n            %4 = [0, 0, 0, 1]~\n            ? mseval(M, s)\n            %5 = [1, 0]\n            ? s = msfromcusp(M,1)\n            %6 = [-5/16, -15/32, -3/32, 0]~\n            ? mseval(M,s)\n            %7 = [-x^6, -6*x^5 - 15*x^4 - 20*x^3 - 15*x^2 - 6*x - 1]\n        \n        In case :math:`M` was initialized with a non-zero :emphasis:`sign`, the symbol is given\n        in terms of the fixed basis of the whole symbol space, not the :math:`+` or :math:`-`\n        part (to which it need not belong).\n        \n        ::\n        \n            ? M = msinit(2,8, 1); \\\\ M_8(Gamma_0(2))^+\n            ? E = mseisenstein(M);\n            ? E[1] \\\\ still two-dimensional, in a smaller space\n            %3 =\n            [ 0 -10]\n            \n            [ 0 3]\n            \n            [-1 0]\n            \n            ? s = msfromcusp(M,oo) \\\\ in terms of the basis for M_8(Gamma_0(2)) !\n            %4 = [0, 0, 0, 1]""~\n            ? mseval(M, s) \\\\ same symbol as before\n            %5 = [1, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1123msfromcusp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_c = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msfromcusp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_c,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_M)) != 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_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msfromcusp", 1, 2, 2, 1); __PYX_ERR(4, 19797, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msfromcusp") < 0)) __PYX_ERR(4, 19797, __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_M = values[0];
    __pyx_v_c = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msfromcusp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19797, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msfromcusp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1122msfromcusp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_c);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1122msfromcusp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_c) {
  GEN __pyx_v__M;
  GEN __pyx_v__c;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msfromcusp", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_c);

  /* "cypari/auto_instance.pxi":19852
 *             %5 = [1, 0]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         c = objtogen(c)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19853
 *         '''
 *         M = objtogen(M)
 *         c = objtogen(c)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19854
 *         M = objtogen(M)
 *         c = objtogen(c)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _c = (<Gen>c).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19854, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19855
 *         c = objtogen(c)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = msfromcusp(_M, _c)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19856
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _c = (<Gen>c).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msfromcusp(_M, _c)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c)->__pyx_base.g;
  __pyx_v__c = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19857
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = msfromcusp(_M, _c)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msfromcusp(__pyx_v__M, __pyx_v__c);

  /* "cypari/auto_instance.pxi":19858
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = msfromcusp(_M, _c)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msfromell(self, E, long sign=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19797
 *         return new_gen(_ret)
 * 
 *     def msfromcusp(self, M, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the modular symbol attached to the cusp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msfromcusp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19860
 *         return new_gen(_ret)
 * 
 *     def msfromell(self, E, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve of conductor :math:`N`. For :math:`\varepsilon =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1125msfromell(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1124msfromell[] = "\n        Let :math:`E/\\mathbb{Q}` be an elliptic curve of conductor :math:`N`. For :math:`\\varepsilon =\n        \302\2611`, we define the (cuspidal, new) modular symbol :math:`x^\\varepsilon` in\n        :math:`H^1_c(X_0(N),\\mathbb{Q})^\\varepsilon` attached to\n        :math:`E`. For all primes :math:`p` not dividing :math:`N` we have\n        :math:`T_p(x^\\varepsilon) = a_p x^\\varepsilon`, where :math:`a_p = p+1-\\#E(\\mathbb{F}_p)`.\n        \n        Let :math:`\\Omega^ += E.omega[1]` be the real period of :math:`E`\n        (integration of the N\303\251ron differential :math:`dx/(2y+a_1x+a3)` on the connected\n        component of :math:`E(\\mathbb{R})`, i.e.\302\240the generator of :math:`H_1(E,\\mathbb{Z})^+`) normalized by\n        :math:`\\Omega^+ > 0`. Let :math:`i\\Omega^-` the integral on a generator of :math:`H_1(E,\\mathbb{Z})^-` with\n        :math:`\\Omega^- \\in \\mathbb{R}_{ > 0}`. If :math:`c_ oo` is the number of connected components of\n        :math:`E(\\mathbb{R})`, :math:`\\Omega^-` is equal to :math:`(-2/c_ oo ) x imag(E.omega[2])`.\n        The complex modular symbol is defined by\n        \n        .. MATH::\n        \n            F: \\delta \\to 2i\\pi \\int_{\\delta} f(z) dz\n        \n        The modular symbols :math:`x^\\varepsilon` are normalized so that\n        :math:`F = x^+ \\Omega^+ + x^- i\\Omega^-`. In particular, we have\n        \n        .. MATH::\n        \n            x^+([0]-[ oo ]) = L(E,1) / \\Omega^+,\n        \n        which defines :math:`x^{\302\261}` unless :math:`L(E,1) = 0`. Furthermore, for all fundamental\n        discriminants :math:`D` such that :math:`\\varepsilon.D > 0`, we also have\n        \n        .. MATH::\n        \n            \\sum_{0 <= a < \\|D\\|} (D\\|a) x^\\varepsilon ([a/\\|D\\|]-[ oo ])\n            = L(E,(D\\|.),1) / \\Omega^{\\varepsilon},\n        \n        where :math:`(D\\|.)` is the Kronecker symbol. The period :math:`\\Omega^-` is also\n        :math:`2/c_ oo x` the real perio""d of the twist\n        :math:`E^{(-4)} = elltwist(E,-4)`.\n        \n        This function returns the pair :math:`[M, x]`, where :math:`M` is\n        :literal:`msinit`:math:`(N,2)` and :math:`x` is :math:`x^{sign}` as above when :math:`sign =\n        \302\2611`, and :math:`x = [x^+,x^-, L_E]` when :emphasis:`sign` is :math:`0`, where :math:`L_E`\n        is a matrix giving the canonical :math:`\\mathbb{Z}`-lattice attached to :math:`E` in the sense\n        of :literal:`mslattice` applied to :math:`\\mathbb{Q} x^+ + \\mathbb{Q} x^-`. Explicitly, it\n        is generated by :math:`(x^{+},x^{-})` when :math:`E(\\mathbb{R})` has two connected components\n        and by :math:`(x^{+} - x^{-},2x^-)` otherwise.\n        \n        The modular symbols :math:`x^\302\261` are given as a :literal:`t_COL` (in terms\n        of the fixed basis of :math:`\\text{Hom}_G(\\Delta,\\mathbb{Q})` chosen in :math:`M`).\n        \n        ::\n        \n            ? E=ellinit([0,-1,1,-10,-20]); \\\\ X_0(11)\n            ? [M,xp]= msfromell(E,1);\n            ? xp\n            %3 = [1/5, -1/2, -1/2]~\n            ? [M,x]= msfromell(E);\n            ? x \\\\ x^+, x^- and L_E\n            %5 = [[1/5, -1/2, -1/2]~, [0, 1/2, -1/2]~, [1/5, 0; -1, 1; 0, -1]]\n            ? p = 23; (mshecke(M,p) - ellap(E,p))*x[1]\n            %6 = [0, 0, 0]~ \\\\ true at all primes, including p = 11; same for x[2]\n            ? (mshecke(M,p) - ellap(E,p))*x[3] == 0\n            %7 = 1\n        \n        Instead of a single curve :math:`E`, one may use instead a vector\n        of :emphasis:`isogenous` curves. The function then returns :math:`M` and the\n        vector of attached modular symbols.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1125msfromell(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_E = 0;
  long __pyx_v_sign;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msfromell (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_E,&__pyx_n_s_sign,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_E)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sign);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msfromell") < 0)) __PYX_ERR(4, 19860, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_E = values[0];
    if (values[1]) {
      __pyx_v_sign = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_sign == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 19860, __pyx_L3_error)
    } else {
      __pyx_v_sign = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msfromell", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19860, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msfromell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1124msfromell(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_E, __pyx_v_sign);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1124msfromell(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_E, long __pyx_v_sign) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msfromell", 0);
  __Pyx_INCREF(__pyx_v_E);

  /* "cypari/auto_instance.pxi":19928
 *         vector of attached modular symbols.
 *         '''
 *         E = objtogen(E)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_E, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_E, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19929
 *         '''
 *         E = objtogen(E)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = msfromell(_E, sign)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19929, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19930
 *         E = objtogen(E)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msfromell(_E, sign)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19931
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = msfromell(_E, sign)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msfromell(__pyx_v__E, __pyx_v_sign);

  /* "cypari/auto_instance.pxi":19932
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = msfromell(_E, sign)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msfromhecke(self, M, v, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19860
 *         return new_gen(_ret)
 * 
 *     def msfromell(self, E, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve of conductor :math:`N`. For :math:`\varepsilon =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msfromell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19934
 *         return new_gen(_ret)
 * 
 *     def msfromhecke(self, M, v, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a msinit :math:`M` and a vector :math:`v` of pairs :math:`[p, P]` (where :math:`p` is prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1127msfromhecke(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1126msfromhecke[] = "\n        Given a msinit :math:`M` and a vector :math:`v` of pairs :math:`[p, P]` (where :math:`p` is prime\n        and :math:`P` is a polynomial with integer coefficients), return a basis of all\n        modular symbols such that :math:`P(T_p)(s) = 0`. If :math:`H` is present, it must\n        be a Hecke-stable subspace and we restrict to :math:`s \\in H`. When :math:`T_p` has\n        a rational eigenvalue and :math:`P(x) = x-a_p` has degree :math:`1`, we also accept the\n        integer :math:`a_p` instead of :math:`P`.\n        \n        ::\n        \n            ? E = ellinit([0,-1,1,-10,-20]) \\\\11a1\n            ? ellap(E,2)\n            %2 = -2\n            ? ellap(E,3)\n            %3 = -1\n            ? M = msinit(11,2);\n            ? S = msfromhecke(M, [[2,-2],[3,-1]])\n            %5 =\n            [ 1 1]\n            \n            [-5 0]\n            \n            [ 0 -5]\n            ? mshecke(M, 2, S)\n            %6 =\n            [-2 0]\n            \n            [ 0 -2]\n            \n            ? M = msinit(23,4);\n            ? S = msfromhecke(M, [[5, x^4-14*x^3-244*x^2+4832*x-19904]]);\n            ? factor( charpoly(mshecke(M,5,S)) )\n            %9 =\n            [x^4 - 14*x^3 - 244*x^2 + 4832*x - 19904 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1127msfromhecke(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msfromhecke (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_v,&__pyx_n_s_H,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_M)) != 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_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msfromhecke", 0, 2, 3, 1); __PYX_ERR(4, 19934, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msfromhecke") < 0)) __PYX_ERR(4, 19934, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_M = values[0];
    __pyx_v_v = values[1];
    __pyx_v_H = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msfromhecke", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 19934, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msfromhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1126msfromhecke(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_v, __pyx_v_H);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1126msfromhecke(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_v, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__v;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("msfromhecke", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":19970
 *             [x^4 - 14*x^3 - 244*x^2 + 4832*x - 19904 2]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         cdef bint _have_H = (H is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19971
 *         '''
 *         M = objtogen(M)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19972
 *         M = objtogen(M)
 *         v = objtogen(v)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":19973
 *         v = objtogen(v)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19974
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":19973
 *         v = objtogen(v)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":19975
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 19975, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19976
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19977
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_4;

  /* "cypari/auto_instance.pxi":19978
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":19979
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":19980
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_instance.pxi":19979
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 */
  }

  /* "cypari/auto_instance.pxi":19981
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msfromhecke(__pyx_v__M, __pyx_v__v, __pyx_v__H);

  /* "cypari/auto_instance.pxi":19982
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msgetlevel(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19934
 *         return new_gen(_ret)
 * 
 *     def msfromhecke(self, M, v, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a msinit :math:`M` and a vector :math:`v` of pairs :math:`[p, P]` (where :math:`p` is prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msfromhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19984
 *         return new_gen(_ret)
 * 
 *     def msgetlevel(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1129msgetlevel(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1128msgetlevel[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return\n        its level :math:`N`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1129msgetlevel(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msgetlevel (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1128msgetlevel(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1128msgetlevel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msgetlevel", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":19989
 *         its level :math:`N`.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":19990
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetlevel(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 19990, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":19991
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msgetlevel(_M)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":19992
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetlevel(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msgetlevel(__pyx_v__M);

  /* "cypari/auto_instance.pxi":19993
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetlevel(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":19994
 *         cdef long _ret = msgetlevel(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def msgetsign(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 19994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19984
 *         return new_gen(_ret)
 * 
 *     def msgetlevel(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msgetlevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":19996
 *         return _ret
 * 
 *     def msgetsign(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1131msgetsign(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1130msgetsign[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return\n        its sign: :math:`\302\2611` or 0 (unset).\n        \n        ::\n        \n            ? M = msinit(11,4, 1);\n            ? msgetsign(M)\n            %2 = 1\n            ? M = msinit(11,4);\n            ? msgetsign(M)\n            %4 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1131msgetsign(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msgetsign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1130msgetsign(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1130msgetsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msgetsign", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":20010
 *             %4 = 0
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20011
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetsign(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20011, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20012
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msgetsign(_M)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20013
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetsign(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msgetsign(__pyx_v__M);

  /* "cypari/auto_instance.pxi":20014
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetsign(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":20015
 *         cdef long _ret = msgetsign(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def msgetweight(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":19996
 *         return _ret
 * 
 *     def msgetsign(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msgetsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20017
 *         return _ret
 * 
 *     def msgetweight(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1133msgetweight(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1132msgetweight[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return\n        its weight :math:`k`.\n        \n        ::\n        \n            ? M = msinit(11,4);\n            ? msgetweight(M)\n            %2 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1133msgetweight(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msgetweight (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1132msgetweight(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1132msgetweight(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msgetweight", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":20028
 *             %2 = 4
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20029
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetweight(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20029, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20030
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msgetweight(_M)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20031
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetweight(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msgetweight(__pyx_v__M);

  /* "cypari/auto_instance.pxi":20032
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetweight(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":20033
 *         cdef long _ret = msgetweight(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mshecke(self, M, long p, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20017
 *         return _ret
 * 
 *     def msgetweight(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msgetweight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20035
 *         return _ret
 * 
 *     def mshecke(self, M, long p, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1135mshecke(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1134mshecke[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        :math:`p` being a prime number, and :math:`H` being a Hecke-stable subspace (:math:`M` if\n        omitted) return the matrix of :math:`T_p` acting on :math:`H`\n        (:math:`U_p` if :math:`p` divides :math:`N`). Result is undefined if :math:`H` is not stable\n        by :math:`T_p` (resp.\302\240:math:`U_p`).\n        \n        ::\n        \n            ? M = msinit(11,2); \\\\ M_2(Gamma_0(11))\n            ? T2 = mshecke(M,2)\n            %2 =\n            [3 0 0]\n            \n            [1 -2 0]\n            \n            [1 0 -2]\n            ? M = msinit(11,2, 1); \\\\ M_2(Gamma_0(11))^+\n            ? T2 = mshecke(M,2)\n            %4 =\n            [ 3 0]\n            \n            [-1 -2]\n            \n            ? N = msnew(M)[1] \\\\ Q-basis of new cuspidal subspace\n            %5 =\n            [-2]\n            \n            [-5]\n            \n            ? p = 1009; mshecke(M, p, N) \\\\ action of T_1009 on N\n            %6 =\n            [-10]\n            ? ellap(ellinit(\"11a1\"), p)\n            %7 = -10\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1135mshecke(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_p;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mshecke (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_p,&__pyx_n_s_H,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_M)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mshecke", 0, 2, 3, 1); __PYX_ERR(4, 20035, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mshecke") < 0)) __PYX_ERR(4, 20035, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_M = values[0];
    __pyx_v_p = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20035, __pyx_L3_error)
    __pyx_v_H = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mshecke", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20035, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mshecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1134mshecke(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_p, __pyx_v_H);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1134mshecke(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_p, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mshecke", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":20072
 *             %7 = -10
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20073
 *         '''
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":20074
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20075
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":20074
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":20076
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 20076, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20077
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":20078
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":20079
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20080
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mshecke(_M, p, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_instance.pxi":20079
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)
 */
  }

  /* "cypari/auto_instance.pxi":20081
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mshecke(__pyx_v__M, __pyx_v_p, __pyx_v__H);

  /* "cypari/auto_instance.pxi":20082
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msinit(self, G, V, long sign=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20035
 *         return _ret
 * 
 *     def mshecke(self, M, long p, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mshecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20084
 *         return new_gen(_ret)
 * 
 *     def msinit(self, G, V, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`G` a finite index subgroup of :math:`SL(2,\mathbb{Z})`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1137msinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1136msinit[] = "\n        Given :math:`G` a finite index subgroup of :math:`SL(2,\\mathbb{Z})`\n        and a finite dimensional representation :math:`V` of :math:`GL(2,\\mathbb{Q})`, creates a\n        space of modular symbols, the :math:`G`-module :math:`\\text{Hom}_G(Div^0(\\mathbb{P}^1\n        (\\mathbb{Q})), V)`. This is canonically isomorphic to :math:`H^1_c(X(G), V)`, and allows to\n        compute modular forms for :math:`G`. If :emphasis:`sign` is present and non-zero, it\n        must be :math:`\302\2611` and we consider the subspace defined by :math:`Ker (\\sigma -\n        sign)`, where :math:`\\sigma` is induced by :literal:`[-1,0;0,1]`. Currently the\n        only supported groups are the :math:`\\Gamma_0(N)`, coded by the integer :math:`N > 0`.\n        The only supported representation is :math:`V_k = \\mathbb{Q}[X,Y]_{k-2}`, coded by the\n        integer :math:`k >= 2`.\n        \n        ::\n        \n            ? M = msinit(11,2); msdim(M) \\\\ Gamma0(11), weight 2\n            %1 = 3\n            ? mshecke(M,2) \\\\ T_2 acting on M\n            %2 =\n            [3 1 1]\n            \n            [0 -2 0]\n            \n            [0 0 -2]\n            ? msstar(M) \\\\ * involution\n            %3 =\n            [1 0 0]\n            \n            [0 0 1]\n            \n            [0 1 0]\n            \n            ? Mp = msinit(11,2, 1); msdim(Mp) \\\\ + part\n            %4 = 2\n            ? mshecke(Mp,2) \\\\ T_2 action on M^+\n            %5 =\n            [3 2]\n            \n            [0 -2]\n            ? msstar(Mp)\n            %6 =\n            [1 0]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1137msinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_V = 0;
  long __pyx_v_sign;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_V,&__pyx_n_s_sign,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G)) != 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_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msinit", 0, 2, 3, 1); __PYX_ERR(4, 20084, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sign);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msinit") < 0)) __PYX_ERR(4, 20084, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_G = values[0];
    __pyx_v_V = values[1];
    if (values[2]) {
      __pyx_v_sign = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_sign == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20084, __pyx_L3_error)
    } else {
      __pyx_v_sign = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msinit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20084, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1136msinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_V, __pyx_v_sign);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1136msinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_V, long __pyx_v_sign) {
  GEN __pyx_v__G;
  GEN __pyx_v__V;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msinit", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_V);

  /* "cypari/auto_instance.pxi":20129
 *             [0 1]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         V = objtogen(V)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20130
 *         '''
 *         G = objtogen(G)
 *         V = objtogen(V)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_V, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_V, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20131
 *         G = objtogen(G)
 *         V = objtogen(V)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20131, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20132
 *         V = objtogen(V)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = msinit(_G, _V, sign)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20133
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msinit(_G, _V, sign)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20134
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = msinit(_G, _V, sign)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msinit(__pyx_v__G, __pyx_v__V, __pyx_v_sign);

  /* "cypari/auto_instance.pxi":20135
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = msinit(_G, _V, sign)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msissymbol(self, M, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20084
 *         return new_gen(_ret)
 * 
 *     def msinit(self, G, V, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`G` a finite index subgroup of :math:`SL(2,\mathbb{Z})`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20137
 *         return new_gen(_ret)
 * 
 *     def msissymbol(self, M, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1139msissymbol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1138msissymbol[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        check whether :math:`s` is a modular symbol attached to :math:`M`. If :math:`A` is a matrix,\n        check whether its columns represent modular symbols and return a :math:`0-1`\n        vector.\n        \n        ::\n        \n            ? M = msinit(7,8, 1); \\\\ M_8(Gamma_0(7))^+\n            ? A = msnew(M)[1];\n            ? s = A[,1];\n            ? msissymbol(M, s)\n            %4 = 1\n            ? msissymbol(M, A)\n            %5 = [1, 1, 1]\n            ? S = mseval(M,s);\n            ? msissymbol(M, S)\n            %7 = 1\n            ? [g,R] = mspathgens(M); g\n            %8 = [[+oo, 0], [0, 1/2], [1/2, 1]]\n            ? #R \\\\ 3 relations among the generators g_i\n            %9 = 3\n            ? T = S; T[3]++; \\\\ randomly perturb S(g_3)\n            ? msissymbol(M, T)\n            %11 = 0 \\\\ no longer satisfies the relations\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1139msissymbol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msissymbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_s,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_M)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msissymbol", 1, 2, 2, 1); __PYX_ERR(4, 20137, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msissymbol") < 0)) __PYX_ERR(4, 20137, __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_M = values[0];
    __pyx_v_s = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msissymbol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msissymbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1138msissymbol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_s);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1138msissymbol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_s) {
  GEN __pyx_v__M;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msissymbol", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":20164
 *             %11 = 0 \\ no longer satisfies the relations
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20165
 *         '''
 *         M = objtogen(M)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20165, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20166
 *         M = objtogen(M)
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20166, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20167
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = msissymbol(_M, _s)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20168
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msissymbol(_M, _s)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20169
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = msissymbol(_M, _s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msissymbol(__pyx_v__M, __pyx_v__s);

  /* "cypari/auto_instance.pxi":20170
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = msissymbol(_M, _s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mslattice(self, M, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20170, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20137
 *         return new_gen(_ret)
 * 
 *     def msissymbol(self, M, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msissymbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20172
 *         return new_gen(_ret)
 * 
 *     def mslattice(self, M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))` and :math:`V_k = \mathbb{Q}[x,y]_{k-2}`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1141mslattice(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1140mslattice[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1(\\mathbb{Q}))` and :math:`V_k = \\mathbb{Q}[x,y]_{k-2}`.\n        Let :math:`M` be a full modular symbol space, as given by :literal:`msinit`\n        and let :math:`H` be a subspace, e.g. as given by :literal:`mscuspidal`.\n        This function returns a canonical :math:`\\mathbb{Z}`\n        structure on :math:`H` defined as follows.\n        Consider the map :math:`c: M = \\text{Hom}_{\\Gamma_0(N)}(\\Delta, V_k) \\to\n        H^1(\\Gamma_0(N), V_k)` given by\n        :math:`\\phi :--->class (\\gamma \\to \\phi ({0, \\gamma^{-1} 0}))`.\n        Let :math:`L_k = \\mathbb{Z}[x,y]_{k-2}` be the natural :math:`\\mathbb{Z}`-structure of :math:`V_k`. The result of\n        :literal:`mslattice` is a :math:`\\mathbb{Z}`-basis of the inverse image by :math:`c` of\n        :math:`H^1(\\Gamma_0(N), L_k)` in the space of modular symbols generated by :math:`H`.\n        \n        For user convenience, :math:`H` can be defined by a matrix representing the\n        :math:`\\mathbb{Q}`-basis of :math:`H` (in terms of the canonical :math:`\\mathbb{Q}`-basis of :math:`M` fixed by\n        :literal:`msinit` and used to represent modular symbols).\n        \n        If omitted, :math:`H` is the cuspidal part of :math:`M` as given by :literal:`mscuspidal`.\n        The Eisenstein part :math:`\\text{Hom}_{\\Gamma_0(N)}(Div(\\mathbb{P}^1(\\mathbb{Q})), V_k)` is in\n        the kernel of :math:`c`, so the result has no meaning for the Eisenstein part\n        :literal:`H`.\n        \n        ::\n        \n            ? M=msinit(11,2);\n            ? [S,E] = mscuspidal(M,1); S[1] \\\\ a primitive Q-basis of S\n            %2 =\n            [ 1 1]\n            [-5 0]\n            [ 0 -5]\n            ? mslattice(M,S)\n            %3 =\n            [-1/5 -1/5]\n            [ 1 0]\n            [ 0 1]\n            ? mslattice(M,E)\n            %4 =\n            [1]\n            [0]\n            [0]\n            ? M=msinit(5,4);\n           "" ? S=mscuspidal(M); S[1]\n            %6 =\n            [ 7 20]\n            [ 3 3]\n            [-10 -23]\n            [-30 -30]\n            ? mslattice(M,S)\n            %7 =\n            [-1/10 -11/130]\n            [ 0 -1/130]\n            [ 1/10 6/65]\n            [ 0 1/13]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1141mslattice(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mslattice (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_H,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mslattice") < 0)) __PYX_ERR(4, 20172, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    __pyx_v_H = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mslattice", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20172, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mslattice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1140mslattice(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_H);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1140mslattice(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mslattice", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":20227
 *             [ 0 1/13]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20228
 *         '''
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":20229
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20230
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":20229
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":20231
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 20231, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20232
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":20233
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":20234
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20235
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mslattice(_M, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_instance.pxi":20234
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)
 */
  }

  /* "cypari/auto_instance.pxi":20236
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mslattice(__pyx_v__M, __pyx_v__H);

  /* "cypari/auto_instance.pxi":20237
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msnew(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20172
 *         return new_gen(_ret)
 * 
 *     def mslattice(self, M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))` and :math:`V_k = \mathbb{Q}[x,y]_{k-2}`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mslattice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20239
 *         return new_gen(_ret)
 * 
 *     def msnew(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1143msnew(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1142msnew[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return the :emphasis:`new` part of its cuspidal subspace. A subspace is given by\n        a structure allowing quick projection and restriction of linear operators;\n        its first component is a matrix with integer coefficients whose columns form\n        a :math:`\\mathbb{Q}`-basis of the subspace.\n        \n        ::\n        \n            ? M = msinit(11,8, 1); \\\\ M_8(Gamma_0(11))^+\n            ? N = msnew(M);\n            ? #N[1] \\\\ 6-dimensional\n            %3 = 6\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1143msnew(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msnew (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1142msnew(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1142msnew(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msnew", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":20254
 *             %3 = 6
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20255
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = msnew(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20255, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20256
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msnew(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20257
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = msnew(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msnew(__pyx_v__M);

  /* "cypari/auto_instance.pxi":20258
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = msnew(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msomseval(self, Mp, PHI, path):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20239
 *         return new_gen(_ret)
 * 
 *     def msnew(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msnew", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20260
 *         return new_gen(_ret)
 * 
 *     def msomseval(self, Mp, PHI, path):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the vectors of moments of the :math:`p`-adic distribution attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1145msomseval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1144msomseval[] = "\n        Return the vectors of moments of the :math:`p`-adic distribution attached\n        to the path :literal:`path` by the overconvergent modular symbol :literal:`PHI`.\n        \n        ::\n        \n            ? M = msinit(3,6,1);\n            ? Mp= mspadicinit(M,5,10);\n            ? phi = [5,-3,-1]~;\n            ? msissymbol(M,phi)\n            %4 = 1\n            ? PHI = mstooms(Mp,phi);\n            ? ME = msomseval(Mp,PHI,[oo, 0]);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1145msomseval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Mp = 0;
  PyObject *__pyx_v_PHI = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msomseval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Mp,&__pyx_n_s_PHI,&__pyx_n_s_path,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Mp)) != 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_PHI)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msomseval", 1, 3, 3, 1); __PYX_ERR(4, 20260, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_path)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msomseval", 1, 3, 3, 2); __PYX_ERR(4, 20260, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msomseval") < 0)) __PYX_ERR(4, 20260, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_Mp = values[0];
    __pyx_v_PHI = values[1];
    __pyx_v_path = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msomseval", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20260, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msomseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1144msomseval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Mp, __pyx_v_PHI, __pyx_v_path);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1144msomseval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Mp, PyObject *__pyx_v_PHI, PyObject *__pyx_v_path) {
  GEN __pyx_v__Mp;
  GEN __pyx_v__PHI;
  GEN __pyx_v__path;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msomseval", 0);
  __Pyx_INCREF(__pyx_v_Mp);
  __Pyx_INCREF(__pyx_v_PHI);
  __Pyx_INCREF(__pyx_v_path);

  /* "cypari/auto_instance.pxi":20275
 *             ? ME = msomseval(Mp,PHI,[oo, 0]);
 *         '''
 *         Mp = objtogen(Mp)             # <<<<<<<<<<<<<<
 *         PHI = objtogen(PHI)
 *         path = objtogen(path)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Mp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Mp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20276
 *         '''
 *         Mp = objtogen(Mp)
 *         PHI = objtogen(PHI)             # <<<<<<<<<<<<<<
 *         path = objtogen(path)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_PHI, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_PHI, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20277
 *         Mp = objtogen(Mp)
 *         PHI = objtogen(PHI)
 *         path = objtogen(path)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_path, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20278
 *         PHI = objtogen(PHI)
 *         path = objtogen(path)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20278, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20279
 *         path = objtogen(path)
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _path = (<Gen>path).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Mp)->__pyx_base.g;
  __pyx_v__Mp = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20280
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g             # <<<<<<<<<<<<<<
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_PHI)->__pyx_base.g;
  __pyx_v__PHI = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20281
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _path = (<Gen>path).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_path)->__pyx_base.g;
  __pyx_v__path = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20282
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msomseval(__pyx_v__Mp, __pyx_v__PHI, __pyx_v__path);

  /* "cypari/auto_instance.pxi":20283
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicL(self, mu, s=None, long r=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20260
 *         return new_gen(_ret)
 * 
 *     def msomseval(self, Mp, PHI, path):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the vectors of moments of the :math:`p`-adic distribution attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msomseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Mp);
  __Pyx_XDECREF(__pyx_v_PHI);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20285
 *         return new_gen(_ret)
 * 
 *     def mspadicL(self, mu, s=None, long r=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1147mspadicL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1146mspadicL[] = "\n        Returns the value (or :math:`r`-th derivative)\n        on a character :math:`\\chi^s` of :math:`\\mathbb{Z}_p^*` of the :math:`p`-adic :math:`L`-function\n        attached to :literal:`mu`.\n        \n        Let :math:`\\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol\n        attached to a modular symbol :math:`\\phi` for :math:`\\Gamma_0(N)` (eigenvector for\n        :math:`T_N(p)` for the eigenvalue :math:`a_p`). Then :math:`L_p(\\Phi,\\chi^s) = L_p(\\mu,s)` is the\n        :math:`p`-adic :math:`L` function defined by\n        \n        .. MATH::\n        \n            L_p(\\Phi,\\chi^s) = \\int_{\\mathbb{Z}_p^*} \\chi^s(z) d\\mu (z)\n        \n        where :math:`\\mu` is the distribution on :math:`\\mathbb{Z}_p^*` defined by the restriction of\n        :math:`\\Phi ([ oo ]-[0])` to :math:`\\mathbb{Z}_p^*`. The :math:`r`-th derivative is taken in\n        direction :math:`<\\chi>`:\n        \n        .. MATH::\n        \n            L_p^{(r)}(\\Phi,\\chi^s) = \\int_{\\mathbb{Z}_p^*} \\chi^s(z) (\\log z)^r d\\mu (z).\n        \n        In the argument list,\n        \n        - :literal:`mu` is as returned by :literal:`mspadicmoments` (distributions\n          attached to :math:`\\Phi` by restriction to discs :math:`a + p^\\nu\\mathbb{Z}_p`, :math:`(a,p) = 1`).\n        \n        - :math:`s = [s_1,s_2]` with :math:`s_1 \\in \\mathbb{Z} \\subset \\mathbb{Z}_p` and :math:`s_2 mod p-1` or\n          :math:`s_2 mod 2` for :math:`p = 2`, encoding the :math:`p`-adic character :math:`\\chi^s := <\n          \\chi >^{s_1} \\tau^{s_2}`; here :math:`\\chi` is the cyclotomic character from\n          :math:`Gal(\\mathbb{Q}_p(\\mu_{p^ oo })/\\mathbb{Q}_p)` to :math:`\\mathbb{Z}_p^*`, and :math:`\\tau` is the\n          Teichm\303\274ller character (for :math:`p > 2` and the character of order 2 on\n          :math:`(\\mathbb{Z}/4\\mathbb{Z})^*` if :math:`p = 2`); for convenience, the character :math:`[s,s]` can also be\n          represented"" by the integer :math:`s`.\n        \n        When :math:`a_p` is a :math:`p`-adic unit, :math:`L_p` takes its values in :math:`\\mathbb{Q}_p`.\n        When :math:`a_p` is not a unit, it takes its values in the\n        two-dimensional :math:`\\mathbb{Q}_p`-vector space :math:`D_{cris}(M(\\phi))` where :math:`M(\\phi)` is\n        the \"motive\" attached to :math:`\\phi`, and we return the two :math:`p`-adic components\n        with respect to some fixed :math:`\\mathbb{Q}_p`-basis.\n        \n        ::\n        \n            ? M = msinit(3,6,1); phi=[5, -3, -1]~;\n            ? msissymbol(M,phi)\n            %2 = 1\n            ? Mp = mspadicinit(M, 5, 4);\n            ? mu = mspadicmoments(Mp, phi); \\\\ no twist\n            \\\\ End of initializations\n            \n            ? mspadicL(mu,0) \\\\ L_p(chi^0)\n            %5 = 5 + 2*5^2 + 2*5^3 + 2*5^4 + ...\n            ? mspadicL(mu,1) \\\\ L_p(chi), zero for parity reasons\n            %6 = [O(5^13)]~\n            ? mspadicL(mu,2) \\\\ L_p(chi^2)\n            %7 = 3 + 4*5 + 4*5^2 + 3*5^5 + ...\n            ? mspadicL(mu,[0,2]) \\\\ L_p(tau^2)\n            %8 = 3 + 5 + 2*5^2 + 2*5^3 + ...\n            ? mspadicL(mu, [1,0]) \\\\ L_p(<chi>)\n            %9 = 3*5 + 2*5^2 + 5^3 + 2*5^7 + 5^8 + 5^10 + 2*5^11 + O(5^13)\n            ? mspadicL(mu,0,1) \\\\ L_p'(chi^0)\n            %10 = 2*5 + 4*5^2 + 3*5^3 + ...\n            ? mspadicL(mu, 2, 1) \\\\ L_p'(chi^2)\n            %11 = 4*5 + 3*5^2 + 5^3 + 5^4 + ...\n        \n        Now several quadratic twists: :literal:`mstooms` is indicated.\n        \n        ::\n        \n            ? PHI = mstooms(Mp,phi);\n            ? mu = mspadicmoments(Mp, PHI, 12); \\\\ twist by 12\n            ? mspadicL(mu)\n            %14 = 5 + 5^2 + 5^3 + 2*5^4 + ...\n            ? mu = mspadicmoments(Mp, PHI, 8); \\\\ twist by 8\n            ? mspadicL(mu)\n            %16 = 2 + 3*5 + 3*5^2 + 2*5^4 + ...\n            ? mu = mspadicmoments(Mp, PHI, -3); \\\\ twist by -3 < 0\n        ""    ? mspadicL(mu)\n            %18 = O(5^13) \\\\ always 0, phi is in the + part and D < 0\n        \n        One can locate interesting symbols of level :math:`N` and weight :math:`k` with\n        :literal:`msnew` and :literal:`mssplit`. Note that instead of a symbol, one can\n        input a 1-dimensional Hecke-subspace from :literal:`mssplit`: the function will\n        automatically use the underlying basis vector.\n        \n        ::\n        \n            ? M=msinit(5,4,1); \\\\ M_4(Gamma_0(5))^+\n            ? L = mssplit(M, msnew(M)); \\\\ list of irreducible Hecke-subspaces\n            ? phi = L[1]; \\\\ one Galois orbit of newforms\n            ? #phi[1] \\\\... this one is rational\n            %4 = 1\n            ? Mp = mspadicinit(M, 3, 4);\n            ? mu = mspadicmoments(Mp, phi);\n            ? mspadicL(mu)\n            %7 = 1 + 3 + 3^3 + 3^4 + 2*3^5 + 3^6 + O(3^9)\n            \n            ? M = msinit(11,8, 1); \\\\ M_8(Gamma_0(11))^+\n            ? Mp = mspadicinit(M, 3, 4);\n            ? L = mssplit(M, msnew(M));\n            ? phi = L[1]; #phi[1] \\\\ ... this one is two-dimensional\n            %11 = 2\n            ? mu = mspadicmoments(Mp, phi);\n             *** at top-level: mu=mspadicmoments(Mp,ph\n             *** ^--------------------\n             *** mspadicmoments: incorrect type in mstooms [dim_Q (eigenspace) > 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1147mspadicL(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mu = 0;
  PyObject *__pyx_v_s = 0;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicL (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mu,&__pyx_n_s_s,&__pyx_n_s_r,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_mu)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicL") < 0)) __PYX_ERR(4, 20285, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mu = values[0];
    __pyx_v_s = values[1];
    if (values[2]) {
      __pyx_v_r = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20285, __pyx_L3_error)
    } else {
      __pyx_v_r = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicL", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20285, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1146mspadicL(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mu, __pyx_v_s, __pyx_v_r);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1146mspadicL(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mu, PyObject *__pyx_v_s, long __pyx_v_r) {
  int __pyx_v__have_s;
  GEN __pyx_v__mu;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mspadicL", 0);
  __Pyx_INCREF(__pyx_v_mu);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":20393
 *              *** mspadicmoments: incorrect type in mstooms [dim_Q (eigenspace) > 1]
 *         '''
 *         mu = objtogen(mu)             # <<<<<<<<<<<<<<
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20394
 *         '''
 *         mu = objtogen(mu)
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_2 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_2;

  /* "cypari/auto_instance.pxi":20395
 *         mu = objtogen(mu)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20396
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":20395
 *         mu = objtogen(mu)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":20397
 *         if _have_s:
 *             s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 20397, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20398
 *             s = objtogen(s)
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mu)->__pyx_base.g;
  __pyx_v__mu = __pyx_t_4;

  /* "cypari/auto_instance.pxi":20399
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_instance.pxi":20400
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20401
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_instance.pxi":20400
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 */
  }

  /* "cypari/auto_instance.pxi":20402
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicL(__pyx_v__mu, __pyx_v__s, __pyx_v_r);

  /* "cypari/auto_instance.pxi":20403
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicinit(self, M, long p, long n, long flag=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20285
 *         return new_gen(_ret)
 * 
 *     def mspadicL(self, mu, s=None, long r=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mu);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20405
 *         return new_gen(_ret)
 * 
 *     def mspadicinit(self, M, long p, long n, long flag=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, and :math:`p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1149mspadicinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1148mspadicinit[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, and :math:`p`\n        a prime, initialize technical data needed to compute with overconvergent\n        modular symbols, modulo :math:`p^n`. If :math:`flag` is unset, allow\n        all symbols; else initialize only for a restricted range of symbols\n        depending on :math:`flag`: if :math:`flag = 0` restrict to ordinary symbols, else\n        restrict to symbols :math:`\\phi` such that :math:`T_p(\\phi) = a_p \\phi`,\n        with :math:`v_p(a_p) >= flag`, which is faster as :math:`flag` increases.\n        (The fastest initialization is obtained for :math:`flag = 0` where we only allow\n        ordinary symbols.) For supersingular eigensymbols, such that :math:`p \\| a_p`, we\n        must further assume that :math:`p` does not divide the level.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\");\n            ? [M,phi] = msfromell(E,1);\n            ? ellap(E,3)\n            %3 = -1\n            ? Mp = mspadicinit(M, 3, 10, 0); \\\\ commit to ordinary symbols\n            ? PHI = mstooms(Mp,phi);\n        \n        If we restrict the range of allowed symbols with :emphasis:`flag` (for faster\n        initialization), exceptions will occur if :math:`v_p(a_p)` violates this bound:\n        \n        ::\n        \n            ? E = ellinit(\"15a1\");\n            ? [M,phi] = msfromell(E,1);\n            ? ellap(E,7)\n            %3 = 0\n            ? Mp = mspadicinit(M,7,5,0); \\\\ restrict to ordinary symbols\n            ? PHI = mstooms(Mp,phi)\n            *** at top-level: PHI=mstooms(Mp,phi)\n            *** ^---------------\n            *** mstooms: incorrect type in mstooms [v_p(ap) > mspadicinit flag] (t_VEC).\n            ? Mp = mspadicinit(M,7,5); \\\\ no restriction\n            ? PHI = mstooms(Mp,phi);\n        \n        This function uses :math:`O(N^2(n+k)^2p)` memory, where :math:`N` is the\n        level of :math:`M`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1149mspadicinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_p;
  long __pyx_v_n;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_flag,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_M)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mspadicinit", 0, 3, 4, 1); __PYX_ERR(4, 20405, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mspadicinit", 0, 3, 4, 2); __PYX_ERR(4, 20405, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicinit") < 0)) __PYX_ERR(4, 20405, __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_M = values[0];
    __pyx_v_p = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20405, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20405, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20405, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicinit", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20405, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1148mspadicinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_p, __pyx_v_n, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1148mspadicinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_p, long __pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspadicinit", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":20447
 *         level of :math:`M`.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20448
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20448, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20449
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20450
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicinit(__pyx_v__M, __pyx_v_p, __pyx_v_n, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":20451
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicmoments(self, Mp, PHI, long D=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20405
 *         return new_gen(_ret)
 * 
 *     def mspadicinit(self, M, long p, long n, long flag=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, and :math:`p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20453
 *         return new_gen(_ret)
 * 
 *     def mspadicmoments(self, Mp, PHI, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, an overconvergent
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1151mspadicmoments(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1150mspadicmoments[] = "\n        Given :literal:`Mp` from :literal:`mspadicinit`, an overconvergent\n        eigensymbol :literal:`PHI` from :literal:`mstooms` and a fundamental discriminant\n        :math:`D` coprime to :math:`p`,\n        let :math:`PHI^D` denote the twisted symbol. This function computes\n        the distribution :math:`\\mu = PHI^D([0] - oo ]) \\| \\mathbb{Z}_p^*` restricted\n        to :math:`\\mathbb{Z}_p^*`. More precisely, it returns\n        the moments of the :math:`p-1` distributions :math:`PHI^D([0]-[ oo ])\n        | (a + p\\mathbb{Z}_p)`, :math:`0 < a < p`.\n        We also allow :literal:`PHI` to be given as a classical\n        symbol, which is then lifted to an overconvergent symbol by :literal:`mstooms`;\n        but this is wasteful if more than one twist is later needed.\n        \n        The returned data :math:`\\mu` (:math:`p`-adic distributions attached to :literal:`PHI`)\n        can then be used in :literal:`mspadicL` or :literal:`mspadicseries`.\n        This precomputation allows to quickly compute derivatives of different\n        orders or values at different characters.\n        \n        ::\n        \n            ? M = msinit(3,6, 1);\n            ? phi = [5,-3,-1]~;\n            ? msissymbol(M, phi)\n            %3 = 1\n            ? p = 5; mshecke(M,p) * phi \\\\ eigenvector of T_5, a_5 = 6\n            %4 = [30, -18, -6]~\n            ? Mp = mspadicinit(M, p, 10, 0); \\\\ restrict to ordinary symbols, mod p^10\n            ? PHI = mstooms(Mp, phi);\n            ? mu = mspadicmoments(Mp, PHI);\n            ? mspadicL(mu)\n            %8 = 5 + 2*5^2 + 2*5^3 + ...\n            ? mu = mspadicmoments(Mp, PHI, 12); \\\\ twist by 12\n            ? mspadicL(mu)\n            %10 = 5 + 5^2 + 5^3 + 2*5^4 + ...\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1151mspadicmoments(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Mp = 0;
  PyObject *__pyx_v_PHI = 0;
  long __pyx_v_D;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicmoments (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Mp,&__pyx_n_s_PHI,&__pyx_n_s_D,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Mp)) != 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_PHI)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mspadicmoments", 0, 2, 3, 1); __PYX_ERR(4, 20453, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicmoments") < 0)) __PYX_ERR(4, 20453, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_Mp = values[0];
    __pyx_v_PHI = values[1];
    if (values[2]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20453, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicmoments", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicmoments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1150mspadicmoments(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Mp, __pyx_v_PHI, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1150mspadicmoments(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Mp, PyObject *__pyx_v_PHI, long __pyx_v_D) {
  GEN __pyx_v__Mp;
  GEN __pyx_v__PHI;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspadicmoments", 0);
  __Pyx_INCREF(__pyx_v_Mp);
  __Pyx_INCREF(__pyx_v_PHI);

  /* "cypari/auto_instance.pxi":20489
 *             %10 = 5 + 5^2 + 5^3 + 2*5^4 + ...
 *         '''
 *         Mp = objtogen(Mp)             # <<<<<<<<<<<<<<
 *         PHI = objtogen(PHI)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Mp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Mp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20490
 *         '''
 *         Mp = objtogen(Mp)
 *         PHI = objtogen(PHI)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_PHI, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_PHI, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20491
 *         Mp = objtogen(Mp)
 *         PHI = objtogen(PHI)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20491, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20492
 *         PHI = objtogen(PHI)
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Mp)->__pyx_base.g;
  __pyx_v__Mp = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20493
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_PHI)->__pyx_base.g;
  __pyx_v__PHI = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20494
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicmoments(__pyx_v__Mp, __pyx_v__PHI, __pyx_v_D);

  /* "cypari/auto_instance.pxi":20495
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicseries(self, mu, long i=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20453
 *         return new_gen(_ret)
 * 
 *     def mspadicmoments(self, Mp, PHI, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, an overconvergent
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicmoments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Mp);
  __Pyx_XDECREF(__pyx_v_PHI);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20497
 *         return new_gen(_ret)
 * 
 *     def mspadicseries(self, mu, long i=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1153mspadicseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1152mspadicseries[] = "\n        Let :math:`\\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol\n        attached to a modular symbol :math:`\\phi` for :math:`\\Gamma_0(N)` (eigenvector for\n        :math:`T_N(p)` for the eigenvalue :math:`a_p`).\n        If :math:`\\mu` is the distribution on :math:`\\mathbb{Z}_p^*` defined by the restriction of\n        :math:`\\Phi ([ oo ]-[0])` to :math:`\\mathbb{Z}_p^*`, let\n        \n        .. MATH::\n        \n            ^{L}_p(\\mu,\\tau^{i})(x)\n            = \\int_{\\mathbb{Z}_p^*} \\tau^i(t) (1+x)^{\\log_p(t)/\\log_p(u)}d\\mu (t)\n        \n        Here, :math:`\\tau` is the Teichm\303\274ller character and :math:`u` is a specific\n        multiplicative generator of :math:`1+2p\\mathbb{Z}_p`. (Namely :math:`1+p` if :math:`p > 2` or :math:`5`\n        if :math:`p = 2`.) To explain\n        the formula, let :math:`G_ oo := Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})`,\n        let :math:`\\chi:G_ oo \\to \\mathbb{Z}_p^*` be the cyclotomic character (isomorphism)\n        and :math:`\\gamma` the element of :math:`G_ oo` such that :math:`\\chi (\\gamma) = u`;\n        then\n        :math:`\\chi (\\gamma)^{\\log_p(t)/\\log_p(u)} = <\302\240t >`.\n        \n        The :math:`p`-padic precision of individual terms is maximal given the precision of\n        the overconvergent symbol :math:`\\mu`.\n        \n        ::\n        \n            ? [M,phi] = msfromell(ellinit(\"17a1\"),1);\n            ? Mp = mspadicinit(M, 5,7);\n            ? mu = mspadicmoments(Mp, phi,1); \\\\ overconvergent symbol\n            ? mspadicseries(mu)\n            %4 = (4 + 3*5 + 4*5^2 + 2*5^3 + 2*5^4 + 5^5 + 4*5^6 + 3*5^7 + O(5^9)) \\\n             + (3 + 3*5 + 5^2 + 5^3 + 2*5^4 + 5^6 + O(5^7))*x \\\n             + (2 + 3*5 + 5^2 + 4*5^3 + 2*5^4 + O(5^5))*x^2 \\\n             + (3 + 4*5 + 4*5^2 + O(5^3))*x^3 \\\n             + (3 + O(5))*x^4 + O(x^5)\n        \n        An example with non-zero Teichm\303\274ller:\n        \n        ::\n        ""\n            ? [M,phi] = msfromell(ellinit(\"11a1\"),1);\n            ? Mp = mspadicinit(M, 3,10);\n            ? mu = mspadicmoments(Mp, phi,1);\n            ? mspadicseries(mu, 2)\n            %4 = (2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 3^6 + 3^7 + 3^10 + 3^11 + O(3^12)) \\\n             + (1 + 3 + 2*3^2 + 3^3 + 3^5 + 2*3^6 + 2*3^8 + O(3^9))*x \\\n             + (1 + 2*3 + 3^4 + 2*3^5 + O(3^6))*x^2 \\\n             + (3 + O(3^2))*x^3 + O(x^4)\n        \n        Supersingular example (not checked)\n        \n        ::\n        \n            ? E = ellinit(\"17a1\"); ellap(E,3)\n            %1 = 0\n            ? [M,phi] = msfromell(E,1);\n            ? Mp = mspadicinit(M, 3,7);\n            ? mu = mspadicmoments(Mp, phi,1);\n            ? mspadicseries(mu)\n            %5 = [(2*3^-1 + 1 + 3 + 3^2 + 3^3 + 3^4 + 3^5 + 3^6 + O(3^7)) \\\n             + (2 + 3^3 + O(3^5))*x \\\n             + (1 + 2*3 + O(3^2))*x^2 + O(x^3),\\\n             (3^-1 + 1 + 3 + 3^2 + 3^3 + 3^4 + 3^5 + 3^6 + O(3^7)) \\\n             + (1 + 2*3 + 2*3^2 + 3^3 + 2*3^4 + O(3^5))*x \\\n             + (3^-2 + 3^-1 + O(3^2))*x^2 + O(3^-2)*x^3 + O(x^4)]\n        \n        Example with a twist:\n        \n        ::\n        \n            ? E = ellinit(\"11a1\");\n            ? [M,phi] = msfromell(E,1);\n            ? Mp = mspadicinit(M, 3,10);\n            ? mu = mspadicmoments(Mp, phi,5); \\\\ twist by 5\n            ? L = mspadicseries(mu)\n            %5 = (2*3^2 + 2*3^4 + 3^5 + 3^6 + 2*3^7 + 2*3^10 + O(3^12)) \\\n             + (2*3^2 + 2*3^6 + 3^7 + 3^8 + O(3^9))*x \\\n             + (3^3 + O(3^6))*x^2 + O(3^2)*x^3 + O(x^4)\n            ? mspadicL(mu)\n            %6 = [2*3^2 + 2*3^4 + 3^5 + 3^6 + 2*3^7 + 2*3^10 + O(3^12)]~\n            ? ellpadicL(E,3,10,,5)\n            %7 = 2 + 2*3^2 + 3^3 + 2*3^4 + 2*3^5 + 3^6 + 2*3^7 + O(3^10)\n            ? mspadicseries(mu,1) \\\\ must be 0\n            %8 = O(3^12) + O(3^9)*x + O(3^6)*x^2 + O(3^2)*x^3 + O(x^4)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1153mspadicseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mu = 0;
  long __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicseries (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mu,&__pyx_n_s_i,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_mu)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicseries") < 0)) __PYX_ERR(4, 20497, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_mu = values[0];
    if (values[1]) {
      __pyx_v_i = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_i == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20497, __pyx_L3_error)
    } else {
      __pyx_v_i = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicseries", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20497, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1152mspadicseries(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_mu, __pyx_v_i);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1152mspadicseries(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_mu, long __pyx_v_i) {
  GEN __pyx_v__mu;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspadicseries", 0);
  __Pyx_INCREF(__pyx_v_mu);

  /* "cypari/auto_instance.pxi":20583
 *             %8 = O(3^12) + O(3^9)*x + O(3^6)*x^2 + O(3^2)*x^3 + O(x^4)
 *         '''
 *         mu = objtogen(mu)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20584
 *         '''
 *         mu = objtogen(mu)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _ret = mspadicseries(_mu, i)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20584, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20585
 *         mu = objtogen(mu)
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicseries(_mu, i)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mu)->__pyx_base.g;
  __pyx_v__mu = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20586
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _ret = mspadicseries(_mu, i)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicseries(__pyx_v__mu, __pyx_v_i);

  /* "cypari/auto_instance.pxi":20587
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _ret = mspadicseries(_mu, i)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspathgens(self, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20497
 *         return new_gen(_ret)
 * 
 *     def mspadicseries(self, mu, long i=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspadicseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mu);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20589
 *         return new_gen(_ret)
 * 
 *     def mspathgens(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1155mspathgens(PyObject *__pyx_v_self, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1154mspathgens[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1(\\mathbb{Q}))`.\n        Let :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return a set of :math:`\\mathbb{Z}[G]`-generators for :math:`\\Delta`. The output\n        is :math:`[g,R]`, where :math:`g` is a minimal system of generators and :math:`R`\n        the vector of :math:`\\mathbb{Z}[G]`-relations between the given generators. A\n        relation is coded by a vector of pairs :math:`[a_i,i]` with :math:`a_i\\in \\mathbb{Z}[G]`\n        and :math:`i` the index of a generator, so that :math:`\\sum_i a_i g[i] = 0`.\n        \n        An element :math:`[v]-[u]` in :math:`\\Delta` is coded by the \"path\" :math:`[u,v]`,\n        where :literal:`oo` denotes the point at infinity :math:`(1:0)` on the projective\n        line.\n        An element of :math:`\\mathbb{Z}[G]` is either an integer :math:`n` (:math:`= n [id_2]`) or a\n        \"factorization matrix\": the first column contains distinct elements :math:`g_i`\n        of :math:`G` and the second integers :math:`n_i` and the matrix codes :math:`\\sum n_i [g_i]`:\n        \n        ::\n        \n            ? M = msinit(11,8); \\\\ M_8(Gamma_0(11))\n            ? [g,R] = mspathgens(M);\n            ? g\n            %3 = [[+oo, 0], [0, 1/3], [1/3, 1/2]] \\\\ 3 paths\n            ? #R \\\\ a single relation\n            %4 = 1\n            ? r = R[1]; #r \\\\ ...involving all 3 generators\n            %5 = 3\n            ? r[1]\n            %6 = [[1, 1; [1, 1; 0, 1], -1], 1]\n            ? r[2]\n            %7 = [[1, 1; [7, -2; 11, -3], -1], 2]\n            ? r[3]\n            %8 = [[1, 1; [8, -3; 11, -4], -1], 3]\n        \n        The given relation is of the form :math:`\\sum_i (1-\\gamma_i) g_i = 0`, with\n        :math:`\\gamma_i\\in \\Gamma_0(11)`. There will always be a single relation involving\n        all generators (corresponding to a round trip along all cusps), then\n        relations involving a single generator"" (corresponding to :math:`2` and :math:`3`-torsion\n        elements in the group:\n        \n        ::\n        \n            ? M = msinit(2,8); \\\\ M_8(Gamma_0(2))\n            ? [g,R] = mspathgens(M);\n            ? g\n            %3 = [[+oo, 0], [0, 1]]\n        \n        Note that the output depends only on the group :math:`G`, not on the\n        representation :math:`V`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1155mspathgens(PyObject *__pyx_v_self, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspathgens (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1154mspathgens(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_M));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1154mspathgens(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspathgens", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":20639
 *         representation :math:`V`.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20640
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspathgens(_M)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20640, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20641
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspathgens(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20642
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspathgens(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspathgens(__pyx_v__M);

  /* "cypari/auto_instance.pxi":20643
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspathgens(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspathlog(self, M, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20589
 *         return new_gen(_ret)
 * 
 *     def mspathgens(self, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspathgens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20645
 *         return new_gen(_ret)
 * 
 *     def mspathlog(self, M, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1157mspathlog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1156mspathlog[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1(\\mathbb{Q}))`.\n        Let :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        encoding fixed :math:`\\mathbb{Z}[G]`-generators :math:`(g_i)` of :math:`\\Delta` (see :literal:`mspathgens`).\n        A path :math:`p = [a,b]` between two elements in :math:`\\mathbb{P}^1(\\mathbb{Q})` corresponds to\n        :math:`[b]-[a]\\in \\Delta`. The path extremities :math:`a` and :math:`b` may be given as\n        :literal:`t_INT`, :literal:`t_FRAC` or :math:`oo = (1:0)`. Finally, we also allow\n        to input a path as a :math:`2 x 2` integer matrix, whose first\n        and second column give :math:`a` and :math:`b` respectively, with the convention\n        :math:`[x,y]~ = (x:y)` in :math:`\\mathbb{P}^1(\\mathbb{Q})`.\n        \n        Returns :math:`(p_i)` in :math:`\\mathbb{Z}[G]` such that :math:`p = \\sum_i p_i g_i`.\n        \n        ::\n        \n            ? M = msinit(2,8); \\\\ M_8(Gamma_0(2))\n            ? [g,R] = mspathgens(M);\n            ? g\n            %3 = [[+oo, 0], [0, 1]]\n            ? p = mspathlog(M, [1/2,2/3]);\n            ? p[1]\n            %5 =\n            [[1, 0; 2, 1] 1]\n            \n            ? p[2]\n            %6 =\n            [[1, 0; 0, 1] 1]\n            \n            [[3, -1; 4, -1] 1]\n            ? mspathlog(M, [1,2;2,3]) == p \\\\ give path via a 2x2 matrix\n            %7 = 1\n        \n        Note that the output depends only on the group :math:`G`, not on the\n        representation :math:`V`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1157mspathlog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspathlog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_p,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_M)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mspathlog", 1, 2, 2, 1); __PYX_ERR(4, 20645, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspathlog") < 0)) __PYX_ERR(4, 20645, __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_M = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspathlog", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20645, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspathlog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1156mspathlog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1156mspathlog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_p) {
  GEN __pyx_v__M;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspathlog", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":20681
 *         representation :math:`V`.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20682
 *         '''
 *         M = objtogen(M)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20683
 *         M = objtogen(M)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20683, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20684
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = mspathlog(_M, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20685
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspathlog(_M, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20686
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = mspathlog(_M, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspathlog(__pyx_v__M, __pyx_v__p);

  /* "cypari/auto_instance.pxi":20687
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = mspathlog(_M, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspetersson(self, M, F=None, G=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20645
 *         return new_gen(_ret)
 * 
 *     def mspathlog(self, M, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspathlog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20689
 *         return new_gen(_ret)
 * 
 *     def mspetersson(self, M, F=None, G=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space for :math:`\Gamma = \Gamma_0(N)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1159mspetersson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1158mspetersson[] = "\n        :math:`M` being a full modular symbol space for :math:`\\Gamma = \\Gamma_0(N)`,\n        as given by :literal:`msinit`,\n        calculate the intersection product :math:`{F, G}` of modular symbols :math:`F` and :math:`G`\n        on :math:`M = \\text{Hom}_{\\Gamma}(\\Delta, V_k)` extended to an hermitian bilinear\n        form on :math:`M \\otimes \\mathbb{C}` whose radical is the Eisenstein subspace of :math:`M`.\n        \n        Suppose that :math:`f_1` and :math:`f_2` are two parabolic forms. Let :math:`F_1`\n        and :math:`F_2` be the attached modular symbols\n        \n        .. MATH::\n        \n            F_i(\\delta) = \\int_{\\delta} f_i(z).(z X + Y)^{k-2} dz\n        \n        and let :math:`F^{\\mathbb{R}}_1`, :math:`F^{\\mathbb{R}}_2` be the attached real modular symbols\n        \n        .. MATH::\n        \n            F^{\\mathbb{R}}_i(\\delta) = \\int_{\\delta}\n            \\Re (f_i(z).(z X + Y)^{k-2} dz)\n        \n        Then we have\n        \n        .. MATH::\n        \n            \\{ F^{\\mathbb{R}}_1, F^{\\mathbb{R}}_2 } = -2 (2i)^{k-2}.\n            \\Im ( < f_1,f_2 > _{Petersson})\n        \n        and\n        \n        .. MATH::\n        \n            { F_1, \\bar{F_2} } = (2i)^{k-2} < f_1,f_2 > _{Petersson}\n        \n        In weight 2, the intersection product :math:`{F, G}` has integer values on the\n        :math:`\\mathbb{Z}`-structure on :math:`M` given by :literal:`mslattice` and defines a Riemann form on\n        :math:`H^1_{par}(\\Gamma,\\mathbb{R})`.\n        \n        For user convenience, we allow :math:`F` and :math:`G` to be matrices and return the\n        attached Gram matrix. If :math:`F` is omitted: treat it as the full modular space\n        attached to :math:`M`; if :math:`G` is omitted, take it equal to :math:`F`.\n        \n        ::\n        \n            ? M = msinit(37,2);\n            ? C = mscuspidal(M)[1];\n            ? mspetersson(M, C)\n            %3 =\n            [ 0 -17 -8 -17]""\n            [17 0 -8 -25]\n            [ 8 8 0 -17]\n            [17 25 17 0]\n            ? mspetersson(M, mslattice(M,C))\n            %4 =\n            [0 -1 0 -1]\n            [1 0 0 -1]\n            [0 0 0 -1]\n            [1 1 1 0]\n            ? E = ellinit(\"33a1\");\n            ? [M,xpm] = msfromell(E); [xp,xm,L] = xpm;\n            ? mspetersson(M, mslattice(M,L))\n            %7 =\n            [0 -3]\n            [3 0]\n            ? ellmoddegree(E)\n            %8 = [3, -126]\n        \n        The coefficient :math:`3` in the matrix is the degree of the\n        modular parametrization.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1159mspetersson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspetersson (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_F,&__pyx_n_s_G,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspetersson") < 0)) __PYX_ERR(4, 20689, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    __pyx_v_F = values[1];
    __pyx_v_G = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspetersson", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20689, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1158mspetersson(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_F, __pyx_v_G);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1158mspetersson(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_F, PyObject *__pyx_v_G) {
  int __pyx_v__have_F;
  int __pyx_v__have_G;
  GEN __pyx_v__M;
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mspetersson", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":20760
 *         modular parametrization.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20761
 *         '''
 *         M = objtogen(M)
 *         cdef bint _have_F = (F is not None)             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             F = objtogen(F)
 */
  __pyx_t_2 = (__pyx_v_F != Py_None);
  __pyx_v__have_F = __pyx_t_2;

  /* "cypari/auto_instance.pxi":20762
 *         M = objtogen(M)
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 */
  __pyx_t_2 = (__pyx_v__have_F != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20763
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 *             F = objtogen(F)             # <<<<<<<<<<<<<<
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":20762
 *         M = objtogen(M)
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 */
  }

  /* "cypari/auto_instance.pxi":20764
 *         if _have_F:
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)             # <<<<<<<<<<<<<<
 *         if _have_G:
 *             G = objtogen(G)
 */
  __pyx_t_2 = (__pyx_v_G != Py_None);
  __pyx_v__have_G = __pyx_t_2;

  /* "cypari/auto_instance.pxi":20765
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             G = objtogen(G)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_G != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20766
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:
 *             G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20766, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":20765
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             G = objtogen(G)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":20767
 *         if _have_G:
 *             G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 20767, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20768
 *             G = objtogen(G)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = NULL
 *         if _have_F:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":20769
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             _F = (<Gen>F).g
 */
  __pyx_v__F = NULL;

  /* "cypari/auto_instance.pxi":20770
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 */
  __pyx_t_2 = (__pyx_v__have_F != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20771
 *         cdef GEN _F = NULL
 *         if _have_F:
 *             _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = NULL
 *         if _have_G:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
    __pyx_v__F = __pyx_t_4;

    /* "cypari/auto_instance.pxi":20770
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 */
  }

  /* "cypari/auto_instance.pxi":20772
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL             # <<<<<<<<<<<<<<
 *         if _have_G:
 *             _G = (<Gen>G).g
 */
  __pyx_v__G = NULL;

  /* "cypari/auto_instance.pxi":20773
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 */
  __pyx_t_2 = (__pyx_v__have_G != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20774
 *         cdef GEN _G = NULL
 *         if _have_G:
 *             _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
    __pyx_v__G = __pyx_t_4;

    /* "cypari/auto_instance.pxi":20773
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 */
  }

  /* "cypari/auto_instance.pxi":20775
 *         if _have_G:
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspetersson(__pyx_v__M, __pyx_v__F, __pyx_v__G);

  /* "cypari/auto_instance.pxi":20776
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspolygon(self, M, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20689
 *         return new_gen(_ret)
 * 
 *     def mspetersson(self, M, F=None, G=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space for :math:`\Gamma = \Gamma_0(N)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20778
 *         return new_gen(_ret)
 * 
 *     def mspolygon(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an integer :math:`N > 1`, return an hyperbolic polygon (Farey symbol)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1161mspolygon(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1160mspolygon[] = "\n        Given an integer :math:`N > 1`, return an hyperbolic polygon (Farey symbol)\n        attached to the group :math:`\\Gamma_0(N)`. More precisely,\n        \n        - its vertices are an ordered list in :math:`\\mathbb{P}^{1}(\\mathbb{Q})`, forming a system of\n          representatives of cusps,\n        \n        - its edges are hyperbolic arcs joining two consecutive vertices,\n        \n        - given a path :math:`(a,b)` between two elements of :math:`\\mathbb{P}^{1}(\\mathbb{Q})`, let\n          :math:`\\overline{(a,b)} = (b,a)` be the opposite path. There is an involution :math:`e\n          \\to e^*` on the edges, where :math:`e^*` is :math:`\\Gamma_0(N)` equivalent to\n          :math:`\\overline{e}`, i.e. there exist :math:`\\gamma_e \\in \\Gamma_0(N)` such that :math:`e =\n          \\gamma_e \\overline{e^*}`.\n        \n        The polygon is given by\n        \n        - the list :math:`E` of its consecutive edges as matrices in :math:`M_2(\\mathbb{Z})`;\n        \n        - the permutation :math:`A` attached to the involution, such that\n          :literal:`A[i]` is the index of :math:`e^*` in :math:`E` if :math:`e = E[i]` is the :math:`i`-th edge;\n        \n        - the list :math:`G` of pairing matrices between :math:`e` and\n          :math:`\\overline{e^*}`, i.e. the matrices :math:`\\gamma_e\\in \\Gamma_0(N)` such that :math:`e =\n          \\gamma_e \\overline{e^*}`. If :math:`e = E[i]`, then :math:`\\gamma_e = G[i]`.\n          Remark that :math:`\\gamma_{e^*} = \\gamma_e^{-1}` if :math:`e != e^*`; modulo these\n          trivial relations, the pairing matrices form a system of independant\n          generators of :math:`\\Gamma_0(N)/{1,-1}`. Note that :math:`\\gamma_e` is elliptic if and only if\n          :math:`e^ *= e`.\n        \n        The above data yields a fundamental domain for :math:`\\Gamma_0(N)` acting\n        on Poincar\303\251's half-plane: take the convex hull of the polygon defined by\n        \n        - the edges"" in :math:`E` such that :math:`e != e^*` or :math:`e^ *= e`, where the pairing\n          matrix :math:`\\gamma_e` has order :math:`2`;\n        \n        - the edges :math:`(r,t)` and :math:`(t,s)` where the edge :math:`e = (r,s) \\in E` is such\n          that :math:`e = e^*` and :math:`\\gamma_e` has order :math:`3` and the triangle :math:`(r,t,s)`\n          is the image of :math:`(0,\\exp (2i\\pi/3), oo )` by some element of :math:`PSL_2(\\mathbb{Q})`\n          formed around the edge.\n        \n        Binary digits of flag mean:\n        \n        1: return a normalized hyperbolic polygon if set, else a polygon with\n        unimodular edges (matrices of determinant :math:`1`). A polygon is normalized\n        in the sense of compact orientable surfaces if the distance :math:`d(a,a^*)` between\n        an edge :math:`a` and its image by the involution :math:`a^*` is less than 2, with\n        equality if and only if :math:`a` is :emphasis:`linked` with another edge :math:`b`\n        (:math:`a`, :math:`b`, :math:`a^*` et :math:`b^*` appear consecutively in :math:`E` up to cyclic\n        permutation). In particular, the vertices of all edges such that that\n        :math:`d(a,a^*) != 1` (distance is 0 or 2) are all equivalent to :math:`0` modulo\n        :math:`\\Gamma_0(N)`. The external vertices of :math:`a a^*` such that :math:`d(a,a^*) = 1` are\n        also equivalent to :math:`0`; the internal vertices :math:`a\\cap a^*` (a single point),\n        together with :math:`0`, form a system of representatives of the cusps of\n        :math:`\\Gamma_0(N)\\\\mathbb{P}^{1}(\\mathbb{Q})`. This is useful to compute the homology group\n        :math:`H_1(X_0(N),\\mathbb{Z})` as it gives a symplectic basis for the intersection pairing.\n        In this case, the number of parabolic matrices (trace 2) in the system of\n        generators :math:`G` is :math:`2(t-1)`, where :math:`t` is the number of non equivalent cusps\n        for :math:`\\Gamma_0(N)`.\n        ""\n        2: add graphical representations (in LaTeX form) for the hyperbolic polygon\n        in Poincar\303\251's half-space and the involution :math:`a\\to a^*` of the Farey symbol.\n        The corresponding character strings can be written to file and included in a\n        LaTeX document provided the preamble contains\n        :literal:`\\\\usepackage{ tikz}`.\n        \n        ::\n        \n            ? [V,A,G] = mspolygon(3);\n            ? V\n            %2 = [[-1, 1; -1, 0], [1, 0; 0, 1], [0, 1; -1, 1]]\n            ? A\n            %3 = Vecsmall([2, 1, 3])\n            ? G\n            %4 = [[-1, -1; 0, -1], [1, -1; 0, 1], [1, -1; 3, -2]]\n            ? [V,A,G, D1,D2] = mspolygon(11,2); \\\\ D1 and D2 contains pictures\n            ? {write(\"F.tex\",\n             \"\\\\documentclass{article}\\\\usepackage{tikz}\\\\begin{document}\"\n             D1, \"\\n\",\n             D2,\n             \"\\\\end{document}\");}\n            \n            ? [V1,A1] = mspolygon(6,1); \\\\ normalized\n            ? V1\n            %8 = [[-1, 1; -1, 0], [1, 0; 0, 1], [0, 1; -1, 3],\n             [1, -2; 3, -5], [-2, 1; -5, 2], [1, -1; 2, -1]]\n            ? A1\n            %9 = Vecsmall([2, 1, 4, 3, 6, 5])\n            \n            ? [V0,A0] = mspolygon(6); \\\\ not normalized V[3]^* = V[6], d(V[3],V[6]) = 3\n            ? A0\n            %11 = Vecsmall([2, 1, 6, 5, 4, 3])\n            \n            ? [V,A] = mspolygon(14, 1);\n            ? A\n            %13 = Vecsmall([2, 1, 4, 3, 6, 5, 9, 10, 7, 8])\n        \n        One can see from this last example that the (normalized) polygon has the form\n        \n        .. MATH::\n        \n            (a_1, a_1^*, a_2, a_2^*, a_3, a_3^*, a_4, a_5, a_4^*, a_5^*),\n        \n        that :math:`X_0(14)` is of genus 1 (in general the genus is the number of blocks\n        of the form :math:`aba^*b^*`), has no elliptic points (:math:`A` has no fixed point)\n        and 4 cusps (number of blocks of the form :math:`aa^*` plus"" 1). The vertices\n        of edges :math:`a_4` and :math:`a_5` all project to :math:`0` in :math:`X_0(14)`: the paths :math:`a_4`\n        and :math:`a_5` project as loops in :math:`X_0(14)` and give a symplectic basis of the\n        homology :math:`H_1(X_0(14),\\mathbb{Z})`.\n        \n        ::\n        \n            ? [V,A] = mspolygon(15);\n            ? apply(matdet, V) \\\\ all unimodular\n            %2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n            ? [V,A] = mspolygon(15,1);\n            ? apply(matdet, V) \\\\ normalized polygon but no longer unimodular edges\n            %4 = [1, 1, 1, 1, 2, 2, 47, 11, 47, 11]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1161mspolygon(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspolygon (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_flag,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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspolygon") < 0)) __PYX_ERR(4, 20778, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20778, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspolygon", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20778, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspolygon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1160mspolygon(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1160mspolygon(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspolygon", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":20898
 *             %4 = [1, 1, 1, 1, 2, 2, 47, 11, 47, 11]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20899
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspolygon(_M, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20899, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20900
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspolygon(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20901
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspolygon(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspolygon(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":20902
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspolygon(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msqexpansion(self, M, projH, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20778
 *         return new_gen(_ret)
 * 
 *     def mspolygon(self, M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an integer :math:`N > 1`, return an hyperbolic polygon (Farey symbol)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mspolygon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20904
 *         return new_gen(_ret)
 * 
 *     def msqexpansion(self, M, projH, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1163msqexpansion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1162msqexpansion[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        and :emphasis:`projH` being a projector on a Hecke-simple subspace (as given\n        by :literal:`mssplit`), return the Fourier coefficients :math:`a_n`, :math:`n <= B` of the\n        corresponding normalized newform. If :math:`B` is omitted, use\n        :literal:`seriesprecision`.\n        \n        This function uses a naive :math:`O(B^2 d^3)`\n        algorithm, where :math:`d = O(kN)` is the dimension of :math:`M_k(\\Gamma_0(N))`.\n        \n        ::\n        \n            ? M = msinit(11,2, 1); \\\\ M_2(Gamma_0(11))^+\n            ? L = mssplit(M, msnew(M));\n            ? msqexpansion(M,L[1], 20)\n            %3 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1, -4, -2, 4, 0, 2]\n            ? ellan(ellinit(\"11a1\"), 20)\n            %4 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1, -4, -2, 4, 0, 2]\n        \n        The shortcut :literal:`msqexpansion(M, s, B)` is available for\n        a symbol :math:`s`, provided it is a Hecke eigenvector:\n        \n        ::\n        \n            ? E = ellinit(\"11a1\");\n            ? [M,S] = msfromell(E); [sp,sm] = S;\n            ? msqexpansion(M,sp,10) \\\\ in the + eigenspace\n            %3 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n            ? msqexpansion(M,sm,10) \\\\ in the - eigenspace\n            %4 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n            ? ellan(E, 10)\n            %5 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1163msqexpansion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_projH = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msqexpansion (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_projH,&__pyx_n_s_serprec,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 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_projH)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msqexpansion", 0, 2, 3, 1); __PYX_ERR(4, 20904, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msqexpansion") < 0)) __PYX_ERR(4, 20904, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_M = values[0];
    __pyx_v_projH = values[1];
    if (values[2]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20904, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msqexpansion", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20904, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msqexpansion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1162msqexpansion(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_projH, __pyx_v_serprec);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1162msqexpansion(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_projH, long __pyx_v_serprec) {
  GEN __pyx_v__M;
  GEN __pyx_v__projH;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("msqexpansion", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_projH);

  /* "cypari/auto_instance.pxi":20938
 *             %5 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         projH = objtogen(projH)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20939
 *         '''
 *         M = objtogen(M)
 *         projH = objtogen(projH)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_projH, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_projH, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20940
 *         M = objtogen(M)
 *         projH = objtogen(projH)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 20940, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20941
 *         projH = objtogen(projH)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20942
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_projH)->__pyx_base.g;
  __pyx_v__projH = __pyx_t_3;

  /* "cypari/auto_instance.pxi":20943
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 */
  __pyx_t_4 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":20944
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":20943
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 */
  }

  /* "cypari/auto_instance.pxi":20945
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msqexpansion(__pyx_v__M, __pyx_v__projH, __pyx_v_serprec);

  /* "cypari/auto_instance.pxi":20946
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mssplit(self, M, H=None, long dimlim=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20904
 *         return new_gen(_ret)
 * 
 *     def msqexpansion(self, M, projH, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msqexpansion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_projH);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20948
 *         return new_gen(_ret)
 * 
 *     def mssplit(self, M, H=None, long dimlim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` denote a full modular symbol space, as given by :literal:`msinit`:math:`(N,k,1)`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1165mssplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1164mssplit[] = "\n        Let :math:`M` denote a full modular symbol space, as given by :literal:`msinit`:math:`(N,k,1)`\n        or :math:`msinit (N,k,-1)` and let :math:`H` be a Hecke-stable subspace of\n        :literal:`msnew`:math:`(M)` (the full new subspace if :math:`H` is omitted). This function\n        splits :math:`H` into Hecke-simple subspaces. If :literal:`dimlim` is present and\n        positive, restrict to subspaces of dimension :math:`<= dimlim`. A subspace\n        is given by a structure allowing quick projection and restriction of linear\n        operators; its first component is a matrix with integer coefficients whose\n        columns form a :math:`\\mathbb{Q}`-basis of the subspace.\n        \n        ::\n        \n            ? M = msinit(11,8, 1); \\\\ M_8(Gamma_0(11))^+\n            ? L = mssplit(M); \\\\ split msnew(M)\n            ? #L\n            %3 = 2\n            ? f = msqexpansion(M,L[1],5); f[1].mod\n            %4 = x^2 + 8*x - 44\n            ? lift(f)\n            %5 = [1, x, -6*x - 27, -8*x - 84, 20*x - 155]\n            ? g = msqexpansion(M,L[2],5); g[1].mod\n            %6 = x^4 - 558*x^2 + 140*x + 51744\n        \n        To a Hecke-simple subspace corresponds an orbit of\n        (normalized) newforms, defined over a number field. In the above example,\n        we printed the polynomials defining the said fields, as well as the first\n        5 Fourier coefficients (at the infinite cusp) of one such form.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1165mssplit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_H = 0;
  long __pyx_v_dimlim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mssplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_H,&__pyx_n_s_dimlim,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimlim);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mssplit") < 0)) __PYX_ERR(4, 20948, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    __pyx_v_H = values[1];
    if (values[2]) {
      __pyx_v_dimlim = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_dimlim == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 20948, __pyx_L3_error)
    } else {
      __pyx_v_dimlim = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mssplit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20948, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mssplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1164mssplit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_H, __pyx_v_dimlim);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1164mssplit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_H, long __pyx_v_dimlim) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mssplit", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":20977
 *         5 Fourier coefficients (at the infinite cusp) of one such form.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":20978
 *         '''
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":20979
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20980
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20980, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":20979
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":20981
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 20981, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":20982
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":20983
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":20984
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":20985
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_instance.pxi":20984
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 */
  }

  /* "cypari/auto_instance.pxi":20986
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mssplit(__pyx_v__M, __pyx_v__H, __pyx_v_dimlim);

  /* "cypari/auto_instance.pxi":20987
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msstar(self, M, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 20987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20948
 *         return new_gen(_ret)
 * 
 *     def mssplit(self, M, H=None, long dimlim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` denote a full modular symbol space, as given by :literal:`msinit`:math:`(N,k,1)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mssplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":20989
 *         return new_gen(_ret)
 * 
 *     def msstar(self, M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1167msstar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1166msstar[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return the matrix of the :literal:`*` involution, induced by complex conjugation,\n        acting on the (stable) subspace :math:`H` (:math:`M` if omitted).\n        \n        ::\n        \n            ? M = msinit(11,2); \\\\ M_2(Gamma_0(11))\n            ? w = msstar(M);\n            ? w^2 == 1\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1167msstar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msstar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_M,&__pyx_n_s_H,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_M)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msstar") < 0)) __PYX_ERR(4, 20989, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_M = values[0];
    __pyx_v_H = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msstar", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 20989, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1166msstar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_M, __pyx_v_H);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1166msstar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_M, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("msstar", 0);
  __Pyx_INCREF(__pyx_v_M);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_instance.pxi":21002
 *             %3 = 1
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21003
 *         '''
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_instance.pxi":21004
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21005
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":21004
 *         M = objtogen(M)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":21006
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21006, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21007
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21008
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_instance.pxi":21009
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21010
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msstar(_M, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_instance.pxi":21009
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)
 */
  }

  /* "cypari/auto_instance.pxi":21011
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msstar(__pyx_v__M, __pyx_v__H);

  /* "cypari/auto_instance.pxi":21012
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mstooms(self, Mp, phi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":20989
 *         return new_gen(_ret)
 * 
 *     def msstar(self, M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.msstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21014
 *         return new_gen(_ret)
 * 
 *     def mstooms(self, Mp, phi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, lift the (classical) eigen symbol
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1169mstooms(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1168mstooms[] = "\n        Given :literal:`Mp` from :literal:`mspadicinit`, lift the (classical) eigen symbol\n        :literal:`phi` to a :math:`p`-adic distribution-valued overconvergent symbol in the\n        sense of Pollack and Stevens. More precisely, let :math:`\\phi` belong to the space\n        :math:`W` of modular symbols of level :math:`N`, :math:`v_p(N) <= 1`, and weight :math:`k` which is\n        an eigenvector for the Hecke operator :math:`T_N(p)` for a non-zero eigenvalue\n        :math:`a_p` and let :math:`N_0 = lcm(N,p)`.\n        \n        Under the action of :math:`T_{N_0}(p)`, :math:`\\phi` generates a subspace :math:`W_\\phi` of\n        dimension :math:`1` (if :math:`p \\| N`) or :math:`2` (if :math:`p` does not divide :math:`N`) in the\n        space of modular symbols of level :math:`N_0`.\n        \n        Let :math:`V_p = [p,0;0,1]` and :math:`C_p = [a_p,p^{k-1};-1,0]`.\n        When :math:`p` does not divide :math:`N` and :math:`a_p` is divisible by :math:`p`, :literal:`mstooms`\n        returns the lift :math:`\\Phi` of :math:`(\\phi,\\phi\\|_k V_p)` such that\n        \n        .. MATH::\n        \n            T_{N_0}(p) \\Phi = C_p \\Phi\n        \n        When :math:`p` does not divide :math:`N` and :math:`a_p` is not divisible by :math:`p`, :literal:`mstooms`\n        returns the lift :math:`\\Phi` of :math:`\\phi - \\alpha^{-1} \\phi\\|_k V_p`\n        which is an eigenvector of :math:`T_{N_0}(p)` for the unit eigenvalue\n        where :math:`\\alpha^2 - a_p \\alpha + p^{k-1} = 0`.\n        \n        The resulting overconvergent eigensymbol can then be used in\n        :literal:`mspadicmoments`, then :literal:`mspadicL` or :literal:`mspadicseries`.\n        \n        ::\n        \n            ? M = msinit(3,6, 1); p = 5;\n            ? Tp = mshecke(M, p); factor(charpoly(Tp))\n            %2 =\n            [x - 3126 2]\n            \n            [ x - 6 1]\n            ? phi = matker(Tp - 6)[,1] \\\\ generator of p-Eigenspace, a_p = 6\n            ""%3 = [5, -3, -1]~\n            ? Mp = mspadicinit(M, p, 10, 0); \\\\ restrict to ordinary symbols, mod p^10\n            ? PHI = mstooms(Mp, phi);\n            ? mu = mspadicmoments(Mp, PHI);\n            ? mspadicL(mu)\n            %7 = 5 + 2*5^2 + 2*5^3 + ...\n        \n        A non ordinary symbol.\n        \n        ::\n        \n            ? M = msinit(4,6,1); p = 3;\n            ? Tp = mshecke(M, p); factor(charpoly(Tp))\n            %2 =\n            [x - 244 3]\n            \n            [ x + 12 1]\n            ? phi = matker(Tp + 12)[,1] \\\\ a_p = -12 is divisible by p = 3\n            %3 = [-1/32, -1/4, -1/32, 1]~\n            ? msissymbol(M,phi)\n            %4 = 1\n            ? Mp = mspadicinit(M,3,5,0);\n            ? PHI = mstooms(Mp,phi);\n             *** at top-level: PHI=mstooms(Mp,phi)\n             *** ^---------------\n             *** mstooms: incorrect type in mstooms [v_p(ap) > mspadicinit flag] (t_VEC).\n            ? Mp = mspadicinit(M,3,5,1);\n            ? PHI = mstooms(Mp,phi);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1169mstooms(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Mp = 0;
  PyObject *__pyx_v_phi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mstooms (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Mp,&__pyx_n_s_phi,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_Mp)) != 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_phi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mstooms", 1, 2, 2, 1); __PYX_ERR(4, 21014, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mstooms") < 0)) __PYX_ERR(4, 21014, __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_Mp = values[0];
    __pyx_v_phi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mstooms", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21014, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mstooms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1168mstooms(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Mp, __pyx_v_phi);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1168mstooms(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Mp, PyObject *__pyx_v_phi) {
  GEN __pyx_v__Mp;
  GEN __pyx_v__phi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mstooms", 0);
  __Pyx_INCREF(__pyx_v_Mp);
  __Pyx_INCREF(__pyx_v_phi);

  /* "cypari/auto_instance.pxi":21081
 *             ? PHI = mstooms(Mp,phi);
 *         '''
 *         Mp = objtogen(Mp)             # <<<<<<<<<<<<<<
 *         phi = objtogen(phi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Mp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Mp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21082
 *         '''
 *         Mp = objtogen(Mp)
 *         phi = objtogen(phi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_phi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21083
 *         Mp = objtogen(Mp)
 *         phi = objtogen(phi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _phi = (<Gen>phi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21083, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21084
 *         phi = objtogen(phi)
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _phi = (<Gen>phi).g
 *         cdef GEN _ret = mstooms(_Mp, _phi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Mp)->__pyx_base.g;
  __pyx_v__Mp = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21085
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _phi = (<Gen>phi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mstooms(_Mp, _phi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_phi)->__pyx_base.g;
  __pyx_v__phi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21086
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _phi = (<Gen>phi).g
 *         cdef GEN _ret = mstooms(_Mp, _phi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mstooms(__pyx_v__Mp, __pyx_v__phi);

  /* "cypari/auto_instance.pxi":21087
 *         cdef GEN _phi = (<Gen>phi).g
 *         cdef GEN _ret = mstooms(_Mp, _phi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def newtonpoly(self, x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21014
 *         return new_gen(_ret)
 * 
 *     def mstooms(self, Mp, phi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, lift the (classical) eigen symbol
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.mstooms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Mp);
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21089
 *         return new_gen(_ret)
 * 
 *     def newtonpoly(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the slopes of the Newton
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1171newtonpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1170newtonpoly[] = "\n        Gives the vector of the slopes of the Newton\n        polygon of the polynomial :math:`x` with respect to the prime number :math:`p`. The :math:`n`\n        components of the vector are in decreasing order, where :math:`n` is equal to the\n        degree of :math:`x`. Vertical slopes occur iff the constant coefficient of :math:`x` is\n        zero and are denoted by :literal:`+oo`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1171newtonpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("newtonpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("newtonpoly", 1, 2, 2, 1); __PYX_ERR(4, 21089, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "newtonpoly") < 0)) __PYX_ERR(4, 21089, __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_x = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("newtonpoly", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21089, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.newtonpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1170newtonpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1170newtonpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("newtonpoly", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":21097
 *         zero and are denoted by :literal:`+oo`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21098
 *         '''
 *         x = objtogen(x)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21099
 *         x = objtogen(x)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21099, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21100
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = newtonpoly(_x, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21101
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = newtonpoly(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21102
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = newtonpoly(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = newtonpoly(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_instance.pxi":21103
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = newtonpoly(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nextprime(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21089
 *         return new_gen(_ret)
 * 
 *     def newtonpoly(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the slopes of the Newton
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.newtonpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21105
 *         return new_gen(_ret)
 * 
 *     def nextprime(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the smallest pseudoprime (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1173nextprime(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1172nextprime[] = "\n        Finds the smallest pseudoprime (see\n        :literal:`ispseudoprime`) greater than or equal to :math:`x`. :math:`x` can be of any real\n        type. Note that if :math:`x` is a pseudoprime, this function returns :math:`x` and not\n        the smallest pseudoprime strictly larger than :math:`x`. To rigorously prove that\n        the result is prime, use :literal:`isprime`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1173nextprime(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nextprime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1172nextprime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1172nextprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nextprime", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":21113
 *         the result is prime, use :literal:`isprime`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21114
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nextprime(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21114, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21115
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nextprime(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21116
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nextprime(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nextprime(__pyx_v__x);

  /* "cypari/auto_instance.pxi":21117
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nextprime(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfalgtobasis(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21105
 *         return new_gen(_ret)
 * 
 *     def nextprime(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the smallest pseudoprime (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nextprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21119
 *         return new_gen(_ret)
 * 
 *     def nfalgtobasis(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :math:`nf`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1175nfalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1174nfalgtobasis[] = "\n        Given an algebraic number :math:`x` in the number field :math:`nf`,\n        transforms it to a column vector on the integral basis :literal:`:emphasis:`nf`.zk`.\n        \n        ::\n        \n            ? nf = nfinit(y^2 + 4);\n            ? nf.zk\n            %2 = [1, 1/2*y]\n            ? nfalgtobasis(nf, [1,1]~)\n            %3 = [1, 1]~\n            ? nfalgtobasis(nf, y)\n            %4 = [0, 2]~\n            ? nfalgtobasis(nf, Mod(y, y^2+4))\n            %5 = [0, 2]~\n        \n        This is the inverse function of :literal:`nfbasistoalg`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1175nfalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfalgtobasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfalgtobasis", 1, 2, 2, 1); __PYX_ERR(4, 21119, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfalgtobasis") < 0)) __PYX_ERR(4, 21119, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfalgtobasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21119, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1174nfalgtobasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1174nfalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":21138
 *         This is the inverse function of :literal:`nfbasistoalg`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21139
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21140
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21140, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21141
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtobasis(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21142
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtobasis(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21143
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtobasis(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtobasis(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":21144
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtobasis(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfbasis(self, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21119
 *         return new_gen(_ret)
 * 
 *     def nfalgtobasis(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :math:`nf`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21146
 *         return new_gen(_ret)
 * 
 *     def nfbasis(self, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`T(X)` be an irreducible polynomial with integral coefficients. This
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1177nfbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_T); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1176nfbasis[] = "\n        Let :math:`T(X)` be an irreducible polynomial with integral coefficients. This\n        function returns an integral basis of the number field defined by :math:`T`,\n        that is a :math:`\\mathbb{Z}`-basis of its maximal order. The basis elements are given as\n        elements in :math:`\\mathbb{Q}[X]/(T)`:\n        \n        ::\n        \n            ? nfbasis(x^2 + 1)\n            %1 = [1, x]\n        \n        This function uses a modified version of the round 4 algorithm,\n        due to David Ford, Sebastian Pauli and Xavier Roblot.\n        \n        :strong:`Local basis, orders maximal at certain primes.`\n        \n        Obtaining the maximal order is hard: it requires factoring the discriminant\n        :math:`D` of :math:`T`. Obtaining an order which is maximal at a finite explicit set of\n        primes is easy, but it may then be a strict suborder of the maximal order. To\n        specify that we are interested in a given set of places only, we can replace\n        the argument :math:`T` by an argument :math:`[T,listP]`, where :emphasis:`listP` encodes\n        the primes we are interested in: it must be a factorization matrix, a vector\n        of integers or a single integer.\n        \n        - Vector: we assume that it contains distinct :emphasis:`prime` numbers.\n        \n        - Matrix: we assume that it is a two-column matrix of a\n          (partial) factorization of :math:`D`; namely the first column contains\n          distinct :emphasis:`primes` and the second one the valuation of :math:`D` at each of\n          these primes.\n        \n        - Integer :math:`B`: this is replaced by the vector of primes up to :math:`B`. Note\n          that the function will use at least :math:`O(B)` time: a small value, about\n          :math:`10^5`, should be enough for most applications. Values larger than :math:`2^{32}`\n          are not supported.\n        \n        In all these cases, the primes may or may not divide the discrimina""nt :math:`D`\n        of :math:`T`. The function then returns a :math:`\\mathbb{Z}`-basis of an order whose index is\n        not divisible by any of these prime numbers. The result is actually a global\n        integral basis if all prime divisors of the :emphasis:`field` discriminant are\n        included! Note that :literal:`nfinit` has built-in support for such\n        a check:\n        \n        ::\n        \n            ? K = nfinit([T, listP]);\n            ? nfcertify(K) \\\\ we computed an actual maximal order\n            %2 = [];\n        \n        The first line initializes a number field structure\n        incorporating :literal:`nfbasis([T, listP]` in place of a proven integral basis.\n        The second line certifies that the resulting structure is correct. This\n        allows to create an :literal:`nf` structure attached to the number field :math:`K =\n        \\mathbb{Q}[X]/(T)`, when the discriminant of :math:`T` cannot be factored completely,\n        whereas the prime divisors of :math:`\\mathrm{disc} K` are known.\n        \n        Of course, if :emphasis:`listP` contains a single prime number :math:`p`,\n        the function returns a local integral basis for :math:`\\mathbb{Z}_p[X]/(T)`:\n        \n        ::\n        \n            ? nfbasis(x^2+x-1001)\n            %1 = [1, 1/3*x - 1/3]\n            ? nfbasis( [x^2+x-1001, [2]] )\n            %2 = [1, x]\n        \n        :strong:`The Buchmann-Lenstra algorithm.`\n        \n        We now complicate the picture: it is in fact allowed to include\n        :emphasis:`composite` numbers instead of primes\n        in :literal:`listP` (Vector or Matrix case), provided they are pairwise coprime.\n        The result will still be a correct integral basis :emphasis:`if`\n        the field discriminant factors completely over the actual primes in the list.\n        Adding a composite :math:`C` such that :math:`C^2` :emphasis:`divides` :math:`D` may help because\n        when we consider :math:`C` ""as a prime and run the algorithm, two good things can\n        happen: either we\n        succeed in proving that no prime dividing :math:`C` can divide the index\n        (without actually needing to find those primes), or the computation\n        exhibits a non-trivial zero divisor, thereby factoring :math:`C` and\n        we go on with the refined factorization. (Note that including a :math:`C`\n        such that :math:`C^2` does not divide :math:`D` is useless.) If neither happen, then the\n        computed basis need not generate the maximal order. Here is an example:\n        \n        ::\n        \n            ? B = 10^5;\n            ? P = factor(poldisc(T), B)[,1]; \\\\ primes <= B dividing D + cofactor\n            ? basis = nfbasis([T, listP])\n            ? disc = nfdisc([T, listP])\n        \n        We obtain the maximal order and its discriminant if the\n        field discriminant factors\n        completely over the primes less than :math:`B` (together with the primes\n        contained in the :literal:`addprimes` table). This can be tested as follows:\n        \n        ::\n        \n             check = factor(disc, B);\n             lastp = check[-1..-1,1];\n             if (lastp > B && !setsearch(addprimes(), lastp),\n             warning(\"nf may be incorrect!\"))\n        \n        This is a sufficient but not a necessary condition, hence the warning,\n        instead of an error. N.B. :literal:`lastp` is the last entry\n        in the first column of the :literal:`check` matrix, i.e. the largest prime\n        dividing :literal:`nf.disc` if :math:`<= B` or if it belongs to the prime table.\n        \n        The function :literal:`nfcertify` speeds up and automates the above process:\n        \n        ::\n        \n            ? B = 10^5;\n            ? nf = nfinit([T, B]);\n            ? nfcertify(nf)\n            %3 = [] \\\\ nf is unconditionally correct\n            ? basis = nf.zk;\n            ? disc = nf.disc;\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1177nfbasis(PyObject *__pyx_v_self, PyObject *__pyx_v_T) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1176nfbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_T));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1176nfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfbasis", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":21265
 *             ? disc = nf.disc;
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21266
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfbasis_gp(_T)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21266, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21267
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfbasis_gp(_T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21268
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfbasis_gp(_T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfbasis_gp(__pyx_v__T);

  /* "cypari/auto_instance.pxi":21269
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfbasis_gp(_T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfbasistoalg(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21146
 *         return new_gen(_ret)
 * 
 *     def nfbasis(self, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`T(X)` be an irreducible polynomial with integral coefficients. This
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21271
 *         return new_gen(_ret)
 * 
 *     def nfbasistoalg(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :emphasis:`nf`, transforms it
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1179nfbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1178nfbasistoalg[] = "\n        Given an algebraic number :math:`x` in the number field :emphasis:`nf`, transforms it\n        into :literal:`t_POLMOD` form.\n        \n        ::\n        \n            ? nf = nfinit(y^2 + 4);\n            ? nf.zk\n            %2 = [1, 1/2*y]\n            ? nfbasistoalg(nf, [1,1]~)\n            %3 = Mod(1/2*y + 1, y^2 + 4)\n            ? nfbasistoalg(nf, y)\n            %4 = Mod(y, y^2 + 4)\n            ? nfbasistoalg(nf, Mod(y, y^2+4))\n            %5 = Mod(y, y^2 + 4)\n        \n        This is the inverse function of :literal:`nfalgtobasis`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1179nfbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfbasistoalg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfbasistoalg", 1, 2, 2, 1); __PYX_ERR(4, 21271, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfbasistoalg") < 0)) __PYX_ERR(4, 21271, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfbasistoalg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21271, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1178nfbasistoalg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1178nfbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":21290
 *         This is the inverse function of :literal:`nfalgtobasis`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21291
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21292
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21292, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21293
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = basistoalg(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21294
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = basistoalg(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21295
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = basistoalg(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = basistoalg(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":21296
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = basistoalg(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfcertify(self, nf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21271
 *         return new_gen(_ret)
 * 
 *     def nfbasistoalg(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :emphasis:`nf`, transforms it
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21298
 *         return new_gen(_ret)
 * 
 *     def nfcertify(self, nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1181nfcertify(PyObject *__pyx_v_self, PyObject *__pyx_v_nf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1180nfcertify[] = "\n        :math:`nf` being as output by\n        :literal:`nfinit`, checks whether the integer basis is known unconditionally.\n        This is in particular useful when the argument to :literal:`nfinit` was of the\n        form :math:`[T, listP]`, specifying a finite list of primes when\n        :math:`p`-maximality had to be proven, or a list of coprime integers to which\n        Buchmann-Lenstra algorithm was to be applied.\n        \n        The function returns a vector of coprime composite integers. If this vector\n        is empty, then :literal:`nf.zk` and :literal:`nf.disc` are correct. Otherwise, the\n        result is dubious. In order to obtain a certified result, one must completely\n        factor each of the given integers, then :literal:`addprime` each of their prime\n        factors, then check whether :literal:`nfdisc(nf.pol)` is equal to :literal:`nf.disc`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1181nfcertify(PyObject *__pyx_v_self, PyObject *__pyx_v_nf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfcertify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1180nfcertify(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_nf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1180nfcertify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfcertify", 0);
  __Pyx_INCREF(__pyx_v_nf);

  /* "cypari/auto_instance.pxi":21313
 *         factors, then check whether :literal:`nfdisc(nf.pol)` is equal to :literal:`nf.disc`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21314
 *         '''
 *         nf = objtogen(nf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = nfcertify(_nf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21314, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21315
 *         nf = objtogen(nf)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfcertify(_nf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21316
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = nfcertify(_nf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfcertify(__pyx_v__nf);

  /* "cypari/auto_instance.pxi":21317
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = nfcertify(_nf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfcompositum(self, nf, P, Q, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21298
 *         return new_gen(_ret)
 * 
 *     def nfcertify(self, nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfcertify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21319
 *         return new_gen(_ret)
 * 
 *     def nfcompositum(self, nf, P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field structure attached to the field :math:`K`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1183nfcompositum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1182nfcompositum[] = "\n        Let :emphasis:`nf` be a number field structure attached to the field :math:`K`\n        and let :math:`P` and :math:`Q`\n        be squarefree polynomials in :math:`K[X]` in the same variable. Outputs\n        the simple factors of the \303\251tale :math:`K`-algebra :math:`A = K[X, Y] / (P(X), Q(Y))`.\n        The factors are given by a list of polynomials :math:`R` in :math:`K[X]`, attached to\n        the number field :math:`K[X]/ (R)`, and sorted by increasing degree (with respect\n        to lexicographic ordering for factors of equal degrees). Returns an error if\n        one of the polynomials is not squarefree.\n        \n        Note that it is more efficient to reduce to the case where :math:`P` and :math:`Q` are\n        irreducible first. The routine will not perform this for you, since it may be\n        expensive, and the inputs are irreducible in most applications anyway. In\n        this case, there will be a single factor :math:`R` if and only if the number\n        fields defined by :math:`P` and :math:`Q` are linearly disjoint (their intersection is\n        :math:`K`).\n        \n        The binary digits of :math:`flag` mean\n        \n        1: outputs a vector of 4-component vectors :math:`[R,a,b,k]`, where :math:`R`\n        ranges through the list of all possible compositums as above, and :math:`a`\n        (resp. :math:`b`) expresses the root of :math:`P` (resp. :math:`Q`) as an element of\n        :math:`K[X]/(R)`. Finally, :math:`k` is a small integer such that :math:`b + ka = X` modulo\n        :math:`R`.\n        \n        2: assume that :math:`P` and :math:`Q` define number fields that are linearly disjoint:\n        both polynomials are irreducible and the corresponding number fields\n        have no common subfield besides :math:`K`. This allows to save a costly\n        factorization over :math:`K`. In this case return the single simple factor\n        instead of a vector with one element.\n        \n        A compositum i""s often defined by a complicated polynomial, which it is\n        advisable to reduce before further work. Here is an example involving\n        the field :math:`K(\\zeta_5, 5^{1/10})`, :math:`K = \\mathbb{Q} (\\sqrt{5})`:\n        \n        ::\n        \n            ? K = nfinit(y^2-5);\n            ? L = nfcompositum(K, x^5 - y, polcyclo(5), 1); \\\\ list of [R,a,b,k]\n            ? [R, a] = L[1]; \\\\ pick the single factor, extract R,a (ignore b,k)\n            ? lift(R) \\\\ defines the compositum\n            %4 = x^10 + (-5/2*y + 5/2)*x^9 + (-5*y + 20)*x^8 + (-20*y + 30)*x^7 + \\\n            (-45/2*y + 145/2)*x^6 + (-71/2*y + 121/2)*x^5 + (-20*y + 60)*x^4 + \\\n            (-25*y + 5)*x^3 + 45*x^2 + (-5*y + 15)*x + (-2*y + 6)\n            ? a^5 - y \\\\ a fifth root of y\n            %5 = 0\n            ? [T, X] = rnfpolredbest(K, R, 1);\n            ? lift(T) \\\\ simpler defining polynomial for K[x]/(R)\n            %7 = x^10 + (-11/2*y + 25/2)\n            ? liftall(X) \\\\  root of R in K[x]/(T(x))\n            %8 = (3/4*y + 7/4)*x^7 + (-1/2*y - 1)*x^5 + 1/2*x^2 + (1/4*y - 1/4)\n            ? a = subst(a.pol, 'x, X); \\\\ a in the new coordinates\n            ? liftall(a)\n            %10 = (-3/4*y - 7/4)*x^7 - 1/2*x^2\n            ? a^5 - y\n            %11 = 0\n        \n        The main variables of :math:`P` and :math:`Q` must be the same and have higher priority\n        than that of :emphasis:`nf` (see\302\240:literal:`varhigher` and\302\240:literal:`varlower`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1183nfcompositum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfcompositum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_flag,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_nf)) != 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_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfcompositum", 0, 3, 4, 1); __PYX_ERR(4, 21319, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfcompositum", 0, 3, 4, 2); __PYX_ERR(4, 21319, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfcompositum") < 0)) __PYX_ERR(4, 21319, __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_nf = values[0];
    __pyx_v_P = values[1];
    __pyx_v_Q = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 21319, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfcompositum", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21319, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1182nfcompositum(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_P, __pyx_v_Q, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1182nfcompositum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfcompositum", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":21380
 *         than that of :emphasis:`nf` (see:literal:`varhigher` and:literal:`varlower`).
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21381
 *         '''
 *         nf = objtogen(nf)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21382
 *         nf = objtogen(nf)
 *         P = objtogen(P)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21383
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21383, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21384
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21385
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21386
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21387
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfcompositum(__pyx_v__nf, __pyx_v__P, __pyx_v__Q, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":21388
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfdetint(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21319
 *         return new_gen(_ret)
 * 
 *     def nfcompositum(self, nf, P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field structure attached to the field :math:`K`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21390
 *         return new_gen(_ret)
 * 
 *     def nfdetint(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`x`, computes a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1185nfdetint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1184nfdetint[] = "\n        Given a pseudo-matrix :math:`x`, computes a\n        non-zero ideal contained in (i.e.\302\240multiple of) the determinant of :math:`x`. This\n        is particularly useful in conjunction with :literal:`nfhnfmod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1185nfdetint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfdetint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfdetint", 1, 2, 2, 1); __PYX_ERR(4, 21390, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfdetint") < 0)) __PYX_ERR(4, 21390, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfdetint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21390, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfdetint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1184nfdetint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1184nfdetint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfdetint", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":21396
 *         is particularly useful in conjunction with :literal:`nfhnfmod`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21397
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21398
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21398, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21399
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfdetint(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21400
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdetint(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21401
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfdetint(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdetint(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":21402
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfdetint(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfdisc(self, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21390
 *         return new_gen(_ret)
 * 
 *     def nfdetint(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`x`, computes a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfdetint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21404
 *         return new_gen(_ret)
 * 
 *     def nfdisc(self, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         field discriminant of the number field defined by the integral,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1187nfdisc(PyObject *__pyx_v_self, PyObject *__pyx_v_T); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1186nfdisc[] = "\n        field discriminant of the number field defined by the integral,\n        preferably monic, irreducible polynomial :math:`T(X)`. Returns the discriminant of\n        the number field :math:`\\mathbb{Q}[X]/(T)`, using the Round :math:`4` algorithm.\n        \n        :strong:`Local discriminants, valuations at certain primes.`\n        \n        As in :literal:`nfbasis`, the argument :math:`T` can be replaced by :math:`[T,listP]`,\n        where :literal:`listP` is as in :literal:`nfbasis`: a vector of\n        pairwise coprime integers (usually distinct primes), a factorization matrix,\n        or a single integer. In that case, the function returns the discriminant of\n        an order whose basis is given by :literal:`nfbasis(T,listP)`, which need not be\n        the maximal order, and whose valuation at a prime entry in :literal:`listP` is the\n        same as the valuation of the field discriminant.\n        \n        In particular, if :literal:`listP` is :math:`[p]` for a prime :math:`p`, we can\n        return the :math:`p`-adic discriminant of the maximal order of :math:`\\mathbb{Z}_p[X]/(T)`,\n        as a power of :math:`p`, as follows:\n        \n        ::\n        \n            ? padicdisc(T,p) = p^valuation(nfdisc([T,[p]]), p);\n            ? nfdisc(x^2 + 6)\n            %2 = -24\n            ? padicdisc(x^2 + 6, 2)\n            %3 = 8\n            ? padicdisc(x^2 + 6, 3)\n            %4 = 3\n        \n        The following function computes the discriminant of the\n        maximal order under the assumption that :math:`P` is a vector of prime numbers\n        containing (at least) all prime divisors of the field discriminant:\n        \n        ::\n        \n            globaldisc(T, P) =\n            { my (D = nfdisc([T, P]));\n             sign(D) * factorback(P, [valuation(D,p) | p <-P]);\n            }\n            ? globaldisc(x^2 + 6, [2, 3, 5])\n            %1 = -24\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1187nfdisc(PyObject *__pyx_v_self, PyObject *__pyx_v_T) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfdisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1186nfdisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_T));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1186nfdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfdisc", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":21447
 *             %1 = -24
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21448
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfdisc(_T)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21448, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21449
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdisc(_T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21450
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfdisc(_T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdisc(__pyx_v__T);

  /* "cypari/auto_instance.pxi":21451
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfdisc(_T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltadd(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21404
 *         return new_gen(_ret)
 * 
 *     def nfdisc(self, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         field discriminant of the number field defined by the integral,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21453
 *         return new_gen(_ret)
 * 
 *     def nfeltadd(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1189nfeltadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1188nfeltadd[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes their sum :math:`x+y` in the number field :math:`nf`.\n        \n        ::\n        \n            ? nf = nfinit(1+x^2);\n            ? nfeltadd(nf, 1, x) \\\\ 1 + I\n            %2 = [1, 1]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1189nfeltadd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltadd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltadd", 1, 3, 3, 1); __PYX_ERR(4, 21453, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltadd", 1, 3, 3, 2); __PYX_ERR(4, 21453, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltadd") < 0)) __PYX_ERR(4, 21453, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltadd", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21453, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1188nfeltadd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1188nfeltadd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltadd", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":21464
 *             %2 = [1, 1]~
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21465
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21466
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21467
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21467, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21468
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21469
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfadd(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21470
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfadd(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21471
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfadd(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfadd(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":21472
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfadd(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdiv(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21453
 *         return new_gen(_ret)
 * 
 *     def nfeltadd(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21474
 *         return new_gen(_ret)
 * 
 *     def nfeltdiv(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1191nfeltdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1190nfeltdiv[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes their quotient :math:`x/y` in the number field :math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1191nfeltdiv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdiv", 1, 3, 3, 1); __PYX_ERR(4, 21474, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdiv", 1, 3, 3, 2); __PYX_ERR(4, 21474, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdiv") < 0)) __PYX_ERR(4, 21474, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdiv", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21474, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1190nfeltdiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1190nfeltdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltdiv", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":21479
 *         :emphasis:`nf`, computes their quotient :math:`x/y` in the number field :math:`nf`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21480
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21481
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21482
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21482, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21483
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21484
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21485
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21486
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdiv(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":21487
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdiveuc(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21474
 *         return new_gen(_ret)
 * 
 *     def nfeltdiv(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21489
 *         return new_gen(_ret)
 * 
 *     def nfeltdiveuc(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1193nfeltdiveuc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1192nfeltdiveuc[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes an algebraic integer :math:`q` in the number field :math:`nf`\n        such that the components of :math:`x-qy` are reasonably small. In fact, this is\n        functionally identical to :literal:`round(nfdiv(:emphasis:`nf`,x,y))`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1193nfeltdiveuc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdiveuc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdiveuc", 1, 3, 3, 1); __PYX_ERR(4, 21489, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdiveuc", 1, 3, 3, 2); __PYX_ERR(4, 21489, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdiveuc") < 0)) __PYX_ERR(4, 21489, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdiveuc", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21489, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdiveuc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1192nfeltdiveuc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1192nfeltdiveuc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltdiveuc", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":21496
 *         functionally identical to :literal:`round(nfdiv(:emphasis:`nf`,x,y))`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21497
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21498
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21499
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21499, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21500
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21501
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21502
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21503
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdiveuc(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":21504
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdivmodpr(self, nf, x, y, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21489
 *         return new_gen(_ret)
 * 
 *     def nfeltdiveuc(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdiveuc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21506
 *         return new_gen(_ret)
 * 
 *     def nfeltdivmodpr(self, nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1195nfeltdivmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1194nfeltdivmodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given two elements :math:`x`\n        and :math:`y` in :emphasis:`nf` and :emphasis:`pr` a prime ideal in :literal:`modpr` format (see\n        :literal:`nfmodprinit`), computes their quotient :math:`x / y` modulo the prime ideal\n        :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1195nfeltdivmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdivmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_pr,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivmodpr", 1, 4, 4, 1); __PYX_ERR(4, 21506, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivmodpr", 1, 4, 4, 2); __PYX_ERR(4, 21506, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivmodpr", 1, 4, 4, 3); __PYX_ERR(4, 21506, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdivmodpr") < 0)) __PYX_ERR(4, 21506, __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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    __pyx_v_pr = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdivmodpr", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21506, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdivmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1194nfeltdivmodpr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1194nfeltdivmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltdivmodpr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":21515
 *         :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21515, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21516
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21517
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21517, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21518
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21518, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21519
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21520
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21521
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21521, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21522
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21523
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21524
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21525
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21526
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdivmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":21527
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdivrem(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21506
 *         return new_gen(_ret)
 * 
 *     def nfeltdivmodpr(self, nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdivmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21529
 *         return new_gen(_ret)
 * 
 *     def nfeltdivrem(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1197nfeltdivrem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1196nfeltdivrem[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, gives a two-element row vector :math:`[q,r]` such that :math:`x = qy+r`, :math:`q` is\n        an algebraic integer in :math:`nf`, and the components of :math:`r` are\n        reasonably small.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1197nfeltdivrem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdivrem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivrem", 1, 3, 3, 1); __PYX_ERR(4, 21529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivrem", 1, 3, 3, 2); __PYX_ERR(4, 21529, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdivrem") < 0)) __PYX_ERR(4, 21529, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdivrem", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21529, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdivrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1196nfeltdivrem(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1196nfeltdivrem(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltdivrem", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":21536
 *         reasonably small.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21537
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21538
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21538, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21539
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21539, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21540
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21541
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21542
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21543
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdivrem(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":21544
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltembed(self, nf, x, pl=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21529
 *         return new_gen(_ret)
 * 
 *     def nfeltdivrem(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltdivrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21546
 *         return new_gen(_ret)
 * 
 *     def nfeltembed(self, nf, x, pl=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1199nfeltembed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1198nfeltembed[] = "\n        Given an element :math:`x` in the number field :emphasis:`nf`, return\n        the (real or) complex embeddings of :math:`x` specified by optional argument\n        :emphasis:`pl`, at the current :literal:`realprecision`:\n        \n        - :emphasis:`pl` omitted: return the vector of embeddings at all :math:`r_1+r_2`\n          places;\n        \n        - :emphasis:`pl` an integer between :math:`1` and :math:`r_1+r_2`: return the\n          :math:`i`-th embedding of :math:`x`, attached to the :math:`i`-th root of :literal:`nf.pol`,\n          i.e. :literal:`nf.roots:math:`[i]``;\n        \n        - :emphasis:`pl` a vector or :literal:`t_VECSMALL`: return the vector of embeddings; the :math:`i`-th\n          entry gives the embedding at the place attached to the :math:`pl[i]`-th real\n          root of :literal:`nf.pol`.\n        \n        ::\n        \n            ? nf = nfinit('y^3 - 2);\n            ? nf.sign\n            %2 = [1, 1]\n            ? nfeltembed(nf, 'y)\n            %3 = [1.25992[...], -0.62996[...] + 1.09112[...]*I]]\n            ? nfeltembed(nf, 'y, 1)\n            %4 = 1.25992[...]\n            ? nfeltembed(nf, 'y, 3) \\\\ there are only 2 arch. places\n             *** at top-level: nfeltembed(nf,'y,3)\n             *** ^-----------------\n             *** nfeltembed: domain error in nfeltembed: index > 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1199nfeltembed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pl = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltembed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_pl,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltembed", 0, 2, 4, 1); __PYX_ERR(4, 21546, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltembed") < 0)) __PYX_ERR(4, 21546, __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);
        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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_pl = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 21546, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltembed", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21546, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1198nfeltembed(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_pl, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1198nfeltembed(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl, long __pyx_v_precision) {
  int __pyx_v__have_pl;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltembed", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":21577
 *              *** nfeltembed: domain error in nfeltembed: index > 2
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21578
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21579
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":21580
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21581
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":21580
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":21582
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21582, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21583
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21584
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21585
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_instance.pxi":21586
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21587
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":21586
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":21588
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":21589
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfeltembed(__pyx_v__nf, __pyx_v__x, __pyx_v__pl, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":21590
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltmod(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21546
 *         return new_gen(_ret)
 * 
 *     def nfeltembed(self, nf, x, pl=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21592
 *         return new_gen(_ret)
 * 
 *     def nfeltmod(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1201nfeltmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1200nfeltmod[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes an element :math:`r` of :math:`nf` of the form :math:`r = x-qy` with\n        :math:`q` and algebraic integer, and such that :math:`r` is small. This is functionally\n        identical to\n        \n        .. MATH::\n        \n            x - nfmul(nf,round(nfdiv(nf,x,y)),y).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1201nfeltmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmod", 1, 3, 3, 1); __PYX_ERR(4, 21592, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmod", 1, 3, 3, 2); __PYX_ERR(4, 21592, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltmod") < 0)) __PYX_ERR(4, 21592, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltmod", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21592, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1200nfeltmod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1200nfeltmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltmod", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":21603
 *             x - nfmul(nf,round(nfdiv(nf,x,y)),y).
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21604
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21605
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21606
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21606, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21607
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21608
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmod(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21609
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmod(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21610
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmod(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmod(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":21611
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmod(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltmul(self, nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21592
 *         return new_gen(_ret)
 * 
 *     def nfeltmod(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21613
 *         return new_gen(_ret)
 * 
 *     def nfeltmul(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1203nfeltmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1202nfeltmul[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes their product :math:`x*y` in the number field :math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1203nfeltmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmul", 1, 3, 3, 1); __PYX_ERR(4, 21613, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmul", 1, 3, 3, 2); __PYX_ERR(4, 21613, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltmul") < 0)) __PYX_ERR(4, 21613, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltmul", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21613, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1202nfeltmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1202nfeltmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltmul", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":21618
 *         :emphasis:`nf`, computes their product :math:`x*y` in the number field :math:`nf`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21619
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21620
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21621
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21621, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21622
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21623
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmul(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21624
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmul(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21625
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmul(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmul(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":21626
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmul(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltmulmodpr(self, nf, x, y, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21613
 *         return new_gen(_ret)
 * 
 *     def nfeltmul(self, nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21628
 *         return new_gen(_ret)
 * 
 *     def nfeltmulmodpr(self, nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1205nfeltmulmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1204nfeltmulmodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given two elements :math:`x` and\n        :math:`y` in :emphasis:`nf` and :emphasis:`pr` a prime ideal in :literal:`modpr` format (see\n        :literal:`nfmodprinit`), computes their product :math:`x*y` modulo the prime ideal\n        :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1205nfeltmulmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltmulmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_pr,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmulmodpr", 1, 4, 4, 1); __PYX_ERR(4, 21628, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmulmodpr", 1, 4, 4, 2); __PYX_ERR(4, 21628, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmulmodpr", 1, 4, 4, 3); __PYX_ERR(4, 21628, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltmulmodpr") < 0)) __PYX_ERR(4, 21628, __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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    __pyx_v_pr = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltmulmodpr", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21628, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltmulmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1204nfeltmulmodpr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_y, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1204nfeltmulmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltmulmodpr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":21637
 *         :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21637, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21638
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21639
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21640
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21641
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21642
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21643
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21643, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21644
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21645
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21646
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21647
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21648
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmulmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":21649
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltnorm(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21628
 *         return new_gen(_ret)
 * 
 *     def nfeltmulmodpr(self, nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltmulmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21651
 *         return new_gen(_ret)
 * 
 *     def nfeltnorm(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute norm of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1207nfeltnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1206nfeltnorm[] = "\n        Returns the absolute norm of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1207nfeltnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltnorm", 1, 2, 2, 1); __PYX_ERR(4, 21651, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltnorm") < 0)) __PYX_ERR(4, 21651, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltnorm", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21651, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1206nfeltnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1206nfeltnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltnorm", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":21655
 *         Returns the absolute norm of :math:`x`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21656
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21657
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21657, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21658
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfnorm(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21659
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfnorm(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21660
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfnorm(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfnorm(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":21661
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfnorm(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltpow(self, nf, x, k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21651
 *         return new_gen(_ret)
 * 
 *     def nfeltnorm(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute norm of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21663
 *         return new_gen(_ret)
 * 
 *     def nfeltpow(self, nf, x, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`nf`, and a positive or negative integer :math:`k`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1209nfeltpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1208nfeltpow[] = "\n        Given an element :math:`x` in :emphasis:`nf`, and a positive or negative integer :math:`k`,\n        computes :math:`x^k` in the number field :math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1209nfeltpow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_k,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpow", 1, 3, 3, 1); __PYX_ERR(4, 21663, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpow", 1, 3, 3, 2); __PYX_ERR(4, 21663, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltpow") < 0)) __PYX_ERR(4, 21663, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_k = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltpow", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21663, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1208nfeltpow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_k);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1208nfeltpow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltpow", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_instance.pxi":21668
 *         computes :math:`x^k` in the number field :math:`nf`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         k = objtogen(k)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21669
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         k = objtogen(k)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21670
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21671
 *         x = objtogen(x)
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21671, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21672
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21673
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = nfpow(_nf, _x, _k)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21674
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfpow(_nf, _x, _k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21675
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = nfpow(_nf, _x, _k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfpow(__pyx_v__nf, __pyx_v__x, __pyx_v__k);

  /* "cypari/auto_instance.pxi":21676
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = nfpow(_nf, _x, _k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltpowmodpr(self, nf, x, k, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21663
 *         return new_gen(_ret)
 * 
 *     def nfeltpow(self, nf, x, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`nf`, and a positive or negative integer :math:`k`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21678
 *         return new_gen(_ret)
 * 
 *     def nfeltpowmodpr(self, nf, x, k, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1211nfeltpowmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1210nfeltpowmodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given an element :math:`x` in :emphasis:`nf`, an integer :math:`k` and a prime ideal\n        :emphasis:`pr` in :literal:`modpr` format\n        (see :literal:`nfmodprinit`), computes :math:`x^k` modulo the prime ideal :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1211nfeltpowmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltpowmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_k,&__pyx_n_s_pr,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpowmodpr", 1, 4, 4, 1); __PYX_ERR(4, 21678, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpowmodpr", 1, 4, 4, 2); __PYX_ERR(4, 21678, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpowmodpr", 1, 4, 4, 3); __PYX_ERR(4, 21678, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltpowmodpr") < 0)) __PYX_ERR(4, 21678, __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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_k = values[2];
    __pyx_v_pr = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltpowmodpr", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21678, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltpowmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1210nfeltpowmodpr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_k, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1210nfeltpowmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltpowmodpr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_k);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":21686
 *         (see :literal:`nfmodprinit`), computes :math:`x^k` modulo the prime ideal :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21686, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21687
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21688
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         k = objtogen(k)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21689
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         k = objtogen(k)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21690
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21691
 *         x = objtogen(x)
 *         k = objtogen(k)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21692
 *         k = objtogen(k)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21692, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21693
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21694
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21695
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21696
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21697
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfpowmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__k, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":21698
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltreduce(self, nf, a, id):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21678
 *         return new_gen(_ret)
 * 
 *     def nfeltpowmodpr(self, nf, x, k, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltpowmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21700
 *         return new_gen(_ret)
 * 
 *     def nfeltreduce(self, nf, a, id):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an ideal :emphasis:`id` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1213nfeltreduce(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1212nfeltreduce[] = "\n        Given an ideal :emphasis:`id` in\n        Hermite normal form and an element :math:`a` of the number field :math:`nf`,\n        finds an element :math:`r` in :math:`nf` such that :math:`a-r` belongs to the ideal\n        and :math:`r` is small.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1213nfeltreduce(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltreduce (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_a,&__pyx_n_s_id,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltreduce", 1, 3, 3, 1); __PYX_ERR(4, 21700, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltreduce", 1, 3, 3, 2); __PYX_ERR(4, 21700, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltreduce") < 0)) __PYX_ERR(4, 21700, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_a = values[1];
    __pyx_v_id = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltreduce", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21700, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltreduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1212nfeltreduce(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_a, __pyx_v_id);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1212nfeltreduce(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_id) {
  GEN __pyx_v__nf;
  GEN __pyx_v__a;
  GEN __pyx_v__id;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltreduce", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_id);

  /* "cypari/auto_instance.pxi":21707
 *         and :math:`r` is small.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         id = objtogen(id)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21707, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21708
 *         '''
 *         nf = objtogen(nf)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         id = objtogen(id)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21709
 *         nf = objtogen(nf)
 *         a = objtogen(a)
 *         id = objtogen(id)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_id, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_id, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21710
 *         a = objtogen(a)
 *         id = objtogen(id)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21710, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21711
 *         id = objtogen(id)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _id = (<Gen>id).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21712
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _id = (<Gen>id).g
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21713
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _id = (<Gen>id).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_id)->__pyx_base.g;
  __pyx_v__id = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21714
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _id = (<Gen>id).g
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfreduce(__pyx_v__nf, __pyx_v__a, __pyx_v__id);

  /* "cypari/auto_instance.pxi":21715
 *         cdef GEN _id = (<Gen>id).g
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltreducemodpr(self, nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21700
 *         return new_gen(_ret)
 * 
 *     def nfeltreduce(self, nf, a, id):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an ideal :emphasis:`id` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltreduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_id);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21717
 *         return new_gen(_ret)
 * 
 *     def nfeltreducemodpr(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1215nfeltreducemodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1214nfeltreducemodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given an element :math:`x` of the number field :math:`nf` and a prime ideal\n        :emphasis:`pr` in :literal:`modpr` format compute a canonical representative for the\n        class of :math:`x` modulo :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1215nfeltreducemodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltreducemodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltreducemodpr", 1, 3, 3, 1); __PYX_ERR(4, 21717, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltreducemodpr", 1, 3, 3, 2); __PYX_ERR(4, 21717, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltreducemodpr") < 0)) __PYX_ERR(4, 21717, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltreducemodpr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21717, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltreducemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1214nfeltreducemodpr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1214nfeltreducemodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltreducemodpr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":21725
 *         class of :math:`x` modulo :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21725, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21726
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21727
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21728
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21729
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21730
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21730, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21731
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21732
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21733
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21734
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfreducemodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":21735
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltsign(self, nf, x, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21717
 *         return new_gen(_ret)
 * 
 *     def nfeltreducemodpr(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltreducemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21737
 *         return new_gen(_ret)
 * 
 *     def nfeltsign(self, nf, x, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, returns the signs of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1217nfeltsign(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1216nfeltsign[] = "\n        Given an element :math:`x` in the number field :emphasis:`nf`, returns the signs of\n        the real embeddings of :math:`x` specified by optional argument :emphasis:`pl`:\n        \n        - :emphasis:`pl` omitted: return the vector of signs at all :math:`r_1` real places;\n        \n        - :emphasis:`pl` an integer between :math:`1` and :math:`r_1`: return the sign of the\n          :math:`i`-th embedding of :math:`x`, attached to the :math:`i`-th real root of :literal:`nf.pol`,\n          i.e. :literal:`nf.roots:math:`[i]``;\n        \n        - :emphasis:`pl` a vector or :literal:`t_VECSMALL`: return the vector of signs; the :math:`i`-th\n          entry gives the sign at the real place attached to the :math:`pl[i]`-th real\n          root of :literal:`nf.pol`.\n        \n        ::\n        \n            ? nf = nfinit(polsubcyclo(11,5,'y)); \\\\ Q(cos(2 pi/11))\n            ? nf.sign\n            %2 = [5, 0]\n            ? x = Mod('y, nf.pol);\n            ? nfeltsign(nf, x)\n            %4 = [-1, -1, -1, 1, 1]\n            ? nfeltsign(nf, x, 1)\n            %5 = -1\n            ? nfeltsign(nf, x, [1..4])\n            %6 = [-1, -1, -1, 1]\n            ? nfeltsign(nf, x, 6) \\\\ there are only 5 real embeddings\n             *** at top-level: nfeltsign(nf,x,6)\n             *** ^-----------------\n             *** nfeltsign: domain error in nfeltsign: index > 5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1217nfeltsign(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltsign (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_pl,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltsign", 0, 2, 3, 1); __PYX_ERR(4, 21737, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltsign") < 0)) __PYX_ERR(4, 21737, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_pl = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltsign", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21737, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1216nfeltsign(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_pl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1216nfeltsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltsign", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":21769
 *              *** nfeltsign: domain error in nfeltsign: index > 5
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21770
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21771
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":21772
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21773
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":21772
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":21774
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21774, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21775
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21776
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21777
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_instance.pxi":21778
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21779
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":21778
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 */
  }

  /* "cypari/auto_instance.pxi":21780
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfeltsign(__pyx_v__nf, __pyx_v__x, __pyx_v__pl);

  /* "cypari/auto_instance.pxi":21781
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfelttrace(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21737
 *         return new_gen(_ret)
 * 
 *     def nfeltsign(self, nf, x, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, returns the signs of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfeltsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21783
 *         return new_gen(_ret)
 * 
 *     def nfelttrace(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute trace of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1219nfelttrace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1218nfelttrace[] = "\n        Returns the absolute trace of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1219nfelttrace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfelttrace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfelttrace", 1, 2, 2, 1); __PYX_ERR(4, 21783, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfelttrace") < 0)) __PYX_ERR(4, 21783, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfelttrace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21783, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfelttrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1218nfelttrace(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1218nfelttrace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfelttrace", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":21787
 *         Returns the absolute trace of :math:`x`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21788
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21789
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21789, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21790
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nftrace(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21791
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nftrace(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21792
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nftrace(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nftrace(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":21793
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nftrace(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nffactor(self, nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21783
 *         return new_gen(_ret)
 * 
 *     def nfelttrace(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute trace of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfelttrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21795
 *         return new_gen(_ret)
 * 
 *     def nffactor(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factorization of the univariate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1221nffactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1220nffactor[] = "\n        Factorization of the univariate\n        polynomial :math:`T` over the number field :math:`nf` given by :literal:`nfinit`; :math:`T`\n        has coefficients in :math:`nf` (i.e.\302\240either scalar, polmod, polynomial or\n        column vector). The factors are sorted by increasing degree.\n        \n        The main variable of :math:`nf` must be of :emphasis:`lower`\n        priority than that of :math:`T`, see ``priority`` (in the PARI manual). However if\n        the polynomial defining the number field occurs explicitly in the\n        coefficients of :math:`T` as modulus of a :literal:`t_POLMOD` or as a :literal:`t_POL`\n        coefficient, its main variable must be :emphasis:`the same` as the main variable\n        of :math:`T`. For example,\n        \n        ::\n        \n            ? nf = nfinit(y^2 + 1);\n            ? nffactor(nf, x^2 + y); \\\\ OK\n            ? nffactor(nf, x^2 + Mod(y, y^2+1)); \\\\  OK\n            ? nffactor(nf, x^2 + Mod(z, z^2+1)); \\\\  WRONG\n        \n        It is possible to input a defining polynomial for :emphasis:`nf`\n        instead, but this is in general less efficient since parts of an :literal:`nf`\n        structure will then be computed internally. This is useful in two\n        situations: when you do not need the :literal:`nf` elsewhere, or when you cannot\n        initialize an :literal:`nf` due to integer factorization difficulties when\n        attempting to compute the field discriminant and maximal order. In all\n        cases, the function runs in polynomial time using Belabas's variant\n        of van Hoeij's algorithm, which copes with hundreds of modular factors.\n        \n        :strong:`Caveat.` :literal:`nfinit([T, listP])` allows to compute in polynomial\n        time a conditional :emphasis:`nf` structure, which sets :literal:`nf.zk` to an order\n        which is not guaranteed to be maximal at all primes. Always either use\n        :literal:`nfcertify` first (which may not run in po""lynomial time) or make sure\n        to input :literal:`nf.pol` instead of the conditional :emphasis:`nf`: :literal:`nffactor` is\n        able to recover in polynomial time in this case, instead of potentially\n        missing a factor.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1221nffactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nffactor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_T,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_nf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nffactor", 1, 2, 2, 1); __PYX_ERR(4, 21795, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nffactor") < 0)) __PYX_ERR(4, 21795, __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_nf = values[0];
    __pyx_v_T = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nffactor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21795, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nffactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1220nffactor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_T);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1220nffactor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nffactor", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":21833
 *         missing a factor.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21834
 *         '''
 *         nf = objtogen(nf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21835
 *         nf = objtogen(nf)
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21835, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21836
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nffactor(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21837
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nffactor(_nf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21838
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nffactor(_nf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nffactor(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_instance.pxi":21839
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nffactor(_nf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nffactorback(self, nf, f, e=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21795
 *         return new_gen(_ret)
 * 
 *     def nffactor(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factorization of the univariate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nffactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21841
 *         return new_gen(_ret)
 * 
 *     def nffactorback(self, nf, f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the :emphasis:`nf` element corresponding to a factorization.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1223nffactorback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1222nffactorback[] = "\n        Gives back the :emphasis:`nf` element corresponding to a factorization.\n        The integer :math:`1` corresponds to the empty factorization.\n        \n        If :math:`e` is present, :math:`e` and :math:`f` must be vectors of the same length (:math:`e` being\n        integral), and the corresponding factorization is the product of the\n        :math:`f[i]^{e[i]}`.\n        \n        If not, and :math:`f` is vector, it is understood as in the preceding case with :math:`e`\n        a vector of 1s: we return the product of the :math:`f[i]`. Finally, :math:`f` can be a\n        regular factorization matrix.\n        \n        ::\n        \n            ? nf = nfinit(y^2+1);\n            ? nffactorback(nf, [3, y+1, [1,2]~], [1, 2, 3])\n            %2 = [12, -66]~\n            ? 3 * (I+1)^2 * (1+2*I)^3\n            %3 = 12 - 66*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1223nffactorback(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_e = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nffactorback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_f,&__pyx_n_s_e,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nffactorback", 0, 2, 3, 1); __PYX_ERR(4, 21841, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nffactorback") < 0)) __PYX_ERR(4, 21841, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_f = values[1];
    __pyx_v_e = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nffactorback", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21841, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nffactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1222nffactorback(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_f, __pyx_v_e);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1222nffactorback(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e) {
  int __pyx_v__have_e;
  GEN __pyx_v__nf;
  GEN __pyx_v__f;
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nffactorback", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_e);

  /* "cypari/auto_instance.pxi":21862
 *             %3 = 12 - 66*I
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21863
 *         '''
 *         nf = objtogen(nf)
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21864
 *         nf = objtogen(nf)
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             e = objtogen(e)
 */
  __pyx_t_2 = (__pyx_v_e != Py_None);
  __pyx_v__have_e = __pyx_t_2;

  /* "cypari/auto_instance.pxi":21865
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21866
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 *             e = objtogen(e)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_e, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21866, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":21865
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":21867
 *         if _have_e:
 *             e = objtogen(e)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21867, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21868
 *             e = objtogen(e)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21869
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _e = NULL
 *         if _have_e:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21870
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             _e = (<Gen>e).g
 */
  __pyx_v__e = NULL;

  /* "cypari/auto_instance.pxi":21871
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":21872
 *         cdef GEN _e = NULL
 *         if _have_e:
 *             _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
    __pyx_v__e = __pyx_t_4;

    /* "cypari/auto_instance.pxi":21871
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 */
  }

  /* "cypari/auto_instance.pxi":21873
 *         if _have_e:
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nffactorback(__pyx_v__nf, __pyx_v__f, __pyx_v__e);

  /* "cypari/auto_instance.pxi":21874
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nffactormod(self, nf, Q, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21841
 *         return new_gen(_ret)
 * 
 *     def nffactorback(self, nf, f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the :emphasis:`nf` element corresponding to a factorization.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nffactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21876
 *         return new_gen(_ret)
 * 
 *     def nffactormod(self, nf, Q, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This routine is obsolete, use :literal:`nfmodpr` and :literal:`factormod`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1225nffactormod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1224nffactormod[] = "\n        This routine is obsolete, use :literal:`nfmodpr` and :literal:`factormod`.\n        \n        Factors the univariate polynomial :math:`Q` modulo the prime ideal :emphasis:`pr` in\n        the number field :math:`nf`. The coefficients of :math:`Q` belong to the number\n        field (scalar, polmod, polynomial, even column vector) and the main variable\n        of :math:`nf` must be of lower priority than that of :math:`Q` (see\n        ``priority`` (in the PARI manual)). The prime ideal :emphasis:`pr` is either in\n        :literal:`idealprimedec` or (preferred) :literal:`modprinit` format. The coefficients\n        of the polynomial factors are lifted to elements of :emphasis:`nf`:\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K, 3)[1];\n            ? nffactormod(K, x^2 + y*x + 18*y+1, P)\n            %3 =\n            [x + (2*y + 1) 1]\n            \n            [x + (2*y + 2) 1]\n            ? P = nfmodprinit(K, P); \\\\ convert to nfmodprinit format\n            ? nffactormod(K, x^2 + y*x + 18*y+1)\n            %5 =\n            [x + (2*y + 1) 1]\n            \n            [x + (2*y + 2) 1]\n        \n        Same result, of course, here about 10\\% faster due to the\n        precomputation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1225nffactormod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nffactormod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_Q,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nffactormod", 1, 3, 3, 1); __PYX_ERR(4, 21876, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nffactormod", 1, 3, 3, 2); __PYX_ERR(4, 21876, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nffactormod") < 0)) __PYX_ERR(4, 21876, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_Q = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nffactormod", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21876, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nffactormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1224nffactormod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_Q, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1224nffactormod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_Q, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__Q;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nffactormod", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":21907
 *         precomputation.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21907, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21908
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         Q = objtogen(Q)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21909
 *         from warnings import warn
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21910
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21911
 *         nf = objtogen(nf)
 *         Q = objtogen(Q)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":21912
 *         Q = objtogen(Q)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 21912, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21913
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21914
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21915
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":21916
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nffactormod(__pyx_v__nf, __pyx_v__Q, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":21917
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfgaloisapply(self, nf, aut, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 21917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21876
 *         return new_gen(_ret)
 * 
 *     def nffactormod(self, nf, Q, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This routine is obsolete, use :literal:`nfmodpr` and :literal:`factormod`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nffactormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21919
 *         return new_gen(_ret)
 * 
 *     def nfgaloisapply(self, nf, aut, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`nf` be a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1227nfgaloisapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1226nfgaloisapply[] = "\n        Let :math:`nf` be a\n        number field as output by :literal:`nfinit`, and let :emphasis:`aut` be a Galois\n        automorphism of :math:`nf` expressed by its image on the field generator\n        (such automorphisms can be found using :literal:`nfgaloisconj`). The function\n        computes the action of the automorphism :emphasis:`aut` on the object :math:`x` in the\n        number field; :math:`x` can be a number field element, or an ideal (possibly\n        extended). Because of possible confusion with elements and ideals, other\n        vector or matrix arguments are forbidden.\n        \n        ::\n        \n             ? nf = nfinit(x^2+1);\n             ? L = nfgaloisconj(nf)\n             %2 = [-x, x]~\n             ? aut = L[1]; /* the non-trivial automorphism */\n             ? nfgaloisapply(nf, aut, x)\n             %4 = Mod(-x, x^2 + 1)\n             ? P = idealprimedec(nf,5); /* prime ideals above 5 */\n             ? nfgaloisapply(nf, aut, P[2]) == P[1]\n             %6 = 0 \\\\ !!!!\n             ? idealval(nf, nfgaloisapply(nf, aut, P[2]), P[1])\n             %7 = 1\n        \n        The surprising failure of the equality test (:literal:`\\%7`) is\n        due to the fact that although the corresponding prime ideals are equal, their\n        representations are not. (A prime ideal is specified by a uniformizer, and\n        there is no guarantee that applying automorphisms yields the same elements\n        as a direct :literal:`idealprimedec` call.)\n        \n        The automorphism can also be given as a column vector, representing the\n        image of :literal:`Mod(x, nf.pol)` as an algebraic number. This last\n        representation is more efficient and should be preferred if a given\n        automorphism must be used in many such calls.\n        \n        ::\n        \n             ? nf = nfinit(x^3 - 37*x^2 + 74*x - 37);\n             ? aut = nfgaloisconj(nf)[2]; \\\\  an automorphism in basistoalg form\n             %2 = -""31/11*x^2 + 1109/11*x - 925/11\n             ? AUT = nfalgtobasis(nf, aut); \\\\  same in algtobasis form\n             %3 = [16, -6, 5]~\n             ? v = [1, 2, 3]~; nfgaloisapply(nf, aut, v) == nfgaloisapply(nf, AUT, v)\n             %4 = 1 \\\\  same result...\n             ? for (i=1,10^5, nfgaloisapply(nf, aut, v))\n             time = 463 ms.\n             ? for (i=1,10^5, nfgaloisapply(nf, AUT, v))\n             time = 343 ms. \\\\  but the latter is faster\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1227nfgaloisapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_aut = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfgaloisapply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_aut,&__pyx_n_s_x,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_aut)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgaloisapply", 1, 3, 3, 1); __PYX_ERR(4, 21919, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgaloisapply", 1, 3, 3, 2); __PYX_ERR(4, 21919, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfgaloisapply") < 0)) __PYX_ERR(4, 21919, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_aut = values[1];
    __pyx_v_x = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfgaloisapply", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21919, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1226nfgaloisapply(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_aut, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1226nfgaloisapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_aut, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__aut;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfgaloisapply", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_aut);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":21969
 *              time = 343 ms. \\  but the latter is faster
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         aut = objtogen(aut)
 *         x = objtogen(x)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21969, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21970
 *         '''
 *         nf = objtogen(nf)
 *         aut = objtogen(aut)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_aut, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_aut, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21971
 *         nf = objtogen(nf)
 *         aut = objtogen(aut)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":21972
 *         aut = objtogen(aut)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _aut = (<Gen>aut).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 21972, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":21973
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21974
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _aut = (<Gen>aut).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_aut)->__pyx_base.g;
  __pyx_v__aut = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21975
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":21976
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisapply(__pyx_v__nf, __pyx_v__aut, __pyx_v__x);

  /* "cypari/auto_instance.pxi":21977
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfgaloisconj(self, nf, long flag=0, d=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 21977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21919
 *         return new_gen(_ret)
 * 
 *     def nfgaloisapply(self, nf, aut, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`nf` be a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_aut);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":21979
 *         return new_gen(_ret)
 * 
 *     def nfgaloisconj(self, nf, long flag=0, d=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being a number field as output by :literal:`nfinit`, computes the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1229nfgaloisconj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1228nfgaloisconj[] = "\n        :math:`nf` being a number field as output by :literal:`nfinit`, computes the\n        conjugates of a root :math:`r` of the non-constant polynomial :math:`x = nf[1]`\n        expressed as polynomials in :math:`r`. This also makes sense when the number field\n        is not Galois since some conjugates may lie in the field.\n        :math:`nf` can simply be a polynomial.\n        \n        If no flags or :math:`flag = 0`, use a combination of flag :math:`4` and :math:`1` and the result\n        is always complete. There is no point whatsoever in using the other flags.\n        \n        If :math:`flag = 1`, use :literal:`nfroots`: a little slow, but guaranteed to work in\n        polynomial time.\n        \n        If :math:`flag = 4`, use :literal:`galoisinit`: very fast, but only applies to (most)\n        Galois fields. If the field is Galois with weakly super-solvable Galois\n        group (see :literal:`galoisinit`), return the complete list of automorphisms, else\n        only the identity element. If present, :math:`d` is assumed to be a multiple of the\n        least common denominator of the conjugates expressed as polynomial in a root\n        of :emphasis:`pol`.\n        \n        This routine can only compute :math:`\\mathbb{Q}`-automorphisms, but it may be used to get\n        :math:`K`-automorphism for any base field :math:`K` as follows:\n        \n        ::\n        \n            rnfgaloisconj(nfK, R) = \\\\ K-automorphisms of L = K[X] / (R)\n            {\n             my(polabs, N,al,S, ala,k, vR);\n             R *= Mod(1, nfK.pol); \\\\ convert coeffs to polmod elts of K\n             vR = variable(R);\n             al = Mod(variable(nfK.pol),nfK.pol);\n             [polabs,ala,k] = rnfequation(nfK, R, 1);\n             Rt = if(k==0,R,subst(R,vR,vR-al*k));\n             N = nfgaloisconj(polabs) % Rt; \\\\ Q-automorphisms of L\n             S = select(s->subst(Rt, vR, Mod(s,Rt)) == 0, N);\n             if (k==0, S, apply(s->subst(s,vR,vR""+k*al)-k*al,S));\n            }\n            K = nfinit(y^2 + 7);\n            rnfgaloisconj(K, x^4 - y*x^3 - 3*x^2 + y*x + 1) \\\\ K-automorphisms of L\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1229nfgaloisconj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_d = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfgaloisconj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_flag,&__pyx_n_s_d,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_nf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfgaloisconj") < 0)) __PYX_ERR(4, 21979, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_nf = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 21979, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_d = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 21979, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfgaloisconj", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 21979, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfgaloisconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1228nfgaloisconj(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_flag, __pyx_v_d, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1228nfgaloisconj(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, long __pyx_v_flag, PyObject *__pyx_v_d, long __pyx_v_precision) {
  int __pyx_v__have_d;
  GEN __pyx_v__nf;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfgaloisconj", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":22020
 *             rnfgaloisconj(K, x^4 - y*x^3 - 3*x^2 + y*x + 1) \\ K-automorphisms of L
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22021
 *         '''
 *         nf = objtogen(nf)
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_2 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_2;

  /* "cypari/auto_instance.pxi":22022
 *         nf = objtogen(nf)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22023
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22023, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":22022
 *         nf = objtogen(nf)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":22024
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22024, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22025
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22026
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_instance.pxi":22027
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22028
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_instance.pxi":22027
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":22029
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":22030
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisconj0(__pyx_v__nf, __pyx_v_flag, __pyx_v__d, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":22031
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfgrunwaldwang(self, nf, Lpr, Ld, pl, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":21979
 *         return new_gen(_ret)
 * 
 *     def nfgaloisconj(self, nf, long flag=0, d=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being a number field as output by :literal:`nfinit`, computes the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfgaloisconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22033
 *         return new_gen(_ret)
 * 
 *     def nfgrunwaldwang(self, nf, Lpr, Ld, pl, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :emphasis:`nf` a number field in :emphasis:`nf` or :emphasis:`bnf` format,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1231nfgrunwaldwang(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1230nfgrunwaldwang[] = "\n        Given :emphasis:`nf` a number field in :emphasis:`nf` or :emphasis:`bnf` format,\n        a :literal:`t_VEC` :emphasis:`Lpr` of primes of :emphasis:`nf` and a :literal:`t_VEC` :emphasis:`Ld` of\n        positive integers of the same length, a :literal:`t_VECSMALL` :emphasis:`pl` of length\n        :math:`r_1` the number of real places of :emphasis:`nf`, computes a polynomial with\n        coefficients in :emphasis:`nf` defining a cyclic extension of :emphasis:`nf` of\n        minimal degree satisfying certain local conditions:\n        \n        - at the prime\302\240:math:`Lpr[i]`, the extension has local degree a multiple\n          of\302\240:math:`Ld[i]`;\n        \n        - at the :math:`i`-th real place of :emphasis:`nf`, it is complex if :math:`pl[i] = -1`\n          (no condition if :math:`pl[i] = 0`).\n        \n        The extension has degree the LCM of the local degrees. Currently, the degree\n        is restricted to be a prime power for the search, and to be prime for the\n        construction because of the :literal:`rnfkummer` restrictions.\n        \n        When :emphasis:`nf` is :math:`\\mathbb{Q}`, prime integers are accepted instead of :literal:`prid`\n        structures. However, their primality is not checked and the behavior is\n        undefined if you provide a composite number.\n        \n        :strong:`Warning.` If the number field :emphasis:`nf` does not contain the :math:`n`-th\n        roots of unity where :math:`n` is the degree of the extension to be computed,\n        triggers the computation of the :emphasis:`bnf` of :math:`nf(\\zeta_n)`, which may be\n        costly.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? pr = idealprimedec(nf,13)[1];\n            ? pol = nfgrunwaldwang(nf, [pr], [2], [0,-1], 'x)\n            %3 = x^2 + Mod(3/2*y + 13/2, y^2 - 5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1231nfgrunwaldwang(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_Lpr = 0;
  PyObject *__pyx_v_Ld = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfgrunwaldwang (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_Lpr,&__pyx_n_s_Ld,&__pyx_n_s_pl,&__pyx_n_s_v,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((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  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_nf)) != 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_Lpr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgrunwaldwang", 0, 4, 5, 1); __PYX_ERR(4, 22033, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Ld)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgrunwaldwang", 0, 4, 5, 2); __PYX_ERR(4, 22033, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgrunwaldwang", 0, 4, 5, 3); __PYX_ERR(4, 22033, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfgrunwaldwang") < 0)) __PYX_ERR(4, 22033, __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);
        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_nf = values[0];
    __pyx_v_Lpr = values[1];
    __pyx_v_Ld = values[2];
    __pyx_v_pl = values[3];
    __pyx_v_v = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfgrunwaldwang", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22033, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfgrunwaldwang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1230nfgrunwaldwang(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_Lpr, __pyx_v_Ld, __pyx_v_pl, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1230nfgrunwaldwang(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_Lpr, PyObject *__pyx_v_Ld, PyObject *__pyx_v_pl, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__nf;
  GEN __pyx_v__Lpr;
  GEN __pyx_v__Ld;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("nfgrunwaldwang", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_Lpr);
  __Pyx_INCREF(__pyx_v_Ld);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":22068
 *             %3 = x^2 + Mod(3/2*y + 13/2, y^2 - 5)
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         Lpr = objtogen(Lpr)
 *         Ld = objtogen(Ld)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22069
 *         '''
 *         nf = objtogen(nf)
 *         Lpr = objtogen(Lpr)             # <<<<<<<<<<<<<<
 *         Ld = objtogen(Ld)
 *         pl = objtogen(pl)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Lpr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Lpr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22070
 *         nf = objtogen(nf)
 *         Lpr = objtogen(Lpr)
 *         Ld = objtogen(Ld)             # <<<<<<<<<<<<<<
 *         pl = objtogen(pl)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Ld, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Ld, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22071
 *         Lpr = objtogen(Lpr)
 *         Ld = objtogen(Ld)
 *         pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22072
 *         Ld = objtogen(Ld)
 *         pl = objtogen(pl)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":22073
 *         pl = objtogen(pl)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":22074
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 22074, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":22073
 *         pl = objtogen(pl)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":22075
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 22075, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22076
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 *         cdef GEN _Ld = (<Gen>Ld).g
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_6;

  /* "cypari/auto_instance.pxi":22077
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Lpr = (<Gen>Lpr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Ld = (<Gen>Ld).g
 *         cdef GEN _pl = (<Gen>pl).g
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Lpr)->__pyx_base.g;
  __pyx_v__Lpr = __pyx_t_6;

  /* "cypari/auto_instance.pxi":22078
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 *         cdef GEN _Ld = (<Gen>Ld).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Ld)->__pyx_base.g;
  __pyx_v__Ld = __pyx_t_6;

  /* "cypari/auto_instance.pxi":22079
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 *         cdef GEN _Ld = (<Gen>Ld).g
 *         cdef GEN _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
  __pyx_v__pl = __pyx_t_6;

  /* "cypari/auto_instance.pxi":22080
 *         cdef GEN _Ld = (<Gen>Ld).g
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfgrunwaldwang(__pyx_v__nf, __pyx_v__Lpr, __pyx_v__Ld, __pyx_v__pl, __pyx_v__v);

  /* "cypari/auto_instance.pxi":22081
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfhilbert(self, nf, a, b, pr=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22033
 *         return new_gen(_ret)
 * 
 *     def nfgrunwaldwang(self, nf, Lpr, Ld, pl, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :emphasis:`nf` a number field in :emphasis:`nf` or :emphasis:`bnf` format,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfgrunwaldwang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_Lpr);
  __Pyx_XDECREF(__pyx_v_Ld);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22083
 *         return new_gen(_ret)
 * 
 *     def nfhilbert(self, nf, a, b, pr=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`pr` is omitted,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1233nfhilbert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1232nfhilbert[] = "\n        If :emphasis:`pr` is omitted,\n        compute the global quadratic Hilbert symbol :math:`(a,b)` in :math:`nf`, that\n        is :math:`1` if :math:`x^2 - a y^2 - b z^2` has a non trivial solution :math:`(x,y,z)` in\n        :math:`nf`, and :math:`-1` otherwise. Otherwise compute the local symbol modulo\n        the prime ideal :emphasis:`pr`, as output by :literal:`idealprimedec`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1233nfhilbert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfhilbert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_pr,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_nf)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfhilbert", 0, 3, 4, 1); __PYX_ERR(4, 22083, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfhilbert", 0, 3, 4, 2); __PYX_ERR(4, 22083, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfhilbert") < 0)) __PYX_ERR(4, 22083, __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_nf = values[0];
    __pyx_v_a = values[1];
    __pyx_v_b = values[2];
    __pyx_v_pr = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfhilbert", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22083, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1232nfhilbert(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_a, __pyx_v_b, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1232nfhilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_pr) {
  int __pyx_v__have_pr;
  GEN __pyx_v__nf;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__pr;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfhilbert", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":22091
 *         the prime ideal :emphasis:`pr`, as output by :literal:`idealprimedec`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         b = objtogen(b)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22092
 *         '''
 *         nf = objtogen(nf)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22093
 *         nf = objtogen(nf)
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22094
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             pr = objtogen(pr)
 */
  __pyx_t_2 = (__pyx_v_pr != Py_None);
  __pyx_v__have_pr = __pyx_t_2;

  /* "cypari/auto_instance.pxi":22095
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22096
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 *             pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":22095
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":22097
 *         if _have_pr:
 *             pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22097, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22098
 *             pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22099
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22100
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22101
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 */
  __pyx_v__pr = NULL;

  /* "cypari/auto_instance.pxi":22102
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22103
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 *             _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
    __pyx_v__pr = __pyx_t_4;

    /* "cypari/auto_instance.pxi":22102
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 */
  }

  /* "cypari/auto_instance.pxi":22104
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = nfhilbert0(__pyx_v__nf, __pyx_v__a, __pyx_v__b, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":22105
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":22106
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def nfhnf(self, nf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22083
 *         return new_gen(_ret)
 * 
 *     def nfhilbert(self, nf, a, b, pr=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`pr` is omitted,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22108
 *         return _ret
 * 
 *     def nfhnf(self, nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`, finds a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1235nfhnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1234nfhnf[] = "\n        Given a pseudo-matrix :math:`(A,I)`, finds a\n        pseudo-basis :math:`(B,J)` in Hermite normal form of the module it generates.\n        If :math:`flag` is non-zero, also return the transformation matrix :math:`U` such that\n        :math:`AU = [0\\|B]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1235nfhnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfhnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfhnf", 0, 2, 3, 1); __PYX_ERR(4, 22108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfhnf") < 0)) __PYX_ERR(4, 22108, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22108, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfhnf", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22108, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1234nfhnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1234nfhnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfhnf", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":22115
 *         :math:`AU = [0\|B]`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22116
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22117
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22117, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22118
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22119
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22120
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfhnf0(__pyx_v__nf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":22121
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfhnfmod(self, nf, x, detx):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22108
 *         return _ret
 * 
 *     def nfhnf(self, nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`, finds a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22123
 *         return new_gen(_ret)
 * 
 *     def nfhnfmod(self, nf, x, detx):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1237nfhnfmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1236nfhnfmod[] = "\n        Given a pseudo-matrix :math:`(A,I)`\n        and an ideal :emphasis:`detx` which is contained in (read integral multiple of) the\n        determinant of :math:`(A,I)`, finds a pseudo-basis in Hermite normal form\n        of the module generated by :math:`(A,I)`. This avoids coefficient explosion.\n        :emphasis:`detx` can be computed using the function :literal:`nfdetint`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1237nfhnfmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_detx = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfhnfmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_detx,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfhnfmod", 1, 3, 3, 1); __PYX_ERR(4, 22123, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfhnfmod", 1, 3, 3, 2); __PYX_ERR(4, 22123, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfhnfmod") < 0)) __PYX_ERR(4, 22123, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_detx = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfhnfmod", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22123, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfhnfmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1236nfhnfmod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_detx);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1236nfhnfmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_detx) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__detx;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfhnfmod", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_detx);

  /* "cypari/auto_instance.pxi":22131
 *         :emphasis:`detx` can be computed using the function :literal:`nfdetint`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         detx = objtogen(detx)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22132
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         detx = objtogen(detx)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22133
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         detx = objtogen(detx)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_detx, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_detx, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22134
 *         x = objtogen(x)
 *         detx = objtogen(detx)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22134, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22135
 *         detx = objtogen(detx)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _detx = (<Gen>detx).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22136
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _detx = (<Gen>detx).g
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22137
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _detx = (<Gen>detx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_detx)->__pyx_base.g;
  __pyx_v__detx = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22138
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _detx = (<Gen>detx).g
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfhnfmod(__pyx_v__nf, __pyx_v__x, __pyx_v__detx);

  /* "cypari/auto_instance.pxi":22139
 *         cdef GEN _detx = (<Gen>detx).g
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfinit(self, pol, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22123
 *         return new_gen(_ret)
 * 
 *     def nfhnfmod(self, nf, x, detx):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfhnfmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_detx);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22141
 *         return new_gen(_ret)
 * 
 *     def nfinit(self, pol, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a non-constant,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1239nfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1238nfinit[] = "\n        :emphasis:`pol` being a non-constant,\n        preferably monic, irreducible polynomial in :math:`\\mathbb{Z}[X]`, initializes a\n        :emphasis:`number field` structure (:literal:`nf`) attached to the field :math:`K` defined\n        by :emphasis:`pol`. As such, it's a technical object passed as the first argument\n        to most :literal:`nf`:emphasis:`xxx` functions, but it contains some information which\n        may be directly useful. Access to this information via :emphasis:`member\n        functions` is preferred since the specific data organization given below\n        may change in the future. Currently, :literal:`nf` is a row vector with 9\n        components:\n        \n        :math:`nf[1]` contains the polynomial :emphasis:`pol` (:literal:`:emphasis:`nf`.pol`).\n        \n        :math:`nf[2]` contains :math:`[r1,r2]` (:literal:`:emphasis:`nf`.sign`, :literal:`:emphasis:`nf`.r1`,\n        :literal:`:emphasis:`nf`.r2`), the number of real and complex places of :math:`K`.\n        \n        :math:`nf[3]` contains the discriminant :math:`d(K)` (:literal:`:emphasis:`nf`.disc`) of :math:`K`.\n        \n        :math:`nf[4]` contains the index of :math:`nf[1]` (:literal:`:emphasis:`nf`.index`),\n        i.e.\302\240:math:`[\\mathbb{Z}_K : \\mathbb{Z}[\\theta]]`, where :math:`\\theta` is any root of :math:`nf[1]`.\n        \n        :math:`nf[5]` is a vector containing 7 matrices :math:`M`, :math:`G`, :emphasis:`roundG`, :math:`T`,\n        :math:`MD`, :math:`TI`, :math:`MDI` useful for certain computations in the number field :math:`K`.\n        \n        \302\240\302\240:strong:`*` :math:`M` is the :math:`(r1+r2) x n` matrix whose columns represent\n        the numerical values of the conjugates of the elements of the integral\n        basis.\n        \n        \302\240\302\240:strong:`*` :math:`G` is an :math:`n x n` matrix such that :math:`T2 = ^t G G`,\n        where :math:`T2` is the quadratic form :math:`T_2(x) = \\sum \\|\\sigma (x)""\\|^2`, :math:`\\sigma`\n        running over the embeddings of :math:`K` into :math:`\\mathbb{C}`.\n        \n        \302\240\302\240:strong:`*` :emphasis:`roundG` is a rescaled copy of :math:`G`, rounded to nearest\n        integers.\n        \n        \302\240\302\240:strong:`*` :math:`T` is the :math:`n x n` matrix whose coefficients are\n        :math:`Tr(\\omega_i\\omega_j)` where the :math:`\\omega_i` are the elements of the\n        integral basis. Note also that :math:`\\det (T)` is equal to the discriminant of the\n        field :math:`K`. Also, when understood as an ideal, the matrix :math:`T^{-1}`\n        generates the codifferent ideal.\n        \n        \302\240\302\240:strong:`*` The columns of :math:`MD` (:literal:`:emphasis:`nf`.diff`) express a :math:`\\mathbb{Z}`-basis\n        of the different of :math:`K` on the integral basis.\n        \n        \302\240\302\240:strong:`*` :math:`TI` is equal to the primitive part of :math:`T^{-1}`, which has integral\n        coefficients.\n        \n        \302\240\302\240:strong:`*` Finally, :math:`MDI` is a two-element representation (for faster\n        ideal product) of :math:`d(K)` times the codifferent ideal\n        (:literal:`:emphasis:`nf`.disc:math:`*`:emphasis:`nf`.codiff`, which is an integral ideal). :math:`MDI`\n        is only used in :literal:`idealinv`.\n        \n        :math:`nf[6]` is the vector containing the :math:`r1+r2` roots\n        (:literal:`:emphasis:`nf`.roots`) of :math:`nf[1]` corresponding to the :math:`r1+r2`\n        embeddings of the number field into :math:`\\mathbb{C}` (the first :math:`r1` components are real,\n        the next :math:`r2` have positive imaginary part).\n        \n        :math:`nf[7]` is an integral basis for :math:`\\mathbb{Z}_K` (:literal:`:emphasis:`nf`.zk`) expressed\n        on the powers of\302\240:math:`\\theta`. Its first element is guaranteed to be :math:`1`. This\n        basis is LLL-reduced with respect to :math:`T_2` (strictly speaking,"" it is a\n        permutation of such a basis, due to the condition that the first element be\n        :math:`1`).\n        \n        :math:`nf[8]` is the :math:`n x n` integral matrix expressing the power\n        basis in terms of the integral basis, and finally\n        \n        :math:`nf[9]` is the :math:`n x n^2` matrix giving the multiplication table\n        of the integral basis.\n        \n        If a non monic polynomial is input, :literal:`nfinit` will transform it into a\n        monic one, then reduce it (see :math:`flag = 3`). It is allowed, though not very\n        useful given the existence of :literal:`nfnewprec`, to input a :emphasis:`nf` or a\n        :emphasis:`bnf` instead of a polynomial. It is also allowed to\n        input a :emphasis:`rnf`, in which case an :literal:`nf` structure attached to the\n        absolute defining polynomial :literal:`polabs` is returned (:emphasis:`flag` is then ignored).\n        \n        ::\n        \n            ? nf = nfinit(x^3 - 12); \\\\ initialize number field Q[X] / (X^3 - 12)\n            ? nf.pol \\\\ defining polynomial\n            %2 = x^3 - 12\n            ? nf.disc \\\\ field discriminant\n            %3 = -972\n            ? nf.index \\\\ index of power basis order in maximal order\n            %4 = 2\n            ? nf.zk \\\\ integer basis, lifted to Q[X]\n            %5 = [1, x, 1/2*x^2]\n            ? nf.sign \\\\ signature\n            %6 = [1, 1]\n            ? factor(abs(nf.disc )) \\\\ determines ramified primes\n            %7 =\n            [2 2]\n            \n            [3 5]\n            ? idealfactor(nf, 2)\n            %8 =\n            [[2, [0, 0, -1]~, 3, 1, [0, 1, 0]~] 3] \\\\  p_2^3\n        \n        :strong:`Huge discriminants, helping nfdisc.`\n        \n        In case :emphasis:`pol` has a huge discriminant which is difficult to factor,\n        it is hard to compute from scratch the maximal order. The special input\n        format :math:`[pol, B]` is also accepted where "":emphasis:`pol` is a polynomial as\n        above and :math:`B` has one of the following forms\n        \n        - an integer basis, as would be computed by :literal:`nfbasis`: a vector of\n          polynomials with first element :math:`1`. This is useful if the maximal order is\n          known in advance.\n        \n        - an argument :literal:`listP` which specifies a list of primes (see\n          :literal:`nfbasis`). Instead of the maximal order, :literal:`nfinit` then computes an\n          order which is maximal at these particular primes as well as the primes\n          contained in the private prime table (see :literal:`addprimes`). The result is\n          unconditionaly correct when the discriminant :literal:`nf.disc` factors\n          completely over this set of primes. The function :literal:`nfcertify` automates\n          this:\n        \n        ::\n        \n            ? pol = polcompositum(x^5 - 101, polcyclo(7))[1];\n            ? nf = nfinit( [pol, 10^3] );\n            ? nfcertify(nf)\n            %3 = []\n        \n        A priori, :literal:`nf.zk` defines an order which is only known\n        to be maximal at all primes :math:`<= 10^3` (no prime :math:`<= 10^3` divides\n        :literal:`nf.index`). The certification step proves the correctness of the\n        computation. Had it failed, that particular :literal:`nf` structure could\n        not have been trusted and may have caused routines using it to fail randomly.\n        One particular function that remains trustworthy in all cases is\n        :literal:`idealprimedec` when applied to a prime included in the above list\n        of primes or, more generally, a prime not dividing any entry in\n        :literal:`nfcertify` output.\n        \n        If :math:`flag = 2`: :emphasis:`pol` is changed into another polynomial :math:`P` defining the same\n        number field, which is as simple as can easily be found using the\n        :literal:`polredbest` algorithm, and all the subsequent"" computations are done\n        using this new polynomial. In particular, the first component of the result\n        is the modified polynomial.\n        \n        If :math:`flag = 3`, apply :literal:`polredbest` as in case 2, but outputs\n        :math:`[nf,Mod (a,P)]`, where :math:`nf` is as before and\n        :math:`Mod (a,P) = Mod (x,pol)` gives the change of\n        variables. This is implicit when :emphasis:`pol` is not monic: first a linear change\n        of variables is performed, to get a monic polynomial, then :literal:`polredbest`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1239nfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfinit") < 0)) __PYX_ERR(4, 22141, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22141, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22141, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfinit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22141, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1238nfinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_pol, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1238nfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfinit", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":22288
 *         of variables is performed, to get a monic polynomial, then :literal:`polredbest`.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22289
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22289, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22290
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22291
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":22292
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfinit0(__pyx_v__pol, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":22293
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfisideal(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22141
 *         return new_gen(_ret)
 * 
 *     def nfinit(self, pol, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a non-constant,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22295
 *         return new_gen(_ret)
 * 
 *     def nfisideal(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1241nfisideal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1240nfisideal[] = "\n        Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1241nfisideal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfisideal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfisideal", 1, 2, 2, 1); __PYX_ERR(4, 22295, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfisideal") < 0)) __PYX_ERR(4, 22295, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfisideal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22295, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfisideal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1240nfisideal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1240nfisideal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfisideal", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":22299
 *         Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22300
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22301
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22301, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22302
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = isideal(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22303
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = isideal(_nf, _x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22304
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = isideal(_nf, _x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isideal(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":22305
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = isideal(_nf, _x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":22306
 *         cdef long _ret = isideal(_nf, _x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def nfisincl(self, f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22295
 *         return new_gen(_ret)
 * 
 *     def nfisideal(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfisideal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22308
 *         return _ret
 * 
 *     def nfisincl(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` and :math:`g` define number fields, where :math:`f` and :math:`g` are irreducible
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1243nfisincl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1242nfisincl[] = "\n        Let :math:`f` and :math:`g` define number fields, where :math:`f` and :math:`g` are irreducible\n        polynomials in :math:`\\mathbb{Q}[X]` and :emphasis:`nf` structures as output by :literal:`nfinit`.\n        Tests whether the number field :math:`f` is conjugate to a subfield of the field\n        :math:`g`. If they are not, the output is the integer 0. If they are, the output is\n        a vector of polynomials, each polynomial :math:`a` representing an embedding\n        i.e.\302\240being such that :math:`g \\| f o a`. If either :math:`f` or :math:`g` is not\n        irreducible, the result is undefined.\n        \n        ::\n        \n            ? T = x^6 + 3*x^4 - 6*x^3 + 3*x^2 + 18*x + 10;\n            ? U = x^3 + 3*x^2 + 3*x - 2\n            \n            ? v = nfisincl(U, T);\n            %2 = [24/179*x^5-27/179*x^4+80/179*x^3-234/179*x^2+380/179*x+94/179]\n            \n            ? subst(U, x, Mod(v[1],T))\n            %3 = Mod(0, x^6 + 3*x^4 - 6*x^3 + 3*x^2 + 18*x + 10)\n            ? #nfisincl(x^2+1, T) \\\\ two embeddings\n            %4 = 2\n            \n            \\\\ same result with nf structures\n            ? nfisincl(U, L = nfinit(T)) == v\n            %5 = 1\n            ? nfisincl(K = nfinit(U), T) == v\n            %6 = 1\n            ? nfisincl(K, L) == v\n            %7 = 1\n            \n            \\\\ comparative bench: an nf is a little faster, esp. for the subfield\n            ? B = 10^3;\n            ? for (i=1, B, nfisincl(U,T))\n            time = 712 ms.\n            \n            ? for (i=1, B, nfisincl(K,T))\n            time = 485 ms.\n            \n            ? for (i=1, B, nfisincl(U,L))\n            time = 704 ms.\n            \n            ? for (i=1, B, nfisincl(K,L))\n            time = 465 ms.\n        \n        Using an :emphasis:`nf` structure for the potential subfield is\n        faster if the structure is already available. On the other hand, the gain in\n        :literal:`nfisincl` is usually n""ot sufficient to make it worthwhile to initialize\n        only for that purpose.\n        \n        ::\n        \n            ? for (i=1, B, nfinit(U))\n            time = 308 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1243nfisincl(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfisincl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_g,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_f)) != 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_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfisincl", 1, 2, 2, 1); __PYX_ERR(4, 22308, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfisincl") < 0)) __PYX_ERR(4, 22308, __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_f = values[0];
    __pyx_v_g = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfisincl", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22308, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfisincl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1242nfisincl(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_g);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1242nfisincl(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfisincl", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_instance.pxi":22363
 *             time = 308 ms.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         g = objtogen(g)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22364
 *         '''
 *         f = objtogen(f)
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22365
 *         f = objtogen(f)
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22365, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22366
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisincl(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22367
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfisincl(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22368
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisincl(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfisincl(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_instance.pxi":22369
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisincl(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfisisom(self, f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22308
 *         return _ret
 * 
 *     def nfisincl(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` and :math:`g` define number fields, where :math:`f` and :math:`g` are irreducible
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfisincl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22371
 *         return new_gen(_ret)
 * 
 *     def nfisisom(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :literal:`nfisincl`, but tests for isomorphism. More efficient if
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1245nfisisom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1244nfisisom[] = "\n        As :literal:`nfisincl`, but tests for isomorphism. More efficient if\n        :math:`f` or :math:`g` is a number field structure.\n        \n        ::\n        \n            ? f = x^6 + 30*x^5 + 495*x^4 + 1870*x^3 + 16317*x^2 - 22560*x + 59648;\n            ? g = x^6 + 42*x^5 + 999*x^4 + 8966*x^3 + 36117*x^2 + 21768*x + 159332;\n            ? h = x^6 + 30*x^5 + 351*x^4 + 2240*x^3 + 10311*x^2 + 35466*x + 58321;\n            \n            ? #nfisisom(f,g) \\\\ two isomorphisms\n            %3 = 2\n            ? nfisisom(f,h) \\\\ not isomorphic\n            %4 = 0\n            \\\\ comparative bench\n            ? K = nfinit(f); L = nfinit(g); B = 10^3;\n            ? for (i=1, B, nfisisom(f,g))\n            time = 6,124 ms.\n            ? for (i=1, B, nfisisom(K,g))\n            time = 3,356 ms.\n            ? for (i=1, B, nfisisom(f,L))\n            time = 3,204 ms.\n            ? for (i=1, B, nfisisom(K,L))\n            time = 3,173 ms.\n        \n        The function is usually very fast when the fields are non-isomorphic,\n        whenever the fields can be distinguished via a simple invariant such as\n        degree, signature or discriminant. It may be slower when the fields\n        share all invariants, but still faster than computing actual isomorphisms:\n        \n        ::\n        \n            \\\\ usually very fast when the answer is 'no':\n            ? for (i=1, B, nfisisom(f,h))\n            time = 32 ms.\n            \n            \\\\ but not always\n            ? u = x^6 + 12*x^5 + 6*x^4 - 377*x^3 - 714*x^2 + 5304*x + 15379\n            ? v = x^6 + 12*x^5 + 60*x^4 + 166*x^3 + 708*x^2 + 6600*x + 23353\n            ? nfisisom(u,v)\n            %13 = 0\n            ? polsturm(u) == polsturm(v)\n            %14 = 1\n            ? nfdisc(u) == nfdisc(v)\n            %15 = 1\n            ? for(i=1,B, nfisisom(u,v))\n            time = 1,821 ms.\n            ? K = nfinit(u); L = nfinit(v);\n            ? for(i=1,B, nfisisom(K,v))\n           "" time = 232 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1245nfisisom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfisisom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_g,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_f)) != 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_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfisisom", 1, 2, 2, 1); __PYX_ERR(4, 22371, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfisisom") < 0)) __PYX_ERR(4, 22371, __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_f = values[0];
    __pyx_v_g = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfisisom", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22371, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfisisom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1244nfisisom(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_g);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1244nfisisom(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfisisom", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_instance.pxi":22423
 *             time = 232 ms.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         g = objtogen(g)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22424
 *         '''
 *         f = objtogen(f)
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22425
 *         f = objtogen(f)
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22425, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22426
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisisom(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22427
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfisisom(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22428
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisisom(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfisisom(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_instance.pxi":22429
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisisom(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfislocalpower(self, nf, pr, a, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22371
 *         return new_gen(_ret)
 * 
 *     def nfisisom(self, f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :literal:`nfisincl`, but tests for isomorphism. More efficient if
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfisisom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22431
 *         return new_gen(_ret)
 * 
 *     def nfislocalpower(self, nf, pr, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`K`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1247nfislocalpower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1246nfislocalpower[] = "\n        Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`K`,\n        let :math:`a \\in K` and let :emphasis:`pr` be a :emphasis:`prid` structure attached to a\n        maximal ideal :math:`v`. Return :math:`1` if :math:`a` is an :math:`n`-th power in the completed\n        local field :math:`K_v`, and :math:`0` otherwise.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K,2)[1]; \\\\ the ramified prime above 2\n            ? nfislocalpower(K,P,-1, 2) \\\\ -1 is a square\n            %3 = 1\n            ? nfislocalpower(K,P,-1, 4) \\\\ ... but not a 4-th power\n            %4 = 0\n            ? nfislocalpower(K,P,2, 2) \\\\ 2 is not a square\n            %5 = 0\n            \n            ? Q = idealprimedec(K,5)[1]; \\\\ a prime above 5\n            ? nfislocalpower(K,Q, [0, 32]~, 30) \\\\ 32*I is locally a 30-th power\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1247nfislocalpower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfislocalpower (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pr,&__pyx_n_s_a,&__pyx_n_s_n,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_nf)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfislocalpower", 1, 4, 4, 1); __PYX_ERR(4, 22431, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfislocalpower", 1, 4, 4, 2); __PYX_ERR(4, 22431, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfislocalpower", 1, 4, 4, 3); __PYX_ERR(4, 22431, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfislocalpower") < 0)) __PYX_ERR(4, 22431, __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_nf = values[0];
    __pyx_v_pr = values[1];
    __pyx_v_a = values[2];
    __pyx_v_n = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfislocalpower", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22431, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfislocalpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1246nfislocalpower(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pr, __pyx_v_a, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1246nfislocalpower(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr, PyObject *__pyx_v_a, PyObject *__pyx_v_n) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__a;
  GEN __pyx_v__n;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfislocalpower", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pr);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":22453
 *             %7 = 1
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         a = objtogen(a)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22454
 *         '''
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         n = objtogen(n)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22455
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22456
 *         pr = objtogen(pr)
 *         a = objtogen(a)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22457
 *         a = objtogen(a)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22457, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22458
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22459
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22460
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22461
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22462
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = nfislocalpower(__pyx_v__nf, __pyx_v__pr, __pyx_v__a, __pyx_v__n);

  /* "cypari/auto_instance.pxi":22463
 *         cdef GEN _n = (<Gen>n).g
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":22464
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def nfkermodpr(self, nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22431
 *         return new_gen(_ret)
 * 
 *     def nfislocalpower(self, nf, pr, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`K`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfislocalpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22466
 *         return _ret
 * 
 *     def nfkermodpr(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1249nfkermodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1248nfkermodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Kernel of the matrix :math:`a` in :math:`\\mathbb{Z}_K/pr`, where :emphasis:`pr` is in\n        :strong:`modpr` format (see :literal:`nfmodprinit`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1249nfkermodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfkermodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfkermodpr", 1, 3, 3, 1); __PYX_ERR(4, 22466, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfkermodpr", 1, 3, 3, 2); __PYX_ERR(4, 22466, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfkermodpr") < 0)) __PYX_ERR(4, 22466, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfkermodpr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22466, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfkermodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1248nfkermodpr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1248nfkermodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfkermodpr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":22473
 *         :strong:`modpr` format (see :literal:`nfmodprinit`).
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22473, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22474
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22475
 *         from warnings import warn
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22476
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22477
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22478
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22478, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22479
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22480
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22481
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22482
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfkermodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":22483
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfmodpr(self, nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22466
 *         return _ret
 * 
 *     def nfkermodpr(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfkermodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22485
 *         return new_gen(_ret)
 * 
 *     def nfmodpr(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Map :math:`x` to a :literal:`t_FFELT` in the residue field modulo :emphasis:`pr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1251nfmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1250nfmodpr[] = "\n        Map :math:`x` to a :literal:`t_FFELT` in the residue field modulo :emphasis:`pr`.\n        The argument :emphasis:`pr` is either a maximal ideal in :literal:`idealprimedec`\n        format or, preferably, a :emphasis:`modpr` structure from :literal:`nfmodprinit`. The\n        function :literal:`nfmodprlift` allows to lift back to :math:`\\mathbb{Z}_K`.\n        \n        Note that the function applies to number field elements and not to\n        vector / matrices / polynomials of such. Use :literal:`apply` to convert\n        recursive structures.\n        \n        ::\n        \n            ? K = nfinit(y^3-250);\n            ? P = idealprimedec(K, 5)[2];\n            ? modP = nfmodprinit(K,P);\n            ? K.zk\n            %4 = [1, 1/5*y, 1/25*y^2]\n            ? apply(t->nfmodpr(K,t,modP), K.zk)\n            %5 = [1, y, 2*y + 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1251nfmodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfmodpr", 1, 3, 3, 1); __PYX_ERR(4, 22485, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfmodpr", 1, 3, 3, 2); __PYX_ERR(4, 22485, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfmodpr") < 0)) __PYX_ERR(4, 22485, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfmodpr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22485, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1250nfmodpr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1250nfmodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfmodpr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":22506
 *             %5 = [1, y, 2*y + 1]
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22507
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22508
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22509
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22509, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22510
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22511
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22512
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22513
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":22514
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfmodprinit(self, nf, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22485
 *         return new_gen(_ret)
 * 
 *     def nfmodpr(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Map :math:`x` to a :literal:`t_FFELT` in the residue field modulo :emphasis:`pr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22516
 *         return new_gen(_ret)
 * 
 *     def nfmodprinit(self, nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the prime ideal :emphasis:`pr` into :literal:`modpr` format necessary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1253nfmodprinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1252nfmodprinit[] = "\n        Transforms the prime ideal :emphasis:`pr` into :literal:`modpr` format necessary\n        for all operations modulo :emphasis:`pr` in the number field :emphasis:`nf`.\n        The functions :literal:`nfmodpr` and :literal:`nfmodprlift` allow to project\n        to and lift from the residue field.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1253nfmodprinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfmodprinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pr,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_nf)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfmodprinit", 1, 2, 2, 1); __PYX_ERR(4, 22516, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfmodprinit") < 0)) __PYX_ERR(4, 22516, __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_nf = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfmodprinit", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22516, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfmodprinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1252nfmodprinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1252nfmodprinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfmodprinit", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":22523
 *         to and lift from the residue field.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22524
 *         '''
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22525
 *         nf = objtogen(nf)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22525, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22526
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22527
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22528
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmodprinit(__pyx_v__nf, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":22529
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfmodprlift(self, nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22516
 *         return new_gen(_ret)
 * 
 *     def nfmodprinit(self, nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the prime ideal :emphasis:`pr` into :literal:`modpr` format necessary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfmodprinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22531
 *         return new_gen(_ret)
 * 
 *     def nfmodprlift(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lift the :literal:`t_FFELT` :math:`x` (from :literal:`nfmodpr`) in the residue field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1255nfmodprlift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1254nfmodprlift[] = "\n        Lift the :literal:`t_FFELT` :math:`x` (from :literal:`nfmodpr`) in the residue field\n        modulo :emphasis:`pr` to the ring of integers. Vectors and matrices are also\n        supported. For polynomials, use :literal:`apply` and the present function.\n        \n        The argument :emphasis:`pr` is either a maximal ideal in :literal:`idealprimedec`\n        format or, preferably, a :emphasis:`modpr` structure from :literal:`nfmodprinit`.\n        There are no compatibility checks to try and decide whether :math:`x` is attached\n        the same residue field as defined by :emphasis:`pr`: the result is undefined\n        if not.\n        \n        The function :literal:`nfmodpr` allows to reduce to the residue field.\n        \n        ::\n        \n            ? K = nfinit(y^3-250);\n            ? P = idealprimedec(K, 5)[2];\n            ? modP = nfmodprinit(K,P);\n            ? K.zk\n            %4 = [1, 1/5*y, 1/25*y^2]\n            ? apply(t->nfmodpr(K,t,modP), K.zk)\n            %5 = [1, y, 2*y + 1]\n            ? nfmodprlift(K, %, modP)\n            %6 = [1, 1/5*y, 2/5*y + 1]\n            ? nfeltval(K, %[3] - K.zk[3], P)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1255nfmodprlift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfmodprlift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfmodprlift", 1, 3, 3, 1); __PYX_ERR(4, 22531, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfmodprlift", 1, 3, 3, 2); __PYX_ERR(4, 22531, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfmodprlift") < 0)) __PYX_ERR(4, 22531, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfmodprlift", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22531, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfmodprlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1254nfmodprlift(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_pr);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1254nfmodprlift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfmodprlift", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":22559
 *             %7 = 1
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22560
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22561
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22562
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22562, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22563
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22564
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22565
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22566
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmodprlift(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":22567
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfnewprec(self, nf, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22531
 *         return new_gen(_ret)
 * 
 *     def nfmodprlift(self, nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lift the :literal:`t_FFELT` :math:`x` (from :literal:`nfmodpr`) in the residue field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfmodprlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22569
 *         return new_gen(_ret)
 * 
 *     def nfnewprec(self, nf, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the number field :math:`nf`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1257nfnewprec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1256nfnewprec[] = "\n        Transforms the number field :math:`nf`\n        into the corresponding data using current (usually larger) precision. This\n        function works as expected if :emphasis:`nf` is in fact a :emphasis:`bnf` or a :emphasis:`bnr`\n        (update structure to current precision) but may be quite slow: many\n        generators of principal ideals have to be computed; note that in this latter\n        case, the :emphasis:`bnf` must contain fundamental units.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1257nfnewprec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfnewprec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_precision,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_nf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfnewprec") < 0)) __PYX_ERR(4, 22569, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_nf = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22569, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfnewprec", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22569, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfnewprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1256nfnewprec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1256nfnewprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, long __pyx_v_precision) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfnewprec", 0);
  __Pyx_INCREF(__pyx_v_nf);

  /* "cypari/auto_instance.pxi":22578
 *         case, the :emphasis:`bnf` must contain fundamental units.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22579
 *         '''
 *         nf = objtogen(nf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22579, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22580
 *         nf = objtogen(nf)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfnewprec(_nf, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22581
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfnewprec(_nf, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":22582
 *         cdef GEN _nf = (<Gen>nf).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfnewprec(_nf, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfnewprec(__pyx_v__nf, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":22583
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfnewprec(_nf, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfpolsturm(self, nf, T, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22569
 *         return new_gen(_ret)
 * 
 *     def nfnewprec(self, nf, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the number field :math:`nf`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfnewprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22585
 *         return new_gen(_ret)
 * 
 *     def nfpolsturm(self, nf, T, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with coefficients in the number field :emphasis:`nf`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1259nfpolsturm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1258nfpolsturm[] = "\n        Given a polynomial :math:`T` with coefficients in the number field :emphasis:`nf`,\n        returns the number of real roots of the :math:`s(T)` where :math:`s` runs through\n        the real embeddings of the field specified by optional argument :emphasis:`pl`:\n        \n        - :emphasis:`pl` omitted: all :math:`r_1` real places;\n        \n        - :emphasis:`pl` an integer between :math:`1` and :math:`r_1`: the embedding attached to\n          the :math:`i`-th real root of :literal:`nf.pol`, i.e. :literal:`nf.roots:math:`[i]``;\n        \n        - :emphasis:`pl` a vector or :literal:`t_VECSMALL`: the embeddings\n          attached to the :math:`pl[i]`-th real roots of :literal:`nf.pol`.\n        \n        ::\n        \n            ? nf = nfinit('y^2 - 2);\n            ? nf.sign\n            %2 = [2, 0]\n            ? nf.roots\n            %3 = [-1.414..., 1.414...]\n            ? T = x^2 + 'y;\n            ? nfpolsturm(nf, T, 1) \\\\ subst(T,y,sqrt(2)) has two real roots\n            %5 = 2\n            ? nfpolsturm(nf, T, 2) \\\\ subst(T,y,-sqrt(2)) has no real root\n            %6 = 0\n            ? nfpolsturm(nf, T) \\\\ all embeddings together\n            %7 = [2, 0]\n            ? nfpolsturm(nf, T, [2,1]) \\\\ second then first embedding\n            %8 = [0, 2]\n            ? nfpolsturm(nf, x^3) \\\\ number of distinct roots !\n            %9 = [1, 1]\n            ? nfpolsturm(nf, x, 6) \\\\ there are only 2 real embeddings !\n             *** at top-level: nfpolsturm(nf,x,6)\n             *** ^-----------------\n             *** nfpolsturm: domain error in nfpolsturm: index > 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1259nfpolsturm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfpolsturm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_T,&__pyx_n_s_pl,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_nf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfpolsturm", 0, 2, 3, 1); __PYX_ERR(4, 22585, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfpolsturm") < 0)) __PYX_ERR(4, 22585, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_T = values[1];
    __pyx_v_pl = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfpolsturm", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22585, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfpolsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1258nfpolsturm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_T, __pyx_v_pl);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1258nfpolsturm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfpolsturm", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_instance.pxi":22622
 *              *** nfpolsturm: domain error in nfpolsturm: index > 2
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         cdef bint _have_pl = (pl is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22623
 *         '''
 *         nf = objtogen(nf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22624
 *         nf = objtogen(nf)
 *         T = objtogen(T)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":22625
 *         T = objtogen(T)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22626
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22626, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":22625
 *         T = objtogen(T)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":22627
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22627, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22628
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22629
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22630
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_instance.pxi":22631
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22632
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":22631
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 */
  }

  /* "cypari/auto_instance.pxi":22633
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfpolsturm(__pyx_v__nf, __pyx_v__T, __pyx_v__pl);

  /* "cypari/auto_instance.pxi":22634
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfroots(self, nf=None, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22585
 *         return new_gen(_ret)
 * 
 *     def nfpolsturm(self, nf, T, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with coefficients in the number field :emphasis:`nf`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfpolsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22636
 *         return new_gen(_ret)
 * 
 *     def nfroots(self, nf=None, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Roots of the polynomial :math:`x` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1261nfroots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1260nfroots[] = "\n        Roots of the polynomial :math:`x` in the\n        number field :math:`nf` given by :literal:`nfinit` without multiplicity (in :math:`\\mathbb{Q}`\n        if :math:`nf` is omitted). :math:`x` has coefficients in the number field (scalar,\n        polmod, polynomial, column vector). The main variable of :math:`nf` must be\n        of lower priority than that of :math:`x` (see ``priority`` (in the PARI manual)). However if the\n        coefficients of the number field occur explicitly (as polmods) as\n        coefficients of :math:`x`, the variable of these polmods :emphasis:`must` be the same as\n        the main variable of :math:`t` (see :literal:`nffactor`).\n        \n        It is possible to input a defining polynomial for :emphasis:`nf`\n        instead, but this is in general less efficient since parts of an :literal:`nf`\n        structure will then be computed internally. This is useful in two\n        situations: when you do not need the :literal:`nf` elsewhere, or when you cannot\n        initialize an :literal:`nf` due to integer factorization difficulties when\n        attempting to compute the field discriminant and maximal order.\n        \n        :strong:`Caveat.` :literal:`nfinit([T, listP])` allows to compute in polynomial\n        time a conditional :emphasis:`nf` structure, which sets :literal:`nf.zk` to an order\n        which is not guaranteed to be maximal at all primes. Always either use\n        :literal:`nfcertify` first (which may not run in polynomial time) or make sure\n        to input :literal:`nf.pol` instead of the conditional :emphasis:`nf`: :literal:`nfroots` is\n        able to recover in polynomial time in this case, instead of potentially\n        missing a factor.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1261nfroots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfroots (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfroots") < 0)) __PYX_ERR(4, 22636, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfroots", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22636, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1260nfroots(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1260nfroots(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  int __pyx_v__have_nf;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("nfroots", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":22662
 *         missing a factor.
 *         '''
 *         cdef bint _have_nf = (nf is not None)             # <<<<<<<<<<<<<<
 *         if _have_nf:
 *             nf = objtogen(nf)
 */
  __pyx_t_1 = (__pyx_v_nf != Py_None);
  __pyx_v__have_nf = __pyx_t_1;

  /* "cypari/auto_instance.pxi":22663
 *         '''
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             nf = objtogen(nf)
 *         if x is None:
 */
  __pyx_t_1 = (__pyx_v__have_nf != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":22664
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:
 *             nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22664, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":22663
 *         '''
 *         cdef bint _have_nf = (nf is not None)
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             nf = objtogen(nf)
 *         if x is None:
 */
  }

  /* "cypari/auto_instance.pxi":22665
 *         if _have_nf:
 *             nf = objtogen(nf)
 *         if x is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x == Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "cypari/auto_instance.pxi":22666
 *             nf = objtogen(nf)
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 22666, __pyx_L1_error)

    /* "cypari/auto_instance.pxi":22665
 *         if _have_nf:
 *             nf = objtogen(nf)
 *         if x is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 */
  }

  /* "cypari/auto_instance.pxi":22667
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = NULL
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22668
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = NULL
 *         if _have_nf:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 22668, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22669
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = NULL             # <<<<<<<<<<<<<<
 *         if _have_nf:
 *             _nf = (<Gen>nf).g
 */
  __pyx_v__nf = NULL;

  /* "cypari/auto_instance.pxi":22670
 *         sig_on()
 *         cdef GEN _nf = NULL
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = (__pyx_v__have_nf != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":22671
 *         cdef GEN _nf = NULL
 *         if _have_nf:
 *             _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfroots(_nf, _x)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
    __pyx_v__nf = __pyx_t_5;

    /* "cypari/auto_instance.pxi":22670
 *         sig_on()
 *         cdef GEN _nf = NULL
 *         if _have_nf:             # <<<<<<<<<<<<<<
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  }

  /* "cypari/auto_instance.pxi":22672
 *         if _have_nf:
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfroots(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_instance.pxi":22673
 *             _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfroots(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfroots(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":22674
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfroots(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfrootsof1(self, nf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22674, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22636
 *         return new_gen(_ret)
 * 
 *     def nfroots(self, nf=None, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Roots of the polynomial :math:`x` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22676
 *         return new_gen(_ret)
 * 
 *     def nfrootsof1(self, nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a two-component vector :math:`[w,z]` where :math:`w` is the number of roots of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1263nfrootsof1(PyObject *__pyx_v_self, PyObject *__pyx_v_nf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1262nfrootsof1[] = "\n        Returns a two-component vector :math:`[w,z]` where :math:`w` is the number of roots of\n        unity in the number field :emphasis:`nf`, and :math:`z` is a primitive :math:`w`-th root\n        of unity.\n        \n        ::\n        \n            ? K = nfinit(polcyclo(11));\n            ? nfrootsof1(K)\n            %2 = [22, [0, 0, 0, 0, 0, -1, 0, 0, 0, 0]~]\n            ? z = nfbasistoalg(K, %[2]) \\\\ in algebraic form\n            %3 = Mod(-x^5, x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1)\n            ? [lift(z^11), lift(z^2)] \\\\ proves that the order of z is 22\n            %4 = [-1, -x^9 - x^8 - x^7 - x^6 - x^5 - x^4 - x^3 - x^2 - x - 1]\n        \n        This function guesses the number :math:`w` as the gcd of the :math:`\\#k(v)^*` for\n        unramified :math:`v` above odd primes, then computes the roots in :emphasis:`nf`\n        of the :math:`w`-th cyclotomic polynomial: the algorithm is polynomial time with\n        respect to the field degree and the bitsize of the multiplication table in\n        :emphasis:`nf` (both of them polynomially bounded in terms of the size of the\n        discriminant). Fields of degree up to :math:`100` or so should require less than\n        one minute.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1263nfrootsof1(PyObject *__pyx_v_self, PyObject *__pyx_v_nf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfrootsof1 (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1262nfrootsof1(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_nf));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1262nfrootsof1(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfrootsof1", 0);
  __Pyx_INCREF(__pyx_v_nf);

  /* "cypari/auto_instance.pxi":22700
 *         one minute.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22701
 *         '''
 *         nf = objtogen(nf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = rootsof1(_nf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22701, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22702
 *         nf = objtogen(nf)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rootsof1(_nf)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22703
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = rootsof1(_nf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rootsof1(__pyx_v__nf);

  /* "cypari/auto_instance.pxi":22704
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = rootsof1(_nf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsnf(self, nf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22676
 *         return new_gen(_ret)
 * 
 *     def nfrootsof1(self, nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a two-component vector :math:`[w,z]` where :math:`w` is the number of roots of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfrootsof1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22706
 *         return new_gen(_ret)
 * 
 *     def nfsnf(self, nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a torsion :math:`\mathbb{Z}_K`-module :math:`x` attached to the square integral
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1265nfsnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1264nfsnf[] = "\n        Given a torsion :math:`\\mathbb{Z}_K`-module :math:`x` attached to the square integral\n        invertible pseudo-matrix :math:`(A,I,J)`, returns an ideal list\n        :math:`D = [d_1,...,d_n]` which is the Smith normal form of :math:`x`. In other\n        words, :math:`x` is isomorphic to :math:`\\mathbb{Z}_K/d_1\\oplus...\\oplus\\mathbb{Z}_K/d_n` and :math:`d_i`\n        divides :math:`d_{i-1}` for :math:`i >= 2`. If :math:`flag` is non-zero return :math:`[D,U,V]`, where\n        :math:`UAV` is the identity.\n        \n        See ``ZKmodules`` (in the PARI manual) for the definition of integral pseudo-matrix;\n        briefly, it is input as a 3-component row vector :math:`[A,I,J]` where\n        :math:`I = [b_1,...,b_n]` and :math:`J = [a_1,...,a_n]` are two ideal lists,\n        and :math:`A` is a square :math:`n x n` matrix with columns :math:`(A_1,...,A_n)`,\n        seen as elements in :math:`K^n` (with canonical basis :math:`(e_1,...,e_n)`).\n        This data defines the :math:`\\mathbb{Z}_K` module :math:`x` given by\n        \n        .. MATH::\n        \n            (b_1e_1\\oplus...\\oplus b_ne_n) / (a_1A_1\\oplus...\\oplus a_nA_n)\n            ,\n        \n        The integrality condition is :math:`a_{i,j} \\in b_i a_j^{-1}` for all :math:`i,j`. If it\n        is not satisfied, then the :math:`d_i` will not be integral. Note that every\n        finitely generated torsion module is isomorphic to a module of this form and\n        even with :math:`b_i = Z_K` for all :math:`i`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1265nfsnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfsnf", 0, 2, 3, 1); __PYX_ERR(4, 22706, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsnf") < 0)) __PYX_ERR(4, 22706, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22706, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsnf", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22706, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1264nfsnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1264nfsnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfsnf", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":22732
 *         even with :math:`b_i = Z_K` for all :math:`i`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22733
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22734
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22734, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22735
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22736
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22737
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsnf0(__pyx_v__nf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":22738
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsolvemodpr(self, nf, a, b, P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22706
 *         return new_gen(_ret)
 * 
 *     def nfsnf(self, nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a torsion :math:`\mathbb{Z}_K`-module :math:`x` attached to the square integral
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22740
 *         return new_gen(_ret)
 * 
 *     def nfsolvemodpr(self, nf, a, b, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1267nfsolvemodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1266nfsolvemodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Let :math:`P` be a prime ideal in :strong:`modpr` format (see :literal:`nfmodprinit`),\n        let :math:`a` be a matrix, invertible over the residue field, and let :math:`b` be\n        a column vector or matrix. This function returns a solution of :math:`a.x =\n        b`; the coefficients of :math:`x` are lifted to :emphasis:`nf` elements.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K, 3)[1];\n            ? P = nfmodprinit(K, P);\n            ? a = [y+1, y; y, 0]; b = [1, y]~\n            ? nfsolvemodpr(K, a,b, P)\n            %5 = [1, 2]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1267nfsolvemodpr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsolvemodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_P,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_nf)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfsolvemodpr", 1, 4, 4, 1); __PYX_ERR(4, 22740, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfsolvemodpr", 1, 4, 4, 2); __PYX_ERR(4, 22740, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfsolvemodpr", 1, 4, 4, 3); __PYX_ERR(4, 22740, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsolvemodpr") < 0)) __PYX_ERR(4, 22740, __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_nf = values[0];
    __pyx_v_a = values[1];
    __pyx_v_b = values[2];
    __pyx_v_P = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsolvemodpr", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22740, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsolvemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1266nfsolvemodpr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_a, __pyx_v_b, __pyx_v_P);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1266nfsolvemodpr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_P) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfsolvemodpr", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":22758
 *             %5 = [1, 2]~
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22758, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22759
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         a = objtogen(a)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22760
 *         from warnings import warn
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         b = objtogen(b)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22761
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         P = objtogen(P)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22762
 *         nf = objtogen(nf)
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22763
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":22764
 *         b = objtogen(b)
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22764, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22765
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22766
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22767
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22768
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22769
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsolvemodpr(__pyx_v__nf, __pyx_v__a, __pyx_v__b, __pyx_v__P);

  /* "cypari/auto_instance.pxi":22770
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsplitting(self, P, d=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 22770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22740
 *         return new_gen(_ret)
 * 
 *     def nfsolvemodpr(self, nf, a, b, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsolvemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22772
 *         return new_gen(_ret)
 * 
 *     def nfsplitting(self, P, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Defining polynomial over:math:`\mathbb{Q}` for the splitting field of :emphasis:`P`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1269nfsplitting(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1268nfsplitting[] = "\n        Defining polynomial over\302\240:math:`\\mathbb{Q}` for the splitting field of :emphasis:`P`,\n        that is the smallest field over which :math:`P` is totally split. If :math:`P`\n        can also be given by a\302\240:literal:`nf` structure, which is more efficient.\n        If :math:`d` is given, it must be a multiple of the splitting field degree.\n        Note that if :math:`P` is reducible the splitting field degree can be smaller\n        than the degree of :math:`P`.\n        \n        ::\n        \n            ? K = nfinit(x^3-2);\n            ? nfsplitting(K)\n            %2 = x^6 + 108\n            ? nfsplitting(x^8-2)\n            %3 = x^16 + 272*x^8 + 64\n            ? S = nfsplitting(x^6-8) // reducible\n            %4 = x^4+2*x^2+4\n            ? lift(nfroots(subst(S,x,a),x^6-8))\n            %5 = [-a,a,-1/2*a^3-a,-1/2*a^3,1/2*a^3,1/2*a^3+a]\n        \n        Specifying the degree of the splitting field can make the computation faster.\n        \n        ::\n        \n            ? nfsplitting(x^17-123);\n            time = 3,607 ms.\n            ? poldegree(%)\n            %2 = 272\n            ? nfsplitting(x^17-123,272);\n            time = 150 ms.\n            ? nfsplitting(x^17-123,273);\n             *** nfsplitting: Warning: ignoring incorrect degree bound 273\n            time = 3,611 ms.\n        \n        The complexity of the algorithm is polynomial in the degree :math:`d` of the\n        splitting field and the bitsize of :math:`T`; if :math:`d` is large the result will\n        likely be unusable, e.g. :literal:`nfinit` will not be an option:\n        \n        ::\n        \n            ? nfsplitting(x^6-x-1)\n            [... degree 720 polynomial deleted ...]\n            time = 11,020 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1269nfsplitting(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsplitting (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_d,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsplitting") < 0)) __PYX_ERR(4, 22772, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsplitting", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22772, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsplitting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1268nfsplitting(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_P, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1268nfsplitting(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_d) {
  int __pyx_v__have_d;
  GEN __pyx_v__P;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfsplitting", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_instance.pxi":22817
 *             time = 11,020 ms.
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22818
 *         '''
 *         P = objtogen(P)
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_2 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_2;

  /* "cypari/auto_instance.pxi":22819
 *         P = objtogen(P)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22820
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22820, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":22819
 *         P = objtogen(P)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":22821
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22821, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22822
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22823
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_instance.pxi":22824
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22825
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsplitting(_P, _d)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_instance.pxi":22824
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)
 */
  }

  /* "cypari/auto_instance.pxi":22826
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsplitting(__pyx_v__P, __pyx_v__d);

  /* "cypari/auto_instance.pxi":22827
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsubfields(self, pol, long d=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22772
 *         return new_gen(_ret)
 * 
 *     def nfsplitting(self, P, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Defining polynomial over:math:`\mathbb{Q}` for the splitting field of :emphasis:`P`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsplitting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22829
 *         return new_gen(_ret)
 * 
 *     def nfsubfields(self, pol, long d=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds all subfields of degree
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1271nfsubfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1270nfsubfields[] = "\n        Finds all subfields of degree\n        :math:`d` of the number field defined by the (monic, integral) polynomial\n        :emphasis:`pol` (all subfields if :math:`d` is null or omitted). The result is a vector\n        of subfields, each being given by :math:`[g,h]`, where :math:`g` is an absolute equation\n        and :math:`h` expresses one of the roots of :math:`g` in terms of the root :math:`x` of the\n        polynomial defining :math:`nf`. This routine uses J.\302\240Kl\303\274ners's algorithm\n        in the general case, and B.\302\240Allombert's :literal:`galoissubfields` when :emphasis:`nf`\n        is Galois (with weakly supersolvable Galois group).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1271nfsubfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_d;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsubfields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_d,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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsubfields") < 0)) __PYX_ERR(4, 22829, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    if (values[1]) {
      __pyx_v_d = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22829, __pyx_L3_error)
    } else {
      __pyx_v_d = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsubfields", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22829, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1270nfsubfields(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_pol, __pyx_v_d);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1270nfsubfields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, long __pyx_v_d) {
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfsubfields", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":22840
 *         is Galois (with weakly supersolvable Galois group).
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22841
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = nfsubfields(_pol, d)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22841, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22842
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsubfields(_pol, d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22843
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = nfsubfields(_pol, d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsubfields(__pyx_v__pol, __pyx_v_d);

  /* "cypari/auto_instance.pxi":22844
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = nfsubfields(_pol, d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def norm(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22844, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22829
 *         return new_gen(_ret)
 * 
 *     def nfsubfields(self, pol, long d=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds all subfields of degree
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.nfsubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22846
 *         return new_gen(_ret)
 * 
 *     def norm(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Algebraic norm of :math:`x`, i.e.the product of :math:`x` with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1273norm(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1272norm[] = "\n        Algebraic norm of :math:`x`, i.e.\302\240the product of :math:`x` with\n        its conjugate (no square roots are taken), or conjugates for polmods. For\n        vectors and matrices, the norm is taken componentwise and hence is not the\n        :math:`L^2`-norm (see :literal:`norml2`). Note that the norm of an element of\n        :math:`\\mathbb{R}` is its square, so as to be compatible with the complex norm.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1273norm(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1272norm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1272norm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("norm", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":22854
 *         :math:`\mathbb{R}` is its square, so as to be compatible with the complex norm.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22855
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorm(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22855, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22856
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gnorm(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22857
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorm(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gnorm(__pyx_v__x);

  /* "cypari/auto_instance.pxi":22858
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorm(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def norml2(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22846
 *         return new_gen(_ret)
 * 
 *     def norm(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Algebraic norm of :math:`x`, i.e.the product of :math:`x` with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22860
 *         return new_gen(_ret)
 * 
 *     def norml2(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of the :math:`L^2`-norm of :math:`x`. More precisely,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1275norml2(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1274norml2[] = "\n        Square of the :math:`L^2`-norm of :math:`x`. More precisely,\n        if :math:`x` is a scalar, :math:`norml2 (x)` is defined to be the square\n        of the complex modulus of :math:`x` (real :literal:`t_QUAD`\302\240s are not supported).\n        If :math:`x` is a polynomial, a (row or column) vector or a matrix, :literal:`norml2(:math:`x`)` is\n        defined recursively as :math:`\\sum_i norml2 (x_i)`, where :math:`(x_i)` run through\n        the components of :math:`x`. In particular, this yields the usual :math:`\\sum \\|x_i\\|^2`\n        (resp.\302\240:math:`\\sum \\|x_{i,j}\\|^2`) if :math:`x` is a polynomial or vector (resp.\302\240matrix) with\n        complex components.\n        \n        ::\n        \n            ? norml2( [ 1, 2, 3 ] ) \\\\ vector\n            %1 = 14\n            ? norml2( [ 1, 2; 3, 4] ) \\\\ matrix\n            %2 = 30\n            ? norml2( 2*I + x )\n            %3 = 5\n            ? norml2( [ [1,2], [3,4], 5, 6 ] ) \\\\ recursively defined\n            %4 = 91\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1275norml2(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norml2 (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1274norml2(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1274norml2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("norml2", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":22882
 *             %4 = 91
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22883
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorml2(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22883, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22884
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gnorml2(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22885
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorml2(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gnorml2(__pyx_v__x);

  /* "cypari/auto_instance.pxi":22886
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorml2(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def normlp(self, x, p=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22860
 *         return new_gen(_ret)
 * 
 *     def norml2(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of the :math:`L^2`-norm of :math:`x`. More precisely,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.norml2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22888
 *         return new_gen(_ret)
 * 
 *     def normlp(self, x, p=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`L^p`-norm of :math:`x`; sup norm if :math:`p` is omitted or :literal:`+oo`. More precisely,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1277normlp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1276normlp[] = "\n        :math:`L^p`-norm of :math:`x`; sup norm if :math:`p` is omitted or :literal:`+oo`. More precisely,\n        if :math:`x` is a scalar, :literal:`normlp`:math:`(x, p)` is defined to be :literal:`abs`:math:`(x)`.\n        If :math:`x` is a polynomial, a (row or column) vector or a matrix:\n        \n        - if :math:`p` is omitted or :literal:`+oo`, then :literal:`normlp(:math:`x`)` is defined\n          recursively as :math:`\\max_i normlp (x_i))`, where :math:`(x_i)` run through the\n          components of\302\240:math:`x`. In particular, this yields the usual sup norm if :math:`x` is a\n          polynomial or vector with complex components.\n        \n        - otherwise, :literal:`normlp(:math:`x`, :math:`p`)` is defined recursively as :math:`(\\sum_i\n          normlp^p(x_i,p))^{1/p}`. In particular, this yields the usual :math:`(\\sum\n          \\|x_i\\|^p)^{1/p}` if :math:`x` is a polynomial or vector with complex components.\n        \n        ::\n        \n            ? v = [1,-2,3]; normlp(v) \\\\ vector\n            %1 = 3\n            ? normlp(v, +oo) \\\\ same, more explicit\n            %2 = 3\n            ? M = [1,-2;-3,4]; normlp(M) \\\\ matrix\n            %3 = 4\n            ? T = (1+I) + I*x^2; normlp(T)\n            %4 = 1.4142135623730950488016887242096980786\n            ? normlp([[1,2], [3,4], 5, 6]) \\\\ recursively defined\n            %5 = 6\n            \n            ? normlp(v, 1)\n            %6 = 6\n            ? normlp(M, 1)\n            %7 = 10\n            ? normlp(T, 1)\n            %8 = 2.4142135623730950488016887242096980786\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1277normlp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normlp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "normlp") < 0)) __PYX_ERR(4, 22888, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_p = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22888, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("normlp", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22888, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.normlp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1276normlp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1276normlp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision) {
  int __pyx_v__have_p;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("normlp", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":22923
 *             %8 = 2.4142135623730950488016887242096980786
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22924
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_instance.pxi":22925
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22926
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22926, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":22925
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":22927
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22927, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22928
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22929
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":22930
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22931
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gnormlp(_x, _p, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_instance.pxi":22930
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":22932
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gnormlp(_x, _p, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":22933
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gnormlp(_x, _p, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gnormlp(__pyx_v__x, __pyx_v__p, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":22934
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gnormlp(_x, _p, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def numbpart(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22888
 *         return new_gen(_ret)
 * 
 *     def normlp(self, x, p=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`L^p`-norm of :math:`x`; sup norm if :math:`p` is omitted or :literal:`+oo`. More precisely,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.normlp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22936
 *         return new_gen(_ret)
 * 
 *     def numbpart(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the number of unrestricted partitions of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1279numbpart(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1278numbpart[] = "\n        Gives the number of unrestricted partitions of\n        :math:`n`, usually called :math:`p(n)` in the literature; in other words the number of\n        nonnegative integer solutions to :math:`a+2b+3c+.. .= n`. :math:`n` must be of type\n        integer and :math:`n < 10^{15}` (with trivial values :math:`p(n) = 0` for :math:`n < 0` and\n        :math:`p(0) = 1`). The algorithm uses the Hardy-Ramanujan-Rademacher formula.\n        To explicitly enumerate them, see :literal:`partitions`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1279numbpart(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numbpart (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1278numbpart(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1278numbpart(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("numbpart", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":22945
 *         To explicitly enumerate them, see :literal:`partitions`.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22946
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = numbpart(_n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22946, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22947
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = numbpart(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22948
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = numbpart(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = numbpart(__pyx_v__n);

  /* "cypari/auto_instance.pxi":22949
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = numbpart(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def numdiv(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22936
 *         return new_gen(_ret)
 * 
 *     def numbpart(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the number of unrestricted partitions of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.numbpart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22951
 *         return new_gen(_ret)
 * 
 *     def numdiv(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1281numdiv(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1280numdiv[] = "\n        Number of divisors of :math:`\\|x\\|`. :math:`x` must be of type integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1281numdiv(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numdiv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1280numdiv(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1280numdiv(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("numdiv", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":22955
 *         Number of divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22956
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = numdiv(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 22956, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22957
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = numdiv(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":22958
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = numdiv(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = numdiv(__pyx_v__x);

  /* "cypari/auto_instance.pxi":22959
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = numdiv(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def numerator(self, f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22951
 *         return new_gen(_ret)
 * 
 *     def numdiv(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.numdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22961
 *         return new_gen(_ret)
 * 
 *     def numerator(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Numerator of :math:`f`. This is defined as :literal:`f * denominator(f,D)`, see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1283numerator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1282numerator[] = "\n        Numerator of :math:`f`. This is defined as :literal:`f * denominator(f,D)`, see\n        :literal:`denominator` for details. The optional argument :math:`D` allows to control\n        over which ring we compute the denominator:\n        \n        - :math:`1`: we only consider the underlying :math:`\\mathbb{Q}`-structure and the\n          denominator is a (positive) rational integer\n        \n        - a simple variable, say :literal:`'x`: all entries as rational functions\n          in :math:`K(x)` and the denominator is a polynomial in :math:`x`.\n        \n        ::\n        \n            ? f = x + 1/y + 1/2;\n            ? numerator(f) \\\\ a t_POL in x\n            %2 = x + ((y + 2)/(2*y))\n            ? numerator(f, 1) \\\\ Q-denominator is 2\n            %3 = x + ((y + 2)/y)\n            ? numerator(f, y) \\\\ as a rational function in y\n            %5 = 2*y*x + (y + 2)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1283numerator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numerator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_D,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "numerator") < 0)) __PYX_ERR(4, 22961, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("numerator", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22961, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.numerator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1282numerator(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1282numerator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("numerator", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":22983
 *             %5 = 2*y*x + (y + 2)
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":22984
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":22985
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22986
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22986, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":22985
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":22987
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 22987, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":22988
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":22989
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":22990
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":22991
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = numerator(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":22990
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)
 */
  }

  /* "cypari/auto_instance.pxi":22992
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = numerator(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_instance.pxi":22993
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def numtoperm(self, long n, k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 22993, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22961
 *         return new_gen(_ret)
 * 
 *     def numerator(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Numerator of :math:`f`. This is defined as :literal:`f * denominator(f,D)`, see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.numerator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":22995
 *         return new_gen(_ret)
 * 
 *     def numtoperm(self, long n, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Generates the :math:`k`-th permutation (as a row vector of length :math:`n`) of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1285numtoperm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1284numtoperm[] = "\n        Generates the :math:`k`-th permutation (as a row vector of length :math:`n`) of the\n        numbers :math:`1` to :math:`n`. The number :math:`k` is taken modulo :math:`n!`, i.e.\302\240inverse\n        function of :literal:`permtonum`. The numbering used is the standard lexicographic\n        ordering, starting at :math:`0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1285numtoperm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numtoperm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_k,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_n)) != 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_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("numtoperm", 1, 2, 2, 1); __PYX_ERR(4, 22995, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "numtoperm") < 0)) __PYX_ERR(4, 22995, __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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 22995, __pyx_L3_error)
    __pyx_v_k = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("numtoperm", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 22995, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.numtoperm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1284numtoperm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_k);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1284numtoperm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_k) {
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("numtoperm", 0);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_instance.pxi":23002
 *         ordering, starting at :math:`0`.
 *         '''
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23003
 *         '''
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = numtoperm(n, _k)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23003, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23004
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = numtoperm(n, _k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23005
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = numtoperm(n, _k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = numtoperm(__pyx_v_n, __pyx_v__k);

  /* "cypari/auto_instance.pxi":23006
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = numtoperm(n, _k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def omega(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":22995
 *         return new_gen(_ret)
 * 
 *     def numtoperm(self, long n, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Generates the :math:`k`-th permutation (as a row vector of length :math:`n`) of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.numtoperm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23008
 *         return new_gen(_ret)
 * 
 *     def omega(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct prime divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1287omega(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1286omega[] = "\n        Number of distinct prime divisors of :math:`\\|x\\|`. :math:`x` must be of type integer.\n        \n        ::\n        \n            ? factor(392)\n            %1 =\n            [2 3]\n            \n            [7 2]\n            \n            ? omega(392)\n            %2 = 2; \\\\ without multiplicity\n            ? bigomega(392)\n            %3 = 5; \\\\ = 3+2, with multiplicity\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1287omega(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("omega (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1286omega(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1286omega(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("omega", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23025
 *             %3 = 5; \\ = 3+2, with multiplicity
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23026
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = omega(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23026, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23027
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = omega(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23028
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = omega(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = omega(__pyx_v__x);

  /* "cypari/auto_instance.pxi":23029
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = omega(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23030
 *         cdef long _ret = omega(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def oo(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23008
 *         return new_gen(_ret)
 * 
 *     def omega(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct prime divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.omega", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23032
 *         return _ret
 * 
 *     def oo(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns an object meaning :math:`+ oo`, for use in functions such as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1289oo(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1288oo[] = "\n        Returns an object meaning :math:`+ oo`, for use in functions such as\n        :literal:`intnum`. It can be negated (:literal:`-oo` represents :math:`- oo`), and\n        compared to real numbers (:literal:`t_INT`, :literal:`t_FRAC`, :literal:`t_REAL`), with the\n        expected meaning: :math:`+ oo` is greater than any real number and :math:`- oo` is\n        smaller.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1289oo(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("oo (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1288oo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1288oo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("oo", 0);

  /* "cypari/auto_instance.pxi":23040
 *         smaller.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mkoo()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 23040, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23041
 *         '''
 *         sig_on()
 *         cdef GEN _ret = mkoo()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mkoo();

  /* "cypari/auto_instance.pxi":23042
 *         sig_on()
 *         cdef GEN _ret = mkoo()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def padicappr(self, pol, a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23032
 *         return _ret
 * 
 *     def oo(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns an object meaning :math:`+ oo`, for use in functions such as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.oo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23044
 *         return new_gen(_ret)
 * 
 *     def padicappr(self, pol, a):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol` congruent to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1291padicappr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1290padicappr[] = "\n        Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol` congruent to the\n        :math:`p`-adic number :math:`a` modulo :math:`p`, and with the same :math:`p`-adic precision as :math:`a`.\n        The number :math:`a` can be an ordinary :math:`p`-adic number (type :literal:`t_PADIC`, i.e.\302\240an\n        element of :math:`\\mathbb{Z}_p`) or can be an integral element of a finite\n        :emphasis:`unramified` extension :math:`\\mathbb{Q}_p[X]/(T)` of :math:`\\mathbb{Q}_p`, given as a :literal:`t_POLMOD`\n        :literal:`Mod`:math:`(A,T)` at least one of whose coefficients is a :literal:`t_PADIC` and :math:`T`\n        irreducible modulo :math:`p`. In this case, the result is the vector of roots\n        belonging to the same extension of :math:`\\mathbb{Q}_p` as :math:`a`. The polynomial :emphasis:`pol`\n        should have exact coefficients; if not, its coefficients are first rounded\n        to :math:`\\mathbb{Q}` or :math:`\\mathbb{Q}[X]/(T)` and this is the polynomial whose roots we consider.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1291padicappr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padicappr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_a,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_pol)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("padicappr", 1, 2, 2, 1); __PYX_ERR(4, 23044, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "padicappr") < 0)) __PYX_ERR(4, 23044, __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_pol = values[0];
    __pyx_v_a = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("padicappr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23044, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.padicappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1290padicappr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_pol, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1290padicappr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_a) {
  GEN __pyx_v__pol;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("padicappr", 0);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":23057
 *         to :math:`\mathbb{Q}` or :math:`\mathbb{Q}[X]/(T)` and this is the polynomial whose roots we consider.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23058
 *         '''
 *         pol = objtogen(pol)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23059
 *         pol = objtogen(pol)
 *         a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23059, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23060
 *         a = objtogen(a)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = padicappr(_pol, _a)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23061
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = padicappr(_pol, _a)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23062
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = padicappr(_pol, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = padicappr(__pyx_v__pol, __pyx_v__a);

  /* "cypari/auto_instance.pxi":23063
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = padicappr(_pol, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def padicfields(self, p, N, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23044
 *         return new_gen(_ret)
 * 
 *     def padicappr(self, pol, a):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol` congruent to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.padicappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23065
 *         return new_gen(_ret)
 * 
 *     def padicfields(self, p, N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials generating all the extensions of degree
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1293padicfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1292padicfields[] = "\n        Returns a vector of polynomials generating all the extensions of degree\n        :math:`N` of the field :math:`\\mathbb{Q}_p` of :math:`p`-adic rational numbers; :math:`N` is\n        allowed to be a 2-component vector :math:`[n,d]`, in which case we return the\n        extensions of degree :math:`n` and discriminant :math:`p^d`.\n        \n        The list is minimal in the sense that two different polynomials generate\n        non-isomorphic extensions; in particular, the number of polynomials is the\n        number of classes of non-isomorphic extensions. If :math:`P` is a polynomial in this\n        list, :math:`\\alpha` is any root of :math:`P` and :math:`K = \\mathbb{Q}_p(\\alpha)`, then :math:`\\alpha`\n        is the sum of a uniformizer and a (lift of a) generator of the residue field\n        of :math:`K`; in particular, the powers of :math:`\\alpha` generate the ring of :math:`p`-adic\n        integers of :math:`K`.\n        \n        If :math:`flag = 1`, replace each polynomial :math:`P` by a vector :math:`[P, e, f, d, c]`\n        where :math:`e` is the ramification index, :math:`f` the residual degree, :math:`d` the\n        valuation of the discriminant, and :math:`c` the number of conjugate fields.\n        If :math:`flag = 2`, only return the :emphasis:`number` of extensions in a fixed\n        algebraic closure (Krasner's formula), which is much faster.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1293padicfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_N = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padicfields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_N,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("padicfields", 0, 2, 3, 1); __PYX_ERR(4, 23065, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "padicfields") < 0)) __PYX_ERR(4, 23065, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_N = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23065, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("padicfields", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23065, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.padicfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1292padicfields(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_p, __pyx_v_N, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1292padicfields(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_p, PyObject *__pyx_v_N, long __pyx_v_flag) {
  GEN __pyx_v__p;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("padicfields", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":23086
 *         algebraic closure (Krasner's formula), which is much faster.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         N = objtogen(N)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23087
 *         '''
 *         p = objtogen(p)
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23088
 *         p = objtogen(p)
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23088, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23089
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = padicfields0(_p, _N, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23090
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = padicfields0(_p, _N, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23091
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = padicfields0(_p, _N, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = padicfields0(__pyx_v__p, __pyx_v__N, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23092
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = padicfields0(_p, _N, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def padicprec(self, x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23065
 *         return new_gen(_ret)
 * 
 *     def padicfields(self, p, N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials generating all the extensions of degree
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.padicfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23094
 *         return new_gen(_ret)
 * 
 *     def padicprec(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute :math:`p`-adic precision of the object :math:`x`; this is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1295padicprec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1294padicprec[] = "\n        Returns the absolute :math:`p`-adic precision of the object :math:`x`; this is the\n        minimum precision of the components of :math:`x`. The result is :literal:`+oo` if :math:`x`\n        is an exact object (as a :math:`p`-adic):\n        \n        ::\n        \n            ? padicprec((1 + O(2^5)) * x + (2 + O(2^4)), 2)\n            %1 = 4\n            ? padicprec(x + 2, 2)\n            %2 = +oo\n            ? padicprec(2 + x + O(x^2), 2)\n            %3 = +oo\n        \n        The function raises an exception if it encounters\n        an object incompatible with :math:`p`-adic computations:\n        \n        ::\n        \n            ? padicprec(O(3), 2)\n             *** at top-level: padicprec(O(3),2)\n             *** ^-----------------\n             *** padicprec: inconsistent moduli in padicprec: 3 != 2\n            \n            ? padicprec(1.0, 2)\n             *** at top-level: padicprec(1.0,2)\n             *** ^----------------\n             *** padicprec: incorrect type in padicprec (t_REAL).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1295padicprec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padicprec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("padicprec", 1, 2, 2, 1); __PYX_ERR(4, 23094, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "padicprec") < 0)) __PYX_ERR(4, 23094, __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_x = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("padicprec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23094, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.padicprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1294padicprec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1294padicprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("padicprec", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":23124
 *              *** padicprec: incorrect type in padicprec (t_REAL).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23124, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23125
 *         '''
 *         x = objtogen(x)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23126
 *         x = objtogen(x)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23126, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23127
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gppadicprec(_x, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23128
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gppadicprec(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23129
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gppadicprec(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gppadicprec(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_instance.pxi":23130
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gppadicprec(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def parapply(self, f, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23094
 *         return new_gen(_ret)
 * 
 *     def padicprec(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute :math:`p`-adic precision of the object :math:`x`; this is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.padicprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23132
 *         return new_gen(_ret)
 * 
 *     def parapply(self, f, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of :literal:`f` on the elements of :literal:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1297parapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1296parapply[] = "\n        Parallel evaluation of :literal:`f` on the elements of :literal:`x`.\n        The function :literal:`f` must not access global variables or variables\n        declared with local(), and must be free of side effects.\n        \n        ::\n        \n            parapply(factor,[2^256 + 1, 2^193 - 1])\n        \n        factors :math:`2^{256} + 1` and :math:`2^{193} - 1` in parallel.\n        \n        ::\n        \n            {\n             my(E = ellinit([1,3]), V = vector(12,i,randomprime(2^200)));\n             parapply(p->ellcard(E,p), V)\n            }\n        \n        computes the order of :math:`E(\\mathbb{F}_p)` for :math:`12` random primes of :math:`200` bits.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1297parapply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parapply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_x,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_f)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("parapply", 1, 2, 2, 1); __PYX_ERR(4, 23132, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parapply") < 0)) __PYX_ERR(4, 23132, __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_f = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parapply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.parapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1296parapply(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1296parapply(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_x) {
  GEN __pyx_v__f;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("parapply", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23153
 *         computes the order of :math:`E(\mathbb{F}_p)` for :math:`12` random primes of :math:`200` bits.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23154
 *         '''
 *         f = objtogen(f)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23155
 *         f = objtogen(f)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23155, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23156
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = parapply(_f, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23157
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = parapply(_f, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23158
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = parapply(_f, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = parapply(__pyx_v__f, __pyx_v__x);

  /* "cypari/auto_instance.pxi":23159
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = parapply(_f, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def pareval(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23132
 *         return new_gen(_ret)
 * 
 *     def parapply(self, f, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of :literal:`f` on the elements of :literal:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.parapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23161
 *         return new_gen(_ret)
 * 
 *     def pareval(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of the elements of :literal:`x`, where :literal:`x` is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1299pareval(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1298pareval[] = "\n        Parallel evaluation of the elements of :literal:`x`, where :literal:`x` is a\n        vector of closures. The closures must be of arity :math:`0`, must not access\n        global variables or variables declared with :literal:`local` and must be\n        free of side effects.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1299pareval(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pareval (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1298pareval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1298pareval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("pareval", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23168
 *         free of side effects.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23169
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pareval(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23169, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23170
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pareval(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23171
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pareval(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pareval(__pyx_v__x);

  /* "cypari/auto_instance.pxi":23172
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pareval(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def parselect(self, f, A, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23161
 *         return new_gen(_ret)
 * 
 *     def pareval(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of the elements of :literal:`x`, where :literal:`x` is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.pareval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23174
 *         return new_gen(_ret)
 * 
 *     def parselect(self, f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Selects elements of :math:`A` according to the selection function :math:`f`, done in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1301parselect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1300parselect[] = "\n        Selects elements of :math:`A` according to the selection function :math:`f`, done in\n        parallel. If :emphasis:`flag` is :math:`1`, return the indices of those elements (indirect\n        selection) The function :literal:`f` must not access global variables or\n        variables declared with local(), and must be free of side effects.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1301parselect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_A = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parselect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_A,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 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_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("parselect", 0, 2, 3, 1); __PYX_ERR(4, 23174, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parselect") < 0)) __PYX_ERR(4, 23174, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_f = values[0];
    __pyx_v_A = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23174, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parselect", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23174, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.parselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1300parselect(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_A, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1300parselect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("parselect", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":23181
 *         variables declared with local(), and must be free of side effects.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23182
 *         '''
 *         f = objtogen(f)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23183
 *         f = objtogen(f)
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23183, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23184
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = parselect(_f, _A, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23185
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = parselect(_f, _A, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23186
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = parselect(_f, _A, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = parselect(__pyx_v__f, __pyx_v__A, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23187
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = parselect(_f, _A, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def partitions(self, long k, a=None, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23174
 *         return new_gen(_ret)
 * 
 *     def parselect(self, f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Selects elements of :math:`A` according to the selection function :math:`f`, done in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.parselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23189
 *         return new_gen(_ret)
 * 
 *     def partitions(self, long k, a=None, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the vector of partitions of the integer :math:`k` as a sum of positive
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1303partitions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1302partitions[] = "\n        Returns the vector of partitions of the integer :math:`k` as a sum of positive\n        integers (parts); for :math:`k < 0`, it returns the empty set :literal:`[]`, and for :math:`k\n        = 0` the trivial partition (no parts). A partition is given by a\n        :literal:`t_VECSMALL`, where parts are sorted in nondecreasing order:\n        \n        ::\n        \n            ? partitions(3)\n            %1 = [Vecsmall([3]), Vecsmall([1, 2]), Vecsmall([1, 1, 1])]\n        \n        correspond to :math:`3`, :math:`1+2` and :math:`1+1+1`. The number\n        of (unrestricted) partitions of :math:`k` is given\n        by :literal:`numbpart`:\n        \n        ::\n        \n            ? #partitions(50)\n            %1 = 204226\n            ? numbpart(50)\n            %2 = 204226\n        \n        Optional parameters :math:`n` and :math:`a` are as follows:\n        \n        - :math:`n = nmax` (resp. :math:`n = [nmin,nmax]`) restricts\n          partitions to length less than :math:`nmax` (resp. length between\n          :math:`nmin` and :math:`nmax`), where the :emphasis:`length` is the number of nonzero\n          entries.\n        \n        - :math:`a = amax` (resp. :math:`a = [amin,amax]`) restricts the parts\n          to integers less than :math:`amax` (resp. between :math:`amin` and\n          :math:`amax`).\n        \n        ::\n        \n            ? partitions(4, 2) \\\\ parts bounded by 2\n            %1 = [Vecsmall([2, 2]), Vecsmall([1, 1, 2]), Vecsmall([1, 1, 1, 1])]\n            ? partitions(4,, 2) \\\\ at most 2 parts\n            %2 = [Vecsmall([4]), Vecsmall([1, 3]), Vecsmall([2, 2])]\n            ? partitions(4,[0,3], 2) \\\\ at most 2 parts\n            %3 = [Vecsmall([4]), Vecsmall([1, 3]), Vecsmall([2, 2])]\n        \n        By default, parts are positive and we remove zero entries unless\n        :math:`amin <= 0`, in which case :math:`nmin` is ignored and we fix :math:`\\#X = nmax`:\n        \n        ::\n        \n            ? pa""rtitions(4, [0,3]) \\\\ parts between 0 and 3\n            %1 = [Vecsmall([0, 0, 1, 3]), Vecsmall([0, 0, 2, 2]),\\\n             Vecsmall([0, 1, 1, 2]), Vecsmall([1, 1, 1, 1])]\n            ? partitions(1, [0,3], [2,4]) \\\\ no partition with 2 to 4 non-zero parts\n            %2 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1303partitions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("partitions (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_a,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_k)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "partitions") < 0)) __PYX_ERR(4, 23189, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23189, __pyx_L3_error)
    __pyx_v_a = values[1];
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("partitions", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23189, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.partitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1302partitions(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_k, __pyx_v_a, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1302partitions(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_k, PyObject *__pyx_v_a, PyObject *__pyx_v_n) {
  int __pyx_v__have_a;
  int __pyx_v__have_n;
  GEN __pyx_v__a;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("partitions", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":23243
 *             %2 = []
 *         '''
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_1 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_1;

  /* "cypari/auto_instance.pxi":23244
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         cdef bint _have_n = (n is not None)
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23245
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":23244
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         cdef bint _have_n = (n is not None)
 */
  }

  /* "cypari/auto_instance.pxi":23246
 *         if _have_a:
 *             a = objtogen(a)
 *         cdef bint _have_n = (n is not None)             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             n = objtogen(n)
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_v__have_n = __pyx_t_1;

  /* "cypari/auto_instance.pxi":23247
 *             a = objtogen(a)
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_n != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23248
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:
 *             n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":23247
 *             a = objtogen(a)
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":23249
 *         if _have_n:
 *             n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 23249, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23250
 *             n = objtogen(n)
 *         sig_on()
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":23251
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _n = NULL
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23252
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = NULL
 *         if _have_n:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_instance.pxi":23251
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _n = NULL
 */
  }

  /* "cypari/auto_instance.pxi":23253
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _n = NULL             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             _n = (<Gen>n).g
 */
  __pyx_v__n = NULL;

  /* "cypari/auto_instance.pxi":23254
 *             _a = (<Gen>a).g
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         cdef GEN _ret = partitions(k, _a, _n)
 */
  __pyx_t_1 = (__pyx_v__have_n != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23255
 *         cdef GEN _n = NULL
 *         if _have_n:
 *             _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = partitions(k, _a, _n)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_instance.pxi":23254
 *             _a = (<Gen>a).g
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         cdef GEN _ret = partitions(k, _a, _n)
 */
  }

  /* "cypari/auto_instance.pxi":23256
 *         if _have_n:
 *             _n = (<Gen>n).g
 *         cdef GEN _ret = partitions(k, _a, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = partitions(__pyx_v_k, __pyx_v__a, __pyx_v__n);

  /* "cypari/auto_instance.pxi":23257
 *             _n = (<Gen>n).g
 *         cdef GEN _ret = partitions(k, _a, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def permorder(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23189
 *         return new_gen(_ret)
 * 
 *     def partitions(self, long k, a=None, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the vector of partitions of the integer :math:`k` as a sum of positive
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.partitions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23259
 *         return new_gen(_ret)
 * 
 *     def permorder(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its order.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1305permorder(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1304permorder[] = "\n        Given a permutation :math:`x` on :math:`n` elements, return its order.\n        \n        ::\n        \n            ? p = Vecsmall([3,1,4,2,5]);\n            ? p^2\n            %2 = Vecsmall([4,3,2,1,5])\n            ? p^4\n            %3 = Vecsmall([1,2,3,4,5])\n            ? permorder(p)\n            %4 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1305permorder(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permorder (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1304permorder(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1304permorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("permorder", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23273
 *             %4 = 4
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23274
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permorder(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23274, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23275
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = permorder(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23276
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permorder(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = permorder(__pyx_v__x);

  /* "cypari/auto_instance.pxi":23277
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permorder(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23278
 *         cdef long _ret = permorder(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def permsign(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23259
 *         return new_gen(_ret)
 * 
 *     def permorder(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its order.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.permorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23280
 *         return _ret
 * 
 *     def permsign(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its signature.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1307permsign(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1306permsign[] = "\n        Given a permutation :math:`x` on :math:`n` elements, return its signature.\n        \n        ::\n        \n            ? p = Vecsmall([3,1,4,2,5]);\n            ? permsign(p)\n            %2 = -1\n            ? permsign(p^2)\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1307permsign(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permsign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1306permsign(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1306permsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("permsign", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23292
 *             %3 = 1
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23293
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permsign(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23293, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23294
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = permsign(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23295
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permsign(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = permsign(__pyx_v__x);

  /* "cypari/auto_instance.pxi":23296
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permsign(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23297
 *         cdef long _ret = permsign(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def permtonum(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23280
 *         return _ret
 * 
 *     def permsign(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its signature.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.permsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23299
 *         return _ret
 * 
 *     def permtonum(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, gives the number :math:`k` such that
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1309permtonum(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1308permtonum[] = "\n        Given a permutation :math:`x` on :math:`n` elements, gives the number :math:`k` such that\n        :math:`x = numtoperm(n,k)`, i.e.\302\240inverse function of :literal:`numtoperm`.\n        The numbering used is the standard lexicographic ordering, starting at :math:`0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1309permtonum(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permtonum (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1308permtonum(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1308permtonum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("permtonum", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23305
 *         The numbering used is the standard lexicographic ordering, starting at :math:`0`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23306
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = permtonum(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23306, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23307
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = permtonum(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23308
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = permtonum(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = permtonum(__pyx_v__x);

  /* "cypari/auto_instance.pxi":23309
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = permtonum(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plotbox(self, long w, x2, y2, long filled=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23299
 *         return _ret
 * 
 *     def permtonum(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, gives the number :math:`k` such that
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.permtonum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23311
 *         return new_gen(_ret)
 * 
 *     def plotbox(self, long w, x2, y2, long filled=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`(x1,y1)` be the current position of the virtual cursor. Draw in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1311plotbox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1310plotbox[] = "\n        Let :math:`(x1,y1)` be the current position of the virtual cursor. Draw in the\n        rectwindow :math:`w` the outline of the rectangle which is such that the points\n        :math:`(x1,y1)` and :math:`(x2,y2)` are opposite corners. Only the part of the rectangle\n        which is in :math:`w` is drawn. The virtual cursor does :emphasis:`not` move.\n        If :math:`filled = 1`, fill the box.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1311plotbox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_x2 = 0;
  PyObject *__pyx_v_y2 = 0;
  long __pyx_v_filled;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotbox (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_x2,&__pyx_n_s_y2,&__pyx_n_s_filled,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_w)) != 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_x2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotbox", 0, 3, 4, 1); __PYX_ERR(4, 23311, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotbox", 0, 3, 4, 2); __PYX_ERR(4, 23311, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filled);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotbox") < 0)) __PYX_ERR(4, 23311, __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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23311, __pyx_L3_error)
    __pyx_v_x2 = values[1];
    __pyx_v_y2 = values[2];
    if (values[3]) {
      __pyx_v_filled = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_filled == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23311, __pyx_L3_error)
    } else {
      __pyx_v_filled = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotbox", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23311, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1310plotbox(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_x2, __pyx_v_y2, __pyx_v_filled);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1310plotbox(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x2, PyObject *__pyx_v_y2, long __pyx_v_filled) {
  GEN __pyx_v__x2;
  GEN __pyx_v__y2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotbox", 0);
  __Pyx_INCREF(__pyx_v_x2);
  __Pyx_INCREF(__pyx_v_y2);

  /* "cypari/auto_instance.pxi":23319
 *         If :math:`filled = 1`, fill the box.
 *         '''
 *         x2 = objtogen(x2)             # <<<<<<<<<<<<<<
 *         y2 = objtogen(y2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23320
 *         '''
 *         x2 = objtogen(x2)
 *         y2 = objtogen(y2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x2 = (<Gen>x2).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23321
 *         x2 = objtogen(x2)
 *         y2 = objtogen(y2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x2 = (<Gen>x2).g
 *         cdef GEN _y2 = (<Gen>y2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23321, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23322
 *         y2 = objtogen(y2)
 *         sig_on()
 *         cdef GEN _x2 = (<Gen>x2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y2 = (<Gen>y2).g
 *         plotbox(w, _x2, _y2, filled)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x2)->__pyx_base.g;
  __pyx_v__x2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23323
 *         sig_on()
 *         cdef GEN _x2 = (<Gen>x2).g
 *         cdef GEN _y2 = (<Gen>y2).g             # <<<<<<<<<<<<<<
 *         plotbox(w, _x2, _y2, filled)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y2)->__pyx_base.g;
  __pyx_v__y2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23324
 *         cdef GEN _x2 = (<Gen>x2).g
 *         cdef GEN _y2 = (<Gen>y2).g
 *         plotbox(w, _x2, _y2, filled)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotbox(__pyx_v_w, __pyx_v__x2, __pyx_v__y2, __pyx_v_filled);

  /* "cypari/auto_instance.pxi":23325
 *         cdef GEN _y2 = (<Gen>y2).g
 *         plotbox(w, _x2, _y2, filled)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotclip(self, long w):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23311
 *         return new_gen(_ret)
 * 
 *     def plotbox(self, long w, x2, y2, long filled=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`(x1,y1)` be the current position of the virtual cursor. Draw in the
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x2);
  __Pyx_XDECREF(__pyx_v_y2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23327
 *         clear_stack()
 * 
 *     def plotclip(self, long w):             # <<<<<<<<<<<<<<
 *         r'''
 *         `clips' the content of rectwindow :math:`w`, i.e remove all parts of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1313plotclip(PyObject *__pyx_v_self, PyObject *__pyx_arg_w); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1312plotclip[] = "\n        `clips' the content of rectwindow :math:`w`, i.e remove all parts of the\n        drawing that would not be visible on the screen. Together with\n        :literal:`plotcopy` this function enables you to draw on a scratchpad before\n        committing the part you're interested in to the final picture.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1313plotclip(PyObject *__pyx_v_self, PyObject *__pyx_arg_w) {
  long __pyx_v_w;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotclip (wrapper)", 0);
  assert(__pyx_arg_w); {
    __pyx_v_w = __Pyx_PyInt_As_long(__pyx_arg_w); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23327, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotclip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1312plotclip(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_w));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1312plotclip(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("plotclip", 0);

  /* "cypari/auto_instance.pxi":23334
 *         committing the part you're interested in to the final picture.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         plotclip(w)
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 23334, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23335
 *         '''
 *         sig_on()
 *         plotclip(w)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotclip(__pyx_v_w);

  /* "cypari/auto_instance.pxi":23336
 *         sig_on()
 *         plotclip(w)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotcolor(self, long w, c):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23327
 *         clear_stack()
 * 
 *     def plotclip(self, long w):             # <<<<<<<<<<<<<<
 *         r'''
 *         `clips' the content of rectwindow :math:`w`, i.e remove all parts of the
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotclip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23338
 *         clear_stack()
 * 
 *     def plotcolor(self, long w, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Set default color to :math:`c` in rectwindow :math:`w`. Return [R,G,B] value attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1315plotcolor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1314plotcolor[] = "\n        Set default color to :math:`c` in rectwindow :math:`w`. Return [R,G,B] value attached\n        to color. Possible values for :math:`c` are\n        \n        - a :literal:`t_VEC` or :literal:`t_VECSMALL` :math:`[R,G,B]` giving the color RGB value\n          (all 3 values are between 0 and 255), e.g. :literal:`[250,235,215]` or\n          equivalently :literal:`[0xfa, 0xeb, 0xd7]` for :literal:`antiquewhite`;\n        \n        - a :literal:`t_STR` giving a valid colour name (see the :literal:`rgb.txt`\n          file in X11 distributions), e.g. :literal:`\"antiquewhite\"` or an RGV\n          value given by a :literal:`\\#` followed by 6 hexadecimal digits, e.g.\n          :literal:`\"\\#faebd7\"` for :literal:`antiquewhite`;\n        \n        - a :literal:`t_INT`, an index in the :literal:`graphcolormap` default, factory\n          setting are\n        \n        1 = black, 2 = blue, 3 = violetred, 4 = red, 5 = green, 6 = grey, 7 = gainsborough.\n        \n        but this can be extended if needed.\n        \n        ::\n        \n            ? plotinit(0,100,100);\n            ? plotcolor(0, \"turquoise\")\n            %2 = [64, 224, 208]\n            ? plotbox(0, 50,50,1);\n            ? plotmove(0, 50,50);\n            ? plotcolor(0, 2) \\\\ blue\n            %4 = [0, 0, 255]\n            ? plotbox(0, 50,50,1);\n            ? plotdraw(0);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1315plotcolor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_c = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotcolor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_c,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_w)) != 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_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotcolor", 1, 2, 2, 1); __PYX_ERR(4, 23338, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotcolor") < 0)) __PYX_ERR(4, 23338, __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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23338, __pyx_L3_error)
    __pyx_v_c = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotcolor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23338, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotcolor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1314plotcolor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_c);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1314plotcolor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_c) {
  GEN __pyx_v__c;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotcolor", 0);
  __Pyx_INCREF(__pyx_v_c);

  /* "cypari/auto_instance.pxi":23371
 *             ? plotdraw(0);
 *         '''
 *         c = objtogen(c)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _c = (<Gen>c).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23372
 *         '''
 *         c = objtogen(c)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = plotcolor(w, _c)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23372, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23373
 *         c = objtogen(c)
 *         sig_on()
 *         cdef GEN _c = (<Gen>c).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plotcolor(w, _c)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c)->__pyx_base.g;
  __pyx_v__c = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23374
 *         sig_on()
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = plotcolor(w, _c)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plotcolor(__pyx_v_w, __pyx_v__c);

  /* "cypari/auto_instance.pxi":23375
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = plotcolor(w, _c)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plotcopy(self, long sourcew, long destw, dx, dy, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23338
 *         clear_stack()
 * 
 *     def plotcolor(self, long w, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Set default color to :math:`c` in rectwindow :math:`w`. Return [R,G,B] value attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotcolor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23377
 *         return new_gen(_ret)
 * 
 *     def plotcopy(self, long sourcew, long destw, dx, dy, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Copy the contents of rectwindow :emphasis:`sourcew` to rectwindow :emphasis:`destw`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1317plotcopy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1316plotcopy[] = "\n        Copy the contents of rectwindow :emphasis:`sourcew` to rectwindow :emphasis:`destw`\n        with offset (dx,dy). If flag's bit 1 is set, dx and dy express fractions of\n        the size of the current output device, otherwise dx and dy are in pixels. dx\n        and dy are relative positions of northwest corners if other bits of flag\n        vanish, otherwise of: 2: southwest, 4: southeast, 6: northeast corners\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1317plotcopy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_sourcew;
  long __pyx_v_destw;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_dy = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotcopy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sourcew,&__pyx_n_s_destw,&__pyx_n_s_dx,&__pyx_n_s_dy,&__pyx_n_s_flag,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sourcew)) != 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_destw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotcopy", 0, 4, 5, 1); __PYX_ERR(4, 23377, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotcopy", 0, 4, 5, 2); __PYX_ERR(4, 23377, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotcopy", 0, 4, 5, 3); __PYX_ERR(4, 23377, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotcopy") < 0)) __PYX_ERR(4, 23377, __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);
        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_sourcew = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_sourcew == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23377, __pyx_L3_error)
    __pyx_v_destw = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_destw == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23377, __pyx_L3_error)
    __pyx_v_dx = values[2];
    __pyx_v_dy = values[3];
    if (values[4]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23377, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotcopy", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23377, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotcopy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1316plotcopy(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_sourcew, __pyx_v_destw, __pyx_v_dx, __pyx_v_dy, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1316plotcopy(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_sourcew, long __pyx_v_destw, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy, long __pyx_v_flag) {
  GEN __pyx_v__dx;
  GEN __pyx_v__dy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotcopy", 0);
  __Pyx_INCREF(__pyx_v_dx);
  __Pyx_INCREF(__pyx_v_dy);

  /* "cypari/auto_instance.pxi":23385
 *         vanish, otherwise of: 2: southwest, 4: southeast, 6: northeast corners
 *         '''
 *         dx = objtogen(dx)             # <<<<<<<<<<<<<<
 *         dy = objtogen(dy)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dx, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dx, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23386
 *         '''
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dy, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dy, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23387
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23387, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23388
 *         dy = objtogen(dy)
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotcopy(sourcew, destw, _dx, _dy, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dx)->__pyx_base.g;
  __pyx_v__dx = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23389
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g             # <<<<<<<<<<<<<<
 *         plotcopy(sourcew, destw, _dx, _dy, flag)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dy)->__pyx_base.g;
  __pyx_v__dy = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23390
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotcopy(sourcew, destw, _dx, _dy, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotcopy(__pyx_v_sourcew, __pyx_v_destw, __pyx_v__dx, __pyx_v__dy, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23391
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotcopy(sourcew, destw, _dx, _dy, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotcursor(self, long w):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23377
 *         return new_gen(_ret)
 * 
 *     def plotcopy(self, long sourcew, long destw, dx, dy, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Copy the contents of rectwindow :emphasis:`sourcew` to rectwindow :emphasis:`destw`
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotcopy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23393
 *         clear_stack()
 * 
 *     def plotcursor(self, long w):             # <<<<<<<<<<<<<<
 *         r'''
 *         Give as a 2-component vector the current
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1319plotcursor(PyObject *__pyx_v_self, PyObject *__pyx_arg_w); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1318plotcursor[] = "\n        Give as a 2-component vector the current\n        (scaled) position of the virtual cursor corresponding to the rectwindow :math:`w`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1319plotcursor(PyObject *__pyx_v_self, PyObject *__pyx_arg_w) {
  long __pyx_v_w;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotcursor (wrapper)", 0);
  assert(__pyx_arg_w); {
    __pyx_v_w = __Pyx_PyInt_As_long(__pyx_arg_w); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23393, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotcursor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1318plotcursor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_w));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1318plotcursor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("plotcursor", 0);

  /* "cypari/auto_instance.pxi":23398
 *         (scaled) position of the virtual cursor corresponding to the rectwindow :math:`w`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plotcursor(w)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 23398, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23399
 *         '''
 *         sig_on()
 *         cdef GEN _ret = plotcursor(w)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plotcursor(__pyx_v_w);

  /* "cypari/auto_instance.pxi":23400
 *         sig_on()
 *         cdef GEN _ret = plotcursor(w)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plotdraw(self, w, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23393
 *         clear_stack()
 * 
 *     def plotcursor(self, long w):             # <<<<<<<<<<<<<<
 *         r'''
 *         Give as a 2-component vector the current
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotcursor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23402
 *         return new_gen(_ret)
 * 
 *     def plotdraw(self, w, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Physically draw the rectwindow :math:`w`. More generally,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1321plotdraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1320plotdraw[] = "\n        Physically draw the rectwindow :math:`w`. More generally,\n        :math:`w` can be of the form :math:`[w_1,x_1,y_1,w_2,x_2,y_2,...]` (number of\n        components must be divisible by :math:`3`; the windows :math:`w_1`, :math:`w_2`, etc.\302\240are\n        physically placed with their upper left corner at physical position\n        :math:`(x_1,y_1)`, :math:`(x_2,y_2)`,...respectively, and are then drawn together.\n        Overlapping regions will thus be drawn twice, and the windows are considered\n        transparent. Then display the whole drawing in a window on your screen.\n        If :math:`flag != 0`, :math:`x_1`, :math:`y_1` etc. express fractions of the size of the\n        current output device\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1321plotdraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotdraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_flag,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_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotdraw") < 0)) __PYX_ERR(4, 23402, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23402, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotdraw", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23402, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1320plotdraw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1320plotdraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_w, long __pyx_v_flag) {
  GEN __pyx_v__w;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotdraw", 0);
  __Pyx_INCREF(__pyx_v_w);

  /* "cypari/auto_instance.pxi":23414
 *         current output device
 *         '''
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23415
 *         '''
 *         w = objtogen(w)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         plotdraw(_w, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23415, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23416
 *         w = objtogen(w)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         plotdraw(_w, flag)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23417
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         plotdraw(_w, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotdraw(__pyx_v__w, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23418
 *         cdef GEN _w = (<Gen>w).g
 *         plotdraw(_w, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotexport(self, fmt, list, long flag=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23402
 *         return new_gen(_ret)
 * 
 *     def plotdraw(self, w, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Physically draw the rectwindow :math:`w`. More generally,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23420
 *         clear_stack()
 * 
 *     def plotexport(self, fmt, list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw list of rectwindows as in :literal:`plotdraw(list,flag)`, returning
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1323plotexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1322plotexport[] = "\n        Draw list of rectwindows as in :literal:`plotdraw(list,flag)`, returning\n        the resulting picture as a character string which can then be written to\n        a file. The format :literal:`fmt` is either :literal:`\"ps\"` (PostScript output)\n        or :literal:`\"svg\"` (Scalable Vector Graphics).\n        \n        ::\n        \n             ? plotinit(0, 100, 100);\n             ? plotbox(0, 50, 50);\n             ? plotcolor(0, 2);\n             ? plotbox(0, 30, 30);\n             ? plotdraw(0); \\\\ watch result on screen\n             ? s = plotexport(\"svg, 0);\n             ? write(\"graph.svg\", s); \\\\ dump result to file\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1323plotexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fmt = 0;
  PyObject *__pyx_v_list = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fmt,&__pyx_n_s_list,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fmt)) != 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_list)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotexport", 0, 2, 3, 1); __PYX_ERR(4, 23420, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotexport") < 0)) __PYX_ERR(4, 23420, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_fmt = values[0];
    __pyx_v_list = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23420, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotexport", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23420, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1322plotexport(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_fmt, __pyx_v_list, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1322plotexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_list, long __pyx_v_flag) {
  GEN __pyx_v__fmt;
  GEN __pyx_v__list;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotexport", 0);
  __Pyx_INCREF(__pyx_v_fmt);
  __Pyx_INCREF(__pyx_v_list);

  /* "cypari/auto_instance.pxi":23437
 *              ? write("graph.svg", s); \\ dump result to file
 *         '''
 *         fmt = objtogen(fmt)             # <<<<<<<<<<<<<<
 *         list = objtogen(list)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fmt, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_fmt, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23438
 *         '''
 *         fmt = objtogen(fmt)
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23439
 *         fmt = objtogen(fmt)
 *         list = objtogen(list)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23439, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23440
 *         list = objtogen(list)
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fmt)->__pyx_base.g;
  __pyx_v__fmt = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23441
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23442
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plotexport(__pyx_v__fmt, __pyx_v__list, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23443
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plothraw(self, X, Y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23420
 *         clear_stack()
 * 
 *     def plotexport(self, fmt, list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw list of rectwindows as in :literal:`plotdraw(list,flag)`, returning
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fmt);
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23445
 *         return new_gen(_ret)
 * 
 *     def plothraw(self, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1325plothraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1324plothraw[] = "\n        Given :math:`X` and :math:`Y` two vectors of equal length, plots (in\n        high precision) the points whose :math:`(x,y)`-coordinates are given in\n        :math:`X` and :math:`Y`. Automatic positioning and scaling is done, but\n        with the same scaling factor on :math:`x` and :math:`y`. If :math:`flag` is 1, join points,\n        other non-0 flags toggle display options and should be combinations of bits\n        :math:`2^k`, :math:`k >= 3` as in :literal:`ploth`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1325plothraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_Y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plothraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_Y,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plothraw", 0, 2, 3, 1); __PYX_ERR(4, 23445, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plothraw") < 0)) __PYX_ERR(4, 23445, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_X = values[0];
    __pyx_v_Y = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23445, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plothraw", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23445, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1324plothraw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_X, __pyx_v_Y, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1324plothraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag) {
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plothraw", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_instance.pxi":23454
 *         :math:`2^k`, :math:`k >= 3` as in :literal:`ploth`.
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         Y = objtogen(Y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23455
 *         '''
 *         X = objtogen(X)
 *         Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23456
 *         X = objtogen(X)
 *         Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23456, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23457
 *         Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothraw(_X, _Y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23458
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plothraw(_X, _Y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
  __pyx_v__Y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23459
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothraw(_X, _Y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plothraw(__pyx_v__X, __pyx_v__Y, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23460
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothraw(_X, _Y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plothrawexport(self, fmt, X, Y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23445
 *         return new_gen(_ret)
 * 
 *     def plothraw(self, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23462
 *         return new_gen(_ret)
 * 
 *     def plothrawexport(self, fmt, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in high precision)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1327plothrawexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1326plothrawexport[] = "\n        Given :math:`X` and :math:`Y` two vectors of equal length, plots (in high precision)\n        the points whose :math:`(x,y)`-coordinates are given in :math:`X` and :math:`Y`, returning the\n        resulting picture as a character string which can then be written to a file.\n        The format :literal:`fmt` is either :literal:`\"ps\"` (PostScript output) or :literal:`\"svg\"`\n        (Scalable Vector Graphics).\n        \n        Automatic positioning and scaling is done, but with the same scaling factor\n        on :math:`x` and :math:`y`. If :math:`flag` is 1, join points, other non-0 flags toggle display\n        options and should be combinations of bits :math:`2^k`, :math:`k >= 3` as in\n        :literal:`ploth`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1327plothrawexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fmt = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_Y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plothrawexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fmt,&__pyx_n_s_X,&__pyx_n_s_Y,&__pyx_n_s_flag,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_fmt)) != 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_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plothrawexport", 0, 3, 4, 1); __PYX_ERR(4, 23462, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plothrawexport", 0, 3, 4, 2); __PYX_ERR(4, 23462, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plothrawexport") < 0)) __PYX_ERR(4, 23462, __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_fmt = values[0];
    __pyx_v_X = values[1];
    __pyx_v_Y = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23462, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plothrawexport", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plothrawexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1326plothrawexport(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_fmt, __pyx_v_X, __pyx_v_Y, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1326plothrawexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_fmt, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag) {
  GEN __pyx_v__fmt;
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plothrawexport", 0);
  __Pyx_INCREF(__pyx_v_fmt);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_instance.pxi":23475
 *         :literal:`ploth`.
 *         '''
 *         fmt = objtogen(fmt)             # <<<<<<<<<<<<<<
 *         X = objtogen(X)
 *         Y = objtogen(Y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fmt, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_fmt, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23476
 *         '''
 *         fmt = objtogen(fmt)
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         Y = objtogen(Y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23477
 *         fmt = objtogen(fmt)
 *         X = objtogen(X)
 *         Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23478
 *         X = objtogen(X)
 *         Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23478, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23479
 *         Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fmt)->__pyx_base.g;
  __pyx_v__fmt = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23480
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23481
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
  __pyx_v__Y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23482
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plothrawexport(__pyx_v__fmt, __pyx_v__X, __pyx_v__Y, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23483
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plothsizes(self, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23462
 *         return new_gen(_ret)
 * 
 *     def plothrawexport(self, fmt, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in high precision)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plothrawexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fmt);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23485
 *         return new_gen(_ret)
 * 
 *     def plothsizes(self, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return data corresponding to the output window
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1329plothsizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1328plothsizes[] = "\n        Return data corresponding to the output window\n        in the form of a 8-component vector: window width and height, sizes for ticks\n        in horizontal and vertical directions (this is intended for the :literal:`gnuplot`\n        interface and is currently not significant), width and height of characters,\n        width and height of display, if applicable. If display has no sense, e.g.\n        for svg plots or postscript plots, then width and height of display are set\n        to 0.\n        \n        If :math:`flag = 0`, sizes of ticks and characters are in\n        pixels, otherwise are fractions of the screen size\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1329plothsizes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plothsizes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plothsizes") < 0)) __PYX_ERR(4, 23485, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23485, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plothsizes", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23485, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plothsizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1328plothsizes(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1328plothsizes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_flag) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("plothsizes", 0);

  /* "cypari/auto_instance.pxi":23498
 *         pixels, otherwise are fractions of the screen size
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plothsizes(flag)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 23498, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23499
 *         '''
 *         sig_on()
 *         cdef GEN _ret = plothsizes(flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plothsizes(__pyx_v_flag);

  /* "cypari/auto_instance.pxi":23500
 *         sig_on()
 *         cdef GEN _ret = plothsizes(flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plotinit(self, long w, x=None, y=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23500, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23485
 *         return new_gen(_ret)
 * 
 *     def plothsizes(self, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return data corresponding to the output window
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plothsizes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23502
 *         return new_gen(_ret)
 * 
 *     def plotinit(self, long w, x=None, y=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize the rectwindow :math:`w`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1331plotinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1330plotinit[] = "\n        Initialize the rectwindow :math:`w`,\n        destroying any rect objects you may have already drawn in :math:`w`. The virtual\n        cursor is set to :math:`(0,0)`. The rectwindow size is set to width :math:`x` and height\n        :math:`y`; omitting either :math:`x` or :math:`y` means we use the full size of the device\n        in that direction.\n        If :math:`flag = 0`, :math:`x` and :math:`y` represent pixel units. Otherwise, :math:`x` and :math:`y`\n        are understood as fractions of the size of the current output device (hence\n        must be between :math:`0` and :math:`1`) and internally converted to pixels.\n        \n        The plotting device imposes an upper bound for :math:`x` and :math:`y`, for instance the\n        number of pixels for screen output. These bounds are available through the\n        :literal:`plothsizes` function. The following sequence initializes in a portable\n        way (i.e independent of the output device) a window of maximal size, accessed\n        through coordinates in the :math:`[0,1000] x [0,1000]` range:\n        \n        ::\n        \n            s = plothsizes();\n            plotinit(0, s[1]-1, s[2]-1);\n            plotscale(0, 0,1000, 0,1000);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1331plotinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_flag,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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_w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          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_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotinit") < 0)) __PYX_ERR(4, 23502, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23502, __pyx_L3_error)
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23502, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotinit", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23502, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1330plotinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_x, __pyx_v_y, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1330plotinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag) {
  int __pyx_v__have_x;
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("plotinit", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":23525
 *             plotscale(0, 0,1000, 0,1000);
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":23526
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23527
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23527, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":23526
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 */
  }

  /* "cypari/auto_instance.pxi":23528
 *         if _have_x:
 *             x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_1 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_1;

  /* "cypari/auto_instance.pxi":23529
 *             x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23530
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23530, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":23529
 *             x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":23531
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 23531, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23532
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":23533
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23534
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":23533
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  }

  /* "cypari/auto_instance.pxi":23535
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":23536
 *             _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         plotinit(w, _x, _y, flag)
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23537
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         plotinit(w, _x, _y, flag)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":23536
 *             _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         plotinit(w, _x, _y, flag)
 */
  }

  /* "cypari/auto_instance.pxi":23538
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         plotinit(w, _x, _y, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotinit(__pyx_v_w, __pyx_v__x, __pyx_v__y, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23539
 *             _y = (<Gen>y).g
 *         plotinit(w, _x, _y, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotkill(self, long w):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23502
 *         return new_gen(_ret)
 * 
 *     def plotinit(self, long w, x=None, y=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize the rectwindow :math:`w`,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23541
 *         clear_stack()
 * 
 *     def plotkill(self, long w):             # <<<<<<<<<<<<<<
 *         r'''
 *         Erase rectwindow :math:`w` and free the corresponding memory. Note that if you
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1333plotkill(PyObject *__pyx_v_self, PyObject *__pyx_arg_w); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1332plotkill[] = "\n        Erase rectwindow :math:`w` and free the corresponding memory. Note that if you\n        want to use the rectwindow :math:`w` again, you have to use :literal:`plotinit` first\n        to specify the new size. So it's better in this case to use :literal:`plotinit`\n        directly as this throws away any previous work in the given rectwindow.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1333plotkill(PyObject *__pyx_v_self, PyObject *__pyx_arg_w) {
  long __pyx_v_w;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotkill (wrapper)", 0);
  assert(__pyx_arg_w); {
    __pyx_v_w = __Pyx_PyInt_As_long(__pyx_arg_w); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23541, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotkill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1332plotkill(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_w));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1332plotkill(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("plotkill", 0);

  /* "cypari/auto_instance.pxi":23548
 *         directly as this throws away any previous work in the given rectwindow.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         plotkill(w)
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 23548, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23549
 *         '''
 *         sig_on()
 *         plotkill(w)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotkill(__pyx_v_w);

  /* "cypari/auto_instance.pxi":23550
 *         sig_on()
 *         plotkill(w)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotlines(self, long w, X, Y, long flag=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23541
 *         clear_stack()
 * 
 *     def plotkill(self, long w):             # <<<<<<<<<<<<<<
 *         r'''
 *         Erase rectwindow :math:`w` and free the corresponding memory. Note that if you
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotkill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23552
 *         clear_stack()
 * 
 *     def plotlines(self, long w, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw on the rectwindow :math:`w`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1335plotlines(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1334plotlines[] = "\n        Draw on the rectwindow :math:`w`\n        the polygon such that the (x,y)-coordinates of the vertices are in the\n        vectors of equal length :math:`X` and :math:`Y`. For simplicity, the whole\n        polygon is drawn, not only the part of the polygon which is inside the\n        rectwindow. If :math:`flag` is non-zero, close the polygon. In any case, the\n        virtual cursor does not move.\n        \n        :math:`X` and :math:`Y` are allowed to be scalars (in this case, both have to).\n        There, a single segment will be drawn, between the virtual cursor current\n        position and the point :math:`(X,Y)`. And only the part thereof which\n        actually lies within the boundary of :math:`w`. Then :emphasis:`move` the virtual cursor\n        to :math:`(X,Y)`, even if it is outside the window. If you want to draw a\n        line from :math:`(x1,y1)` to :math:`(x2,y2)` where :math:`(x1,y1)` is not necessarily the\n        position of the virtual cursor, use :literal:`plotmove(w,x1,y1)` before using this\n        function.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1335plotlines(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_Y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotlines (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_X,&__pyx_n_s_Y,&__pyx_n_s_flag,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_w)) != 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_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotlines", 0, 3, 4, 1); __PYX_ERR(4, 23552, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotlines", 0, 3, 4, 2); __PYX_ERR(4, 23552, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotlines") < 0)) __PYX_ERR(4, 23552, __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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23552, __pyx_L3_error)
    __pyx_v_X = values[1];
    __pyx_v_Y = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23552, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotlines", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23552, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotlines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1334plotlines(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_X, __pyx_v_Y, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1334plotlines(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag) {
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotlines", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_instance.pxi":23570
 *         function.
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         Y = objtogen(Y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23571
 *         '''
 *         X = objtogen(X)
 *         Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23572
 *         X = objtogen(X)
 *         Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23572, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23573
 *         Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = (<Gen>Y).g
 *         plotlines(w, _X, _Y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23574
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         plotlines(w, _X, _Y, flag)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
  __pyx_v__Y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23575
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 *         plotlines(w, _X, _Y, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotlines(__pyx_v_w, __pyx_v__X, __pyx_v__Y, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":23576
 *         cdef GEN _Y = (<Gen>Y).g
 *         plotlines(w, _X, _Y, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotlinetype(self, long w, long type):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23552
 *         clear_stack()
 * 
 *     def plotlines(self, long w, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw on the rectwindow :math:`w`
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotlines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23578
 *         clear_stack()
 * 
 *     def plotlinetype(self, long w, long type):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete and currently a no-op.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1337plotlinetype(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1336plotlinetype[] = "\n        This function is obsolete and currently a no-op.\n        \n        Change the type of lines subsequently plotted in rectwindow :math:`w`.\n        :emphasis:`type` :math:`-2` corresponds to frames, :math:`-1` to axes, larger values may\n        correspond to something else. :math:`w = -1` changes highlevel plotting.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1337plotlinetype(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  long __pyx_v_type;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotlinetype (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_type,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_w)) != 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_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotlinetype", 1, 2, 2, 1); __PYX_ERR(4, 23578, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotlinetype") < 0)) __PYX_ERR(4, 23578, __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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23578, __pyx_L3_error)
    __pyx_v_type = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_type == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23578, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotlinetype", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23578, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotlinetype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1336plotlinetype(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_type);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1336plotlinetype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, long __pyx_v_type) {
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("plotlinetype", 0);

  /* "cypari/auto_instance.pxi":23586
 *         correspond to something else. :math:`w = -1` changes highlevel plotting.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function plotlinetype is obsolete (2007-05-11)', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23586, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23587
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function plotlinetype is obsolete (2007-05-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         plotlinetype(w, type)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23588
 *         from warnings import warn
 *         warn('the PARI/GP function plotlinetype is obsolete (2007-05-11)', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         plotlinetype(w, type)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 23588, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23589
 *         warn('the PARI/GP function plotlinetype is obsolete (2007-05-11)', DeprecationWarning)
 *         sig_on()
 *         plotlinetype(w, type)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotlinetype(__pyx_v_w, __pyx_v_type);

  /* "cypari/auto_instance.pxi":23590
 *         sig_on()
 *         plotlinetype(w, type)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotmove(self, long w, x, y):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23578
 *         clear_stack()
 * 
 *     def plotlinetype(self, long w, long type):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete and currently a no-op.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotlinetype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23592
 *         clear_stack()
 * 
 *     def plotmove(self, long w, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Move the virtual cursor of the rectwindow :math:`w` to position :math:`(x,y)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1339plotmove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1338plotmove[] = "\n        Move the virtual cursor of the rectwindow :math:`w` to position :math:`(x,y)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1339plotmove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotmove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotmove", 1, 3, 3, 1); __PYX_ERR(4, 23592, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotmove", 1, 3, 3, 2); __PYX_ERR(4, 23592, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotmove") < 0)) __PYX_ERR(4, 23592, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23592, __pyx_L3_error)
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotmove", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23592, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotmove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1338plotmove(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1338plotmove(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotmove", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":23596
 *         Move the virtual cursor of the rectwindow :math:`w` to position :math:`(x,y)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23597
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23597, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23598
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23598, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23599
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         plotmove(w, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23600
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         plotmove(w, _x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23601
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         plotmove(w, _x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotmove(__pyx_v_w, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":23602
 *         cdef GEN _y = (<Gen>y).g
 *         plotmove(w, _x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotpoints(self, long w, X, Y):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23592
 *         clear_stack()
 * 
 *     def plotmove(self, long w, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Move the virtual cursor of the rectwindow :math:`w` to position :math:`(x,y)`.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotmove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23604
 *         clear_stack()
 * 
 *     def plotpoints(self, long w, X, Y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw on the rectwindow :math:`w` the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1341plotpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1340plotpoints[] = "\n        Draw on the rectwindow :math:`w` the\n        points whose :math:`(x,y)`-coordinates are in the vectors of equal length :math:`X` and\n        :math:`Y` and which are inside :math:`w`. The virtual cursor does :emphasis:`not` move. This\n        is basically the same function as :literal:`plothraw`, but either with no scaling\n        factor or with a scale chosen using the function :literal:`plotscale`.\n        \n        As was the case with the :literal:`plotlines` function, :math:`X` and :math:`Y` are allowed to\n        be (simultaneously) scalar. In this case, draw the single point :math:`(X,Y)` on\n        the rectwindow :math:`w` (if it is actually inside :math:`w`), and in any case\n        :emphasis:`move` the virtual cursor to position :math:`(x,y)`.\n        \n        If you draw few points in the rectwindow, they will be hard to see; in\n        this case, you can use filled boxes instead. Compare:\n        \n        ::\n        \n            ? plotinit(0, 100,100); plotpoints(0, 50,50);\n            ? plotdraw(0)\n            ? plotinit(1, 100,100); plotmove(1,48,48); plotrbox(1, 4,4, 1);\n            ? plotdraw(1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1341plotpoints(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_Y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotpoints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_X,&__pyx_n_s_Y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotpoints", 1, 3, 3, 1); __PYX_ERR(4, 23604, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotpoints", 1, 3, 3, 2); __PYX_ERR(4, 23604, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotpoints") < 0)) __PYX_ERR(4, 23604, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23604, __pyx_L3_error)
    __pyx_v_X = values[1];
    __pyx_v_Y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotpoints", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23604, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1340plotpoints(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_X, __pyx_v_Y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1340plotpoints(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) {
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotpoints", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_instance.pxi":23627
 *             ? plotdraw(1)
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         Y = objtogen(Y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23628
 *         '''
 *         X = objtogen(X)
 *         Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23629
 *         X = objtogen(X)
 *         Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23629, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23630
 *         Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = (<Gen>Y).g
 *         plotpoints(w, _X, _Y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23631
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         plotpoints(w, _X, _Y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
  __pyx_v__Y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23632
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 *         plotpoints(w, _X, _Y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotpoints(__pyx_v_w, __pyx_v__X, __pyx_v__Y);

  /* "cypari/auto_instance.pxi":23633
 *         cdef GEN _Y = (<Gen>Y).g
 *         plotpoints(w, _X, _Y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotpointsize(self, long w, size):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23604
 *         clear_stack()
 * 
 *     def plotpoints(self, long w, X, Y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw on the rectwindow :math:`w` the
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23635
 *         clear_stack()
 * 
 *     def plotpointsize(self, long w, size):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete. It is currently a no-op.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1343plotpointsize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1342plotpointsize[] = "\n        This function is obsolete. It is currently a no-op.\n        \n        Changes the \"size\" of following points in rectwindow :math:`w`. If :math:`w = -1`,\n        change it in all rectwindows.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1343plotpointsize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_size = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotpointsize (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_size,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_w)) != 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_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotpointsize", 1, 2, 2, 1); __PYX_ERR(4, 23635, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotpointsize") < 0)) __PYX_ERR(4, 23635, __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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23635, __pyx_L3_error)
    __pyx_v_size = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotpointsize", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23635, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotpointsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1342plotpointsize(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_size);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1342plotpointsize(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_size) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__size;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("plotpointsize", 0);
  __Pyx_INCREF(__pyx_v_size);

  /* "cypari/auto_instance.pxi":23642
 *         change it in all rectwindows.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function plotpointsize is obsolete (2007-05-11)', DeprecationWarning)
 *         size = objtogen(size)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23642, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23643
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function plotpointsize is obsolete (2007-05-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         size = objtogen(size)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23644
 *         from warnings import warn
 *         warn('the PARI/GP function plotpointsize is obsolete (2007-05-11)', DeprecationWarning)
 *         size = objtogen(size)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _size = (<Gen>size).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_size, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_size, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23645
 *         warn('the PARI/GP function plotpointsize is obsolete (2007-05-11)', DeprecationWarning)
 *         size = objtogen(size)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _size = (<Gen>size).g
 *         plotpointsize(w, _size)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 23645, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23646
 *         size = objtogen(size)
 *         sig_on()
 *         cdef GEN _size = (<Gen>size).g             # <<<<<<<<<<<<<<
 *         plotpointsize(w, _size)
 *         clear_stack()
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_size)->__pyx_base.g;
  __pyx_v__size = __pyx_t_4;

  /* "cypari/auto_instance.pxi":23647
 *         sig_on()
 *         cdef GEN _size = (<Gen>size).g
 *         plotpointsize(w, _size)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotpointsize(__pyx_v_w, __pyx_v__size);

  /* "cypari/auto_instance.pxi":23648
 *         cdef GEN _size = (<Gen>size).g
 *         plotpointsize(w, _size)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotpointtype(self, long w, long type):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23635
 *         clear_stack()
 * 
 *     def plotpointsize(self, long w, size):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete. It is currently a no-op.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotpointsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_size);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23650
 *         clear_stack()
 * 
 *     def plotpointtype(self, long w, long type):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete and currently a no-op.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1345plotpointtype(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1344plotpointtype[] = "\n        This function is obsolete and currently a no-op.\n        \n        change the type of points subsequently plotted in rectwindow :math:`w`.\n        :math:`type = -1` corresponds to a dot, larger values may correspond to\n        something else. :math:`w = -1` changes highlevel plotting.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1345plotpointtype(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  long __pyx_v_type;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotpointtype (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_type,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_w)) != 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_type)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotpointtype", 1, 2, 2, 1); __PYX_ERR(4, 23650, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotpointtype") < 0)) __PYX_ERR(4, 23650, __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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23650, __pyx_L3_error)
    __pyx_v_type = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_type == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23650, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotpointtype", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23650, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotpointtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1344plotpointtype(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_type);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1344plotpointtype(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, long __pyx_v_type) {
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("plotpointtype", 0);

  /* "cypari/auto_instance.pxi":23658
 *         something else. :math:`w = -1` changes highlevel plotting.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function plotpointtype is obsolete (2007-05-11)', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23658, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23659
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function plotpointtype is obsolete (2007-05-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         plotpointtype(w, type)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23660
 *         from warnings import warn
 *         warn('the PARI/GP function plotpointtype is obsolete (2007-05-11)', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         plotpointtype(w, type)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 23660, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23661
 *         warn('the PARI/GP function plotpointtype is obsolete (2007-05-11)', DeprecationWarning)
 *         sig_on()
 *         plotpointtype(w, type)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotpointtype(__pyx_v_w, __pyx_v_type);

  /* "cypari/auto_instance.pxi":23662
 *         sig_on()
 *         plotpointtype(w, type)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotrbox(self, long w, dx, dy, long filled=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23650
 *         clear_stack()
 * 
 *     def plotpointtype(self, long w, long type):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete and currently a no-op.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotpointtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23664
 *         clear_stack()
 * 
 *     def plotrbox(self, long w, dx, dy, long filled=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw in the rectwindow :math:`w` the outline of the rectangle which is such
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1347plotrbox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1346plotrbox[] = "\n        Draw in the rectwindow :math:`w` the outline of the rectangle which is such\n        that the points :math:`(x1,y1)` and :math:`(x1+dx,y1+dy)` are opposite corners, where\n        :math:`(x1,y1)` is the current position of the cursor. Only the part of the\n        rectangle which is in :math:`w` is drawn. The virtual cursor does :emphasis:`not` move.\n        If :math:`filled = 1`, fill the box.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1347plotrbox(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_dy = 0;
  long __pyx_v_filled;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotrbox (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_dx,&__pyx_n_s_dy,&__pyx_n_s_filled,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_w)) != 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_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrbox", 0, 3, 4, 1); __PYX_ERR(4, 23664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrbox", 0, 3, 4, 2); __PYX_ERR(4, 23664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filled);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotrbox") < 0)) __PYX_ERR(4, 23664, __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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23664, __pyx_L3_error)
    __pyx_v_dx = values[1];
    __pyx_v_dy = values[2];
    if (values[3]) {
      __pyx_v_filled = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_filled == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23664, __pyx_L3_error)
    } else {
      __pyx_v_filled = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotrbox", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23664, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1346plotrbox(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_dx, __pyx_v_dy, __pyx_v_filled);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1346plotrbox(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy, long __pyx_v_filled) {
  GEN __pyx_v__dx;
  GEN __pyx_v__dy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotrbox", 0);
  __Pyx_INCREF(__pyx_v_dx);
  __Pyx_INCREF(__pyx_v_dy);

  /* "cypari/auto_instance.pxi":23672
 *         If :math:`filled = 1`, fill the box.
 *         '''
 *         dx = objtogen(dx)             # <<<<<<<<<<<<<<
 *         dy = objtogen(dy)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dx, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dx, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23673
 *         '''
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dy, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dy, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23674
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23674, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23675
 *         dy = objtogen(dy)
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrbox(w, _dx, _dy, filled)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dx)->__pyx_base.g;
  __pyx_v__dx = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23676
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g             # <<<<<<<<<<<<<<
 *         plotrbox(w, _dx, _dy, filled)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dy)->__pyx_base.g;
  __pyx_v__dy = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23677
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrbox(w, _dx, _dy, filled)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotrbox(__pyx_v_w, __pyx_v__dx, __pyx_v__dy, __pyx_v_filled);

  /* "cypari/auto_instance.pxi":23678
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrbox(w, _dx, _dy, filled)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotrecthraw(self, long w, data, long flags=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23664
 *         clear_stack()
 * 
 *     def plotrbox(self, long w, dx, dy, long filled=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw in the rectwindow :math:`w` the outline of the rectangle which is such
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23680
 *         clear_stack()
 * 
 *     def plotrecthraw(self, long w, data, long flags=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Plot graph(s) for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1349plotrecthraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1348plotrecthraw[] = "\n        Plot graph(s) for\n        :emphasis:`data` in rectwindow :math:`w`. :math:`flag` has the same significance here as in\n        :literal:`ploth`, though recursive plot is no more significant.\n        \n        :emphasis:`data` is a vector of vectors, each corresponding to a list a coordinates.\n        If parametric plot is set, there must be an even number of vectors, each\n        successive pair corresponding to a curve. Otherwise, the first one contains\n        the :math:`x` coordinates, and the other ones contain the :math:`y`-coordinates\n        of curves to plot.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1349plotrecthraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_data = 0;
  long __pyx_v_flags;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotrecthraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_data,&__pyx_n_s_flags,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrecthraw", 0, 2, 3, 1); __PYX_ERR(4, 23680, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotrecthraw") < 0)) __PYX_ERR(4, 23680, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23680, __pyx_L3_error)
    __pyx_v_data = values[1];
    if (values[2]) {
      __pyx_v_flags = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flags == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23680, __pyx_L3_error)
    } else {
      __pyx_v_flags = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotrecthraw", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23680, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrecthraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1348plotrecthraw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_data, __pyx_v_flags);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1348plotrecthraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_data, long __pyx_v_flags) {
  GEN __pyx_v__data;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotrecthraw", 0);
  __Pyx_INCREF(__pyx_v_data);

  /* "cypari/auto_instance.pxi":23692
 *         of curves to plot.
 *         '''
 *         data = objtogen(data)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23693
 *         '''
 *         data = objtogen(data)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _ret = plotrecthraw(w, _data, flags)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23693, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23694
 *         data = objtogen(data)
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plotrecthraw(w, _data, flags)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_data)->__pyx_base.g;
  __pyx_v__data = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23695
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _ret = plotrecthraw(w, _data, flags)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plotrecthraw(__pyx_v_w, __pyx_v__data, __pyx_v_flags);

  /* "cypari/auto_instance.pxi":23696
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _ret = plotrecthraw(w, _data, flags)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plotrline(self, long w, dx, dy):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23680
 *         clear_stack()
 * 
 *     def plotrecthraw(self, long w, data, long flags=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Plot graph(s) for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrecthraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23698
 *         return new_gen(_ret)
 * 
 *     def plotrline(self, long w, dx, dy):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw in the rectwindow :math:`w` the part of the segment
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1351plotrline(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1350plotrline[] = "\n        Draw in the rectwindow :math:`w` the part of the segment\n        :math:`(x1,y1)-(x1+dx,y1+dy)` which is inside :math:`w`, where :math:`(x1,y1)` is the current\n        position of the virtual cursor, and move the virtual cursor to\n        :math:`(x1+dx,y1+dy)` (even if it is outside the window).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1351plotrline(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_dy = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotrline (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_dx,&__pyx_n_s_dy,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrline", 1, 3, 3, 1); __PYX_ERR(4, 23698, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrline", 1, 3, 3, 2); __PYX_ERR(4, 23698, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotrline") < 0)) __PYX_ERR(4, 23698, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23698, __pyx_L3_error)
    __pyx_v_dx = values[1];
    __pyx_v_dy = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotrline", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23698, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1350plotrline(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_dx, __pyx_v_dy);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1350plotrline(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy) {
  GEN __pyx_v__dx;
  GEN __pyx_v__dy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotrline", 0);
  __Pyx_INCREF(__pyx_v_dx);
  __Pyx_INCREF(__pyx_v_dy);

  /* "cypari/auto_instance.pxi":23705
 *         :math:`(x1+dx,y1+dy)` (even if it is outside the window).
 *         '''
 *         dx = objtogen(dx)             # <<<<<<<<<<<<<<
 *         dy = objtogen(dy)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dx, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dx, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23706
 *         '''
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dy, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dy, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23707
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23707, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23708
 *         dy = objtogen(dy)
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrline(w, _dx, _dy)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dx)->__pyx_base.g;
  __pyx_v__dx = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23709
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g             # <<<<<<<<<<<<<<
 *         plotrline(w, _dx, _dy)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dy)->__pyx_base.g;
  __pyx_v__dy = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23710
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrline(w, _dx, _dy)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotrline(__pyx_v_w, __pyx_v__dx, __pyx_v__dy);

  /* "cypari/auto_instance.pxi":23711
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrline(w, _dx, _dy)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotrmove(self, long w, dx, dy):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23698
 *         return new_gen(_ret)
 * 
 *     def plotrline(self, long w, dx, dy):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw in the rectwindow :math:`w` the part of the segment
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23713
 *         clear_stack()
 * 
 *     def plotrmove(self, long w, dx, dy):             # <<<<<<<<<<<<<<
 *         r'''
 *         Move the virtual cursor of the rectwindow :math:`w` to position
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1353plotrmove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1352plotrmove[] = "\n        Move the virtual cursor of the rectwindow :math:`w` to position\n        :math:`(x1+dx,y1+dy)`, where :math:`(x1,y1)` is the initial position of the cursor\n        (i.e.\302\240to position :math:`(dx,dy)` relative to the initial cursor).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1353plotrmove(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_dy = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotrmove (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_dx,&__pyx_n_s_dy,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrmove", 1, 3, 3, 1); __PYX_ERR(4, 23713, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrmove", 1, 3, 3, 2); __PYX_ERR(4, 23713, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotrmove") < 0)) __PYX_ERR(4, 23713, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23713, __pyx_L3_error)
    __pyx_v_dx = values[1];
    __pyx_v_dy = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotrmove", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23713, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrmove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1352plotrmove(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_dx, __pyx_v_dy);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1352plotrmove(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy) {
  GEN __pyx_v__dx;
  GEN __pyx_v__dy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotrmove", 0);
  __Pyx_INCREF(__pyx_v_dx);
  __Pyx_INCREF(__pyx_v_dy);

  /* "cypari/auto_instance.pxi":23719
 *         (i.e.to position :math:`(dx,dy)` relative to the initial cursor).
 *         '''
 *         dx = objtogen(dx)             # <<<<<<<<<<<<<<
 *         dy = objtogen(dy)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dx, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dx, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23720
 *         '''
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dy, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dy, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23721
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23721, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23722
 *         dy = objtogen(dy)
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrmove(w, _dx, _dy)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dx)->__pyx_base.g;
  __pyx_v__dx = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23723
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g             # <<<<<<<<<<<<<<
 *         plotrmove(w, _dx, _dy)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dy)->__pyx_base.g;
  __pyx_v__dy = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23724
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrmove(w, _dx, _dy)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotrmove(__pyx_v_w, __pyx_v__dx, __pyx_v__dy);

  /* "cypari/auto_instance.pxi":23725
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrmove(w, _dx, _dy)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotrpoint(self, long w, dx, dy):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23713
 *         clear_stack()
 * 
 *     def plotrmove(self, long w, dx, dy):             # <<<<<<<<<<<<<<
 *         r'''
 *         Move the virtual cursor of the rectwindow :math:`w` to position
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrmove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23727
 *         clear_stack()
 * 
 *     def plotrpoint(self, long w, dx, dy):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw the point :math:`(x1+dx,y1+dy)` on the rectwindow :math:`w` (if it is inside
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1355plotrpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1354plotrpoint[] = "\n        Draw the point :math:`(x1+dx,y1+dy)` on the rectwindow :math:`w` (if it is inside\n        :math:`w`), where :math:`(x1,y1)` is the current position of the cursor, and in any case\n        move the virtual cursor to position :math:`(x1+dx,y1+dy)`.\n        \n        If you draw few points in the rectwindow, they will be hard to see; in\n        this case, you can use filled boxes instead. Compare:\n        \n        ::\n        \n            ? plotinit(0, 100,100); plotrpoint(0, 50,50); plotrpoint(0, 10,10);\n            ? plotdraw(0)\n            \n            ? thickpoint(w,x,y)= plotmove(w,x-2,y-2); plotrbox(w,4,4,1);\n            ? plotinit(1, 100,100); thickpoint(1, 50,50); thickpoint(1, 60,60);\n            ? plotdraw(1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1355plotrpoint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_dx = 0;
  PyObject *__pyx_v_dy = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotrpoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_dx,&__pyx_n_s_dy,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_dx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrpoint", 1, 3, 3, 1); __PYX_ERR(4, 23727, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotrpoint", 1, 3, 3, 2); __PYX_ERR(4, 23727, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotrpoint") < 0)) __PYX_ERR(4, 23727, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23727, __pyx_L3_error)
    __pyx_v_dx = values[1];
    __pyx_v_dy = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotrpoint", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23727, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1354plotrpoint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_dx, __pyx_v_dy);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1354plotrpoint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_dx, PyObject *__pyx_v_dy) {
  GEN __pyx_v__dx;
  GEN __pyx_v__dy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotrpoint", 0);
  __Pyx_INCREF(__pyx_v_dx);
  __Pyx_INCREF(__pyx_v_dy);

  /* "cypari/auto_instance.pxi":23745
 *             ? plotdraw(1)
 *         '''
 *         dx = objtogen(dx)             # <<<<<<<<<<<<<<
 *         dy = objtogen(dy)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dx, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dx, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23746
 *         '''
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_dy, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_dy, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23747
 *         dx = objtogen(dx)
 *         dy = objtogen(dy)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23747, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23748
 *         dy = objtogen(dy)
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrpoint(w, _dx, _dy)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dx)->__pyx_base.g;
  __pyx_v__dx = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23749
 *         sig_on()
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g             # <<<<<<<<<<<<<<
 *         plotrpoint(w, _dx, _dy)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_dy)->__pyx_base.g;
  __pyx_v__dy = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23750
 *         cdef GEN _dx = (<Gen>dx).g
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrpoint(w, _dx, _dy)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotrpoint(__pyx_v_w, __pyx_v__dx, __pyx_v__dy);

  /* "cypari/auto_instance.pxi":23751
 *         cdef GEN _dy = (<Gen>dy).g
 *         plotrpoint(w, _dx, _dy)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotscale(self, long w, x1, x2, y1, y2):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23727
 *         clear_stack()
 * 
 *     def plotrpoint(self, long w, dx, dy):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw the point :math:`(x1+dx,y1+dy)` on the rectwindow :math:`w` (if it is inside
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotrpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_dx);
  __Pyx_XDECREF(__pyx_v_dy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23753
 *         clear_stack()
 * 
 *     def plotscale(self, long w, x1, x2, y1, y2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Scale the local coordinates of the rectwindow :math:`w` so that :math:`x` goes from
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1357plotscale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1356plotscale[] = "\n        Scale the local coordinates of the rectwindow :math:`w` so that :math:`x` goes from\n        :math:`x1` to :math:`x2` and :math:`y` goes from :math:`y1` to :math:`y2` (:math:`x2 < x1` and :math:`y2 < y1` being\n        allowed). Initially, after the initialization of the rectwindow :math:`w` using\n        the function :literal:`plotinit`, the default scaling is the graphic pixel count,\n        and in particular the :math:`y` axis is oriented downwards since the origin is at\n        the upper left. The function :literal:`plotscale` allows to change all these\n        defaults and should be used whenever functions are graphed.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1357plotscale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_x1 = 0;
  PyObject *__pyx_v_x2 = 0;
  PyObject *__pyx_v_y1 = 0;
  PyObject *__pyx_v_y2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotscale (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_y1,&__pyx_n_s_y2,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_x1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotscale", 1, 5, 5, 1); __PYX_ERR(4, 23753, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotscale", 1, 5, 5, 2); __PYX_ERR(4, 23753, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotscale", 1, 5, 5, 3); __PYX_ERR(4, 23753, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotscale", 1, 5, 5, 4); __PYX_ERR(4, 23753, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotscale") < 0)) __PYX_ERR(4, 23753, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23753, __pyx_L3_error)
    __pyx_v_x1 = values[1];
    __pyx_v_x2 = values[2];
    __pyx_v_y1 = values[3];
    __pyx_v_y2 = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotscale", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23753, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1356plotscale(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_x1, __pyx_v_x2, __pyx_v_y1, __pyx_v_y2);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1356plotscale(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x1, PyObject *__pyx_v_x2, PyObject *__pyx_v_y1, PyObject *__pyx_v_y2) {
  GEN __pyx_v__x1;
  GEN __pyx_v__x2;
  GEN __pyx_v__y1;
  GEN __pyx_v__y2;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotscale", 0);
  __Pyx_INCREF(__pyx_v_x1);
  __Pyx_INCREF(__pyx_v_x2);
  __Pyx_INCREF(__pyx_v_y1);
  __Pyx_INCREF(__pyx_v_y2);

  /* "cypari/auto_instance.pxi":23763
 *         defaults and should be used whenever functions are graphed.
 *         '''
 *         x1 = objtogen(x1)             # <<<<<<<<<<<<<<
 *         x2 = objtogen(x2)
 *         y1 = objtogen(y1)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23764
 *         '''
 *         x1 = objtogen(x1)
 *         x2 = objtogen(x2)             # <<<<<<<<<<<<<<
 *         y1 = objtogen(y1)
 *         y2 = objtogen(y2)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23765
 *         x1 = objtogen(x1)
 *         x2 = objtogen(x2)
 *         y1 = objtogen(y1)             # <<<<<<<<<<<<<<
 *         y2 = objtogen(y2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23766
 *         x2 = objtogen(x2)
 *         y1 = objtogen(y1)
 *         y2 = objtogen(y2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x1 = (<Gen>x1).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23767
 *         y1 = objtogen(y1)
 *         y2 = objtogen(y2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x1 = (<Gen>x1).g
 *         cdef GEN _x2 = (<Gen>x2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 23767, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23768
 *         y2 = objtogen(y2)
 *         sig_on()
 *         cdef GEN _x1 = (<Gen>x1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x2 = (<Gen>x2).g
 *         cdef GEN _y1 = (<Gen>y1).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x1)->__pyx_base.g;
  __pyx_v__x1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23769
 *         sig_on()
 *         cdef GEN _x1 = (<Gen>x1).g
 *         cdef GEN _x2 = (<Gen>x2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y1 = (<Gen>y1).g
 *         cdef GEN _y2 = (<Gen>y2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x2)->__pyx_base.g;
  __pyx_v__x2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23770
 *         cdef GEN _x1 = (<Gen>x1).g
 *         cdef GEN _x2 = (<Gen>x2).g
 *         cdef GEN _y1 = (<Gen>y1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y2 = (<Gen>y2).g
 *         plotscale(w, _x1, _x2, _y1, _y2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y1)->__pyx_base.g;
  __pyx_v__y1 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23771
 *         cdef GEN _x2 = (<Gen>x2).g
 *         cdef GEN _y1 = (<Gen>y1).g
 *         cdef GEN _y2 = (<Gen>y2).g             # <<<<<<<<<<<<<<
 *         plotscale(w, _x1, _x2, _y1, _y2)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y2)->__pyx_base.g;
  __pyx_v__y2 = __pyx_t_3;

  /* "cypari/auto_instance.pxi":23772
 *         cdef GEN _y1 = (<Gen>y1).g
 *         cdef GEN _y2 = (<Gen>y2).g
 *         plotscale(w, _x1, _x2, _y1, _y2)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotscale(__pyx_v_w, __pyx_v__x1, __pyx_v__x2, __pyx_v__y1, __pyx_v__y2);

  /* "cypari/auto_instance.pxi":23773
 *         cdef GEN _y2 = (<Gen>y2).g
 *         plotscale(w, _x1, _x2, _y1, _y2)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotstring(self, long w, x, long flags=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23753
 *         clear_stack()
 * 
 *     def plotscale(self, long w, x1, x2, y1, y2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Scale the local coordinates of the rectwindow :math:`w` so that :math:`x` goes from
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x1);
  __Pyx_XDECREF(__pyx_v_x2);
  __Pyx_XDECREF(__pyx_v_y1);
  __Pyx_XDECREF(__pyx_v_y2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23775
 *         clear_stack()
 * 
 *     def plotstring(self, long w, x, long flags=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw on the rectwindow :math:`w` the String :math:`x` (see ``strings`` (in the PARI manual)), at
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1359plotstring(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1358plotstring[] = "\n        Draw on the rectwindow :math:`w` the String :math:`x` (see ``strings`` (in the PARI manual)), at\n        the current position of the cursor.\n        \n        :emphasis:`flag` is used for justification: bits 1 and 2 regulate horizontal alignment:\n        left if 0, right if 2, center if 1. Bits 4 and 8 regulate vertical\n        alignment: bottom if 0, top if 8, v-center if 4. Can insert additional small\n        gap between point and string: horizontal if bit 16 is set, vertical if bit\n        32 is set (see the tutorial for an example).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1359plotstring(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_w;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flags;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotstring (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_x,&__pyx_n_s_flags,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plotstring", 0, 2, 3, 1); __PYX_ERR(4, 23775, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotstring") < 0)) __PYX_ERR(4, 23775, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_w = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_w == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23775, __pyx_L3_error)
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flags = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flags == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23775, __pyx_L3_error)
    } else {
      __pyx_v_flags = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotstring", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23775, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1358plotstring(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_w, __pyx_v_x, __pyx_v_flags);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1358plotstring(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_w, PyObject *__pyx_v_x, long __pyx_v_flags) {
  char *__pyx_v__x;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("plotstring", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23786
 *         32 is set (see the tutorial for an example).
 *         '''
 *         x = to_bytes(x)             # <<<<<<<<<<<<<<
 *         cdef char* _x = <bytes>x
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23787
 *         '''
 *         x = to_bytes(x)
 *         cdef char* _x = <bytes>x             # <<<<<<<<<<<<<<
 *         sig_on()
 *         plotstring(w, _x, flags)
 */
  if (unlikely(__pyx_v_x == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 23787, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_x); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 23787, __pyx_L1_error)
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_instance.pxi":23788
 *         x = to_bytes(x)
 *         cdef char* _x = <bytes>x
 *         sig_on()             # <<<<<<<<<<<<<<
 *         plotstring(w, _x, flags)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 23788, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23789
 *         cdef char* _x = <bytes>x
 *         sig_on()
 *         plotstring(w, _x, flags)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotstring(__pyx_v_w, __pyx_v__x, __pyx_v_flags);

  /* "cypari/auto_instance.pxi":23790
 *         sig_on()
 *         plotstring(w, _x, flags)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def polchebyshev(self, long n, long flag=1, a=None):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":23775
 *         clear_stack()
 * 
 *     def plotstring(self, long w, x, long flags=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw on the rectwindow :math:`w` the String :math:`x` (see ``strings`` (in the PARI manual)), at
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.plotstring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23792
 *         clear_stack()
 * 
 *     def polchebyshev(self, long n, long flag=1, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :math:`n-th`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1361polchebyshev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1360polchebyshev[] = "\n        Returns the :math:`n-th`\n        Chebyshev polynomial of the first kind :math:`T_n` (:math:`flag = 1`) or the second\n        kind :math:`U_n` (:math:`flag = 2`), evaluated at :math:`a` (:literal:`'x` by default). Both series of\n        polynomials satisfy the 3-term relation\n        \n        .. MATH::\n        \n            P_{n+1} = 2xP_n - P_{n-1},\n        \n        and are determined by the initial conditions :math:`U_0 = T_0 = 1`, :math:`T_1 = x`,\n        :math:`U_1 = 2x`. In fact :math:`T_n' = n U_{n-1}` and, for all complex numbers :math:`z`, we\n        have :math:`T_n(\\cos z) = \\cos (nz)` and :math:`U_{n-1}(\\cos z) = \\sin (nz)/\\sin z`.\n        If :math:`n >= 0`, then these polynomials have degree :math:`n`. For :math:`n < 0`,\n        :math:`T_n` is equal to :math:`T_{-n}` and :math:`U_n` is equal to :math:`-U_{-2-n}`.\n        In particular, :math:`U_{-1} = 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1361polchebyshev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_flag;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polchebyshev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_flag,&__pyx_n_s_a,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polchebyshev") < 0)) __PYX_ERR(4, 23792, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23792, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23792, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
    __pyx_v_a = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polchebyshev", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23792, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polchebyshev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1360polchebyshev(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_flag, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1360polchebyshev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_flag, PyObject *__pyx_v_a) {
  int __pyx_v__have_a;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polchebyshev", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":23810
 *         In particular, :math:`U_{-1} = 0`.
 *         '''
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_1 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_1;

  /* "cypari/auto_instance.pxi":23811
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23812
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":23811
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":23813
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 23813, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23814
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":23815
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polchebyshev_eval(n, flag, _a)
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":23816
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polchebyshev_eval(n, flag, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_instance.pxi":23815
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polchebyshev_eval(n, flag, _a)
 */
  }

  /* "cypari/auto_instance.pxi":23817
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polchebyshev_eval(n, flag, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polchebyshev_eval(__pyx_v_n, __pyx_v_flag, __pyx_v__a);

  /* "cypari/auto_instance.pxi":23818
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polchebyshev_eval(n, flag, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polclass(self, D, long inv=0, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23792
 *         clear_stack()
 * 
 *     def polchebyshev(self, long n, long flag=1, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :math:`n-th`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polchebyshev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23820
 *         return new_gen(_ret)
 * 
 *     def polclass(self, D, long inv=0, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a polynomial in :math:`\mathbb{Z}[x]` generating the Hilbert class field for the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1363polclass(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1362polclass[] = "\n        Return a polynomial in :math:`\\mathbb{Z}[x]` generating the Hilbert class field for the\n        imaginary quadratic discriminant :math:`D`. If :math:`inv` is 0 (the default),\n        use the modular :math:`j`-function and return the classical Hilbert polynomial,\n        otherwise use a class invariant. The following invariants correspond to\n        the different values of :math:`inv`, where :math:`f` denotes Weber's function\n        :literal:`weber`, and :math:`w_{p,q}` the double eta quotient given by\n        :math:`w_{p,q} = (\\eta (x/p) \\eta (x/q) )/(\\eta (x) \\eta (x/{pq}) )`\n        \n        The invariants :math:`w_{p,q}` are not allowed unless they satisfy the following\n        technical conditions ensuring they do generate the Hilbert class\n        field and not a strict subfield:\n        \n        - if :math:`p != q`, we need them both non-inert, prime to the conductor of\n          :math:`\\mathbb{Z}[\\sqrt{D}]`. Let :math:`P, Q` be prime ideals above :math:`p` and :math:`q`; if both are\n          unramified, we further require that :math:`P^{\302\261 1} Q^{\302\261 1}` be all distinct in\n          the class group of :math:`\\mathbb{Z}[\\sqrt{D}]`; if both are ramified, we require that :math:`PQ\n          != 1` in the class group.\n        \n        - if :math:`p = q`, we want it split and prime to the conductor and\n          the prime ideal above it must have order :math:`!= 1, 2, 4` in the class group.\n        \n        Invariants are allowed under the additional conditions on :math:`D`\n        listed below.\n        \n        - 0 : :math:`j`\n        \n        - 1 : :math:`f`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 2 : :math:`f^2`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 3 : :math:`f^3`, :math:`D = 1 mod 8`;\n        \n        - 4 : :math:`f^4`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 5 : :math:`\\gamma_2 = j^{1/3}`, :math:`D = 1,2 mod 3`;""\n        \n        - 6 : :math:`w_{2,3}`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 8 : :math:`f^8`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 9 : :math:`w_{3,3}`, :math:`D = 1 mod 2` and :math:`D = 1,2 mod 3`;\n        \n        - 10: :math:`w_{2,5}`, :math:`D != 60 mod 80` and :math:`D = 1,2 mod 3`;\n        \n        - 14: :math:`w_{2,7}`, :math:`D = 1 mod 8`;\n        \n        - 15: :math:`w_{3,5}`, :math:`D = 1,2 mod 3`;\n        \n        - 21: :math:`w_{3,7}`, :math:`D = 1 mod 2` and :math:`21` does not divide :math:`D`\n        \n        - 23: :math:`w_{2,3}^2`, :math:`D = 1,2 mod 3`;\n        \n        - 24: :math:`w_{2,5}^2`, :math:`D = 1,2 mod 3`;\n        \n        - 26: :math:`w_{2,13}`, :math:`D != 156 mod 208`;\n        \n        - 27: :math:`w_{2,7}^2`, :math:`D != 28 mod 112`;\n        \n        - 28: :math:`w_{3,3}^2`, :math:`D = 1,2 mod 3`;\n        \n        - 35: :math:`w_{5,7}`, :math:`D = 1,2 mod 3`;\n        \n        - 39: :math:`w_{3,13}`, :math:`D = 1 mod 2` and :math:`D = 1,2 mod 3`;\n        \n        The algorithm for computing the polynomial does not use the floating point\n        approach, which would evaluate a precise modular function in a precise\n        complex argument. Instead, it relies on a faster Chinese remainder based\n        approach modulo small primes, in which the class invariant is only defined\n        algebraically by the modular polynomial relating the modular function to :math:`j`.\n        So in fact, any of the several roots of the modular polynomial may actually\n        be the class invariant, and more precise assertions cannot be made.\n        \n        For instance, while :literal:`polclass(D)` returns the minimal polynomial of\n        :math:`j(\\tau)` with :math:`\\tau` (any) quadratic integer for the discriminant :math:`D`,\n        the polynomial returned by :literal:`polclass(D, 5)` can be the minimal polynomial\n        of any of :math:`\\gamma_2"" (\\tau)`, :math:`\\zeta_3 \\gamma_2 (\\tau)` or\n        :math:`\\zeta_3^2 \\gamma_2 (\\tau)`, the three roots of the modular polynomial\n        :math:`j = \\gamma_2^3`, in which :math:`j` has been specialised to :math:`j (\\tau)`.\n        \n        The modular polynomial is given by\n        :math:`j = ((f^{24}-16)^3 )/(f^{24})` for Weber's function :math:`f`.\n        \n        For the double eta quotients of level :math:`N = p q`, all functions are covered\n        such that the modular curve :math:`X_0^+ (N)`, the function field of which is\n        generated by the functions invariant under :math:`\\Gamma^0 (N)` and the\n        Fricke-Atkin-Lehner involution, is of genus :math:`0` with function field\n        generated by (a power of) the double eta quotient :math:`w`.\n        This ensures that the full Hilbert class field (and not a proper subfield)\n        is generated by class invariants from these double eta quotients.\n        Then the modular polynomial is of degree :math:`2` in :math:`j`, and\n        of degree :math:`\\psi (N) = (p+1)(q+1)` in :math:`w`.\n        \n        ::\n        \n            ? polclass(-163)\n            %1 = x + 262537412640768000\n            ? polclass(-51, , 'z)\n            %2 = z^2 + 5541101568*z + 6262062317568\n            ? polclass(-151,1)\n            x^7 - x^6 + x^5 + 3*x^3 - x^2 + 3*x + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1363polclass(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  long __pyx_v_inv;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polclass (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_inv,&__pyx_n_s_x,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inv);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polclass") < 0)) __PYX_ERR(4, 23820, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
    if (values[1]) {
      __pyx_v_inv = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_inv == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23820, __pyx_L3_error)
    } else {
      __pyx_v_inv = ((long)0);
    }
    __pyx_v_x = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polclass", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23820, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polclass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1362polclass(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_inv, __pyx_v_x);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1362polclass(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_inv, PyObject *__pyx_v_x) {
  long __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polclass", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":23923
 *             x^7 - x^6 + x^5 + 3*x^3 - x^2 + 3*x + 1
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         cdef long _x = -1
 *         if x is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23924
 *         '''
 *         D = objtogen(D)
 *         cdef long _x = -1             # <<<<<<<<<<<<<<
 *         if x is not None:
 *             _x = get_var(x)
 */
  __pyx_v__x = -1L;

  /* "cypari/auto_instance.pxi":23925
 *         D = objtogen(D)
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_x != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":23926
 *         cdef long _x = -1
 *         if x is not None:
 *             _x = get_var(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_x); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 23926, __pyx_L1_error)
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":23925
 *         D = objtogen(D)
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":23927
 *         if x is not None:
 *             _x = get_var(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = polclass(_D, inv, _x)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 23927, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23928
 *             _x = get_var(x)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polclass(_D, inv, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_6;

  /* "cypari/auto_instance.pxi":23929
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = polclass(_D, inv, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polclass(__pyx_v__D, __pyx_v_inv, __pyx_v__x);

  /* "cypari/auto_instance.pxi":23930
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = polclass(_D, inv, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcoef(self, x, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23820
 *         return new_gen(_ret)
 * 
 *     def polclass(self, D, long inv=0, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a polynomial in :math:`\mathbb{Z}[x]` generating the Hilbert class field for the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polclass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23932
 *         return new_gen(_ret)
 * 
 *     def polcoef(self, x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficient of degree :math:`n` of the polynomial :math:`x`, with respect to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1365polcoef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1364polcoef[] = "\n        Coefficient of degree :math:`n` of the polynomial :math:`x`, with respect to the\n        main variable if :math:`v` is omitted, with respect to :math:`v` otherwise. If :math:`n`\n        is greater than the degree, the result is zero.\n        \n        Naturally applies to scalars (polynomial of degree :math:`0`), as well as to\n        rational functions whose denominator is a monomial. It also applies to power\n        series: if :math:`n` is less than the valuation, the result is zero. If it is\n        greater than the largest significant degree, then an error message is issued.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1365polcoef(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcoef (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polcoef", 0, 2, 3, 1); __PYX_ERR(4, 23932, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polcoef") < 0)) __PYX_ERR(4, 23932, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23932, __pyx_L3_error)
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polcoef", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23932, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1364polcoef(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1364polcoef(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polcoef", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23943
 *         greater than the largest significant degree, then an error message is issued.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":23944
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":23945
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":23946
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 23946, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":23945
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":23947
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoef(_x, n, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 23947, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23948
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcoef(_x, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":23949
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoef(_x, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcoef(__pyx_v__x, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_instance.pxi":23950
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoef(_x, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcoeff(self, x, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23950, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23932
 *         return new_gen(_ret)
 * 
 *     def polcoef(self, x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficient of degree :math:`n` of the polynomial :math:`x`, with respect to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23952
 *         return new_gen(_ret)
 * 
 *     def polcoeff(self, x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for polcoef.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1367polcoeff(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1366polcoeff[] = "\n        Deprecated alias for polcoef.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1367polcoeff(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcoeff (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polcoeff", 0, 2, 3, 1); __PYX_ERR(4, 23952, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polcoeff") < 0)) __PYX_ERR(4, 23952, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23952, __pyx_L3_error)
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polcoeff", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23952, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcoeff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1366polcoeff(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1366polcoeff(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v) {
  PyObject *__pyx_v_warn = NULL;
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  GEN __pyx_t_7;
  __Pyx_RefNannySetupContext("polcoeff", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":23956
 *         Deprecated alias for polcoef.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23956, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23957
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef long _v = -1
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23958
 *         from warnings import warn
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":23959
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":23960
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_v != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":23961
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_5 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_5 == ((long)-2L))) __PYX_ERR(4, 23961, __pyx_L1_error)
    __pyx_v__v = __pyx_t_5;

    /* "cypari/auto_instance.pxi":23960
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":23962
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoeff0(_x, n, _v)
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(4, 23962, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":23963
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcoeff0(_x, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_7 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_7;

  /* "cypari/auto_instance.pxi":23964
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoeff0(_x, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcoeff0(__pyx_v__x, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_instance.pxi":23965
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoeff0(_x, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcompositum(self, P, Q, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 23965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23952
 *         return new_gen(_ret)
 * 
 *     def polcoeff(self, x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for polcoef.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcoeff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":23967
 *         return new_gen(_ret)
 * 
 *     def polcompositum(self, P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`P` and :math:`Q`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1369polcompositum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1368polcompositum[] = "\n        :math:`P` and :math:`Q`\n        being squarefree polynomials in :math:`\\mathbb{Z}[X]` in the same variable, outputs\n        the simple factors of the \303\251tale :math:`\\mathbb{Q}`-algebra :math:`A = \\mathbb{Q} (X, Y) / (P(X), Q(Y))`.\n        The factors are given by a list of polynomials :math:`R` in :math:`\\mathbb{Z}[X]`, attached to\n        the number field :math:`\\mathbb{Q} (X)/ (R)`, and sorted by increasing degree (with respect\n        to lexicographic ordering for factors of equal degrees). Returns an error if\n        one of the polynomials is not squarefree.\n        \n        Note that it is more efficient to reduce to the case where :math:`P` and :math:`Q` are\n        irreducible first. The routine will not perform this for you, since it may be\n        expensive, and the inputs are irreducible in most applications anyway. In\n        this case, there will be a single factor :math:`R` if and only if the number\n        fields defined by :math:`P` and :math:`Q` are linearly disjoint (their intersection is\n        :math:`\\mathbb{Q}`).\n        \n        Assuming :math:`P` is irreducible (of smaller degree than :math:`Q` for efficiency), it\n        is in general much faster to proceed as follows\n        \n        ::\n        \n            nf = nfinit(P); L = nffactor(nf, Q)[,1];\n            vector(#L, i, rnfequation(nf, L[i]))\n        \n        to obtain the same result. If you are only interested in the degrees of the\n        simple factors, the :literal:`rnfequation` instruction can be replaced by a\n        trivial :literal:`poldegree(P) * poldegree(L[i])`.\n        \n        The binary digits of :math:`flag` mean\n        \n        1: outputs a vector of 4-component vectors :math:`[R,a,b,k]`, where :math:`R`\n        ranges through the list of all possible compositums as above, and :math:`a`\n        (resp. :math:`b`) expresses the root of :math:`P` (resp. :math:`Q`) as an element of\n        :math:`\\mathbb{Q} (X)/(R)`. Fina""lly, :math:`k` is a small integer such that :math:`b + ka = X` modulo\n        :math:`R`.\n        \n        2: assume that :math:`P` and :math:`Q` define number fields which are linearly disjoint:\n        both polynomials are irreducible and the corresponding number fields\n        have no common subfield besides :math:`\\mathbb{Q}`. This allows to save a costly\n        factorization over :math:`\\mathbb{Q}`. In this case return the single simple factor\n        instead of a vector with one element.\n        \n        A compositum is often defined by a complicated polynomial, which it is\n        advisable to reduce before further work. Here is an example involving\n        the field :math:`\\mathbb{Q} (\\zeta_5, 5^{1/5})`:\n        \n        ::\n        \n            ? L = polcompositum(x^5 - 5, polcyclo(5), 1); \\\\ list of [R,a,b,k]\n            ? [R, a] = L[1]; \\\\ pick the single factor, extract R,a (ignore b,k)\n            ? R \\\\ defines the compositum\n            %3 = x^20 + 5*x^19 + 15*x^18 + 35*x^17 + 70*x^16 + 141*x^15 + 260*x^14\\\n            + 355*x^13 + 95*x^12 - 1460*x^11 - 3279*x^10 - 3660*x^9 - 2005*x^8 \\\n            + 705*x^7 + 9210*x^6 + 13506*x^5 + 7145*x^4 - 2740*x^3 + 1040*x^2 \\\n            - 320*x + 256\n            ? a^5 - 5 \\\\ a fifth root of 5\n            %4 = 0\n            ? [T, X] = polredbest(R, 1);\n            ? T \\\\ simpler defining polynomial for Q[x]/(R)\n            %6 = x^20 + 25*x^10 + 5\n            ? X \\\\  root of R in Q[y]/(T(y))\n            %7 = Mod(-1/11*x^15 - 1/11*x^14 + 1/22*x^10 - 47/22*x^5 - 29/11*x^4 + 7/22,\\\n            x^20 + 25*x^10 + 5)\n            ? a = subst(a.pol, 'x, X) \\\\ a in the new coordinates\n            %8 = Mod(1/11*x^14 + 29/11*x^4, x^20 + 25*x^10 + 5)\n            ? a^5 - 5\n            %9 = 0\n        \n        In the above example, :math:`x^5-5` and the :math:`5`-th cyclotomic\n        polynomial are irreducible over :math:`\\mathbb{Q}`; they have coprime degrees so\n      ""  define linearly disjoint extensions and we could have started by\n        \n        ::\n        \n            ? [R,a] = polcompositum(x^5 - 5, polcyclo(5), 3); \\\\ [R,a,b,k]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1369polcompositum(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcompositum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polcompositum", 0, 2, 3, 1); __PYX_ERR(4, 23967, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polcompositum") < 0)) __PYX_ERR(4, 23967, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_Q = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 23967, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polcompositum", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 23967, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1368polcompositum(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_P, __pyx_v_Q, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1368polcompositum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag) {
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polcompositum", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":24044
 *             ? [R,a] = polcompositum(x^5 - 5, polcyclo(5), 3); \\ [R,a,b,k]
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24045
 *         '''
 *         P = objtogen(P)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24046
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24046, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24047
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24048
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24049
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcompositum0(__pyx_v__P, __pyx_v__Q, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":24050
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcyclo(self, long n, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":23967
 *         return new_gen(_ret)
 * 
 *     def polcompositum(self, P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`P` and :math:`Q`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24052
 *         return new_gen(_ret)
 * 
 *     def polcyclo(self, long n, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th cyclotomic polynomial, evaluated at :math:`a` (:literal:`'x` by default). The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1371polcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1370polcyclo[] = "\n        :math:`n`-th cyclotomic polynomial, evaluated at :math:`a` (:literal:`'x` by default). The\n        integer :math:`n` must be positive.\n        \n        Algorithm used: reduce to the case where :math:`n` is squarefree; to compute the\n        cyclotomic polynomial, use :math:`\\Phi_{np}(x) = \\Phi_n(x^p)/\\Phi (x)`; to compute\n        it evaluated, use :math:`\\Phi_n(x) = \\prod_{d \\| n} (x^d-1)^{\\mu (n/d)}`. In the\n        evaluated case, the algorithm assumes that :math:`a^d - 1` is either :math:`0` or\n        invertible, for all :math:`d \\| n`. If this is not the case (the base ring has\n        zero divisors), use :literal:`subst(polcyclo(n),x,a)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1371polcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcyclo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_a,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polcyclo") < 0)) __PYX_ERR(4, 24052, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24052, __pyx_L3_error)
    __pyx_v_a = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polcyclo", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24052, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1370polcyclo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1370polcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_a) {
  int __pyx_v__have_a;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polcyclo", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":24064
 *         zero divisors), use :literal:`subst(polcyclo(n),x,a)`.
 *         '''
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_1 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_1;

  /* "cypari/auto_instance.pxi":24065
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":24066
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":24065
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24067
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 24067, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24068
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":24069
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polcyclo_eval(n, _a)
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":24070
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcyclo_eval(n, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24069
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polcyclo_eval(n, _a)
 */
  }

  /* "cypari/auto_instance.pxi":24071
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polcyclo_eval(n, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcyclo_eval(__pyx_v_n, __pyx_v__a);

  /* "cypari/auto_instance.pxi":24072
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polcyclo_eval(n, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcyclofactors(self, f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24052
 *         return new_gen(_ret)
 * 
 *     def polcyclo(self, long n, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th cyclotomic polynomial, evaluated at :math:`a` (:literal:`'x` by default). The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24074
 *         return new_gen(_ret)
 * 
 *     def polcyclofactors(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials, whose product is the product of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1373polcyclofactors(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1372polcyclofactors[] = "\n        Returns a vector of polynomials, whose product is the product of\n        distinct cyclotomic polynomials dividing :math:`f`.\n        \n        ::\n        \n            ? f = x^10+5*x^8-x^7+8*x^6-4*x^5+8*x^4-3*x^3+7*x^2+3;\n            ? v = polcyclofactors(f)\n            %2 = [x^2 + 1, x^2 + x + 1, x^4 - x^3 + x^2 - x + 1]\n            ? apply(poliscycloprod, v)\n            %3 = [1, 1, 1]\n            ? apply(poliscyclo, v)\n            %4 = [4, 3, 10]\n        \n        In general, the polynomials are products of cyclotomic\n        polynomials and not themselves irreducible:\n        \n        ::\n        \n            ? g = x^8+2*x^7+6*x^6+9*x^5+12*x^4+11*x^3+10*x^2+6*x+3;\n            ? polcyclofactors(g)\n            %2 = [x^6 + 2*x^5 + 3*x^4 + 3*x^3 + 3*x^2 + 2*x + 1]\n            ? factor(%[1])\n            %3 =\n            [ x^2 + x + 1 1]\n            \n            [x^4 + x^3 + x^2 + x + 1 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1373polcyclofactors(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcyclofactors (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1372polcyclofactors(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_f));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1372polcyclofactors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f) {
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polcyclofactors", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":24103
 *             [x^4 + x^3 + x^2 + x + 1 1]
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24104
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polcyclofactors(_f)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24104, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24105
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcyclofactors(_f)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24106
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polcyclofactors(_f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcyclofactors(__pyx_v__f);

  /* "cypari/auto_instance.pxi":24107
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polcyclofactors(_f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldegree(self, x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24074
 *         return new_gen(_ret)
 * 
 *     def polcyclofactors(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials, whose product is the product of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polcyclofactors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24109
 *         return new_gen(_ret)
 * 
 *     def poldegree(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Degree of the polynomial :math:`x` in the main variable if :math:`v` is omitted, in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1375poldegree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1374poldegree[] = "\n        Degree of the polynomial :math:`x` in the main variable if :math:`v` is omitted, in\n        the variable :math:`v` otherwise.\n        \n        The degree of :math:`0` is :literal:`-oo`. The degree of a non-zero scalar is :math:`0`.\n        Finally, when :math:`x` is a non-zero polynomial or rational function, returns the\n        ordinary degree of :math:`x`. Raise an error otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1375poldegree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldegree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poldegree") < 0)) __PYX_ERR(4, 24109, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poldegree", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24109, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poldegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1374poldegree(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1374poldegree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("poldegree", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":24118
 *         ordinary degree of :math:`x`. Raise an error otherwise.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24119
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":24120
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24121
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 24121, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24120
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24122
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gppoldegree(_x, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 24122, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24123
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gppoldegree(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24124
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gppoldegree(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gppoldegree(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":24125
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gppoldegree(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldisc(self, pol, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24109
 *         return new_gen(_ret)
 * 
 *     def poldegree(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Degree of the polynomial :math:`x` in the main variable if :math:`v` is omitted, in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poldegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24127
 *         return new_gen(_ret)
 * 
 *     def poldisc(self, pol, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1377poldisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1376poldisc[] = "\n        Discriminant of the polynomial\n        :emphasis:`pol` in the main variable if :math:`v` is omitted, in :math:`v` otherwise. Uses a\n        modular algorithm over :math:`\\mathbb{Z}` or :math:`\\mathbb{Q}`, and the subresultant algorithm\n        otherwise.\n        \n        ::\n        \n            ? T = x^4 + 2*x+1;\n            ? poldisc(T)\n            %2 = -176\n            ? poldisc(T^2)\n            %3 = 0\n        \n        For convenience, the function also applies to types :literal:`t_QUAD` and\n        :literal:`t_QFI`/:literal:`t_QFR`:\n        \n        ::\n        \n            ? z = 3*quadgen(8) + 4;\n            ? poldisc(z)\n            %2 = 8\n            ? q = Qfb(1,2,3);\n            ? poldisc(q)\n            %4 = -8\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1377poldisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldisc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poldisc") < 0)) __PYX_ERR(4, 24127, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poldisc", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24127, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poldisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1376poldisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_pol, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1376poldisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("poldisc", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":24154
 *             %4 = -8
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24155
 *         '''
 *         pol = objtogen(pol)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":24156
 *         pol = objtogen(pol)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24157
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 24157, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24156
 *         pol = objtogen(pol)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24158
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = poldisc0(_pol, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 24158, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24159
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = poldisc0(_pol, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24160
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = poldisc0(_pol, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = poldisc0(__pyx_v__pol, __pyx_v__v);

  /* "cypari/auto_instance.pxi":24161
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = poldisc0(_pol, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldiscfactors(self, T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24127
 *         return new_gen(_ret)
 * 
 *     def poldisc(self, pol, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poldisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24163
 *         return new_gen(_ret)
 * 
 *     def poldiscfactors(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with integer coefficients, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1379poldiscfactors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1378poldiscfactors[] = "\n        Given a polynomial :math:`T` with integer coefficients, return\n        :math:`[D, faD]` where :math:`D` is the discriminant of :math:`T` and\n        :emphasis:`faD` is a cheap partial factorization of :math:`\\|D\\|`: entries in its first\n        column are coprime and not perfect powers but need not be primes.\n        The factors are obtained by a combination of trial division, testing for\n        perfect powers, factorizations in coprimes, and computing Euclidean\n        remainder sequences for :math:`(T,T')` modulo composite factors :math:`d` of :math:`D`\n        (which is likely to produce :math:`0`-divisors in :math:`\\mathbb{Z}/d\\mathbb{Z}`).\n        If :emphasis:`flag` is :math:`1`, finish the factorization using :literal:`factorint`.\n        \n        ::\n        \n            ? T = x^3 - 6021021*x^2 + 12072210077769*x - 8092423140177664432;\n            ? [D,faD] = poldiscfactors(T); print(faD); D\n            [3, 3; 7, 2; 373, 2; 500009, 2; 24639061, 2]\n            %2 = -27937108625866859018515540967767467\n            \n            ? T = x^3 + 9*x^2 + 27*x - 125014250689643346789780229390526092263790263725;\n            ? [D,faD] = poldiscfactors(T); print(faD)\n            [2, 6; 3, 3; 125007125141751093502187, 4]\n            ? [D,faD] = poldiscfactors(T, 1); print(faD)\n            [2, 6; 3, 3; 500009, 12; 1000003, 4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1379poldiscfactors(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldiscfactors (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_flag,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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poldiscfactors") < 0)) __PYX_ERR(4, 24163, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24163, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poldiscfactors", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24163, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poldiscfactors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1378poldiscfactors(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1378poldiscfactors(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("poldiscfactors", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":24188
 *             [2, 6; 3, 3; 500009, 12; 1000003, 4]
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24189
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = poldiscfactors(_T, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24189, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24190
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = poldiscfactors(_T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24191
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = poldiscfactors(_T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = poldiscfactors(__pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":24192
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = poldiscfactors(_T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldiscreduced(self, f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24163
 *         return new_gen(_ret)
 * 
 *     def poldiscfactors(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with integer coefficients, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poldiscfactors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24194
 *         return new_gen(_ret)
 * 
 *     def poldiscreduced(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduced discriminant vector of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1381poldiscreduced(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1380poldiscreduced[] = "\n        Reduced discriminant vector of the\n        (integral, monic) polynomial :math:`f`. This is the vector of elementary divisors\n        of :math:`\\mathbb{Z}[\\alpha]/f'(\\alpha)\\mathbb{Z}[\\alpha]`, where :math:`\\alpha` is a root of the\n        polynomial :math:`f`. The components of the result are all positive, and their\n        product is equal to the absolute value of the discriminant of\302\240:math:`f`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1381poldiscreduced(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldiscreduced (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1380poldiscreduced(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_f));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1380poldiscreduced(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f) {
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("poldiscreduced", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":24202
 *         product is equal to the absolute value of the discriminant of:math:`f`.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24203
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = reduceddiscsmith(_f)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24203, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24204
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = reduceddiscsmith(_f)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24205
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = reduceddiscsmith(_f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = reduceddiscsmith(__pyx_v__f);

  /* "cypari/auto_instance.pxi":24206
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = reduceddiscsmith(_f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polgalois(self, T, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24194
 *         return new_gen(_ret)
 * 
 *     def poldiscreduced(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduced discriminant vector of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poldiscreduced", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24208
 *         return new_gen(_ret)
 * 
 *     def polgalois(self, T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Galois group of the non-constant
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1383polgalois(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1382polgalois[] = "\n        Galois group of the non-constant\n        polynomial :math:`T\\in\\mathbb{Q}[X]`. In the present version :strong:`2.11.3`, :math:`T` must be irreducible\n        and the degree :math:`d` of :math:`T` must be less than or equal to 7. If the\n        :literal:`galdata` package has been installed, degrees 8, 9, 10 and 11 are also\n        implemented. By definition, if :math:`K = \\mathbb{Q}[x]/(T)`, this computes the action of\n        the Galois group of the Galois closure of :math:`K` on the :math:`d` distinct roots of\n        :math:`T`, up to conjugacy (corresponding to different root orderings).\n        \n        The output is a 4-component vector :math:`[n,s,k,name]` with the\n        following meaning: :math:`n` is the cardinality of the group, :math:`s` is its signature\n        (:math:`s = 1` if the group is a subgroup of the alternating group :math:`A_d`, :math:`s = -1`\n        otherwise) and name is a character string containing name of the transitive\n        group according to the GAP 4 transitive groups library by Alexander Hulpke.\n        \n        :math:`k` is more arbitrary and the choice made up to version\302\2402.2.3 of PARI is rather\n        unfortunate: for :math:`d > 7`, :math:`k` is the numbering of the group among all\n        transitive subgroups of :math:`S_d`, as given in \"The transitive groups of degree up\n        to eleven\", G.\302\240Butler and J.\302\240McKay, :emphasis:`Communications in Algebra`, vol.\302\24011,\n        1983,\n        pp.\302\240863--911 (group :math:`k` is denoted :math:`T_k` there). And for :math:`d <= 7`, it was ad\n        hoc, so as to ensure that a given triple would denote a unique group.\n        Specifically, for polynomials of degree :math:`d <= 7`, the groups are coded as\n        follows, using standard notations\n        \n        In degree 1: :math:`S_1 = [1,1,1]`.\n        \n        In degree 2: :math:`S_2 = [2,-1,1]`.\n        \n        In degree 3: :math:`A_3 = C_3 = [3,1,1]`, :math:""`S_3 = [6,-1,1]`.\n        \n        In degree 4: :math:`C_4 = [4,-1,1]`, :math:`V_4 = [4,1,1]`, :math:`D_4 = [8,-1,1]`, :math:`A_4 = [12,1,1]`,\n        :math:`S_4 = [24,-1,1]`.\n        \n        In degree 5: :math:`C_5 = [5,1,1]`, :math:`D_5 = [10,1,1]`, :math:`M_{20} = [20,-1,1]`,\n        :math:`A_5 = [60,1,1]`, :math:`S_5 = [120,-1,1]`.\n        \n        In degree 6: :math:`C_6 = [6,-1,1]`, :math:`S_3 = [6,-1,2]`, :math:`D_6 = [12,-1,1]`, :math:`A_4 = [12,1,1]`,\n        :math:`G_{18} = [18,-1,1]`, :math:`S_4^ -= [24,-1,1]`, :math:`A_4 x C_2 = [24,-1,2]`,\n        :math:`S_4^ += [24,1,1]`, :math:`G_{36}^ -= [36,-1,1]`, :math:`G_{36}^ += [36,1,1]`,\n        :math:`S_4 x C_2 = [48,-1,1]`, :math:`A_5 = PSL_2(5) = [60,1,1]`, :math:`G_{72} = [72,-1,1]`,\n        :math:`S_5 = PGL_2(5) = [120,-1,1]`, :math:`A_6 = [360,1,1]`, :math:`S_6 = [720,-1,1]`.\n        \n        In degree 7: :math:`C_7 = [7,1,1]`, :math:`D_7 = [14,-1,1]`, :math:`M_{21} = [21,1,1]`,\n        :math:`M_{42} = [42,-1,1]`, :math:`PSL_2(7) = PSL_3(2) = [168,1,1]`, :math:`A_7 = [2520,1,1]`,\n        :math:`S_7 = [5040,-1,1]`.\n        \n        This is deprecated and obsolete, but for reasons of backward compatibility,\n        we cannot change this behavior yet. So you can use the default\n        :literal:`new_galois_format` to switch to a consistent naming scheme, namely :math:`k` is\n        always the standard numbering of the group among all transitive subgroups of\n        :math:`S_n`. If this default is in effect, the above groups will be coded as:\n        \n        In degree 1: :math:`S_1 = [1,1,1]`.\n        \n        In degree 2: :math:`S_2 = [2,-1,1]`.\n        \n        In degree 3: :math:`A_3 = C_3 = [3,1,1]`, :math:`S_3 = [6,-1,2]`.\n        \n        In degree 4: :math:`C_4 = [4,-1,1]`, :math:`V_4 = [4,1,2]`, :math:`D_4 = [8,-1,3]`, :math:`A_4 = [12,1,4]`,\n        :math:`S_4 = [24,-1,5]`.\n        \n        In degree 5: :math:`C_5 = [5,1,1]`, :math:`D_5 = [10,1,2]`, :math:`M_{20} ="" [20,-1,3]`,\n        :math:`A_5 = [60,1,4]`, :math:`S_5 = [120,-1,5]`.\n        \n        In degree 6: :math:`C_6 = [6,-1,1]`, :math:`S_3 = [6,-1,2]`, :math:`D_6 = [12,-1,3]`, :math:`A_4 = [12,1,4]`,\n        :math:`G_{18} = [18,-1,5]`, :math:`A_4 x C_2 = [24,-1,6]`, :math:`S_4^ += [24,1,7]`,\n        :math:`S_4^ -= [24,-1,8]`, :math:`G_{36}^ -= [36,-1,9]`, :math:`G_{36}^ += [36,1,10]`,\n        :math:`S_4 x C_2 = [48,-1,11]`, :math:`A_5 = PSL_2(5) = [60,1,12]`, :math:`G_{72} = [72,-1,13]`,\n        :math:`S_5 = PGL_2(5) = [120,-1,14]`, :math:`A_6 = [360,1,15]`, :math:`S_6 = [720,-1,16]`.\n        \n        In degree 7: :math:`C_7 = [7,1,1]`, :math:`D_7 = [14,-1,2]`, :math:`M_{21} = [21,1,3]`,\n        :math:`M_{42} = [42,-1,4]`, :math:`PSL_2(7) = PSL_3(2) = [168,1,5]`, :math:`A_7 = [2520,1,6]`,\n        :math:`S_7 = [5040,-1,7]`.\n        \n        :strong:`Warning.` The method used is that of resolvent polynomials and is\n        sensitive to the current precision. The precision is updated internally but,\n        in very rare cases, a wrong result may be returned if the initial precision\n        was not sufficient.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1383polgalois(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polgalois (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_precision,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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polgalois") < 0)) __PYX_ERR(4, 24208, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24208, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polgalois", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24208, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1382polgalois(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1382polgalois(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_precision) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polgalois", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":24289
 *         was not sufficient.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24290
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24290, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24291
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polgalois(_T, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24292
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polgalois(_T, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":24293
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polgalois(_T, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polgalois(__pyx_v__T, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":24294
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polgalois(_T, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polgraeffe(self, f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24208
 *         return new_gen(_ret)
 * 
 *     def polgalois(self, T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Galois group of the non-constant
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24296
 *         return new_gen(_ret)
 * 
 *     def polgraeffe(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Graeffe transform :math:`g` of :math:`f`, such that :math:`g(x^2) = f(x)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1385polgraeffe(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1384polgraeffe[] = "\n        Returns the Graeffe transform :math:`g` of :math:`f`, such that :math:`g(x^2) = f(x)\n        f(-x)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1385polgraeffe(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polgraeffe (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1384polgraeffe(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_f));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1384polgraeffe(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f) {
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polgraeffe", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":24301
 *         f(-x)`.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24302
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polgraeffe(_f)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24302, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24303
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polgraeffe(_f)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24304
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polgraeffe(_f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polgraeffe(__pyx_v__f);

  /* "cypari/auto_instance.pxi":24305
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polgraeffe(_f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polhensellift(self, A, B, p, long e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24296
 *         return new_gen(_ret)
 * 
 *     def polgraeffe(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Graeffe transform :math:`g` of :math:`f`, such that :math:`g(x^2) = f(x)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polgraeffe", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24307
 *         return new_gen(_ret)
 * 
 *     def polhensellift(self, A, B, p, long e):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime :math:`p`, an integral polynomial :math:`A` whose leading coefficient
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1387polhensellift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1386polhensellift[] = "\n        Given a prime :math:`p`, an integral polynomial :math:`A` whose leading coefficient\n        is a :math:`p`-unit, a vector :math:`B` of integral polynomials that are monic and\n        pairwise relatively prime modulo :math:`p`, and whose product is congruent to\n        :math:`A/lc(A)` modulo :math:`p`, lift the elements of :math:`B` to polynomials whose\n        product is congruent to :math:`A` modulo :math:`p^e`.\n        \n        More generally, if :math:`T` is an integral polynomial irreducible mod :math:`p`, and\n        :math:`B` is a factorization of :math:`A` over the finite field :math:`\\mathbb{F}_p[t]/(T)`, you can\n        lift it to :math:`\\mathbb{Z}_p[t]/(T, p^e)` by replacing the :math:`p` argument with :math:`[p,T]`:\n        \n        ::\n        \n            ? { T = t^3 - 2; p = 7; A = x^2 + t + 1;\n             B = [x + (3*t^2 + t + 1), x + (4*t^2 + 6*t + 6)];\n             r = polhensellift(A, B, [p, T], 6) }\n            %1 = [x + (20191*t^2 + 50604*t + 75783), x + (97458*t^2 + 67045*t + 41866)]\n            ? liftall( r[1] * r[2] * Mod(Mod(1,p^6),T) )\n            %2 = x^2 + (t + 1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1387polhensellift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_e;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polhensellift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_p,&__pyx_n_s_e,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_A)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polhensellift", 1, 4, 4, 1); __PYX_ERR(4, 24307, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polhensellift", 1, 4, 4, 2); __PYX_ERR(4, 24307, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polhensellift", 1, 4, 4, 3); __PYX_ERR(4, 24307, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polhensellift") < 0)) __PYX_ERR(4, 24307, __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_A = values[0];
    __pyx_v_B = values[1];
    __pyx_v_p = values[2];
    __pyx_v_e = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_e == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24307, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polhensellift", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24307, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polhensellift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1386polhensellift(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_p, __pyx_v_e);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1386polhensellift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_p, long __pyx_v_e) {
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polhensellift", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":24328
 *             %2 = x^2 + (t + 1)
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         p = objtogen(p)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24329
 *         '''
 *         A = objtogen(A)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24330
 *         A = objtogen(A)
 *         B = objtogen(B)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24331
 *         B = objtogen(B)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24331, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24332
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24333
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24334
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24335
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polhensellift(__pyx_v__A, __pyx_v__B, __pyx_v__p, __pyx_v_e);

  /* "cypari/auto_instance.pxi":24336
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polhermite(self, long n, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24307
 *         return new_gen(_ret)
 * 
 *     def polhensellift(self, A, B, p, long e):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime :math:`p`, an integral polynomial :math:`A` whose leading coefficient
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polhensellift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24338
 *         return new_gen(_ret)
 * 
 *     def polhermite(self, long n, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n-th` Hermite polynomial :math:`H_n` evaluated at :math:`a`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1389polhermite(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1388polhermite[] = "\n        :math:`n-th` Hermite polynomial :math:`H_n` evaluated at :math:`a`\n        (:literal:`'x` by default), i.e.\n        \n        .. MATH::\n        \n            H_n(x) = (-1)^n e^{x^2} (d^n)/(dx^n)e^{-x^2}.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1389polhermite(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polhermite (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_a,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polhermite") < 0)) __PYX_ERR(4, 24338, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24338, __pyx_L3_error)
    __pyx_v_a = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polhermite", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24338, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polhermite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1388polhermite(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1388polhermite(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_a) {
  int __pyx_v__have_a;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polhermite", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":24347
 *             H_n(x) = (-1)^n e^{x^2} (d^n)/(dx^n)e^{-x^2}.
 *         '''
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_1 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_1;

  /* "cypari/auto_instance.pxi":24348
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":24349
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":24348
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24350
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 24350, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24351
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":24352
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polhermite_eval(n, _a)
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":24353
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polhermite_eval(n, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24352
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polhermite_eval(n, _a)
 */
  }

  /* "cypari/auto_instance.pxi":24354
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polhermite_eval(n, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polhermite_eval(__pyx_v_n, __pyx_v__a);

  /* "cypari/auto_instance.pxi":24355
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polhermite_eval(n, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poliscyclo(self, f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24338
 *         return new_gen(_ret)
 * 
 *     def polhermite(self, long n, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n-th` Hermite polynomial :math:`H_n` evaluated at :math:`a`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polhermite", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24357
 *         return new_gen(_ret)
 * 
 *     def poliscyclo(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 0 if :math:`f` is not a cyclotomic polynomial, and :math:`n > 0` if :math:`f =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1391poliscyclo(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1390poliscyclo[] = "\n        Returns 0 if :math:`f` is not a cyclotomic polynomial, and :math:`n > 0` if :math:`f =\n        \\Phi_n`, the :math:`n`-th cyclotomic polynomial.\n        \n        ::\n        \n            ? poliscyclo(x^4-x^2+1)\n            %1 = 12\n            ? polcyclo(12)\n            %2 = x^4 - x^2 + 1\n            ? poliscyclo(x^4-x^2-1)\n            %3 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1391poliscyclo(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poliscyclo (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1390poliscyclo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_f));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1390poliscyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f) {
  GEN __pyx_v__f;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("poliscyclo", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":24371
 *             %3 = 0
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24372
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscyclo(_f)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24372, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24373
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = poliscyclo(_f)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24374
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscyclo(_f)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = poliscyclo(__pyx_v__f);

  /* "cypari/auto_instance.pxi":24375
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscyclo(_f)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":24376
 *         cdef long _ret = poliscyclo(_f)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def poliscycloprod(self, f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24357
 *         return new_gen(_ret)
 * 
 *     def poliscyclo(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 0 if :math:`f` is not a cyclotomic polynomial, and :math:`n > 0` if :math:`f =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poliscyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24378
 *         return _ret
 * 
 *     def poliscycloprod(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`f` is a product of cyclotomic polynomial, and :math:`0`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1393poliscycloprod(PyObject *__pyx_v_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1392poliscycloprod[] = "\n        Returns 1 if :math:`f` is a product of cyclotomic polynomial, and :math:`0`\n        otherwise.\n        \n        ::\n        \n            ? f = x^6+x^5-x^3+x+1;\n            ? poliscycloprod(f)\n            %2 = 1\n            ? factor(f)\n            %3 =\n            [ x^2 + x + 1 1]\n            \n            [x^4 - x^2 + 1 1]\n            ? [ poliscyclo(T) | T <- %[,1] ]\n            %4 = [3, 12]\n            ? polcyclo(3) * polcyclo(12)\n            %5 = x^6 + x^5 - x^3 + x + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1393poliscycloprod(PyObject *__pyx_v_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poliscycloprod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1392poliscycloprod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_f));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1392poliscycloprod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f) {
  GEN __pyx_v__f;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("poliscycloprod", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":24398
 *             %5 = x^6 + x^5 - x^3 + x + 1
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24399
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscycloprod(_f)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24399, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24400
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = poliscycloprod(_f)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24401
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscycloprod(_f)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = poliscycloprod(__pyx_v__f);

  /* "cypari/auto_instance.pxi":24402
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscycloprod(_f)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":24403
 *         cdef long _ret = poliscycloprod(_f)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def polisirreducible(self, pol):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24378
 *         return _ret
 * 
 *     def poliscycloprod(self, f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`f` is a product of cyclotomic polynomial, and :math:`0`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poliscycloprod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24405
 *         return _ret
 * 
 *     def polisirreducible(self, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a polynomial (univariate in the present version :strong:`2.11.3`),
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1395polisirreducible(PyObject *__pyx_v_self, PyObject *__pyx_v_pol); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1394polisirreducible[] = "\n        :emphasis:`pol` being a polynomial (univariate in the present version :strong:`2.11.3`),\n        returns 1 if :emphasis:`pol` is non-constant and irreducible, 0 otherwise.\n        Irreducibility is checked over the smallest base field over which :emphasis:`pol`\n        seems to be defined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1395polisirreducible(PyObject *__pyx_v_self, PyObject *__pyx_v_pol) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polisirreducible (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1394polisirreducible(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_pol));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1394polisirreducible(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol) {
  GEN __pyx_v__pol;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polisirreducible", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":24412
 *         seems to be defined.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24413
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef long _ret = isirreducible(_pol)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24413, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24414
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = isirreducible(_pol)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24415
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef long _ret = isirreducible(_pol)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isirreducible(__pyx_v__pol);

  /* "cypari/auto_instance.pxi":24416
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef long _ret = isirreducible(_pol)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":24417
 *         cdef long _ret = isirreducible(_pol)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def pollead(self, x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24405
 *         return _ret
 * 
 *     def polisirreducible(self, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a polynomial (univariate in the present version :strong:`2.11.3`),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polisirreducible", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24419
 *         return _ret
 * 
 *     def pollead(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Leading coefficient of the polynomial or power series :math:`x`. This is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1397pollead(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1396pollead[] = "\n        Leading coefficient of the polynomial or power series :math:`x`. This is\n        computed with respect to the main variable of :math:`x` if :math:`v` is omitted, with\n        respect to the variable :math:`v` otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1397pollead(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pollead (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pollead") < 0)) __PYX_ERR(4, 24419, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pollead", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24419, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.pollead", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1396pollead(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1396pollead(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("pollead", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":24425
 *         respect to the variable :math:`v` otherwise.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24426
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":24427
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24428
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 24428, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24427
 *         x = objtogen(x)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24429
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pollead(_x, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 24429, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24430
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pollead(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24431
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pollead(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pollead(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":24432
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pollead(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def pollegendre(self, long n, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24419
 *         return _ret
 * 
 *     def pollead(self, x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Leading coefficient of the polynomial or power series :math:`x`. This is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.pollead", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24434
 *         return new_gen(_ret)
 * 
 *     def pollegendre(self, long n, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n-th` Legendre polynomial evaluated at :math:`a` (:literal:`'x` by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1399pollegendre(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1398pollegendre[] = "\n        :math:`n-th` Legendre polynomial evaluated at :math:`a` (:literal:`'x` by\n        default).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1399pollegendre(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pollegendre (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_a,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pollegendre") < 0)) __PYX_ERR(4, 24434, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24434, __pyx_L3_error)
    __pyx_v_a = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pollegendre", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24434, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.pollegendre", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1398pollegendre(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1398pollegendre(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_a) {
  int __pyx_v__have_a;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("pollegendre", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":24439
 *         default).
 *         '''
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_1 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_1;

  /* "cypari/auto_instance.pxi":24440
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":24441
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":24440
 *         '''
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24442
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 24442, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24443
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":24444
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = pollegendre_eval(n, _a)
 */
  __pyx_t_1 = (__pyx_v__have_a != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":24445
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pollegendre_eval(n, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24444
 *         sig_on()
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = pollegendre_eval(n, _a)
 */
  }

  /* "cypari/auto_instance.pxi":24446
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = pollegendre_eval(n, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pollegendre_eval(__pyx_v_n, __pyx_v__a);

  /* "cypari/auto_instance.pxi":24447
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = pollegendre_eval(n, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polmodular(self, long L, long inv=0, x=None, y=None, long derivs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24434
 *         return new_gen(_ret)
 * 
 *     def pollegendre(self, long n, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n-th` Legendre polynomial evaluated at :math:`a` (:literal:`'x` by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.pollegendre", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24449
 *         return new_gen(_ret)
 * 
 *     def polmodular(self, long L, long inv=0, x=None, y=None, long derivs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the modular polynomial of prime level :math:`L` in variables :math:`x` and :math:`y`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1401polmodular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1400polmodular[] = "\n        Return the modular polynomial of prime level :math:`L` in variables :math:`x` and :math:`y`\n        for the modular function specified by :literal:`inv`. If :literal:`inv` is 0 (the\n        default), use the modular :math:`j` function, if :literal:`inv` is 1 use the\n        Weber-:math:`f` function, and if :literal:`inv` is 5 use :math:`\\gamma_2 =\n        \\sqrt[3]{j}`.\n        See :literal:`polclass` for the full list of invariants.\n        If :math:`x` is given as :literal:`Mod(j, p)` or an element :math:`j` of\n        a finite field (as a :literal:`t_FFELT`), then return the modular polynomial of\n        level :math:`L` evaluated at :math:`j`. If :math:`j` is from a finite field and\n        :literal:`derivs` is non-zero, then return a triple where the\n        last two elements are the first and second derivatives of the modular\n        polynomial evaluated at :math:`j`.\n        \n        ::\n        \n            ? polmodular(3)\n            %1 = x^4 + (-y^3 + 2232*y^2 - 1069956*y + 36864000)*x^3 + ...\n            ? polmodular(7, 1, , 'J)\n            %2 = x^8 - J^7*x^7 + 7*J^4*x^4 - 8*J*x + J^8\n            ? polmodular(7, 5, 7*ffgen(19)^0, 'j)\n            %3 = j^8 + 4*j^7 + 4*j^6 + 8*j^5 + j^4 + 12*j^2 + 18*j + 18\n            ? polmodular(7, 5, Mod(7,19), 'j)\n            %4 = Mod(1, 19)*j^8 + Mod(4, 19)*j^7 + Mod(4, 19)*j^6 + ...\n            \n            ? u = ffgen(5)^0; T = polmodular(3,0,,'j)*u;\n            ? polmodular(3, 0, u,'j,1)\n            %6 = [j^4 + 3*j^2 + 4*j + 1, 3*j^2 + 2*j + 4, 3*j^3 + 4*j^2 + 4*j + 2]\n            ? subst(T,x,u)\n            %7 = j^4 + 3*j^2 + 4*j + 1\n            ? subst(T',x,u)\n            %8 = 3*j^2 + 2*j + 4\n            ? subst(T'',x,u)\n            %9 = 3*j^3 + 4*j^2 + 4*j + 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1401polmodular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_L;
  long __pyx_v_inv;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  long __pyx_v_derivs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polmodular (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_inv,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_derivs,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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  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_L)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inv);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          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_y);
          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_derivs);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polmodular") < 0)) __PYX_ERR(4, 24449, __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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_L == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24449, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_inv = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_inv == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24449, __pyx_L3_error)
    } else {
      __pyx_v_inv = ((long)0);
    }
    __pyx_v_x = values[2];
    __pyx_v_y = values[3];
    if (values[4]) {
      __pyx_v_derivs = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_derivs == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24449, __pyx_L3_error)
    } else {
      __pyx_v_derivs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polmodular", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24449, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polmodular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1400polmodular(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_L, __pyx_v_inv, __pyx_v_x, __pyx_v_y, __pyx_v_derivs);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1400polmodular(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_L, long __pyx_v_inv, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_derivs) {
  int __pyx_v__have_x;
  long __pyx_v__y;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polmodular", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":24485
 *             %9 = 3*j^3 + 4*j^2 + 4*j + 2
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":24486
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         cdef long _y = -1
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":24487
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _y = -1
 *         if y is not None:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24487, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":24486
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         cdef long _y = -1
 */
  }

  /* "cypari/auto_instance.pxi":24488
 *         if _have_x:
 *             x = objtogen(x)
 *         cdef long _y = -1             # <<<<<<<<<<<<<<
 *         if y is not None:
 *             _y = get_var(y)
 */
  __pyx_v__y = -1L;

  /* "cypari/auto_instance.pxi":24489
 *             x = objtogen(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_y != Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24490
 *         cdef long _y = -1
 *         if y is not None:
 *             _y = get_var(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_y); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 24490, __pyx_L1_error)
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24489
 *             x = objtogen(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24491
 *         if y is not None:
 *             _y = get_var(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 24491, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24492
 *             _y = get_var(y)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":24493
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = polmodular(L, inv, _x, _y, derivs)
 */
  __pyx_t_3 = (__pyx_v__have_x != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24494
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polmodular(L, inv, _x, _y, derivs)
 *         return new_gen(_ret)
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_6;

    /* "cypari/auto_instance.pxi":24493
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = polmodular(L, inv, _x, _y, derivs)
 */
  }

  /* "cypari/auto_instance.pxi":24495
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = polmodular(L, inv, _x, _y, derivs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polmodular(__pyx_v_L, __pyx_v_inv, __pyx_v__x, __pyx_v__y, __pyx_v_derivs);

  /* "cypari/auto_instance.pxi":24496
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = polmodular(L, inv, _x, _y, derivs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrecip(self, pol):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24449
 *         return new_gen(_ret)
 * 
 *     def polmodular(self, long L, long inv=0, x=None, y=None, long derivs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the modular polynomial of prime level :math:`L` in variables :math:`x` and :math:`y`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polmodular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24498
 *         return new_gen(_ret)
 * 
 *     def polrecip(self, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reciprocal polynomial of :emphasis:`pol`, i.e.the coefficients are in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1403polrecip(PyObject *__pyx_v_self, PyObject *__pyx_v_pol); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1402polrecip[] = "\n        Reciprocal polynomial of :emphasis:`pol`, i.e.\302\240the coefficients are in\n        reverse order. :emphasis:`pol` must be a polynomial.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1403polrecip(PyObject *__pyx_v_self, PyObject *__pyx_v_pol) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrecip (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1402polrecip(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_pol));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1402polrecip(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol) {
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polrecip", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":24503
 *         reverse order. :emphasis:`pol` must be a polynomial.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24504
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = polrecip(_pol)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24504, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24505
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrecip(_pol)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24506
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = polrecip(_pol)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrecip(__pyx_v__pol);

  /* "cypari/auto_instance.pxi":24507
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = polrecip(_pol)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polred(self, T, long flag=0, _arg3=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24498
 *         return new_gen(_ret)
 * 
 *     def polrecip(self, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reciprocal polynomial of :emphasis:`pol`, i.e.the coefficients are in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrecip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24509
 *         return new_gen(_ret)
 * 
 *     def polred(self, T, long flag=0, _arg3=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is :emphasis:`deprecated`, use :literal:`polredbest` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1405polred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1404polred[] = "\n        This function is :emphasis:`deprecated`, use :literal:`polredbest` instead.\n        Finds polynomials with reasonably small coefficients defining subfields of\n        the number field defined by :math:`T`. One of the polynomials always defines :math:`\\mathbb{Q}`\n        (hence has degree :math:`1`), and another always defines the same number field\n        as :math:`T` if :math:`T` is irreducible.\n        \n        All :math:`T` accepted by :literal:`nfinit` are also allowed here;\n        in particular, the format :literal:`[T, listP]` is recommended, e.g. with\n        :math:`listP = 10^5` or a vector containing all ramified primes. Otherwise,\n        the maximal order of :math:`\\mathbb{Q}[x]/(T)` must be computed.\n        \n        The following binary digits of :math:`flag` are significant:\n        \n        1: Possibly use a suborder of the maximal order. The\n        primes dividing the index of the order chosen are larger than\n        :literal:`primelimit` or divide integers stored in the :literal:`addprimes` table.\n        This flag is :emphasis:`deprecated`, the :literal:`[T, listP]` format is more\n        flexible.\n        \n        2: gives also elements. The result is a two-column matrix, the first column\n        giving primitive elements defining these subfields, the second giving the\n        corresponding minimal polynomials.\n        \n        ::\n        \n            ? M = polred(x^4 + 8, 2)\n            %1 =\n            [ 1 x - 1]\n            \n            [ 1/2*x^2 + 1 x^2 - 2*x + 3]\n            \n            [-1/2*x^2 + 1 x^2 - 2*x + 3]\n            \n            [ 1/2*x^2 x^2 + 2]\n            \n            [ 1/4*x^3 x^4 + 2]\n            ? minpoly(Mod(M[2,1], x^4+8))\n            %2 = x^2 + 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1405polred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v__arg3 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_flag,&__pyx_n_s_arg3,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arg3);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polred") < 0)) __PYX_ERR(4, 24509, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24509, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v__arg3 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polred", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24509, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1404polred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_flag, __pyx_v__arg3);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1404polred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag, PyObject *__pyx_v__arg3) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have__arg3;
  GEN __pyx_v__T;
  GEN __pyx_v___arg3;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polred", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v__arg3);

  /* "cypari/auto_instance.pxi":24550
 *             %2 = x^2 + 2
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg3 is not None:
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24550, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24551
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         if _arg3 is not None:
 *             from warnings import warn
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24552
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg3 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 */
  __pyx_t_3 = (__pyx_v__arg3 != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":24553
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg3 is not None:
 *             from warnings import warn             # <<<<<<<<<<<<<<
 *             warn('argument 3 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 *         T = objtogen(T)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_warn);
    __Pyx_GIVEREF(__pyx_n_s_warn);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn);
    __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24553, __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_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24553, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_warn, __pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":24554
 *         if _arg3 is not None:
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24554, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":24552
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg3 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 */
  }

  /* "cypari/auto_instance.pxi":24555
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24556
 *             warn('argument 3 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 *         T = objtogen(T)
 *         cdef bint _have__arg3 = (_arg3 is not None)             # <<<<<<<<<<<<<<
 *         if _have__arg3:
 *             _arg3 = objtogen(_arg3)
 */
  __pyx_t_4 = (__pyx_v__arg3 != Py_None);
  __pyx_v__have__arg3 = __pyx_t_4;

  /* "cypari/auto_instance.pxi":24557
 *         T = objtogen(T)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             _arg3 = objtogen(_arg3)
 *         sig_on()
 */
  __pyx_t_4 = (__pyx_v__have__arg3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":24558
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:
 *             _arg3 = objtogen(_arg3)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v__arg3, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v__arg3, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":24557
 *         T = objtogen(T)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             _arg3 = objtogen(_arg3)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24559
 *         if _have__arg3:
 *             _arg3 = objtogen(_arg3)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg3 = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 24559, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24560
 *             _arg3 = objtogen(_arg3)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24561
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg3 = NULL             # <<<<<<<<<<<<<<
 *         if _have__arg3:
 *             __arg3 = (<Gen>_arg3).g
 */
  __pyx_v___arg3 = NULL;

  /* "cypari/auto_instance.pxi":24562
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             __arg3 = (<Gen>_arg3).g
 *         cdef GEN _ret = polred0(_T, flag, __arg3)
 */
  __pyx_t_4 = (__pyx_v__have__arg3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":24563
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:
 *             __arg3 = (<Gen>_arg3).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polred0(_T, flag, __arg3)
 *         return new_gen(_ret)
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v__arg3)->__pyx_base.g;
    __pyx_v___arg3 = __pyx_t_6;

    /* "cypari/auto_instance.pxi":24562
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             __arg3 = (<Gen>_arg3).g
 *         cdef GEN _ret = polred0(_T, flag, __arg3)
 */
  }

  /* "cypari/auto_instance.pxi":24564
 *         if _have__arg3:
 *             __arg3 = (<Gen>_arg3).g
 *         cdef GEN _ret = polred0(_T, flag, __arg3)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polred0(__pyx_v__T, __pyx_v_flag, __pyx_v___arg3);

  /* "cypari/auto_instance.pxi":24565
 *             __arg3 = (<Gen>_arg3).g
 *         cdef GEN _ret = polred0(_T, flag, __arg3)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polredabs(self, T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24509
 *         return new_gen(_ret)
 * 
 *     def polred(self, T, long flag=0, _arg3=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is :emphasis:`deprecated`, use :literal:`polredbest` instead.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v__arg3);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24567
 *         return new_gen(_ret)
 * 
 *     def polredabs(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a canonical defining polynomial :math:`P` for the number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1407polredabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1406polredabs[] = "\n        Returns a canonical defining polynomial :math:`P` for the number field\n        :math:`\\mathbb{Q}[X]/(T)` defined by :math:`T`, such that the sum of the squares of the modulus\n        of the roots (i.e.\302\240the :math:`T_2`-norm) is minimal. Different :math:`T` defining\n        isomorphic number fields will yield the same :math:`P`. All :math:`T` accepted by\n        :literal:`nfinit` are also allowed here, e.g. non-monic polynomials, or pairs\n        :literal:`[T, listP]` specifying that a non-maximal order may be used. For\n        convenience, any number field structure (:emphasis:`nf`, :emphasis:`bnf`,...) can also\n        be used instead of :math:`T`.\n        \n        ::\n        \n            ? polredabs(x^2 + 16)\n            %1 = x^2 + 1\n            ? K = bnfinit(x^2 + 16); polredabs(K)\n            %2 = x^2 + 1\n        \n        :strong:`Warning 1.` Using a :literal:`t_POL` :math:`T` requires computing\n        and fully factoring the discriminant :math:`d_K` of the maximal order which may be\n        very hard. You can use the format :literal:`[T, listP]`, where :literal:`listP`\n        encodes a list of known coprime divisors of :math:`\\mathrm{disc} (T)` (see :literal:`\077\077nfbasis`),\n        to help the routine, thereby replacing this part of the algorithm by a\n        polynomial time computation But this may only compute a suborder of the\n        maximal order, when the divisors are not squarefree or do not include all\n        primes dividing :math:`d_K`. The routine attempts to certify the result\n        independently of this order computation as per :literal:`nfcertify`: we try to\n        prove that the computed order is maximal. If the certification fails,\n        the routine then fully factors the integers returned by :literal:`nfcertify`.\n        You can use :literal:`polredbest` or :literal:`polredabs(,16)` to avoid this\n        factorization step; in both cases, the result is no longer canonical.\n        \n    ""    :strong:`Warning 2.` Apart from the factorization of the discriminant of\n        :math:`T`, this routine runs in polynomial time for a :emphasis:`fixed` degree.\n        But the complexity is exponential in the degree: this routine\n        may be exceedingly slow when the number field has many subfields, hence a\n        lot of elements of small :math:`T_2`-norm. If you do not need a canonical\n        polynomial, the function :literal:`polredbest` is in general much faster (it runs\n        in polynomial time), and tends to return polynomials with smaller\n        discriminants.\n        \n        The binary digits of :math:`flag` mean\n        \n        1: outputs a two-component row vector :math:`[P,a]`, where :math:`P` is the default\n        output and :literal:`Mod(a, P)` is a root of the original :math:`T`.\n        \n        4: gives :emphasis:`all` polynomials of minimal :math:`T_2` norm; of the two polynomials\n        :math:`P(x)` and :math:`\302\261 P(-x)`, only one is given.\n        \n        16: Possibly use a suborder of the maximal order, :emphasis:`without` attempting to\n        certify the result as in Warning 1: we always return a polynomial and never\n        :math:`0`. The result is a priori not canonical.\n        \n        ::\n        \n            ? T = x^16 - 136*x^14 + 6476*x^12 - 141912*x^10 + 1513334*x^8 \\\n             - 7453176*x^6 + 13950764*x^4 - 5596840*x^2 + 46225\n            ? T1 = polredabs(T); T2 = polredbest(T);\n            ? [ norml2(polroots(T1)), norml2(polroots(T2)) ]\n            %3 = [88.0000000, 120.000000]\n            ? [ sizedigit(poldisc(T1)), sizedigit(poldisc(T2)) ]\n            %4 = [75, 67]\n        \n        The precise definition of the output of :literal:`polredabs` is as follows.\n        \n        - Consider the finite list of characteristic polynomials of primitive\n          elements of\302\240:math:`K` that are in\302\240:math:`\\mathbb{Z}_K` and minimal for the\302\240:math:`T_2` norm;\n       ""   now remove from the list the polynomials whose discriminant do not have\n          minimal absolute value. Note that this condition is restricted to the\n          original list of polynomials with minimal :math:`T_2` norm and does not imply that\n          the defining polynomial for the field with smallest discriminant belongs to\n          the list !\n        \n        - To a polynomial :math:`P(x) = x^n +...+ a_n \\in \\mathbb{R}[x]` we attach\n          the sequence :math:`S(P)` given by :math:`\\|a_1\\|, a_1,..., \\|a_n\\|, a_n`.\n          Order the polynomials :math:`P` by the lexicographic order on the coefficient\n          vectors :math:`S(P)`. Then the output of :literal:`polredabs` is the smallest\n          polynomial in the above list for that order. In other words, the monic\n          polynomial which is lexicographically smallest with respect to the absolute\n          values of coefficients, favouring negative coefficients to break ties, i.e.\n          choosing :math:`x^3-2` rather than :math:`x^3+2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1407polredabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polredabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_flag,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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polredabs") < 0)) __PYX_ERR(4, 24567, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24567, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polredabs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24567, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1406polredabs(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1406polredabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polredabs", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":24649
 *           choosing :math:`x^3-2` rather than :math:`x^3+2`.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24650
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredabs0(_T, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24650, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24651
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polredabs0(_T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24652
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredabs0(_T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polredabs0(__pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":24653
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredabs0(_T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polredbest(self, T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24567
 *         return new_gen(_ret)
 * 
 *     def polredabs(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a canonical defining polynomial :math:`P` for the number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24655
 *         return new_gen(_ret)
 * 
 *     def polredbest(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds a polynomial with reasonably
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1409polredbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1408polredbest[] = "\n        Finds a polynomial with reasonably\n        small coefficients defining the same number field as :math:`T`.\n        All :math:`T` accepted by :literal:`nfinit` are also allowed here (e.g. non-monic\n        polynomials, :literal:`nf`, :literal:`bnf`, :literal:`[T,Z_K_basis]`). Contrary to\n        :literal:`polredabs`, this routine runs in polynomial time, but it offers no\n        guarantee as to the minimality of its result.\n        \n        This routine computes an LLL-reduced basis for an order in :math:`\\mathbb{Q}[X]/(T)`, then\n        examines small linear combinations of the basis vectors, computing their\n        characteristic polynomials. It returns the :emphasis:`separable` polynomial :math:`P` of\n        smallest discriminant, the one with lexicographically smallest\n        :literal:`abs(Vec(P))` in case of ties. This is a good candidate for subsequent\n        number field computations since it guarantees that the denominators of\n        algebraic integers, when expressed in the power basis, are reasonably small.\n        With no claim of minimality, though.\n        \n        It can happen that iterating this functions yields better and better\n        polynomials, until it stabilizes:\n        \n        ::\n        \n            ? \\p5\n            ? P = X^12+8*X^8-50*X^6+16*X^4-3069*X^2+625;\n            ? poldisc(P)*1.\n            %2 = 1.2622 E55\n            ? P = polredbest(P);\n            ? poldisc(P)*1.\n            %4 = 2.9012 E51\n            ? P = polredbest(P);\n            ? poldisc(P)*1.\n            %6 = 8.8704 E44\n        \n        In this example, the initial polynomial :math:`P` is the one\n        returned by :literal:`polredabs`, and the last one is stable.\n        \n        If :math:`flag = 1`: outputs a two-component row vector :math:`[P,a]`, where :math:`P` is the\n        default output and :literal:`Mod(a, P)` is a root of the original :math:`T`.\n        \n        ::\n        \n            ? [P,a] = polred""best(x^4 + 8, 1)\n            %1 = [x^4 + 2, Mod(x^3, x^4 + 2)]\n            ? charpoly(a)\n            %2 = x^4 + 8\n        \n        In particular, the map :math:`\\mathbb{Q}[x]/(T) \\to \\mathbb{Q}[x]/(P)`,\n        :math:`x:--->Mod(a,P)` defines an isomorphism of number fields, which can\n        be computed as\n        \n        ::\n        \n             subst(lift(Q), 'x, a)\n        \n        if :math:`Q` is a :literal:`t_POLMOD` modulo :math:`T`; :literal:`b = modreverse(a)`\n        returns a :literal:`t_POLMOD` giving the inverse of the above map (which should be\n        useless since :math:`\\mathbb{Q}[x]/(P)` is a priori a better representation for the number\n        field and its elements).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1409polredbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polredbest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_flag,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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polredbest") < 0)) __PYX_ERR(4, 24655, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24655, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polredbest", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24655, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1408polredbest(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1408polredbest(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polredbest", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":24715
 *         field and its elements).
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24716
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredbest(_T, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24716, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24717
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polredbest(_T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24718
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredbest(_T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polredbest(__pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":24719
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredbest(_T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polredord(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24655
 *         return new_gen(_ret)
 * 
 *     def polredbest(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds a polynomial with reasonably
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24721
 *         return new_gen(_ret)
 * 
 *     def polredord(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use polredbest.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1411polredord(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1410polredord[] = "\n        This function is obsolete, use polredbest.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1411polredord(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polredord (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1410polredord(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1410polredord(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polredord", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":24725
 *         This function is obsolete, use polredbest.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24725, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24726
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24727
 *         from warnings import warn
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24728
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polredord(_x)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 24728, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24729
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polredord(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":24730
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polredord(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polredord(__pyx_v__x);

  /* "cypari/auto_instance.pxi":24731
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polredord(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polresultant(self, x, y, v=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24721
 *         return new_gen(_ret)
 * 
 *     def polredord(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use polredbest.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polredord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24733
 *         return new_gen(_ret)
 * 
 *     def polresultant(self, x, y, v=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Resultant of the two
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1413polresultant(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1412polresultant[] = "\n        Resultant of the two\n        polynomials :math:`x` and :math:`y` with exact entries, with respect to the main\n        variables of :math:`x` and :math:`y` if :math:`v` is omitted, with respect to the variable :math:`v`\n        otherwise. The algorithm assumes the base ring is a domain. If you also need\n        the :math:`u` and :math:`v` such that :math:`x*u + y*v = Res(x,y)`, use the\n        :literal:`polresultantext` function.\n        \n        If :math:`flag = 0` (default), uses the algorithm best suited to the inputs,\n        either the subresultant algorithm (Lazard/Ducos variant, generic case),\n        a modular algorithm (inputs in :math:`\\mathbb{Q}[X]`) or Sylvester's matrix (inexact\n        inputs).\n        \n        If :math:`flag = 1`, uses the determinant of Sylvester's matrix instead; this should\n        always be slower than the default.\n        \n        If :math:`x` or :math:`y` are multivariate with a huge :emphasis:`polynomial` content, it\n        is advisable to remove it before calling this function. Compare:\n        \n        ::\n        \n            ? a = polcyclo(7) * ((t+1)/(t+2))^100;\n            ? b = polcyclo(11)* ((t+2)/(t+3))^100);\n            ? polresultant(a,b);\n            time = 3,833 ms.\n            ? ca = content(a); cb = content(b); \\\n             polresultant(a/ca,b/cb)*ca^poldegree(b)*cb*poldegree(a); \\\\ instantaneous\n        \n        The function only removes rational denominators and does\n        not compute automatically the content because it is generically small and\n        potentially :emphasis:`very` expensive (e.g. in multivariate contexts).\n        The choice is yours, depending on your application.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1413polresultant(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polresultant (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_v,&__pyx_n_s_flag,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polresultant", 0, 2, 4, 1); __PYX_ERR(4, 24733, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          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_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polresultant") < 0)) __PYX_ERR(4, 24733, __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);
        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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_v = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24733, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polresultant", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24733, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polresultant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1412polresultant(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_v, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1412polresultant(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v, long __pyx_v_flag) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polresultant", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":24767
 *         The choice is yours, depending on your application.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24768
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24768, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24769
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":24770
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24771
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 24771, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24770
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24772
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 24772, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24773
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24774
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24775
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polresultant0(__pyx_v__x, __pyx_v__y, __pyx_v__v, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":24776
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polresultantext(self, A, B, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24733
 *         return new_gen(_ret)
 * 
 *     def polresultant(self, x, y, v=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Resultant of the two
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polresultant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24778
 *         return new_gen(_ret)
 * 
 *     def polresultantext(self, A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds polynomials :math:`U` and :math:`V` such that :math:`A*U + B*V = R`, where :math:`R` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1415polresultantext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1414polresultantext[] = "\n        Finds polynomials :math:`U` and :math:`V` such that :math:`A*U + B*V = R`, where :math:`R` is\n        the resultant of :math:`U` and :math:`V` with respect to the main variables of :math:`A` and\n        :math:`B` if :math:`v` is omitted, and with respect to :math:`v` otherwise. Returns the row\n        vector :math:`[U,V,R]`. The algorithm used (subresultant) assumes that the base\n        ring is a domain.\n        \n        ::\n        \n            ? A = x*y; B = (x+y)^2;\n            ? [U,V,R] = polresultantext(A, B)\n            %2 = [-y*x - 2*y^2, y^2, y^4]\n            ? A*U + B*V\n            %3 = y^4\n            ? [U,V,R] = polresultantext(A, B, y)\n            %4 = [-2*x^2 - y*x, x^2, x^4]\n            ? A*U+B*V\n            %5 = x^4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1415polresultantext(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polresultantext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_A)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polresultantext", 0, 2, 3, 1); __PYX_ERR(4, 24778, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polresultantext") < 0)) __PYX_ERR(4, 24778, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_A = values[0];
    __pyx_v_B = values[1];
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polresultantext", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24778, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polresultantext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1414polresultantext(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_B, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1414polresultantext(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polresultantext", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":24798
 *             %5 = x^4
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24799
 *         '''
 *         A = objtogen(A)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24800
 *         A = objtogen(A)
 *         B = objtogen(B)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":24801
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24802
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 24802, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24801
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24803
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 24803, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24804
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24805
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_6;

  /* "cypari/auto_instance.pxi":24806
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polresultantext0(__pyx_v__A, __pyx_v__B, __pyx_v__v);

  /* "cypari/auto_instance.pxi":24807
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polroots(self, T, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24778
 *         return new_gen(_ret)
 * 
 *     def polresultantext(self, A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds polynomials :math:`U` and :math:`V` such that :math:`A*U + B*V = R`, where :math:`R` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polresultantext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24809
 *         return new_gen(_ret)
 * 
 *     def polroots(self, T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complex roots of the polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1417polroots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1416polroots[] = "\n        Complex roots of the polynomial\n        :math:`T`, given as a column vector where each root is repeated according to\n        its multiplicity. The precision is given as for transcendental functions: in\n        GP it is kept in the variable :literal:`realprecision` and is transparent to the\n        user, but it must be explicitly given as a second argument in library mode.\n        \n        The algorithm used is a modification of Sch\303\266nhage's\n        root-finding algorithm, due to and originally implemented by Gourdon.\n        It is guaranteed to converge; if furthermore :math:`T` has rational coefficients,\n        roots are guaranteed to the required relative accuracy.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1417polroots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polroots (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_precision,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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polroots") < 0)) __PYX_ERR(4, 24809, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24809, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polroots", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24809, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1416polroots(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1416polroots(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_precision) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polroots", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":24822
 *         roots are guaranteed to the required relative accuracy.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24823
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24823, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24824
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = roots(_T, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24825
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = roots(_T, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":24826
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = roots(_T, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = roots(__pyx_v__T, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":24827
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = roots(_T, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsbound(self, T, tau=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24809
 *         return new_gen(_ret)
 * 
 *     def polroots(self, T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complex roots of the polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24829
 *         return new_gen(_ret)
 * 
 *     def polrootsbound(self, T, tau=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a sharp upper bound :math:`B` for the modulus of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1419polrootsbound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1418polrootsbound[] = "\n        Return a sharp upper bound :math:`B` for the modulus of\n        the largest complex root of the polynomial :math:`T` with complex coefficients\n        with relative error :math:`\\tau`. More precisely, we have :math:`\\|z\\| <= B` for all roots\n        and there exist one root such that :math:`\\|z_0\\| >= B \\exp (-2\\tau)`. Much faster\n        than either polroots or polrootsreal.\n        \n        ::\n        \n            ? T=poltchebi(500);\n            ? vecmax(abs(polroots(T)))\n            time = 5,706 ms.\n            %2 = 0.99999506520185816611184481744870013191\n            ? vecmax(abs(polrootsreal(T)))\n            time = 1,972 ms.\n            %3 = 0.99999506520185816611184481744870013191\n            ? polrootsbound(T)\n            time = 217 ms.\n            %4 = 1.0098792554165905155\n            ? polrootsbound(T, log(2)/2) \\\\ allow a factor 2, much faster\n            time = 51 ms.\n            %5 = 1.4065759938190154354\n            ? polrootsbound(T, 1e-4)\n            time = 504 ms.\n            %6 = 1.0000920717983847741\n            ? polrootsbound(T, 1e-6)\n            time = 810 ms.\n            %7 = 0.9999960628901692905\n            ? polrootsbound(T, 1e-10)\n            time = 1,351 ms.\n            %8 = 0.9999950652993869760\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1419polrootsbound(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_tau = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsbound (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_tau,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tau);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsbound") < 0)) __PYX_ERR(4, 24829, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    __pyx_v_tau = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsbound", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24829, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsbound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1418polrootsbound(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_tau);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1418polrootsbound(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_tau) {
  int __pyx_v__have_tau;
  GEN __pyx_v__T;
  GEN __pyx_v__tau;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polrootsbound", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_tau);

  /* "cypari/auto_instance.pxi":24862
 *             %8 = 0.9999950652993869760
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have_tau = (tau is not None)
 *         if _have_tau:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24863
 *         '''
 *         T = objtogen(T)
 *         cdef bint _have_tau = (tau is not None)             # <<<<<<<<<<<<<<
 *         if _have_tau:
 *             tau = objtogen(tau)
 */
  __pyx_t_2 = (__pyx_v_tau != Py_None);
  __pyx_v__have_tau = __pyx_t_2;

  /* "cypari/auto_instance.pxi":24864
 *         T = objtogen(T)
 *         cdef bint _have_tau = (tau is not None)
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             tau = objtogen(tau)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_tau != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":24865
 *         cdef bint _have_tau = (tau is not None)
 *         if _have_tau:
 *             tau = objtogen(tau)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tau, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_tau, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":24864
 *         T = objtogen(T)
 *         cdef bint _have_tau = (tau is not None)
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             tau = objtogen(tau)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24866
 *         if _have_tau:
 *             tau = objtogen(tau)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 24866, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24867
 *             tau = objtogen(tau)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tau = NULL
 *         if _have_tau:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_instance.pxi":24868
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL             # <<<<<<<<<<<<<<
 *         if _have_tau:
 *             _tau = (<Gen>tau).g
 */
  __pyx_v__tau = NULL;

  /* "cypari/auto_instance.pxi":24869
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 */
  __pyx_t_2 = (__pyx_v__have_tau != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":24870
 *         cdef GEN _tau = NULL
 *         if _have_tau:
 *             _tau = (<Gen>tau).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tau)->__pyx_base.g;
    __pyx_v__tau = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24869
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 */
  }

  /* "cypari/auto_instance.pxi":24871
 *         if _have_tau:
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrootsbound(__pyx_v__T, __pyx_v__tau);

  /* "cypari/auto_instance.pxi":24872
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsff(self, x, p=None, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24829
 *         return new_gen(_ret)
 * 
 *     def polrootsbound(self, T, tau=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a sharp upper bound :math:`B` for the modulus of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsbound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_tau);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24874
 *         return new_gen(_ret)
 * 
 *     def polrootsff(self, x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1421polrootsff(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1420polrootsff[] = "\n        Obsolete, kept for backward compatibility: use factormod.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1421polrootsff(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsff (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,&__pyx_n_s_a,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsff") < 0)) __PYX_ERR(4, 24874, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_p = values[1];
    __pyx_v_a = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsff", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24874, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1420polrootsff(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p, __pyx_v_a);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1420polrootsff(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_p;
  int __pyx_v__have_a;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("polrootsff", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":24878
 *         Obsolete, kept for backward compatibility: use factormod.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24878, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24879
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24880
 *         from warnings import warn
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":24881
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_3 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24882
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24883
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24883, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":24882
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  }

  /* "cypari/auto_instance.pxi":24884
 *         if _have_p:
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_3 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24885
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24886
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":24885
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24887
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 24887, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24888
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_instance.pxi":24889
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_instance.pxi":24890
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24891
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_5;

    /* "cypari/auto_instance.pxi":24890
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  }

  /* "cypari/auto_instance.pxi":24892
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":24893
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":24894
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_5;

    /* "cypari/auto_instance.pxi":24893
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 */
  }

  /* "cypari/auto_instance.pxi":24895
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrootsff(__pyx_v__x, __pyx_v__p, __pyx_v__a);

  /* "cypari/auto_instance.pxi":24896
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsmod(self, f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 24896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24874
 *         return new_gen(_ret)
 * 
 *     def polrootsff(self, x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24898
 *         return new_gen(_ret)
 * 
 *     def polrootsmod(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of roots of the polynomial :math:`f` over the finite field defined
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1423polrootsmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1422polrootsmod[] = "\n        Vector of roots of the polynomial :math:`f` over the finite field defined\n        by the domain :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        Multiple roots are :emphasis:`not` repeated.\n        \n        ::\n        \n            ? polrootsmod(x^2-1,2)\n            %1 = [Mod(1, 2)]~\n            ? polrootsmod(x^2+1,3)\n            %2 = []~\n            ? polrootsmod(x^2+1, [3,y^2+1])\n            %3 = [Mod(Mod(1, 3)*y, Mod(1, 3)*y^2 + Mod(1, 3)),\n             Mod(Mod(2, 3)*y, Mod(1, 3)*y^2 + Mod(1, 3))]~\n            ? polrootsmod(x^2 + Mod(1,3))\n            %4 = []~\n            ? liftall( polrootsmod(x^2 + Mod(Mod(1,3),y^2+1)) )\n            %5 = [y, 2*y]~\n            ? t = ffgen(y^2+Mod(1,3)); polrootsmod(x^2 + t^0)\n            %6 = [y, 2*y]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1423polrootsmod(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_D,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsmod") < 0)) __PYX_ERR(4, 24898, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_D = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsmod", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24898, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1422polrootsmod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_D);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1422polrootsmod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polrootsmod", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":24931
 *             %6 = [y, 2*y]~
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24932
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_instance.pxi":24933
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":24934
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":24933
 *         f = objtogen(f)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":24935
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 24935, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24936
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":24937
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_instance.pxi":24938
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":24939
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrootsmod(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_instance.pxi":24938
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)
 */
  }

  /* "cypari/auto_instance.pxi":24940
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrootsmod(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_instance.pxi":24941
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootspadic(self, x, p, long r):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24898
 *         return new_gen(_ret)
 * 
 *     def polrootsmod(self, f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of roots of the polynomial :math:`f` over the finite field defined
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24943
 *         return new_gen(_ret)
 * 
 *     def polrootspadic(self, x, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol`, given to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1425polrootspadic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1424polrootspadic[] = "\n        Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol`, given to\n        :math:`p`-adic precision :math:`r`; the integer :math:`p` is assumed to be a prime.\n        Multiple roots are\n        :emphasis:`not` repeated. Note that this is not the same as the roots in\n        :math:`\\mathbb{Z}/p^r\\mathbb{Z}`, rather it gives approximations in :math:`\\mathbb{Z}/p^r\\mathbb{Z}` of the true roots\n        living in :math:`\\mathbb{Q}_p`.\n        \n        ::\n        \n            ? polrootspadic(x^3 - x^2 + 64, 2, 5)\n            %1 = [2^3 + O(2^5), 2^3 + 2^4 + O(2^5), 1 + O(2^5)]~\n        \n        If :emphasis:`pol` has inexact :literal:`t_PADIC` coefficients, this is not always\n        well-defined; in this case, the polynomial is first made integral by dividing\n        out the :math:`p`-adic content, then lifted\n        to :math:`\\mathbb{Z}` using :literal:`truncate` coefficientwise. Hence the roots given are\n        approximations of the roots of an exact polynomial which is :math:`p`-adically\n        close to the input. To avoid pitfalls, we advise to only factor polynomials\n        with exact rational coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1425polrootspadic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootspadic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,&__pyx_n_s_r,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polrootspadic", 1, 3, 3, 1); __PYX_ERR(4, 24943, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polrootspadic", 1, 3, 3, 2); __PYX_ERR(4, 24943, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootspadic") < 0)) __PYX_ERR(4, 24943, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_p = values[1];
    __pyx_v_r = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24943, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootspadic", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24943, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootspadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1424polrootspadic(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p, __pyx_v_r);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1424polrootspadic(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_r) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polrootspadic", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":24965
 *         with exact rational coefficients.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24966
 *         '''
 *         x = objtogen(x)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":24967
 *         x = objtogen(x)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 24967, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":24968
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = rootpadic(_x, _p, r)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24969
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rootpadic(_x, _p, r)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":24970
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = rootpadic(_x, _p, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rootpadic(__pyx_v__x, __pyx_v__p, __pyx_v_r);

  /* "cypari/auto_instance.pxi":24971
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = rootpadic(_x, _p, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsreal(self, T, ab=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 24971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24943
 *         return new_gen(_ret)
 * 
 *     def polrootspadic(self, x, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol`, given to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootspadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":24973
 *         return new_gen(_ret)
 * 
 *     def polrootsreal(self, T, ab=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real roots of the polynomial :math:`T` with real coefficients, multiple
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1427polrootsreal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1426polrootsreal[] = "\n        Real roots of the polynomial :math:`T` with real coefficients, multiple\n        roots being included according to their multiplicity. If the polynomial\n        does not have rational coefficients, it is first rescaled and rounded.\n        The roots are given to a relative accuracy of :literal:`realprecision`.\n        If argument :emphasis:`ab` is\n        present, it must be a vector :math:`[a,b]` with two components (of type\n        :literal:`t_INT`, :literal:`t_FRAC` or :literal:`t_INFINITY`) and we restrict to roots belonging\n        to that closed interval.\n        \n        ::\n        \n            ? \\p9\n            ? polrootsreal(x^2-2)\n            %1 = [-1.41421356, 1.41421356]~\n            ? polrootsreal(x^2-2, [1,+oo])\n            %2 = [1.41421356]~\n            ? polrootsreal(x^2-2, [2,3])\n            %3 = []~\n            ? polrootsreal((x-1)*(x-2), [2,3])\n            %4 = [2.00000000]~\n        \n        The algorithm used is a modification of Uspensky's method (relying on\n        Descartes's rule of sign), following Rouillier and Zimmerman's article\n        \"Efficient isolation of a polynomial real roots\"\n        (:literal:`http://hal.inria.fr/inria-00072518/`). Barring bugs, it is guaranteed\n        to converge and to give the roots to the required accuracy.\n        \n        :strong:`Remark.` If the polynomial :math:`T` is of the\n        form :math:`Q(x^h)` for some :math:`h >= 2` and :emphasis:`ab` is omitted, the routine will\n        apply the algorithm to :math:`Q` (restricting to non-negative roots when :math:`h` is\n        even), then take :math:`h`-th roots. On the other hand, if you want to specify\n        :emphasis:`ab`, you should apply the routine to :math:`Q` yourself and a suitable\n        interval :math:`[a',b']` using approximate :math:`h`-th roots adapted to your problem:\n        the function will not perform this change of variables if :emphasis:`ab` is present.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1427polrootsreal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_ab = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsreal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_ab,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ab);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsreal") < 0)) __PYX_ERR(4, 24973, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    __pyx_v_ab = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 24973, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsreal", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 24973, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1426polrootsreal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_ab, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1426polrootsreal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_ab, long __pyx_v_precision) {
  int __pyx_v__have_ab;
  GEN __pyx_v__T;
  GEN __pyx_v__ab;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polrootsreal", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_ab);

  /* "cypari/auto_instance.pxi":25010
 *         the function will not perform this change of variables if :emphasis:`ab` is present.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25011
 *         '''
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             ab = objtogen(ab)
 */
  __pyx_t_2 = (__pyx_v_ab != Py_None);
  __pyx_v__have_ab = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25012
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25013
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 *             ab = objtogen(ab)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ab, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ab, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25012
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25014
 *         if _have_ab:
 *             ab = objtogen(ab)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25014, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25015
 *             ab = objtogen(ab)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25016
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 */
  __pyx_v__ab = NULL;

  /* "cypari/auto_instance.pxi":25017
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25018
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 *             _ab = (<Gen>ab).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = realroots(_T, _ab, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ab)->__pyx_base.g;
    __pyx_v__ab = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25017
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":25019
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = realroots(_T, _ab, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":25020
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = realroots(_T, _ab, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = realroots(__pyx_v__T, __pyx_v__ab, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":25021
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = realroots(_T, _ab, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polsturm(self, T, ab=None, _arg3=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25021, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":24973
 *         return new_gen(_ret)
 * 
 *     def polrootsreal(self, T, ab=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real roots of the polynomial :math:`T` with real coefficients, multiple
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polrootsreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_ab);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25023
 *         return new_gen(_ret)
 * 
 *     def polsturm(self, T, ab=None, _arg3=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct real roots of the real polynomial :emphasis:`T`. If
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1429polsturm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1428polsturm[] = "\n        Number of distinct real roots of the real polynomial :emphasis:`T`. If\n        the argument :emphasis:`ab` is present, it must be a vector :math:`[a,b]` with\n        two real components (of type :literal:`t_INT`, :literal:`t_REAL`, :literal:`t_FRAC`\n        or :literal:`t_INFINITY`) and we count roots belonging to that closed interval.\n        \n        If possible, you should stick to exact inputs, that is avoid :literal:`t_REAL`\302\240s in\n        :math:`T` and the bounds :math:`a,b`: the result is then guaranteed and we use a fast\n        algorithm (Uspensky's method, relying on Descartes's rule of sign, see\n        :literal:`polrootsreal`). Otherwise, the polynomial is rescaled and rounded first\n        and the result may be wrong due to that initial error. If only :math:`a` or :math:`b` is\n        inexact, on the other hand, the interval is first thickened using rational\n        endpoints and the result remains guaranteed unless there exist a root\n        :emphasis:`very` close to a non-rational endpoint (which may be missed or unduly\n        included).\n        \n        ::\n        \n            ? T = (x-1)*(x-2)*(x-3);\n            ? polsturm(T)\n            %2 = 3\n            ? polsturm(T, [-oo,2])\n            %3 = 2\n            ? polsturm(T, [1/2,+oo])\n            %4 = 3\n            ? polsturm(T, [1, Pi]) \\\\ Pi inexact: not recommended !\n            %5 = 3\n            ? polsturm(T*1., [0, 4]) \\\\ T*1. inexact: not recommended !\n            %6 = 3\n            ? polsturm(T^2, [0, 4]) \\\\ not squarefree: roots are not repeated!\n            %7 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1429polsturm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_ab = 0;
  PyObject *__pyx_v__arg3 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsturm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_ab,&__pyx_n_s_arg3,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ab);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arg3);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polsturm") < 0)) __PYX_ERR(4, 25023, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    __pyx_v_ab = values[1];
    __pyx_v__arg3 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polsturm", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25023, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1428polsturm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_ab, __pyx_v__arg3);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1428polsturm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_ab, PyObject *__pyx_v__arg3) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_ab;
  int __pyx_v__have__arg3;
  GEN __pyx_v__T;
  GEN __pyx_v__ab;
  GEN __pyx_v___arg3;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polsturm", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_ab);
  __Pyx_INCREF(__pyx_v__arg3);

  /* "cypari/auto_instance.pxi":25056
 *             %7 = 3
 *         '''
 *         if _arg3 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 */
  __pyx_t_1 = (__pyx_v__arg3 != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25057
 *         '''
 *         if _arg3 is not None:
 *             from warnings import warn             # <<<<<<<<<<<<<<
 *             warn('argument 3 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 *         T = objtogen(T)
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 25057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_warn);
    __Pyx_GIVEREF(__pyx_n_s_warn);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_warn);
    __pyx_t_4 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 25057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 25057, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_warn = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/auto_instance.pxi":25058
 *         if _arg3 is not None:
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 25058, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/auto_instance.pxi":25056
 *             %7 = 3
 *         '''
 *         if _arg3 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 */
  }

  /* "cypari/auto_instance.pxi":25059
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 25059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "cypari/auto_instance.pxi":25060
 *             warn('argument 3 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             ab = objtogen(ab)
 */
  __pyx_t_2 = (__pyx_v_ab != Py_None);
  __pyx_v__have_ab = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25061
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25062
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 *             ab = objtogen(ab)             # <<<<<<<<<<<<<<
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ab, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 25062, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_ab, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cypari/auto_instance.pxi":25061
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 */
  }

  /* "cypari/auto_instance.pxi":25063
 *         if _have_ab:
 *             ab = objtogen(ab)
 *         cdef bint _have__arg3 = (_arg3 is not None)             # <<<<<<<<<<<<<<
 *         if _have__arg3:
 *             _arg3 = objtogen(_arg3)
 */
  __pyx_t_2 = (__pyx_v__arg3 != Py_None);
  __pyx_v__have__arg3 = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25064
 *             ab = objtogen(ab)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             _arg3 = objtogen(_arg3)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have__arg3 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25065
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:
 *             _arg3 = objtogen(_arg3)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v__arg3, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 25065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v__arg3, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cypari/auto_instance.pxi":25064
 *             ab = objtogen(ab)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             _arg3 = objtogen(_arg3)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25066
 *         if _have__arg3:
 *             _arg3 = objtogen(_arg3)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 25066, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25067
 *             _arg3 = objtogen(_arg3)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_6;

  /* "cypari/auto_instance.pxi":25068
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 */
  __pyx_v__ab = NULL;

  /* "cypari/auto_instance.pxi":25069
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg3 = NULL
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25070
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 *             _ab = (<Gen>ab).g             # <<<<<<<<<<<<<<
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ab)->__pyx_base.g;
    __pyx_v__ab = __pyx_t_6;

    /* "cypari/auto_instance.pxi":25069
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg3 = NULL
 */
  }

  /* "cypari/auto_instance.pxi":25071
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg3 = NULL             # <<<<<<<<<<<<<<
 *         if _have__arg3:
 *             __arg3 = (<Gen>_arg3).g
 */
  __pyx_v___arg3 = NULL;

  /* "cypari/auto_instance.pxi":25072
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             __arg3 = (<Gen>_arg3).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg3)
 */
  __pyx_t_2 = (__pyx_v__have__arg3 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25073
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:
 *             __arg3 = (<Gen>_arg3).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = sturmpart(_T, _ab, __arg3)
 *         clear_stack()
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v__arg3)->__pyx_base.g;
    __pyx_v___arg3 = __pyx_t_6;

    /* "cypari/auto_instance.pxi":25072
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg3 = NULL
 *         if _have__arg3:             # <<<<<<<<<<<<<<
 *             __arg3 = (<Gen>_arg3).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg3)
 */
  }

  /* "cypari/auto_instance.pxi":25074
 *         if _have__arg3:
 *             __arg3 = (<Gen>_arg3).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg3)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = sturmpart(__pyx_v__T, __pyx_v__ab, __pyx_v___arg3);

  /* "cypari/auto_instance.pxi":25075
 *             __arg3 = (<Gen>_arg3).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg3)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":25076
 *         cdef long _ret = sturmpart(_T, _ab, __arg3)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def polsubcyclo(self, long n, long d, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 25076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25023
 *         return new_gen(_ret)
 * 
 *     def polsturm(self, T, ab=None, _arg3=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct real roots of the real polynomial :emphasis:`T`. If
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_ab);
  __Pyx_XDECREF(__pyx_v__arg3);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25078
 *         return _ret
 * 
 *     def polsubcyclo(self, long n, long d, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives polynomials (in variable :math:`v`) defining the sub-Abelian extensions
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1431polsubcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1430polsubcyclo[] = "\n        Gives polynomials (in variable :math:`v`) defining the sub-Abelian extensions\n        of degree :math:`d` of the cyclotomic field :math:`\\mathbb{Q} (\\zeta_n)`, where :math:`d \\| \\phi (n)`.\n        \n        If there is exactly one such extension the output is a polynomial, else it is\n        a vector of polynomials, possibly empty. To get a vector in all cases,\n        use :literal:`concat([], polsubcyclo(n,d))`.\n        \n        The function :literal:`galoissubcyclo` allows to specify exactly which\n        sub-Abelian extension should be computed.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1431polsubcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_d;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsubcyclo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_d,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_n)) != 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_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polsubcyclo", 0, 2, 3, 1); __PYX_ERR(4, 25078, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polsubcyclo") < 0)) __PYX_ERR(4, 25078, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25078, __pyx_L3_error)
    __pyx_v_d = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25078, __pyx_L3_error)
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polsubcyclo", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25078, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1430polsubcyclo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_d, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1430polsubcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_d, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("polsubcyclo", 0);

  /* "cypari/auto_instance.pxi":25090
 *         sub-Abelian extension should be computed.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":25091
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25092
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = polsubcyclo(n, d, _v)
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(4, 25092, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_instance.pxi":25091
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25093
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polsubcyclo(n, d, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 25093, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25094
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _ret = polsubcyclo(n, d, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polsubcyclo(__pyx_v_n, __pyx_v_d, __pyx_v__v);

  /* "cypari/auto_instance.pxi":25095
 *         sig_on()
 *         cdef GEN _ret = polsubcyclo(n, d, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polsylvestermatrix(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 25095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25078
 *         return _ret
 * 
 *     def polsubcyclo(self, long n, long d, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives polynomials (in variable :math:`v`) defining the sub-Abelian extensions
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25097
 *         return new_gen(_ret)
 * 
 *     def polsylvestermatrix(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Forms the Sylvester matrix
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1433polsylvestermatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1432polsylvestermatrix[] = "\n        Forms the Sylvester matrix\n        corresponding to the two polynomials :math:`x` and :math:`y`, where the coefficients of\n        the polynomials are put in the columns of the matrix (which is the natural\n        direction for solving equations afterwards). The use of this matrix can be\n        essential when dealing with polynomials with inexact entries, since\n        polynomial Euclidean division doesn't make much sense in this case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1433polsylvestermatrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsylvestermatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polsylvestermatrix", 1, 2, 2, 1); __PYX_ERR(4, 25097, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polsylvestermatrix") < 0)) __PYX_ERR(4, 25097, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polsylvestermatrix", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25097, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsylvestermatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1432polsylvestermatrix(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1432polsylvestermatrix(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polsylvestermatrix", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":25106
 *         polynomial Euclidean division doesn't make much sense in this case.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25107
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25108
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25108, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25109
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = sylvestermatrix(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25110
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sylvestermatrix(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25111
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = sylvestermatrix(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sylvestermatrix(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":25112
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = sylvestermatrix(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polsym(self, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25097
 *         return new_gen(_ret)
 * 
 *     def polsylvestermatrix(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Forms the Sylvester matrix
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsylvestermatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25114
 *         return new_gen(_ret)
 * 
 *     def polsym(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the column vector of the symmetric powers of the roots of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1435polsym(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1434polsym[] = "\n        Creates the column vector of the symmetric powers of the roots of the\n        polynomial :math:`x` up to power :math:`n`, using Newton's formula.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1435polsym(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsym (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polsym", 1, 2, 2, 1); __PYX_ERR(4, 25114, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polsym") < 0)) __PYX_ERR(4, 25114, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25114, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polsym", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25114, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsym", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1434polsym(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1434polsym(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polsym", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25119
 *         polynomial :math:`x` up to power :math:`n`, using Newton's formula.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25120
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polsym(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25120, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25121
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polsym(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25122
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polsym(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polsym(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":25123
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polsym(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poltchebi(self, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25114
 *         return new_gen(_ret)
 * 
 *     def polsym(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the column vector of the symmetric powers of the roots of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polsym", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25125
 *         return new_gen(_ret)
 * 
 *     def poltchebi(self, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`polchebyshev`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1437poltchebi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1436poltchebi[] = "\n        Deprecated alias for :literal:`polchebyshev`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1437poltchebi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poltchebi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poltchebi") < 0)) __PYX_ERR(4, 25125, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25125, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poltchebi", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25125, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poltchebi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1436poltchebi(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_v);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1436poltchebi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_v) {
  PyObject *__pyx_v_warn = NULL;
  long __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("poltchebi", 0);

  /* "cypari/auto_instance.pxi":25129
 *         Deprecated alias for :literal:`polchebyshev`
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function poltchebi is obsolete (2013-04-03)', DeprecationWarning)
 *         cdef long _v = -1
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25129, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25130
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function poltchebi is obsolete (2013-04-03)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25131
 *         from warnings import warn
 *         warn('the PARI/GP function poltchebi is obsolete (2013-04-03)', DeprecationWarning)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":25132
 *         warn('the PARI/GP function poltchebi is obsolete (2013-04-03)', DeprecationWarning)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_v != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":25133
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = polchebyshev1(n, _v)
 */
    __pyx_t_5 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_5 == ((long)-2L))) __PYX_ERR(4, 25133, __pyx_L1_error)
    __pyx_v__v = __pyx_t_5;

    /* "cypari/auto_instance.pxi":25132
 *         warn('the PARI/GP function poltchebi is obsolete (2013-04-03)', DeprecationWarning)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25134
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polchebyshev1(n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(4, 25134, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25135
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _ret = polchebyshev1(n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polchebyshev1(__pyx_v_n, __pyx_v__v);

  /* "cypari/auto_instance.pxi":25136
 *         sig_on()
 *         cdef GEN _ret = polchebyshev1(n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poltschirnhaus(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25125
 *         return new_gen(_ret)
 * 
 *     def poltchebi(self, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`polchebyshev`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poltchebi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25138
 *         return new_gen(_ret)
 * 
 *     def poltschirnhaus(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Applies a random Tschirnhausen
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1439poltschirnhaus(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1438poltschirnhaus[] = "\n        Applies a random Tschirnhausen\n        transformation to the polynomial :math:`x`, which is assumed to be non-constant\n        and separable, so as to obtain a new equation for the \303\251tale algebra\n        defined by :math:`x`. This is for instance useful when computing resolvents,\n        hence is used by the :literal:`polgalois` function.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1439poltschirnhaus(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poltschirnhaus (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1438poltschirnhaus(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1438poltschirnhaus(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("poltschirnhaus", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25146
 *         hence is used by the :literal:`polgalois` function.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25147
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = tschirnhaus(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25147, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25148
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = tschirnhaus(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25149
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = tschirnhaus(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = tschirnhaus(__pyx_v__x);

  /* "cypari/auto_instance.pxi":25150
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = tschirnhaus(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polylog(self, long m, x, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25138
 *         return new_gen(_ret)
 * 
 *     def poltschirnhaus(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Applies a random Tschirnhausen
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.poltschirnhaus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25152
 *         return new_gen(_ret)
 * 
 *     def polylog(self, long m, x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         One of the different polylogarithms, depending on :emphasis:`flag`:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1441polylog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1440polylog[] = "\n        One of the different polylogarithms, depending on :emphasis:`flag`:\n        \n        If :math:`flag = 0` or is omitted: :math:`m-th` polylogarithm of :math:`x`, i.e.\302\240analytic\n        continuation of the power series :math:`Li_m(x) = \\sum_{n >= 1}x^n/n^m`\n        (:math:`x < 1`). Uses the functional equation linking the values at :math:`x` and :math:`1/x`\n        to restrict to the case :math:`\\|x\\| <= 1`, then the power series when\n        :math:`\\|x\\|^2 <= 1/2`, and the power series expansion in :math:`\\log (x)` otherwise.\n        \n        Using :math:`flag`, computes a modified :math:`m-th` polylogarithm of :math:`x`.\n        We use Zagier's notations; let :math:`\\Re_m` denote :math:`\\Re` or :math:`\\Im` depending\n        on whether :math:`m` is odd or even:\n        \n        If :math:`flag = 1`: compute :math:`~ D_m(x)`, defined for :math:`\\|x\\| <= 1` by\n        \n        .. MATH::\n        \n            \\Re_m(\\sum_{k = 0}^{m-1} ((-\\log\\|x\\|)^k)/(k!)Li_{m-k}(x)\n            +((-\\log\\|x\\|)^{m-1})/(m!)\\log\\|1-x\\|).\n        \n        If :math:`flag = 2`: compute :math:`D_m(x)`, defined for :math:`\\|x\\| <= 1` by\n        \n        .. MATH::\n        \n            \\Re_m(\\sum_{k = 0}^{m-1}((-\\log\\|x\\|)^k)/(k!)Li_{m-k}(x)\n            -(1)/(2)((-\\log\\|x\\|)^m)/(m!)).\n        \n        If :math:`flag = 3`: compute :math:`P_m(x)`, defined for :math:`\\|x\\| <= 1` by\n        \n        .. MATH::\n        \n            \\Re_m(\\sum_{k = 0}^{m-1}(2^kB_k)/(k!)(\\log\\|x\\|)^kLi_{m-k}(x)\n            -(2^{m-1}B_m)/(m!)(\\log\\|x\\|)^m).\n        \n        These three functions satisfy the functional equation\n        :math:`f_m(1/x) = (-1)^{m-1}f_m(x)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1441polylog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_m;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polylog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_x,&__pyx_n_s_flag,&__pyx_n_s_precision,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_m)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polylog", 0, 2, 4, 1); __PYX_ERR(4, 25152, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polylog") < 0)) __PYX_ERR(4, 25152, __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);
        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_m = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25152, __pyx_L3_error)
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25152, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25152, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polylog", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25152, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polylog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1440polylog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_m, __pyx_v_x, __pyx_v_flag, __pyx_v_precision);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1440polylog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_m, PyObject *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polylog", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25190
 *         :math:`f_m(1/x) = (-1)^{m-1}f_m(x)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25191
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25191, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25192
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polylog0(m, _x, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25193
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polylog0(m, _x, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":25194
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polylog0(m, _x, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polylog0(__pyx_v_m, __pyx_v__x, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":25195
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polylog0(m, _x, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polzagier(self, long n, long m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25152
 *         return new_gen(_ret)
 * 
 *     def polylog(self, long m, x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         One of the different polylogarithms, depending on :emphasis:`flag`:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polylog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25197
 *         return new_gen(_ret)
 * 
 *     def polzagier(self, long n, long m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates Zagier's polynomial :math:`P_n^{(m)}` used in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1443polzagier(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1442polzagier[] = "\n        Creates Zagier's polynomial :math:`P_n^{(m)}` used in\n        the functions :literal:`sumalt` and :literal:`sumpos` (with :math:`flag = 1`), see\n        \"Convergence acceleration of alternating series\", Cohen et al.,\n        :emphasis:`Experiment.\302\240Math.`, vol.\302\2409, 2000, pp.\302\2403--12.\n        \n        If :math:`m < 0` or :math:`m >= n`, :math:`P_n^{(m)} = 0`.\n        We have\n        :math:`P_n := P_n^{(0)}` is :math:`T_n(2x-1)`, where :math:`T_n` is the Legendre polynomial of\n        the second kind. For :math:`n > m > 0`, :math:`P_n^{(m)}` is the :math:`m`-th difference with\n        step :math:`2` of the sequence :math:`n^{m+1}P_n`; in this case, it satisfies\n        \n        .. MATH::\n        \n            2 P_n^{(m)}(sin^2 t) = (d^{m+1})/(dt^{m+1})(\\sin (2t)^m \\sin (2(n-m)t)).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1443polzagier(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polzagier (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_m,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_n)) != 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_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polzagier", 1, 2, 2, 1); __PYX_ERR(4, 25197, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polzagier") < 0)) __PYX_ERR(4, 25197, __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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25197, __pyx_L3_error)
    __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25197, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polzagier", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25197, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polzagier", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1442polzagier(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_m);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1442polzagier(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_m) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("polzagier", 0);

  /* "cypari/auto_instance.pxi":25214
 *             2 P_n^{(m)}(sin^2 t) = (d^{m+1})/(dt^{m+1})(\sin (2t)^m \sin (2(n-m)t)).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polzag(n, m)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 25214, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25215
 *         '''
 *         sig_on()
 *         cdef GEN _ret = polzag(n, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polzag(__pyx_v_n, __pyx_v_m);

  /* "cypari/auto_instance.pxi":25216
 *         sig_on()
 *         cdef GEN _ret = polzag(n, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def powers(self, x, long n, x0=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25197
 *         return new_gen(_ret)
 * 
 *     def polzagier(self, long n, long m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates Zagier's polynomial :math:`P_n^{(m)}` used in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.polzagier", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25218
 *         return new_gen(_ret)
 * 
 *     def powers(self, x, long n, x0=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         For non-negative :math:`n`, return the vector with :math:`n+1` components
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1445powers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1444powers[] = "\n        For non-negative :math:`n`, return the vector with :math:`n+1` components\n        :math:`[1,x,...,x^n]` if :literal:`x0` is omitted, and :math:`[x_0, x_0*x, ..., x_0*x^n]`\n        otherwise.\n        \n        ::\n        \n            ? powers(Mod(3,17), 4)\n            %1 = [Mod(1, 17), Mod(3, 17), Mod(9, 17), Mod(10, 17), Mod(13, 17)]\n            ? powers(Mat([1,2;3,4]), 3)\n            %2 = [[1, 0; 0, 1], [1, 2; 3, 4], [7, 10; 15, 22], [37, 54; 81, 118]]\n            ? powers(3, 5, 2)\n            %3 = [2, 6, 18, 54, 162, 486]\n        \n        When :math:`n < 0`, the function returns the empty vector :literal:`[]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1445powers(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_x0 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("powers (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,&__pyx_n_s_x0,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("powers", 0, 2, 3, 1); __PYX_ERR(4, 25218, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "powers") < 0)) __PYX_ERR(4, 25218, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25218, __pyx_L3_error)
    __pyx_v_x0 = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("powers", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25218, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.powers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1444powers(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n, __pyx_v_x0);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1444powers(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_x0) {
  int __pyx_v__have_x0;
  GEN __pyx_v__x;
  GEN __pyx_v__x0;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("powers", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_x0);

  /* "cypari/auto_instance.pxi":25235
 *         When :math:`n < 0`, the function returns the empty vector :literal:`[]`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_x0 = (x0 is not None)
 *         if _have_x0:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25236
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_x0 = (x0 is not None)             # <<<<<<<<<<<<<<
 *         if _have_x0:
 *             x0 = objtogen(x0)
 */
  __pyx_t_2 = (__pyx_v_x0 != Py_None);
  __pyx_v__have_x0 = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25237
 *         x = objtogen(x)
 *         cdef bint _have_x0 = (x0 is not None)
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             x0 = objtogen(x0)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_x0 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25238
 *         cdef bint _have_x0 = (x0 is not None)
 *         if _have_x0:
 *             x0 = objtogen(x0)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x0, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25237
 *         x = objtogen(x)
 *         cdef bint _have_x0 = (x0 is not None)
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             x0 = objtogen(x0)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25239
 *         if _have_x0:
 *             x0 = objtogen(x0)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25239, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25240
 *             x0 = objtogen(x0)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x0 = NULL
 *         if _have_x0:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25241
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL             # <<<<<<<<<<<<<<
 *         if _have_x0:
 *             _x0 = (<Gen>x0).g
 */
  __pyx_v__x0 = NULL;

  /* "cypari/auto_instance.pxi":25242
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 */
  __pyx_t_2 = (__pyx_v__have_x0 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25243
 *         cdef GEN _x0 = NULL
 *         if _have_x0:
 *             _x0 = (<Gen>x0).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x0)->__pyx_base.g;
    __pyx_v__x0 = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25242
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 */
  }

  /* "cypari/auto_instance.pxi":25244
 *         if _have_x0:
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpowers0(__pyx_v__x, __pyx_v_n, __pyx_v__x0);

  /* "cypari/auto_instance.pxi":25245
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def precision(self, x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25218
 *         return new_gen(_ret)
 * 
 *     def powers(self, x, long n, x0=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         For non-negative :math:`n`, return the vector with :math:`n+1` components
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.powers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25247
 *         return new_gen(_ret)
 * 
 *     def precision(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1447precision(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1446precision[] = "\n        The function behaves differently according to whether :math:`n` is\n        present and positive or not. If :math:`n` is missing, the function returns the\n        floating point precision in decimal digits of the PARI object :math:`x`. If :math:`x`\n        has no floating point component, the function returns :literal:`+oo`.\n        \n        ::\n        \n            ? precision(exp(1e-100))\n            %1 = 154 \\\\ 154 significant decimal digits\n            ? precision(2 + x)\n            %2 = +oo \\\\ exact object\n            ? precision(0.5 + O(x))\n            %3 = 38 \\\\ floating point accuracy, NOT series precision\n            ? precision( [ exp(1e-100), 0.5 ] )\n            %4 = 38 \\\\ minimal accuracy among components\n        \n        If :math:`n` is present, the function creates a new object equal to :math:`x` with a new\n        floating point precision :math:`n`: :math:`n` is the number of desired significant\n        :emphasis:`decimal` digits. If :math:`n` is smaller than the precision of a :literal:`t_REAL`\n        component of :math:`x`, it is truncated, otherwise it is extended with zeros.\n        For non-floating point types, no change.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1447precision(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("precision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "precision") < 0)) __PYX_ERR(4, 25247, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25247, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("precision", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25247, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1446precision(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1446precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("precision", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25271
 *         For non-floating point types, no change.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25272
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precision0(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25272, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25273
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = precision0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25274
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precision0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = precision0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":25275
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precision0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def precprime(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25247
 *         return new_gen(_ret)
 * 
 *     def precision(self, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25277
 *         return new_gen(_ret)
 * 
 *     def precprime(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the largest pseudoprime (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1449precprime(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1448precprime[] = "\n        Finds the largest pseudoprime (see\n        :literal:`ispseudoprime`) less than or equal to :math:`x`. :math:`x` can be of any real type.\n        Returns 0 if :math:`x <= 1`. Note that if :math:`x` is a prime, this function returns :math:`x`\n        and not the largest prime strictly smaller than :math:`x`. To rigorously prove that\n        the result is prime, use :literal:`isprime`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1449precprime(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("precprime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1448precprime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1448precprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("precprime", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25285
 *         the result is prime, use :literal:`isprime`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25286
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precprime(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25286, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25287
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = precprime(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25288
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precprime(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = precprime(__pyx_v__x);

  /* "cypari/auto_instance.pxi":25289
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precprime(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def prime(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25277
 *         return new_gen(_ret)
 * 
 *     def precprime(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the largest pseudoprime (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.precprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25291
 *         return new_gen(_ret)
 * 
 *     def prime(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         The :math:`n-th` prime number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1451prime(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1450prime[] = "\n        The :math:`n-th` prime number\n        \n        ::\n        \n            ? prime(10^9)\n            %1 = 22801763489\n        \n        Uses checkpointing and a naive :math:`O(n)` algorithm. Will need\n        about 30 minutes for :math:`n` up to :math:`10^{11}`; make sure to start gp with\n        :literal:`primelimit` at least :math:`\\sqrt{p_n}`, e.g. the value\n        :math:`\\sqrt{n\\log (n\\log n)}` is guaranteed to be sufficient.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1451prime(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prime (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25291, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.prime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1450prime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((long)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1450prime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("prime", 0);

  /* "cypari/auto_instance.pxi":25305
 *         :math:`\sqrt{n\log (n\log n)}` is guaranteed to be sufficient.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = prime(n)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 25305, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25306
 *         '''
 *         sig_on()
 *         cdef GEN _ret = prime(n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = prime(__pyx_v_n);

  /* "cypari/auto_instance.pxi":25307
 *         sig_on()
 *         cdef GEN _ret = prime(n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primecert(self, N, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25291
 *         return new_gen(_ret)
 * 
 *     def prime(self, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         The :math:`n-th` prime number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.prime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25309
 *         return new_gen(_ret)
 * 
 *     def primecert(self, N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If N is a prime, return a PARI Primality Certificate for the prime :math:`N`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1453primecert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1452primecert[] = "\n        If N is a prime, return a PARI Primality Certificate for the prime :math:`N`,\n        as described below. Otherwise, return 0. A Primality Certificate\n        :math:`c` can be checked using :literal:`primecertisvalid`:math:`(c)`.\n        \n        If :math:`flag = 0` (default), return an ECPP certificate (Atkin-Morain)\n        \n        A PARI ECPP Primality Certificate for the prime :math:`N` is either a prime\n        integer :math:`N < 2^{64}` or a vector :literal:`C` of length :math:`\\ell` whose :math:`i`th\n        component :literal:`C[i]` is a vector of length :math:`5` containing :math:`N_i`, :math:`t_i`,\n        :math:`s_i`, :math:`a_i`, :math:`P_i` (in that order) where :math:`N_1 = N`. It is said to be valid\n        if for each :math:`i = 1,..., \\ell`, all of the following conditions are\n        satisfied\n        \n        - :math:`N_i` is a positive integer\n        \n        - :math:`t_i` is an integer such that :math:`t_i < 4N_i^2`\n        \n        - :math:`s_i` is a positive integer which divides :math:`m_i` where\n          :math:`m_i = N_i + 1 - t_i`\n        \n        - If we set :math:`q_i = (m_i)/(s_i)`, then\n        \n        \302\240\302\240:strong:`*` :math:`q_i > (N_i^{1/4}+1)^2`\n        \n        \302\240\302\240:strong:`*` :math:`q_i = N_{i+1}` if :math:`1 <= i < l`\n        \n        \302\240\302\240:strong:`*` :math:`q_\\ell <= 2^{64}` is prime\n        \n        - :math:`a_i` is an integer\n        \n        \302\240\302\240:strong:`*` :literal:`P[i]` is a vector of length :math:`2` representing the affine\n        point :math:`P_i = (x_i, y_i)` on the elliptic curve :math:`E: y^2 = x^3 + a_ix + b_i`\n        modulo :math:`N_i` where :math:`b_i = y_i^2 - x_i^3 - a_ix_i` satisfying the following:\n        \n        \302\240\302\240:strong:`*` :math:`m_i P_i = oo`\n        \n        \302\240\302\240:strong:`*` :math:`s_i P_i != oo`\n        \n        :strong:`Theorem.` If :math:`N` is an integer and there exist posi""tive integers\n        :math:`m, q` and a point :math:`P` on the elliptic curve :math:`E: y^2 = x^3 + ax + b` defined\n        modulo :math:`N` such that :math:`q > (N^{1/4} + 1)^2`, :math:`q` is a prime divisor of :math:`m`,\n        :math:`mP = oo` and :math:`(m)/(q)P != oo`, then :math:`N` is prime.\n        \n        Using the above theorem, the data in the vector :literal:`C` can be used to\n        certify the primality of :math:`N` assuming :math:`q_\\ell` is prime.\n        \n        ::\n        \n            ? primecert(10^35 + 69)\n            %1 = [[100000000000000000000000000000000069, 5468679110354\n            52074, 2963504668391148, 0, [60737979324046450274283740674\n            208692, 24368673584839493121227731392450025]], [3374383076\n            4501150277, -11610830419, 734208843, 0, [26740412374402652\n            72 4, 6367191119818901665]], [45959444779, 299597, 2331, 0\n            , [18022351516, 9326882 51]]]\n            ? primecert(nextprime(2^64))\n            %2 = [[18446744073709551629, -8423788454, 160388, 1, [1059\n            8342506117936052, 2225259013356795550]]]\n            ? primecert(6)\n            %3 = 0\n            ? primecert(41)\n            %4 = 41\n        \n        If :math:`flag = 1` (very slow), return an :math:`N-1` certificate (Pocklington Lehmer)\n        \n        A PARI :math:`N-1` Primality Certificate for the prime :math:`N` is either a prime\n        integer :math:`N < 2^{64}` or a pair :math:`[N, C]`, where :math:`C` is a vector with :math:`\\ell`\n        elements which are either a single integer :math:`p_i < 2^{64}` or a\n        triple :math:`[p_i,a_i,C_i]` with :math:`p_i > 2^{64}` satisfying the following\n        properties:\n        \n        - :math:`p_i` is a prime divisor of :math:`N - 1`;\n        \n        - :math:`a_i` is an integer such that :math:`a_i^{N-1} = 1 (mod N)` and\n          :math:`a_i^{(N-1)/p_i} - 1` is coprime with :math:`N`;\n        \n        - :math:`C_i` is an :math:`N-1` ""Primality Certificate for :math:`p_i`\n        \n        - The product :math:`F` of the :math:`p_i^{v_{p_i}(N-1)}` is strictly larger than\n          :math:`N^{1/3}`. Provided that all :math:`p_i` are indeed primes, this implies that any\n          divisor of :math:`N` is congruent to :math:`1` modulo :math:`F`.\n        \n        - The Billhart, Lehmer, Selfridge criterion is satisfied: when we write\n          :math:`N = 1 + c_1 F + c_2 F^2` in base :math:`F` the polynomial :math:`1 + c_1 X + c_2 X^2`\n          is irreducible over :math:`\\mathbb{Z}`, i.e. :math:`c_1^2 - 4c_2` is not a square. This\n          implies that :math:`N` is prime.\n        \n        This algorithm requires factoring partially :math:`p-1` for various prime integers\n        :math:`p` with an unfactored parted :math:`<= p^{2/3}` and this may be exceedingly\n        slow compared to the default.\n        \n        The algorithm fails if one of the pseudo-prime factors is not prime, which is\n        exceedingly unlikely and well worth a bug report. Note that if you monitor\n        the algorithm at a high enough debug level, you may see warnings about\n        untested integers being declared primes. This is normal: we ask for partial\n        factorizations (sufficient to prove primality if the unfactored part is not\n        too large), and :literal:`factor` warns us that the cofactor hasn't been tested.\n        It may or may not be tested later, and may or may not be prime. This does\n        not affect the validity of the whole Primality Certificate.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1453primecert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primecert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_flag,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_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "primecert") < 0)) __PYX_ERR(4, 25309, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25309, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("primecert", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25309, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.primecert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1452primecert(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N, __pyx_v_flag);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1452primecert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N, long __pyx_v_flag) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("primecert", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":25411
 *         not affect the validity of the whole Primality Certificate.
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25412
 *         '''
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = primecert(_N, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25412, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25413
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primecert(_N, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25414
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = primecert(_N, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primecert(__pyx_v__N, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":25415
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = primecert(_N, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primecertexport(self, cert, long format=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25309
 *         return new_gen(_ret)
 * 
 *     def primecert(self, N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If N is a prime, return a PARI Primality Certificate for the prime :math:`N`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.primecert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25417
 *         return new_gen(_ret)
 * 
 *     def primecertexport(self, cert, long format=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a string suitable for print/write to display a primality certificate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1455primecertexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1454primecertexport[] = "\n        Returns a string suitable for print/write to display a primality certificate\n        from :literal:`primecert`, the format of which depends on the value of :literal:`format`:\n        \n        - 0 (default): Human-readable format.\n        \n        - 1: Primo format 4.\n        \n        - 2: MAGMA format.\n        \n        Currently, only ECPP Primality Certificates are supported.\n        \n        ::\n        \n            ? cert = primecert(10^35+69);\n            ? s = primecertexport(cert); \\\\ Human-readable\n            ? print(s)\n            [1]\n             N = 100000000000000000000000000000000069\n             t = 546867911035452074\n             s = 2963504668391148\n            a4 = 0\n            D = -3\n            m = 99999999999999999453132088964547996\n            q = 33743830764501150277\n            E = [0, 1]\n            P = [21567861682493263464353543707814204,\n            49167839501923147849639425291163552]\n            [2]\n             N = 33743830764501150277\n             t = -11610830419\n             s = 734208843\n            a4 = 0\n            D = -3\n            m = 33743830776111980697\n            q = 45959444779\n            E = [0, 25895956964997806805]\n            P = [29257172487394218479, 3678591960085668324]\n            \n            \\\\ Primo format\n            ? s = primecertexport(cert,1); write(\"cert.out\", s);\n            \n            \\\\ Magma format, write to file\n            ? s = primecertexport(cert,2); write(\"cert.m\", s);\n            \n            ? cert = primecert(10^35+69, 1); \\\\ N-1 certificate\n             *** at top-level: primecertexport(cert)\n             *** ^---------------------\n             *** primecertexport: sorry, N-1 certificate is not yet implemented.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1455primecertexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cert = 0;
  long __pyx_v_format;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primecertexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cert,&__pyx_n_s_format,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_cert)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "primecertexport") < 0)) __PYX_ERR(4, 25417, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_cert = values[0];
    if (values[1]) {
      __pyx_v_format = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_format == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25417, __pyx_L3_error)
    } else {
      __pyx_v_format = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("primecertexport", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25417, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.primecertexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1454primecertexport(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_cert, __pyx_v_format);

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1454primecertexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cert, long __pyx_v_format) {
  GEN __pyx_v__cert;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("primecertexport", 0);
  __Pyx_INCREF(__pyx_v_cert);

  /* "cypari/auto_instance.pxi":25468
 *              *** primecertexport: sorry, N-1 certificate is not yet implemented.
 *         '''
 *         cert = objtogen(cert)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cert, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cert, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25469
 *         '''
 *         cert = objtogen(cert)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef GEN _ret = primecertexport(_cert, format)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25469, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25470
 *         cert = objtogen(cert)
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primecertexport(_cert, format)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cert)->__pyx_base.g;
  __pyx_v__cert = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25471
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef GEN _ret = primecertexport(_cert, format)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primecertexport(__pyx_v__cert, __pyx_v_format);

  /* "cypari/auto_instance.pxi":25472
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef GEN _ret = primecertexport(_cert, format)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primecertisvalid(self, cert):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25417
 *         return new_gen(_ret)
 * 
 *     def primecertexport(self, cert, long format=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a string suitable for print/write to display a primality certificate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.primecertexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cert);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25474
 *         return new_gen(_ret)
 * 
 *     def primecertisvalid(self, cert):             # <<<<<<<<<<<<<<
 *         r'''
 *         Verifies if cert is a valid PARI ECPP Primality certificate, as described
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1457primecertisvalid(PyObject *__pyx_v_self, PyObject *__pyx_v_cert); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1456primecertisvalid[] = "\n        Verifies if cert is a valid PARI ECPP Primality certificate, as described\n        in :literal:`\077\077primecert`.\n        \n        ::\n        \n            ? cert = primecert(10^35 + 69)\n            %1 = [[100000000000000000000000000000000069, 5468679110354\n            52074, 2963504668391148, 0, [60737979324046450274283740674\n            208692, 24368673584839493121227731392450025]], [3374383076\n            4501150277, -11610830419, 734208843, 0, [26740412374402652\n            72 4, 6367191119818901665]], [45959444779, 299597, 2331, 0\n            , [18022351516, 9326882 51]]]\n            ? primecertisvalid(cert)\n            %2 = 1\n            \n            ? cert[1][1]++; \\\\ random perturbation\n            ? primecertisvalid(cert)\n            %4 = 0 \\\\ no longer valid\n            ? primecertisvalid(primecert(6))\n            %5 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1457primecertisvalid(PyObject *__pyx_v_self, PyObject *__pyx_v_cert) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primecertisvalid (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1456primecertisvalid(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_cert));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1456primecertisvalid(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_cert) {
  GEN __pyx_v__cert;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("primecertisvalid", 0);
  __Pyx_INCREF(__pyx_v_cert);

  /* "cypari/auto_instance.pxi":25497
 *             %5 = 0
 *         '''
 *         cert = objtogen(cert)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cert, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cert, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25498
 *         '''
 *         cert = objtogen(cert)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef long _ret = primecertisvalid(_cert)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25498, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25499
 *         cert = objtogen(cert)
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = primecertisvalid(_cert)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cert)->__pyx_base.g;
  __pyx_v__cert = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25500
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef long _ret = primecertisvalid(_cert)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = primecertisvalid(__pyx_v__cert);

  /* "cypari/auto_instance.pxi":25501
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef long _ret = primecertisvalid(_cert)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":25502
 *         cdef long _ret = primecertisvalid(_cert)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def primepi(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25474
 *         return new_gen(_ret)
 * 
 *     def primecertisvalid(self, cert):             # <<<<<<<<<<<<<<
 *         r'''
 *         Verifies if cert is a valid PARI ECPP Primality certificate, as described
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.primecertisvalid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cert);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25504
 *         return _ret
 * 
 *     def primepi(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The prime counting function. Returns the number of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1459primepi(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1458primepi[] = "\n        The prime counting function. Returns the number of\n        primes :math:`p`, :math:`p <= x`.\n        \n        ::\n        \n            ? primepi(10)\n            %1 = 4;\n            ? primes(5)\n            %2 = [2, 3, 5, 7, 11]\n            ? primepi(10^11)\n            %3 = 4118054813\n        \n        Uses checkpointing and a naive :math:`O(x)` algorithm;\n        make sure to start gp with :literal:`primelimit` at least :math:`\\sqrt{x}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1459primepi(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primepi (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1458primepi(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1458primepi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("primepi", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25521
 *         make sure to start gp with :literal:`primelimit` at least :math:`\sqrt{x}`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25522
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = primepi(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25522, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25523
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primepi(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25524
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = primepi(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primepi(__pyx_v__x);

  /* "cypari/auto_instance.pxi":25525
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = primepi(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primes(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25504
 *         return _ret
 * 
 *     def primepi(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The prime counting function. Returns the number of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.primepi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25527
 *         return new_gen(_ret)
 * 
 *     def primes(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the first :math:`n` prime numbers.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1461primes(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1460primes[] = "\n        Creates a row vector whose components are the first :math:`n` prime numbers.\n        (Returns the empty vector for :math:`n <= 0`.) A :literal:`t_VEC` :math:`n = [a,b]` is also\n        allowed, in which case the primes in :math:`[a,b]` are returned\n        \n        ::\n        \n            ? primes(10) \\\\ the first 10 primes\n            %1 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n            ? primes([0,29]) \\\\ the primes up to 29\n            %2 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n            ? primes([15,30])\n            %3 = [17, 19, 23, 29]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1461primes(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primes (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1460primes(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_n));

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

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1460primes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("primes", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":25542
 *             %3 = [17, 19, 23, 29]
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25543
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = primes0(_n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25543, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25544
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primes0(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25545
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = primes0(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primes0(__pyx_v__n);

  /* "cypari/auto_instance.pxi":25546
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = primes0(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def prodeulerrat(self, F, s=None, long a=2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25527
 *         return new_gen(_ret)
 * 
 *     def primes(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the first :math:`n` prime numbers.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25548
 *         return new_gen(_ret)
 * 
 *     def prodeulerrat(self, F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1463prodeulerrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1462prodeulerrat[] = "\n        :math:`\\prod_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.\n        \n        ::\n        \n            ? prodeulerrat(1+1/q^3,1)\n            %1 = 1.1815649490102569125693997341604542605\n            ? zeta(3)/zeta(6)\n            %2 = 1.1815649490102569125693997341604542606\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1463prodeulerrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_s = 0;
  long __pyx_v_a;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prodeulerrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_s,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prodeulerrat") < 0)) __PYX_ERR(4, 25548, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_F = values[0];
    __pyx_v_s = values[1];
    if (values[2]) {
      __pyx_v_a = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25548, __pyx_L3_error)
    } else {
      __pyx_v_a = ((long)2);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25548, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prodeulerrat", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25548, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.prodeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1462prodeulerrat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_s, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1462prodeulerrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision) {
  int __pyx_v__have_s;
  GEN __pyx_v__F;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("prodeulerrat", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":25559
 *             %2 = 1.1815649490102569125693997341604542606
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25560
 *         '''
 *         F = objtogen(F)
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_2 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25561
 *         F = objtogen(F)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25562
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25561
 *         F = objtogen(F)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25563
 *         if _have_s:
 *             s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25563, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25564
 *             s = objtogen(s)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25565
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_instance.pxi":25566
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25567
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25566
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":25568
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":25569
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = prodeulerrat(__pyx_v__F, __pyx_v__s, __pyx_v_a, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":25570
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def prodnumrat(self, F, long a, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25548
 *         return new_gen(_ret)
 * 
 *     def prodeulerrat(self, F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.prodeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25572
 *         return new_gen(_ret)
 * 
 *     def prodnumrat(self, F, long a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{n >= a}F(n)`, where :math:`F-1` is a rational function of degree less
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1465prodnumrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1464prodnumrat[] = "\n        :math:`\\prod_{n >= a}F(n)`, where :math:`F-1` is a rational function of degree less\n        than or equal to :math:`-2`.\n        \n        ::\n        \n            ? prodnumrat(1+1/x^2,1)\n            %1 = 3.6760779103749777206956974920282606665\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1465prodnumrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_a;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prodnumrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("prodnumrat", 0, 2, 3, 1); __PYX_ERR(4, 25572, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prodnumrat") < 0)) __PYX_ERR(4, 25572, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_F = values[0];
    __pyx_v_a = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25572, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25572, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prodnumrat", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25572, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.prodnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1464prodnumrat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1464prodnumrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, long __pyx_v_a, long __pyx_v_precision) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("prodnumrat", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_instance.pxi":25582
 *             %1 = 3.6760779103749777206956974920282606665
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25583
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25583, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25584
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodnumrat(_F, a, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25585
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = prodnumrat(_F, a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":25586
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodnumrat(_F, a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = prodnumrat(__pyx_v__F, __pyx_v_a, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":25587
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodnumrat(_F, a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def psdraw(self, list, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25572
 *         return new_gen(_ret)
 * 
 *     def prodnumrat(self, F, long a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{n >= a}F(n)`, where :math:`F-1` is a rational function of degree less
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.prodnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25589
 *         return new_gen(_ret)
 * 
 *     def psdraw(self, list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plotexport and write the result to file.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1467psdraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1466psdraw[] = "\n        This function is obsolete, use plotexport and write the result to file.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1467psdraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_list = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("psdraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_list,&__pyx_n_s_flag,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_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "psdraw") < 0)) __PYX_ERR(4, 25589, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_list = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25589, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("psdraw", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25589, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.psdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1466psdraw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_list, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1466psdraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_list, long __pyx_v_flag) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__list;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("psdraw", 0);
  __Pyx_INCREF(__pyx_v_list);

  /* "cypari/auto_instance.pxi":25593
 *         This function is obsolete, use plotexport and write the result to file.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)
 *         list = objtogen(list)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25593, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25594
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         list = objtogen(list)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25595
 *         from warnings import warn
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25596
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)
 *         list = objtogen(list)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         psdraw(_list, flag)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25596, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25597
 *         list = objtogen(list)
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         psdraw(_list, flag)
 *         clear_stack()
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25598
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 *         psdraw(_list, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  psdraw(__pyx_v__list, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":25599
 *         cdef GEN _list = (<Gen>list).g
 *         psdraw(_list, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def psi(self, x, long precision=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":25589
 *         return new_gen(_ret)
 * 
 *     def psdraw(self, list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plotexport and write the result to file.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.psdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25601
 *         clear_stack()
 * 
 *     def psi(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The :math:`\psi`-function of :math:`x`, i.e.the logarithmic derivative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1469psi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1468psi[] = "\n        The :math:`\\psi`-function of :math:`x`, i.e.\302\240the logarithmic derivative\n        :math:`\\Gamma'(x)/\\Gamma (x)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1469psi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("psi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "psi") < 0)) __PYX_ERR(4, 25601, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25601, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("psi", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25601, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.psi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1468psi(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1468psi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("psi", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25606
 *         :math:`\Gamma'(x)/\Gamma (x)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25607
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25607, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25608
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gpsi(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25609
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpsi(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":25610
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gpsi(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpsi(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":25611
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gpsi(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def psplothraw(self, listx, listy, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25601
 *         clear_stack()
 * 
 *     def psi(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The :math:`\psi`-function of :math:`x`, i.e.the logarithmic derivative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.psi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25613
 *         return new_gen(_ret)
 * 
 *     def psplothraw(self, listx, listy, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plothrawexport and write the result to file.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1471psplothraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1470psplothraw[] = "\n        This function is obsolete, use plothrawexport and write the result to file.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1471psplothraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_listx = 0;
  PyObject *__pyx_v_listy = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("psplothraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_listx,&__pyx_n_s_listy,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_listx)) != 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_listy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("psplothraw", 0, 2, 3, 1); __PYX_ERR(4, 25613, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "psplothraw") < 0)) __PYX_ERR(4, 25613, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_listx = values[0];
    __pyx_v_listy = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25613, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("psplothraw", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25613, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.psplothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1470psplothraw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_listx, __pyx_v_listy, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1470psplothraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_listx, PyObject *__pyx_v_listy, long __pyx_v_flag) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__listx;
  GEN __pyx_v__listy;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("psplothraw", 0);
  __Pyx_INCREF(__pyx_v_listx);
  __Pyx_INCREF(__pyx_v_listy);

  /* "cypari/auto_instance.pxi":25617
 *         This function is obsolete, use plothrawexport and write the result to file.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)
 *         listx = objtogen(listx)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25617, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25618
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         listx = objtogen(listx)
 *         listy = objtogen(listy)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25619
 *         from warnings import warn
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)
 *         listx = objtogen(listx)             # <<<<<<<<<<<<<<
 *         listy = objtogen(listy)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_listx, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_listx, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25620
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)
 *         listx = objtogen(listx)
 *         listy = objtogen(listy)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _listx = (<Gen>listx).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_listy, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_listy, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25621
 *         listx = objtogen(listx)
 *         listy = objtogen(listy)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _listx = (<Gen>listx).g
 *         cdef GEN _listy = (<Gen>listy).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25621, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25622
 *         listy = objtogen(listy)
 *         sig_on()
 *         cdef GEN _listx = (<Gen>listx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _listy = (<Gen>listy).g
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_listx)->__pyx_base.g;
  __pyx_v__listx = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25623
 *         sig_on()
 *         cdef GEN _listx = (<Gen>listx).g
 *         cdef GEN _listy = (<Gen>listy).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_listy)->__pyx_base.g;
  __pyx_v__listy = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25624
 *         cdef GEN _listx = (<Gen>listx).g
 *         cdef GEN _listy = (<Gen>listy).g
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = psplothraw(__pyx_v__listx, __pyx_v__listy, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":25625
 *         cdef GEN _listy = (<Gen>listy).g
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfauto(self, G, fl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25613
 *         return new_gen(_ret)
 * 
 *     def psplothraw(self, listx, listy, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plothrawexport and write the result to file.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.psplothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_listx);
  __Pyx_XDECREF(__pyx_v_listy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25627
 *         return new_gen(_ret)
 * 
 *     def qfauto(self, G, fl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1473qfauto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1472qfauto[] = "\n        :math:`G` being a square and symmetric matrix with integer entries representing a\n        positive definite quadratic form, outputs the automorphism group of the\n        associate lattice.\n        Since this requires computing the minimal vectors, the computations can\n        become very lengthy as the dimension grows. :math:`G` can also be given by an\n        :literal:`qfisominit` structure.\n        See :literal:`qfisominit` for the meaning of :emphasis:`fl`.\n        \n        The output is a two-components vector :math:`[o,g]` where :math:`o` is the group order\n        and :math:`g` is the list of generators (as a vector). For each generator :math:`H`,\n        the equality :math:`G = {^t}H G H` holds.\n        \n        The interface of this function is experimental and will likely change in the\n        future.\n        \n        This function implements an algorithm of Plesken and Souvignier, following\n        Souvignier's implementation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1473qfauto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_fl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfauto (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_fl,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_G)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfauto") < 0)) __PYX_ERR(4, 25627, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_G = values[0];
    __pyx_v_fl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfauto", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25627, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfauto", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1472qfauto(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_fl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1472qfauto(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_fl) {
  int __pyx_v__have_fl;
  GEN __pyx_v__G;
  GEN __pyx_v__fl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfauto", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_fl);

  /* "cypari/auto_instance.pxi":25647
 *         Souvignier's implementation.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25648
 *         '''
 *         G = objtogen(G)
 *         cdef bint _have_fl = (fl is not None)             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             fl = objtogen(fl)
 */
  __pyx_t_2 = (__pyx_v_fl != Py_None);
  __pyx_v__have_fl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25649
 *         G = objtogen(G)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25650
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 *             fl = objtogen(fl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25650, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25649
 *         G = objtogen(G)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25651
 *         if _have_fl:
 *             fl = objtogen(fl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25651, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25652
 *             fl = objtogen(fl)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25653
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 */
  __pyx_v__fl = NULL;

  /* "cypari/auto_instance.pxi":25654
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25655
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 *             _fl = (<Gen>fl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfauto0(_G, _fl)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fl)->__pyx_base.g;
    __pyx_v__fl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25654
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)
 */
  }

  /* "cypari/auto_instance.pxi":25656
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfauto0(__pyx_v__G, __pyx_v__fl);

  /* "cypari/auto_instance.pxi":25657
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfautoexport(self, qfa, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25627
 *         return new_gen(_ret)
 * 
 *     def qfauto(self, G, fl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfauto", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_fl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25659
 *         return new_gen(_ret)
 * 
 *     def qfautoexport(self, qfa, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`qfa` being an automorphism group as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1475qfautoexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1474qfautoexport[] = "\n        :emphasis:`qfa` being an automorphism group as output by\n        :literal:`qfauto`, export the underlying matrix group as a string suitable\n        for (no flags or :math:`flag = 0`) GAP or (:math:`flag = 1`) Magma. The following example\n        computes the size of the matrix group using GAP:\n        \n        ::\n        \n            ? G = qfauto([2,1;1,2])\n            %1 = [12, [[-1, 0; 0, -1], [0, -1; 1, 1], [1, 1; 0, -1]]]\n            ? s = qfautoexport(G)\n            %2 = \"Group([[-1, 0], [0, -1]], [[0, -1], [1, 1]], [[1, 1], [0, -1]])\"\n            ? extern(\"echo \\\"Order(\"s\");\\\" | gap -q\")\n            %3 = 12\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1475qfautoexport(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_qfa = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfautoexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_qfa,&__pyx_n_s_flag,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_qfa)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfautoexport") < 0)) __PYX_ERR(4, 25659, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_qfa = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25659, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfautoexport", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25659, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfautoexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1474qfautoexport(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_qfa, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1474qfautoexport(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_qfa, long __pyx_v_flag) {
  GEN __pyx_v__qfa;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfautoexport", 0);
  __Pyx_INCREF(__pyx_v_qfa);

  /* "cypari/auto_instance.pxi":25675
 *             %3 = 12
 *         '''
 *         qfa = objtogen(qfa)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _qfa = (<Gen>qfa).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_qfa, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_qfa, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25676
 *         '''
 *         qfa = objtogen(qfa)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _qfa = (<Gen>qfa).g
 *         cdef GEN _ret = qfautoexport(_qfa, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25676, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25677
 *         qfa = objtogen(qfa)
 *         sig_on()
 *         cdef GEN _qfa = (<Gen>qfa).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfautoexport(_qfa, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_qfa)->__pyx_base.g;
  __pyx_v__qfa = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25678
 *         sig_on()
 *         cdef GEN _qfa = (<Gen>qfa).g
 *         cdef GEN _ret = qfautoexport(_qfa, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfautoexport(__pyx_v__qfa, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":25679
 *         cdef GEN _qfa = (<Gen>qfa).g
 *         cdef GEN _ret = qfautoexport(_qfa, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbclassno(self, D, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25659
 *         return new_gen(_ret)
 * 
 *     def qfautoexport(self, qfa, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`qfa` being an automorphism group as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfautoexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_qfa);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25681
 *         return new_gen(_ret)
 * 
 *     def qfbclassno(self, D, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ordinary class number of the quadratic order of discriminant :math:`D`, for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1477qfbclassno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1476qfbclassno[] = "\n        Ordinary class number of the quadratic order of discriminant :math:`D`, for\n        \"small\" values of :math:`D`.\n        \n        - if :math:`D > 0` or :math:`flag = 1`, use a :math:`O(\\|D\\|^{1/2})`\n          algorithm (compute :math:`L(1,\\chi_D)` with the approximate functional equation).\n          This is slower than :literal:`quadclassunit` as soon as :math:`\\|D\\| ~ 10^2` or\n          so and is not meant to be used for large :math:`D`.\n        \n        - if :math:`D < 0` and :math:`flag = 0` (or omitted), use a :math:`O(\\|D\\|^{1/4})`\n          algorithm (Shanks's baby-step/giant-step method). It should\n          be faster than :literal:`quadclassunit` for small values of :math:`D`, say\n          :math:`\\|D\\| < 10^{18}`.\n        \n        :strong:`Important warning.` In the latter case, this function only\n        implements part of Shanks's method (which allows to speed it up\n        considerably). It gives unconditionnally correct results for\n        :math:`\\|D\\| < 2.10^{10}`, but may give incorrect results for larger values\n        if the class\n        group has many cyclic factors. We thus recommend to double-check results\n        using the function :literal:`quadclassunit`, which is about 2 to 3 times slower in\n        the range :math:`\\|D\\| \\in [10^{10}, 10^{18}]`, assuming GRH. We currently have no\n        counter-examples but they should exist: we would appreciate a bug report if\n        you find one.\n        \n        :strong:`Warning.` Contrary to what its name implies, this routine does not\n        compute the number of classes of binary primitive forms of discriminant :math:`D`,\n        which is equal to the :emphasis:`narrow` class number. The two notions are the same\n        when :math:`D < 0` or the fundamental unit :math:`\\varepsilon` has negative norm; when :math:`D\n        > 0` and :math:`N\\varepsilon > 0`, the number of classes of forms is twice the\n        ordinary class number. This is a pr""oblem which we cannot fix for backward\n        compatibility reasons. Use the following routine if you are only interested\n        in the number of classes of forms:\n        \n        ::\n        \n            QFBclassno(D) =\n            qfbclassno(D) * if (D < 0 || norm(quadunit(D)) < 0, 1, 2)\n        \n        Here are a few examples:\n        \n        ::\n        \n            ? qfbclassno(400000028) \\\\ D > 0: slow\n            time = 3,140 ms.\n            %1 = 1\n            ? quadclassunit(400000028).no\n            time = 20 ms. \\\\{ much faster, assume GRH}\n            %2 = 1\n            ? qfbclassno(-400000028) \\\\ D < 0: fast enough\n            time = 0 ms.\n            %3 = 7253\n            ? quadclassunit(-400000028).no\n            time = 0 ms.\n            %4 = 7253\n        \n        See also :literal:`qfbhclassno`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1477qfbclassno(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbclassno (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_flag,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_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbclassno") < 0)) __PYX_ERR(4, 25681, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25681, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbclassno", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25681, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1476qfbclassno(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1476qfbclassno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_flag) {
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbclassno", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":25740
 *         See also :literal:`qfbhclassno`.
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25741
 *         '''
 *         D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = qfbclassno0(_D, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25741, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25742
 *         D = objtogen(D)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbclassno0(_D, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25743
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = qfbclassno0(_D, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbclassno0(__pyx_v__D, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":25744
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = qfbclassno0(_D, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbcompraw(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25681
 *         return new_gen(_ret)
 * 
 *     def qfbclassno(self, D, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ordinary class number of the quadratic order of discriminant :math:`D`, for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25746
 *         return new_gen(_ret)
 * 
 *     def qfbcompraw(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the binary quadratic forms :math:`x` and :math:`y`, without
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1479qfbcompraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1478qfbcompraw[] = "\n        composition of the binary quadratic forms :math:`x` and :math:`y`, without\n        reduction of the result. This is useful e.g.\302\240to compute a generating\n        element of an ideal. The result is undefined if :math:`x` and :math:`y` do not have the\n        same discriminant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1479qfbcompraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbcompraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbcompraw", 1, 2, 2, 1); __PYX_ERR(4, 25746, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbcompraw") < 0)) __PYX_ERR(4, 25746, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbcompraw", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25746, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbcompraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1478qfbcompraw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1478qfbcompraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbcompraw", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":25753
 *         same discriminant.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25754
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25755
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25755, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25756
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = qfbcompraw(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25757
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbcompraw(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25758
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = qfbcompraw(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbcompraw(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":25759
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = qfbcompraw(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbhclassno(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25746
 *         return new_gen(_ret)
 * 
 *     def qfbcompraw(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the binary quadratic forms :math:`x` and :math:`y`, without
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbcompraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25761
 *         return new_gen(_ret)
 * 
 *     def qfbhclassno(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz class number of :math:`x`, when
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1481qfbhclassno(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1480qfbhclassno[] = "\n        Hurwitz class number of :math:`x`, when\n        :math:`x` is non-negative and congruent to 0 or 3 modulo 4, and :math:`0` for other\n        values. For :math:`x > 5.10^5`, we assume the GRH, and use :literal:`quadclassunit`\n        with default parameters.\n        \n        ::\n        \n            ? qfbhclassno(1) \\\\ not 0 or 3 mod 4\n            %1 = 0\n            ? qfbhclassno(3)\n            %2 = 1/3\n            ? qfbhclassno(4)\n            %3 = 1/2\n            ? qfbhclassno(23)\n            %4 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1481qfbhclassno(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbhclassno (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1480qfbhclassno(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1480qfbhclassno(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbhclassno", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25779
 *             %4 = 3
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25780
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hclassno(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25780, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25781
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hclassno(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25782
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hclassno(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hclassno(__pyx_v__x);

  /* "cypari/auto_instance.pxi":25783
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hclassno(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbil(self, x, y, q=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25761
 *         return new_gen(_ret)
 * 
 *     def qfbhclassno(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz class number of :math:`x`, when
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbhclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25785
 *         return new_gen(_ret)
 * 
 *     def qfbil(self, x, y, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1483qfbil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1482qfbil[] = "\n        This function is obsolete, use :literal:`qfeval`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1483qfbil(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_q,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbil", 0, 2, 3, 1); __PYX_ERR(4, 25785, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbil") < 0)) __PYX_ERR(4, 25785, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_q = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbil", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25785, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1482qfbil(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1482qfbil(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_q) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_q;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("qfbil", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_instance.pxi":25789
 *         This function is obsolete, use :literal:`qfeval`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25789, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25790
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25791
 *         from warnings import warn
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25792
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":25793
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             q = objtogen(q)
 */
  __pyx_t_3 = (__pyx_v_q != Py_None);
  __pyx_v__have_q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25794
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":25795
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 *             q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25795, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":25794
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25796
 *         if _have_q:
 *             q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 25796, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25797
 *             q = objtogen(q)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_instance.pxi":25798
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _q = NULL
 *         if _have_q:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_5;

  /* "cypari/auto_instance.pxi":25799
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             _q = (<Gen>q).g
 */
  __pyx_v__q = NULL;

  /* "cypari/auto_instance.pxi":25800
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":25801
 *         cdef GEN _q = NULL
 *         if _have_q:
 *             _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
    __pyx_v__q = __pyx_t_5;

    /* "cypari/auto_instance.pxi":25800
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 */
  }

  /* "cypari/auto_instance.pxi":25802
 *         if _have_q:
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbil(__pyx_v__x, __pyx_v__y, __pyx_v__q);

  /* "cypari/auto_instance.pxi":25803
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbnucomp(self, x, y, L):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 25803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25785
 *         return new_gen(_ret)
 * 
 *     def qfbil(self, x, y, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25805
 *         return new_gen(_ret)
 * 
 *     def qfbnucomp(self, x, y, L):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the primitive positive
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1485qfbnucomp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1484qfbnucomp[] = "\n        composition of the primitive positive\n        definite binary quadratic forms :math:`x` and :math:`y` (type :literal:`t_QFI`) using the NUCOMP\n        and NUDUPL algorithms of Shanks, \303\240 la Atkin. :math:`L` is any positive\n        constant, but for optimal speed, one should take :math:`L = \\|D/4\\|^{1/4}`, i.e.\n        :literal:`sqrtnint(abs(D) >> 2,4)`, where :math:`D` is the common discriminant of :math:`x` and\n        :math:`y`. When :math:`x` and :math:`y` do not have the same discriminant, the result is\n        undefined.\n        \n        The current implementation is slower than the generic routine for small :math:`D`,\n        and becomes faster when :math:`D` has about :math:`45` bits.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1485qfbnucomp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbnucomp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_L,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbnucomp", 1, 3, 3, 1); __PYX_ERR(4, 25805, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbnucomp", 1, 3, 3, 2); __PYX_ERR(4, 25805, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbnucomp") < 0)) __PYX_ERR(4, 25805, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_L = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbnucomp", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25805, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbnucomp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1484qfbnucomp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_L);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1484qfbnucomp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_L) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbnucomp", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":25818
 *         and becomes faster when :math:`D` has about :math:`45` bits.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         L = objtogen(L)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25819
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         L = objtogen(L)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25820
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25821
 *         y = objtogen(y)
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25821, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25822
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25823
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ret = nucomp(_x, _y, _L)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25824
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nucomp(_x, _y, _L)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25825
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ret = nucomp(_x, _y, _L)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nucomp(__pyx_v__x, __pyx_v__y, __pyx_v__L);

  /* "cypari/auto_instance.pxi":25826
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ret = nucomp(_x, _y, _L)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbnupow(self, x, n, L=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25805
 *         return new_gen(_ret)
 * 
 *     def qfbnucomp(self, x, y, L):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the primitive positive
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbnucomp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25828
 *         return new_gen(_ret)
 * 
 *     def qfbnupow(self, x, n, L=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the primitive positive definite
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1487qfbnupow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1486qfbnupow[] = "\n        :math:`n`-th power of the primitive positive definite\n        binary quadratic form :math:`x` using Shanks's NUCOMP and NUDUPL algorithms;\n        if set, :math:`L` should be equal to :literal:`sqrtnint(abs(D) >> 2,4)`, where :math:`D < 0` is\n        the discriminant of :math:`x`.\n        \n        The current implementation is slower than the generic routine for small\n        discriminant :math:`D`, and becomes faster for :math:`D ~ 2^{45}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1487qfbnupow(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbnupow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,&__pyx_n_s_L,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbnupow", 0, 2, 3, 1); __PYX_ERR(4, 25828, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbnupow") < 0)) __PYX_ERR(4, 25828, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_n = values[1];
    __pyx_v_L = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbnupow", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25828, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbnupow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1486qfbnupow(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n, __pyx_v_L);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1486qfbnupow(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_n, PyObject *__pyx_v_L) {
  int __pyx_v__have_L;
  GEN __pyx_v__x;
  GEN __pyx_v__n;
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfbnupow", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_instance.pxi":25838
 *         discriminant :math:`D`, and becomes faster for :math:`D ~ 2^{45}`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         cdef bint _have_L = (L is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25838, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25839
 *         '''
 *         x = objtogen(x)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25840
 *         x = objtogen(x)
 *         n = objtogen(n)
 *         cdef bint _have_L = (L is not None)             # <<<<<<<<<<<<<<
 *         if _have_L:
 *             L = objtogen(L)
 */
  __pyx_t_2 = (__pyx_v_L != Py_None);
  __pyx_v__have_L = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25841
 *         n = objtogen(n)
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             L = objtogen(L)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_L != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25842
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:
 *             L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25842, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25841
 *         n = objtogen(n)
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             L = objtogen(L)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25843
 *         if _have_L:
 *             L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25843, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25844
 *             L = objtogen(L)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25845
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L = NULL
 *         if _have_L:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25846
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL             # <<<<<<<<<<<<<<
 *         if _have_L:
 *             _L = (<Gen>L).g
 */
  __pyx_v__L = NULL;

  /* "cypari/auto_instance.pxi":25847
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)
 */
  __pyx_t_2 = (__pyx_v__have_L != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25848
 *         cdef GEN _L = NULL
 *         if _have_L:
 *             _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nupow(_x, _n, _L)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
    __pyx_v__L = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25847
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)
 */
  }

  /* "cypari/auto_instance.pxi":25849
 *         if _have_L:
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nupow(__pyx_v__x, __pyx_v__n, __pyx_v__L);

  /* "cypari/auto_instance.pxi":25850
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbpowraw(self, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25828
 *         return new_gen(_ret)
 * 
 *     def qfbnupow(self, x, n, L=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the primitive positive definite
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbnupow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25852
 *         return new_gen(_ret)
 * 
 *     def qfbpowraw(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the binary quadratic form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1489qfbpowraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1488qfbpowraw[] = "\n        :math:`n`-th power of the binary quadratic form\n        :math:`x`, computed without doing any reduction (i.e.\302\240using :literal:`qfbcompraw`).\n        Here :math:`n` must be non-negative and :math:`n < 2^{31}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1489qfbpowraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbpowraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbpowraw", 1, 2, 2, 1); __PYX_ERR(4, 25852, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbpowraw") < 0)) __PYX_ERR(4, 25852, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25852, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbpowraw", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25852, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbpowraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1488qfbpowraw(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1488qfbpowraw(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbpowraw", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":25858
 *         Here :math:`n` must be non-negative and :math:`n < 2^{31}`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25859
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfbpowraw(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25859, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25860
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbpowraw(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25861
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfbpowraw(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbpowraw(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":25862
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfbpowraw(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbprimeform(self, x, p, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25852
 *         return new_gen(_ret)
 * 
 *     def qfbpowraw(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the binary quadratic form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbpowraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25864
 *         return new_gen(_ret)
 * 
 *     def qfbprimeform(self, x, p, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Prime binary quadratic form of discriminant
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1491qfbprimeform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1490qfbprimeform[] = "\n        Prime binary quadratic form of discriminant\n        :math:`x` whose first coefficient is :math:`p`, where :math:`\\|p\\|` is a prime number.\n        By abuse of notation,\n        :math:`p = \302\261 1` is also valid and returns the unit form. Returns an\n        error if :math:`x` is not a quadratic residue mod :math:`p`, or if :math:`x < 0` and :math:`p < 0`.\n        (Negative definite :literal:`t_QFI` are not implemented.) In the case where :math:`x > 0`,\n        the \"distance\" component of the form is set equal to zero according to the\n        current precision.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1491qfbprimeform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbprimeform (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbprimeform", 0, 2, 3, 1); __PYX_ERR(4, 25864, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbprimeform") < 0)) __PYX_ERR(4, 25864, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_p = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25864, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbprimeform", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25864, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbprimeform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1490qfbprimeform(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1490qfbprimeform(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbprimeform", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":25875
 *         current precision.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25876
 *         '''
 *         x = objtogen(x)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25877
 *         x = objtogen(x)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25877, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25878
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25879
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = primeform(_x, _p, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25880
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primeform(_x, _p, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":25881
 *         cdef GEN _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = primeform(_x, _p, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primeform(__pyx_v__x, __pyx_v__p, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":25882
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = primeform(_x, _p, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbred(self, x, long flag=0, d=None, isd=None, sd=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25864
 *         return new_gen(_ret)
 * 
 *     def qfbprimeform(self, x, p, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Prime binary quadratic form of discriminant
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbprimeform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25884
 *         return new_gen(_ret)
 * 
 *     def qfbred(self, x, long flag=0, d=None, isd=None, sd=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduces the binary quadratic form :math:`x` (updating Shanks's distance function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1493qfbred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1492qfbred[] = "\n        Reduces the binary quadratic form :math:`x` (updating Shanks's distance function\n        if :math:`x` is indefinite). The binary digits of :math:`flag` are toggles meaning\n        \n        \302\240\302\2401: perform a single reduction step\n        \n        \302\240\302\2402: don't update Shanks's distance\n        \n        The arguments :math:`d`, :emphasis:`isd`, :emphasis:`sd`, if present, supply the values of the\n        discriminant, :math:`floor{\\sqrt{d}}`, and :math:`\\sqrt{d}` respectively\n        (no checking is done of these facts). If :math:`d < 0` these values are useless,\n        and all references to Shanks's distance are irrelevant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1493qfbred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_isd = 0;
  PyObject *__pyx_v_sd = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,&__pyx_n_s_d,&__pyx_n_s_isd,&__pyx_n_s_sd,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          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_isd);
          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_sd);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbred") < 0)) __PYX_ERR(4, 25884, __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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 25884, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_d = values[2];
    __pyx_v_isd = values[3];
    __pyx_v_sd = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbred", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25884, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1492qfbred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag, __pyx_v_d, __pyx_v_isd, __pyx_v_sd);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1492qfbred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag, PyObject *__pyx_v_d, PyObject *__pyx_v_isd, PyObject *__pyx_v_sd) {
  int __pyx_v__have_d;
  int __pyx_v__have_isd;
  int __pyx_v__have_sd;
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__isd;
  GEN __pyx_v__sd;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfbred", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_d);
  __Pyx_INCREF(__pyx_v_isd);
  __Pyx_INCREF(__pyx_v_sd);

  /* "cypari/auto_instance.pxi":25898
 *         and all references to Shanks's distance are irrelevant.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25899
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_2 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25900
 *         x = objtogen(x)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25901
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25901, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25900
 *         x = objtogen(x)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 */
  }

  /* "cypari/auto_instance.pxi":25902
 *         if _have_d:
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)             # <<<<<<<<<<<<<<
 *         if _have_isd:
 *             isd = objtogen(isd)
 */
  __pyx_t_2 = (__pyx_v_isd != Py_None);
  __pyx_v__have_isd = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25903
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 */
  __pyx_t_2 = (__pyx_v__have_isd != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25904
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:
 *             isd = objtogen(isd)             # <<<<<<<<<<<<<<
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_isd, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25904, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_isd, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25903
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 */
  }

  /* "cypari/auto_instance.pxi":25905
 *         if _have_isd:
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)             # <<<<<<<<<<<<<<
 *         if _have_sd:
 *             sd = objtogen(sd)
 */
  __pyx_t_2 = (__pyx_v_sd != Py_None);
  __pyx_v__have_sd = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25906
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             sd = objtogen(sd)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_sd != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25907
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:
 *             sd = objtogen(sd)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sd, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_sd, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25906
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             sd = objtogen(sd)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25908
 *         if _have_sd:
 *             sd = objtogen(sd)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25908, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25909
 *             sd = objtogen(sd)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25910
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_instance.pxi":25911
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25912
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _isd = NULL
 *         if _have_isd:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25911
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 */
  }

  /* "cypari/auto_instance.pxi":25913
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL             # <<<<<<<<<<<<<<
 *         if _have_isd:
 *             _isd = (<Gen>isd).g
 */
  __pyx_v__isd = NULL;

  /* "cypari/auto_instance.pxi":25914
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 */
  __pyx_t_2 = (__pyx_v__have_isd != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25915
 *         cdef GEN _isd = NULL
 *         if _have_isd:
 *             _isd = (<Gen>isd).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sd = NULL
 *         if _have_sd:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_isd)->__pyx_base.g;
    __pyx_v__isd = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25914
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 */
  }

  /* "cypari/auto_instance.pxi":25916
 *         if _have_isd:
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL             # <<<<<<<<<<<<<<
 *         if _have_sd:
 *             _sd = (<Gen>sd).g
 */
  __pyx_v__sd = NULL;

  /* "cypari/auto_instance.pxi":25917
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 */
  __pyx_t_2 = (__pyx_v__have_sd != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25918
 *         cdef GEN _sd = NULL
 *         if _have_sd:
 *             _sd = (<Gen>sd).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sd)->__pyx_base.g;
    __pyx_v__sd = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25917
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 */
  }

  /* "cypari/auto_instance.pxi":25919
 *         if _have_sd:
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbred0(__pyx_v__x, __pyx_v_flag, __pyx_v__d, __pyx_v__isd, __pyx_v__sd);

  /* "cypari/auto_instance.pxi":25920
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbredsl2(self, x, data=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25884
 *         return new_gen(_ret)
 * 
 *     def qfbred(self, x, long flag=0, d=None, isd=None, sd=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduces the binary quadratic form :math:`x` (updating Shanks's distance function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_isd);
  __Pyx_XDECREF(__pyx_v_sd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25922
 *         return new_gen(_ret)
 * 
 *     def qfbredsl2(self, x, data=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduction of the (real or imaginary) binary quadratic form :math:`x`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1495qfbredsl2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1494qfbredsl2[] = "\n        Reduction of the (real or imaginary) binary quadratic form :math:`x`, return\n        :math:`[y,g]` where :math:`y` is reduced and :math:`g` in :math:`SL(2,\\mathbb{Z})` is such that\n        :math:`g.x = y`; :emphasis:`data`, if\n        present, must be equal to :math:`[D, sqrtint (D)]`, where :math:`D > 0` is the\n        discriminant of :math:`x`. In case :math:`x` is a :literal:`t_QFR`, the distance component is\n        unaffected.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1495qfbredsl2(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbredsl2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbredsl2") < 0)) __PYX_ERR(4, 25922, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbredsl2", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25922, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbredsl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1494qfbredsl2(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_data);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1494qfbredsl2(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_data) {
  int __pyx_v__have_data;
  GEN __pyx_v__x;
  GEN __pyx_v__data;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfbredsl2", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_data);

  /* "cypari/auto_instance.pxi":25931
 *         unaffected.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_data = (data is not None)
 *         if _have_data:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25931, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25932
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_data = (data is not None)             # <<<<<<<<<<<<<<
 *         if _have_data:
 *             data = objtogen(data)
 */
  __pyx_t_2 = (__pyx_v_data != Py_None);
  __pyx_v__have_data = __pyx_t_2;

  /* "cypari/auto_instance.pxi":25933
 *         x = objtogen(x)
 *         cdef bint _have_data = (data is not None)
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             data = objtogen(data)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_data != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25934
 *         cdef bint _have_data = (data is not None)
 *         if _have_data:
 *             data = objtogen(data)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_data, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":25933
 *         x = objtogen(x)
 *         cdef bint _have_data = (data is not None)
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             data = objtogen(data)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":25935
 *         if _have_data:
 *             data = objtogen(data)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 25935, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25936
 *             data = objtogen(data)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _data = NULL
 *         if _have_data:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":25937
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL             # <<<<<<<<<<<<<<
 *         if _have_data:
 *             _data = (<Gen>data).g
 */
  __pyx_v__data = NULL;

  /* "cypari/auto_instance.pxi":25938
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 */
  __pyx_t_2 = (__pyx_v__have_data != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":25939
 *         cdef GEN _data = NULL
 *         if _have_data:
 *             _data = (<Gen>data).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_data)->__pyx_base.g;
    __pyx_v__data = __pyx_t_4;

    /* "cypari/auto_instance.pxi":25938
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 */
  }

  /* "cypari/auto_instance.pxi":25940
 *         if _have_data:
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbredsl2(__pyx_v__x, __pyx_v__data);

  /* "cypari/auto_instance.pxi":25941
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbsolve(self, Q, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25922
 *         return new_gen(_ret)
 * 
 *     def qfbredsl2(self, x, data=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduction of the (real or imaginary) binary quadratic form :math:`x`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbredsl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25943
 *         return new_gen(_ret)
 * 
 *     def qfbsolve(self, Q, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Solve the equation :math:`Q(x,y) = p` over the integers,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1497qfbsolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1496qfbsolve[] = "\n        Solve the equation :math:`Q(x,y) = p` over the integers,\n        where :math:`Q` is a binary quadratic form and :math:`p` a prime number.\n        \n        Return :math:`[x,y]` as a two-components vector, or zero if there is no solution.\n        Note that this function returns only one solution and not all the solutions.\n        \n        Let :math:`D = \\mathrm{disc} Q`. The algorithm used runs in probabilistic polynomial time\n        in :math:`p` (through the computation of a square root of :math:`D` modulo :math:`p`); it is\n        polynomial time in :math:`D` if :math:`Q` is imaginary, but exponential time if :math:`Q` is\n        real (through the computation of a full cycle of reduced forms). In the\n        latter case, note that :literal:`bnfisprincipal` provides a solution in heuristic\n        subexponential time in :math:`D` assuming the GRH.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1497qfbsolve(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbsolve (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_p,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_Q)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbsolve", 1, 2, 2, 1); __PYX_ERR(4, 25943, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbsolve") < 0)) __PYX_ERR(4, 25943, __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_Q = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbsolve", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25943, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1496qfbsolve(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_Q, __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1496qfbsolve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_Q, PyObject *__pyx_v_p) {
  GEN __pyx_v__Q;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbsolve", 0);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":25958
 *         subexponential time in :math:`D` assuming the GRH.
 *         '''
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25959
 *         '''
 *         Q = objtogen(Q)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":25960
 *         Q = objtogen(Q)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 25960, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":25961
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = qfbsolve(_Q, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25962
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbsolve(_Q, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":25963
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = qfbsolve(_Q, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbsolve(__pyx_v__Q, __pyx_v__p);

  /* "cypari/auto_instance.pxi":25964
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = qfbsolve(_Q, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfeval(self, q=None, x=None, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 25964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25943
 *         return new_gen(_ret)
 * 
 *     def qfbsolve(self, Q, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Solve the equation :math:`Q(x,y) = p` over the integers,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfbsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":25966
 *         return new_gen(_ret)
 * 
 *     def qfeval(self, q=None, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluate the quadratic form :math:`q` (given by a symmetric matrix)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1499qfeval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1498qfeval[] = "\n        Evaluate the quadratic form :math:`q` (given by a symmetric matrix)\n        at the vector :math:`x`; if :math:`y` is present, evaluate the polar form at :math:`(x,y)`;\n        if :math:`q` omitted, use the standard Euclidean scalar product, corresponding to\n        the identity matrix.\n        \n        Roughly equivalent to :literal:`x~ * q * y`, but a little faster and\n        more convenient (does not distinguish between column and row vectors):\n        \n        ::\n        \n            ? x = [1,2,3]~; y = [-1,3,1]~; q = [1,2,3;2,2,-1;3,-1,9];\n            ? qfeval(q,x,y)\n            %2 = 23\n            ? for(i=1,10^6, qfeval(q,x,y))\n            time = 661ms\n            ? for(i=1,10^6, x~*q*y)\n            time = 697ms\n        \n        The speedup is noticeable for the quadratic form,\n        compared to :literal:`x~ * q * x`, since we save almost half the\n        operations:\n        \n        ::\n        \n            ? for(i=1,10^6, qfeval(q,x))\n            time = 487ms\n        \n        The special case :math:`q = Id` is handled faster if we\n        omit :math:`q` altogether:\n        \n        ::\n        \n            ? qfeval(,x,y)\n            %6 = 8\n            ? q = matid(#x);\n            ? for(i=1,10^6, qfeval(q,x,y))\n            time = 529 ms.\n            ? for(i=1,10^6, qfeval(,x,y))\n            time = 228 ms.\n            ? for(i=1,10^6, x~*y)\n            time = 274 ms.\n        \n        We also allow :literal:`t_MAT`\302\240s of compatible dimensions for :math:`x`,\n        and return :literal:`x~ * q * x` in this case as well:\n        \n        ::\n        \n            ? M = [1,2,3;4,5,6;7,8,9]; qfeval(,M) \\\\ Gram matrix\n            %5 =\n            [66 78 90]\n            \n            [78 93 108]\n            \n            [90 108 126]\n            \n            ? q = [1,2,3;2,2,-1;3,-1,9];\n            ? for(i=1,10^6, qfeval(q,M))\n            time = 2,008 ms.\n            ? for(i=1,10^6, M~*q*M)\n     ""       time = 2,368 ms.\n            \n            ? for(i=1,10^6, qfeval(,M))\n            time = 1,053 ms.\n            ? for(i=1,10^6, M~*M)\n            time = 1,171 ms.\n        \n        If :math:`q` is a :literal:`t_QFI` or :literal:`t_QFR`, it is implicitly converted to the\n        attached symmetric :literal:`t_MAT`. This is done more\n        efficiently than by direct conversion, since we avoid introducing a\n        denominator :math:`2` and rational arithmetic:\n        \n        ::\n        \n            ? q = Qfb(2,3,4); x = [2,3];\n            ? qfeval(q, x)\n            %2 = 62\n            ? Q = Mat(q)\n            %3 =\n             [ 2 3/2]\n            \n             [3/2 4]\n            ? qfeval(Q, x)\n            %4 = 62\n            ? for (i=1, 10^6, qfeval(q,x))\n            time = 758 ms.\n            ? for (i=1, 10^6, qfeval(Q,x))\n            time = 1,110 ms.\n        \n        Finally, when :math:`x` is a :literal:`t_MAT` with :emphasis:`integral` coefficients, we allow\n        a :literal:`t_QFI` or :literal:`t_QFR` for :math:`q` and return the binary\n        quadratic form :math:`q o M`. Again, the conversion to :literal:`t_MAT` is less\n        efficient in this case:\n        \n        ::\n        \n            ? q = Qfb(2,3,4); Q = Mat(q); x = [1,2;3,4];\n            ? qfeval(q, x)\n            %2 = Qfb(47, 134, 96)\n            ? qfeval(Q,x)\n            %3 =\n            [47 67]\n            \n            [67 96]\n            ? for (i=1, 10^6, qfeval(q,x))\n            time = 701 ms.\n            ? for (i=1, 10^6, qfeval(Q,x))\n            time = 1,639 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1499qfeval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfeval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfeval") < 0)) __PYX_ERR(4, 25966, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_q = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfeval", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 25966, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1498qfeval(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_q, __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1498qfeval(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_q;
  int __pyx_v__have_y;
  GEN __pyx_v__q;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("qfeval", 0);
  __Pyx_INCREF(__pyx_v_q);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":26076
 *             time = 1,639 ms.
 *         '''
 *         cdef bint _have_q = (q is not None)             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             q = objtogen(q)
 */
  __pyx_t_1 = (__pyx_v_q != Py_None);
  __pyx_v__have_q = __pyx_t_1;

  /* "cypari/auto_instance.pxi":26077
 *         '''
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         if x is None:
 */
  __pyx_t_1 = (__pyx_v__have_q != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":26078
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 *             q = objtogen(q)             # <<<<<<<<<<<<<<
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26078, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":26077
 *         '''
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         if x is None:
 */
  }

  /* "cypari/auto_instance.pxi":26079
 *         if _have_q:
 *             q = objtogen(q)
 *         if x is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x == Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (unlikely(__pyx_t_3)) {

    /* "cypari/auto_instance.pxi":26080
 *             q = objtogen(q)
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26080, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(4, 26080, __pyx_L1_error)

    /* "cypari/auto_instance.pxi":26079
 *         if _have_q:
 *             q = objtogen(q)
 *         if x is None:             # <<<<<<<<<<<<<<
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 */
  }

  /* "cypari/auto_instance.pxi":26081
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":26082
 *             raise TypeError("missing required argument: 'x'")
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_3 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26083
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_y != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26084
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26084, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":26083
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26085
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = NULL
 *         if _have_q:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 26085, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26086
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _q = NULL             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             _q = (<Gen>q).g
 */
  __pyx_v__q = NULL;

  /* "cypari/auto_instance.pxi":26087
 *         sig_on()
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26088
 *         cdef GEN _q = NULL
 *         if _have_q:
 *             _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
    __pyx_v__q = __pyx_t_5;

    /* "cypari/auto_instance.pxi":26087
 *         sig_on()
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _x = (<Gen>x).g
 */
  }

  /* "cypari/auto_instance.pxi":26089
 *         if _have_q:
 *             _q = (<Gen>q).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_instance.pxi":26090
 *             _q = (<Gen>q).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_instance.pxi":26091
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 */
  __pyx_t_3 = (__pyx_v__have_y != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26092
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_5;

    /* "cypari/auto_instance.pxi":26091
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 */
  }

  /* "cypari/auto_instance.pxi":26093
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfeval0(__pyx_v__q, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":26094
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfgaussred(self, q):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":25966
 *         return new_gen(_ret)
 * 
 *     def qfeval(self, q=None, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluate the quadratic form :math:`q` (given by a symmetric matrix)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26096
 *         return new_gen(_ret)
 * 
 *     def qfgaussred(self, q):             # <<<<<<<<<<<<<<
 *         r'''
 *         decomposition into squares of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1501qfgaussred(PyObject *__pyx_v_self, PyObject *__pyx_v_q); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1500qfgaussred[] = "\n        decomposition into squares of the\n        quadratic form represented by the symmetric matrix :math:`q`. The result is a\n        matrix whose diagonal entries are the coefficients of the squares, and the\n        off-diagonal entries on each line represent the bilinear forms. More\n        precisely, if :math:`(a_{ij})` denotes the output, one has\n        \n        .. MATH::\n        \n            q(x) = \\sum_i a_{ii} (x_i + \\sum_{j != i} a_{ij} x_j)^2\n        \n        ::\n        \n            ? qfgaussred([0,1;1,0])\n            %1 =\n            [1/2 1]\n            \n            [-1 -1/2]\n        \n        This means that :math:`2xy = (1/2)(x+y)^2 - (1/2)(x-y)^2`.\n        Singular matrices are supported, in which case some diagonal coefficients\n        will vanish:\n        \n        ::\n        \n            ? qfgaussred([1,1;1,1])\n            %1 =\n            [1 1]\n            \n            [1 0]\n        \n        This means that :math:`x^2 + 2xy + y^2 = (x+y)^2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1501qfgaussred(PyObject *__pyx_v_self, PyObject *__pyx_v_q) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfgaussred (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1500qfgaussred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_q));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1500qfgaussred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q) {
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfgaussred", 0);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_instance.pxi":26130
 *         This means that :math:`x^2 + 2xy + y^2 = (x+y)^2`.
 *         '''
 *         q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26131
 *         '''
 *         q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = qfgaussred(_q)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26131, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26132
 *         q = objtogen(q)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfgaussred(_q)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26133
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = qfgaussred(_q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfgaussred(__pyx_v__q);

  /* "cypari/auto_instance.pxi":26134
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = qfgaussred(_q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfisom(self, G, H, fl=None, grp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26096
 *         return new_gen(_ret)
 * 
 *     def qfgaussred(self, q):             # <<<<<<<<<<<<<<
 *         r'''
 *         decomposition into squares of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfgaussred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26136
 *         return new_gen(_ret)
 * 
 *     def qfisom(self, G, H, fl=None, grp=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G`, :math:`H` being square and symmetric matrices with integer entries representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1503qfisom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1502qfisom[] = "\n        :math:`G`, :math:`H` being square and symmetric matrices with integer entries representing\n        positive definite quadratic forms, return an invertible matrix :math:`S` such that\n        :math:`G = {^t}S H S`. This defines a isomorphism between the corresponding lattices.\n        Since this requires computing the minimal vectors, the computations can\n        become very lengthy as the dimension grows.\n        See :literal:`qfisominit` for the meaning of :emphasis:`fl`.\n        If :emphasis:`grp` is given it must be the automorphism group of :math:`H`. It will be used\n        to speed up the computation.\n        \n        :math:`G` can also be given by an :literal:`qfisominit` structure which is preferable if\n        several forms :math:`H` need to be compared to :math:`G`.\n        \n        This function implements an algorithm of Plesken and Souvignier, following\n        Souvignier's implementation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1503qfisom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_v_fl = 0;
  PyObject *__pyx_v_grp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfisom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_H,&__pyx_n_s_fl,&__pyx_n_s_grp,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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_G)) != 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_H)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfisom", 0, 2, 4, 1); __PYX_ERR(4, 26136, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          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_grp);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfisom") < 0)) __PYX_ERR(4, 26136, __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);
        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_G = values[0];
    __pyx_v_H = values[1];
    __pyx_v_fl = values[2];
    __pyx_v_grp = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfisom", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26136, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfisom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1502qfisom(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_H, __pyx_v_fl, __pyx_v_grp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1502qfisom(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_H, PyObject *__pyx_v_fl, PyObject *__pyx_v_grp) {
  int __pyx_v__have_fl;
  int __pyx_v__have_grp;
  GEN __pyx_v__G;
  GEN __pyx_v__H;
  GEN __pyx_v__fl;
  GEN __pyx_v__grp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfisom", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_H);
  __Pyx_INCREF(__pyx_v_fl);
  __Pyx_INCREF(__pyx_v_grp);

  /* "cypari/auto_instance.pxi":26153
 *         Souvignier's implementation.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         H = objtogen(H)
 *         cdef bint _have_fl = (fl is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26154
 *         '''
 *         G = objtogen(G)
 *         H = objtogen(H)             # <<<<<<<<<<<<<<
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26155
 *         G = objtogen(G)
 *         H = objtogen(H)
 *         cdef bint _have_fl = (fl is not None)             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             fl = objtogen(fl)
 */
  __pyx_t_2 = (__pyx_v_fl != Py_None);
  __pyx_v__have_fl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":26156
 *         H = objtogen(H)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26157
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 *             fl = objtogen(fl)             # <<<<<<<<<<<<<<
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26157, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":26156
 *         H = objtogen(H)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 */
  }

  /* "cypari/auto_instance.pxi":26158
 *         if _have_fl:
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)             # <<<<<<<<<<<<<<
 *         if _have_grp:
 *             grp = objtogen(grp)
 */
  __pyx_t_2 = (__pyx_v_grp != Py_None);
  __pyx_v__have_grp = __pyx_t_2;

  /* "cypari/auto_instance.pxi":26159
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             grp = objtogen(grp)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_grp != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26160
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:
 *             grp = objtogen(grp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_grp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26160, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_grp, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":26159
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             grp = objtogen(grp)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26161
 *         if _have_grp:
 *             grp = objtogen(grp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _H = (<Gen>H).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 26161, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26162
 *             grp = objtogen(grp)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_instance.pxi":26163
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
  __pyx_v__H = __pyx_t_4;

  /* "cypari/auto_instance.pxi":26164
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 */
  __pyx_v__fl = NULL;

  /* "cypari/auto_instance.pxi":26165
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26166
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 *             _fl = (<Gen>fl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _grp = NULL
 *         if _have_grp:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fl)->__pyx_base.g;
    __pyx_v__fl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26165
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 */
  }

  /* "cypari/auto_instance.pxi":26167
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL             # <<<<<<<<<<<<<<
 *         if _have_grp:
 *             _grp = (<Gen>grp).g
 */
  __pyx_v__grp = NULL;

  /* "cypari/auto_instance.pxi":26168
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 */
  __pyx_t_2 = (__pyx_v__have_grp != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26169
 *         cdef GEN _grp = NULL
 *         if _have_grp:
 *             _grp = (<Gen>grp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_grp)->__pyx_base.g;
    __pyx_v__grp = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26168
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 */
  }

  /* "cypari/auto_instance.pxi":26170
 *         if _have_grp:
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfisom0(__pyx_v__G, __pyx_v__H, __pyx_v__fl, __pyx_v__grp);

  /* "cypari/auto_instance.pxi":26171
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfisominit(self, G, fl=None, m=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26136
 *         return new_gen(_ret)
 * 
 *     def qfisom(self, G, H, fl=None, grp=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G`, :math:`H` being square and symmetric matrices with integer entries representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfisom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XDECREF(__pyx_v_fl);
  __Pyx_XDECREF(__pyx_v_grp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26173
 *         return new_gen(_ret)
 * 
 *     def qfisominit(self, G, fl=None, m=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1505qfisominit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1504qfisominit[] = "\n        :math:`G` being a square and symmetric matrix with integer entries representing a\n        positive definite quadratic form, return an :literal:`isom` structure allowing to\n        compute isomorphisms between :math:`G` and other quadratic forms faster.\n        \n        The interface of this function is experimental and will likely change in future\n        release.\n        \n        If present, the optional parameter :emphasis:`fl` must be a :literal:`t_VEC` with two\n        components. It allows to specify the invariants used, which can make the\n        computation faster or slower. The components are\n        \n        - :literal:`fl[1]` Depth of scalar product combination to use.\n        \n        - :literal:`fl[2]` Maximum level of Bacher polynomials to use.\n        \n        If present, :math:`m` must be the set of vectors of norm up to the maximal of the\n        diagonal entry of :math:`G`, either as a matrix or as given by :literal:`qfminim`.\n        Otherwise this function computes the minimal vectors so it become very\n        lengthy as the dimension of :math:`G` grows.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1505qfisominit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_fl = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfisominit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_fl,&__pyx_n_s_m,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_G)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfisominit") < 0)) __PYX_ERR(4, 26173, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_G = values[0];
    __pyx_v_fl = values[1];
    __pyx_v_m = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfisominit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26173, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfisominit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1504qfisominit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_fl, __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1504qfisominit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_fl, PyObject *__pyx_v_m) {
  int __pyx_v__have_fl;
  int __pyx_v__have_m;
  GEN __pyx_v__G;
  GEN __pyx_v__fl;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfisominit", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_fl);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":26195
 *         lengthy as the dimension of :math:`G` grows.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26196
 *         '''
 *         G = objtogen(G)
 *         cdef bint _have_fl = (fl is not None)             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             fl = objtogen(fl)
 */
  __pyx_t_2 = (__pyx_v_fl != Py_None);
  __pyx_v__have_fl = __pyx_t_2;

  /* "cypari/auto_instance.pxi":26197
 *         G = objtogen(G)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26198
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 *             fl = objtogen(fl)             # <<<<<<<<<<<<<<
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":26197
 *         G = objtogen(G)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 */
  }

  /* "cypari/auto_instance.pxi":26199
 *         if _have_fl:
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             m = objtogen(m)
 */
  __pyx_t_2 = (__pyx_v_m != Py_None);
  __pyx_v__have_m = __pyx_t_2;

  /* "cypari/auto_instance.pxi":26200
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_m != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26201
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 *             m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":26200
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26202
 *         if _have_m:
 *             m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 26202, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26203
 *             m = objtogen(m)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_instance.pxi":26204
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 */
  __pyx_v__fl = NULL;

  /* "cypari/auto_instance.pxi":26205
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26206
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 *             _fl = (<Gen>fl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = NULL
 *         if _have_m:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fl)->__pyx_base.g;
    __pyx_v__fl = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26205
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 */
  }

  /* "cypari/auto_instance.pxi":26207
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             _m = (<Gen>m).g
 */
  __pyx_v__m = NULL;

  /* "cypari/auto_instance.pxi":26208
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 */
  __pyx_t_2 = (__pyx_v__have_m != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26209
 *         cdef GEN _m = NULL
 *         if _have_m:
 *             _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
    __pyx_v__m = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26208
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 */
  }

  /* "cypari/auto_instance.pxi":26210
 *         if _have_m:
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfisominit0(__pyx_v__G, __pyx_v__fl, __pyx_v__m);

  /* "cypari/auto_instance.pxi":26211
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfjacobi(self, A, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26173
 *         return new_gen(_ret)
 * 
 *     def qfisominit(self, G, fl=None, m=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfisominit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_fl);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26213
 *         return new_gen(_ret)
 * 
 *     def qfjacobi(self, A, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply Jacobi's eigenvalue algorithm to the real symmetric matrix :math:`A`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1507qfjacobi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1506qfjacobi[] = "\n        Apply Jacobi's eigenvalue algorithm to the real symmetric matrix :math:`A`.\n        This returns :math:`[L, V]`, where\n        \n        - :math:`L` is the vector of (real) eigenvalues of :math:`A`, sorted in increasing\n          order,\n        \n        - :math:`V` is the corresponding orthogonal matrix of eigenvectors of :math:`A`.\n        \n        ::\n        \n            ? \\p19\n            ? A = [1,2;2,1]; mateigen(A)\n            %1 =\n            [-1 1]\n            \n            [ 1 1]\n            ? [L, H] = qfjacobi(A);\n            ? L\n            %3 = [-1.000000000000000000, 3.000000000000000000]~\n            ? H\n            %4 =\n            [ 0.7071067811865475245 0.7071067811865475244]\n            \n            [-0.7071067811865475244 0.7071067811865475245]\n            ? norml2( (A-L[1])*H[,1] ) \\\\ approximate eigenvector\n            %5 = 9.403954806578300064 E-38\n            ? norml2(H*H~ - 1)\n            %6 = 2.350988701644575016 E-38 \\\\ close to orthogonal\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1507qfjacobi(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfjacobi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_precision,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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfjacobi") < 0)) __PYX_ERR(4, 26213, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26213, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfjacobi", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfjacobi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1506qfjacobi(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_A, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1506qfjacobi(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_A, long __pyx_v_precision) {
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfjacobi", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":26244
 *             %6 = 2.350988701644575016 E-38 \\ close to orthogonal
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26245
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26245, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26246
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jacobi(_A, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26247
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jacobi(_A, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":26248
 *         cdef GEN _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jacobi(_A, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jacobi(__pyx_v__A, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":26249
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jacobi(_A, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qflll(self, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26213
 *         return new_gen(_ret)
 * 
 *     def qfjacobi(self, A, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply Jacobi's eigenvalue algorithm to the real symmetric matrix :math:`A`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfjacobi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26251
 *         return new_gen(_ret)
 * 
 *     def qflll(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL algorithm applied to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1509qflll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1508qflll[] = "\n        LLL algorithm applied to the\n        :emphasis:`columns` of the matrix :math:`x`. The columns of :math:`x` may be linearly\n        dependent. The result is a unimodular transformation matrix :math:`T` such that :math:`x\n        .T` is an LLL-reduced basis of the lattice generated by the column\n        vectors of :math:`x`. Note that if :math:`x` is not of maximal rank :math:`T` will not be\n        square. The LLL parameters are :math:`(0.51,0.99)`, meaning that the Gram-Schmidt\n        coefficients for the final basis satisfy :math:`\\|\\mu_{i,j}\\| <= 0.51`, and the\n        Lov\303\241sz's constant is :math:`0.99`.\n        \n        If :math:`flag = 0` (default), assume that :math:`x` has either exact (integral or\n        rational) or real floating point entries. The matrix is rescaled, converted\n        to integers and the behavior is then as in :math:`flag = 1`.\n        \n        If :math:`flag = 1`, assume that :math:`x` is integral. Computations involving Gram-Schmidt\n        vectors are approximate, with precision varying as needed (Lehmer's trick,\n        as generalized by Schnorr). Adapted from Nguyen and Stehl\303\251's algorithm\n        and Stehl\303\251's code (:literal:`fplll-1.3`).\n        \n        If :math:`flag = 2`, :math:`x` should be an integer matrix whose columns are linearly\n        independent. Returns a partially reduced basis for :math:`x`, using an unpublished\n        algorithm by Peter Montgomery: a basis is said to be :emphasis:`partially reduced`\n        if :math:`\\|v_i \302\261 v_j\\| >= \\|v_i\\|` for any two distinct basis vectors :math:`v_i,\n        v_j`.\n        \n        This is faster than :math:`flag = 1`, esp. when one row is huge compared\n        to the other rows (knapsack-style), and should quickly produce relatively\n        short vectors. The resulting basis is :emphasis:`not` LLL-reduced in general.\n        If LLL reduction is eventually desired, avoid this partial reduction:\n        apply""ing LLL to the partially reduced matrix is significantly :emphasis:`slower`\n        than starting from a knapsack-type lattice.\n        \n        If :math:`flag = 4`, as :math:`flag = 1`, returning a vector :math:`[K, T]` of matrices: the\n        columns of :math:`K` represent a basis of the integer kernel of :math:`x`\n        (not LLL-reduced in general) and :math:`T` is the transformation\n        matrix such that :math:`x.T` is an LLL-reduced :math:`\\mathbb{Z}`-basis of the image\n        of the matrix :math:`x`.\n        \n        If :math:`flag = 5`, case as case :math:`4`, but :math:`x` may have polynomial coefficients.\n        \n        If :math:`flag = 8`, same as case :math:`0`, but :math:`x` may have polynomial coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1509qflll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qflll (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qflll") < 0)) __PYX_ERR(4, 26251, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26251, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qflll", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26251, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qflll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1508qflll(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1508qflll(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qflll", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":26294
 *         If :math:`flag = 8`, same as case :math:`0`, but :math:`x` may have polynomial coefficients.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26295
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qflll0(_x, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26295, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26296
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qflll0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26297
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qflll0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qflll0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":26298
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qflll0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qflllgram(self, G, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26251
 *         return new_gen(_ret)
 * 
 *     def qflll(self, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL algorithm applied to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qflll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26300
 *         return new_gen(_ret)
 * 
 *     def qflllgram(self, G, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`qflll`, except that the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1511qflllgram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1510qflllgram[] = "\n        Same as :literal:`qflll`, except that the\n        matrix :math:`G = x~ * x` is the Gram matrix of some lattice vectors :math:`x`,\n        and not the coordinates of the vectors themselves. In particular, :math:`G` must\n        now be a square symmetric real matrix, corresponding to a positive\n        quadratic form (not necessarily definite: :math:`x` needs not have maximal rank).\n        The result is a unimodular\n        transformation matrix :math:`T` such that :math:`x.T` is an LLL-reduced basis of\n        the lattice generated by the column vectors of :math:`x`. See :literal:`qflll` for\n        further details about the LLL implementation.\n        \n        If :math:`flag = 0` (default), assume that :math:`G` has either exact (integral or\n        rational) or real floating point entries. The matrix is rescaled, converted\n        to integers and the behavior is then as in :math:`flag = 1`.\n        \n        If :math:`flag = 1`, assume that :math:`G` is integral. Computations involving Gram-Schmidt\n        vectors are approximate, with precision varying as needed (Lehmer's trick,\n        as generalized by Schnorr). Adapted from Nguyen and Stehl\303\251's algorithm\n        and Stehl\303\251's code (:literal:`fplll-1.3`).\n        \n        :math:`flag = 4`: :math:`G` has integer entries, gives the kernel and reduced image of :math:`x`.\n        \n        :math:`flag = 5`: same as :math:`4`, but :math:`G` may have polynomial coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1511qflllgram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qflllgram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_flag,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_G)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qflllgram") < 0)) __PYX_ERR(4, 26300, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_G = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26300, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qflllgram", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1510qflllgram(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1510qflllgram(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, long __pyx_v_flag) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qflllgram", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":26325
 *         :math:`flag = 5`: same as :math:`4`, but :math:`G` may have polynomial coefficients.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26326
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qflllgram0(_G, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26326, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26327
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qflllgram0(_G, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26328
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qflllgram0(_G, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qflllgram0(__pyx_v__G, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":26329
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qflllgram0(_G, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfminim(self, x, b=None, m=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26300
 *         return new_gen(_ret)
 * 
 *     def qflllgram(self, G, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`qflll`, except that the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26331
 *         return new_gen(_ret)
 * 
 *     def qfminim(self, x, b=None, m=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a square and symmetric matrix representing a positive definite
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1513qfminim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1512qfminim[] = "\n        :math:`x` being a square and symmetric matrix representing a positive definite\n        quadratic form, this function deals with the vectors of :math:`x` whose norm is\n        less than or equal to :math:`b`, enumerated using the Fincke-Pohst algorithm,\n        storing at most :math:`m` vectors (no limit if :math:`m` is omitted). The function\n        searches for the minimal non-zero vectors if :math:`b` is omitted. The behavior is\n        undefined if :math:`x` is not positive definite (a \"precision too low\" error is\n        most likely, although more precise error messages are possible). The precise\n        behavior depends on :math:`flag`.\n        \n        If :math:`flag = 0` (default), returns at most :math:`2m` vectors. The result is a\n        three-component vector, the first component being the number of vectors\n        enumerated (which may be larger than :math:`2m`), the second being the maximum\n        norm found, and the last vector\n        is a matrix whose columns are found vectors, only one being given for each\n        pair :math:`\302\261 v` (at most :math:`m` such pairs, unless :math:`m` was omitted). The vectors\n        are returned in no particular order.\n        \n        If :math:`flag = 1`, ignores :math:`m` and returns :math:`[N,v]`, where :math:`v` is a non-zero vector\n        of length :math:`N <= b`, or :math:`[]` if no non-zero vector has length :math:`<= b`.\n        If no explicit :math:`b` is provided, return a vector of smallish norm\n        (smallest vector in an LLL-reduced basis).\n        \n        In these two cases, :math:`x` must have :emphasis:`integral` entries. The\n        implementation uses low precision floating point computations for maximal\n        speed, which gives incorrect result when :math:`x` has large entries. (The\n        condition is checked in the code and the routine raises an error if\n        large rounding errors occur.) A more robust, but much slower,\n        implementation ""is chosen if the following flag is used:\n        \n        If :math:`flag = 2`, :math:`x` can have non integral real entries. In this case, if :math:`b`\n        is omitted, the \"minimal\" vectors only have approximately the same norm.\n        If :math:`b` is omitted, :math:`m` is an upper bound for the number of vectors that\n        will be stored and returned, but all minimal vectors are nevertheless\n        enumerated. If :math:`m` is omitted, all vectors found are stored and returned;\n        note that this may be a huge vector!\n        \n        ::\n        \n            ? x = matid(2);\n            ? qfminim(x) \\\\ 4 minimal vectors of norm 1: \302\261[0,1], \302\261[1,0]\n            %2 = [4, 1, [0, 1; 1, 0]]\n            ? { x =\n            [4, 2, 0, 0, 0,-2, 0, 0, 0, 0, 0, 0, 1,-1, 0, 0, 0, 1, 0,-1, 0, 0, 0,-2;\n             2, 4,-2,-2, 0,-2, 0, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 0,-1, 0, 1,-1,-1;\n             0,-2, 4, 0,-2, 0, 0, 0, 0, 0, 0, 0,-1, 1, 0, 0, 1, 0, 0, 1,-1,-1, 0, 0;\n             0,-2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1,-1, 0, 0, 0, 1,-1, 0, 1,-1, 1, 0;\n             0, 0,-2, 0, 4, 0, 0, 0, 1,-1, 0, 0, 1, 0, 0, 0,-2, 0, 0,-1, 1, 1, 0, 0;\n            -2, -2,0, 0, 0, 4,-2, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,-1, 1, 1;\n             0, 0, 0, 0, 0,-2, 4,-2, 0, 0, 0, 0, 0, 1, 0, 0, 0,-1, 0, 0, 0, 1,-1, 0;\n             0, 0, 0, 0, 0, 0,-2, 4, 0, 0, 0, 0,-1, 0, 0, 0, 0, 0,-1,-1,-1, 0, 1, 0;\n             0, 0, 0, 0, 1,-1, 0, 0, 4, 0,-2, 0, 1, 1, 0,-1, 0, 1, 0, 0, 0, 0, 0, 0;\n             0, 0, 0, 0,-1, 0, 0, 0, 0, 4, 0, 0, 1, 1,-1, 1, 0, 0, 0, 1, 0, 0, 1, 0;\n             0, 0, 0, 0, 0, 0, 0, 0,-2, 0, 4,-2, 0,-1, 0, 0, 0,-1, 0,-1, 0, 0, 0, 0;\n             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 4,-1, 1, 0, 0,-1, 1, 0, 1, 1, 1,-1, 0;\n             1, 0,-1, 1, 1, 0, 0,-1, 1, 1, 0,-1, 4, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1,-1;\n            -1,-1, 1,-1, 0, 0, 1, 0, 1, 1,-1, 1, 0, 4, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1;\n             0, 0, 0, 0, 0, 0, 0, 0, 0,-""1, 0, 0, 0, 1, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0;\n             0, 0, 0, 0, 0, 0, 0, 0,-1, 1, 0, 0, 1, 1, 0, 4, 0, 0, 0, 0, 1, 1, 0, 0;\n             0, 0, 1, 0,-2, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 4, 1, 1, 1, 0, 0, 1, 1;\n             1, 0, 0, 1, 0, 0,-1, 0, 1, 0,-1, 1, 1, 0, 0, 0, 1, 4, 0, 1, 1, 0, 1, 0;\n             0, 0, 0,-1, 0, 1, 0,-1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 4, 0, 1, 1, 0, 1;\n            -1, -1,1, 0,-1, 1, 0,-1, 0, 1,-1, 1, 0, 1, 0, 0, 1, 1, 0, 4, 0, 0, 1, 1;\n             0, 0,-1, 1, 1, 0, 0,-1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 4, 1, 0, 1;\n             0, 1,-1,-1, 1,-1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 4, 0, 1;\n             0,-1, 0, 1, 0, 1,-1, 1, 0, 1, 0,-1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 4, 1;\n            -2,-1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,-1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 4]; }\n            ? qfminim(x,,0) \\\\ the Leech lattice has 196560 minimal vectors of norm 4\n            time = 648 ms.\n            %4 = [196560, 4, [;]]\n            ? qfminim(x,,0,2); \\\\ safe algorithm. Slower and unnecessary here.\n            time = 18,161 ms.\n            %5 = [196560, 4.000061035156250000, [;]]\n        \n        In the last example, we store 0 vectors to limit memory use. All minimal\n        vectors are nevertheless enumerated. Provided :literal:`parisize` is about 50MB,\n        :literal:`qfminim(x)` succeeds in 2.5 seconds.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1513qfminim(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_m = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfminim (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_b,&__pyx_n_s_m,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          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_flag);
          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_precision);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfminim") < 0)) __PYX_ERR(4, 26331, __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);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_b = values[1];
    __pyx_v_m = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26331, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[4]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26331, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfminim", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfminim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1512qfminim(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_b, __pyx_v_m, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1512qfminim(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_b, PyObject *__pyx_v_m, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_b;
  int __pyx_v__have_m;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfminim", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":26410
 *         :literal:`qfminim(x)` succeeds in 2.5 seconds.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26411
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_2 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_2;

  /* "cypari/auto_instance.pxi":26412
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26413
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":26412
 *         x = objtogen(x)
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 */
  }

  /* "cypari/auto_instance.pxi":26414
 *         if _have_b:
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             m = objtogen(m)
 */
  __pyx_t_2 = (__pyx_v_m != Py_None);
  __pyx_v__have_m = __pyx_t_2;

  /* "cypari/auto_instance.pxi":26415
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_m != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26416
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 *             m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":26415
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26417
 *         if _have_m:
 *             m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 26417, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26418
 *             m = objtogen(m)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":26419
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_instance.pxi":26420
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 */
  __pyx_t_2 = (__pyx_v__have_b != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26421
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = NULL
 *         if _have_m:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26420
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 */
  }

  /* "cypari/auto_instance.pxi":26422
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             _m = (<Gen>m).g
 */
  __pyx_v__m = NULL;

  /* "cypari/auto_instance.pxi":26423
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_m != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26424
 *         cdef GEN _m = NULL
 *         if _have_m:
 *             _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
    __pyx_v__m = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26423
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":26425
 *         if _have_m:
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":26426
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfminim0(__pyx_v__x, __pyx_v__b, __pyx_v__m, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":26427
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfnorm(self, x, q=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26331
 *         return new_gen(_ret)
 * 
 *     def qfminim(self, x, b=None, m=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a square and symmetric matrix representing a positive definite
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfminim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26429
 *         return new_gen(_ret)
 * 
 *     def qfnorm(self, x, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1515qfnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1514qfnorm[] = "\n        This function is obsolete, use :literal:`qfeval`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1515qfnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_q,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfnorm") < 0)) __PYX_ERR(4, 26429, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_q = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfnorm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26429, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1514qfnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1514qfnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_q) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_q;
  GEN __pyx_v__x;
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("qfnorm", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_instance.pxi":26433
 *         This function is obsolete, use :literal:`qfeval`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26433, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":26434
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_q = (q is not None)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":26435
 *         from warnings import warn
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":26436
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 *         cdef bint _have_q = (q is not None)             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             q = objtogen(q)
 */
  __pyx_t_3 = (__pyx_v_q != Py_None);
  __pyx_v__have_q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26437
 *         x = objtogen(x)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26438
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 *             q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":26437
 *         x = objtogen(x)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26439
 *         if _have_q:
 *             q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 26439, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26440
 *             q = objtogen(q)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _q = NULL
 *         if _have_q:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_instance.pxi":26441
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             _q = (<Gen>q).g
 */
  __pyx_v__q = NULL;

  /* "cypari/auto_instance.pxi":26442
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26443
 *         cdef GEN _q = NULL
 *         if _have_q:
 *             _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfnorm(_x, _q)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
    __pyx_v__q = __pyx_t_5;

    /* "cypari/auto_instance.pxi":26442
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)
 */
  }

  /* "cypari/auto_instance.pxi":26444
 *         if _have_q:
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfnorm(__pyx_v__x, __pyx_v__q);

  /* "cypari/auto_instance.pxi":26445
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qforbits(self, G, V):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26429
 *         return new_gen(_ret)
 * 
 *     def qfnorm(self, x, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26447
 *         return new_gen(_ret)
 * 
 *     def qforbits(self, G, V):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the orbits of :math:`V` under the action of the group
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1517qforbits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1516qforbits[] = "\n        Return the orbits of :math:`V` under the action of the group\n        of linear transformation generated by the set :math:`G`.\n        It is assumed that :math:`G` contains minus identity, and only one vector\n        in :math:`{v, -v}` should be given.\n        If :math:`G` does not stabilize :math:`V`, the function return :math:`0`.\n        \n        In the example below, we compute representatives and lengths of the orbits of\n        the vectors of norm :math:`<= 3` under the automorphisms of the lattice :math:`A_1^6`.\n        \n        ::\n        \n            ? Q=matid(6); G=qfauto(Q); V=qfminim(Q,3);\n            ? apply(x->[x[1],#x],qforbits(G,V))\n            %2 = [[[0,0,0,0,0,1]~,6],[[0,0,0,0,1,-1]~,30],[[0,0,0,1,-1,-1]~,80]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1517qforbits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_V = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qforbits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_V,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_G)) != 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_V)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qforbits", 1, 2, 2, 1); __PYX_ERR(4, 26447, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qforbits") < 0)) __PYX_ERR(4, 26447, __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_G = values[0];
    __pyx_v_V = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qforbits", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26447, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qforbits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1516qforbits(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_V);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1516qforbits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_V) {
  GEN __pyx_v__G;
  GEN __pyx_v__V;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qforbits", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_V);

  /* "cypari/auto_instance.pxi":26464
 *             %2 = [[[0,0,0,0,0,1]~,6],[[0,0,0,0,1,-1]~,30],[[0,0,0,1,-1,-1]~,80]]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         V = objtogen(V)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26465
 *         '''
 *         G = objtogen(G)
 *         V = objtogen(V)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_V, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_V, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26466
 *         G = objtogen(G)
 *         V = objtogen(V)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26466, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26467
 *         V = objtogen(V)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = qforbits(_G, _V)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26468
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qforbits(_G, _V)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26469
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = qforbits(_G, _V)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qforbits(__pyx_v__G, __pyx_v__V);

  /* "cypari/auto_instance.pxi":26470
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = qforbits(_G, _V)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfparam(self, G, sol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26447
 *         return new_gen(_ret)
 * 
 *     def qforbits(self, G, V):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the orbits of :math:`V` under the action of the group
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qforbits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26472
 *         return new_gen(_ret)
 * 
 *     def qfparam(self, G, sol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of binary quadratic forms that parametrize the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1519qfparam(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1518qfparam[] = "\n        Coefficients of binary quadratic forms that parametrize the\n        solutions of the ternary quadratic form :math:`G`, using the particular\n        solution\302\240:emphasis:`sol`.\n        :emphasis:`flag` is optional and can be 1, 2, or 3, in which case the :emphasis:`flag`-th form is\n        reduced. The default is :emphasis:`flag` = 0 (no reduction).\n        \n        ::\n        \n            ? G = [1,0,0;0,1,0;0,0,-34];\n            ? M = qfparam(G, qfsolve(G))\n            %2 =\n            [ 3 -10 -3]\n            \n            [-5 -6 5]\n            \n            [ 1 0 1]\n        \n        Indeed, the solutions can be parametrized as\n        \n        .. MATH::\n        \n            (3x^2 - 10xy - 3y^2)^2 + (-5x^2 - 6xy + 5y^2)^2 -34(x^2 + y^2)^2 = 0.\n        \n        ::\n        \n            ? v = y^2 * M*[1,x/y,(x/y)^2]~\n            %3 = [3*x^2 - 10*y*x - 3*y^2, -5*x^2 - 6*y*x + 5*y^2, -x^2 - y^2]~\n            ? v~*G*v\n            %4 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1519qfparam(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_sol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfparam (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_sol,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G)) != 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_sol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfparam", 0, 2, 3, 1); __PYX_ERR(4, 26472, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfparam") < 0)) __PYX_ERR(4, 26472, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_G = values[0];
    __pyx_v_sol = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26472, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfparam", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26472, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1518qfparam(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_sol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1518qfparam(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_sol, long __pyx_v_flag) {
  GEN __pyx_v__G;
  GEN __pyx_v__sol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfparam", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_sol);

  /* "cypari/auto_instance.pxi":26504
 *             %4 = 0
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sol = objtogen(sol)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26505
 *         '''
 *         G = objtogen(G)
 *         sol = objtogen(sol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26506
 *         G = objtogen(G)
 *         sol = objtogen(sol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _sol = (<Gen>sol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26506, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26507
 *         sol = objtogen(sol)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sol = (<Gen>sol).g
 *         cdef GEN _ret = qfparam(_G, _sol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26508
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _sol = (<Gen>sol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfparam(_G, _sol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sol)->__pyx_base.g;
  __pyx_v__sol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26509
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _sol = (<Gen>sol).g
 *         cdef GEN _ret = qfparam(_G, _sol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfparam(__pyx_v__G, __pyx_v__sol, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":26510
 *         cdef GEN _sol = (<Gen>sol).g
 *         cdef GEN _ret = qfparam(_G, _sol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfperfection(self, G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26472
 *         return new_gen(_ret)
 * 
 *     def qfparam(self, G, sol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of binary quadratic forms that parametrize the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_sol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26512
 *         return new_gen(_ret)
 * 
 *     def qfperfection(self, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1521qfperfection(PyObject *__pyx_v_self, PyObject *__pyx_v_G); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1520qfperfection[] = "\n        :math:`G` being a square and symmetric matrix with\n        integer entries representing a positive definite quadratic form, outputs the\n        perfection rank of the form. That is, gives the rank of the family of the :math:`s`\n        symmetric matrices :math:`v_iv_i^t`, where :math:`s` is half the number of minimal\n        vectors and the :math:`v_i` (:math:`1 <= i <= s`) are the minimal vectors.\n        \n        Since this requires computing the minimal vectors, the computations can\n        become very lengthy as the dimension of :math:`x` grows.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1521qfperfection(PyObject *__pyx_v_self, PyObject *__pyx_v_G) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfperfection (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1520qfperfection(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_G));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1520qfperfection(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfperfection", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":26523
 *         become very lengthy as the dimension of :math:`x` grows.
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26524
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = perf(_G)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26524, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26525
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = perf(_G)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26526
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = perf(_G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = perf(__pyx_v__G);

  /* "cypari/auto_instance.pxi":26527
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = perf(_G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfrep(self, q, B, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26512
 *         return new_gen(_ret)
 * 
 *     def qfperfection(self, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfperfection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26529
 *         return new_gen(_ret)
 * 
 *     def qfrep(self, q, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`q` being a square and symmetric matrix with integer entries representing a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1523qfrep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1522qfrep[] = "\n        :math:`q` being a square and symmetric matrix with integer entries representing a\n        positive definite quadratic form, count the vectors representing successive\n        integers.\n        \n        - If :math:`flag = 0`, count all vectors. Outputs the vector whose :math:`i`-th\n          entry, :math:`1 <= i <= B` is half the number of vectors :math:`v` such that :math:`q(v) = i`.\n        \n        - If :math:`flag = 1`, count vectors of even norm. Outputs the vector\n          whose :math:`i`-th entry, :math:`1 <= i <= B` is half the number of vectors such\n          that :math:`q(v) = 2i`.\n        \n        ::\n        \n            ? q = [2, 1; 1, 3];\n            ? qfrep(q, 5)\n            %2 = Vecsmall([0, 1, 2, 0, 0]) \\\\ 1 vector of norm 2, 2 of norm 3, etc.\n            ? qfrep(q, 5, 1)\n            %3 = Vecsmall([1, 0, 0, 1, 0]) \\\\ 1 vector of norm 2, 0 of norm 4, etc.\n        \n        This routine uses a naive algorithm based on :literal:`qfminim`, and\n        will fail if any entry becomes larger than :math:`2^{31}` (or :math:`2^{63}`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1523qfrep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_v_B = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfrep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,&__pyx_n_s_B,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfrep", 0, 2, 3, 1); __PYX_ERR(4, 26529, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfrep") < 0)) __PYX_ERR(4, 26529, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_q = values[0];
    __pyx_v_B = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26529, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfrep", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26529, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfrep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1522qfrep(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_q, __pyx_v_B, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1522qfrep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, PyObject *__pyx_v_B, long __pyx_v_flag) {
  GEN __pyx_v__q;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfrep", 0);
  __Pyx_INCREF(__pyx_v_q);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":26553
 *         will fail if any entry becomes larger than :math:`2^{31}` (or :math:`2^{63}`).
 *         '''
 *         q = objtogen(q)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26554
 *         '''
 *         q = objtogen(q)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26555
 *         q = objtogen(q)
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26555, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26556
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = qfrep0(_q, _B, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26557
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfrep0(_q, _B, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26558
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = qfrep0(_q, _B, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfrep0(__pyx_v__q, __pyx_v__B, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":26559
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = qfrep0(_q, _B, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfsign(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26559, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26529
 *         return new_gen(_ret)
 * 
 *     def qfrep(self, q, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`q` being a square and symmetric matrix with integer entries representing a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfrep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26561
 *         return new_gen(_ret)
 * 
 *     def qfsign(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[p,m]` the signature of the quadratic form represented by the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1525qfsign(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1524qfsign[] = "\n        Returns :math:`[p,m]` the signature of the quadratic form represented by the\n        symmetric matrix :math:`x`. Namely, :math:`p` (resp.\302\240:math:`m`) is the number of positive\n        (resp.\302\240negative) eigenvalues of :math:`x`. The result is computed using Gaussian\n        reduction.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1525qfsign(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfsign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1524qfsign(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1524qfsign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfsign", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":26568
 *         reduction.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26569
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfsign(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26569, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26570
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfsign(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26571
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfsign(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfsign(__pyx_v__x);

  /* "cypari/auto_instance.pxi":26572
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfsign(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfsolve(self, G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26572, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26561
 *         return new_gen(_ret)
 * 
 *     def qfsign(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[p,m]` the signature of the quadratic form represented by the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26574
 *         return new_gen(_ret)
 * 
 *     def qfsolve(self, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a square symmetric matrix :math:`G` of dimension :math:`n >= 1`, solve over
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1527qfsolve(PyObject *__pyx_v_self, PyObject *__pyx_v_G); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1526qfsolve[] = "\n        Given a square symmetric matrix :math:`G` of dimension :math:`n >= 1`, solve over\n        :math:`\\mathbb{Q}` the quadratic equation :math:`X^tGX = 0`. The matrix :math:`G` must have rational\n        coefficients. The solution might be a single non-zero vector (vectorv) or a\n        matrix (whose columns generate a totally isotropic subspace).\n        \n        If no solution exists, returns an integer, that can be a prime :math:`p` such that\n        there is no local solution at :math:`p`, or :math:`-1` if there is no real solution,\n        or :math:`-2` if :math:`n = 2` and :math:`-\\det G` is positive but not a square (which implies\n        there is a real solution, but no local solution at some :math:`p` dividing :math:`\\det G`).\n        \n        ::\n        \n            ? G = [1,0,0;0,1,0;0,0,-34];\n            ? qfsolve(G)\n            %1 = [-3, -5, 1]~\n            ? qfsolve([1,0; 0,2])\n            %2 = -1 \\\\ no real solution\n            ? qfsolve([1,0,0;0,3,0; 0,0,-2])\n            %3 = 3 \\\\ no solution in Q_3\n            ? qfsolve([1,0; 0,-2])\n            %4 = -2 \\\\ no solution, n = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1527qfsolve(PyObject *__pyx_v_self, PyObject *__pyx_v_G) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfsolve (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1526qfsolve(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_G));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1526qfsolve(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfsolve", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_instance.pxi":26598
 *             %4 = -2 \\ no solution, n = 2
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26599
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qfsolve(_G)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26599, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26600
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfsolve(_G)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26601
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qfsolve(_G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfsolve(__pyx_v__G);

  /* "cypari/auto_instance.pxi":26602
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qfsolve(_G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadclassunit(self, D, long flag=0, tech=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26574
 *         return new_gen(_ret)
 * 
 *     def qfsolve(self, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a square symmetric matrix :math:`G` of dimension :math:`n >= 1`, solve over
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.qfsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26604
 *         return new_gen(_ret)
 * 
 *     def quadclassunit(self, D, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Buchmann-McCurley's sub-exponential algorithm for computing the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1529quadclassunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1528quadclassunit[] = "\n        Buchmann-McCurley's sub-exponential algorithm for computing the\n        class group of a quadratic order of discriminant :math:`D`.\n        \n        This function should be used instead of :literal:`qfbclassno` or :literal:`quadregula`\n        when :math:`D < -10^{25}`, :math:`D > 10^{10}`, or when the :emphasis:`structure` is wanted. It\n        is a special case of :literal:`bnfinit`, which is slower, but more robust.\n        \n        The result is a vector :math:`v` whose components should be accessed using member\n        functions:\n        \n        - :literal:`:math:`v`.no`: the class number\n        \n        - :literal:`:math:`v`.cyc`: a vector giving the structure of the class group as a\n          product of cyclic groups;\n        \n        - :literal:`:math:`v`.gen`: a vector giving generators of those cyclic groups (as\n          binary quadratic forms).\n        \n        - :literal:`:math:`v`.reg`: the regulator, computed to an accuracy which is the\n          maximum of an internal accuracy determined by the program and the current\n          default (note that once the regulator is known to a small accuracy it is\n          trivial to compute it to very high accuracy, see the tutorial).\n        \n        The :math:`flag` is obsolete and should be left alone. In older versions,\n        it supposedly computed the narrow class group when :math:`D > 0`, but this did not\n        work at all; use the general function :literal:`bnfnarrow`.\n        \n        Optional parameter :emphasis:`tech` is a row vector of the form :math:`[c_1, c_2]`,\n        where :math:`c_1 <= c_2` are non-negative real numbers which control the execution\n        time and the stack size, see ``GRHbnf`` (in the PARI manual). The parameter is used as a\n        threshold to balance the relation finding phase against the final linear\n        algebra. Increasing the default :math:`c_1` means that relations are easier\n        to find, but more relations are neede""d and the linear algebra will be\n        harder. The default value for :math:`c_1` is :math:`0` and means that it is taken equal\n        to :math:`c_2`. The parameter :math:`c_2` is mostly obsolete and should not be changed,\n        but we still document it for completeness: we compute a tentative class\n        group by generators and relations using a factorbase of prime ideals\n        :math:`<= c_1 (\\log \\|D\\|)^2`, then prove that ideals of norm\n        :math:`<= c_2 (\\log \\|D\\|)^2` do\n        not generate a larger group. By default an optimal :math:`c_2` is chosen, so that\n        the result is provably correct under the GRH --- a famous result of Bach\n        states that :math:`c_2 = 6` is fine, but it is possible to improve on this\n        algorithmically. You may provide a smaller :math:`c_2`, it will be ignored\n        (we use the provably correct\n        one); you may provide a larger :math:`c_2` than the default value, which results\n        in longer computing times for equally correct outputs (under GRH).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1529quadclassunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_tech = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadclassunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_flag,&__pyx_n_s_tech,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tech);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadclassunit") < 0)) __PYX_ERR(4, 26604, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26604, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_tech = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26604, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadclassunit", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26604, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadclassunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1528quadclassunit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_flag, __pyx_v_tech, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1528quadclassunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision) {
  int __pyx_v__have_tech;
  GEN __pyx_v__D;
  GEN __pyx_v__tech;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("quadclassunit", 0);
  __Pyx_INCREF(__pyx_v_D);
  __Pyx_INCREF(__pyx_v_tech);

  /* "cypari/auto_instance.pxi":26653
 *         in longer computing times for equally correct outputs (under GRH).
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26654
 *         '''
 *         D = objtogen(D)
 *         cdef bint _have_tech = (tech is not None)             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             tech = objtogen(tech)
 */
  __pyx_t_2 = (__pyx_v_tech != Py_None);
  __pyx_v__have_tech = __pyx_t_2;

  /* "cypari/auto_instance.pxi":26655
 *         D = objtogen(D)
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_tech != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26656
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:
 *             tech = objtogen(tech)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tech, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_tech, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":26655
 *         D = objtogen(D)
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26657
 *         if _have_tech:
 *             tech = objtogen(tech)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 26657, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26658
 *             tech = objtogen(tech)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_4;

  /* "cypari/auto_instance.pxi":26659
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 */
  __pyx_v__tech = NULL;

  /* "cypari/auto_instance.pxi":26660
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_tech != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26661
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 *             _tech = (<Gen>tech).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tech)->__pyx_base.g;
    __pyx_v__tech = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26660
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":26662
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":26663
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadclassunit0(__pyx_v__D, __pyx_v_flag, __pyx_v__tech, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":26664
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quaddisc(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26604
 *         return new_gen(_ret)
 * 
 *     def quadclassunit(self, D, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Buchmann-McCurley's sub-exponential algorithm for computing the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadclassunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XDECREF(__pyx_v_tech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26666
 *         return new_gen(_ret)
 * 
 *     def quaddisc(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the tale algebra :math:`\mathbb{Q} (\sqrt{x})`, where :math:`x\in\mathbb{Q}^*`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1531quaddisc(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1530quaddisc[] = "\n        Discriminant of the \303\251tale algebra :math:`\\mathbb{Q} (\\sqrt{x})`, where :math:`x\\in\\mathbb{Q}^*`.\n        This is the same as :literal:`coredisc`:math:`(d)` where :math:`d` is the integer square-free\n        part of :math:`x`, so x = :math:`d f^2` with :math:`f\\in \\mathbb{Q}^*` and :math:`d\\in\\mathbb{Z}`.\n        This returns :math:`0` for :math:`x = 0`, :math:`1` for :math:`x` square and the discriminant of the\n        quadratic field :math:`\\mathbb{Q} (\\sqrt{x})` otherwise.\n        \n        ::\n        \n            ? quaddisc(7)\n            %1 = 28\n            ? quaddisc(-7)\n            %2 = -7\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1531quaddisc(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quaddisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1530quaddisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1530quaddisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("quaddisc", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":26681
 *             %2 = -7
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26681, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26682
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = quaddisc(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26682, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26683
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quaddisc(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26684
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = quaddisc(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quaddisc(__pyx_v__x);

  /* "cypari/auto_instance.pxi":26685
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = quaddisc(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadgen(self, D, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26666
 *         return new_gen(_ret)
 * 
 *     def quaddisc(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the tale algebra :math:`\mathbb{Q} (\sqrt{x})`, where :math:`x\in\mathbb{Q}^*`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quaddisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26687
 *         return new_gen(_ret)
 * 
 *     def quadgen(self, D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the quadratic number :math:`\omega = (a+\sqrt{D})/2` where
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1533quadgen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1532quadgen[] = "\n        Creates the quadratic number :math:`\\omega = (a+\\sqrt{D})/2` where\n        :math:`a = 0` if :math:`D = 0 mod 4`,\n        :math:`a = 1` if :math:`D = 1 mod 4`, so that :math:`(1,\\omega)` is an integral basis for the\n        quadratic order of discriminant :math:`D`. :math:`D` must be an integer congruent to 0 or\n        1 modulo 4, which is not a square.\n        If :emphasis:`v` is given, the variable name is used to display :math:`g` else 'w' is used.\n        \n        ::\n        \n            ? w = quadgen(5, 'w); w^2 - w - 1\n            %1 = 0\n            ? w = quadgen(0, 'w)\n             *** at top-level: w=quadgen(0)\n             *** ^----------\n             *** quadgen: domain error in quadpoly: issquare(disc) = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1533quadgen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadgen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadgen") < 0)) __PYX_ERR(4, 26687, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadgen", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26687, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1532quadgen(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1532quadgen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("quadgen", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":26705
 *              *** quadgen: domain error in quadpoly: issquare(disc) = 1
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26706
 *         '''
 *         D = objtogen(D)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":26707
 *         D = objtogen(D)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26708
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 26708, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26707
 *         D = objtogen(D)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26709
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadgen0(_D, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 26709, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26710
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadgen0(_D, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_6;

  /* "cypari/auto_instance.pxi":26711
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadgen0(_D, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadgen0(__pyx_v__D, __pyx_v__v);

  /* "cypari/auto_instance.pxi":26712
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadgen0(_D, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadhilbert(self, D, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26687
 *         return new_gen(_ret)
 * 
 *     def quadgen(self, D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the quadratic number :math:`\omega = (a+\sqrt{D})/2` where
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26714
 *         return new_gen(_ret)
 * 
 *     def quadhilbert(self, D, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation defining the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1535quadhilbert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1534quadhilbert[] = "\n        Relative equation defining the\n        Hilbert class field of the quadratic field of discriminant :math:`D`.\n        \n        If :math:`D < 0`, uses complex multiplication (Schertz's variant).\n        \n        If :math:`D > 0` Stark units are used and (in rare cases) a\n        vector of extensions may be returned whose compositum is the requested class\n        field. See :literal:`bnrstark` for details.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1535quadhilbert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadhilbert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_precision,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_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadhilbert") < 0)) __PYX_ERR(4, 26714, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26714, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadhilbert", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26714, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1534quadhilbert(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1534quadhilbert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, long __pyx_v_precision) {
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("quadhilbert", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":26725
 *         field. See :literal:`bnrstark` for details.
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26726
 *         '''
 *         D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26726, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26727
 *         D = objtogen(D)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadhilbert(_D, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26728
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadhilbert(_D, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":26729
 *         cdef GEN _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadhilbert(_D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadhilbert(__pyx_v__D, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":26730
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadhilbert(_D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadpoly(self, D, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26714
 *         return new_gen(_ret)
 * 
 *     def quadhilbert(self, D, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation defining the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26732
 *         return new_gen(_ret)
 * 
 *     def quadpoly(self, D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the "canonical" quadratic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1537quadpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1536quadpoly[] = "\n        Creates the \"canonical\" quadratic\n        polynomial (in the variable :math:`v`) corresponding to the discriminant :math:`D`,\n        i.e.\302\240the minimal polynomial of :math:`quadgen (D)`. :math:`D` must be an integer\n        congruent to 0 or 1 modulo 4, which is not a square.\n        \n        ::\n        \n            ? quadpoly(5,'y)\n            %1 = y^2 - y - 1\n            ? quadpoly(0,'y)\n             *** at top-level: quadpoly(0,'y)\n             *** ^--------------\n             *** quadpoly: domain error in quadpoly: issquare(disc) = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1537quadpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadpoly") < 0)) __PYX_ERR(4, 26732, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadpoly", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26732, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1536quadpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1536quadpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("quadpoly", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":26748
 *              *** quadpoly: domain error in quadpoly: issquare(disc) = 1
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26749
 *         '''
 *         D = objtogen(D)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":26750
 *         D = objtogen(D)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26751
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 26751, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26750
 *         D = objtogen(D)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26752
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadpoly0(_D, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 26752, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26753
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadpoly0(_D, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_6;

  /* "cypari/auto_instance.pxi":26754
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadpoly0(_D, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadpoly0(__pyx_v__D, __pyx_v__v);

  /* "cypari/auto_instance.pxi":26755
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadpoly0(_D, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadray(self, D, f, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26732
 *         return new_gen(_ret)
 * 
 *     def quadpoly(self, D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the "canonical" quadratic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26757
 *         return new_gen(_ret)
 * 
 *     def quadray(self, D, f, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation for the ray
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1539quadray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1538quadray[] = "\n        Relative equation for the ray\n        class field of conductor :math:`f` for the quadratic field of discriminant :math:`D`\n        using analytic methods. A :literal:`bnf` for :math:`x^2 - D` is also accepted in place\n        of :math:`D`.\n        \n        For :math:`D < 0`, uses the :math:`\\sigma` function and Schertz's method.\n        \n        For :math:`D > 0`, uses Stark's conjecture, and a vector of relative equations may be\n        returned. See :literal:`bnrstark` for more details.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1539quadray(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_v_f = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_f,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D)) != 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_f)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("quadray", 0, 2, 3, 1); __PYX_ERR(4, 26757, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadray") < 0)) __PYX_ERR(4, 26757, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_D = values[0];
    __pyx_v_f = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26757, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadray", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26757, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1538quadray(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_f, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1538quadray(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_f, long __pyx_v_precision) {
  GEN __pyx_v__D;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("quadray", 0);
  __Pyx_INCREF(__pyx_v_D);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":26769
 *         returned. See :literal:`bnrstark` for more details.
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         f = objtogen(f)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26770
 *         '''
 *         D = objtogen(D)
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26771
 *         D = objtogen(D)
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26771, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26772
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26773
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadray(_D, _f, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26774
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _f = (<Gen>f).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadray(_D, _f, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":26775
 *         cdef GEN _f = (<Gen>f).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadray(_D, _f, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadray(__pyx_v__D, __pyx_v__f, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":26776
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadray(_D, _f, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadregulator(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26757
 *         return new_gen(_ret)
 * 
 *     def quadray(self, D, f, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation for the ray
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26778
 *         return new_gen(_ret)
 * 
 *     def quadregulator(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Regulator of the quadratic field of positive discriminant :math:`x`. Returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1541quadregulator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1540quadregulator[] = "\n        Regulator of the quadratic field of positive discriminant :math:`x`. Returns\n        an error if :math:`x` is not a discriminant (fundamental or not) or if :math:`x` is a\n        square. See also :literal:`quadclassunit` if :math:`x` is large.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1541quadregulator(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadregulator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadregulator") < 0)) __PYX_ERR(4, 26778, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 26778, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadregulator", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26778, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1540quadregulator(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1540quadregulator(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("quadregulator", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":26784
 *         square. See also :literal:`quadclassunit` if :math:`x` is large.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26785
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26785, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26786
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadregulator(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26787
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadregulator(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":26788
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadregulator(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadregulator(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":26789
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadregulator(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadunit(self, D, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26778
 *         return new_gen(_ret)
 * 
 *     def quadregulator(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Regulator of the quadratic field of positive discriminant :math:`x`. Returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26791
 *         return new_gen(_ret)
 * 
 *     def quadunit(self, D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fundamental unit :math:`u` of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1543quadunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1542quadunit[] = "\n        Fundamental unit :math:`u` of the\n        real quadratic field :math:`\\mathbb{Q} (\\sqrt D)` where :math:`D` is the positive discriminant\n        of the field. If :math:`D` is not a fundamental discriminant, this probably gives\n        the fundamental unit of the corresponding order. :math:`D` must be an integer\n        congruent to 0 or 1 modulo 4, which is not a square; the result is a\n        quadratic number (see ``quadgen`` (in the PARI manual)).\n        If :emphasis:`v` is given, the variable name is used to display :math:`u`\n        else 'w' is used.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1543quadunit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadunit") < 0)) __PYX_ERR(4, 26791, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadunit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26791, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1542quadunit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_D, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1542quadunit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("quadunit", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":26802
 *         else 'w' is used.
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26803
 *         '''
 *         D = objtogen(D)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":26804
 *         D = objtogen(D)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":26805
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 26805, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26804
 *         D = objtogen(D)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26806
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadunit0(_D, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 26806, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26807
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadunit0(_D, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_6;

  /* "cypari/auto_instance.pxi":26808
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadunit0(_D, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadunit0(__pyx_v__D, __pyx_v__v);

  /* "cypari/auto_instance.pxi":26809
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadunit0(_D, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ramanujantau(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26791
 *         return new_gen(_ret)
 * 
 *     def quadunit(self, D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fundamental unit :math:`u` of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.quadunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26811
 *         return new_gen(_ret)
 * 
 *     def ramanujantau(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of Ramanujan's tau function at an individual :math:`n`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1545ramanujantau(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1544ramanujantau[] = "\n        Compute the value of Ramanujan's tau function at an individual :math:`n`,\n        assuming the truth of the GRH (to compute quickly class numbers of imaginary\n        quadratic fields using :literal:`quadclassunit`).\n        Algorithm in :math:`~{O}(n^{1/2})` using :math:`O(\\log n)` space. If all values up\n        to :math:`N` are required, then\n        \n        .. MATH::\n        \n            \\sum \\tau (n)q^n = q \\prod_{n >= 1} (1-q^n)^{24}\n        \n        will produce them in time :math:`~{O}(N)`, against :math:`~{O}(N^{3/2})` for\n        individual calls to :literal:`ramanujantau`; of course the space complexity then\n        becomes :math:`~{O}(N)`.\n        \n        ::\n        \n            ? tauvec(N) = Vec(q*eta(q + O(q^N))^24);\n            ? N = 10^4; v = tauvec(N);\n            time = 26 ms.\n            ? ramanujantau(N)\n            %3 = -482606811957501440000\n            ? w = vector(N, n, ramanujantau(n)); \\\\ much slower !\n            time = 13,190 ms.\n            ? v == w\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1545ramanujantau(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ramanujantau (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1544ramanujantau(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1544ramanujantau(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ramanujantau", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":26839
 *             %4 = 1
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":26840
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ramanujantau(_n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 26840, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26841
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ramanujantau(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":26842
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ramanujantau(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ramanujantau(__pyx_v__n);

  /* "cypari/auto_instance.pxi":26843
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ramanujantau(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def random(self, N=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 26843, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26811
 *         return new_gen(_ret)
 * 
 *     def ramanujantau(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of Ramanujan's tau function at an individual :math:`n`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.ramanujantau", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26845
 *         return new_gen(_ret)
 * 
 *     def random(self, N=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a random element in various natural sets depending on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1547random(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1546random[] = "\n        Returns a random element in various natural sets depending on the\n        argument :math:`N`.\n        \n        - :literal:`t_INT`: returns an integer\n          uniformly distributed between :math:`0` and :math:`N-1`. Omitting the argument\n          is equivalent to :literal:`random(2^31)`.\n        \n        - :literal:`t_REAL`: returns a real number in :math:`[0,1[` with the same accuracy as\n          :math:`N` (whose mantissa has the same number of significant words).\n        \n        - :literal:`t_INTMOD`: returns a random intmod for the same modulus.\n        \n        - :literal:`t_FFELT`: returns a random element in the same finite field.\n        \n        - :literal:`t_VEC` of length :math:`2`, :math:`N = [a,b]`: returns an integer uniformly\n          distributed between :math:`a` and :math:`b`.\n        \n        - :literal:`t_VEC` generated by :literal:`ellinit` over a finite field :math:`k`\n          (coefficients are :literal:`t_INTMOD`\302\240s modulo a prime or :literal:`t_FFELT`\302\240s): returns a\n          \"random\" :math:`k`-rational :emphasis:`affine` point on the curve. More precisely\n          if the curve has a single point (at infinity!) we return it; otherwise\n          we return an affine point by drawing an abscissa uniformly at\n          random until :literal:`ellordinate` succeeds. Note that this is definitely not a\n          uniform distribution over :math:`E(k)`, but it should be good enough for\n          applications.\n        \n        - :literal:`t_POL` return a random polynomial of degree at most the degree of :math:`N`.\n          The coefficients are drawn by applying :literal:`random` to the leading\n          coefficient of :math:`N`.\n        \n        ::\n        \n            ? random(10)\n            %1 = 9\n            ? random(Mod(0,7))\n            %2 = Mod(1, 7)\n            ? a = ffgen(ffinit(3,7), 'a); random(a)\n            %3 = a^6 + 2*a^5 + a^4 + a^3 + a^2 + 2*a\n            ? E = ellinit""([3,7]*Mod(1,109)); random(E)\n            %4 = [Mod(103, 109), Mod(10, 109)]\n            ? E = ellinit([1,7]*a^0); random(E)\n            %5 = [a^6 + a^5 + 2*a^4 + 2*a^2, 2*a^6 + 2*a^4 + 2*a^3 + a^2 + 2*a]\n            ? random(Mod(1,7)*x^4)\n            %6 = Mod(5, 7)*x^4 + Mod(6, 7)*x^3 + Mod(2, 7)*x^2 + Mod(2, 7)*x + Mod(5, 7)\n            \n        \n        These variants all depend on a single internal generator, and are\n        independent from your operating system's random number generators.\n        A random seed may be obtained via :literal:`getrand`, and reset\n        using :literal:`setrand`: from a given seed, and given sequence of :literal:`random`\302\240s,\n        the exact same values will be generated. The same seed is used at each\n        startup, reseed the generator yourself if this is a problem. Note that\n        internal functions also call the random number generator; adding such a\n        function call in the middle of your code will change the numbers produced.\n        \n        :strong:`Technical note.`\n        Up to\n        version 2.4 included, the internal generator produced pseudo-random numbers\n        by means of linear congruences, which were not well distributed in arithmetic\n        progressions. We now\n        use Brent's XORGEN algorithm, based on Feedback Shift Registers, see\n        :literal:`http://wwwmaths.anu.edu.au/~brent/random.html`. The generator has period\n        :math:`2^{4096}-1`, passes the Crush battery of statistical tests of L'Ecuyer and\n        Simard, but is not suitable for cryptographic purposes: one can reconstruct\n        the state vector from a small sample of consecutive values, thus predicting\n        the entire sequence.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1547random(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("random (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "random") < 0)) __PYX_ERR(4, 26845, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("random", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26845, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.random", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1546random(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1546random(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N) {
  int __pyx_v__have_N;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("random", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":26914
 *         the entire sequence.
 *         '''
 *         cdef bint _have_N = (N is not None)             # <<<<<<<<<<<<<<
 *         if _have_N:
 *             N = objtogen(N)
 */
  __pyx_t_1 = (__pyx_v_N != Py_None);
  __pyx_v__have_N = __pyx_t_1;

  /* "cypari/auto_instance.pxi":26915
 *         '''
 *         cdef bint _have_N = (N is not None)
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             N = objtogen(N)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_N != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":26916
 *         cdef bint _have_N = (N is not None)
 *         if _have_N:
 *             N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26916, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":26915
 *         '''
 *         cdef bint _have_N = (N is not None)
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             N = objtogen(N)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26917
 *         if _have_N:
 *             N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = NULL
 *         if _have_N:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 26917, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26918
 *             N = objtogen(N)
 *         sig_on()
 *         cdef GEN _N = NULL             # <<<<<<<<<<<<<<
 *         if _have_N:
 *             _N = (<Gen>N).g
 */
  __pyx_v__N = NULL;

  /* "cypari/auto_instance.pxi":26919
 *         sig_on()
 *         cdef GEN _N = NULL
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = genrand(_N)
 */
  __pyx_t_1 = (__pyx_v__have_N != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":26920
 *         cdef GEN _N = NULL
 *         if _have_N:
 *             _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = genrand(_N)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
    __pyx_v__N = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26919
 *         sig_on()
 *         cdef GEN _N = NULL
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = genrand(_N)
 */
  }

  /* "cypari/auto_instance.pxi":26921
 *         if _have_N:
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = genrand(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = genrand(__pyx_v__N);

  /* "cypari/auto_instance.pxi":26922
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = genrand(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def randomprime(self, N=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26845
 *         return new_gen(_ret)
 * 
 *     def random(self, N=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a random element in various natural sets depending on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.random", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26924
 *         return new_gen(_ret)
 * 
 *     def randomprime(self, N=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a strong pseudo prime (see :literal:`ispseudoprime`) in :math:`[2,N-1]`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1549randomprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1548randomprime[] = "\n        Returns a strong pseudo prime (see :literal:`ispseudoprime`) in :math:`[2,N-1]`.\n        A :literal:`t_VEC` :math:`N = [a,b]` is also allowed, with :math:`a <= b` in which case a\n        pseudo prime :math:`a <= p <= b` is returned; if no prime exists in the\n        interval, the function will run into an infinite loop. If the upper bound\n        is less than :math:`2^{64}` the pseudo prime returned is a proven prime.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1549randomprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("randomprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "randomprime") < 0)) __PYX_ERR(4, 26924, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("randomprime", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26924, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.randomprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1548randomprime(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_N);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1548randomprime(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_N) {
  int __pyx_v__have_N;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("randomprime", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":26932
 *         is less than :math:`2^{64}` the pseudo prime returned is a proven prime.
 *         '''
 *         cdef bint _have_N = (N is not None)             # <<<<<<<<<<<<<<
 *         if _have_N:
 *             N = objtogen(N)
 */
  __pyx_t_1 = (__pyx_v_N != Py_None);
  __pyx_v__have_N = __pyx_t_1;

  /* "cypari/auto_instance.pxi":26933
 *         '''
 *         cdef bint _have_N = (N is not None)
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             N = objtogen(N)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_N != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":26934
 *         cdef bint _have_N = (N is not None)
 *         if _have_N:
 *             N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":26933
 *         '''
 *         cdef bint _have_N = (N is not None)
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             N = objtogen(N)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":26935
 *         if _have_N:
 *             N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = NULL
 *         if _have_N:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 26935, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26936
 *             N = objtogen(N)
 *         sig_on()
 *         cdef GEN _N = NULL             # <<<<<<<<<<<<<<
 *         if _have_N:
 *             _N = (<Gen>N).g
 */
  __pyx_v__N = NULL;

  /* "cypari/auto_instance.pxi":26937
 *         sig_on()
 *         cdef GEN _N = NULL
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = randomprime(_N)
 */
  __pyx_t_1 = (__pyx_v__have_N != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":26938
 *         cdef GEN _N = NULL
 *         if _have_N:
 *             _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = randomprime(_N)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
    __pyx_v__N = __pyx_t_4;

    /* "cypari/auto_instance.pxi":26937
 *         sig_on()
 *         cdef GEN _N = NULL
 *         if _have_N:             # <<<<<<<<<<<<<<
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = randomprime(_N)
 */
  }

  /* "cypari/auto_instance.pxi":26939
 *         if _have_N:
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = randomprime(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = randomprime(__pyx_v__N);

  /* "cypari/auto_instance.pxi":26940
 *             _N = (<Gen>N).g
 *         cdef GEN _ret = randomprime(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def read(self, filename=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 26940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26924
 *         return new_gen(_ret)
 * 
 *     def randomprime(self, N=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a strong pseudo prime (see :literal:`ispseudoprime`) in :math:`[2,N-1]`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.randomprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26942
 *         return new_gen(_ret)
 * 
 *     def read(self, filename=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads in the file
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1551read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1550read[] = "\n        Reads in the file\n        :emphasis:`filename` (subject to string expansion). If :emphasis:`filename` is\n        omitted, re-reads the last file that was fed into :literal:`gp`. The return\n        value is the result of the last expression evaluated.\n        \n        If a GP :literal:`binary file` is read using this command (see\n        ``writebin`` (in the PARI manual)), the file is loaded and the last object in the file\n        is returned.\n        \n        In case the file you read in contains an :literal:`allocatemem` statement (to be\n        generally avoided), you should leave :literal:`read` instructions by themselves,\n        and not part of larger instruction sequences.\n        \n        :strong:`Variants.` :literal:`readvec` allows to read a whole file at once;\n        :literal:`fileopen` followed by either :literal:`fileread` (evaluated lines) or\n        :literal:`filereadstr` (lines as non-evaluated strings) allows to read a file\n        one line at a time.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1551read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("read (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(4, 26942, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26942, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1550read(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1550read(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename) {
  char *__pyx_v__filename;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("read", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "cypari/auto_instance.pxi":26963
 *         '''
 *         cdef char* _filename
 *         if filename is None:             # <<<<<<<<<<<<<<
 *             _filename = ""
 *         else:
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26964
 *         cdef char* _filename
 *         if filename is None:
 *             _filename = ""             # <<<<<<<<<<<<<<
 *         else:
 *             filename = to_bytes(filename)
 */
    __pyx_v__filename = ((char *)"");

    /* "cypari/auto_instance.pxi":26963
 *         '''
 *         cdef char* _filename
 *         if filename is None:             # <<<<<<<<<<<<<<
 *             _filename = ""
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/auto_instance.pxi":26966
 *             _filename = ""
 *         else:
 *             filename = to_bytes(filename)             # <<<<<<<<<<<<<<
 *             _filename = <bytes>filename
 *         sig_on()
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 26966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/auto_instance.pxi":26967
 *         else:
 *             filename = to_bytes(filename)
 *             _filename = <bytes>filename             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = gp_read_file(_filename)
 */
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 26967, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(4, 26967, __pyx_L1_error)
    __pyx_v__filename = __pyx_t_4;
  }
  __pyx_L3:;

  /* "cypari/auto_instance.pxi":26968
 *             filename = to_bytes(filename)
 *             _filename = <bytes>filename
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gp_read_file(_filename)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 26968, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26969
 *             _filename = <bytes>filename
 *         sig_on()
 *         cdef GEN _ret = gp_read_file(_filename)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gp_read_file(__pyx_v__filename);

  /* "cypari/auto_instance.pxi":26970
 *         sig_on()
 *         cdef GEN _ret = gp_read_file(_filename)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def readstr(self, filename=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 26970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26942
 *         return new_gen(_ret)
 * 
 *     def read(self, filename=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads in the file
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26972
 *         return new_gen(_ret)
 * 
 *     def readstr(self, filename=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads in the file :emphasis:`filename` and return a vector of GP strings,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1553readstr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1552readstr[] = "\n        Reads in the file :emphasis:`filename` and return a vector of GP strings,\n        each component containing one line from the file. If :emphasis:`filename` is\n        omitted, re-reads the last file that was fed into :literal:`gp`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1553readstr(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("readstr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "readstr") < 0)) __PYX_ERR(4, 26972, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("readstr", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26972, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.readstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1552readstr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1552readstr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename) {
  char *__pyx_v__filename;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("readstr", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "cypari/auto_instance.pxi":26979
 *         '''
 *         cdef char* _filename
 *         if filename is None:             # <<<<<<<<<<<<<<
 *             _filename = ""
 *         else:
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":26980
 *         cdef char* _filename
 *         if filename is None:
 *             _filename = ""             # <<<<<<<<<<<<<<
 *         else:
 *             filename = to_bytes(filename)
 */
    __pyx_v__filename = ((char *)"");

    /* "cypari/auto_instance.pxi":26979
 *         '''
 *         cdef char* _filename
 *         if filename is None:             # <<<<<<<<<<<<<<
 *             _filename = ""
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/auto_instance.pxi":26982
 *             _filename = ""
 *         else:
 *             filename = to_bytes(filename)             # <<<<<<<<<<<<<<
 *             _filename = <bytes>filename
 *         sig_on()
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 26982, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/auto_instance.pxi":26983
 *         else:
 *             filename = to_bytes(filename)
 *             _filename = <bytes>filename             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = readstr(_filename)
 */
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 26983, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(4, 26983, __pyx_L1_error)
    __pyx_v__filename = __pyx_t_4;
  }
  __pyx_L3:;

  /* "cypari/auto_instance.pxi":26984
 *             filename = to_bytes(filename)
 *             _filename = <bytes>filename
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = readstr(_filename)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 26984, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":26985
 *             _filename = <bytes>filename
 *         sig_on()
 *         cdef GEN _ret = readstr(_filename)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = readstr(__pyx_v__filename);

  /* "cypari/auto_instance.pxi":26986
 *         sig_on()
 *         cdef GEN _ret = readstr(_filename)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def readvec(self, filename=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 26986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26972
 *         return new_gen(_ret)
 * 
 *     def readstr(self, filename=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads in the file :emphasis:`filename` and return a vector of GP strings,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.readstr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":26988
 *         return new_gen(_ret)
 * 
 *     def readvec(self, filename=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads in the file
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1555readvec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1554readvec[] = "\n        Reads in the file\n        :emphasis:`filename` (subject to string expansion). If :emphasis:`filename` is\n        omitted, re-reads the last file that was fed into :literal:`gp`. The return\n        value is a vector whose components are the evaluation of all sequences\n        of instructions contained in the file. For instance, if :emphasis:`file` contains\n        \n        ::\n        \n            1\n            2\n            3\n        \n        then we will get:\n        \n        ::\n        \n            ? \\r a\n            %1 = 1\n            %2 = 2\n            %3 = 3\n            ? read(a)\n            %4 = 3\n            ? readvec(a)\n            %5 = [1, 2, 3]\n        \n        In general a sequence is just a single line, but as usual braces and\n        :literal:`\\\\` may be used to enter multiline sequences.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1555readvec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("readvec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_filename);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "readvec") < 0)) __PYX_ERR(4, 26988, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("readvec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 26988, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.readvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1554readvec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_filename);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1554readvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename) {
  char *__pyx_v__filename;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("readvec", 0);
  __Pyx_INCREF(__pyx_v_filename);

  /* "cypari/auto_instance.pxi":27019
 *         '''
 *         cdef char* _filename
 *         if filename is None:             # <<<<<<<<<<<<<<
 *             _filename = ""
 *         else:
 */
  __pyx_t_1 = (__pyx_v_filename == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":27020
 *         cdef char* _filename
 *         if filename is None:
 *             _filename = ""             # <<<<<<<<<<<<<<
 *         else:
 *             filename = to_bytes(filename)
 */
    __pyx_v__filename = ((char *)"");

    /* "cypari/auto_instance.pxi":27019
 *         '''
 *         cdef char* _filename
 *         if filename is None:             # <<<<<<<<<<<<<<
 *             _filename = ""
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/auto_instance.pxi":27022
 *             _filename = ""
 *         else:
 *             filename = to_bytes(filename)             # <<<<<<<<<<<<<<
 *             _filename = <bytes>filename
 *         sig_on()
 */
  /*else*/ {
    __pyx_t_3 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_filename); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 27022, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/auto_instance.pxi":27023
 *         else:
 *             filename = to_bytes(filename)
 *             _filename = <bytes>filename             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = gp_readvec_file(_filename)
 */
    if (unlikely(__pyx_v_filename == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(4, 27023, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(4, 27023, __pyx_L1_error)
    __pyx_v__filename = __pyx_t_4;
  }
  __pyx_L3:;

  /* "cypari/auto_instance.pxi":27024
 *             filename = to_bytes(filename)
 *             _filename = <bytes>filename
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gp_readvec_file(_filename)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 27024, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27025
 *             _filename = <bytes>filename
 *         sig_on()
 *         cdef GEN _ret = gp_readvec_file(_filename)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gp_readvec_file(__pyx_v__filename);

  /* "cypari/auto_instance.pxi":27026
 *         sig_on()
 *         cdef GEN _ret = gp_readvec_file(_filename)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def real(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 27026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":26988
 *         return new_gen(_ret)
 * 
 *     def readvec(self, filename=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reads in the file
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.readvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27028
 *         return new_gen(_ret)
 * 
 *     def real(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real part of :math:`x`. In the case where :math:`x` is a quadratic number, this is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1557real(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1556real[] = "\n        Real part of :math:`x`. In the case where :math:`x` is a quadratic number, this is the\n        coefficient of :math:`1` in the \"canonical\" integral basis :math:`(1,\\omega)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1557real(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("real (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1556real(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1556real(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("real", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27033
 *         coefficient of :math:`1` in the "canonical" integral basis :math:`(1,\omega)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27034
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = greal(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27034, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27035
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = greal(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27036
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = greal(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = greal(__pyx_v__x);

  /* "cypari/auto_instance.pxi":27037
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = greal(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def removeprimes(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27028
 *         return new_gen(_ret)
 * 
 *     def real(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real part of :math:`x`. In the case where :math:`x` is a quadratic number, this is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.real", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27039
 *         return new_gen(_ret)
 * 
 *     def removeprimes(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the primes listed in :math:`x` from
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1559removeprimes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1558removeprimes[] = "\n        Removes the primes listed in :math:`x` from\n        the prime number table. In particular :literal:`removeprimes(addprimes())` empties\n        the extra prime table. :math:`x` can also be a single integer. List the current\n        extra primes if :math:`x` is omitted.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1559removeprimes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("removeprimes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "removeprimes") < 0)) __PYX_ERR(4, 27039, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("removeprimes", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27039, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.removeprimes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1558removeprimes(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1558removeprimes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("removeprimes", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27046
 *         extra primes if :math:`x` is omitted.
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":27047
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":27048
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 27048, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":27047
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":27049
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 27049, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27050
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":27051
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = removeprimes(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":27052
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = removeprimes(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":27051
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = removeprimes(_x)
 */
  }

  /* "cypari/auto_instance.pxi":27053
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = removeprimes(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = removeprimes(__pyx_v__x);

  /* "cypari/auto_instance.pxi":27054
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = removeprimes(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfalgtobasis(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 27054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27039
 *         return new_gen(_ret)
 * 
 *     def removeprimes(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the primes listed in :math:`x` from
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.removeprimes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27056
 *         return new_gen(_ret)
 * 
 *     def rnfalgtobasis(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expresses :math:`x` on the relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1561rnfalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1560rnfalgtobasis[] = "\n        Expresses :math:`x` on the relative\n        integral basis. Here, :math:`rnf` is a relative number field extension :math:`L/K`\n        as output by :literal:`rnfinit`, and :math:`x` an element of :math:`L` in absolute form, i.e.\n        expressed as a polynomial or polmod with polmod coefficients, :emphasis:`not` on\n        the relative integral basis.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1561rnfalgtobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfalgtobasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfalgtobasis", 1, 2, 2, 1); __PYX_ERR(4, 27056, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfalgtobasis") < 0)) __PYX_ERR(4, 27056, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfalgtobasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27056, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1560rnfalgtobasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1560rnfalgtobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27064
 *         the relative integral basis.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27065
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27066
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27066, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27067
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27068
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27069
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfalgtobasis(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27070
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfbasis(self, bnf, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27056
 *         return new_gen(_ret)
 * 
 *     def rnfalgtobasis(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expresses :math:`x` on the relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27072
 *         return new_gen(_ret)
 * 
 *     def rnfbasis(self, bnf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` the field represented by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1563rnfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1562rnfbasis[] = "\n        Let :math:`K` the field represented by\n        :emphasis:`bnf`, as output by :literal:`bnfinit`. :math:`M` is a projective :math:`\\mathbb{Z}_K`-module\n        of rank :math:`n` (:math:`M\\otimes K` is an :math:`n`-dimensional :math:`K`-vector space), given by a\n        pseudo-basis of size :math:`n`. The routine returns either a true :math:`\\mathbb{Z}_K`-basis of\n        :math:`M` (of size :math:`n`) if it exists, or an :math:`n+1`-element generating set of :math:`M` if\n        not.\n        \n        It is allowed to use a monic irreducible polynomial :math:`P` in :math:`K[X]` instead of\n        :math:`M`, in which case, :math:`M` is defined as the ring of integers of :math:`K[X]/(P)`,\n        viewed as a :math:`\\mathbb{Z}_K`-module.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1563rnfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfbasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_M,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_bnf)) != 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_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfbasis", 1, 2, 2, 1); __PYX_ERR(4, 27072, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfbasis") < 0)) __PYX_ERR(4, 27072, __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_bnf = values[0];
    __pyx_v_M = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfbasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27072, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1562rnfbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_M);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1562rnfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_M) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfbasis", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":27085
 *         viewed as a :math:`\mathbb{Z}_K`-module.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         M = objtogen(M)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27086
 *         '''
 *         bnf = objtogen(bnf)
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27087
 *         bnf = objtogen(bnf)
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27087, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27088
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfbasis(_bnf, _M)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27089
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfbasis(_bnf, _M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27090
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfbasis(_bnf, _M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfbasis(__pyx_v__bnf, __pyx_v__M);

  /* "cypari/auto_instance.pxi":27091
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfbasis(_bnf, _M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfbasistoalg(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27072
 *         return new_gen(_ret)
 * 
 *     def rnfbasis(self, bnf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` the field represented by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27093
 *         return new_gen(_ret)
 * 
 *     def rnfbasistoalg(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the representation of :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1565rnfbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1564rnfbasistoalg[] = "\n        Computes the representation of :math:`x`\n        as a polmod with polmods coefficients. Here, :math:`rnf` is a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit`, and :math:`x` an element of\n        :math:`L` expressed on the relative integral basis.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1565rnfbasistoalg(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfbasistoalg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfbasistoalg", 1, 2, 2, 1); __PYX_ERR(4, 27093, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfbasistoalg") < 0)) __PYX_ERR(4, 27093, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfbasistoalg", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27093, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1564rnfbasistoalg(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1564rnfbasistoalg(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27100
 *         :math:`L` expressed on the relative integral basis.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27101
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27102
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27102, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27103
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27104
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27105
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfbasistoalg(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27106
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfcharpoly(self, nf, T, a, var=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27093
 *         return new_gen(_ret)
 * 
 *     def rnfbasistoalg(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the representation of :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27108
 *         return new_gen(_ret)
 * 
 *     def rnfcharpoly(self, nf, T, a, var=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Characteristic polynomial of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1567rnfcharpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1566rnfcharpoly[] = "\n        Characteristic polynomial of\n        :math:`a` over :math:`nf`, where :math:`a` belongs to the algebra defined by :math:`T` over\n        :math:`nf`, i.e.\302\240:math:`nf[X]/(T)`. Returns a polynomial in variable :math:`v`\n        (:math:`x` by default).\n        \n        ::\n        \n            ? nf = nfinit(y^2+1);\n            ? rnfcharpoly(nf, x^2+y*x+1, x+y)\n            %2 = x^2 + Mod(-y, y^2 + 1)*x + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1567rnfcharpoly(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_var = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfcharpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_T,&__pyx_n_s_a,&__pyx_n_s_var,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_nf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfcharpoly", 0, 3, 4, 1); __PYX_ERR(4, 27108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfcharpoly", 0, 3, 4, 2); __PYX_ERR(4, 27108, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_var);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfcharpoly") < 0)) __PYX_ERR(4, 27108, __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_nf = values[0];
    __pyx_v_T = values[1];
    __pyx_v_a = values[2];
    __pyx_v_var = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfcharpoly", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27108, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1566rnfcharpoly(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_T, __pyx_v_a, __pyx_v_var);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1566rnfcharpoly(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_a, PyObject *__pyx_v_var) {
  long __pyx_v__var;
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("rnfcharpoly", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":27121
 *             %2 = x^2 + Mod(-y, y^2 + 1)*x + 1
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         a = objtogen(a)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27122
 *         '''
 *         nf = objtogen(nf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         cdef long _var = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27123
 *         nf = objtogen(nf)
 *         T = objtogen(T)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         cdef long _var = -1
 *         if var is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27124
 *         T = objtogen(T)
 *         a = objtogen(a)
 *         cdef long _var = -1             # <<<<<<<<<<<<<<
 *         if var is not None:
 *             _var = get_var(var)
 */
  __pyx_v__var = -1L;

  /* "cypari/auto_instance.pxi":27125
 *         a = objtogen(a)
 *         cdef long _var = -1
 *         if var is not None:             # <<<<<<<<<<<<<<
 *             _var = get_var(var)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_var != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":27126
 *         cdef long _var = -1
 *         if var is not None:
 *             _var = get_var(var)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_var); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 27126, __pyx_L1_error)
    __pyx_v__var = __pyx_t_4;

    /* "cypari/auto_instance.pxi":27125
 *         a = objtogen(a)
 *         cdef long _var = -1
 *         if var is not None:             # <<<<<<<<<<<<<<
 *             _var = get_var(var)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":27127
 *         if var is not None:
 *             _var = get_var(var)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 27127, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27128
 *             _var = get_var(var)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_6;

  /* "cypari/auto_instance.pxi":27129
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_6;

  /* "cypari/auto_instance.pxi":27130
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_6;

  /* "cypari/auto_instance.pxi":27131
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfcharpoly(__pyx_v__nf, __pyx_v__T, __pyx_v__a, __pyx_v__var);

  /* "cypari/auto_instance.pxi":27132
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfconductor(self, bnf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27108
 *         return new_gen(_ret)
 * 
 *     def rnfcharpoly(self, nf, T, a, var=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Characteristic polynomial of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27134
 *         return new_gen(_ret)
 * 
 *     def rnfconductor(self, bnf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`bnf` structure attached to a number field :math:`K`, as produced
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1569rnfconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1568rnfconductor[] = "\n        Given a :emphasis:`bnf` structure attached to a number field :math:`K`, as produced\n        by :literal:`bnfinit`, and :math:`T` a monic irreducible polynomial in :math:`K[x]`\n        defining an Abelian extension :math:`L = K[x]/(T)`, computes the class field\n        theory conductor of this Abelian extension. The result is a 3-component vector\n        :math:`[conductor,bnr,subgroup]`, where :emphasis:`conductor` is\n        the conductor of the extension given as a 2-component row vector\n        :math:`[f_0,f_ oo ]`, :emphasis:`bnr` is the attached :literal:`bnr` structure\n        and :emphasis:`subgroup` is a matrix in HNF defining the subgroup of the ray class\n        group on the ray class group generators :literal:`bnr.gen`.\n        \n        :strong:`Huge discriminants, helping rnfdisc.` the format :math:`[T,B]` is\n        also accepted instead of :math:`T` and computes the conductor of the extension\n        provided it factors completely over prime divisors of rational primes :math:`p < B`,\n        see :literal:`\077\077rnfinit`: the valuation of :math:`f_0` is then correct at all prime\n        ideals :math:`p` above a rational prime :math:`p < B` but may be incorrect at other\n        primes.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1569rnfconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_T,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_bnf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfconductor", 1, 2, 2, 1); __PYX_ERR(4, 27134, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfconductor") < 0)) __PYX_ERR(4, 27134, __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_bnf = values[0];
    __pyx_v_T = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfconductor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27134, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1568rnfconductor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_T);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1568rnfconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_T) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfconductor", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":27153
 *         primes.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27154
 *         '''
 *         bnf = objtogen(bnf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27155
 *         bnf = objtogen(bnf)
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27155, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27156
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfconductor(_bnf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27157
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfconductor(_bnf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27158
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfconductor(_bnf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfconductor(__pyx_v__bnf, __pyx_v__T);

  /* "cypari/auto_instance.pxi":27159
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfconductor(_bnf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfdedekind(self, nf, pol, pr=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27134
 *         return new_gen(_ret)
 * 
 *     def rnfconductor(self, bnf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`bnf` structure attached to a number field :math:`K`, as produced
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27161
 *         return new_gen(_ret)
 * 
 *     def rnfdedekind(self, nf, pol, pr=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`K` coded by :math:`nf` and a monic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1571rnfdedekind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1570rnfdedekind[] = "\n        Given a number field :math:`K` coded by :math:`nf` and a monic\n        polynomial :math:`P\\in \\mathbb{Z}_K[X]`, irreducible over :math:`K` and thus defining a relative\n        extension :math:`L` of :math:`K`, applies Dedekind's criterion to the order\n        :math:`\\mathbb{Z}_K[X]/(P)`, at the prime ideal :emphasis:`pr`. It is possible to set :emphasis:`pr`\n        to a vector of prime ideals (test maximality at all primes in the vector),\n        or to omit altogether, in which case maximality at :emphasis:`all` primes is tested;\n        in this situation :emphasis:`flag` is automatically set to :math:`1`.\n        \n        The default historic behavior (:emphasis:`flag` is 0 or omitted and :emphasis:`pr` is a\n        single prime ideal) is not so useful since\n        :literal:`rnfpseudobasis` gives more information and is generally not that\n        much slower. It returns a 3-component vector :math:`[max, basis, v]`:\n        \n        - :emphasis:`basis` is a pseudo-basis of an enlarged order :math:`O` produced by\n          Dedekind's criterion, containing the original order :math:`\\mathbb{Z}_K[X]/(P)`\n          with index a power of :emphasis:`pr`. Possibly equal to the original order.\n        \n        - :emphasis:`max` is a flag equal to 1 if the enlarged order :math:`O`\n          could be proven to be :emphasis:`pr`-maximal and to 0 otherwise; it may still be\n          maximal in the latter case if :emphasis:`pr` is ramified in :math:`L`,\n        \n        - :math:`v` is the valuation at :emphasis:`pr` of the order discriminant.\n        \n        If :emphasis:`flag` is non-zero, on the other hand, we just return :math:`1` if the order\n        :math:`\\mathbb{Z}_K[X]/(P)` is :emphasis:`pr`-maximal (resp.\302\240maximal at all relevant primes, as\n        described above), and :math:`0` if not. This is much faster than the default,\n        since the enlarged order is not computed.\n        \n        ::\n        \n            ? n""f = nfinit(y^2-3); P = x^3 - 2*y;\n            ? pr3 = idealprimedec(nf,3)[1];\n            ? rnfdedekind(nf, P, pr3)\n            %3 = [1, [[1, 0, 0; 0, 1, 0; 0, 0, 1], [1, 1, 1]], 8]\n            ? rnfdedekind(nf, P, pr3, 1)\n            %4 = 1\n        \n        In this example, :literal:`pr3` is the ramified ideal above :math:`3`,\n        and the order generated by the cube roots of :math:`y` is already\n        :literal:`pr3`-maximal. The order-discriminant has valuation :math:`8`. On the other\n        hand, the order is not maximal at the prime above 2:\n        \n        ::\n        \n            ? pr2 = idealprimedec(nf,2)[1];\n            ? rnfdedekind(nf, P, pr2, 1)\n            %6 = 0\n            ? rnfdedekind(nf, P, pr2)\n            %7 = [0, [[2, 0, 0; 0, 1, 0; 0, 0, 1], [[1, 0; 0, 1], [1, 0; 0, 1],\n             [1, 1/2; 0, 1/2]]], 2]\n        \n        The enlarged order is not proven to be :literal:`pr2`-maximal yet. In fact, it\n        is; it is in fact the maximal order:\n        \n        ::\n        \n            ? B = rnfpseudobasis(nf, P)\n            %8 = [[1, 0, 0; 0, 1, 0; 0, 0, 1], [1, 1, [1, 1/2; 0, 1/2]],\n             [162, 0; 0, 162], -1]\n            ? idealval(nf,B[3], pr2)\n            %9 = 2\n        \n        It is possible to use this routine with non-monic\n        :math:`P = \\sum_{i <= n} a_i X^i \\in \\mathbb{Z}_K[X]` if :math:`flag = 1`;\n        in this case, we test maximality of Dedekind's order generated by\n        \n        .. MATH::\n        \n            1, a_n \\alpha, a_n\\alpha^2 + a_{n-1}\\alpha,...,\n            a_n\\alpha^{n-1} + a_{n-1}\\alpha^{n-2} +...+ a_1\\alpha.\n        \n        The routine will fail if :math:`P` is :math:`0` on the projective line over the residue\n        field :math:`\\mathbb{Z}_K/pr` (FIXME).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1571rnfdedekind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_pr = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfdedekind (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pol,&__pyx_n_s_pr,&__pyx_n_s_flag,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_nf)) != 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_pol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfdedekind", 0, 2, 4, 1); __PYX_ERR(4, 27161, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr);
          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_flag);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfdedekind") < 0)) __PYX_ERR(4, 27161, __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);
        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_nf = values[0];
    __pyx_v_pol = values[1];
    __pyx_v_pr = values[2];
    if (values[3]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 27161, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfdedekind", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfdedekind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1570rnfdedekind(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pol, __pyx_v_pr, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1570rnfdedekind(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_pr, long __pyx_v_flag) {
  int __pyx_v__have_pr;
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("rnfdedekind", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":27237
 *         field :math:`\mathbb{Z}_K/pr` (FIXME).
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         cdef bint _have_pr = (pr is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27238
 *         '''
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27239
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 *         cdef bint _have_pr = (pr is not None)             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             pr = objtogen(pr)
 */
  __pyx_t_2 = (__pyx_v_pr != Py_None);
  __pyx_v__have_pr = __pyx_t_2;

  /* "cypari/auto_instance.pxi":27240
 *         pol = objtogen(pol)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":27241
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 *             pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":27240
 *         pol = objtogen(pol)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":27242
 *         if _have_pr:
 *             pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 27242, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27243
 *             pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":27244
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_4;

  /* "cypari/auto_instance.pxi":27245
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 */
  __pyx_v__pr = NULL;

  /* "cypari/auto_instance.pxi":27246
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":27247
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 *             _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
    __pyx_v__pr = __pyx_t_4;

    /* "cypari/auto_instance.pxi":27246
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 */
  }

  /* "cypari/auto_instance.pxi":27248
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfdedekind(__pyx_v__nf, __pyx_v__pol, __pyx_v__pr, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":27249
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfdet(self, nf, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27161
 *         return new_gen(_ret)
 * 
 *     def rnfdedekind(self, nf, pol, pr=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`K` coded by :math:`nf` and a monic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfdedekind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27251
 *         return new_gen(_ret)
 * 
 *     def rnfdet(self, nf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`M` over the maximal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1573rnfdet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1572rnfdet[] = "\n        Given a pseudo-matrix :math:`M` over the maximal\n        order of :math:`nf`, computes its determinant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1573rnfdet(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_M = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfdet (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_M,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_nf)) != 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_M)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfdet", 1, 2, 2, 1); __PYX_ERR(4, 27251, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfdet") < 0)) __PYX_ERR(4, 27251, __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_nf = values[0];
    __pyx_v_M = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfdet", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27251, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfdet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1572rnfdet(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_M);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1572rnfdet(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_M) {
  GEN __pyx_v__nf;
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfdet", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_instance.pxi":27256
 *         order of :math:`nf`, computes its determinant.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         M = objtogen(M)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27257
 *         '''
 *         nf = objtogen(nf)
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27258
 *         nf = objtogen(nf)
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27258, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27259
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfdet(_nf, _M)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27260
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfdet(_nf, _M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27261
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfdet(_nf, _M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfdet(__pyx_v__nf, __pyx_v__M);

  /* "cypari/auto_instance.pxi":27262
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfdet(_nf, _M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfdisc(self, nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27251
 *         return new_gen(_ret)
 * 
 *     def rnfdet(self, nf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`M` over the maximal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfdet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27264
 *         return new_gen(_ret)
 * 
 *     def rnfdisc(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1575rnfdisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1574rnfdisc[] = "\n        Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output\n        by :literal:`nfinit`, and a monic irreducible polynomial :math:`T\\in K[x]` defining a\n        relative extension :math:`L = K[x]/(T)`, compute the relative discriminant of :math:`L`.\n        This is a vector :math:`[D,d]`, where :math:`D` is the relative ideal discriminant and\n        :math:`d` is the relative discriminant considered as an element of :math:`K^*/{K^*}^2`.\n        The main variable of :math:`nf` :emphasis:`must` be of lower priority than that of\n        :math:`T`, see ``priority`` (in the PARI manual).\n        \n        :strong:`Huge discriminants, helping rnfdisc.` the format :math:`[T,B]` is\n        also accepted instead of :math:`T` and computes an order which is maximal at all\n        :math:`p < B`, see :literal:`\077\077rnfinit`: the valuation of :math:`D` is then correct at all\n        prime ideals :math:`p` above a rational prime :math:`p < B` but may be incorrect\n        at other primes.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1575rnfdisc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfdisc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_T,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_nf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfdisc", 1, 2, 2, 1); __PYX_ERR(4, 27264, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfdisc") < 0)) __PYX_ERR(4, 27264, __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_nf = values[0];
    __pyx_v_T = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfdisc", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27264, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1574rnfdisc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_T);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1574rnfdisc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfdisc", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":27280
 *         at other primes.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27281
 *         '''
 *         nf = objtogen(nf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27282
 *         nf = objtogen(nf)
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27282, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27283
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfdiscf(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27284
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfdiscf(_nf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27285
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfdiscf(_nf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfdiscf(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_instance.pxi":27286
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfdiscf(_nf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltabstorel(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27264
 *         return new_gen(_ret)
 * 
 *     def rnfdisc(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27288
 *         return new_gen(_ret)
 * 
 *     def rnfeltabstorel(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1577rnfeltabstorel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1576rnfeltabstorel[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be an\n        element of :math:`L` expressed as a polynomial modulo the absolute equation\n        :literal:`:emphasis:`rnf`.pol`, or in terms of the absolute :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L`\n        if :emphasis:`rnf` contains one (as in :literal:`rnfinit(nf,pol,1)`, or after\n        a call to :literal:`nfinit(rnf)`).\n        Computes :math:`x` as an element of the relative extension\n        :math:`L/K` as a polmod with polmod coefficients.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.polabs\n            %2 = x^4 + 1\n            ? rnfeltabstorel(L, Mod(x, L.polabs))\n            %3 = Mod(x, x^2 + Mod(-y, y^2 + 1))\n            ? rnfeltabstorel(L, 1/3)\n            %4 = 1/3\n            ? rnfeltabstorel(L, Mod(x, x^2-y))\n            %5 = Mod(x, x^2 + Mod(-y, y^2 + 1))\n            \n            ? rnfeltabstorel(L, [0,0,0,1]~) \\\\ Z_L not initialized yet\n             *** at top-level: rnfeltabstorel(L,[0,\n             *** ^--------------------\n             *** rnfeltabstorel: incorrect type in rnfeltabstorel, apply nfinit(rnf).\n            ? nfinit(L); \\\\ initialize now\n            ? rnfeltabstorel(L, [0,0,0,1]~)\n            %6 = Mod(Mod(y, y^2 + 1)*x, x^2 + Mod(-y, y^2 + 1))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1577rnfeltabstorel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltabstorel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfeltabstorel", 1, 2, 2, 1); __PYX_ERR(4, 27288, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfeltabstorel") < 0)) __PYX_ERR(4, 27288, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfeltabstorel", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27288, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltabstorel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1576rnfeltabstorel(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1576rnfeltabstorel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltabstorel", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27319
 *             %6 = Mod(Mod(y, y^2 + 1)*x, x^2 + Mod(-y, y^2 + 1))
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27320
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27321
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27321, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27322
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27323
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27324
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltabstorel(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27325
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltdown(self, rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27288
 *         return new_gen(_ret)
 * 
 *     def rnfeltabstorel(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltabstorel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27327
 *         return new_gen(_ret)
 * 
 *     def rnfeltdown(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1579rnfeltdown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1578rnfeltdown[] = "\n        :math:`rnf` being a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being an element of\n        :math:`L` expressed as a polynomial or polmod with polmod coefficients (or as a\n        :literal:`t_COL` on :literal:`nfinit(rnf).zk`), computes\n        :math:`x` as an element of :math:`K` as a :literal:`t_POLMOD` if :math:`flag = 0` and as a :literal:`t_COL`\n        otherwise. If :math:`x` is not in :math:`K`, a domain error occurs.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.pol\n            %2 = x^4 + 1\n            ? rnfeltdown(L, Mod(x^2, L.pol))\n            %3 = Mod(y, y^2 + 1)\n            ? rnfeltdown(L, Mod(x^2, L.pol), 1)\n            %4 = [0, 1]~\n            ? rnfeltdown(L, Mod(y, x^2-y))\n            %5 = Mod(y, y^2 + 1)\n            ? rnfeltdown(L, Mod(y,K.pol))\n            %6 = Mod(y, y^2 + 1)\n            ? rnfeltdown(L, Mod(x, L.pol))\n             *** at top-level: rnfeltdown(L,Mod(x,x\n             *** ^--------------------\n             *** rnfeltdown: domain error in rnfeltdown: element not in the base field\n            ? rnfeltdown(L, Mod(y, x^2-y), 1) \\\\ as a t_COL\n            %7 = [0, 1]~\n            ? rnfeltdown(L, [0,1,0,0]~) \\\\ not allowed without absolute nf struct\n             *** rnfeltdown: incorrect type in rnfeltdown (t_COL).\n            ? nfinit(L); \\\\ add absolute nf structure to L\n            ? rnfeltdown(L, [0,1,0,0]~) \\\\ now OK\n            %8 = Mod(y, y^2 + 1)\n        \n        If we had started with\n        :literal:`L = rnfinit(K, x^2-y, 1)`, then the final would have worked directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1579rnfeltdown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltdown (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfeltdown", 0, 2, 3, 1); __PYX_ERR(4, 27327, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfeltdown") < 0)) __PYX_ERR(4, 27327, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_rnf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 27327, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfeltdown", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27327, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1578rnfeltdown(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1578rnfeltdown(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltdown", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27364
 *         :literal:`L = rnfinit(K, x^2-y, 1)`, then the final would have worked directly.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27365
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27366
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27366, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27367
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27368
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27369
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltdown0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":27370
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltnorm(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27327
 *         return new_gen(_ret)
 * 
 *     def rnfeltdown(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27372
 *         return new_gen(_ret)
 * 
 *     def rnfeltnorm(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1581rnfeltnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1580rnfeltnorm[] = "\n        :math:`rnf` being a relative number field extension :math:`L/K` as output by\n        :literal:`rnfinit` and :math:`x` being an element of :math:`L`, returns the relative norm\n        :math:`N_{L/K}(x)` as an element of :math:`K`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? rnfeltnorm(L, Mod(x, L.pol))\n            %2 = Mod(x, x^2 + Mod(-y, y^2 + 1))\n            ? rnfeltnorm(L, 2)\n            %3 = 4\n            ? rnfeltnorm(L, Mod(x, x^2-y))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1581rnfeltnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfeltnorm", 1, 2, 2, 1); __PYX_ERR(4, 27372, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfeltnorm") < 0)) __PYX_ERR(4, 27372, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfeltnorm", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27372, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1580rnfeltnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1580rnfeltnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltnorm", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27387
 *             ? rnfeltnorm(L, Mod(x, x^2-y))
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27388
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27389
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27389, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27390
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27391
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27392
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltnorm(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27393
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltreltoabs(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27372
 *         return new_gen(_ret)
 * 
 *     def rnfeltnorm(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27395
 *         return new_gen(_ret)
 * 
 *     def rnfeltreltoabs(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1583rnfeltreltoabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1582rnfeltreltoabs[] = "\n        :math:`rnf` being a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being an\n        element of :math:`L` expressed as a polynomial or polmod with polmod\n        coefficients, computes :math:`x` as an element of the absolute extension :math:`L/\\mathbb{Q}` as\n        a polynomial modulo the absolute equation :literal:`:emphasis:`rnf`.pol`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.pol\n            %2 = x^4 + 1\n            ? rnfeltreltoabs(L, Mod(x, L.pol))\n            %3 = Mod(x, x^4 + 1)\n            ? rnfeltreltoabs(L, Mod(y, x^2-y))\n            %4 = Mod(x^2, x^4 + 1)\n            ? rnfeltreltoabs(L, Mod(y,K.pol))\n            %5 = Mod(x^2, x^4 + 1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1583rnfeltreltoabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltreltoabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfeltreltoabs", 1, 2, 2, 1); __PYX_ERR(4, 27395, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfeltreltoabs") < 0)) __PYX_ERR(4, 27395, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfeltreltoabs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27395, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1582rnfeltreltoabs(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1582rnfeltreltoabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltreltoabs", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27415
 *             %5 = Mod(x^2, x^4 + 1)
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27416
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27417
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27417, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27418
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27419
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27420
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltreltoabs(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27421
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfelttrace(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27395
 *         return new_gen(_ret)
 * 
 *     def rnfeltreltoabs(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27423
 *         return new_gen(_ret)
 * 
 *     def rnfelttrace(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1585rnfelttrace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1584rnfelttrace[] = "\n        :math:`rnf` being a relative number field extension :math:`L/K` as output by\n        :literal:`rnfinit` and :math:`x` being an element of :math:`L`, returns the relative trace\n        :math:`Tr_{L/K}(x)` as an element of :math:`K`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? rnfelttrace(L, Mod(x, L.pol))\n            %2 = 0\n            ? rnfelttrace(L, 2)\n            %3 = 4\n            ? rnfelttrace(L, Mod(x, x^2-y))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1585rnfelttrace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfelttrace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfelttrace", 1, 2, 2, 1); __PYX_ERR(4, 27423, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfelttrace") < 0)) __PYX_ERR(4, 27423, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfelttrace", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27423, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfelttrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1584rnfelttrace(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1584rnfelttrace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfelttrace", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27438
 *             ? rnfelttrace(L, Mod(x, x^2-y))
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27439
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27439, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27440
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27440, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27441
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27442
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27443
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfelttrace(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27444
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltup(self, rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27423
 *         return new_gen(_ret)
 * 
 *     def rnfelttrace(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfelttrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27446
 *         return new_gen(_ret)
 * 
 *     def rnfeltup(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1587rnfeltup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1586rnfeltup[] = "\n        :math:`rnf` being a relative number field extension :math:`L/K` as output by\n        :literal:`rnfinit` and :math:`x` being an element of :math:`K`, computes :math:`x` as an element of\n        the absolute extension :math:`L/\\mathbb{Q}`. As a :literal:`t_POLMOD` modulo :literal:`:emphasis:`rnf`.pol`\n        if :math:`flag = 0` and as a :literal:`t_COL` on the absolute field integer basis if\n        :math:`flag = 1`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.pol\n            %2 = x^4 + 1\n            ? rnfeltup(L, Mod(y, K.pol))\n            %3 = Mod(x^2, x^4 + 1)\n            ? rnfeltup(L, y)\n            %4 = Mod(x^2, x^4 + 1)\n            ? rnfeltup(L, [1,2]~) \\\\ in terms of K.zk\n            %5 = Mod(2*x^2 + 1, x^4 + 1)\n            ? rnfeltup(L, y, 1) \\\\ in terms of nfinit(L).zk\n            %6 = [0, 1, 0, 0]~\n            ? rnfeltup(L, [1,2]~, 1)\n            %7 = [1, 2, 0, 0]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1587rnfeltup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfeltup", 0, 2, 3, 1); __PYX_ERR(4, 27446, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfeltup") < 0)) __PYX_ERR(4, 27446, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_rnf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 27446, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfeltup", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27446, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1586rnfeltup(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1586rnfeltup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltup", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27470
 *             %7 = [1, 2, 0, 0]~
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27471
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27472
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27472, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27473
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27474
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27475
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltup0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":27476
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfequation(self, nf, pol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27446
 *         return new_gen(_ret)
 * 
 *     def rnfeltup(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfeltup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27478
 *         return new_gen(_ret)
 * 
 *     def rnfequation(self, nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1589rnfequation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1588rnfequation[] = "\n        Given a number field\n        :math:`nf` as output by :literal:`nfinit` (or simply a polynomial) and a\n        polynomial :emphasis:`pol` with coefficients in :math:`nf` defining a relative\n        extension :math:`L` of :math:`nf`, computes an absolute equation of :math:`L` over\n        :math:`\\mathbb{Q}`.\n        \n        The main variable of :math:`nf` :emphasis:`must` be of lower priority than that\n        of :emphasis:`pol` (see ``priority`` (in the PARI manual)). Note that for efficiency, this does\n        not check whether the relative equation is irreducible over :math:`nf`, but\n        only if it is squarefree. If it is reducible but squarefree, the result will\n        be the absolute equation of the \303\251tale algebra defined by :emphasis:`pol`. If\n        :emphasis:`pol` is not squarefree, raise an :literal:`e_DOMAIN` exception.\n        \n        ::\n        \n            ? rnfequation(y^2+1, x^2 - y)\n            %1 = x^4 + 1\n            ? T = y^3-2; rnfequation(nfinit(T), (x^3-2)/(x-Mod(y,T)))\n            %2 = x^6 + 108 \\\\ Galois closure of Q(2^(1/3))\n        \n        If :math:`flag` is non-zero, outputs a 3-component row vector :math:`[z,a,k]`, where\n        \n        - :math:`z` is the absolute equation of :math:`L` over :math:`\\mathbb{Q}`, as in the default\n          behavior,\n        \n        - :math:`a` expresses as a :literal:`t_POLMOD` modulo :math:`z` a root :math:`\\alpha` of the\n          polynomial defining the base field :math:`nf`,\n        \n        - :math:`k` is a small integer such that :math:`\\theta = \\beta+k\\alpha`\n          is a root of :math:`z`, where :math:`\\beta` is a root of :math:`pol`. It is guaranteed\n          that :math:`k = 0` whenever :math:`\\mathbb{Q} (\\beta) = L`.\n        \n        ::\n        \n            ? T = y^3-2; pol = x^2 +x*y + y^2;\n            ? [z,a,k] = rnfequation(T, pol, 1);\n            ? z\n            %3 = x^6 + 108\n            ? subst(T, y, a)\n           "" %4 = 0\n            ? alpha= Mod(y, T);\n            ? beta = Mod(x*Mod(1,T), pol);\n            ? subst(z, x, beta + k*alpha)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1589rnfequation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfequation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pol,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_pol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfequation", 0, 2, 3, 1); __PYX_ERR(4, 27478, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfequation") < 0)) __PYX_ERR(4, 27478, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_pol = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 27478, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfequation", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27478, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfequation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1588rnfequation(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1588rnfequation(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfequation", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":27525
 *             %7 = 0
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27526
 *         '''
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27527
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27527, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27528
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27529
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27530
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfequation0(__pyx_v__nf, __pyx_v__pol, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":27531
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfhnfbasis(self, bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27478
 *         return new_gen(_ret)
 * 
 *     def rnfequation(self, nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfequation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27533
 *         return new_gen(_ret)
 * 
 *     def rnfhnfbasis(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1591rnfhnfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1590rnfhnfbasis[] = "\n        Given :math:`bnf` as output by\n        :literal:`bnfinit`, and either a polynomial :math:`x` with coefficients in :math:`bnf`\n        defining a relative extension :math:`L` of :math:`bnf`, or a pseudo-basis :math:`x` of\n        such an extension, gives either a true :math:`bnf`-basis of :math:`L` in upper\n        triangular Hermite normal form, if it exists, and returns :math:`0` otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1591rnfhnfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfhnfbasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_x,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_bnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfhnfbasis", 1, 2, 2, 1); __PYX_ERR(4, 27533, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfhnfbasis") < 0)) __PYX_ERR(4, 27533, __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_bnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfhnfbasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27533, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfhnfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1590rnfhnfbasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1590rnfhnfbasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfhnfbasis", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27541
 *         triangular Hermite normal form, if it exists, and returns :math:`0` otherwise.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27542
 *         '''
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27543
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27543, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27544
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27545
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27546
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfhnfbasis(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27547
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealabstorel(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27533
 *         return new_gen(_ret)
 * 
 *     def rnfhnfbasis(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfhnfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27549
 *         return new_gen(_ret)
 * 
 *     def rnfidealabstorel(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1593rnfidealabstorel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1592rnfidealabstorel[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be an\n        ideal of the absolute extension :math:`L/\\mathbb{Q}`. Returns the relative pseudo-matrix in\n        HNF giving the ideal :math:`x` considered as an ideal of the relative extension\n        :math:`L/K`, i.e.\302\240as a :math:`\\mathbb{Z}_K`-module.\n        \n        Let :literal:`Labs` be an (absolute) :literal:`nf` structure attached to :math:`L`,\n        obtained via :literal:`Labs = nfinit(rnf))`. Then :literal:`rnf` \"knows\" about\n        :literal:`Labs` and :math:`x` may be given in any format\n        attached to :literal:`Labs`, e.g. a prime ideal or an ideal in HNF wrt.\n        :literal:`Labs.zk`:\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y); Labs = nfinit(rnf);\n            ? m = idealhnf(Labs, 17, x^3+2); \\\\ some ideal in HNF wrt. Labs.zk\n            ? B = rnfidealabstorel(rnf, m)\n            %3 = [[1, 8; 0, 1], [[17, 4; 0, 1], 1]] \\\\ pseudo-basis for m as Z_K-module\n            ? A = rnfidealreltoabs(rnf, B)\n            %4 = [17, x^2 + 4, x + 8, x^3 + 8*x^2] \\\\ Z-basis for m in Q[x]/(rnf.polabs)\n            ? mathnf(matalgtobasis(Labs, A)) == m\n            %5 = 1\n        \n        If on the other hand, we do not have a :literal:`Labs` at hand,\n        because it would be too expensive to compute, but we nevertheless have\n        a :math:`\\mathbb{Z}`-basis for :math:`x`, then we can use the function with this basis as\n        argument. The entries of :math:`x` may be given either modulo :literal:`rnf.polabs`\n        (absolute form, possibly lifted) or modulo :literal:`rnf.pol` (relative form as\n        :literal:`t_POLMOD`\302\240s):\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y);\n            ? rnfidealabstorel(rnf, [17, x^2 + 4, x + 8, x^3 + 8*x^2])\n            %2 = [[1, 8; 0, 1], [[17, 4; 0, 1],"" 1]]\n            ? rnfidealabstorel(rnf, Mod([17, y + 4, x + 8, y*x + 8*y], x^2-y))\n            %3 = [[1, 8; 0, 1], [[17, 4; 0, 1], 1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1593rnfidealabstorel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealabstorel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealabstorel", 1, 2, 2, 1); __PYX_ERR(4, 27549, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealabstorel") < 0)) __PYX_ERR(4, 27549, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealabstorel", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27549, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealabstorel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1592rnfidealabstorel(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1592rnfidealabstorel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealabstorel", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27589
 *             %3 = [[1, 8; 0, 1], [[17, 4; 0, 1], 1]]
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27590
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27591
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27591, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27592
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27593
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27594
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealabstorel(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27595
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealdown(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27549
 *         return new_gen(_ret)
 * 
 *     def rnfidealabstorel(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealabstorel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27597
 *         return new_gen(_ret)
 * 
 *     def rnfidealdown(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1595rnfidealdown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1594rnfidealdown[] = "\n        Let :math:`rnf` be a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit`, and :math:`x` an ideal of\n        :math:`L`, given either in relative form or by a :math:`\\mathbb{Z}`-basis of elements of :math:`L`\n        (see ``rnfidealabstorel`` (in the PARI manual)). This function returns the ideal of :math:`K`\n        below :math:`x`, i.e.\302\240the intersection of :math:`x` with :math:`K`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1595rnfidealdown(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealdown (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealdown", 1, 2, 2, 1); __PYX_ERR(4, 27597, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealdown") < 0)) __PYX_ERR(4, 27597, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealdown", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27597, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1594rnfidealdown(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1594rnfidealdown(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealdown", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27605
 *         below :math:`x`, i.e.the intersection of :math:`x` with :math:`K`.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27606
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27607
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27607, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27608
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27609
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27610
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealdown(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27611
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealfactor(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27597
 *         return new_gen(_ret)
 * 
 *     def rnfidealdown(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27613
 *         return new_gen(_ret)
 * 
 *     def rnfidealfactor(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor into prime ideal powers the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1597rnfidealfactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1596rnfidealfactor[] = "\n        Factor into prime ideal powers the\n        ideal :math:`x` in the attached absolute number field :math:`L = nfinit (rnf)`.\n        The output format is similar to the :literal:`factor` function, and the prime\n        ideals are represented in the form output by the :literal:`idealprimedec`\n        function for :math:`L`.\n        \n        ::\n        \n            ? rnf = rnfinit(nfinit(y^2+1), x^2-y+1);\n            ? rnfidealfactor(rnf, y+1) \\\\ P_2^2\n            %2 =\n            [[2, [0,0,1,0]~, 4, 1, [0,0,0,2;0,0,-2,0;-1,-1,0,0;1,-1,0,0]] 2]\n            \n            ? rnfidealfactor(rnf, x) \\\\ P_2\n            %3 =\n            [[2, [0,0,1,0]~, 4, 1, [0,0,0,2;0,0,-2,0;-1,-1,0,0;1,-1,0,0]] 1]\n            \n            ? L = nfinit(rnf);\n            ? id = idealhnf(L, idealhnf(L, 25, (x+1)^2));\n            ? idealfactor(L, id) == rnfidealfactor(rnf, id)\n            %6 = 1\n        \n        Note that ideals of the base field :math:`K` must be explicitly\n        lifted to :math:`L` via :literal:`rnfidealup` before they can be factored.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1597rnfidealfactor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealfactor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealfactor", 1, 2, 2, 1); __PYX_ERR(4, 27613, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealfactor") < 0)) __PYX_ERR(4, 27613, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealfactor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27613, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealfactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1596rnfidealfactor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1596rnfidealfactor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealfactor", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27640
 *         lifted to :math:`L` via :literal:`rnfidealup` before they can be factored.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27641
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27642
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27642, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27643
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27644
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27645
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealfactor(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27646
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealhnf(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27613
 *         return new_gen(_ret)
 * 
 *     def rnfidealfactor(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor into prime ideal powers the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealfactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27648
 *         return new_gen(_ret)
 * 
 *     def rnfidealhnf(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1599rnfidealhnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1598rnfidealhnf[] = "\n        :math:`rnf` being a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being a relative\n        ideal (which can be, as in the absolute case, of many different types,\n        including of course elements), computes the HNF pseudo-matrix attached to\n        :math:`x`, viewed as a :math:`\\mathbb{Z}_K`-module.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1599rnfidealhnf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealhnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealhnf", 1, 2, 2, 1); __PYX_ERR(4, 27648, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealhnf") < 0)) __PYX_ERR(4, 27648, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealhnf", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27648, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1598rnfidealhnf(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1598rnfidealhnf(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealhnf", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27656
 *         :math:`x`, viewed as a :math:`\mathbb{Z}_K`-module.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27657
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27658
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27658, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27659
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27660
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27661
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealhnf(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27662
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealmul(self, rnf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27648
 *         return new_gen(_ret)
 * 
 *     def rnfidealhnf(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27664
 *         return new_gen(_ret)
 * 
 *     def rnfidealmul(self, rnf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1601rnfidealmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1600rnfidealmul[] = "\n        :math:`rnf` being a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` and :math:`y` being ideals\n        of the relative extension :math:`L/K` given by pseudo-matrices, outputs the ideal\n        product, again as a relative ideal.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1601rnfidealmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealmul", 1, 3, 3, 1); __PYX_ERR(4, 27664, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealmul", 1, 3, 3, 2); __PYX_ERR(4, 27664, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealmul") < 0)) __PYX_ERR(4, 27664, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_rnf = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealmul", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27664, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1600rnfidealmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1600rnfidealmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealmul", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":27671
 *         product, again as a relative ideal.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27672
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27673
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27674
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27674, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27675
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27676
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27677
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27678
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealmul(__pyx_v__rnf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":27679
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealnormabs(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27664
 *         return new_gen(_ret)
 * 
 *     def rnfidealmul(self, rnf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27681
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormabs(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1603rnfidealnormabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1602rnfidealnormabs[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be a\n        relative ideal (which can be, as in the absolute case, of many different\n        types, including of course elements). This function computes the norm of the\n        :math:`x` considered as an ideal of the absolute extension :math:`L/\\mathbb{Q}`. This is\n        identical to\n        \n        ::\n        \n             idealnorm(rnf, rnfidealnormrel(rnf,x))\n        \n        but faster.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1603rnfidealnormabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealnormabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealnormabs", 1, 2, 2, 1); __PYX_ERR(4, 27681, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealnormabs") < 0)) __PYX_ERR(4, 27681, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealnormabs", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27681, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealnormabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1602rnfidealnormabs(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1602rnfidealnormabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealnormabs", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27696
 *         but faster.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27697
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27698
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27698, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27699
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27700
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27701
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealnormabs(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27702
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealnormrel(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27681
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormabs(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealnormabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27704
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormrel(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1605rnfidealnormrel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1604rnfidealnormrel[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be a\n        relative ideal (which can be, as in the absolute case, of many different\n        types, including of course elements). This function computes the relative\n        norm of :math:`x` as an ideal of :math:`K` in HNF.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1605rnfidealnormrel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealnormrel (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealnormrel", 1, 2, 2, 1); __PYX_ERR(4, 27704, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealnormrel") < 0)) __PYX_ERR(4, 27704, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealnormrel", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27704, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealnormrel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1604rnfidealnormrel(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1604rnfidealnormrel(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealnormrel", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27712
 *         norm of :math:`x` as an ideal of :math:`K` in HNF.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27713
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27714
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27714, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27715
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27716
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27717
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealnormrel(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27718
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealprimedec(self, rnf, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27704
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormrel(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealnormrel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27720
 *         return new_gen(_ret)
 * 
 *     def rnfidealprimedec(self, rnf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1607rnfidealprimedec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1606rnfidealprimedec[] = "\n        Let :emphasis:`rnf` be a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit`, and :emphasis:`pr` a maximal\n        ideal of :math:`K` (:emphasis:`prid`), this function completes the :emphasis:`rnf`\n        with a :emphasis:`nf` structure attached to :math:`L` (see ``rnfinit`` (in the PARI manual))\n        and returns the prime ideal decomposition of :emphasis:`pr` in :math:`L/K`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^3+y+1);\n            ? P = idealprimedec(K, 2)[1];\n            ? S = rnfidealprimedec(rnf, P);\n            ? #S\n            %4 = 1\n        \n        The argument :emphasis:`pr` is also allowed to be a prime number :math:`p`, in which\n        case the function returns a pair of vectors :literal:`[SK,SL]`, where :literal:`SK` contains\n        the primes of :math:`K` above :math:`p` and :literal:`SL`:math:`[i]` is the vector of primes of :math:`L`\n        above :literal:`SK`:math:`[i]`.\n        \n        ::\n        \n            ? [SK,SL] = rnfidealprimedec(rnf, 5);\n            ? [#SK, vector(#SL,i,#SL[i])]\n            %6 = [2, [2, 2]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1607rnfidealprimedec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealprimedec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_pr,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_rnf)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealprimedec", 1, 2, 2, 1); __PYX_ERR(4, 27720, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealprimedec") < 0)) __PYX_ERR(4, 27720, __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_rnf = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealprimedec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27720, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealprimedec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1606rnfidealprimedec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1606rnfidealprimedec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_pr) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealprimedec", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_instance.pxi":27747
 *             %6 = [2, [2, 2]]
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27748
 *         '''
 *         rnf = objtogen(rnf)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27749
 *         rnf = objtogen(rnf)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27749, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27750
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27751
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27752
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealprimedec(__pyx_v__rnf, __pyx_v__pr);

  /* "cypari/auto_instance.pxi":27753
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealreltoabs(self, rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27720
 *         return new_gen(_ret)
 * 
 *     def rnfidealprimedec(self, rnf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealprimedec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27755
 *         return new_gen(_ret)
 * 
 *     def rnfidealreltoabs(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1609rnfidealreltoabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1608rnfidealreltoabs[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be a\n        relative ideal, given as a :math:`\\mathbb{Z}_K`-module by a pseudo matrix :math:`[A,I]`.\n        This function returns the ideal :math:`x` as an absolute ideal of :math:`L/\\mathbb{Q}`.\n        If :math:`flag = 0`, the result is given by a vector of :literal:`t_POLMOD`\302\240s modulo\n        :literal:`rnf.pol` forming a :math:`\\mathbb{Z}`-basis; if :math:`flag = 1`, it is given in HNF in terms\n        of the fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L`, see ``rnfinit`` (in the PARI manual).\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y);\n            ? P = idealprimedec(K,2)[1];\n            ? P = rnfidealup(rnf, P)\n            %3 = [2, x^2 + 1, 2*x, x^3 + x]\n            ? Prel = rnfidealhnf(rnf, P)\n            %4 = [[1, 0; 0, 1], [[2, 1; 0, 1], [2, 1; 0, 1]]]\n            ? rnfidealreltoabs(rnf,Prel)\n            %5 = [2, x^2 + 1, 2*x, x^3 + x]\n            ? rnfidealreltoabs(rnf,Prel,1)\n            %6 =\n            [2 1 0 0]\n            \n            [0 1 0 0]\n            \n            [0 0 2 1]\n            \n            [0 0 0 1]\n        \n        The reason why we do not return by default (:math:`flag = 0`) the customary HNF in\n        terms of a fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L` is precisely because\n        a :emphasis:`rnf` does not contain such a basis by default. Completing the\n        structure so that it contains a :emphasis:`nf` structure for :math:`L` is polynomial\n        time but costly when the absolute degree is large, thus it is not done by\n        default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1609rnfidealreltoabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealreltoabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealreltoabs", 0, 2, 3, 1); __PYX_ERR(4, 27755, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealreltoabs") < 0)) __PYX_ERR(4, 27755, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_rnf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 27755, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealreltoabs", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27755, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1608rnfidealreltoabs(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1608rnfidealreltoabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealreltoabs", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27792
 *         default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27793
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27794
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27794, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27795
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27796
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27797
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealreltoabs0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":27798
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealtwoelt(self, rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27755
 *         return new_gen(_ret)
 * 
 *     def rnfidealreltoabs(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27800
 *         return new_gen(_ret)
 * 
 *     def rnfidealtwoelt(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1611rnfidealtwoelt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1610rnfidealtwoelt[] = "\n        :math:`rnf` being a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being an\n        ideal of the relative extension :math:`L/K` given by a pseudo-matrix, gives a\n        vector of two generators of :math:`x` over :math:`\\mathbb{Z}_L` expressed as polmods with polmod\n        coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1611rnfidealtwoelt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealtwoelt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,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_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealtwoelt", 1, 2, 2, 1); __PYX_ERR(4, 27800, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealtwoelt") < 0)) __PYX_ERR(4, 27800, __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_rnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealtwoelt", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27800, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealtwoelt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1610rnfidealtwoelt(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1610rnfidealtwoelt(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealtwoelt", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27808
 *         coefficients.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27809
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27810
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27810, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27811
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27812
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27813
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealtwoelement(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27814
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealup(self, rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27800
 *         return new_gen(_ret)
 * 
 *     def rnfidealtwoelt(self, rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealtwoelt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27816
 *         return new_gen(_ret)
 * 
 *     def rnfidealup(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1613rnfidealup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1612rnfidealup[] = "\n        Let :math:`rnf` be a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be an ideal of\n        :math:`K`. This function returns the ideal :math:`x\\mathbb{Z}_L` as an absolute ideal of :math:`L/\\mathbb{Q}`,\n        in the form of a :math:`\\mathbb{Z}`-basis. If :math:`flag = 0`, the result is given by a vector of\n        polynomials (modulo :literal:`rnf.pol`); if :math:`flag = 1`, it is given in HNF in terms\n        of the fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L`, see ``rnfinit`` (in the PARI manual).\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y);\n            ? P = idealprimedec(K,2)[1];\n            ? rnfidealup(rnf, P)\n            %3 = [2, x^2 + 1, 2*x, x^3 + x]\n            ? rnfidealup(rnf, P,1)\n            %4 =\n            [2 1 0 0]\n            \n            [0 1 0 0]\n            \n            [0 0 2 1]\n            \n            [0 0 0 1]\n        \n        The reason why we do not return by default (:math:`flag = 0`) the customary HNF in\n        terms of a fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L` is precisely because\n        a :emphasis:`rnf` does not contain such a basis by default. Completing the\n        structure so that it contains a :emphasis:`nf` structure for :math:`L` is polynomial\n        time but costly when the absolute degree is large, thus it is not done by\n        default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1613rnfidealup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rnf = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rnf,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealup", 0, 2, 3, 1); __PYX_ERR(4, 27816, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealup") < 0)) __PYX_ERR(4, 27816, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_rnf = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 27816, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealup", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27816, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1612rnfidealup(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_rnf, __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1612rnfidealup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealup", 0);
  __Pyx_INCREF(__pyx_v_rnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27848
 *         default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27849
 *         '''
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27850
 *         rnf = objtogen(rnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27850, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27851
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27852
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27853
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealup0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":27854
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfinit(self, nf, T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27816
 *         return new_gen(_ret)
 * 
 *     def rnfidealup(self, rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfidealup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27856
 *         return new_gen(_ret)
 * 
 *     def rnfinit(self, nf, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1615rnfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1614rnfinit[] = "\n        Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by\n        :literal:`nfinit`, and a monic irreducible polynomial :math:`T` in :math:`K[x]` defining a\n        relative extension :math:`L = K[x]/(T)`, this computes data to work in :math:`L/K`\n        The main variable of :math:`T` must be of higher priority\n        (see ``priority`` (in the PARI manual)) than that of :math:`nf`, and the coefficients of\n        :math:`T` must be in :math:`K`.\n        \n        The result is a row vector, whose components are technical.\n        We let :math:`m = [K:\\mathbb{Q}]` the degree of the base field, :math:`n = [L:K]` the relative\n        degree, :math:`r_1` and :math:`r_2` the number of real and complex places of :math:`K`. Access\n        to this information via :emphasis:`member functions` is preferred since the\n        specific data organization specified below will change in the future.\n        \n        If :math:`flag = 1`, add an :emphasis:`nf` structure attached to :math:`L` to :emphasis:`rnf`.\n        This is likely to be very expensive if the absolute degree :math:`mn` is large,\n        but fixes an integer basis for :math:`\\mathbb{Z}_L` as a :math:`\\mathbb{Z}`-module and allows to input\n        and output elements of :math:`L` in absolute form: as :literal:`t_COL` for elements,\n        as :literal:`t_MAT` in HNF for ideals, as :literal:`prid` for prime ideals. Without such\n        a call, elements of :math:`L` are represented as :literal:`t_POLMOD`, etc.\n        Note that a subsequent :literal:`nfinit`:math:`(rnf)` will also explicitly\n        add such a component, and so will the following functions :literal:`rnfidealmul`,\n        :literal:`rnfidealtwoelt`, :literal:`rnfidealprimedec`, :literal:`rnfidealup` (with flag 1)\n        and :literal:`rnfidealreltoabs` (with flag 1). The absolute :emphasis:`nf` structure\n        attached to :math:`L` can be recovered using :literal:`nfinit(rnf)`.\n        \n   ""     :math:`rnf[1]`(:literal:`rnf.pol`) contains the relative polynomial :math:`T`.\n        \n        :math:`rnf[2]` contains the integer basis :math:`[A,d]` of :math:`K`, as\n        (integral) elements of :math:`L/\\mathbb{Q}`. More precisely, :math:`A` is a vector of\n        polynomial with integer coefficients, :math:`d` is a denominator, and the integer\n        basis is given by :math:`A/d`.\n        \n        :math:`rnf[3]` (:literal:`rnf.disc`) is a two-component row vector\n        :math:`[d (L/K),s]` where :math:`d (L/K)` is the relative ideal discriminant\n        of :math:`L/K` and :math:`s` is the discriminant of :math:`L/K` viewed as an element of\n        :math:`K^*/(K^*)^2`, in other words it is the output of :literal:`rnfdisc`.\n        \n        :math:`rnf[4]`(:literal:`rnf.index`) is the ideal index :math:`f`, i.e.\302\240such\n        that :math:`d(T)\\mathbb{Z}_K = f^2d (L/K)`.\n        \n        :math:`rnf[5]` is currently unused.\n        \n        :math:`rnf[6]` is currently unused.\n        \n        :math:`rnf[7]` (:literal:`rnf.zk`) is the pseudo-basis :math:`(A,I)` for the maximal\n        order :math:`\\mathbb{Z}_L` as a :math:`\\mathbb{Z}_K`-module: :math:`A` is the relative integral pseudo basis\n        expressed as polynomials (in the variable of :math:`T`) with polmod coefficients\n        in :math:`nf`, and the second component :math:`I` is the ideal list of the\n        pseudobasis in HNF.\n        \n        :math:`rnf[8]` is the inverse matrix of the integral basis matrix, with\n        coefficients polmods in :math:`nf`.\n        \n        :math:`rnf[9]` is currently unused.\n        \n        :math:`rnf[10]` (:literal:`rnf.nf`) is :math:`nf`.\n        \n        :math:`rnf[11]` is an extension of :literal:`rnfequation(K, T, 1)`. Namely, a\n        vector :math:`[P, a, k, K.pol, T]` describing the :emphasis:`absolute`\n        extension :math:`L/\\mathbb{Q}`: :math:`P` is an absolute equation, more conveniently obtained\n      ""  as :literal:`rnf.polabs`; :math:`a` expresses the generator :math:`\\alpha = y mod K.pol`\n        of the number field :math:`K` as an element of :math:`L`, i.e.\302\240a polynomial modulo the\n        absolute equation :math:`P`;\n        \n        :math:`k` is a small integer such that, if :math:`\\beta` is an abstract root of :math:`T`\n        and :math:`\\alpha` the generator of :math:`K` given above, then :math:`P(\\beta + k\\alpha) = 0`.\n        It is guaranteed that :math:`k = 0` if :math:`\\mathbb{Q} (\\beta) = L`.\n        \n        :strong:`Caveat.` Be careful if :math:`k != 0` when dealing simultaneously with\n        absolute and relative quantities since :math:`L = \\mathbb{Q} (\\beta + k\\alpha) =\n        K(\\alpha)`, and the generator chosen for the absolute extension is not the\n        same as for the relative one. If this happens, one can of course go on\n        working, but we advise to change the relative polynomial so that its root\n        becomes :math:`\\beta + k \\alpha`. Typical GP instructions would be\n        \n        ::\n        \n             [P,a,k] = rnfequation(K, T, 1);\n             if (k, T = subst(T, x, x - k*Mod(y, K.pol)));\n             L = rnfinit(K, T);\n        \n        :math:`rnf[12]` is by default unused and set equal to 0. This field is used\n        to store further information about the field as it becomes available (which\n        is rarely needed, hence would be too expensive to compute during the initial\n        :literal:`rnfinit` call).\n        \n        :strong:`Huge discriminants, helping rnfdisc.` When :math:`T` has a\n        discriminant which is difficult to factor, it is hard to compute\n        :math:`\\mathbb{Z}_L`. As in :literal:`nfinit`, the special input format :math:`[T,B]`\n        is also accepted, where :math:`T` is a polynomial as above and :math:`B` is\n        an integer. Instead of :math:`\\mathbb{Z}_L`, this produces an order which is maximal\n        at all primes less than :math:`""B`. The result is actually a complete and correct\n        :emphasis:`rnf` structure if all prime divisors of the relative ideal\n        discriminant divide a rational prime less than :math:`B`. In general, the order\n        may not be maximal at primes :math:`p \\| p` for :math:`p >= B` such that\n        :math:`p^2` divides the relative ideal discriminant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1615rnfinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_T = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_T,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfinit", 0, 2, 3, 1); __PYX_ERR(4, 27856, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfinit") < 0)) __PYX_ERR(4, 27856, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_T = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 27856, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfinit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27856, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1614rnfinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_T, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1614rnfinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfinit", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":27955
 *         :math:`p^2` divides the relative ideal discriminant.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27956
 *         '''
 *         nf = objtogen(nf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27957
 *         nf = objtogen(nf)
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27957, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27958
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27959
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27960
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfinit0(__pyx_v__nf, __pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":27961
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfisabelian(self, nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27856
 *         return new_gen(_ret)
 * 
 *     def rnfinit(self, nf, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27963
 *         return new_gen(_ret)
 * 
 *     def rnfisabelian(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being a relative polynomial with coefficients
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1617rnfisabelian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1616rnfisabelian[] = "\n        :math:`T` being a relative polynomial with coefficients\n        in :emphasis:`nf`, return 1 if it defines an abelian extension, and 0 otherwise.\n        \n        ::\n        \n            ? K = nfinit(y^2 + 23);\n            ? rnfisabelian(K, x^3 - 3*x - y)\n            %2 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1617rnfisabelian(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisabelian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_T,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_nf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfisabelian", 1, 2, 2, 1); __PYX_ERR(4, 27963, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfisabelian") < 0)) __PYX_ERR(4, 27963, __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_nf = values[0];
    __pyx_v_T = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfisabelian", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27963, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisabelian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1616rnfisabelian(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_T);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1616rnfisabelian(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisabelian", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":27974
 *             %2 = 1
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27975
 *         '''
 *         nf = objtogen(nf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27976
 *         nf = objtogen(nf)
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27976, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27977
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef long _ret = rnfisabelian(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27978
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rnfisabelian(_nf, _T)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27979
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef long _ret = rnfisabelian(_nf, _T)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rnfisabelian(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_instance.pxi":27980
 *         cdef GEN _T = (<Gen>T).g
 *         cdef long _ret = rnfisabelian(_nf, _T)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":27981
 *         cdef long _ret = rnfisabelian(_nf, _T)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def rnfisfree(self, bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27963
 *         return new_gen(_ret)
 * 
 *     def rnfisabelian(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being a relative polynomial with coefficients
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisabelian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":27983
 *         return _ret
 * 
 *     def rnfisfree(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1619rnfisfree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1618rnfisfree[] = "\n        Given :math:`bnf` as output by\n        :literal:`bnfinit`, and either a polynomial :math:`x` with coefficients in :math:`bnf`\n        defining a relative extension :math:`L` of :math:`bnf`, or a pseudo-basis :math:`x` of\n        such an extension, returns true (1) if :math:`L/bnf` is free, false (0) if\n        not.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1619rnfisfree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisfree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnf,&__pyx_n_s_x,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_bnf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfisfree", 1, 2, 2, 1); __PYX_ERR(4, 27983, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfisfree") < 0)) __PYX_ERR(4, 27983, __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_bnf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfisfree", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 27983, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisfree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1618rnfisfree(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1618rnfisfree(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisfree", 0);
  __Pyx_INCREF(__pyx_v_bnf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":27991
 *         not.
 *         '''
 *         bnf = objtogen(bnf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27992
 *         '''
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":27993
 *         bnf = objtogen(bnf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 27993, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":27994
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rnfisfree(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27995
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rnfisfree(_bnf, _x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":27996
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rnfisfree(_bnf, _x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rnfisfree(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":27997
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rnfisfree(_bnf, _x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":27998
 *         cdef long _ret = rnfisfree(_bnf, _x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def rnfislocalcyclo(self, rnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 27998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":27983
 *         return _ret
 * 
 *     def rnfisfree(self, bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisfree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28000
 *         return _ret
 * 
 *     def rnfislocalcyclo(self, rnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number field extension :math:`L/K` as output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1621rnfislocalcyclo(PyObject *__pyx_v_self, PyObject *__pyx_v_rnf); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1620rnfislocalcyclo[] = "\n        Let :emphasis:`rnf` be a relative number field extension :math:`L/K` as output\n        by :literal:`rnfinit` whose degree :math:`[L:K]` is a power of a prime :math:`\\ell`.\n        Return :math:`1` if the :math:`\\ell`-extension is locally cyclotomic (locally contained in\n        the cyclotomic :math:`\\mathbb{Z}_\\ell`-extension of :math:`K_v` at all places :math:`v \\| \\ell`), and\n        :math:`0` if not.\n        \n        ::\n        \n            ? K = nfinit(y^2 + y + 1);\n            ? L = rnfinit(K, x^3 - y); /* = K(zeta_9), globally cyclotomic */\n            ? rnfislocalcyclo(L)\n            %3 = 1\n            \\\\ we expect 3-adic continuity by Krasner's lemma\n            ? vector(5, i, rnfislocalcyclo(rnfinit(K, x^3 - y + 3^i)))\n            %5 = [0, 1, 1, 1, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1621rnfislocalcyclo(PyObject *__pyx_v_self, PyObject *__pyx_v_rnf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfislocalcyclo (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1620rnfislocalcyclo(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_rnf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1620rnfislocalcyclo(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_rnf) {
  GEN __pyx_v__rnf;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfislocalcyclo", 0);
  __Pyx_INCREF(__pyx_v_rnf);

  /* "cypari/auto_instance.pxi":28018
 *             %5 = [0, 1, 1, 1, 1]
 *         '''
 *         rnf = objtogen(rnf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28019
 *         '''
 *         rnf = objtogen(rnf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28019, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28020
 *         rnf = objtogen(rnf)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28021
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef long _ret = rnfislocalcyclo(_rnf)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rnfislocalcyclo(__pyx_v__rnf);

  /* "cypari/auto_instance.pxi":28022
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":28023
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def rnfisnorm(self, T, a, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28000
 *         return _ret
 * 
 *     def rnfislocalcyclo(self, rnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number field extension :math:`L/K` as output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfislocalcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rnf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28025
 *         return _ret
 * 
 *     def rnfisnorm(self, T, a, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Similar to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1623rnfisnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1622rnfisnorm[] = "\n        Similar to\n        :literal:`bnfisnorm` but in the relative case. :math:`T` is as output by\n        :literal:`rnfisnorminit` applied to the extension :math:`L/K`. This tries to decide\n        whether the element :math:`a` in :math:`K` is the norm of some :math:`x` in the extension\n        :math:`L/K`.\n        \n        The output is a vector :math:`[x,q]`, where :math:`a = \\mathrm{Norm} (x)*q`. The\n        algorithm looks for a solution :math:`x` which is an :math:`S`-integer, with :math:`S` a list\n        of places of :math:`K` containing at least the ramified primes, the generators of\n        the class group of :math:`L`, as well as those primes dividing :math:`a`. If :math:`L/K` is\n        Galois, then this is enough; otherwise, :math:`flag` is used to add more primes to\n        :math:`S`: all the places above the primes :math:`p <= flag` (resp.\302\240:math:`p\\|flag`) if :math:`flag > 0`\n        (resp.\302\240:math:`flag < 0`).\n        \n        The answer is guaranteed (i.e.\302\240:math:`a` is a norm iff :math:`q = 1`) if the field is\n        Galois, or, under GRH, if :math:`S` contains all primes less than\n        :math:`12\\log^2\\|\\mathrm{disc} (M)\\|`, where :math:`M` is the normal\n        closure of :math:`L/K`.\n        \n        If :literal:`rnfisnorminit` has determined (or was told) that :math:`L/K` is\n        Galois, and :math:`flag != 0`, a Warning is issued (so that you can set\n        :math:`flag = 1` to check whether :math:`L/K` is known to be Galois, according to :math:`T`).\n        Example:\n        \n        ::\n        \n            bnf = bnfinit(y^3 + y^2 - 2*y - 1);\n            p = x^2 + Mod(y^2 + 2*y + 1, bnf.pol);\n            T = rnfisnorminit(bnf, p);\n            rnfisnorm(T, 17)\n        \n        checks whether :math:`17` is a norm in the Galois extension :math:`\\mathbb{Q} (\\beta) /\n        \\mathbb{Q} (\\alpha)`, where :math:`\\alpha^3 + \\alpha^2 - 2\\alpha - 1 = 0` and :math:`\\beta^2 +\n        ""\\alpha^2 + 2\\alpha + 1 = 0` (it is).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1623rnfisnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_a = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_a,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_T)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfisnorm", 0, 2, 3, 1); __PYX_ERR(4, 28025, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfisnorm") < 0)) __PYX_ERR(4, 28025, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_T = values[0];
    __pyx_v_a = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28025, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfisnorm", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28025, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1622rnfisnorm(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_T, __pyx_v_a, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1622rnfisnorm(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_T, PyObject *__pyx_v_a, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisnorm", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":28062
 *         \alpha^2 + 2\alpha + 1 = 0` (it is).
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28063
 *         '''
 *         T = objtogen(T)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28063, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28064
 *         T = objtogen(T)
 *         a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28064, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28065
 *         a = objtogen(a)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28066
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28067
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfisnorm(__pyx_v__T, __pyx_v__a, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":28068
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfisnorminit(self, pol, polrel, long flag=2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28025
 *         return _ret
 * 
 *     def rnfisnorm(self, T, a, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Similar to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28070
 *         return new_gen(_ret)
 * 
 *     def rnfisnorminit(self, pol, polrel, long flag=2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be defined by a root of :emphasis:`pol`, and :math:`L/K` the extension defined
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1625rnfisnorminit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1624rnfisnorminit[] = "\n        Let :math:`K` be defined by a root of :emphasis:`pol`, and :math:`L/K` the extension defined\n        by the polynomial :emphasis:`polrel`. As usual, :emphasis:`pol` can in fact be an :emphasis:`nf`,\n        or :emphasis:`bnf`, etc; if :emphasis:`pol` has degree :math:`1` (the base field is :math:`\\mathbb{Q}`),\n        polrel is also allowed to be an :emphasis:`nf`, etc. Computes technical data needed\n        by :literal:`rnfisnorm` to solve norm equations :math:`Nx = a`, for :math:`x` in :math:`L`, and :math:`a`\n        in :math:`K`.\n        \n        If :math:`flag = 0`, do not care whether :math:`L/K` is Galois or not.\n        \n        If :math:`flag = 1`, :math:`L/K` is assumed to be Galois (unchecked), which speeds up\n        :literal:`rnfisnorm`.\n        \n        If :math:`flag = 2`, let the routine determine whether :math:`L/K` is Galois.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1625rnfisnorminit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_polrel = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisnorminit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_polrel,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pol)) != 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_polrel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfisnorminit", 0, 2, 3, 1); __PYX_ERR(4, 28070, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfisnorminit") < 0)) __PYX_ERR(4, 28070, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_pol = values[0];
    __pyx_v_polrel = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28070, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)2);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfisnorminit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28070, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisnorminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1624rnfisnorminit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_pol, __pyx_v_polrel, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1624rnfisnorminit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_pol, PyObject *__pyx_v_polrel, long __pyx_v_flag) {
  GEN __pyx_v__pol;
  GEN __pyx_v__polrel;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisnorminit", 0);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_polrel);

  /* "cypari/auto_instance.pxi":28086
 *         If :math:`flag = 2`, let the routine determine whether :math:`L/K` is Galois.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         polrel = objtogen(polrel)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28087
 *         '''
 *         pol = objtogen(pol)
 *         polrel = objtogen(polrel)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_polrel, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_polrel, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28088
 *         pol = objtogen(pol)
 *         polrel = objtogen(polrel)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28088, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28089
 *         polrel = objtogen(polrel)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28090
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _polrel = (<Gen>polrel).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_polrel)->__pyx_base.g;
  __pyx_v__polrel = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28091
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfisnorminit(__pyx_v__pol, __pyx_v__polrel, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":28092
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfkummer(self, bnr, subgp=None, long d=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28070
 *         return new_gen(_ret)
 * 
 *     def rnfisnorminit(self, pol, polrel, long flag=2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be defined by a root of :emphasis:`pol`, and :math:`L/K` the extension defined
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfisnorminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_polrel);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28094
 *         return new_gen(_ret)
 * 
 *     def rnfkummer(self, bnr, subgp=None, long d=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1627rnfkummer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1626rnfkummer[] = "\n        :emphasis:`bnr`\n        being as output by :literal:`bnrinit`, finds a relative equation for the\n        class field corresponding to the module in :emphasis:`bnr` and the given\n        congruence subgroup (the full ray class field if :emphasis:`subgp` is omitted).\n        If :math:`d` is positive, outputs the list of all relative equations of\n        degree :math:`d` contained in the ray class field defined by :emphasis:`bnr`, with\n        the :emphasis:`same` conductor as :math:`(bnr, subgp)`.\n        \n        :strong:`Warning.` This routine only works for subgroups of prime index. It\n        uses Kummer theory, adjoining necessary roots of unity (it needs to compute a\n        tough :literal:`bnfinit` here), and finds a generator via Hecke's characterization\n        of ramification in Kummer extensions of prime degree. If your extension does\n        not have prime degree, for the time being, you have to split it by hand as a\n        tower / compositum of such extensions.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1627rnfkummer(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_subgp = 0;
  long __pyx_v_d;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfkummer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_subgp,&__pyx_n_s_d,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_bnr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subgp);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfkummer") < 0)) __PYX_ERR(4, 28094, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bnr = values[0];
    __pyx_v_subgp = values[1];
    if (values[2]) {
      __pyx_v_d = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28094, __pyx_L3_error)
    } else {
      __pyx_v_d = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28094, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfkummer", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28094, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfkummer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1626rnfkummer(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_subgp, __pyx_v_d, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1626rnfkummer(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_subgp, long __pyx_v_d, long __pyx_v_precision) {
  int __pyx_v__have_subgp;
  GEN __pyx_v__bnr;
  GEN __pyx_v__subgp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("rnfkummer", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_subgp);

  /* "cypari/auto_instance.pxi":28111
 *         tower / compositum of such extensions.
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         cdef bint _have_subgp = (subgp is not None)
 *         if _have_subgp:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28111, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28112
 *         '''
 *         bnr = objtogen(bnr)
 *         cdef bint _have_subgp = (subgp is not None)             # <<<<<<<<<<<<<<
 *         if _have_subgp:
 *             subgp = objtogen(subgp)
 */
  __pyx_t_2 = (__pyx_v_subgp != Py_None);
  __pyx_v__have_subgp = __pyx_t_2;

  /* "cypari/auto_instance.pxi":28113
 *         bnr = objtogen(bnr)
 *         cdef bint _have_subgp = (subgp is not None)
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             subgp = objtogen(subgp)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_subgp != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":28114
 *         cdef bint _have_subgp = (subgp is not None)
 *         if _have_subgp:
 *             subgp = objtogen(subgp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_subgp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_subgp, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":28113
 *         bnr = objtogen(bnr)
 *         cdef bint _have_subgp = (subgp is not None)
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             subgp = objtogen(subgp)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":28115
 *         if _have_subgp:
 *             subgp = objtogen(subgp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 28115, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28116
 *             subgp = objtogen(subgp)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":28117
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL             # <<<<<<<<<<<<<<
 *         if _have_subgp:
 *             _subgp = (<Gen>subgp).g
 */
  __pyx_v__subgp = NULL;

  /* "cypari/auto_instance.pxi":28118
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_subgp != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":28119
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:
 *             _subgp = (<Gen>subgp).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_subgp)->__pyx_base.g;
    __pyx_v__subgp = __pyx_t_4;

    /* "cypari/auto_instance.pxi":28118
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":28120
 *         if _have_subgp:
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":28121
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfkummer(__pyx_v__bnr, __pyx_v__subgp, __pyx_v_d, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":28122
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnflllgram(self, nf, pol, order, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28094
 *         return new_gen(_ret)
 * 
 *     def rnfkummer(self, bnr, subgp=None, long d=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfkummer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_subgp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28124
 *         return new_gen(_ret)
 * 
 *     def rnflllgram(self, nf, pol, order, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1629rnflllgram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1628rnflllgram[] = "\n        Given a polynomial\n        :emphasis:`pol` with coefficients in :emphasis:`nf` defining a relative extension :math:`L` and\n        a suborder :emphasis:`order` of :math:`L` (of maximal rank), as output by\n        :literal:`rnfpseudobasis`:math:`(nf,pol)` or similar, gives\n        :math:`[[neworder],U]`, where :emphasis:`neworder` is a reduced order and :math:`U` is\n        the unimodular transformation matrix.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1629rnflllgram(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_order = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnflllgram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pol,&__pyx_n_s_order,&__pyx_n_s_precision,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_nf)) != 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_pol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnflllgram", 0, 3, 4, 1); __PYX_ERR(4, 28124, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_order)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnflllgram", 0, 3, 4, 2); __PYX_ERR(4, 28124, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnflllgram") < 0)) __PYX_ERR(4, 28124, __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_nf = values[0];
    __pyx_v_pol = values[1];
    __pyx_v_order = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28124, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnflllgram", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28124, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1628rnflllgram(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pol, __pyx_v_order, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1628rnflllgram(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_order, long __pyx_v_precision) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__order;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnflllgram", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_order);

  /* "cypari/auto_instance.pxi":28133
 *         the unimodular transformation matrix.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         order = objtogen(order)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28134
 *         '''
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         order = objtogen(order)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28135
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 *         order = objtogen(order)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_order, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_order, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28136
 *         pol = objtogen(pol)
 *         order = objtogen(order)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28136, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28137
 *         order = objtogen(order)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _order = (<Gen>order).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28138
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _order = (<Gen>order).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28139
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _order = (<Gen>order).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_order)->__pyx_base.g;
  __pyx_v__order = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28140
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _order = (<Gen>order).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":28141
 *         cdef GEN _order = (<Gen>order).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnflllgram(__pyx_v__nf, __pyx_v__pol, __pyx_v__order, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":28142
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfnormgroup(self, bnr, pol):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28124
 *         return new_gen(_ret)
 * 
 *     def rnflllgram(self, nf, pol, order, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_order);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28144
 *         return new_gen(_ret)
 * 
 *     def rnfnormgroup(self, bnr, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being a big ray
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1631rnfnormgroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1630rnfnormgroup[] = "\n        :emphasis:`bnr` being a big ray\n        class field as output by :literal:`bnrinit` and :emphasis:`pol` a relative polynomial\n        defining an Abelian extension, computes the norm group (alias Artin\n        or Takagi group) corresponding to the Abelian extension of\n        :math:`bnf =`:literal:`bnr.bnf`\n        defined by :emphasis:`pol`, where the module corresponding to :emphasis:`bnr` is assumed\n        to be a multiple of the conductor (i.e.\302\240:emphasis:`pol` defines a subextension of\n        bnr). The result is the HNF defining the norm group on the given generators\n        of :literal:`bnr.gen`. Note that neither the fact that :emphasis:`pol` defines an\n        Abelian extension nor the fact that the module is a multiple of the conductor\n        is checked. The result is undefined if the assumption is not correct,\n        but the function will return the empty matrix :literal:`[;]` if it detects a\n        problem; it may also not detect the problem and return a wrong result.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1631rnfnormgroup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfnormgroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_pol,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_bnr)) != 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_pol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfnormgroup", 1, 2, 2, 1); __PYX_ERR(4, 28144, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfnormgroup") < 0)) __PYX_ERR(4, 28144, __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_bnr = values[0];
    __pyx_v_pol = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfnormgroup", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28144, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfnormgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1630rnfnormgroup(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_pol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1630rnfnormgroup(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_pol) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfnormgroup", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":28160
 *         problem; it may also not detect the problem and return a wrong result.
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28161
 *         '''
 *         bnr = objtogen(bnr)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28162
 *         bnr = objtogen(bnr)
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28162, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28163
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28164
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28165
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfnormgroup(__pyx_v__bnr, __pyx_v__pol);

  /* "cypari/auto_instance.pxi":28166
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpolred(self, nf, pol, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28144
 *         return new_gen(_ret)
 * 
 *     def rnfnormgroup(self, bnr, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being a big ray
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfnormgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28168
 *         return new_gen(_ret)
 * 
 *     def rnfpolred(self, nf, pol, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete: use :literal:`rnfpolredbest` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1633rnfpolred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1632rnfpolred[] = "\n        This function is obsolete: use :literal:`rnfpolredbest` instead.\n        Relative version of :literal:`polred`. Given a monic polynomial :emphasis:`pol` with\n        coefficients in :math:`nf`, finds a list of relative polynomials defining some\n        subfields, hopefully simpler and containing the original field. In the present\n        version :strong:`2.11.3`, this is slower and less efficient than :literal:`rnfpolredbest`.\n        \n        :strong:`Remark.` this function is based on an incomplete reduction\n        theory of lattices over number fields, implemented by :literal:`rnflllgram`, which\n        deserves to be improved.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1633rnfpolred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpolred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pol,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_pol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfpolred", 0, 2, 3, 1); __PYX_ERR(4, 28168, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfpolred") < 0)) __PYX_ERR(4, 28168, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_pol = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28168, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfpolred", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28168, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpolred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1632rnfpolred(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pol, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1632rnfpolred(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_precision) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("rnfpolred", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":28180
 *         deserves to be improved.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)
 *         nf = objtogen(nf)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28180, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":28181
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":28182
 *         from warnings import warn
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":28183
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":28184
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 28184, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28185
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":28186
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_4;

  /* "cypari/auto_instance.pxi":28187
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":28188
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpolred(__pyx_v__nf, __pyx_v__pol, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":28189
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpolredabs(self, nf, pol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28168
 *         return new_gen(_ret)
 * 
 *     def rnfpolred(self, nf, pol, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete: use :literal:`rnfpolredbest` instead.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpolred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28191
 *         return new_gen(_ret)
 * 
 *     def rnfpolredabs(self, nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredabs`. Given an irreducible monic polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1635rnfpolredabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1634rnfpolredabs[] = "\n        Relative version of :literal:`polredabs`. Given an irreducible monic polynomial\n        :emphasis:`pol` with coefficients in :math:`nf`, finds a canonical relative\n        polynomial defining the same field, hopefully with small coefficients.\n        Note that the equation is only canonical for a fixed :emphasis:`nf`, using a\n        different defining polynomial in the :emphasis:`nf` structure will produce a\n        different relative equation.\n        \n        The binary digits of :math:`flag` correspond to :math:`1`: add information to convert\n        elements to the new representation, :math:`2`: absolute polynomial, instead of\n        relative, :math:`16`: possibly use a suborder of the maximal order. More precisely:\n        \n        0: default, return :math:`P`\n        \n        1: returns :math:`[P,a]` where :math:`P` is the default output and :math:`a`,\n        a :literal:`t_POLMOD` modulo :math:`P`, is a root of :emphasis:`pol`.\n        \n        2: returns :emphasis:`Pabs`, an absolute, instead of a relative, polynomial.\n        This polynomial is canonical and does not depend on the :emphasis:`nf` structure.\n        Same as but faster than\n        \n        ::\n        \n             polredabs(rnfequation(nf, pol))\n        \n        3: returns :math:`[Pabs,a,b]`, where :emphasis:`Pabs` is an absolute polynomial\n        as above, :math:`a`, :math:`b` are :literal:`t_POLMOD` modulo :emphasis:`Pabs`, roots of :literal:`nf.pol`\n        and :emphasis:`pol` respectively.\n        \n        16: possibly use a suborder of the maximal order. This is slower than the\n        default when the relative discriminant is smooth, and much faster otherwise.\n        In this case the result is no longer canonical; see ``polredabs`` (in the PARI manual).\n        \n        :strong:`Warning.` The complexity of :literal:`rnfpolredabs`\n        is exponential in the absolute degree. The function :literal:`rnfpolredbest` runs\n        in polynomial"" time, and tends to return polynomials with smaller\n        discriminants.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1635rnfpolredabs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpolredabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pol,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_pol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfpolredabs", 0, 2, 3, 1); __PYX_ERR(4, 28191, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfpolredabs") < 0)) __PYX_ERR(4, 28191, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_pol = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28191, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfpolredabs", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28191, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpolredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1634rnfpolredabs(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1634rnfpolredabs(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfpolredabs", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":28230
 *         discriminants.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28231
 *         '''
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28232
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28232, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28233
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28234
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28235
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpolredabs(__pyx_v__nf, __pyx_v__pol, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":28236
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpolredbest(self, nf, pol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28191
 *         return new_gen(_ret)
 * 
 *     def rnfpolredabs(self, nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredabs`. Given an irreducible monic polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpolredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28238
 *         return new_gen(_ret)
 * 
 *     def rnfpolredbest(self, nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredbest`. Given a monic polynomial :emphasis:`pol`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1637rnfpolredbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1636rnfpolredbest[] = "\n        Relative version of :literal:`polredbest`. Given a monic polynomial :emphasis:`pol`\n        with coefficients in :math:`nf`, finds a simpler relative polynomial :math:`P`\n        defining the same field. As opposed to :literal:`rnfpolredabs` this function does\n        not return a :emphasis:`smallest` (canonical) polynomial with respect to some\n        measure, but it does run in polynomial time.\n        \n        The binary digits of :math:`flag` correspond to :math:`1`: add information to convert\n        elements to the new representation, :math:`2`: absolute polynomial, instead of\n        relative. More precisely:\n        \n        0: default, return :math:`P`\n        \n        1: returns :math:`[P,a]` where :math:`P` is the default output and :math:`a`,\n        a :literal:`t_POLMOD` modulo :math:`P`, is a root of :emphasis:`pol`.\n        \n        2: returns :emphasis:`Pabs`, an absolute, instead of a relative, polynomial.\n        Same as but faster than\n        \n        ::\n        \n             rnfequation(nf, rnfpolredbest(nf,pol))\n        \n        3: returns :math:`[Pabs,a,b]`, where :emphasis:`Pabs` is an absolute polynomial\n        as above, :math:`a`, :math:`b` are :literal:`t_POLMOD` modulo :emphasis:`Pabs`, roots of :literal:`nf.pol`\n        and :emphasis:`pol` respectively.\n        \n        ::\n        \n            ? K = nfinit(y^3-2); pol = x^2 +x*y + y^2;\n            ? [P, a] = rnfpolredbest(K,pol,1);\n            ? P\n            %3 = x^2 - x + Mod(y - 1, y^3 - 2)\n            ? a\n            %4 = Mod(Mod(2*y^2+3*y+4,y^3-2)*x + Mod(-y^2-2*y-2,y^3-2),\n             x^2 - x + Mod(y-1,y^3-2))\n            ? subst(K.pol,y,a)\n            %5 = 0\n            ? [Pabs, a, b] = rnfpolredbest(K,pol,3);\n            ? Pabs\n            %7 = x^6 - 3*x^5 + 5*x^3 - 3*x + 1\n            ? a\n            %8 = Mod(-x^2+x+1, x^6-3*x^5+5*x^3-3*x+1)\n            ? b\n            %9 = Mod(2*x^5-5*x^4-3*x^3+10*x^2+5*x-5, x^6-3*x^5+5*x^3""-3*x+1)\n            ? subst(K.pol,y,a)\n            %10 = 0\n            ? substvec(pol,[x,y],[a,b])\n            %11 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1637rnfpolredbest(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpolredbest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_pol,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nf)) != 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_pol)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfpolredbest", 0, 2, 3, 1); __PYX_ERR(4, 28238, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfpolredbest") < 0)) __PYX_ERR(4, 28238, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_nf = values[0];
    __pyx_v_pol = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28238, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfpolredbest", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28238, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpolredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1636rnfpolredbest(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_pol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1636rnfpolredbest(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfpolredbest", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_instance.pxi":28289
 *             %11 = 0
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28290
 *         '''
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28291
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28291, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28292
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28293
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28294
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpolredbest(__pyx_v__nf, __pyx_v__pol, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":28295
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpseudobasis(self, nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28238
 *         return new_gen(_ret)
 * 
 *     def rnfpolredbest(self, nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredbest`. Given a monic polynomial :emphasis:`pol`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpolredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28297
 *         return new_gen(_ret)
 * 
 *     def rnfpseudobasis(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1639rnfpseudobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1638rnfpseudobasis[] = "\n        Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by\n        :literal:`nfinit`, and a monic irreducible polynomial :math:`T` in :math:`K[x]` defining a\n        relative extension :math:`L = K[x]/(T)`, computes the relative discriminant of :math:`L`\n        and a pseudo-basis :math:`(A,J)` for the maximal order :math:`\\mathbb{Z}_L` viewed as a\n        :math:`\\mathbb{Z}_K`-module. This is output as a vector :math:`[A,J,D,d]`, where :math:`D` is the\n        relative ideal discriminant and :math:`d` is the relative discriminant considered\n        as an element of :math:`K^*/{K^*}^2`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? [A,J,D,d] = rnfpseudobasis(K, x^2+y);\n            ? A\n            %3 =\n            [1 0]\n            \n            [0 1]\n            \n            ? J\n            %4 = [1, 1]\n            ? D\n            %5 = [0, -4]~\n            ? d\n            %6 = [0, -1]~\n        \n        :strong:`Huge discriminants, helping rnfdisc.` the format :math:`[T,B]` is\n        also accepted instead of :math:`T` and produce an order which is maximal at all\n        primes :math:`p < B`, see :literal:`\077\077rnfinit`.\n        \n        ::\n        \n            ? p = 585403248812100232206609398101;\n            ? q = 711171340236468512951957953369;\n            ? T = x^2 + 3*(p*q)^2;\n            ? [A,J,D,d] = V = rnfpseudobasis(K, T); D\n            time = 22,178 ms.\n            %10 =\n            [3 0]\n            \n            [0 3]\n            ? [A,J,D,d] = W = rnfpseudobasis(K, [T,100]); D\n            time = 5 ms.\n            %11 =\n            [3 0]\n            \n            [0 3]\n            ? V == W\n            %12 = 1\n        \n        In this example, the results are identical since :math:`D \\cap \\mathbb{Z}`\n        factors over primes less than :math:`100`. Had it not been the case, the\n        order would have been guaranteed maximal at primes :""math:`p \\| p` for :math:`p\n        <= 100` only (and might not have been maximal at any maximal ideal\n        :math:`p` such that :math:`p^2` dividing :math:`D`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1639rnfpseudobasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpseudobasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_T,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_nf)) != 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_T)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfpseudobasis", 1, 2, 2, 1); __PYX_ERR(4, 28297, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfpseudobasis") < 0)) __PYX_ERR(4, 28297, __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_nf = values[0];
    __pyx_v_T = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfpseudobasis", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28297, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpseudobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1638rnfpseudobasis(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_T);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1638rnfpseudobasis(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfpseudobasis", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":28354
 *         :math:`p` such that :math:`p^2` dividing :math:`D`.
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28355
 *         '''
 *         nf = objtogen(nf)
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28355, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28356
 *         nf = objtogen(nf)
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28356, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28357
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28358
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28359
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpseudobasis(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_instance.pxi":28360
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfsteinitz(self, nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28297
 *         return new_gen(_ret)
 * 
 *     def rnfpseudobasis(self, nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfpseudobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28362
 *         return new_gen(_ret)
 * 
 *     def rnfsteinitz(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`nf` as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1641rnfsteinitz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1640rnfsteinitz[] = "\n        Given a number field :math:`nf` as\n        output by :literal:`nfinit` and either a polynomial :math:`x` with coefficients in\n        :math:`nf` defining a relative extension :math:`L` of :math:`nf`, or a pseudo-basis\n        :math:`x` of such an extension as output for example by :literal:`rnfpseudobasis`,\n        computes another pseudo-basis :math:`(A,I)` (not in HNF in general) such that all\n        the ideals of :math:`I` except perhaps the last one are equal to the ring of\n        integers of :math:`nf`, and outputs the four-component row vector :math:`[A,I,D,d]`\n        as in :literal:`rnfpseudobasis`. The name of this function comes from the fact\n        that the ideal class of the last ideal of :math:`I`, which is well defined, is the\n        Steinitz class of the :math:`\\mathbb{Z}_K`-module :math:`\\mathbb{Z}_L` (its image in :math:`SK_0(\\mathbb{Z}_K)`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1641rnfsteinitz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_nf = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfsteinitz (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nf,&__pyx_n_s_x,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_nf)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfsteinitz", 1, 2, 2, 1); __PYX_ERR(4, 28362, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfsteinitz") < 0)) __PYX_ERR(4, 28362, __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_nf = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfsteinitz", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28362, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfsteinitz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1640rnfsteinitz(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_nf, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1640rnfsteinitz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfsteinitz", 0);
  __Pyx_INCREF(__pyx_v_nf);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28375
 *         Steinitz class of the :math:`\mathbb{Z}_K`-module :math:`\mathbb{Z}_L` (its image in :math:`SK_0(\mathbb{Z}_K)`).
 *         '''
 *         nf = objtogen(nf)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_nf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_nf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28376
 *         '''
 *         nf = objtogen(nf)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28377
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28377, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28378
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28379
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28380
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfsteinitz(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_instance.pxi":28381
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def select(self, f, A, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28362
 *         return new_gen(_ret)
 * 
 *     def rnfsteinitz(self, nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`nf` as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.rnfsteinitz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_nf);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28383
 *         return new_gen(_ret)
 * 
 *     def select(self, f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         We first describe the default behavior, when :math:`flag` is 0 or omitted.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1643select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1642select[] = "\n        We first describe the default behavior, when :math:`flag` is 0 or omitted.\n        Given a vector or list :literal:`A` and a :literal:`t_CLOSURE` :literal:`f`, :literal:`select`\n        returns the elements :math:`x` of :literal:`A` such that :math:`f(x)` is non-zero. In other\n        words, :literal:`f` is seen as a selection function returning a boolean value.\n        \n        ::\n        \n            ? select(x->isprime(x), vector(50,i,i^2+1))\n            %1 = [2, 5, 17, 37, 101, 197, 257, 401, 577, 677, 1297, 1601]\n            ? select(x->(x<100), %)\n            %2 = [2, 5, 17, 37]\n        \n        returns the primes of the form :math:`i^2+1` for some :math:`i <= 50`,\n        then the elements less than 100 in the preceding result. The :literal:`select`\n        function also applies to a matrix :literal:`A`, seen as a vector of columns, i.e. it\n        selects columns instead of entries, and returns the matrix whose columns are\n        the selected ones.\n        \n        :strong:`Remark.` For :math:`v` a :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_LIST` or :literal:`t_MAT`,\n        the alternative set-notations\n        \n        ::\n        \n            [g(x) | x <- v, f(x)]\n            [x | x <- v, f(x)]\n            [g(x) | x <- v]\n        \n        are available as shortcuts for\n        \n        ::\n        \n            apply(g, select(f, Vec(v)))\n            select(f, Vec(v))\n            apply(g, Vec(v))\n        \n        respectively:\n        \n        ::\n        \n            ? [ x | x <- vector(50,i,i^2+1), isprime(x) ]\n            %1 = [2, 5, 17, 37, 101, 197, 257, 401, 577, 677, 1297, 1601]\n        \n        If :math:`flag = 1`, this function returns instead the :emphasis:`indices` of\n        the selected elements, and not the elements themselves (indirect selection):\n        \n        ::\n        \n            ? V = vector(50,i,i^2+1);\n            ? select(x->isprime(x), V, 1)\n            %2 = Vecsmall(""[1, 2, 4, 6, 10, 14, 16, 20, 24, 26, 36, 40])\n            ? vecextract(V, %)\n            %3 = [2, 5, 17, 37, 101, 197, 257, 401, 577, 677, 1297, 1601]\n        \n        The following function lists the elements in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`:\n        \n        ::\n        \n            ? invertibles(N) = select(x->gcd(x,N) == 1, [1..N])\n        \n        Finally\n        \n        ::\n        \n            ? select(x->x, M)\n        \n        selects the non-0 entries in :literal:`M`. If the latter is a\n        :literal:`t_MAT`, we extract the matrix of non-0 columns. Note that :emphasis:`removing`\n        entries instead of selecting them just involves replacing the selection\n        function :literal:`f` with its negation:\n        \n        ::\n        \n            ? select(x->!isprime(x), vector(50,i,i^2+1))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1643select(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_A = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_A,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 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_A)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("select", 0, 2, 3, 1); __PYX_ERR(4, 28383, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "select") < 0)) __PYX_ERR(4, 28383, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_f = values[0];
    __pyx_v_A = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28383, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("select", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28383, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1642select(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_A, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1642select(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("select", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_instance.pxi":28459
 *             ? select(x->!isprime(x), vector(50,i,i^2+1))
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28460
 *         '''
 *         f = objtogen(f)
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28461
 *         f = objtogen(f)
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28461, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28462
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = select0(_f, _A, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28463
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = select0(_f, _A, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28464
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = select0(_f, _A, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = select0(__pyx_v__f, __pyx_v__A, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":28465
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = select0(_f, _A, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def self(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28383
 *         return new_gen(_ret)
 * 
 *     def select(self, f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         We first describe the default behavior, when :math:`flag` is 0 or omitted.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28467
 *         return new_gen(_ret)
 * 
 *     def self(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the calling function or closure as a :literal:`t_CLOSURE` object.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1645self(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1644self[] = "\n        Return the calling function or closure as a :literal:`t_CLOSURE` object.\n        This is useful for defining anonymous recursive functions.\n        \n        ::\n        \n            ? (n->if(n==0,1,n*self()(n-1)))(5)\n            %1 = 120\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1645self(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("self (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1644self(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1644self(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("self", 0);

  /* "cypari/auto_instance.pxi":28477
 *             %1 = 120
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pari_self()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 28477, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28478
 *         '''
 *         sig_on()
 *         cdef GEN _ret = pari_self()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pari_self();

  /* "cypari/auto_instance.pxi":28479
 *         sig_on()
 *         cdef GEN _ret = pari_self()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def seralgdep(self, s, long p, long r):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28467
 *         return new_gen(_ret)
 * 
 *     def self(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the calling function or closure as a :literal:`t_CLOSURE` object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.self", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28481
 *         return new_gen(_ret)
 * 
 *     def seralgdep(self, s, long p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a linear relation between powers :math:`(1,s,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1647seralgdep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1646seralgdep[] = "\n        finds a linear relation between powers :math:`(1,s,\n        ..., s^p)` of the series :math:`s`, with polynomial coefficients of degree\n        :math:`<= r`. In case no relation is found, return :math:`0`.\n        \n        ::\n        \n            ? s = 1 + 10*y - 46*y^2 + 460*y^3 - 5658*y^4 + 77740*y^5 + O(y^6);\n            ? seralgdep(s, 2, 2)\n            %2 = -x^2 + (8*y^2 + 20*y + 1)\n            ? subst(%, x, s)\n            %3 = O(y^6)\n            ? seralgdep(s, 1, 3)\n            %4 = (-77*y^2 - 20*y - 1)*x + (310*y^3 + 231*y^2 + 30*y + 1)\n            ? seralgdep(s, 1, 2)\n            %5 = 0\n        \n        The series main variable must not be :math:`x`, so as to be able\n        to express the result as a polynomial in :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1647seralgdep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_p;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("seralgdep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_p,&__pyx_n_s_r,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("seralgdep", 1, 3, 3, 1); __PYX_ERR(4, 28481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("seralgdep", 1, 3, 3, 2); __PYX_ERR(4, 28481, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "seralgdep") < 0)) __PYX_ERR(4, 28481, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_s = values[0];
    __pyx_v_p = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28481, __pyx_L3_error)
    __pyx_v_r = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28481, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("seralgdep", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28481, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.seralgdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1646seralgdep(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_p, __pyx_v_r);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1646seralgdep(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_p, long __pyx_v_r) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("seralgdep", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":28502
 *         to express the result as a polynomial in :math:`x`.
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28503
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = seralgdep(_s, p, r)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28503, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28504
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = seralgdep(_s, p, r)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28505
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = seralgdep(_s, p, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = seralgdep(__pyx_v__s, __pyx_v_p, __pyx_v_r);

  /* "cypari/auto_instance.pxi":28506
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = seralgdep(_s, p, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serchop(self, s, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28481
 *         return new_gen(_ret)
 * 
 *     def seralgdep(self, s, long p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a linear relation between powers :math:`(1,s,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.seralgdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28508
 *         return new_gen(_ret)
 * 
 *     def serchop(self, s, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Remove all terms of degree strictly less than :math:`n` in series :math:`s`. When
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1649serchop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1648serchop[] = "\n        Remove all terms of degree strictly less than :math:`n` in series :math:`s`. When\n        the series contains no terms of degree :math:`< n`, return :math:`O(x^n)`.\n        \n        ::\n        \n            ? s = 1/x + x + 2*x^2 + O(x^3);\n            ? serchop(s)\n            %2 = x + 2*x^3 + O(x^3)\n            ? serchop(s, 2)\n            %3 = 2*x^2 + O(x^3)\n            ? serchop(s, 100)\n            %4 = O(x^100)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1649serchop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serchop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_n,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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "serchop") < 0)) __PYX_ERR(4, 28508, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28508, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("serchop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28508, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serchop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1648serchop(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1648serchop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_n) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("serchop", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":28523
 *             %4 = O(x^100)
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28524
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serchop(_s, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28524, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28525
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = serchop(_s, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28526
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serchop(_s, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = serchop(__pyx_v__s, __pyx_v_n);

  /* "cypari/auto_instance.pxi":28527
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serchop(_s, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serconvol(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28508
 *         return new_gen(_ret)
 * 
 *     def serchop(self, s, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Remove all terms of degree strictly less than :math:`n` in series :math:`s`. When
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serchop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28529
 *         return new_gen(_ret)
 * 
 *     def serconvol(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Convolution (or Hadamard product) of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1651serconvol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1650serconvol[] = "\n        Convolution (or Hadamard product) of the\n        two power series :math:`x` and :math:`y`; in other words if :math:`x = \\sum a_k*X^k` and :math:`y = \\sum\n        b_k*X^k` then :math:`serconvol (x,y) = \\sum a_k*b_k*X^k`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1651serconvol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serconvol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("serconvol", 1, 2, 2, 1); __PYX_ERR(4, 28529, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "serconvol") < 0)) __PYX_ERR(4, 28529, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("serconvol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28529, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serconvol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1650serconvol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1650serconvol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("serconvol", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":28535
 *         b_k*X^k` then :math:`serconvol (x,y) = \sum a_k*b_k*X^k`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28536
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28537
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28537, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28538
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = convol(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28539
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = convol(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28540
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = convol(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = convol(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":28541
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = convol(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serlaplace(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28529
 *         return new_gen(_ret)
 * 
 *     def serconvol(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Convolution (or Hadamard product) of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serconvol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28543
 *         return new_gen(_ret)
 * 
 *     def serlaplace(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be a power series with non-negative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1653serlaplace(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1652serlaplace[] = "\n        :math:`x` must be a power series with non-negative\n        exponents or a polynomial. If :math:`x = \\sum (a_k/k!)*X^k` then the result is :math:`\\sum\n        a_k*X^k`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1653serlaplace(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serlaplace (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1652serlaplace(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1652serlaplace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("serlaplace", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28549
 *         a_k*X^k`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28550
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = laplace(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28550, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28551
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = laplace(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28552
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = laplace(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = laplace(__pyx_v__x);

  /* "cypari/auto_instance.pxi":28553
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = laplace(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serprec(self, x, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28543
 *         return new_gen(_ret)
 * 
 *     def serlaplace(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be a power series with non-negative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serlaplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28555
 *         return new_gen(_ret)
 * 
 *     def serprec(self, x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute precision of :math:`x` with respect to power series
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1655serprec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1654serprec[] = "\n        Returns the absolute precision of :math:`x` with respect to power series\n        in the variable :math:`v`; this is the\n        minimum precision of the components of :math:`x`. The result is :literal:`+oo` if :math:`x`\n        is an exact object (as a series in :math:`v`):\n        \n        ::\n        \n            ? serprec(x + O(y^2), y)\n            %1 = 2\n            ? serprec(x + 2, x)\n            %2 = +oo\n            ? serprec(2 + x + O(x^2), y)\n            %3 = +oo\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1655serprec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serprec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("serprec", 1, 2, 2, 1); __PYX_ERR(4, 28555, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "serprec") < 0)) __PYX_ERR(4, 28555, __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_x = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("serprec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28555, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1654serprec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1654serprec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("serprec", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28571
 *             %3 = +oo
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28572
 *         '''
 *         x = objtogen(x)
 *         cdef long _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_2 == ((long)-2L))) __PYX_ERR(4, 28572, __pyx_L1_error)
  __pyx_v__v = __pyx_t_2;

  /* "cypari/auto_instance.pxi":28573
 *         x = objtogen(x)
 *         cdef long _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpserprec(_x, _v)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 28573, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28574
 *         cdef long _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpserprec(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":28575
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpserprec(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpserprec(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_instance.pxi":28576
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpserprec(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serreverse(self, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28555
 *         return new_gen(_ret)
 * 
 *     def serprec(self, x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute precision of :math:`x` with respect to power series
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28578
 *         return new_gen(_ret)
 * 
 *     def serreverse(self, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reverse power series of :math:`s`, i.e. the series :math:`t` such that :math:`t(s) = x`;
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1657serreverse(PyObject *__pyx_v_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1656serreverse[] = "\n        Reverse power series of :math:`s`, i.e. the series :math:`t` such that :math:`t(s) = x`;\n        :math:`s` must be a power series whose valuation is exactly equal to one.\n        \n        ::\n        \n            ? \\ps 8\n            ? t = serreverse(tan(x))\n            %2 = x - 1/3*x^3 + 1/5*x^5 - 1/7*x^7 + O(x^8)\n            ? tan(t)\n            %3 = x + O(x^8)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1657serreverse(PyObject *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serreverse (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1656serreverse(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1656serreverse(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("serreverse", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":28591
 *             %3 = x + O(x^8)
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28592
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serreverse(_s)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28592, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28593
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = serreverse(_s)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28594
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serreverse(_s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = serreverse(__pyx_v__s);

  /* "cypari/auto_instance.pxi":28595
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serreverse(_s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setbinop(self, f, X, Y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28578
 *         return new_gen(_ret)
 * 
 *     def serreverse(self, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reverse power series of :math:`s`, i.e. the series :math:`t` such that :math:`t(s) = x`;
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.serreverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28597
 *         return new_gen(_ret)
 * 
 *     def setbinop(self, f, X, Y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The set whose elements are the f(x,y), where x,y run through X,Y.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1659setbinop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1658setbinop[] = "\n        The set whose elements are the f(x,y), where x,y run through X,Y.\n        respectively. If :math:`Y` is omitted, assume that :math:`X = Y` and that :math:`f` is symmetric:\n        :math:`f(x,y) = f(y,x)` for all :math:`x,y` in :math:`X`.\n        \n        ::\n        \n            ? X = [1,2,3]; Y = [2,3,4];\n            ? setbinop((x,y)->x+y, X,Y) \\\\ set X + Y\n            %2 = [3, 4, 5, 6, 7]\n            ? setbinop((x,y)->x-y, X,Y) \\\\ set X - Y\n            %3 = [-3, -2, -1, 0, 1]\n            ? setbinop((x,y)->x+y, X) \\\\ set 2X = X + X\n            %2 = [2, 3, 4, 5, 6]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1659setbinop(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_Y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setbinop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_X,&__pyx_n_s_Y,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_f)) != 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_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setbinop", 0, 2, 3, 1); __PYX_ERR(4, 28597, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setbinop") < 0)) __PYX_ERR(4, 28597, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_f = values[0];
    __pyx_v_X = values[1];
    __pyx_v_Y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setbinop", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28597, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setbinop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1658setbinop(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_X, __pyx_v_Y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1658setbinop(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) {
  int __pyx_v__have_Y;
  GEN __pyx_v__f;
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("setbinop", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_instance.pxi":28613
 *             %2 = [2, 3, 4, 5, 6]
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         X = objtogen(X)
 *         cdef bint _have_Y = (Y is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28613, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28614
 *         '''
 *         f = objtogen(f)
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28615
 *         f = objtogen(f)
 *         X = objtogen(X)
 *         cdef bint _have_Y = (Y is not None)             # <<<<<<<<<<<<<<
 *         if _have_Y:
 *             Y = objtogen(Y)
 */
  __pyx_t_2 = (__pyx_v_Y != Py_None);
  __pyx_v__have_Y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":28616
 *         X = objtogen(X)
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             Y = objtogen(Y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_Y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":28617
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:
 *             Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":28616
 *         X = objtogen(X)
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             Y = objtogen(Y)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":28618
 *         if _have_Y:
 *             Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 28618, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28619
 *             Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_instance.pxi":28620
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = NULL
 *         if _have_Y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_4;

  /* "cypari/auto_instance.pxi":28621
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL             # <<<<<<<<<<<<<<
 *         if _have_Y:
 *             _Y = (<Gen>Y).g
 */
  __pyx_v__Y = NULL;

  /* "cypari/auto_instance.pxi":28622
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 */
  __pyx_t_2 = (__pyx_v__have_Y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":28623
 *         cdef GEN _Y = NULL
 *         if _have_Y:
 *             _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
    __pyx_v__Y = __pyx_t_4;

    /* "cypari/auto_instance.pxi":28622
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 */
  }

  /* "cypari/auto_instance.pxi":28624
 *         if _have_Y:
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setbinop(__pyx_v__f, __pyx_v__X, __pyx_v__Y);

  /* "cypari/auto_instance.pxi":28625
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setintersect(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28597
 *         return new_gen(_ret)
 * 
 *     def setbinop(self, f, X, Y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The set whose elements are the f(x,y), where x,y run through X,Y.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setbinop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28627
 *         return new_gen(_ret)
 * 
 *     def setintersect(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1661setintersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1660setintersect[] = "\n        Intersection of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).\n        If :math:`x` or :math:`y` is not a set, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1661setintersect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setintersect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setintersect", 1, 2, 2, 1); __PYX_ERR(4, 28627, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setintersect") < 0)) __PYX_ERR(4, 28627, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setintersect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28627, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1660setintersect(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1660setintersect(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setintersect", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":28632
 *         If :math:`x` or :math:`y` is not a set, the result is undefined.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28633
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28633, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28634
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28634, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28635
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setintersect(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28636
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setintersect(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28637
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setintersect(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setintersect(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":28638
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setintersect(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setisset(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28627
 *         return new_gen(_ret)
 * 
 *     def setintersect(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28640
 *         return new_gen(_ret)
 * 
 *     def setisset(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a set, false (0) if
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1663setisset(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1662setisset[] = "\n        Returns true (1) if :math:`x` is a set, false (0) if\n        not. In PARI, a set is a row vector whose entries are strictly\n        increasing with respect to a (somewhat arbitrary) universal comparison\n        function. To convert any object into a set (this is most useful for\n        vectors, of course), use the function :literal:`Set`.\n        \n        ::\n        \n            ? a = [3, 1, 1, 2];\n            ? setisset(a)\n            %2 = 0\n            ? Set(a)\n            %3 = [1, 2, 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1663setisset(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setisset (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1662setisset(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1662setisset(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setisset", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28656
 *             %3 = [1, 2, 3]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28656, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28657
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setisset(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28657, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28658
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = setisset(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28659
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setisset(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = setisset(__pyx_v__x);

  /* "cypari/auto_instance.pxi":28660
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setisset(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":28661
 *         cdef long _ret = setisset(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def setminus(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28640
 *         return new_gen(_ret)
 * 
 *     def setisset(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a set, false (0) if
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setisset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28663
 *         return _ret
 * 
 *     def setminus(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the two sets :math:`x` and :math:`y` (see :literal:`setisset`),
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1665setminus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1664setminus[] = "\n        Difference of the two sets :math:`x` and :math:`y` (see :literal:`setisset`),\n        i.e.\302\240set of elements of :math:`x` which do not belong to :math:`y`.\n        If :math:`x` or :math:`y` is not a set, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1665setminus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setminus (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setminus", 1, 2, 2, 1); __PYX_ERR(4, 28663, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setminus") < 0)) __PYX_ERR(4, 28663, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setminus", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28663, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setminus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1664setminus(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1664setminus(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setminus", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":28669
 *         If :math:`x` or :math:`y` is not a set, the result is undefined.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28670
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28671
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28671, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28672
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setminus(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28673
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setminus(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28674
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setminus(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setminus(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":28675
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setminus(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setrand(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28663
 *         return _ret
 * 
 *     def setminus(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the two sets :math:`x` and :math:`y` (see :literal:`setisset`),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setminus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28677
 *         return new_gen(_ret)
 * 
 *     def setrand(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reseeds the random number generator using the seed :math:`n`. No value is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1667setrand(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1666setrand[] = "\n        Reseeds the random number generator using the seed :math:`n`. No value is\n        returned. The seed is a small positive integer :math:`0 < n < 2^{64}` used to\n        generate deterministically a suitable state array. All gp session start\n        by an implicit :literal:`setrand(1)`, so resetting the seed to this value allows\n        to replay all computations since the session start. Alternatively,\n        running a randomized computation starting by :literal:`setrand` (:math:`n`)\n        twice with the same :math:`n` will generate the exact same output.\n        \n        In the other direction, including a call to :literal:`setrand(getwalltime())`\n        from your gprc will cause GP to produce different streams of random numbers\n        in each session. (Unix users may want to use :literal:`/dev/urandom` instead\n        of :literal:`getwalltime`.)\n        \n        For debugging purposes, one can also record a particular random state\n        using :literal:`getrand` (the value is encoded as a huge integer) and feed it to\n        :literal:`setrand`:\n        \n        ::\n        \n            ? state = getrand(); \\\\ record seed\n            ...\n            ? setrand(state); \\\\ we can now replay the exact same computations\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1667setrand(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setrand (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1666setrand(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1666setrand(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n) {
  GEN __pyx_v__n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setrand", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":28702
 *             ? setrand(state); \\ we can now replay the exact same computations
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28703
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         setrand(_n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28703, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28704
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         setrand(_n)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28705
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         setrand(_n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  setrand(__pyx_v__n);

  /* "cypari/auto_instance.pxi":28706
 *         cdef GEN _n = (<Gen>n).g
 *         setrand(_n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def setsearch(self, S, x, long flag=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":28677
 *         return new_gen(_ret)
 * 
 *     def setrand(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reseeds the random number generator using the seed :math:`n`. No value is
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28708
 *         clear_stack()
 * 
 *     def setsearch(self, S, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the set :math:`S` (see :literal:`setisset`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1669setsearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1668setsearch[] = "\n        Determines whether :math:`x` belongs to the set :math:`S` (see :literal:`setisset`).\n        \n        We first describe the default behavior, when :math:`flag` is zero or omitted. If :math:`x`\n        belongs to the set :math:`S`, returns the index :math:`j` such that :math:`S[j] = x`, otherwise\n        returns 0.\n        \n        ::\n        \n            ? T = [7,2,3,5]; S = Set(T);\n            ? setsearch(S, 2)\n            %2 = 1\n            ? setsearch(S, 4) \\\\ not found\n            %3 = 0\n            ? setsearch(T, 7) \\\\ search in a randomly sorted vector\n            %4 = 0 \\\\ WRONG !\n        \n        If :math:`S` is not a set, we also allow sorted lists with\n        respect to the :literal:`cmp` sorting function, without repeated entries,\n        as per :literal:`listsort`:math:`(L,1)`; otherwise the result is undefined.\n        \n        ::\n        \n            ? L = List([1,4,2,3,2]); setsearch(L, 4)\n            %1 = 0 \\\\ WRONG !\n            ? listsort(L, 1); L \\\\ sort L first\n            %2 = List([1, 2, 3, 4])\n            ? setsearch(L, 4)\n            %3 = 4 \\\\ now correct\n        \n        If :math:`flag` is non-zero, this function returns the index :math:`j` where :math:`x` should be\n        inserted, and :math:`0` if it already belongs to :math:`S`. This is meant to be used for\n        dynamically growing (sorted) lists, in conjunction with :literal:`listinsert`.\n        \n        ::\n        \n            ? L = List([1,5,2,3,2]); listsort(L,1); L\n            %1 = List([1,2,3,5])\n            ? j = setsearch(L, 4, 1) \\\\ 4 should have been inserted at index j\n            %2 = 4\n            ? listinsert(L, 4, j); L\n            %3 = List([1, 2, 3, 4, 5])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1669setsearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_S = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setsearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_S,&__pyx_n_s_x,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_S)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setsearch", 0, 2, 3, 1); __PYX_ERR(4, 28708, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setsearch") < 0)) __PYX_ERR(4, 28708, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_S = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28708, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setsearch", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28708, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1668setsearch(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_S, __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1668setsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_S, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__S;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setsearch", 0);
  __Pyx_INCREF(__pyx_v_S);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28752
 *             %3 = List([1, 2, 3, 4, 5])
 *         '''
 *         S = objtogen(S)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_S, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_S, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28753
 *         '''
 *         S = objtogen(S)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _S = (<Gen>S).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28754
 *         S = objtogen(S)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28754, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28755
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _S = (<Gen>S).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setsearch(_S, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_S)->__pyx_base.g;
  __pyx_v__S = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28756
 *         sig_on()
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = setsearch(_S, _x, flag)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28757
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setsearch(_S, _x, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = setsearch(__pyx_v__S, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":28758
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setsearch(_S, _x, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":28759
 *         cdef long _ret = setsearch(_S, _x, flag)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def setunion(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28708
 *         clear_stack()
 * 
 *     def setsearch(self, S, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the set :math:`S` (see :literal:`setisset`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_S);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28761
 *         return _ret
 * 
 *     def setunion(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Union of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1671setunion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1670setunion[] = "\n        Union of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).\n        If :math:`x` or :math:`y` is not a set, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1671setunion(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setunion (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("setunion", 1, 2, 2, 1); __PYX_ERR(4, 28761, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setunion") < 0)) __PYX_ERR(4, 28761, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setunion", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28761, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setunion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1670setunion(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1670setunion(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setunion", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_instance.pxi":28766
 *         If :math:`x` or :math:`y` is not a set, the result is undefined.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28767
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28768
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28768, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28769
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setunion(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28770
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setunion(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28771
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setunion(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setunion(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_instance.pxi":28772
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setunion(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def shift(self, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28761
 *         return _ret
 * 
 *     def setunion(self, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Union of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.setunion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28774
 *         return new_gen(_ret)
 * 
 *     def shift(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Shifts :math:`x` componentwise left by :math:`n` bits if :math:`n >= 0` and right by :math:`\|n\|`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1673shift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1672shift[] = "\n        Shifts :math:`x` componentwise left by :math:`n` bits if :math:`n >= 0` and right by :math:`\\|n\\|`\n        bits if :math:`n < 0`. May be abbreviated as :math:`x` :literal:` << ` :math:`n` or :math:`x` :literal:` >> ` :math:`(-n)`.\n        A left shift by :math:`n` corresponds to multiplication by :math:`2^n`. A right shift of an\n        integer :math:`x` by :math:`\\|n\\|` corresponds to a Euclidean division of :math:`x` by :math:`2^{\\|n\\|}`\n        with a remainder of the same sign as :math:`x`, hence is not the same (in general) as\n        :math:`x \\ 2^n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1673shift(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("shift", 1, 2, 2, 1); __PYX_ERR(4, 28774, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shift") < 0)) __PYX_ERR(4, 28774, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28774, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("shift", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28774, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1672shift(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1672shift(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("shift", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28783
 *         :math:`x \ 2^n`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28784
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gshift(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28784, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28785
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gshift(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28786
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gshift(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gshift(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":28787
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gshift(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def shiftmul(self, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28774
 *         return new_gen(_ret)
 * 
 *     def shift(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Shifts :math:`x` componentwise left by :math:`n` bits if :math:`n >= 0` and right by :math:`\|n\|`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28789
 *         return new_gen(_ret)
 * 
 *     def shiftmul(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplies :math:`x` by :math:`2^n`. The difference with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1675shiftmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1674shiftmul[] = "\n        Multiplies :math:`x` by :math:`2^n`. The difference with\n        :literal:`shift` is that when :math:`n < 0`, ordinary division takes place, hence for\n        example if :math:`x` is an integer the result may be a fraction, while for shifts\n        Euclidean division takes place when :math:`n < 0` hence if :math:`x` is an integer the result\n        is still an integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1675shiftmul(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shiftmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("shiftmul", 1, 2, 2, 1); __PYX_ERR(4, 28789, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "shiftmul") < 0)) __PYX_ERR(4, 28789, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28789, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("shiftmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28789, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.shiftmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1674shiftmul(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1674shiftmul(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("shiftmul", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28797
 *         is still an integer.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28798
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gmul2n(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28798, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28799
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmul2n(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28800
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gmul2n(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmul2n(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":28801
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gmul2n(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sigma(self, x, long k=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28789
 *         return new_gen(_ret)
 * 
 *     def shiftmul(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplies :math:`x` by :math:`2^n`. The difference with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.shiftmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28803
 *         return new_gen(_ret)
 * 
 *     def sigma(self, x, long k=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the :math:`k-th` powers of the positive divisors of :math:`\|x\|`. :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1677sigma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1676sigma[] = "\n        Sum of the :math:`k-th` powers of the positive divisors of :math:`\\|x\\|`. :math:`x`\n        and :math:`k` must be of type integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1677sigma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_k;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sigma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_k,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sigma") < 0)) __PYX_ERR(4, 28803, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28803, __pyx_L3_error)
    } else {
      __pyx_v_k = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sigma", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28803, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1676sigma(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_k);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1676sigma(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_k) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sigma", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28808
 *         and :math:`k` must be of type integer.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28808, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28809
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sumdivk(_x, k)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28809, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28810
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumdivk(_x, k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28811
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sumdivk(_x, k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumdivk(__pyx_v__x, __pyx_v_k);

  /* "cypari/auto_instance.pxi":28812
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sumdivk(_x, k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sign(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28803
 *         return new_gen(_ret)
 * 
 *     def sigma(self, x, long k=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the :math:`k-th` powers of the positive divisors of :math:`\|x\|`. :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28814
 *         return new_gen(_ret)
 * 
 *     def sign(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         sign (:math:`0`, :math:`1` or :math:`-1`) of :math:`x`, which must be of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1679sign(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1678sign[] = "\n        sign (:math:`0`, :math:`1` or :math:`-1`) of :math:`x`, which must be of\n        type integer, real or fraction; :literal:`t_QUAD` with positive discriminants and\n        :literal:`t_INFINITY` are also supported.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1679sign(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1678sign(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1678sign(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sign", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28820
 *         :literal:`t_INFINITY` are also supported.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28821
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = gsigne(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28821, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28822
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = gsigne(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28823
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = gsigne(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = gsigne(__pyx_v__x);

  /* "cypari/auto_instance.pxi":28824
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = gsigne(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":28825
 *         cdef int _ret = gsigne(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def simplify(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28814
 *         return new_gen(_ret)
 * 
 *     def sign(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         sign (:math:`0`, :math:`1` or :math:`-1`) of :math:`x`, which must be of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28827
 *         return _ret
 * 
 *     def simplify(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function simplifies :math:`x` as much as it can. Specifically, a complex or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1681simplify(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1680simplify[] = "\n        This function simplifies :math:`x` as much as it can. Specifically, a complex or\n        quadratic number whose imaginary part is the integer 0 (i.e.\302\240not :literal:`Mod(0,2)`\n        or :literal:`0.E-28`) is converted to its real part, and a polynomial of degree :math:`0`\n        is converted to its constant term. Simplifications occur recursively.\n        \n        This function is especially useful before using arithmetic functions,\n        which expect integer arguments:\n        \n        ::\n        \n            ? x = 2 + y - y\n            %1 = 2\n            ? isprime(x)\n             *** at top-level: isprime(x)\n             *** ^----------\n             *** isprime: not an integer argument in an arithmetic function\n            ? type(x)\n            %2 = \"t_POL\"\n            ? type(simplify(x))\n            %3 = \"t_INT\"\n        \n        Note that GP results are simplified as above before they are stored in the\n        history. (Unless you disable automatic simplification with :literal:`\\\\backslash y`, that is.)\n        In particular\n        \n        ::\n        \n            ? type(%1)\n            %4 = \"t_INT\"\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1681simplify(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("simplify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1680simplify(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1680simplify(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("simplify", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28859
 *             %4 = "t_INT"
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28860
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = simplify(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28860, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28861
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = simplify(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28862
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = simplify(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = simplify(__pyx_v__x);

  /* "cypari/auto_instance.pxi":28863
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = simplify(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sin(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28863, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28827
 *         return _ret
 * 
 *     def simplify(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function simplifies :math:`x` as much as it can. Specifically, a complex or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.simplify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28865
 *         return new_gen(_ret)
 * 
 *     def sin(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1683sin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1682sin[] = "\n        Sine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1683sin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sin") < 0)) __PYX_ERR(4, 28865, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28865, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sin", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28865, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1682sin(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1682sin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sin", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28869
 *         Sine of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28870
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28870, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28871
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsin(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28872
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsin(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":28873
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsin(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsin(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":28874
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsin(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sinc(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28865
 *         return new_gen(_ret)
 * 
 *     def sin(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28876
 *         return new_gen(_ret)
 * 
 *     def sinc(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cardinal sine of :math:`x`, i.e. :math:`\sin (x)/x` if :math:`x != 0`, :math:`1` otherwise.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1685sinc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1684sinc[] = "\n        Cardinal sine of :math:`x`, i.e. :math:`\\sin (x)/x` if :math:`x != 0`, :math:`1` otherwise.\n        Note that this function also allows to compute\n        \n        .. MATH::\n        \n            (1-\\cos (x)) / x^2 = sinc (x/2)^2 / 2\n        \n        accurately near :math:`x = 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1685sinc(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sinc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sinc") < 0)) __PYX_ERR(4, 28876, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28876, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sinc", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28876, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sinc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1684sinc(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1684sinc(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sinc", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28887
 *         accurately near :math:`x = 0`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28888
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28888, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28889
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinc(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28890
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsinc(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":28891
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinc(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsinc(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":28892
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinc(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sinh(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28876
 *         return new_gen(_ret)
 * 
 *     def sinc(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cardinal sine of :math:`x`, i.e. :math:`\sin (x)/x` if :math:`x != 0`, :math:`1` otherwise.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sinc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28894
 *         return new_gen(_ret)
 * 
 *     def sinh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic sine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1687sinh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1686sinh[] = "\n        Hyperbolic sine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1687sinh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sinh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sinh") < 0)) __PYX_ERR(4, 28894, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28894, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sinh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28894, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1686sinh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1686sinh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sinh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28898
 *         Hyperbolic sine of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28899
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28899, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28900
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinh(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28901
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsinh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":28902
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsinh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":28903
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sizebyte(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28894
 *         return new_gen(_ret)
 * 
 *     def sinh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic sine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28905
 *         return new_gen(_ret)
 * 
 *     def sizebyte(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the total number of bytes occupied by the tree representing the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1689sizebyte(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1688sizebyte[] = "\n        Outputs the total number of bytes occupied by the tree representing the\n        PARI object :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1689sizebyte(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sizebyte (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1688sizebyte(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1688sizebyte(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sizebyte", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28910
 *         PARI object :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28911
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = gsizebyte(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28911, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28912
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = gsizebyte(_x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28913
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = gsizebyte(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = gsizebyte(__pyx_v__x);

  /* "cypari/auto_instance.pxi":28914
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = gsizebyte(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":28915
 *         cdef long _ret = gsizebyte(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def sizedigit(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28905
 *         return new_gen(_ret)
 * 
 *     def sizebyte(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the total number of bytes occupied by the tree representing the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sizebyte", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28917
 *         return _ret
 * 
 *     def sizedigit(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is DEPRECATED, essentially meaningless, and provided for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1691sizedigit(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1690sizedigit[] = "\n        This function is DEPRECATED, essentially meaningless, and provided for\n        backwards compatibility only. Don't use it!\n        \n        outputs a quick upper bound for the number of decimal digits of (the\n        components of) :math:`x`, off by at most :math:`1`. More precisely, for a positive\n        integer :math:`x`, it computes (approximately) the ceiling of\n        \n        .. MATH::\n        \n            floor (1 + \\log_2 x) \\log_{10}2,\n        \n        To count the number of decimal digits of a positive integer :math:`x`, use\n        :literal:`\\#digits(x)`. To estimate (recursively) the size of :math:`x`, use\n        :literal:`normlp(x)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1691sizedigit(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sizedigit (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1690sizedigit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1690sizedigit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sizedigit", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28934
 *         :literal:`normlp(x)`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28934, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":28935
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":28936
 *         from warnings import warn
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_instance.pxi":28937
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = sizedigit(_x)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 28937, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28938
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = sizedigit(_x)
 *         clear_stack()
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":28939
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = sizedigit(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = sizedigit(__pyx_v__x);

  /* "cypari/auto_instance.pxi":28940
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = sizedigit(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":28941
 *         cdef long _ret = sizedigit(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def sqr(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 28941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28917
 *         return _ret
 * 
 *     def sizedigit(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is DEPRECATED, essentially meaningless, and provided for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sizedigit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28943
 *         return _ret
 * 
 *     def sqr(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of :math:`x`. This operation is not completely
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1693sqr(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1692sqr[] = "\n        Square of :math:`x`. This operation is not completely\n        straightforward, i.e.\302\240identical to :math:`x * x`, since it can usually be\n        computed more efficiently (roughly one-half of the elementary\n        multiplications can be saved). Also, squaring a :math:`2`-adic number increases\n        its precision. For example,\n        \n        ::\n        \n            ? (1 + O(2^4))^2\n            %1 = 1 + O(2^5)\n            ? (1 + O(2^4)) * (1 + O(2^4))\n            %2 = 1 + O(2^4)\n        \n        Note that this function is also called whenever one multiplies two objects\n        which are known to be :emphasis:`identical`, e.g.\302\240they are the value of the same\n        variable, or we are computing a power.\n        \n        ::\n        \n            ? x = (1 + O(2^4)); x * x\n            %3 = 1 + O(2^5)\n            ? (1 + O(2^4))^4\n            %4 = 1 + O(2^6)\n        \n        (note the difference between :literal:`\\%2` and :literal:`\\%3` above).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1693sqr(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1692sqr(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1692sqr(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sqr", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28971
 *         (note the difference between :literal:`\%2` and :literal:`\%3` above).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28972
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gsqr(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28972, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28973
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsqr(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28974
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gsqr(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsqr(__pyx_v__x);

  /* "cypari/auto_instance.pxi":28975
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gsqr(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sqrt(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28975, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28943
 *         return _ret
 * 
 *     def sqr(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of :math:`x`. This operation is not completely
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28977
 *         return new_gen(_ret)
 * 
 *     def sqrt(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the square root of :math:`x`, defined as :math:`\sqrt{x} =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1695sqrt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1694sqrt[] = "\n        Principal branch of the square root of :math:`x`, defined as :math:`\\sqrt{x} =\n        \\exp (\\log x / 2)`. In particular, we have\n        :math:`Arg(sqrt(x))\\in ]-\\pi/2, \\pi/2]`, and if :math:`x\\in \\mathbb{R}` and :math:`x < 0`,\n        then the result is complex with positive imaginary part.\n        \n        Intmod a prime :math:`p`, :literal:`t_PADIC` and :literal:`t_FFELT` are allowed as arguments. In\n        the first 2 cases (:literal:`t_INTMOD`, :literal:`t_PADIC`), the square root (if it\n        exists) which is returned is the one whose first :math:`p`-adic digit is in the\n        interval :math:`[0,p/2]`. For other arguments, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1695sqrt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sqrt") < 0)) __PYX_ERR(4, 28977, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 28977, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sqrt", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 28977, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sqrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1694sqrt(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1694sqrt(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sqrt", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":28989
 *         interval :math:`[0,p/2]`. For other arguments, the result is undefined.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":28990
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 28990, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":28991
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsqrt(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":28992
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsqrt(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":28993
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsqrt(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsqrt(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":28994
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsqrt(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sqrtint(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 28994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28977
 *         return new_gen(_ret)
 * 
 *     def sqrt(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the square root of :math:`x`, defined as :math:`\sqrt{x} =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sqrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":28996
 *         return new_gen(_ret)
 * 
 *     def sqrtint(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer square root of :math:`x`, i.e. the largest integer :math:`y`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1697sqrtint(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1696sqrtint[] = "\n        Returns the integer square root of :math:`x`, i.e. the largest integer :math:`y`\n        such that :math:`y^2 <= x`, where :math:`x` a non-negative integer.\n        \n        ::\n        \n            ? N = 120938191237; sqrtint(N)\n            %1 = 347761\n            ? sqrt(N)\n            %2 = 347761.68741970412747602130964414095216\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1697sqrtint(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrtint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1696sqrtint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1696sqrtint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sqrtint", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":29008
 *             %2 = 347761.68741970412747602130964414095216
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29009
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtint(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29009, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29010
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sqrtint(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29011
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtint(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sqrtint(__pyx_v__x);

  /* "cypari/auto_instance.pxi":29012
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtint(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sqrtnint(self, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":28996
 *         return new_gen(_ret)
 * 
 *     def sqrtint(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer square root of :math:`x`, i.e. the largest integer :math:`y`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sqrtint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29014
 *         return new_gen(_ret)
 * 
 *     def sqrtnint(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer :math:`n`-th root of :math:`x`, i.e. the largest integer :math:`y` such
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1699sqrtnint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1698sqrtnint[] = "\n        Returns the integer :math:`n`-th root of :math:`x`, i.e. the largest integer :math:`y` such\n        that :math:`y^n <= x`, where :math:`x` is a non-negative integer.\n        \n        ::\n        \n            ? N = 120938191237; sqrtnint(N, 5)\n            %1 = 164\n            ? N^(1/5)\n            %2 = 164.63140849829660842958614676939677391\n        \n        The special case :math:`n = 2` is :literal:`sqrtint`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1699sqrtnint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrtnint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sqrtnint", 1, 2, 2, 1); __PYX_ERR(4, 29014, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sqrtnint") < 0)) __PYX_ERR(4, 29014, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29014, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sqrtnint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29014, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sqrtnint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1698sqrtnint(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1698sqrtnint(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sqrtnint", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":29028
 *         The special case :math:`n = 2` is :literal:`sqrtint`
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29029
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtnint(_x, n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29029, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29030
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sqrtnint(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29031
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtnint(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sqrtnint(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_instance.pxi":29032
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtnint(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def stirling(self, long n, long k, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29014
 *         return new_gen(_ret)
 * 
 *     def sqrtnint(self, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer :math:`n`-th root of :math:`x`, i.e. the largest integer :math:`y` such
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sqrtnint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29034
 *         return new_gen(_ret)
 * 
 *     def stirling(self, long n, long k, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Stirling number of the first kind :math:`s(n,k)` (:math:`flag = 1`, default) or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1701stirling(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1700stirling[] = "\n        Stirling number of the first kind :math:`s(n,k)` (:math:`flag = 1`, default) or\n        of the second kind :math:`S(n,k)` (:emphasis:`flag` = 2), where :math:`n`, :math:`k` are non-negative\n        integers. The former is :math:`(-1)^{n-k}` times the\n        number of permutations of :math:`n` symbols with exactly :math:`k` cycles; the latter is\n        the number of ways of partitioning a set of :math:`n` elements into :math:`k` non-empty\n        subsets. Note that if all :math:`s(n,k)` are needed, it is much faster to compute\n        \n        .. MATH::\n        \n            \\sum_k s(n,k) x^k = x(x-1)...(x-n+1).\n        \n        Similarly, if a large number of :math:`S(n,k)` are needed for the same :math:`k`,\n        one should use\n        \n        .. MATH::\n        \n            \\sum_n S(n,k) x^n = (x^k)/((1-x)...(1-kx)).\n        \n        (Should be implemented using a divide and conquer product.) Here are\n        simple variants for :math:`n` fixed:\n        \n        ::\n        \n            /* list of s(n,k), k = 1..n */\n            vecstirling(n) = Vec( factorback(vector(n-1,i,1-i*'x)) )\n            \n            /* list of S(n,k), k = 1..n */\n            vecstirling2(n) =\n            { my(Q = x^(n-1), t);\n             vector(n, i, t = divrem(Q, x-i); Q=t[1]; simplify(t[2]));\n            }\n            \n            /* Bell numbers, B_n = B[n+1] = sum(k = 0, n, S(n,k)), n = 0..N */\n            vecbell(N)=\n            { my (B = vector(N+1));\n             B[1] = B[2] = 1;\n             for (n = 2, N,\n             my (C = binomial(n-1));\n             B[n+1] = sum(k = 1, n, C[k]*B[k]);\n             ); B;\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1701stirling(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_k;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stirling (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_k,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 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_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("stirling", 0, 2, 3, 1); __PYX_ERR(4, 29034, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stirling") < 0)) __PYX_ERR(4, 29034, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29034, __pyx_L3_error)
    __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29034, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29034, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("stirling", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29034, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.stirling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1700stirling(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_k, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1700stirling(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_k, long __pyx_v_flag) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("stirling", 0);

  /* "cypari/auto_instance.pxi":29078
 *             }
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = stirling(n, k, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 29078, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29079
 *         '''
 *         sig_on()
 *         cdef GEN _ret = stirling(n, k, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = stirling(__pyx_v_n, __pyx_v_k, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":29080
 *         sig_on()
 *         cdef GEN _ret = stirling(n, k, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def subgrouplist(self, bnr, bound=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29034
 *         return new_gen(_ret)
 * 
 *     def stirling(self, long n, long k, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Stirling number of the first kind :math:`s(n,k)` (:math:`flag = 1`, default) or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.stirling", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29082
 *         return new_gen(_ret)
 * 
 *     def subgrouplist(self, bnr, bound=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit` or a list of cyclic components
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1703subgrouplist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1702subgrouplist[] = "\n        :emphasis:`bnr` being as output by :literal:`bnrinit` or a list of cyclic components\n        of a finite Abelian group :math:`G`, outputs the list of subgroups of :math:`G`. Subgroups\n        are given as HNF left divisors of the SNF matrix corresponding to :math:`G`.\n        \n        If :math:`flag = 0` (default) and :emphasis:`bnr` is as output by :literal:`bnrinit`, gives\n        only the subgroups whose modulus is the conductor. Otherwise, the modulus is\n        not taken into account.\n        \n        If :emphasis:`bound` is present, and is a positive integer, restrict the output to\n        subgroups of index less than :emphasis:`bound`. If :emphasis:`bound` is a vector\n        containing a single positive integer :math:`B`, then only subgroups of index\n        exactly equal to :math:`B` are computed. For instance\n        \n        ::\n        \n            ? subgrouplist([6,2])\n            %1 = [[6, 0; 0, 2], [2, 0; 0, 2], [6, 3; 0, 1], [2, 1; 0, 1], [3, 0; 0, 2],\n            [1, 0; 0, 2], [6, 0; 0, 1], [2, 0; 0, 1], [3, 0; 0, 1], [1, 0; 0, 1]]\n            ? subgrouplist([6,2],3) \\\\ index less than 3\n            %2 = [[2, 1; 0, 1], [1, 0; 0, 2], [2, 0; 0, 1], [3, 0; 0, 1], [1, 0; 0, 1]]\n            ? subgrouplist([6,2],[3]) \\\\ index 3\n            %3 = [[3, 0; 0, 1]]\n            ? bnr = bnrinit(bnfinit(x), [120,[1]], 1);\n            ? L = subgrouplist(bnr, [8]);\n        \n        In the last example, :math:`L` corresponds to the 24 subfields of\n        :math:`\\mathbb{Q} (\\zeta_{120})`, of degree :math:`8` and conductor :math:`120 oo` (by setting :emphasis:`flag`,\n        we see there are a total of :math:`43` subgroups of degree :math:`8`).\n        \n        ::\n        \n            ? vector(#L, i, galoissubcyclo(bnr, L[i]))\n        \n        will produce their equations. (For a general base field, you would\n        have to rely on :literal:`bnrstark`, or :literal:`rnfkummer`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1703subgrouplist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnr = 0;
  PyObject *__pyx_v_bound = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subgrouplist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnr,&__pyx_n_s_bound,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_bnr)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bound);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subgrouplist") < 0)) __PYX_ERR(4, 29082, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bnr = values[0];
    __pyx_v_bound = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29082, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subgrouplist", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29082, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.subgrouplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1702subgrouplist(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_bnr, __pyx_v_bound, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1702subgrouplist(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_bnr, PyObject *__pyx_v_bound, long __pyx_v_flag) {
  int __pyx_v__have_bound;
  GEN __pyx_v__bnr;
  GEN __pyx_v__bound;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("subgrouplist", 0);
  __Pyx_INCREF(__pyx_v_bnr);
  __Pyx_INCREF(__pyx_v_bound);

  /* "cypari/auto_instance.pxi":29120
 *         have to rely on :literal:`bnrstark`, or :literal:`rnfkummer`.)
 *         '''
 *         bnr = objtogen(bnr)             # <<<<<<<<<<<<<<
 *         cdef bint _have_bound = (bound is not None)
 *         if _have_bound:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29121
 *         '''
 *         bnr = objtogen(bnr)
 *         cdef bint _have_bound = (bound is not None)             # <<<<<<<<<<<<<<
 *         if _have_bound:
 *             bound = objtogen(bound)
 */
  __pyx_t_2 = (__pyx_v_bound != Py_None);
  __pyx_v__have_bound = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29122
 *         bnr = objtogen(bnr)
 *         cdef bint _have_bound = (bound is not None)
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             bound = objtogen(bound)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_bound != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29123
 *         cdef bint _have_bound = (bound is not None)
 *         if _have_bound:
 *             bound = objtogen(bound)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bound, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29123, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_bound, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":29122
 *         bnr = objtogen(bnr)
 *         cdef bint _have_bound = (bound is not None)
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             bound = objtogen(bound)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29124
 *         if _have_bound:
 *             bound = objtogen(bound)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29124, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29125
 *             bound = objtogen(bound)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bound = NULL
 *         if _have_bound:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29126
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL             # <<<<<<<<<<<<<<
 *         if _have_bound:
 *             _bound = (<Gen>bound).g
 */
  __pyx_v__bound = NULL;

  /* "cypari/auto_instance.pxi":29127
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 */
  __pyx_t_2 = (__pyx_v__have_bound != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29128
 *         cdef GEN _bound = NULL
 *         if _have_bound:
 *             _bound = (<Gen>bound).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bound)->__pyx_base.g;
    __pyx_v__bound = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29127
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 */
  }

  /* "cypari/auto_instance.pxi":29129
 *         if _have_bound:
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = subgrouplist0(__pyx_v__bnr, __pyx_v__bound, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":29130
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def subst(self, x, y, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29082
 *         return new_gen(_ret)
 * 
 *     def subgrouplist(self, bnr, bound=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit` or a list of cyclic components
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.subgrouplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnr);
  __Pyx_XDECREF(__pyx_v_bound);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29132
 *         return new_gen(_ret)
 * 
 *     def subst(self, x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the simple variable :math:`y` by the argument :math:`z` in the "polynomial"
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1705subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1704subst[] = "\n        Replace the simple variable :math:`y` by the argument :math:`z` in the \"polynomial\"\n        expression :math:`x`. Every type is allowed for :math:`x`, but if it is not a genuine\n        polynomial (or power series, or rational function), the substitution will be\n        done as if the scalar components were polynomials of degree zero. In\n        particular, beware that:\n        \n        ::\n        \n            ? subst(1, x, [1,2; 3,4])\n            %1 =\n            [1 0]\n            \n            [0 1]\n            \n            ? subst(1, x, Mat([0,1]))\n             *** at top-level: subst(1,x,Mat([0,1])\n             *** ^--------------------\n             *** subst: forbidden substitution by a non square matrix.\n        \n        If :math:`x` is a power series, :math:`z` must be either a polynomial, a power\n        series, or a rational function. Finally, if :math:`x` is a vector,\n        matrix or list, the substitution is applied to each individual entry.\n        \n        Use the function :literal:`substvec` to replace several variables at once,\n        or the function :literal:`substpol` to replace a polynomial expression.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1705subst(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subst (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("subst", 1, 3, 3, 1); __PYX_ERR(4, 29132, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("subst", 1, 3, 3, 2); __PYX_ERR(4, 29132, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subst") < 0)) __PYX_ERR(4, 29132, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_z = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subst", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.subst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1704subst(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1704subst(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  long __pyx_v__y;
  GEN __pyx_v__x;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("subst", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":29160
 *         or the function :literal:`substpol` to replace a polynomial expression.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _y = get_var(y)
 *         z = objtogen(z)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29161
 *         '''
 *         x = objtogen(x)
 *         cdef long _y = get_var(y)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_y); if (unlikely(__pyx_t_2 == ((long)-2L))) __PYX_ERR(4, 29161, __pyx_L1_error)
  __pyx_v__y = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29162
 *         x = objtogen(x)
 *         cdef long _y = get_var(y)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29163
 *         cdef long _y = get_var(y)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29163, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29164
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubst(_x, _y, _z)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29165
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsubst(_x, _y, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29166
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubst(_x, _y, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsubst(__pyx_v__x, __pyx_v__y, __pyx_v__z);

  /* "cypari/auto_instance.pxi":29167
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubst(_x, _y, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def substpol(self, x, y, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29167, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29132
 *         return new_gen(_ret)
 * 
 *     def subst(self, x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the simple variable :math:`y` by the argument :math:`z` in the "polynomial"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.subst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29169
 *         return new_gen(_ret)
 * 
 *     def substpol(self, x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the "variable" :math:`y` by the argument :math:`z` in the "polynomial"
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1707substpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1706substpol[] = "\n        Replace the \"variable\" :math:`y` by the argument :math:`z` in the \"polynomial\"\n        expression :math:`x`. Every type is allowed for :math:`x`, but the same behavior\n        as :literal:`subst` above apply.\n        \n        The difference with :literal:`subst` is that :math:`y` is allowed to be any polynomial\n        here. The substitution is done moding out all components of :math:`x`\n        (recursively) by :math:`y - t`, where :math:`t` is a new free variable of lowest\n        priority. Then substituting :math:`t` by :math:`z` in the resulting expression. For\n        instance\n        \n        ::\n        \n            ? substpol(x^4 + x^2 + 1, x^2, y)\n            %1 = y^2 + y + 1\n            ? substpol(x^4 + x^2 + 1, x^3, y)\n            %2 = x^2 + y*x + 1\n            ? substpol(x^4 + x^2 + 1, (x+1)^2, y)\n            %3 = (-4*y - 6)*x + (y^2 + 3*y - 3)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1707substpol(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("substpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("substpol", 1, 3, 3, 1); __PYX_ERR(4, 29169, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("substpol", 1, 3, 3, 2); __PYX_ERR(4, 29169, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "substpol") < 0)) __PYX_ERR(4, 29169, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_z = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("substpol", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29169, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.substpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1706substpol(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1706substpol(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("substpol", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":29190
 *             %3 = (-4*y - 6)*x + (y^2 + 3*y - 3)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         z = objtogen(z)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29191
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29192
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29193
 *         y = objtogen(y)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29193, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29194
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29195
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29196
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29197
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsubstpol(__pyx_v__x, __pyx_v__y, __pyx_v__z);

  /* "cypari/auto_instance.pxi":29198
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def substvec(self, x, v, w):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29169
 *         return new_gen(_ret)
 * 
 *     def substpol(self, x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the "variable" :math:`y` by the argument :math:`z` in the "polynomial"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.substpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29200
 *         return new_gen(_ret)
 * 
 *     def substvec(self, x, v, w):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`v` being a vector of monomials of degree 1 (variables),
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1709substvec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1708substvec[] = "\n        :math:`v` being a vector of monomials of degree 1 (variables),\n        :math:`w` a vector of expressions of the same length, replace in the expression\n        :math:`x` all occurrences of :math:`v_i` by :math:`w_i`. The substitutions are done\n        simultaneously; more precisely, the :math:`v_i` are first replaced by new\n        variables in :math:`x`, then these are replaced by the :math:`w_i`:\n        \n        ::\n        \n            ? substvec([x,y], [x,y], [y,x])\n            %1 = [y, x]\n            ? substvec([x,y], [x,y], [y,x+y])\n            %2 = [y, x + y] \\\\ not [y, 2*y]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1709substvec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("substvec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_w,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("substvec", 1, 3, 3, 1); __PYX_ERR(4, 29200, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("substvec", 1, 3, 3, 2); __PYX_ERR(4, 29200, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "substvec") < 0)) __PYX_ERR(4, 29200, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_v = values[1];
    __pyx_v_w = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("substvec", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29200, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.substvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1708substvec(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_v, __pyx_v_w);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1708substvec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_w) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("substvec", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_INCREF(__pyx_v_w);

  /* "cypari/auto_instance.pxi":29215
 *             %2 = [y, x + y] \\ not [y, 2*y]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         v = objtogen(v)
 *         w = objtogen(w)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29216
 *         '''
 *         x = objtogen(x)
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         w = objtogen(w)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29216, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29217
 *         x = objtogen(x)
 *         v = objtogen(v)
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29218
 *         v = objtogen(v)
 *         w = objtogen(w)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29218, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29219
 *         w = objtogen(w)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _w = (<Gen>w).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29220
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29221
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29222
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsubstvec(__pyx_v__x, __pyx_v__v, __pyx_v__w);

  /* "cypari/auto_instance.pxi":29223
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumdedekind(self, h, k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29200
 *         return new_gen(_ret)
 * 
 *     def substvec(self, x, v, w):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`v` being a vector of monomials of degree 1 (variables),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.substvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29225
 *         return new_gen(_ret)
 * 
 *     def sumdedekind(self, h, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Dedekind sum attached to the integers :math:`h` and :math:`k`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1711sumdedekind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1710sumdedekind[] = "\n        Returns the Dedekind sum attached to the integers :math:`h` and :math:`k`,\n        corresponding to a fast implementation of\n        \n        ::\n        \n             s(h,k) = sum(n = 1, k-1, (n/k)*(frac(h*n/k) - 1/2))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1711sumdedekind(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumdedekind (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_h,&__pyx_n_s_k,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_h)) != 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_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sumdedekind", 1, 2, 2, 1); __PYX_ERR(4, 29225, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumdedekind") < 0)) __PYX_ERR(4, 29225, __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_h = values[0];
    __pyx_v_k = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumdedekind", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29225, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumdedekind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1710sumdedekind(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_h, __pyx_v_k);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1710sumdedekind(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_h, PyObject *__pyx_v_k) {
  GEN __pyx_v__h;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sumdedekind", 0);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_instance.pxi":29234
 *              s(h,k) = sum(n = 1, k-1, (n/k)*(frac(h*n/k) - 1/2))
 *         '''
 *         h = objtogen(h)             # <<<<<<<<<<<<<<
 *         k = objtogen(k)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_h, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29235
 *         '''
 *         h = objtogen(h)
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _h = (<Gen>h).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29236
 *         h = objtogen(h)
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29236, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29237
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _h = (<Gen>h).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = sumdedekind(_h, _k)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_h)->__pyx_base.g;
  __pyx_v__h = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29238
 *         sig_on()
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumdedekind(_h, _k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29239
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = sumdedekind(_h, _k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumdedekind(__pyx_v__h, __pyx_v__k);

  /* "cypari/auto_instance.pxi":29240
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = sumdedekind(_h, _k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumdigits(self, n, B=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29225
 *         return new_gen(_ret)
 * 
 *     def sumdedekind(self, h, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Dedekind sum attached to the integers :math:`h` and :math:`k`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumdedekind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29242
 *         return new_gen(_ret)
 * 
 *     def sumdigits(self, n, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of digits in the integer :math:`\|n\|`, when written in base :math:`B > 1`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1713sumdigits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1712sumdigits[] = "\n        Sum of digits in the integer :math:`\\|n\\|`, when written in base :math:`B > 1`.\n        \n        ::\n        \n            ? sumdigits(123456789)\n            %1 = 45\n            ? sumdigits(123456789, 2)\n            %1 = 16\n        \n        Note that the sum of bits in :math:`n` is also returned by\n        :literal:`hammingweight`. This function is much faster than\n        :literal:`vecsum(digits(n,B))` when :math:`B` is :math:`10` or a power of :math:`2`, and only\n        slightly faster in other cases.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1713sumdigits(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumdigits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_B,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumdigits") < 0)) __PYX_ERR(4, 29242, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = values[0];
    __pyx_v_B = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumdigits", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29242, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1712sumdigits(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1712sumdigits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_B) {
  int __pyx_v__have_B;
  GEN __pyx_v__n;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumdigits", 0);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":29258
 *         slightly faster in other cases.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29259
 *         '''
 *         n = objtogen(n)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29260
 *         n = objtogen(n)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29261
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29261, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":29260
 *         n = objtogen(n)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29262
 *         if _have_B:
 *             B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29262, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29263
 *             B = objtogen(B)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29264
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_instance.pxi":29265
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29266
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumdigits0(_n, _B)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29265
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)
 */
  }

  /* "cypari/auto_instance.pxi":29267
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumdigits0(__pyx_v__n, __pyx_v__B);

  /* "cypari/auto_instance.pxi":29268
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumeulerrat(self, F, s=None, long a=2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29242
 *         return new_gen(_ret)
 * 
 *     def sumdigits(self, n, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of digits in the integer :math:`\|n\|`, when written in base :math:`B > 1`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29270
 *         return new_gen(_ret)
 * 
 *     def sumeulerrat(self, F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1715sumeulerrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1714sumeulerrat[] = "\n        :math:`\\sum_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.\n        \n        ::\n        \n            ? sumeulerrat(1/q)\n            %1 = 0.45224742004106549850654336483224793418\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1715sumeulerrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_s = 0;
  long __pyx_v_a;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumeulerrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_s,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumeulerrat") < 0)) __PYX_ERR(4, 29270, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_F = values[0];
    __pyx_v_s = values[1];
    if (values[2]) {
      __pyx_v_a = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29270, __pyx_L3_error)
    } else {
      __pyx_v_a = ((long)2);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29270, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumeulerrat", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29270, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1714sumeulerrat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_s, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1714sumeulerrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision) {
  int __pyx_v__have_s;
  GEN __pyx_v__F;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumeulerrat", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":29279
 *             %1 = 0.45224742004106549850654336483224793418
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29280
 *         '''
 *         F = objtogen(F)
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_2 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29281
 *         F = objtogen(F)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29282
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":29281
 *         F = objtogen(F)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29283
 *         if _have_s:
 *             s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29283, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29284
 *             s = objtogen(s)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29285
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_instance.pxi":29286
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29287
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29286
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":29288
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29289
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumeulerrat(__pyx_v__F, __pyx_v__s, __pyx_v_a, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29290
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumformal(self, f, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29270
 *         return new_gen(_ret)
 * 
 *     def sumeulerrat(self, F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29292
 *         return new_gen(_ret)
 * 
 *     def sumformal(self, f, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal sum of the polynomial expression :math:`f` with respect to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1717sumformal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1716sumformal[] = "\n        formal sum of the polynomial expression :math:`f` with respect to the\n        main variable if :math:`v` is omitted, with respect to the variable :math:`v` otherwise;\n        it is assumed that the base ring has characteristic zero. In other words,\n        considering :math:`f` as a polynomial function in the variable :math:`v`,\n        returns :math:`F`, a polynomial in :math:`v` vanishing at :math:`0`, such that :math:`F(b) - F(a)\n        = sum_{v = a+1}^b f(v)`:\n        \n        ::\n        \n            ? sumformal(n) \\\\ 1 + ... + n\n            %1 = 1/2*n^2 + 1/2*n\n            ? f(n) = n^3+n^2+1;\n            ? F = sumformal(f(n)) \\\\ f(1) + ... + f(n)\n            %3 = 1/4*n^4 + 5/6*n^3 + 3/4*n^2 + 7/6*n\n            ? sum(n = 1, 2000, f(n)) == subst(F, n, 2000)\n            %4 = 1\n            ? sum(n = 1001, 2000, f(n)) == subst(F, n, 2000) - subst(F, n, 1000)\n            %5 = 1\n            ? sumformal(x^2 + x*y + y^2, y)\n            %6 = y*x^2 + (1/2*y^2 + 1/2*y)*x + (1/3*y^3 + 1/2*y^2 + 1/6*y)\n            ? x^2 * y + x * sumformal(y) + sumformal(y^2) == %\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1717sumformal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumformal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumformal") < 0)) __PYX_ERR(4, 29292, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumformal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29292, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1716sumformal(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_f, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1716sumformal(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_f, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("sumformal", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_instance.pxi":29317
 *             %7 = 1
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29318
 *         '''
 *         f = objtogen(f)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":29319
 *         f = objtogen(f)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":29320
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(4, 29320, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29319
 *         f = objtogen(f)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29321
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = sumformal(_f, _v)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(4, 29321, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29322
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumformal(_f, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_6;

  /* "cypari/auto_instance.pxi":29323
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = sumformal(_f, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumformal(__pyx_v__f, __pyx_v__v);

  /* "cypari/auto_instance.pxi":29324
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = sumformal(_f, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnumapinit(self, asymp=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29292
 *         return new_gen(_ret)
 * 
 *     def sumformal(self, f, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal sum of the polynomial expression :math:`f` with respect to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29326
 *         return new_gen(_ret)
 * 
 *     def sumnumapinit(self, asymp=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Abel-Plana summation of a series :math:`\sum f(n)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1719sumnumapinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1718sumnumapinit[] = "\n        Initialize tables for Abel-Plana summation of a series :math:`\\sum f(n)`,\n        where :math:`f` is holomorphic in a right half-plane.\n        If given, :literal:`asymp` is of the form :math:`[+oo, \\alpha]`,\n        as in :literal:`intnum` and indicates the decrease rate at infinity of functions\n        to be summed. A positive\n        :math:`\\alpha > 0` encodes an exponential decrease of type :math:`\\exp (-\\alpha n)` and\n        a negative :math:`-2 < \\alpha < -1` encodes a slow polynomial decrease of type\n        :math:`n^{\\alpha}`.\n        \n        ::\n        \n            ? \\p200\n            ? sumnumap(n=1, n^-2);\n            time = 163 ms.\n            ? tab = sumnumapinit();\n            time = 160 ms.\n            ? sumnum(n=1, n^-2, tab); \\\\ faster\n            time = 7 ms.\n            \n            ? tab = sumnumapinit([+oo, log(2)]); \\\\ decrease like 2^-n\n            time = 164 ms.\n            ? sumnumap(n=1, 2^-n, tab) - 1\n            time = 36 ms.\n            %5 = 3.0127431466707723218 E-282\n            \n            ? tab = sumnumapinit([+oo, -4/3]); \\\\ decrease like n^(-4/3)\n            time = 166 ms.\n            ? sumnumap(n=1, n^(-4/3), tab);\n            time = 181 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1719sumnumapinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_asymp = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnumapinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_asymp,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asymp);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnumapinit") < 0)) __PYX_ERR(4, 29326, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_asymp = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29326, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnumapinit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29326, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnumapinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1718sumnumapinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_asymp, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1718sumnumapinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, long __pyx_v_precision) {
  int __pyx_v__have_asymp;
  GEN __pyx_v__asymp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumnumapinit", 0);
  __Pyx_INCREF(__pyx_v_asymp);

  /* "cypari/auto_instance.pxi":29358
 *             time = 181 ms.
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 */
  __pyx_t_1 = (__pyx_v_asymp != Py_None);
  __pyx_v__have_asymp = __pyx_t_1;

  /* "cypari/auto_instance.pxi":29359
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29360
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:
 *             asymp = objtogen(asymp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _asymp = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_asymp, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29360, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_asymp, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":29359
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29361
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29361, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29362
 *             asymp = objtogen(asymp)
 *         sig_on()
 *         cdef GEN _asymp = NULL             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 */
  __pyx_v__asymp = NULL;

  /* "cypari/auto_instance.pxi":29363
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29364
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
    __pyx_v__asymp = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29363
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":29365
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29366
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnumapinit(__pyx_v__asymp, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29367
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnuminit(self, asymp=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29326
 *         return new_gen(_ret)
 * 
 *     def sumnumapinit(self, asymp=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Abel-Plana summation of a series :math:`\sum f(n)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnumapinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_asymp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29369
 *         return new_gen(_ret)
 * 
 *     def sumnuminit(self, asymp=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Euler-MacLaurin delta summation of a series with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1721sumnuminit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1720sumnuminit[] = "\n        Initialize tables for Euler-MacLaurin delta summation of a series with\n        positive terms. If given, :literal:`asymp` is of the form :math:`[+oo, \\alpha]`,\n        as in :literal:`intnum` and indicates the decrease rate at infinity of functions\n        to be summed. A positive\n        :math:`\\alpha > 0` encodes an exponential decrease of type :math:`\\exp (-\\alpha n)` and\n        a negative :math:`-2 < \\alpha < -1` encodes a slow polynomial decrease of type\n        :math:`n^{\\alpha}`.\n        \n        ::\n        \n            ? \\p200\n            ? sumnum(n=1, n^-2);\n            time = 200 ms.\n            ? tab = sumnuminit();\n            time = 188 ms.\n            ? sumnum(n=1, n^-2, tab); \\\\ faster\n            time = 8 ms.\n            \n            ? tab = sumnuminit([+oo, log(2)]); \\\\ decrease like 2^-n\n            time = 200 ms.\n            ? sumnum(n=1, 2^-n, tab)\n            time = 44 ms.\n            \n            ? tab = sumnuminit([+oo, -4/3]); \\\\ decrease like n^(-4/3)\n            time = 200 ms.\n            ? sumnum(n=1, n^(-4/3), tab);\n            time = 221 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1721sumnuminit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_asymp = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnuminit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_asymp,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asymp);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnuminit") < 0)) __PYX_ERR(4, 29369, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_asymp = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29369, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnuminit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29369, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1720sumnuminit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_asymp, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1720sumnuminit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, long __pyx_v_precision) {
  int __pyx_v__have_asymp;
  GEN __pyx_v__asymp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumnuminit", 0);
  __Pyx_INCREF(__pyx_v_asymp);

  /* "cypari/auto_instance.pxi":29399
 *             time = 221 ms.
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 */
  __pyx_t_1 = (__pyx_v_asymp != Py_None);
  __pyx_v__have_asymp = __pyx_t_1;

  /* "cypari/auto_instance.pxi":29400
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29401
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:
 *             asymp = objtogen(asymp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _asymp = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_asymp, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_asymp, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":29400
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29402
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29402, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29403
 *             asymp = objtogen(asymp)
 *         sig_on()
 *         cdef GEN _asymp = NULL             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 */
  __pyx_v__asymp = NULL;

  /* "cypari/auto_instance.pxi":29404
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29405
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnuminit(_asymp, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
    __pyx_v__asymp = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29404
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":29406
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnuminit(_asymp, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29407
 *             _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnuminit(_asymp, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnuminit(__pyx_v__asymp, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29408
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnuminit(_asymp, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnumlagrangeinit(self, asymp=None, c1=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29369
 *         return new_gen(_ret)
 * 
 *     def sumnuminit(self, asymp=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Euler-MacLaurin delta summation of a series with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_asymp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29410
 *         return new_gen(_ret)
 * 
 *     def sumnumlagrangeinit(self, asymp=None, c1=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Lagrange summation of a series. By
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1723sumnumlagrangeinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1722sumnumlagrangeinit[] = "\n        Initialize tables for Lagrange summation of a series. By\n        default, assume that the remainder :math:`R(n) = \\sum_{m >= n} f(m)`\n        has an asymptotic expansion\n        \n        .. MATH::\n        \n            R(n) = \\sum_{m >= n} f(n) ~ \\sum_{i >= 1} a_i / n^i\n        \n        at infinity. The argument :literal:`asymp` allows to specify different\n        expansions:\n        \n        - a real number :math:`\\beta` means\n          \n        \n        .. MATH::\n        \n            R(n) = n^{-\\beta} \\sum_{i >= 1} a_i / n^i\n        \n        - a :literal:`t_CLOSURE` :math:`g` means\n          \n        \n        .. MATH::\n        \n            R(n) = g(n) \\sum_{i >= 1} a_i / n^i\n        \n          (The preceding case corresponds to :math:`g(n) = n^{-\\beta}`.)\n        \n        - a pair :math:`[\\alpha,\\beta]` where :math:`\\beta` is as above and\n          :math:`\\alpha\\in {2, 1, 1/2, 1/3, 1/4}`. We let :math:`R_2(n) = R(n) - f(n)/2`\n          and :math:`R_\\alpha (n) = R(n)` for :math:`\\alpha != 2`. Then\n          \n        \n        .. MATH::\n        \n            R_\\alpha (n) = g(n) \\sum_{i >= 1} a_i / n^{i\\alpha}\n        \n          Note that the initialization times increase considerable for the :math:`\\alpha`\n          is this list (:math:`1/4` being the slowest).\n        \n        The constant :math:`c1` is technical and computed by the program, but can be set\n        by the user: the number of interpolation steps will be chosen close to\n        :math:`c1.B`, where :math:`B` is the bit accuracy.\n        \n        ::\n        \n            ? \\p2000\n            ? sumnumlagrange(n=1, n^-2);\n            time = 173 ms.\n            ? tab = sumnumlagrangeinit();\n            time = 172 ms.\n            ? sumnumlagrange(n=1, n^-2, tab);\n            time = 4 ms.\n            \n            ? \\p115\n            ? sumnumlagrange(n=1, n^(-4/3)) - zeta(4/3);\n            %1 = -0.1093[...] \\\\ junk: expansion ""in n^(1/3)\n            time = 84 ms.\n            ? tab = sumnumlagrangeinit([1/3,0]); \\\\ alpha = 1/3\n            time = 336 ms.\n            ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3)\n            time = 84 ms.\n            %3 = 1.0151767349262596893 E-115 \\\\ now OK\n            \n            ? tab = sumnumlagrangeinit(1/3); \\\\ alpha = 1, beta = 1/3: much faster\n            time = 3ms\n            ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3) \\\\ ... but wrong\n            %5 = -0.273825[...] \\\\ junk !\n            ? tab = sumnumlagrangeinit(-2/3); \\\\ alpha = 1, beta = -2/3\n            time = 3ms\n            ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3)\n            %6 = 2.030353469852519379 E-115 \\\\ now OK\n        \n        in The final example with :math:`\\zeta (4/3)`, the remainder\n        :math:`R_1(n)` is of the form :math:`n^{-1/3} \\sum_{i >= 0} a_i / n^i`, i.e.\n        :math:`n^{2/3} \\sum_{i >= 1} a_i / n^i`. The explains the wrong result\n        for :math:`\\beta = 1/3` and the correction with :math:`\\beta = -2/3`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1723sumnumlagrangeinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_asymp = 0;
  PyObject *__pyx_v_c1 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnumlagrangeinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_asymp,&__pyx_n_s_c1,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asymp);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c1);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnumlagrangeinit") < 0)) __PYX_ERR(4, 29410, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_asymp = values[0];
    __pyx_v_c1 = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29410, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnumlagrangeinit", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29410, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnumlagrangeinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1722sumnumlagrangeinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_asymp, __pyx_v_c1, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1722sumnumlagrangeinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, PyObject *__pyx_v_c1, long __pyx_v_precision) {
  int __pyx_v__have_asymp;
  int __pyx_v__have_c1;
  GEN __pyx_v__asymp;
  GEN __pyx_v__c1;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumnumlagrangeinit", 0);
  __Pyx_INCREF(__pyx_v_asymp);
  __Pyx_INCREF(__pyx_v_c1);

  /* "cypari/auto_instance.pxi":29489
 *         for :math:`\beta = 1/3` and the correction with :math:`\beta = -2/3`.
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 */
  __pyx_t_1 = (__pyx_v_asymp != Py_None);
  __pyx_v__have_asymp = __pyx_t_1;

  /* "cypari/auto_instance.pxi":29490
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         cdef bint _have_c1 = (c1 is not None)
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29491
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:
 *             asymp = objtogen(asymp)             # <<<<<<<<<<<<<<
 *         cdef bint _have_c1 = (c1 is not None)
 *         if _have_c1:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_asymp, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_asymp, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":29490
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         cdef bint _have_c1 = (c1 is not None)
 */
  }

  /* "cypari/auto_instance.pxi":29492
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 *         cdef bint _have_c1 = (c1 is not None)             # <<<<<<<<<<<<<<
 *         if _have_c1:
 *             c1 = objtogen(c1)
 */
  __pyx_t_1 = (__pyx_v_c1 != Py_None);
  __pyx_v__have_c1 = __pyx_t_1;

  /* "cypari/auto_instance.pxi":29493
 *             asymp = objtogen(asymp)
 *         cdef bint _have_c1 = (c1 is not None)
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             c1 = objtogen(c1)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_c1 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29494
 *         cdef bint _have_c1 = (c1 is not None)
 *         if _have_c1:
 *             c1 = objtogen(c1)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _asymp = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c1, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_c1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":29493
 *             asymp = objtogen(asymp)
 *         cdef bint _have_c1 = (c1 is not None)
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             c1 = objtogen(c1)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29495
 *         if _have_c1:
 *             c1 = objtogen(c1)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29495, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29496
 *             c1 = objtogen(c1)
 *         sig_on()
 *         cdef GEN _asymp = NULL             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 */
  __pyx_v__asymp = NULL;

  /* "cypari/auto_instance.pxi":29497
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29498
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c1 = NULL
 *         if _have_c1:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
    __pyx_v__asymp = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29497
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL
 */
  }

  /* "cypari/auto_instance.pxi":29499
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL             # <<<<<<<<<<<<<<
 *         if _have_c1:
 *             _c1 = (<Gen>c1).g
 */
  __pyx_v__c1 = NULL;

  /* "cypari/auto_instance.pxi":29500
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_c1 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29501
 *         cdef GEN _c1 = NULL
 *         if _have_c1:
 *             _c1 = (<Gen>c1).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c1)->__pyx_base.g;
    __pyx_v__c1 = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29500
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":29502
 *         if _have_c1:
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29503
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnumlagrangeinit(__pyx_v__asymp, __pyx_v__c1, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29504
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnummonieninit(self, asymp=None, w=None, n0=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29504, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29410
 *         return new_gen(_ret)
 * 
 *     def sumnumlagrangeinit(self, asymp=None, c1=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Lagrange summation of a series. By
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnumlagrangeinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_asymp);
  __Pyx_XDECREF(__pyx_v_c1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29506
 *         return new_gen(_ret)
 * 
 *     def sumnummonieninit(self, asymp=None, w=None, n0=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Monien summation of a series :math:`\sum_{n >= n_0}
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1725sumnummonieninit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1724sumnummonieninit[] = "\n        Initialize tables for Monien summation of a series :math:`\\sum_{n >= n_0}\n        f(n)` where :math:`f(1/z)` has a complex analytic continuation in a (complex)\n        neighbourhood of the segment :math:`[0,1]`.\n        \n        By default, assume that :math:`f(n) = O(n^{-2})` and has a non-zero asymptotic\n        expansion\n        \n        .. MATH::\n        \n            f(n) = \\sum_{i >= 2} a_i / n^i\n        \n        at infinity. Note that the sum starts at :math:`i = 2`! The argument :literal:`asymp`\n        allows to specify different expansions:\n        \n        - a real number :math:`\\beta > 0` means\n          \n        \n        .. MATH::\n        \n            f(n) = \\sum_{i >= 1} a_i / n^{i + \\beta}\n        \n          (Now the summation starts at :math:`1`.)\n        \n        - a vector :math:`[\\alpha,\\beta]` of reals, where we must have :math:`\\alpha > 0`\n          and :math:`\\alpha + \\beta > 1` to ensure convergence, means that\n          \n        \n        .. MATH::\n        \n            f(n) = \\sum_{i >= 1} a_i / n^{\\alpha i + \\beta}\n        \n          Note that :math:`asymp = [1, \\beta]` is equivalent to\n          :math:`asymp = \\beta`.\n        \n        ::\n        \n            ? \\p57\n            ? s = sumnum(n = 1, sin(1/sqrt(n)) / n); \\\\ reference point\n            \n            ? \\p38\n            ? sumnummonien(n = 1, sin(1/sqrt(n)) / n) - s\n            %2 = -0.001[...] \\\\ completely wrong\n            \n            ? t = sumnummonieninit(1/2); \\\\ f(n) = sum_i 1 / n^(i+1/2)\n            ? sumnummonien(n = 1, sin(1/sqrt(n)) / n, t) - s\n            %3 = 0.E-37 \\\\ now correct\n        \n        (As a matter of fact, in the above summation, the\n        result given by :literal:`sumnum` at :literal:`\\\\p38` is slighly incorrect,\n        so we had to increase the accuracy to :literal:`\\\\p57`.)\n        \n        The argument :math:`w` is used to sum expressions of the form\n        ""\n        .. MATH::\n        \n            \\sum_{n >= n_0} f(n) w(n),\n        \n        for varying :math:`f` :emphasis:`as above`, and fixed weight function :math:`w`, where we\n        further assume that the auxiliary sums\n        \n        .. MATH::\n        \n            g_w(m) = \\sum_{n >= n_0} w(n) / n^{\\alpha m + \\beta}\n        \n        converge for all :math:`m >= 1`. Note that for non-negative integers :math:`k`,\n        and weight :math:`w(n) = (\\log n)^k`, the function :math:`g_w(m) = \\zeta^{(k)}(\\alpha m +\n        \\beta)` has a simple expression; for general weights, :math:`g_w` is\n        computed using :literal:`sumnum`. The following variants are available\n        \n        - an integer :math:`k >= 0`, to code :math:`w(n) = (\\log n)^k`;\n        \n        - a :literal:`t_CLOSURE` computing the values :math:`w(n)`, where we\n          assume that :math:`w(n) = O(n^\\epsilon)` for all :math:`\\epsilon > 0`;\n        \n        - a vector :math:`[w, fast]`, where :math:`w` is a closure as above\n          and :literal:`fast` is a scalar;\n          we assume that :math:`w(n) = O(n^{fast+\\epsilon})`; note that\n          :math:`w = [w, 0]` is equivalent to :math:`w = w`. Note that if\n          :math:`w` decreases exponentially, :literal:`suminf` should be used instead.\n        \n        The subsequent calls to :literal:`sumnummonien` :emphasis:`must` use the same value\n        of :math:`n_0` as was used here.\n        \n        ::\n        \n            ? \\p300\n            ? sumnummonien(n = 1, n^-2*log(n)) + zeta'(2)\n            time = 328 ms.\n            %1 = -1.323[...]E-6 \\\\ completely wrong, f does not satisfy hypotheses !\n            ? tab = sumnummonieninit(, 1); \\\\ codes w(n) = log(n)\n            time = 3,993 ms.\n            ? sumnummonien(n = 1, n^-2, tab) + zeta'(2)\n            time = 41 ms.\n            %3 = -5.562684646268003458 E-309 \\\\ now perfect\n            \n            ? tab = sumnummonieninit(, n->log""(n)); \\\\ generic, slower\n            time = 9,808 ms.\n            ? sumnummonien(n = 1, n^-2, tab) + zeta'(2)\n            time = 40 ms.\n            %5 = -5.562684646268003458 E-309 \\\\ identical result\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1725sumnummonieninit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_asymp = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_n0 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnummonieninit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_asymp,&__pyx_n_s_w,&__pyx_n_s_n0,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asymp);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n0);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnummonieninit") < 0)) __PYX_ERR(4, 29506, __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);
        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;
      }
    }
    __pyx_v_asymp = values[0];
    __pyx_v_w = values[1];
    __pyx_v_n0 = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29506, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnummonieninit", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29506, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnummonieninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1724sumnummonieninit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_asymp, __pyx_v_w, __pyx_v_n0, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1724sumnummonieninit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_asymp, PyObject *__pyx_v_w, PyObject *__pyx_v_n0, long __pyx_v_precision) {
  int __pyx_v__have_asymp;
  int __pyx_v__have_w;
  int __pyx_v__have_n0;
  GEN __pyx_v__asymp;
  GEN __pyx_v__w;
  GEN __pyx_v__n0;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumnummonieninit", 0);
  __Pyx_INCREF(__pyx_v_asymp);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_n0);

  /* "cypari/auto_instance.pxi":29609
 *             %5 = -5.562684646268003458 E-309 \\ identical result
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 */
  __pyx_t_1 = (__pyx_v_asymp != Py_None);
  __pyx_v__have_asymp = __pyx_t_1;

  /* "cypari/auto_instance.pxi":29610
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         cdef bint _have_w = (w is not None)
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29611
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:
 *             asymp = objtogen(asymp)             # <<<<<<<<<<<<<<
 *         cdef bint _have_w = (w is not None)
 *         if _have_w:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_asymp, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29611, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_asymp, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":29610
 *         '''
 *         cdef bint _have_asymp = (asymp is not None)
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             asymp = objtogen(asymp)
 *         cdef bint _have_w = (w is not None)
 */
  }

  /* "cypari/auto_instance.pxi":29612
 *         if _have_asymp:
 *             asymp = objtogen(asymp)
 *         cdef bint _have_w = (w is not None)             # <<<<<<<<<<<<<<
 *         if _have_w:
 *             w = objtogen(w)
 */
  __pyx_t_1 = (__pyx_v_w != Py_None);
  __pyx_v__have_w = __pyx_t_1;

  /* "cypari/auto_instance.pxi":29613
 *             asymp = objtogen(asymp)
 *         cdef bint _have_w = (w is not None)
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 */
  __pyx_t_1 = (__pyx_v__have_w != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29614
 *         cdef bint _have_w = (w is not None)
 *         if _have_w:
 *             w = objtogen(w)             # <<<<<<<<<<<<<<
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":29613
 *             asymp = objtogen(asymp)
 *         cdef bint _have_w = (w is not None)
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 */
  }

  /* "cypari/auto_instance.pxi":29615
 *         if _have_w:
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)             # <<<<<<<<<<<<<<
 *         if _have_n0:
 *             n0 = objtogen(n0)
 */
  __pyx_t_1 = (__pyx_v_n0 != Py_None);
  __pyx_v__have_n0 = __pyx_t_1;

  /* "cypari/auto_instance.pxi":29616
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             n0 = objtogen(n0)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_n0 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29617
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:
 *             n0 = objtogen(n0)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _asymp = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n0, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_n0, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":29616
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             n0 = objtogen(n0)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29618
 *         if _have_n0:
 *             n0 = objtogen(n0)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29618, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29619
 *             n0 = objtogen(n0)
 *         sig_on()
 *         cdef GEN _asymp = NULL             # <<<<<<<<<<<<<<
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 */
  __pyx_v__asymp = NULL;

  /* "cypari/auto_instance.pxi":29620
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL
 */
  __pyx_t_1 = (__pyx_v__have_asymp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29621
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _w = NULL
 *         if _have_w:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
    __pyx_v__asymp = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29620
 *         sig_on()
 *         cdef GEN _asymp = NULL
 *         if _have_asymp:             # <<<<<<<<<<<<<<
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL
 */
  }

  /* "cypari/auto_instance.pxi":29622
 *         if _have_asymp:
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL             # <<<<<<<<<<<<<<
 *         if _have_w:
 *             _w = (<Gen>w).g
 */
  __pyx_v__w = NULL;

  /* "cypari/auto_instance.pxi":29623
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 */
  __pyx_t_1 = (__pyx_v__have_w != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29624
 *         cdef GEN _w = NULL
 *         if _have_w:
 *             _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n0 = NULL
 *         if _have_n0:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
    __pyx_v__w = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29623
 *             _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 */
  }

  /* "cypari/auto_instance.pxi":29625
 *         if _have_w:
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL             # <<<<<<<<<<<<<<
 *         if _have_n0:
 *             _n0 = (<Gen>n0).g
 */
  __pyx_v__n0 = NULL;

  /* "cypari/auto_instance.pxi":29626
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_n0 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":29627
 *         cdef GEN _n0 = NULL
 *         if _have_n0:
 *             _n0 = (<Gen>n0).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n0)->__pyx_base.g;
    __pyx_v__n0 = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29626
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":29628
 *         if _have_n0:
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29629
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnummonieninit(__pyx_v__asymp, __pyx_v__w, __pyx_v__n0, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29630
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnumrat(self, F, a, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 29630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29506
 *         return new_gen(_ret)
 * 
 *     def sumnummonieninit(self, asymp=None, w=None, n0=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Monien summation of a series :math:`\sum_{n >= n_0}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnummonieninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_asymp);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_n0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29632
 *         return new_gen(_ret)
 * 
 *     def sumnumrat(self, F, a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{n >= a}F(n)`, where :math:`F` is a rational function of degree less
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1727sumnumrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1726sumnumrat[] = "\n        :math:`\\sum_{n >= a}F(n)`, where :math:`F` is a rational function of degree less\n        than or equal to :math:`-2` and where poles of :math:`F` at integers :math:`>= a` are\n        omitted from the summation. The argument :math:`a` must be a :literal:`t_INT`\n        or :literal:`-oo`.\n        \n        ::\n        \n            ? sumnumrat(1/(x^2+1)^2,0)\n            %1 = 1.3068369754229086939178621382829073480\n            ? sumnumrat(1/x^2, -oo) \\\\ value at x=0 is discarded\n            %2 = 3.2898681336964528729448303332920503784\n            ? 2*zeta(2)\n            %3 = 3.2898681336964528729448303332920503784\n        \n        When :math:`\\deg F = -1`, we define\n        \n        .. MATH::\n        \n            \\sum_{- oo }^{ oo } F(n) := \\sum_{n >= 0} (F(n) + F(-1-n)):\n        \n        ::\n        \n            ? sumnumrat(1/x, -oo)\n            %4 = 0.E-38\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1727sumnumrat(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_a = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnumrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("sumnumrat", 0, 2, 3, 1); __PYX_ERR(4, 29632, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnumrat") < 0)) __PYX_ERR(4, 29632, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_F = values[0];
    __pyx_v_a = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29632, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnumrat", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29632, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1726sumnumrat(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_F, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1726sumnumrat(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_F, PyObject *__pyx_v_a, long __pyx_v_precision) {
  GEN __pyx_v__F;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sumnumrat", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":29659
 *             %4 = 0.E-38
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29660
 *         '''
 *         F = objtogen(F)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29661
 *         F = objtogen(F)
 *         a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29661, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29662
 *         a = objtogen(a)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29663
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29664
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _a = (<Gen>a).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29665
 *         cdef GEN _a = (<Gen>a).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnumrat(__pyx_v__F, __pyx_v__a, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29666
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def system(self, str):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29632
 *         return new_gen(_ret)
 * 
 *     def sumnumrat(self, F, a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{n >= a}F(n)`, where :math:`F` is a rational function of degree less
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.sumnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29668
 *         return new_gen(_ret)
 * 
 *     def system(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`str` is a string representing a system command. This command is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1729system(PyObject *__pyx_v_self, PyObject *__pyx_v_str); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1728system[] = "\n        :emphasis:`str` is a string representing a system command. This command is\n        executed, its output written to the standard output (this won't get into your\n        logfile), and control returns to the PARI system. This simply calls the C\n        :literal:`system` command.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1729system(PyObject *__pyx_v_self, PyObject *__pyx_v_str) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("system (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1728system(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_str));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1728system(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_str) {
  char *__pyx_v__str;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("system", 0);
  __Pyx_INCREF(__pyx_v_str);

  /* "cypari/auto_instance.pxi":29675
 *         :literal:`system` command.
 *         '''
 *         str = to_bytes(str)             # <<<<<<<<<<<<<<
 *         cdef char* _str = <bytes>str
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_str); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_str, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29676
 *         '''
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str             # <<<<<<<<<<<<<<
 *         sig_on()
 *         gpsystem(_str)
 */
  if (unlikely(__pyx_v_str == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 29676, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_str); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 29676, __pyx_L1_error)
  __pyx_v__str = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29677
 *         str = to_bytes(str)
 *         cdef char* _str = <bytes>str
 *         sig_on()             # <<<<<<<<<<<<<<
 *         gpsystem(_str)
 *         clear_stack()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29677, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29678
 *         cdef char* _str = <bytes>str
 *         sig_on()
 *         gpsystem(_str)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gpsystem(__pyx_v__str);

  /* "cypari/auto_instance.pxi":29679
 *         sig_on()
 *         gpsystem(_str)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def tan(self, x, long precision=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":29668
 *         return new_gen(_ret)
 * 
 *     def system(self, str):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`str` is a string representing a system command. This command is
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.system", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_str);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29681
 *         clear_stack()
 * 
 *     def tan(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1731tan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1730tan[] = "\n        Tangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1731tan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tan") < 0)) __PYX_ERR(4, 29681, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29681, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tan", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29681, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.tan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1730tan(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1730tan(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("tan", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":29685
 *         Tangent of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29686
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29686, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29687
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtan(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29688
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtan(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29689
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtan(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtan(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29690
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtan(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def tanh(self, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29681
 *         clear_stack()
 * 
 *     def tan(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.tan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29692
 *         return new_gen(_ret)
 * 
 *     def tanh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic tangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1733tanh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1732tanh[] = "\n        Hyperbolic tangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1733tanh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tanh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tanh") < 0)) __PYX_ERR(4, 29692, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29692, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tanh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29692, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.tanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1732tanh(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1732tanh(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("tanh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":29696
 *         Hyperbolic tangent of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29697
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29697, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29698
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtanh(_x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29699
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtanh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29700
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtanh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtanh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29701
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtanh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def taylor(self, x, t, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29692
 *         return new_gen(_ret)
 * 
 *     def tanh(self, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic tangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.tanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29703
 *         return new_gen(_ret)
 * 
 *     def taylor(self, x, t, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Taylor expansion around :math:`0` of :math:`x` with respect to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1735taylor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1734taylor[] = "\n        Taylor expansion around :math:`0` of :math:`x` with respect to\n        the simple variable :math:`t`. :math:`x` can be of any reasonable type, for example a\n        rational function. Contrary to :literal:`Ser`, which takes the valuation into\n        account, this function adds :math:`O(t^d)` to all components of :math:`x`.\n        \n        ::\n        \n            ? taylor(x/(1+y), y, 5)\n            %1 = (y^4 - y^3 + y^2 - y + 1)*x + O(y^5)\n            ? Ser(x/(1+y), y, 5)\n             *** at top-level: Ser(x/(1+y),y,5)\n             *** ^----------------\n             *** Ser: main variable must have higher priority in gtoser.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1735taylor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_t = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("taylor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_t,&__pyx_n_s_serprec,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("taylor", 0, 2, 3, 1); __PYX_ERR(4, 29703, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "taylor") < 0)) __PYX_ERR(4, 29703, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_t = values[1];
    if (values[2]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29703, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("taylor", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29703, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.taylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1734taylor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_t, __pyx_v_serprec);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1734taylor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_t, long __pyx_v_serprec) {
  long __pyx_v__t;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  long __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("taylor", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":29719
 *              *** Ser: main variable must have higher priority in gtoser.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef long _t = get_var(t)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29720
 *         '''
 *         x = objtogen(x)
 *         cdef long _t = get_var(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_t); if (unlikely(__pyx_t_2 == ((long)-2L))) __PYX_ERR(4, 29720, __pyx_L1_error)
  __pyx_v__t = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29721
 *         x = objtogen(x)
 *         cdef long _t = get_var(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29721, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29722
 *         cdef long _t = get_var(t)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29723
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 */
  __pyx_t_5 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_5) {

    /* "cypari/auto_instance.pxi":29724
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_instance.pxi":29723
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 */
  }

  /* "cypari/auto_instance.pxi":29725
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = tayl(__pyx_v__x, __pyx_v__t, __pyx_v_serprec);

  /* "cypari/auto_instance.pxi":29726
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def teichmuller(self, x, tab=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29703
 *         return new_gen(_ret)
 * 
 *     def taylor(self, x, t, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Taylor expansion around :math:`0` of :math:`x` with respect to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.taylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29728
 *         return new_gen(_ret)
 * 
 *     def teichmuller(self, x, tab=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Teichmller character of the :math:`p`-adic number :math:`x`, i.e. the unique
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1737teichmuller(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1736teichmuller[] = "\n        Teichm\303\274ller character of the :math:`p`-adic number :math:`x`, i.e. the unique\n        :math:`(p-1)`-th root of unity congruent to :math:`x / p^{v_p(x)}` modulo :math:`p`.\n        If :math:`x` is of the form :math:`[p,n]`, for a prime :math:`p` and integer :math:`n`,\n        return the lifts to :math:`\\mathbb{Z}` of the images of :math:`i + O(p^n)` for\n        :math:`i = 1,..., p-1`, i.e. all roots of :math:`1` ordered by residue class modulo\n        :math:`p`. Such a vector can be fed back to :literal:`teichmuller`, as the\n        optional argument :literal:`tab`, to speed up later computations.\n        \n        ::\n        \n            ? z = teichmuller(2 + O(101^5))\n            %1 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)\n            ? z^100\n            %2 = 1 + O(101^5)\n            ? T = teichmuller([101, 5]);\n            ? teichmuller(2 + O(101^5), T)\n            %4 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)\n        \n        As a rule of thumb, if more than\n        \n        .. MATH::\n        \n            p / 2(\\log_2(p) + hammingweight (p))\n        \n        values of :literal:`teichmuller` are to be computed, then it is worthwile to\n        initialize:\n        \n        ::\n        \n            ? p = 101; n = 100; T = teichmuller([p,n]); \\\\ instantaneous\n            ? for(i=1,10^3, vector(p-1, i, teichmuller(i+O(p^n), T)))\n            time = 60 ms.\n            ? for(i=1,10^3, vector(p-1, i, teichmuller(i+O(p^n))))\n            time = 1,293 ms.\n            ? 1 + 2*(log(p)/log(2) + hammingweight(p))\n            %8 = 22.316[...]\n        \n        Here the precompuation induces a speedup by a factor\n        :math:`1293/ 60 ~ 21.5`.\n        \n        :strong:`Caveat.`\n        If the accuracy of :literal:`tab` (the argument :math:`n` above) is lower than the\n        precision of :math:`x`, the :emphasis:`former` is used, i.e. the cached value is not\n        refined to higher accurac""y. It the accuracy of :literal:`tab` is larger, then\n        the precision of :math:`x` is used:\n        \n        ::\n        \n            ? Tlow = teichmuller([101, 2]); \\\\ lower accuracy !\n            ? teichmuller(2 + O(101^5), Tlow)\n            %10 = 2 + 83*101 + O(101^5) \\\\ no longer a root of 1\n            \n            ? Thigh = teichmuller([101, 10]); \\\\ higher accuracy\n            ? teichmuller(2 + O(101^5), Thigh)\n            %12 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1737teichmuller(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_tab = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("teichmuller (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_tab,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tab);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "teichmuller") < 0)) __PYX_ERR(4, 29728, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_tab = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("teichmuller", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29728, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.teichmuller", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1736teichmuller(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_tab);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1736teichmuller(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_tab) {
  int __pyx_v__have_tab;
  GEN __pyx_v__x;
  GEN __pyx_v__tab;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("teichmuller", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_tab);

  /* "cypari/auto_instance.pxi":29786
 *             %12 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_tab = (tab is not None)
 *         if _have_tab:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29787
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_tab = (tab is not None)             # <<<<<<<<<<<<<<
 *         if _have_tab:
 *             tab = objtogen(tab)
 */
  __pyx_t_2 = (__pyx_v_tab != Py_None);
  __pyx_v__have_tab = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29788
 *         x = objtogen(x)
 *         cdef bint _have_tab = (tab is not None)
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             tab = objtogen(tab)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_tab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29789
 *         cdef bint _have_tab = (tab is not None)
 *         if _have_tab:
 *             tab = objtogen(tab)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tab, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29789, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_tab, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":29788
 *         x = objtogen(x)
 *         cdef bint _have_tab = (tab is not None)
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             tab = objtogen(tab)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29790
 *         if _have_tab:
 *             tab = objtogen(tab)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29790, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29791
 *             tab = objtogen(tab)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tab = NULL
 *         if _have_tab:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29792
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL             # <<<<<<<<<<<<<<
 *         if _have_tab:
 *             _tab = (<Gen>tab).g
 */
  __pyx_v__tab = NULL;

  /* "cypari/auto_instance.pxi":29793
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)
 */
  __pyx_t_2 = (__pyx_v__have_tab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29794
 *         cdef GEN _tab = NULL
 *         if _have_tab:
 *             _tab = (<Gen>tab).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = teichmuller(_x, _tab)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tab)->__pyx_base.g;
    __pyx_v__tab = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29793
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)
 */
  }

  /* "cypari/auto_instance.pxi":29795
 *         if _have_tab:
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = teichmuller(__pyx_v__x, __pyx_v__tab);

  /* "cypari/auto_instance.pxi":29796
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def theta(self, q, z, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29728
 *         return new_gen(_ret)
 * 
 *     def teichmuller(self, x, tab=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Teichmller character of the :math:`p`-adic number :math:`x`, i.e. the unique
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.teichmuller", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_tab);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29798
 *         return new_gen(_ret)
 * 
 *     def theta(self, q, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Jacobi sine theta-function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1739theta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1738theta[] = "\n        Jacobi sine theta-function\n        \n        .. MATH::\n        \n            \\theta_1(z, q) = 2q^{1/4} \\sum_{n >= 0} (-1)^n q^{n(n+1)} \\sin ((2n+1)z).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1739theta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_v_z = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("theta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,&__pyx_n_s_z,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q)) != 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("theta", 0, 2, 3, 1); __PYX_ERR(4, 29798, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "theta") < 0)) __PYX_ERR(4, 29798, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_q = values[0];
    __pyx_v_z = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29798, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("theta", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29798, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.theta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1738theta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_q, __pyx_v_z, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1738theta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, PyObject *__pyx_v_z, long __pyx_v_precision) {
  GEN __pyx_v__q;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("theta", 0);
  __Pyx_INCREF(__pyx_v_q);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":29806
 *             \theta_1(z, q) = 2q^{1/4} \sum_{n >= 0} (-1)^n q^{n(n+1)} \sin ((2n+1)z).
 *         '''
 *         q = objtogen(q)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29807
 *         '''
 *         q = objtogen(q)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29808
 *         q = objtogen(q)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29808, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29809
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29810
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = theta(_q, _z, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29811
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = theta(_q, _z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29812
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = theta(_q, _z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = theta(__pyx_v__q, __pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29813
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = theta(_q, _z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def thetanullk(self, q, long k, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29798
 *         return new_gen(_ret)
 * 
 *     def theta(self, q, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Jacobi sine theta-function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.theta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29815
 *         return new_gen(_ret)
 * 
 *     def thetanullk(self, q, long k, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1741thetanullk(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1740thetanullk[] = "\n        :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1741thetanullk(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_q = 0;
  long __pyx_v_k;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("thetanullk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,&__pyx_n_s_k,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q)) != 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_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("thetanullk", 0, 2, 3, 1); __PYX_ERR(4, 29815, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "thetanullk") < 0)) __PYX_ERR(4, 29815, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_q = values[0];
    __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29815, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29815, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("thetanullk", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29815, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.thetanullk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1740thetanullk(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_q, __pyx_v_k, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1740thetanullk(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_q, long __pyx_v_k, long __pyx_v_precision) {
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("thetanullk", 0);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_instance.pxi":29819
 *         :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.
 *         '''
 *         q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29820
 *         '''
 *         q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29820, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29821
 *         q = objtogen(q)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thetanullk(_q, k, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29822
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = thetanullk(_q, k, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29823
 *         cdef GEN _q = (<Gen>q).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thetanullk(_q, k, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = thetanullk(__pyx_v__q, __pyx_v_k, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29824
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thetanullk(_q, k, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def thue(self, tnf, a, sol=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29815
 *         return new_gen(_ret)
 * 
 *     def thetanullk(self, q, long k, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.thetanullk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29826
 *         return new_gen(_ret)
 * 
 *     def thue(self, tnf, a, sol=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all solutions of the equation
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1743thue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1742thue[] = "\n        Returns all solutions of the equation\n        :math:`P(x,y) = a` in integers :math:`x` and :math:`y`, where :emphasis:`tnf` was created with\n        :math:`thueinit (P)`. If present, :emphasis:`sol` must contain the solutions of\n        :math:`\\mathrm{Norm} (x) = a` modulo units of positive norm in the number field\n        defined by :math:`P` (as computed by :literal:`bnfisintnorm`). If there are infinitely\n        many solutions, an error is issued.\n        \n        It is allowed to input directly the polynomial :math:`P` instead of a :emphasis:`tnf`,\n        in which case, the function first performs :literal:`thueinit(P,0)`. This is\n        very wasteful if more than one value of :math:`a` is required.\n        \n        If :emphasis:`tnf` was computed without assuming GRH (flag :math:`1` in :literal:`thueinit`),\n        then the result is unconditional. Otherwise, it depends in principle of the\n        truth of the GRH, but may still be unconditionally correct in some\n        favorable cases. The result is conditional on the GRH if\n        :math:`a != \302\261 1` and :math:`P` has a single irreducible rational factor, whose\n        attached tentative class number :math:`h` and regulator :math:`R` (as computed\n        assuming the GRH) satisfy\n        \n        - :math:`h > 1`,\n        \n        - :math:`R/0.2 > 1.5`.\n        \n        Here's how to solve the Thue equation :math:`x^{13} - 5y^{13} = - 4`:\n        \n        ::\n        \n            ? tnf = thueinit(x^13 - 5);\n            ? thue(tnf, -4)\n            %1 = [[1, 1]]\n        \n        In this case, one checks that :literal:`bnfinit(x^13 -5).no`\n        is :math:`1`. Hence, the only solution is :math:`(x,y) = (1,1)` and the result is\n        unconditional. On the other hand:\n        \n        ::\n        \n            ? P = x^3-2*x^2+3*x-17; tnf = thueinit(P);\n            ? thue(tnf, -15)\n            %2 = [[1, 1]] \\\\ a priori conditional on the GRH.\n            ""? K = bnfinit(P); K.no\n            %3 = 3\n            ? K.reg\n            %4 = 2.8682185139262873674706034475498755834\n        \n        This time the result is conditional. All results computed using this\n        particular :emphasis:`tnf` are likewise conditional, :emphasis:`except` for a right-hand\n        side of :math:`\302\261 1`.\n        The above result is in fact correct, so we did not just disprove the GRH:\n        \n        ::\n        \n            ? tnf = thueinit(x^3-2*x^2+3*x-17, 1 /*unconditional*/);\n            ? thue(tnf, -15)\n            %4 = [[1, 1]]\n        \n        Note that reducible or non-monic polynomials are allowed:\n        \n        ::\n        \n            ? tnf = thueinit((2*x+1)^5 * (4*x^3-2*x^2+3*x-17), 1);\n            ? thue(tnf, 128)\n            %2 = [[-1, 0], [1, 0]]\n        \n        Reducible polynomials are in fact much easier to handle.\n        \n        :strong:`Note.` When :math:`P` is irreducible without a real root, the default\n        strategy is to use brute force enumeration in time :math:`\\|a\\|^{1/\\deg P}` and\n        avoid computing a touch :emphasis:`bnf` attached to :math:`P`, see :literal:`thueinit`.\n        Besides reusing a quantity you might need for other purposes, the\n        default argument :emphasis:`sol` can also be used to use a different strategy\n        and prove that there are no solutions; of course you need to compute a\n        :emphasis:`bnf` on you own to obtain :emphasis:`sol`. If there :emphasis:`are` solutions\n        this won't help unless :math:`P` is quadratic, since the enumeration will be\n        performed in any case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1743thue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tnf = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_sol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("thue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tnf,&__pyx_n_s_a,&__pyx_n_s_sol,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_tnf)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("thue", 0, 2, 3, 1); __PYX_ERR(4, 29826, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sol);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "thue") < 0)) __PYX_ERR(4, 29826, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_tnf = values[0];
    __pyx_v_a = values[1];
    __pyx_v_sol = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("thue", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29826, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.thue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1742thue(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_tnf, __pyx_v_a, __pyx_v_sol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1742thue(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_tnf, PyObject *__pyx_v_a, PyObject *__pyx_v_sol) {
  int __pyx_v__have_sol;
  GEN __pyx_v__tnf;
  GEN __pyx_v__a;
  GEN __pyx_v__sol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("thue", 0);
  __Pyx_INCREF(__pyx_v_tnf);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_sol);

  /* "cypari/auto_instance.pxi":29904
 *         performed in any case.
 *         '''
 *         tnf = objtogen(tnf)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         cdef bint _have_sol = (sol is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tnf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_tnf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29905
 *         '''
 *         tnf = objtogen(tnf)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29905, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29906
 *         tnf = objtogen(tnf)
 *         a = objtogen(a)
 *         cdef bint _have_sol = (sol is not None)             # <<<<<<<<<<<<<<
 *         if _have_sol:
 *             sol = objtogen(sol)
 */
  __pyx_t_2 = (__pyx_v_sol != Py_None);
  __pyx_v__have_sol = __pyx_t_2;

  /* "cypari/auto_instance.pxi":29907
 *         a = objtogen(a)
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             sol = objtogen(sol)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_sol != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29908
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:
 *             sol = objtogen(sol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _tnf = (<Gen>tnf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29908, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_sol, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":29907
 *         a = objtogen(a)
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             sol = objtogen(sol)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":29909
 *         if _have_sol:
 *             sol = objtogen(sol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _tnf = (<Gen>tnf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 29909, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29910
 *             sol = objtogen(sol)
 *         sig_on()
 *         cdef GEN _tnf = (<Gen>tnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tnf)->__pyx_base.g;
  __pyx_v__tnf = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29911
 *         sig_on()
 *         cdef GEN _tnf = (<Gen>tnf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sol = NULL
 *         if _have_sol:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_instance.pxi":29912
 *         cdef GEN _tnf = (<Gen>tnf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL             # <<<<<<<<<<<<<<
 *         if _have_sol:
 *             _sol = (<Gen>sol).g
 */
  __pyx_v__sol = NULL;

  /* "cypari/auto_instance.pxi":29913
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 */
  __pyx_t_2 = (__pyx_v__have_sol != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":29914
 *         cdef GEN _sol = NULL
 *         if _have_sol:
 *             _sol = (<Gen>sol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sol)->__pyx_base.g;
    __pyx_v__sol = __pyx_t_4;

    /* "cypari/auto_instance.pxi":29913
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 */
  }

  /* "cypari/auto_instance.pxi":29915
 *         if _have_sol:
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = thue(__pyx_v__tnf, __pyx_v__a, __pyx_v__sol);

  /* "cypari/auto_instance.pxi":29916
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def thueinit(self, P, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29826
 *         return new_gen(_ret)
 * 
 *     def thue(self, tnf, a, sol=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all solutions of the equation
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.thue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tnf);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_sol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29918
 *         return new_gen(_ret)
 * 
 *     def thueinit(self, P, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the :emphasis:`tnf` corresponding to :math:`P`, a non-constant
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1745thueinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1744thueinit[] = "\n        Initializes the :emphasis:`tnf` corresponding to :math:`P`, a non-constant\n        univariate polynomial with integer coefficients.\n        The result is meant to be used in conjunction with :literal:`thue` to solve Thue\n        equations :math:`P(X / Y)Y^{\\deg P} = a`, where :math:`a` is an integer. Accordingly,\n        :math:`P` must either have at least two distinct irreducible factors over :math:`\\mathbb{Q}`,\n        or have one irreducible factor :math:`T` with degree :math:`> 2` or two conjugate\n        complex roots: under these (necessary and sufficient) conditions, the\n        equation has finitely many integer solutions.\n        \n        ::\n        \n            ? S = thueinit(t^2+1);\n            ? thue(S, 5)\n            %2 = [[-2, -1], [-2, 1], [-1, -2], [-1, 2], [1, -2], [1, 2], [2, -1], [2, 1]]\n            ? S = thueinit(t+1);\n             *** at top-level: thueinit(t+1)\n             *** ^-------------\n             *** thueinit: domain error in thueinit: P = t + 1\n        \n        The hardest case is when :math:`\\deg P > 2` and :math:`P` is irreducible\n        with at least one real root. The routine then uses Bilu-Hanrot's algorithm.\n        \n        If :math:`flag` is non-zero, certify results unconditionally. Otherwise, assume\n        GRH, this being much faster of course. In the latter case, the result\n        may still be unconditionally correct, see :literal:`thue`. For instance in most\n        cases where :math:`P` is reducible (not a pure power of an irreducible), :emphasis:`or`\n        conditional computed class groups are trivial :emphasis:`or` the right hand side\n        is :math:`\302\2611`, then results are unconditional.\n        \n        :strong:`Note.` The general philosophy is to disprove the existence of large\n        solutions then to enumerate bounded solutions naively. The implementation\n        will overflow when there exist huge solutions and the equation has degree\n        :math:`> 2` (t""he quadratic imaginary case is special, since we can stick to\n        :literal:`bnfisintnorm`, there are no fundamental units):\n        \n        ::\n        \n            ? thue(t^3+2, 10^30)\n             *** at top-level: L=thue(t^3+2,10^30)\n             *** ^-----------------\n             *** thue: overflow in thue (SmallSols): y <= 80665203789619036028928.\n            ? thue(x^2+2, 10^30) \\\\ quadratic case much easier\n            %1 = [[-1000000000000000, 0], [1000000000000000, 0]]\n        \n        :strong:`Note.` It is sometimes possible to circumvent the above, and in any\n        case obtain an important speed-up, if you can write :math:`P = Q(x^d)` for some :math:`d >\n        1` and :math:`Q` still satisfying the :literal:`thueinit` hypotheses. You can then solve\n        the equation attached to :math:`Q` then eliminate all solutions :math:`(x,y)` such that\n        either :math:`x` or :math:`y` is not a :math:`d`-th power.\n        \n        ::\n        \n            ? thue(x^4+1, 10^40); \\\\ stopped after 10 hours\n            ? filter(L,d) =\n             my(x,y); [[x,y] | v<-L, ispower(v[1],d,&x)&&ispower(v[2],d,&y)];\n            ? L = thue(x^2+1, 10^40);\n            ? filter(L, 2)\n            %4 = [[0, 10000000000], [10000000000, 0]]\n        \n        The last 2 commands use less than 20ms.\n        \n        :strong:`Note.` When :math:`P` is irreducible without a real root, the equation\n        can be solved unconditionnally in time :math:`\\|a\\|^{1/\\deg P}`. When this\n        latter quantity is huge and the equation has no solutions, this fact\n        may still be ascertained via arithmetic conditions but this now implies\n        solving norm equations, computing a :emphasis:`bnf` and possibly assuming the GRH.\n        When there is no real root, the code does not compute a :emphasis:`bnf`\n        (with certification if :math:`flag = 1`) if it expects this to be an \"easy\"\n        computation (because the result would only ""be used for huge values of :math:`a`).\n        See :literal:`thue` for a way to compute an expensive :emphasis:`bnf` on your own and\n        still get a result where this default cheap strategy fails.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1745thueinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("thueinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "thueinit") < 0)) __PYX_ERR(4, 29918, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29918, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 29918, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("thueinit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 29918, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.thueinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1744thueinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_P, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1744thueinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("thueinit", 0);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_instance.pxi":29992
 *         still get a result where this default cheap strategy fails.
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":29993
 *         '''
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 29993, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":29994
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thueinit(_P, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_instance.pxi":29995
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = thueinit(_P, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":29996
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thueinit(_P, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = thueinit(__pyx_v__P, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":29997
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thueinit(_P, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def trace(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 29997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29918
 *         return new_gen(_ret)
 * 
 *     def thueinit(self, P, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the :emphasis:`tnf` corresponding to :math:`P`, a non-constant
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.thueinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":29999
 *         return new_gen(_ret)
 * 
 *     def trace(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This applies to quite general :math:`x`. If :math:`x` is not a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1747trace(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1746trace[] = "\n        This applies to quite general :math:`x`. If :math:`x` is not a\n        matrix, it is equal to the sum of :math:`x` and its conjugate, except for polmods\n        where it is the trace as an algebraic number.\n        \n        For :math:`x` a square matrix, it is the ordinary trace. If :math:`x` is a\n        non-square matrix (but not a vector), an error occurs.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1747trace(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trace (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1746trace(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1746trace(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("trace", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":30008
 *         non-square matrix (but not a vector), an error occurs.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30008, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30009
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrace(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30009, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30010
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtrace(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30011
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrace(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtrace(__pyx_v__x);

  /* "cypari/auto_instance.pxi":30012
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrace(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def type(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":29999
 *         return new_gen(_ret)
 * 
 *     def trace(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This applies to quite general :math:`x`. If :math:`x` is not a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30014
 *         return new_gen(_ret)
 * 
 *     def type(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This is useful only under :literal:`gp`. Returns the internal type name of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1749type(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1748type[] = "\n        This is useful only under :literal:`gp`. Returns the internal type name of\n        the PARI object :math:`x` as a string. Check out existing type names with the\n        metacommand :literal:`\\\\t`. For example :literal:`type(1)` will return \":literal:`t_INT`\".\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1749type(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1748type(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1748type(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("type", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":30020
 *         metacommand :literal:`\\t`. For example :literal:`type(1)` will return ":literal:`t_INT`".
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30021
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = type0(_x)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30021, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30022
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = type0(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30023
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = type0(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = type0(__pyx_v__x);

  /* "cypari/auto_instance.pxi":30024
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = type0(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def valuation(self, x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30014
 *         return new_gen(_ret)
 * 
 *     def type(self, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This is useful only under :literal:`gp`. Returns the internal type name of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30026
 *         return new_gen(_ret)
 * 
 *     def valuation(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the highest
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1751valuation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1750valuation[] = "\n        Computes the highest\n        exponent of :math:`p` dividing :math:`x`. If :math:`p` is of type integer, :math:`x` must be an\n        integer, an intmod whose modulus is divisible by :math:`p`, a fraction, a\n        :math:`q`-adic number with :math:`q = p`, or a polynomial or power series in which case the\n        valuation is the minimum of the valuation of the coefficients.\n        \n        If :math:`p` is of type polynomial, :math:`x` must be of type polynomial or rational\n        function, and also a power series if :math:`x` is a monomial. Finally, the\n        valuation of a vector, complex or quadratic number is the minimum of the\n        component valuations.\n        \n        If :math:`x = 0`, the result is :literal:`+oo` if :math:`x` is an exact object. If :math:`x` is a\n        :math:`p`-adic numbers or power series, the result is the exponent of the zero.\n        Any other type combinations gives an error.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1751valuation(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("valuation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("valuation", 1, 2, 2, 1); __PYX_ERR(4, 30026, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "valuation") < 0)) __PYX_ERR(4, 30026, __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_x = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("valuation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30026, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.valuation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1750valuation(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1750valuation(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("valuation", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_instance.pxi":30043
 *         Any other type combinations gives an error.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30044
 *         '''
 *         x = objtogen(x)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30045
 *         x = objtogen(x)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30045, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30046
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gpvaluation(_x, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30047
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpvaluation(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30048
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gpvaluation(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpvaluation(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_instance.pxi":30049
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gpvaluation(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def varhigher(self, name, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30026
 *         return new_gen(_ret)
 * 
 *     def valuation(self, x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the highest
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.valuation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30051
 *         return new_gen(_ret)
 * 
 *     def varhigher(self, name, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a variable :emphasis:`name` whose priority is higher
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1753varhigher(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1752varhigher[] = "\n        Return a variable :emphasis:`name` whose priority is higher\n        than the priority of :math:`v` (of all existing variables if :math:`v` is omitted).\n        This is a counterpart to :literal:`varlower`.\n        \n        ::\n        \n            ? Pol([x,x], t)\n             *** at top-level: Pol([x,x],t)\n             *** ^------------\n             *** Pol: incorrect priority in gtopoly: variable x <= t\n            ? t = varhigher(\"t\", x);\n            ? Pol([x,x], t)\n            %3 = x*t + x\n        \n        This routine is useful since new GP variables directly\n        created by the interpreter always have lower priority than existing\n        GP variables. When some basic objects already exist in a variable\n        that is incompatible with some function requirement, you can now\n        create a new variable with a suitable priority instead of changing variables\n        in existing objects:\n        \n        ::\n        \n            ? K = nfinit(x^2+1);\n            ? rnfequation(K,y^2-2)\n             *** at top-level: rnfequation(K,y^2-2)\n             *** ^--------------------\n             *** rnfequation: incorrect priority in rnfequation: variable y >= x\n            ? y = varhigher(\"y\", x);\n            ? rnfequation(K, y^2-2)\n            %3 = y^4 - 2*y^2 + 9\n        \n        :strong:`Caution 1.`\n        The :emphasis:`name` is an arbitrary character string, only used for display\n        purposes and need not be related to the GP variable holding the result, nor\n        to be a valid variable name. In particular the :emphasis:`name` can\n        not be used to retrieve the variable, it is not even present in the parser's\n        hash tables.\n        \n        ::\n        \n            ? x = varhigher(\"#\");\n            ? x^2\n            %2 = #^2\n        \n        :strong:`Caution 2.` There are a limited number of variables and if no\n        existing variable with the given display name has the requested\n     ""   priority, the call to :literal:`varhigher` uses up one such slot. Do not create\n        new variables in this way unless it's absolutely necessary,\n        reuse existing names instead and choose sensible priority requirements:\n        if you only need a variable with higher priority than :math:`x`, state so\n        rather than creating a new variable with highest priority.\n        \n        ::\n        \n            \\\\ quickly use up all variables\n            ? n = 0; while(1,varhigher(\"tmp\"); n++)\n             *** at top-level: n=0;while(1,varhigher(\"tmp\");n++)\n             *** ^-------------------\n             *** varhigher: no more variables available.\n             *** Break loop: type 'break' to go back to GP prompt\n            break> n\n            65510\n            \\\\ infinite loop: here we reuse the same 'tmp'\n            ? n = 0; while(1,varhigher(\"tmp\", x); n++)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1753varhigher(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("varhigher (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "varhigher") < 0)) __PYX_ERR(4, 30051, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("varhigher", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30051, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.varhigher", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1752varhigher(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_name, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1752varhigher(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_v) {
  char *__pyx_v__name;
  long __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("varhigher", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "cypari/auto_instance.pxi":30119
 *             ? n = 0; while(1,varhigher("tmp", x); n++)
 *         '''
 *         name = to_bytes(name)             # <<<<<<<<<<<<<<
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30120
 *         '''
 *         name = to_bytes(name)
 *         cdef char* _name = <bytes>name             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  if (unlikely(__pyx_v_name == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 30120, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_name); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 30120, __pyx_L1_error)
  __pyx_v__name = __pyx_t_2;

  /* "cypari/auto_instance.pxi":30121
 *         name = to_bytes(name)
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":30122
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_v != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":30123
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = varhigher(_name, _v)
 */
    __pyx_t_5 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_5 == ((long)-2L))) __PYX_ERR(4, 30123, __pyx_L1_error)
    __pyx_v__v = __pyx_t_5;

    /* "cypari/auto_instance.pxi":30122
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30124
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = varhigher(_name, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(4, 30124, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30125
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _ret = varhigher(_name, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = varhigher(__pyx_v__name, __pyx_v__v);

  /* "cypari/auto_instance.pxi":30126
 *         sig_on()
 *         cdef GEN _ret = varhigher(_name, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def variable(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30051
 *         return new_gen(_ret)
 * 
 *     def varhigher(self, name, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a variable :emphasis:`name` whose priority is higher
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.varhigher", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30128
 *         return new_gen(_ret)
 * 
 *     def variable(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the main variable of the object :math:`x` (the variable with the highest
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1755variable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1754variable[] = "\n        Gives the main variable of the object :math:`x` (the variable with the highest\n        priority used in :math:`x`), and :math:`p` if :math:`x` is a :math:`p`-adic number. Return :math:`0` if\n        :math:`x` has no variable attached to it.\n        \n        ::\n        \n            ? variable(x^2 + y)\n            %1 = x\n            ? variable(1 + O(5^2))\n            %2 = 5\n            ? variable([x,y,z,t])\n            %3 = x\n            ? variable(1)\n            %4 = 0\n        \n        The construction\n        \n        ::\n        \n             if (!variable(x),...)\n        \n        can be used to test whether a variable is attached to :math:`x`.\n        \n        If :math:`x` is omitted, returns the list of user variables known to the\n        interpreter, by order of decreasing priority. (Highest priority is initially\n        :math:`x`, which come first until :literal:`varhigher` is used.) If :literal:`varhigher`\n        or :literal:`varlower` are used, it is quite possible to end up with different\n        variables (with different priorities) printed in the same way: they\n        will then appear multiple times in the output:\n        \n        ::\n        \n            ? varhigher(\"y\");\n            ? varlower(\"y\");\n            ? variable()\n            %4 = [y, x, y]\n        \n        Using :literal:`v = variable()` then :literal:`v[1]`, :literal:`v[2]`,\n        etc.\302\240allows to recover and use existing variables.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1755variable(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("variable (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "variable") < 0)) __PYX_ERR(4, 30128, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("variable", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.variable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1754variable(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1754variable(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("variable", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":30170
 *         etc.allows to recover and use existing variables.
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":30171
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":30172
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":30171
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30173
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 30173, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30174
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":30175
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gpolvar(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":30176
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpolvar(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":30175
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gpolvar(_x)
 */
  }

  /* "cypari/auto_instance.pxi":30177
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gpolvar(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpolvar(__pyx_v__x);

  /* "cypari/auto_instance.pxi":30178
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = gpolvar(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def variables(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30128
 *         return new_gen(_ret)
 * 
 *     def variable(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the main variable of the object :math:`x` (the variable with the highest
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.variable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30180
 *         return new_gen(_ret)
 * 
 *     def variables(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the list of all variables occuring in object :math:`x` (all user
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1757variables(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1756variables[] = "\n        Returns the list of all variables occuring in object :math:`x` (all user\n        variables known to the interpreter if :math:`x` is omitted), sorted by\n        decreasing priority.\n        \n        ::\n        \n            ? variables([x^2 + y*z + O(t), a+x])\n            %1 = [x, y, z, t, a]\n        \n        The construction\n        \n        ::\n        \n             if (!variables(x),...)\n        \n        can be used to test whether a variable is attached to :math:`x`.\n        \n        If :literal:`varhigher` or :literal:`varlower` are used, it is quite possible to end up\n        with different variables (with different priorities) printed in the same\n        way: they will then appear multiple times in the output:\n        \n        ::\n        \n            ? y1 = varhigher(\"y\");\n            ? y2 = varlower(\"y\");\n            ? variables(y*y1*y2)\n            %4 = [y, y, y]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1757variables(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("variables (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "variables") < 0)) __PYX_ERR(4, 30180, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("variables", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30180, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.variables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1756variables(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1756variables(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x) {
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("variables", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":30210
 *             %4 = [y, y, y]
 *         '''
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_1;

  /* "cypari/auto_instance.pxi":30211
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":30212
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30212, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_instance.pxi":30211
 *         '''
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30213
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 30213, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30214
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":30215
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = variables_vec(_x)
 */
  __pyx_t_1 = (__pyx_v__have_x != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_instance.pxi":30216
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = variables_vec(_x)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_instance.pxi":30215
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = variables_vec(_x)
 */
  }

  /* "cypari/auto_instance.pxi":30217
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = variables_vec(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = variables_vec(__pyx_v__x);

  /* "cypari/auto_instance.pxi":30218
 *             _x = (<Gen>x).g
 *         cdef GEN _ret = variables_vec(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def varlower(self, name, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30180
 *         return new_gen(_ret)
 * 
 *     def variables(self, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the list of all variables occuring in object :math:`x` (all user
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.variables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30220
 *         return new_gen(_ret)
 * 
 *     def varlower(self, name, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a variable :emphasis:`name` whose priority is lower
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1759varlower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1758varlower[] = "\n        Return a variable :emphasis:`name` whose priority is lower\n        than the priority of :math:`v` (of all existing variables if :math:`v` is omitted).\n        This is a counterpart to :literal:`varhigher`.\n        \n        New GP variables directly created by the interpreter always\n        have lower priority than existing GP variables, but it is not easy\n        to check whether an identifier is currently unused, so that the\n        corresponding variable has the expected priority when it's created!\n        Thus, depending on the session history, the same command may fail or succeed:\n        \n        ::\n        \n            ? t; z; \\\\ now t > z\n            ? rnfequation(t^2+1,z^2-t)\n             *** at top-level: rnfequation(t^2+1,z^\n             *** ^--------------------\n             *** rnfequation: incorrect priority in rnfequation: variable t >= t\n        \n        Restart and retry:\n        \n        ::\n        \n            ? z; t; \\\\ now z > t\n            ? rnfequation(t^2+1,z^2-t)\n            %2 = z^4 + 1\n        \n        It is quite annoying for package authors, when trying to\n        define a base ring, to notice that the package may fail for some users\n        depending on their session history. The safe way to do this is as follows:\n        \n        ::\n        \n            ? z; t; \\\\ In new session: now z > t\n            ...\n            ? t = varlower(\"t\", 'z);\n            ? rnfequation(t^2+1,z^2-2)\n            %2 = z^4 - 2*z^2 + 9\n            ? variable()\n            %3 = [x, y, z, t]\n        \n        ::\n        \n            ? t; z; \\\\ In new session: now t > z\n            ...\n            ? t = varlower(\"t\", 'z); \\\\ create a new variable, still printed \"t\"\n            ? rnfequation(t^2+1,z^2-2)\n            %2 = z^4 - 2*z^2 + 9\n            ? variable()\n            %3 = [x, y, t, z, t]\n        \n        Now both constructions succeed. Note that in the\n        first case, :literal:`v""arlower` is essentially a no-op, the existing variable :math:`t`\n        has correct priority. While in the second case, two different variables are\n        displayed as :literal:`t`, one with higher priority than :math:`z` (created in the first\n        line) and another one with lower priority (created by :literal:`varlower`).\n        \n        :strong:`Caution 1.`\n        The :emphasis:`name` is an arbitrary character string, only used for display\n        purposes and need not be related to the GP variable holding the result, nor\n        to be a valid variable name. In particular the :emphasis:`name` can\n        not be used to retrieve the variable, it is not even present in the parser's\n        hash tables.\n        \n        ::\n        \n            ? x = varlower(\"#\");\n            ? x^2\n            %2 = #^2\n        \n        :strong:`Caution 2.` There are a limited number of variables and if no\n        existing variable with the given display name has the requested\n        priority, the call to :literal:`varlower` uses up one such slot. Do not create\n        new variables in this way unless it's absolutely necessary,\n        reuse existing names instead and choose sensible priority requirements:\n        if you only need a variable with higher priority than :math:`x`, state so\n        rather than creating a new variable with highest priority.\n        \n        ::\n        \n            \\\\ quickly use up all variables\n            ? n = 0; while(1,varlower(\"x\"); n++)\n             *** at top-level: n=0;while(1,varlower(\"x\");n++)\n             *** ^-------------------\n             *** varlower: no more variables available.\n             *** Break loop: type 'break' to go back to GP prompt\n            break> n\n            65510\n            \\\\ infinite loop: here we reuse the same 'tmp'\n            ? n = 0; while(1,varlower(\"tmp\", x); n++)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1759varlower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("varlower (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "varlower") < 0)) __PYX_ERR(4, 30220, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_name = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("varlower", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30220, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.varlower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1758varlower(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_name, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1758varlower(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_v) {
  char *__pyx_v__name;
  long __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("varlower", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "cypari/auto_instance.pxi":30312
 *             ? n = 0; while(1,varlower("tmp", x); n++)
 *         '''
 *         name = to_bytes(name)             # <<<<<<<<<<<<<<
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30313
 *         '''
 *         name = to_bytes(name)
 *         cdef char* _name = <bytes>name             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  if (unlikely(__pyx_v_name == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 30313, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_name); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 30313, __pyx_L1_error)
  __pyx_v__name = __pyx_t_2;

  /* "cypari/auto_instance.pxi":30314
 *         name = to_bytes(name)
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_instance.pxi":30315
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_v != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":30316
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = varlower(_name, _v)
 */
    __pyx_t_5 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_5 == ((long)-2L))) __PYX_ERR(4, 30316, __pyx_L1_error)
    __pyx_v__v = __pyx_t_5;

    /* "cypari/auto_instance.pxi":30315
 *         cdef char* _name = <bytes>name
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30317
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = varlower(_name, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(4, 30317, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30318
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _ret = varlower(_name, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = varlower(__pyx_v__name, __pyx_v__v);

  /* "cypari/auto_instance.pxi":30319
 *         sig_on()
 *         cdef GEN _ret = varlower(_name, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecextract(self, x, y, z=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30220
 *         return new_gen(_ret)
 * 
 *     def varlower(self, name, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a variable :emphasis:`name` whose priority is lower
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.varlower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30321
 *         return new_gen(_ret)
 * 
 *     def vecextract(self, x, y, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extraction of components of the vector or matrix :math:`x` according to :math:`y`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1761vecextract(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1760vecextract[] = "\n        Extraction of components of the vector or matrix :math:`x` according to :math:`y`.\n        In case :math:`x` is a matrix, its components are the :emphasis:`columns` of :math:`x`. The\n        parameter :math:`y` is a component specifier, which is either an integer, a string\n        describing a range, or a vector.\n        \n        If :math:`y` is an integer, it is considered as a mask: the binary bits of :math:`y` are\n        read from right to left, but correspond to taking the components from left to\n        right. For example, if :math:`y = 13 = (1101)_2` then the components 1,3 and 4 are\n        extracted.\n        \n        If :math:`y` is a vector (:literal:`t_VEC`, :literal:`t_COL` or :literal:`t_VECSMALL`), which must have\n        integer entries, these entries correspond to the component numbers to be\n        extracted, in the order specified.\n        \n        If :math:`y` is a string, it can be\n        \n        - a single (non-zero) index giving a component number (a negative\n          index means we start counting from the end).\n        \n        - a range of the form :literal:`\":math:`a`..:math:`b`\"`, where :math:`a` and :math:`b` are\n          indexes as above. Any of :math:`a` and :math:`b` can be omitted; in this case, we take\n          as default values :math:`a = 1` and :math:`b = -1`, i.e.\302\240the first and last components\n          respectively. We then extract all components in the interval :math:`[a,b]`, in\n          reverse order if :math:`b < a`.\n        \n        In addition, if the first character in the string is :literal:`^`, the\n        complement of the given set of indices is taken.\n        \n        If :math:`z` is not omitted, :math:`x` must be a matrix. :math:`y` is then the :emphasis:`row`\n        specifier, and :math:`z` the :emphasis:`column` specifier, where the component specifier\n        is as explained above.\n        \n        ::\n        \n            ? v = [a, b, c, d, e];\n           "" ? vecextract(v, 5) \\\\ mask\n            %1 = [a, c]\n            ? vecextract(v, [4, 2, 1]) \\\\ component list\n            %2 = [d, b, a]\n            ? vecextract(v, \"2..4\") \\\\ interval\n            %3 = [b, c, d]\n            ? vecextract(v, \"-1..-3\") \\\\ interval + reverse order\n            %4 = [e, d, c]\n            ? vecextract(v, \"^2\") \\\\ complement\n            %5 = [a, c, d, e]\n            ? vecextract(matid(3), \"2..\", \"..\")\n            %6 =\n            [0 1 0]\n            \n            [0 0 1]\n        \n        The range notations :literal:`v[i..j]` and :literal:`v[^i]` (for :literal:`t_VEC` or\n        :literal:`t_COL`) and :literal:`M[i..j, k..l]` and friends (for :literal:`t_MAT`) implement a\n        subset of the above, in a simpler and :emphasis:`faster` way, hence should be\n        preferred in most common situations. The following features are not\n        implemented in the range notation:\n        \n        - reverse order,\n        \n        - omitting either :math:`a` or :math:`b` in :literal:`:math:`a`..:math:`b``.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1761vecextract(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecextract (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_z,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("vecextract", 0, 2, 3, 1); __PYX_ERR(4, 30321, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vecextract") < 0)) __PYX_ERR(4, 30321, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_z = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vecextract", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30321, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecextract", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1760vecextract(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1760vecextract(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  int __pyx_v__have_z;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("vecextract", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_instance.pxi":30384
 *         - omitting either :math:`a` or :math:`b` in :literal:`:math:`a`..:math:`b``.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         cdef bint _have_z = (z is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30385
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30386
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_2 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_2;

  /* "cypari/auto_instance.pxi":30387
 *         y = objtogen(y)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30388
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":30387
 *         y = objtogen(y)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30389
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 30389, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30390
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":30391
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_instance.pxi":30392
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_instance.pxi":30393
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30394
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = extract0(_x, _y, _z)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_instance.pxi":30393
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)
 */
  }

  /* "cypari/auto_instance.pxi":30395
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = extract0(__pyx_v__x, __pyx_v__y, __pyx_v__z);

  /* "cypari/auto_instance.pxi":30396
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecprod(self, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30396, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30321
 *         return new_gen(_ret)
 * 
 *     def vecextract(self, x, y, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extraction of components of the vector or matrix :math:`x` according to :math:`y`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecextract", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30398
 *         return new_gen(_ret)
 * 
 *     def vecprod(self, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the product of the components of the vector :math:`v`. Return :math:`1` on an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1763vecprod(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1762vecprod[] = "\n        Return the product of the components of the vector :math:`v`. Return :math:`1` on an\n        empty vector.\n        \n        ::\n        \n            ? vecprod([1,2,3])\n            %1 = 6\n            ? vecprod([])\n            %2 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1763vecprod(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecprod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1762vecprod(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1762vecprod(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("vecprod", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":30410
 *             %2 = 1
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30411
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecprod(_v)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30411, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30412
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = vecprod(_v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30413
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecprod(_v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = vecprod(__pyx_v__v);

  /* "cypari/auto_instance.pxi":30414
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecprod(_v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecsearch(self, v, x, cmpf=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30398
 *         return new_gen(_ret)
 * 
 *     def vecprod(self, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the product of the components of the vector :math:`v`. Return :math:`1` on an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecprod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30416
 *         return new_gen(_ret)
 * 
 *     def vecsearch(self, v, x, cmpf=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the sorted vector or list :math:`v`: return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1765vecsearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1764vecsearch[] = "\n        Determines whether :math:`x` belongs to the sorted vector or list :math:`v`: return\n        the (positive) index where :math:`x` was found, or :math:`0` if it does not belong to\n        :math:`v`.\n        \n        If the comparison function cmpf is omitted, we assume that :math:`v` is sorted in\n        increasing order, according to the standard comparison function :literal:`lex`,\n        thereby restricting the possible types for :math:`x` and the elements of :math:`v`\n        (integers, fractions, reals, and vectors of such). We also transparently\n        allow a :literal:`t_VECSMALL` :math:`x` in this case, for the natural ordering of the\n        integers.\n        \n        If :literal:`cmpf` is present, it is understood as a comparison function and we\n        assume that :math:`v` is sorted according to it, see :literal:`vecsort` for how to\n        encode comparison functions.\n        \n        ::\n        \n            ? v = [1,3,4,5,7];\n            ? vecsearch(v, 3)\n            %2 = 2\n            ? vecsearch(v, 6)\n            %3 = 0 \\\\ not in the list\n            ? vecsearch([7,6,5], 5) \\\\ unsorted vector: result undefined\n            %4 = 0\n        \n        Note that if we are sorting with respect to a key\n        which is expensive to compute (e.g. a discriminant), one should rather\n        precompute all keys, sort that vector and search in the vector of keys,\n        rather than searching in the original vector with respect to a comparison\n        function.\n        \n        By abuse of notation, :math:`x` is also allowed to be a matrix, seen as a vector\n        of its columns; again by abuse of notation, a :literal:`t_VEC` is considered\n        as part of the matrix, if its transpose is one of the matrix columns.\n        \n        ::\n        \n            ? v = vecsort([3,0,2; 1,0,2]) \\\\ sort matrix columns according to lex order\n            %1 =\n            [0 2 3]\n            \n            [0 2 1]\n      ""      ? vecsearch(v, [3,1]~)\n            %2 = 3\n            ? vecsearch(v, [3,1]) \\\\ can search for x or x~\n            %3 = 3\n            ? vecsearch(v, [1,2])\n            %4 = 0 \\\\ not in the list\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1765vecsearch(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_cmpf = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecsearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_x,&__pyx_n_s_cmpf,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_v)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("vecsearch", 0, 2, 3, 1); __PYX_ERR(4, 30416, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmpf);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vecsearch") < 0)) __PYX_ERR(4, 30416, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_v = values[0];
    __pyx_v_x = values[1];
    __pyx_v_cmpf = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vecsearch", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30416, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1764vecsearch(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_v, __pyx_v_x, __pyx_v_cmpf);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1764vecsearch(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v, PyObject *__pyx_v_x, PyObject *__pyx_v_cmpf) {
  int __pyx_v__have_cmpf;
  GEN __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__cmpf;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("vecsearch", 0);
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_cmpf);

  /* "cypari/auto_instance.pxi":30467
 *             %4 = 0 \\ not in the list
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30468
 *         '''
 *         v = objtogen(v)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30469
 *         v = objtogen(v)
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 */
  __pyx_t_2 = (__pyx_v_cmpf != Py_None);
  __pyx_v__have_cmpf = __pyx_t_2;

  /* "cypari/auto_instance.pxi":30470
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30471
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cmpf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_cmpf, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":30470
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30472
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 30472, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30473
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_4;

  /* "cypari/auto_instance.pxi":30474
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":30475
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 */
  __pyx_v__cmpf = NULL;

  /* "cypari/auto_instance.pxi":30476
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 */
  __pyx_t_2 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30477
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cmpf)->__pyx_base.g;
    __pyx_v__cmpf = __pyx_t_4;

    /* "cypari/auto_instance.pxi":30476
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 */
  }

  /* "cypari/auto_instance.pxi":30478
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = vecsearch(__pyx_v__v, __pyx_v__x, __pyx_v__cmpf);

  /* "cypari/auto_instance.pxi":30479
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":30480
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def vecsort(self, x, cmpf=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30416
 *         return new_gen(_ret)
 * 
 *     def vecsearch(self, v, x, cmpf=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the sorted vector or list :math:`v`: return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_cmpf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30482
 *         return _ret
 * 
 *     def vecsort(self, x, cmpf=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the vector :math:`x` in ascending order, using a mergesort method.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1767vecsort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1766vecsort[] = "\n        Sorts the vector :math:`x` in ascending order, using a mergesort method.\n        :math:`x` must be a list, vector or matrix (seen as a vector of its columns).\n        Note that mergesort is stable, hence the initial ordering of \"equal\"\n        entries (with respect to the sorting criterion) is not changed.\n        \n        If :literal:`cmpf` is omitted, we use the standard comparison function\n        :literal:`lex`, thereby restricting the possible types for the elements of :math:`x`\n        (integers, fractions or reals and vectors of those). We also transparently\n        allow a :literal:`t_VECSMALL` :math:`x` in this case, for the standard ordering on the\n        integers.\n        \n        If :literal:`cmpf` is present, it is understood as a comparison function and we\n        sort according to it. The following possibilities exist:\n        \n        - an integer :math:`k`: sort according to the value of the :math:`k`-th\n          subcomponents of the components of\302\240:math:`x`.\n        \n        - a vector: sort lexicographically according to the components listed in\n          the vector. For example, if :math:`cmpf = [2,1,3]`, sort with respect to\n          the second component, and when these are equal, with respect to the first,\n          and when these are equal, with respect to the third.\n        \n        - a comparison function: :literal:`t_CLOSURE` with two arguments :math:`x` and :math:`y`,\n          and returning a real number which is :math:`< 0`, :math:`> 0` or :math:`= 0` if :math:`x < y`, :math:`x > y` or\n          :math:`x = y` respectively.\n        \n        - a key: :literal:`t_CLOSURE` with one argument :math:`x` and returning\n          the value :math:`f(x)` with respect to which we sort.\n        \n        ::\n        \n            ? vecsort([3,0,2; 1,0,2]) \\\\ sort columns according to lex order\n            %1 =\n            [0 2 3]\n            \n            [0 2 1]\n            ? vecsort(v, (x,y)->y-""x) \\\\ reverse sort\n            ? vecsort(v, (x,y)->abs(x)-abs(y)) \\\\ sort by increasing absolute value\n            ? vecsort(v, abs) \\\\ sort by increasing absolute value, using key\n            ? cmpf(x,y) = my(dx = poldisc(x), dy = poldisc(y)); abs(dx) - abs(dy);\n            ? v = [x^2+1, x^3-2, x^4+5*x+1] vecsort(v, cmpf) \\\\ comparison function\n            ? vecsort(v, x->abs(poldisc(x))) \\\\ key\n        \n        The :literal:`abs` and :literal:`cmpf` examples show how to use a named function\n        instead of an anonymous function. It is preferable to use a :emphasis:`key`\n        whenever possible rather than include it in the comparison function as above\n        since the key is evaluated :math:`O(n)` times instead of :math:`O(n\\log n)`,\n        where :math:`n` is the number of entries.\n        \n        A direct approach is also possible and equivalent to using a sorting key:\n        \n        ::\n        \n            ? T = [abs(poldisc(x)) | x<-v];\n            ? perm = vecsort(T,,1); \\\\ indirect sort\n            ? vecextract(v, perm)\n        \n        This also provides the vector :math:`T` of all keys, which is\n        interesting for instance in later :literal:`vecsearch` calls: it is more\n        efficient to sort :math:`T` (:literal:`T = vecextract(T, perm)`) then search for a key\n        in :math:`T` rather than to search in :math:`v` using a comparison function or a key.\n        Note also that :literal:`mapisdefined` is often easier to use and faster than\n        :literal:`vecsearch`.\n        \n        The binary digits of :emphasis:`flag` mean:\n        \n        - 1: indirect sorting of the vector :math:`x`, i.e.\302\240if :math:`x` is an\n          :math:`n`-component vector, returns a permutation of :math:`[1,2,...,n]` which\n          applied to the components of :math:`x` sorts :math:`x` in increasing order.\n          For example, :literal:`vecextract(x, vecsort(x,,1))` is equivalent to\n          :literal:`vecs""ort(x)`.\n        \n        - 4: use descending instead of ascending order.\n        \n        - 8: remove \"duplicate\" entries with respect to the sorting function\n          (keep the first occurring entry). For example:\n        \n        ::\n        \n             ? vecsort([Pi,Mod(1,2),z], (x,y)->0, 8) \\\\ make everything compare equal\n             %1 = [3.141592653589793238462643383]\n             ? vecsort([[2,3],[0,1],[0,3]], 2, 8)\n             %2 = [[0, 1], [2, 3]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1767vecsort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_cmpf = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecsort (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_cmpf,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmpf);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vecsort") < 0)) __PYX_ERR(4, 30482, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_cmpf = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30482, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vecsort", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30482, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1766vecsort(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_cmpf, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1766vecsort(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_cmpf, long __pyx_v_flag) {
  int __pyx_v__have_cmpf;
  GEN __pyx_v__x;
  GEN __pyx_v__cmpf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("vecsort", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_cmpf);

  /* "cypari/auto_instance.pxi":30568
 *              %2 = [[0, 1], [2, 3]]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30569
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 */
  __pyx_t_2 = (__pyx_v_cmpf != Py_None);
  __pyx_v__have_cmpf = __pyx_t_2;

  /* "cypari/auto_instance.pxi":30570
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30571
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cmpf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30571, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_cmpf, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":30570
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30572
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 30572, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30573
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":30574
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 */
  __pyx_v__cmpf = NULL;

  /* "cypari/auto_instance.pxi":30575
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 */
  __pyx_t_2 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30576
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cmpf)->__pyx_base.g;
    __pyx_v__cmpf = __pyx_t_4;

    /* "cypari/auto_instance.pxi":30575
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 */
  }

  /* "cypari/auto_instance.pxi":30577
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = vecsort0(__pyx_v__x, __pyx_v__cmpf, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":30578
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecsum(self, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30482
 *         return _ret
 * 
 *     def vecsort(self, x, cmpf=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the vector :math:`x` in ascending order, using a mergesort method.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_cmpf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30580
 *         return new_gen(_ret)
 * 
 *     def vecsum(self, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the sum of the components of the vector :math:`v`. Return :math:`0` on an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1769vecsum(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1768vecsum[] = "\n        Return the sum of the components of the vector :math:`v`. Return :math:`0` on an\n        empty vector.\n        \n        ::\n        \n            ? vecsum([1,2,3])\n            %1 = 6\n            ? vecsum([])\n            %2 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1769vecsum(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecsum (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1768vecsum(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1768vecsum(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_v) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("vecsum", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_instance.pxi":30592
 *             %2 = 0
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30593
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecsum(_v)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30593, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30594
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = vecsum(_v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30595
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecsum(_v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = vecsum(__pyx_v__v);

  /* "cypari/auto_instance.pxi":30596
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecsum(_v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def version(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30580
 *         return new_gen(_ret)
 * 
 *     def vecsum(self, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the sum of the components of the vector :math:`v`. Return :math:`0` on an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.vecsum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30598
 *         return new_gen(_ret)
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the current version number as a :literal:`t_VEC` with three integer
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1771version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1770version[] = "\n        Returns the current version number as a :literal:`t_VEC` with three integer\n        components (major version number, minor version number and patchlevel);\n        if your sources were obtained through our version control system, this will\n        be followed by further more precise arguments, including\n        e.g.\302\240a\302\240:literal:`git` :emphasis:`commit hash`.\n        \n        This function is present in all versions of PARI following releases 2.3.4\n        (stable) and 2.4.3 (testing).\n        \n        Unless you are working with multiple development versions, you probably only\n        care about the 3 first numeric components. In any case, the :literal:`lex` function\n        offers a clever way to check against a particular version number, since it will\n        compare each successive vector entry, numerically or as strings, and will not\n        mind if the vectors it compares have different lengths:\n        \n        ::\n        \n             if (lex(version(), [2,3,5]) >= 0,\n             \\\\ code to be executed if we are running 2.3.5 or more recent.\n             ,\n             \\\\ compatibility code\n             );\n        \n        On a number of different machines, :literal:`version()` could return either of\n        \n        ::\n        \n             %1 = [2, 3, 4] \\\\ released version, stable branch\n             %1 = [2, 4, 3] \\\\ released version, testing branch\n             %1 = [2, 6, 1, 15174, \"\"505ab9b\"] \\\\ development\n        \n        In particular, if you are only working with released versions, the first\n        line of the gp introductory message can be emulated by\n        \n        ::\n        \n             [M,m,p] = version();\n             printf(\"GP/PARI CALCULATOR Version %s.%s.%s\", M,m,p);\n        \n        If you :emphasis:`are` working with many development versions of\n        PARI/GP, the 4th and/or 5th components can be profitably included in the\n        name of your logfiles"", for instance.\n        \n        :strong:`Technical note.` For development versions obtained via :literal:`git`,\n        the 4th and 5th components are liable to change eventually, but we document\n        their current meaning for completeness. The 4th component counts the number\n        of reachable commits in the branch (analogous to :literal:`svn`'s revision\n        number), and the 5th is the :literal:`git` commit hash. In particular, :literal:`lex`\n        comparison still orders correctly development versions with respect to each\n        others or to released versions (provided we stay within a given branch,\n        e.g. :literal:`master`)!\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1771version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("version (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1770version(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1770version(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("version", 0);

  /* "cypari/auto_instance.pxi":30652
 *         e.g. :literal:`master`)!
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pari_version()
 *         return new_gen(_ret)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 30652, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30653
 *         '''
 *         sig_on()
 *         cdef GEN _ret = pari_version()             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pari_version();

  /* "cypari/auto_instance.pxi":30654
 *         sig_on()
 *         cdef GEN _ret = pari_version()
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def weber(self, x, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30598
 *         return new_gen(_ret)
 * 
 *     def version(self):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the current version number as a :literal:`t_VEC` with three integer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30656
 *         return new_gen(_ret)
 * 
 *     def weber(self, x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         One of Weber's three :math:`f` functions.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1773weber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1772weber[] = "\n        One of Weber's three :math:`f` functions.\n        If :math:`flag = 0`, returns\n        \n        .. MATH::\n        \n            f(x) = \\exp (-i\\pi/24).\\eta ((x+1)/2)/\\eta (x) {such that}\n            j = (f^{24}-16)^3/f^{24},\n        \n        where :math:`j` is the elliptic :math:`j`-invariant (see the function :literal:`ellj`).\n        If :math:`flag = 1`, returns\n        \n        .. MATH::\n        \n            f_1(x) = \\eta (x/2)/\\eta (x) {such that}\n            j = (f_1^{24}+16)^3/f_1^{24}.\n        \n        Finally, if :math:`flag = 2`, returns\n        \n        .. MATH::\n        \n            f_2(x) = \\sqrt{2}\\eta (2x)/\\eta (x) {such that}\n            j = (f_2^{24}+16)^3/f_2^{24}.\n        \n        Note the identities :math:`f^8 = f_1^8+f_2^8` and :math:`ff_1f_2 = \\sqrt2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1773weber(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("weber (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weber") < 0)) __PYX_ERR(4, 30656, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30656, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30656, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("weber", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30656, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.weber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1772weber(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1772weber(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("weber", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":30683
 *         Note the identities :math:`f^8 = f_1^8+f_2^8` and :math:`ff_1f_2 = \sqrt2`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30684
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30684, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30685
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = weber0(_x, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30686
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = weber0(_x, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":30687
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = weber0(_x, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = weber0(__pyx_v__x, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":30688
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = weber0(_x, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def writebin(self, filename, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30656
 *         return new_gen(_ret)
 * 
 *     def weber(self, x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         One of Weber's three :math:`f` functions.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.weber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30690
 *         return new_gen(_ret)
 * 
 *     def writebin(self, filename, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Writes (appends) to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1775writebin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1774writebin[] = "\n        Writes (appends) to\n        :emphasis:`filename` the object :math:`x` in binary format. This format is not human\n        readable, but contains the exact internal structure of :math:`x`, and is much\n        faster to save/load than a string expression, as would be produced by\n        :literal:`write`. The binary file format includes a magic number, so that such a\n        file can be recognized and correctly input by the regular :literal:`read` or :literal:`\\\\r`\n        function. If saved objects refer to polynomial variables that are not\n        defined in the new session, they will be displayed as :literal:`t:math:`n`` for some\n        integer :math:`n` (the attached variable number).\n        Installed functions and history objects can not be saved via this function.\n        \n        If :math:`x` is omitted, saves all user variables from the session, together with\n        their names. Reading such a \"named object\" back in a :literal:`gp` session will set\n        the corresponding user variable to the saved value. E.g after\n        \n        ::\n        \n            x = 1; writebin(\"log\")\n        \n        reading :literal:`log` into a clean session will set :literal:`x` to :math:`1`.\n        The relative variables priorities (see ``priority`` (in the PARI manual)) of new variables\n        set in this way remain the same (preset variables retain their former\n        priority, but are set to the new value). In particular, reading such a\n        session log into a clean session will restore all variables exactly as they\n        were in the original one.\n        \n        Just as a regular input file, a binary file can be compressed\n        using :literal:`gzip`, provided the file name has the standard :literal:`.gz`\n        extension.\n        \n        In the present implementation, the binary files are architecture dependent\n        and compatibility with future versions of :literal:`gp` is not guaranteed. Hence\n        bina""ry files should not be used for long term storage (also, they are\n        larger and harder to compress than text files).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1775writebin(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("writebin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_filename,&__pyx_n_s_x,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_filename)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "writebin") < 0)) __PYX_ERR(4, 30690, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_filename = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("writebin", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30690, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.writebin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1774writebin(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_filename, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1774writebin(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_x) {
  char *__pyx_v__filename;
  int __pyx_v__have_x;
  GEN __pyx_v__x;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("writebin", 0);
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":30727
 *         larger and harder to compress than text files).
 *         '''
 *         filename = to_bytes(filename)             # <<<<<<<<<<<<<<
 *         cdef char* _filename = <bytes>filename
 *         cdef bint _have_x = (x is not None)
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_to_bytes(__pyx_v_filename); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30728
 *         '''
 *         filename = to_bytes(filename)
 *         cdef char* _filename = <bytes>filename             # <<<<<<<<<<<<<<
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 */
  if (unlikely(__pyx_v_filename == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(4, 30728, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsWritableString(__pyx_v_filename); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(4, 30728, __pyx_L1_error)
  __pyx_v__filename = __pyx_t_2;

  /* "cypari/auto_instance.pxi":30729
 *         filename = to_bytes(filename)
 *         cdef char* _filename = <bytes>filename
 *         cdef bint _have_x = (x is not None)             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             x = objtogen(x)
 */
  __pyx_t_3 = (__pyx_v_x != Py_None);
  __pyx_v__have_x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30730
 *         cdef char* _filename = <bytes>filename
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_x != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":30731
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:
 *             x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = NULL
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":30730
 *         cdef char* _filename = <bytes>filename
 *         cdef bint _have_x = (x is not None)
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             x = objtogen(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30732
 *         if _have_x:
 *             x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = NULL
 *         if _have_x:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(4, 30732, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30733
 *             x = objtogen(x)
 *         sig_on()
 *         cdef GEN _x = NULL             # <<<<<<<<<<<<<<
 *         if _have_x:
 *             _x = (<Gen>x).g
 */
  __pyx_v__x = NULL;

  /* "cypari/auto_instance.pxi":30734
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         gpwritebin(_filename, _x)
 */
  __pyx_t_3 = (__pyx_v__have_x != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_instance.pxi":30735
 *         cdef GEN _x = NULL
 *         if _have_x:
 *             _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         gpwritebin(_filename, _x)
 *         clear_stack()
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
    __pyx_v__x = __pyx_t_5;

    /* "cypari/auto_instance.pxi":30734
 *         sig_on()
 *         cdef GEN _x = NULL
 *         if _have_x:             # <<<<<<<<<<<<<<
 *             _x = (<Gen>x).g
 *         gpwritebin(_filename, _x)
 */
  }

  /* "cypari/auto_instance.pxi":30736
 *         if _have_x:
 *             _x = (<Gen>x).g
 *         gpwritebin(_filename, _x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gpwritebin(__pyx_v__filename, __pyx_v__x);

  /* "cypari/auto_instance.pxi":30737
 *             _x = (<Gen>x).g
 *         gpwritebin(_filename, _x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def zeta(self, s, long precision=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":30690
 *         return new_gen(_ret)
 * 
 *     def writebin(self, filename, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Writes (appends) to
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.writebin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30739
 *         clear_stack()
 * 
 *     def zeta(self, s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s != 1` a complex number, Riemann's zeta
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1777zeta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1776zeta[] = "\n        For :math:`s != 1` a complex number, Riemann's zeta\n        function :math:`\\zeta (s) = \\sum_{n >= 1}n^{-s}`,\n        computed using the Euler-Maclaurin summation formula, except\n        when :math:`s` is of type integer, in which case it is computed using\n        Bernoulli numbers for :math:`s <= 0` or :math:`s > 0` and\n        even, and using modular forms for :math:`s > 0` and odd. Power series\n        are also allowed:\n        \n        ::\n        \n            ? zeta(2) - Pi^2/6\n            %1 = 0.E-38\n            ? zeta(1+x+O(x^3))\n            %2 = 1.0000000000000000000000000000000000000*x^-1 + \\\n             0.57721566490153286060651209008240243104 + O(x)\n        \n        For :math:`s != 1` a :math:`p`-adic number, Kubota-Leopoldt zeta function at :math:`s`, that\n        is the unique continuous :math:`p`-adic function on the :math:`p`-adic integers\n        that interpolates the values of :math:`(1 - p^{-k}) \\zeta (k)` at negative\n        integers :math:`k` such that :math:`k = 1 (mod p-1)` (resp. :math:`k` is odd) if\n        :math:`p` is odd (resp. :math:`p = 2`). Power series are not allowed in this case.\n        \n        ::\n        \n            ? zeta(-3+O(5^10))\n            %1 = 4*5^-1 + 4 + 3*5 + 4*5^3 + 4*5^5 + 4*5^7 + O(5^9)))))\n            ? (1-5^3) * zeta(-3)\n            %2 = -1.0333333333333333333333333333333333333\n            ? bestappr(%)\n            %3 = -31/30\n            ? zeta(-3+O(5^10)) - (-31/30)\n            %4 = O(5^9)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1777zeta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zeta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_precision,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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zeta") < 0)) __PYX_ERR(4, 30739, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30739, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zeta", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30739, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1776zeta(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1776zeta(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zeta", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_instance.pxi":30774
 *             %4 = O(5^9)
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30775
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30775, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30776
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gzeta(_s, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30777
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gzeta(_s, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":30778
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gzeta(_s, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gzeta(__pyx_v__s, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":30779
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gzeta(_s, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetahurwitz(self, s, x, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30739
 *         clear_stack()
 * 
 *     def zeta(self, s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s != 1` a complex number, Riemann's zeta
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30781
 *         return new_gen(_ret)
 * 
 *     def zetahurwitz(self, s, x, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz zeta function :math:`\zeta (s,x) = \sum_{n >= 0}(n+x)^{-s}` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1779zetahurwitz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1778zetahurwitz[] = "\n        Hurwitz zeta function :math:`\\zeta (s,x) = \\sum_{n >= 0}(n+x)^{-s}` and\n        analytically continued, with :math:`s != 1` and :math:`x` not a negative or zero\n        integer. Note that :math:`\\zeta (s,1) = \\zeta (s)`. :math:`s` can also be a polynomial,\n        rational function, or power series. If :literal:`der` is positive, compute the\n        :literal:`der`'th derivative with respect to :math:`s`. Note that the derivative\n        with respect to :math:`x` is simply :math:`-s\\zeta (s+1,x)`.\n        \n        ::\n        \n            ? zetahurwitz(Pi,Pi)\n            %1 = 0.056155444497585099925180502385781494484\n            ? zetahurwitz(2,1) - zeta(2)\n            %2 = -2.350988701644575016 E-38\n            ? zetahurwitz(Pi,3) - (zeta(Pi)-1-1/2^Pi)\n            %3 = -2.2040519077917890774 E-39\n            ? zetahurwitz(-7/2,1) - zeta(-7/2)\n            %4 = -2.295887403949780289 E-41\n            ? zetahurwitz(-2.3,Pi+I*log(2))\n            %5 = -5.1928369229555125820137832704455696057\\\n             - 6.1349660138824147237884128986232049582*I\n            ? zetahurwitz(-1+x^2+O(x^3),1)\n            %6 = -0.083333333333333333333333333333333333333\\\n             - 0.16542114370045092921391966024278064276*x^2 + O(x^3)\n            ? zetahurwitz(1+x+O(x^4),2)\n            %7 = 1.0000000000000000000000000000000000000*x^-1\\\n             - 0.42278433509846713939348790991759756896\\\n             + 0.072815845483676724860586375874901319138*x + O(x^2)\n            ? zetahurwitz(2,1,2) \\\\ zeta''(2)\n            %8 = 1.9892802342989010234208586874215163815\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1779zetahurwitz(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetahurwitz (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_x,&__pyx_n_s_der,&__pyx_n_s_precision,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_s)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zetahurwitz", 0, 2, 4, 1); __PYX_ERR(4, 30781, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetahurwitz") < 0)) __PYX_ERR(4, 30781, __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);
        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_s = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30781, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30781, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetahurwitz", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30781, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetahurwitz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1778zetahurwitz(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_x, __pyx_v_der, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1778zetahurwitz(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_der, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("zetahurwitz", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_instance.pxi":30813
 *             %8 = 1.9892802342989010234208586874215163815
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30814
 *         '''
 *         s = objtogen(s)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30815
 *         s = objtogen(s)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30815, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30816
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30817
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30818
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_instance.pxi":30819
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":30818
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 */
  }

  /* "cypari/auto_instance.pxi":30820
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetahurwitz(__pyx_v__s, __pyx_v__x, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":30821
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetamult(self, s, T=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30821, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30781
 *         return new_gen(_ret)
 * 
 *     def zetahurwitz(self, s, x, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz zeta function :math:`\zeta (s,x) = \sum_{n >= 0}(n+x)^{-s}` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetahurwitz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30823
 *         return new_gen(_ret)
 * 
 *     def zetamult(self, s, T=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a vector of positive integers such that :math:`s[1] >= 2`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1781zetamult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1780zetamult[] = "\n        For :math:`s` a vector of positive integers such that :math:`s[1] >= 2`,\n        returns the multiple zeta value (MZV)\n        \n        .. MATH::\n        \n            \\zeta (s_1,..., s_k) = \\sum_{n_1 > ... > n_k > 0} n_1^{-s_1}...n_k^{-s_k}.\n        \n        ::\n        \n            ? zetamult([2,1]) - zeta(3) \\\\ Euler's identity\n            %1 = 0.E-38\n        \n        If the bit precision is :math:`B`, this function runs in time :math:`~{O}(k B^2)`.\n        \n        If :math:`T` is provided, it must be the output of :literal:`zetamultinit`:math:`(w)` for\n        some :math:`w >= s_1 +...+ s_k` and will provide a small speed up,\n        usually about 10\\%.\n        \n        ::\n        \n            ? T = zetamultinit(20); s = [2,1,1,1,1,1,1,1,1];\n            ? for(i=1,10^3, zetamult(s))\n            time = 373 ms.\n            ? for(i=1,10^3, zetamult(s, T)) \\\\ faster\n            time = 279 ms.\n            ? zetamult(vector(10,i,2), T)\n            %4 = 1.7165384749821433018378232207719985786 E-10\n            ? zetamult(vector(11,i,2), T) \\\\ overshoot\n             *** at top-level: zetamult(vector(11,i\n             *** ^--------------------\n             *** zetamult: domain error in zetamult: weight > 20\n        \n        In addition to the above format (:literal:`avec`), the function\n        also accepts an internal binary format :literal:`evec` (each :math:`s_i` is replaced\n        by :math:`s_i` bits, all of them 0 but the last one), and an :literal:`index` format\n        (if :math:`e` is the positive integer attached the :literal:`evec` vector of\n        bits, the index is the integer :math:`e + 2^{k-2}`). The function\n        :literal:`zetamultconvert` allows to pass from one format to the other; the\n        function :literal:`zetamultall` computes simultaneously all MZVs of weight\n        :math:`\\sum_{i <= k} s_i` up to :math:`n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1781zetamult(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_T = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetamult (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_T,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_T);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetamult") < 0)) __PYX_ERR(4, 30823, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_T = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30823, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetamult", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30823, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1780zetamult(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_s, __pyx_v_T, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1780zetamult(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_s, PyObject *__pyx_v_T, long __pyx_v_precision) {
  int __pyx_v__have_T;
  GEN __pyx_v__s;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("zetamult", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_instance.pxi":30866
 *         :math:`\sum_{i <= k} s_i` up to :math:`n`.
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef bint _have_T = (T is not None)
 *         if _have_T:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30867
 *         '''
 *         s = objtogen(s)
 *         cdef bint _have_T = (T is not None)             # <<<<<<<<<<<<<<
 *         if _have_T:
 *             T = objtogen(T)
 */
  __pyx_t_2 = (__pyx_v_T != Py_None);
  __pyx_v__have_T = __pyx_t_2;

  /* "cypari/auto_instance.pxi":30868
 *         s = objtogen(s)
 *         cdef bint _have_T = (T is not None)
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_T != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30869
 *         cdef bint _have_T = (T is not None)
 *         if _have_T:
 *             T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30869, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":30868
 *         s = objtogen(s)
 *         cdef bint _have_T = (T is not None)
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             T = objtogen(T)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":30870
 *         if _have_T:
 *             T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 30870, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30871
 *             T = objtogen(T)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = NULL
 *         if _have_T:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_4;

  /* "cypari/auto_instance.pxi":30872
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL             # <<<<<<<<<<<<<<
 *         if _have_T:
 *             _T = (<Gen>T).g
 */
  __pyx_v__T = NULL;

  /* "cypari/auto_instance.pxi":30873
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_T != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":30874
 *         cdef GEN _T = NULL
 *         if _have_T:
 *             _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamult0(_s, _T, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
    __pyx_v__T = __pyx_t_4;

    /* "cypari/auto_instance.pxi":30873
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_instance.pxi":30875
 *         if _have_T:
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetamult0(_s, _T, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":30876
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamult0(_s, _T, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetamult0(__pyx_v__s, __pyx_v__T, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":30877
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamult0(_s, _T, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetamultall(self, long n, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30823
 *         return new_gen(_ret)
 * 
 *     def zetamult(self, s, T=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a vector of positive integers such that :math:`s[1] >= 2`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30879
 *         return new_gen(_ret)
 * 
 *     def zetamultall(self, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of all multiple zeta values for weight :math:`s_1 +...+ s_k` up to :math:`n`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1783zetamultall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1782zetamultall[] = "\n        List of all multiple zeta values for weight :math:`s_1 +...+ s_k` up to :math:`n`.\n        The function returns a vector with :math:`2^{n-1}-1` components whose :math:`i`-th entry\n        is the MZV of :literal:`index` :math:`i` (see :literal:`zetamult`).\n        \n        ::\n        \n            ? z = zetamultall(5);\n            ? z[10]\n            %2 = 0.22881039760335375976874614894168879193\n            ? zetamultconvert(10) \\\\ convert index 10 to avec\n            %3 = Vecsmall([3, 2])\n            ? zetamult(%)\n            %4 = 0.22881039760335375976874614894168879193\n            ? zetamult(10)\n            %5 = 0.22881039760335375976874614894168879193\n        \n        If the bit precision is :math:`B`, this function runs in time\n        :math:`O(2^n n B^2)` for an output of size :math:`O(2^n B)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1783zetamultall(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetamultall (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_precision,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetamultall") < 0)) __PYX_ERR(4, 30879, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30879, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30879, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetamultall", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30879, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamultall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1782zetamultall(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1782zetamultall(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_n, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("zetamultall", 0);

  /* "cypari/auto_instance.pxi":30900
 *         :math:`O(2^n n B^2)` for an output of size :math:`O(2^n B)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamultall(n, precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 30900, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30901
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetamultall(n, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":30902
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamultall(n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetamultall(__pyx_v_n, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":30903
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamultall(n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetamultconvert(self, a, long fl=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30879
 *         return new_gen(_ret)
 * 
 *     def zetamultall(self, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of all multiple zeta values for weight :math:`s_1 +...+ s_k` up to :math:`n`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamultall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30905
 *         return new_gen(_ret)
 * 
 *     def zetamultconvert(self, a, long fl=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`a` being either an :literal:`evec`, :literal:`avec`, or index :literal:`m`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1785zetamultconvert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1784zetamultconvert[] = "\n        :literal:`a` being either an :literal:`evec`, :literal:`avec`, or index :literal:`m`,\n        converts into :literal:`evec` (:literal:`fl = 0`), :literal:`avec` (:literal:`fl = 1`, default), or\n        index :literal:`m` (:literal:`fl = 2`); see :literal:`zetamult` for explanations.\n        \n        ::\n        \n            ? zetamultconvert(10)\n            %1 = Vecsmall([3, 2])\n            ? zetamultconvert(13)\n            %2 = Vecsmall([2, 2, 1])\n            ? zetamultconvert(10, 0)\n            %3 = Vecsmall([0, 0, 1, 0, 1])\n            ? zetamultconvert(13, 0)\n            %4 = Vecsmall([0, 1, 0, 1, 1])\n        \n        The last two lines imply that :math:`[3,2]` and :math:`[2,2,1]`\n        are dual (reverse order of bits and swap :math:`0` and :math:`1` in :literal:`evec` form).\n        Hence they have the same zeta value:\n        \n        ::\n        \n            ? zetamult([3,2])\n            %5 = 0.22881039760335375976874614894168879193\n            ? zetamult([2,2,1])\n            %6 = 0.22881039760335375976874614894168879193\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1785zetamultconvert(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  long __pyx_v_fl;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetamultconvert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_fl,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_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetamultconvert") < 0)) __PYX_ERR(4, 30905, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_a = values[0];
    if (values[1]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30905, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetamultconvert", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30905, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamultconvert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1784zetamultconvert(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_a, __pyx_v_fl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1784zetamultconvert(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_a, long __pyx_v_fl) {
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zetamultconvert", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":30933
 *             %6 = 0.22881039760335375976874614894168879193
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":30934
 *         '''
 *         a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = zetamultconvert(_a, fl)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 30934, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30935
 *         a = objtogen(a)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetamultconvert(_a, fl)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_instance.pxi":30936
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = zetamultconvert(_a, fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetamultconvert(__pyx_v__a, __pyx_v_fl);

  /* "cypari/auto_instance.pxi":30937
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = zetamultconvert(_a, fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetamultinit(self, long maxw, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 30937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30905
 *         return new_gen(_ret)
 * 
 *     def zetamultconvert(self, a, long fl=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`a` being either an :literal:`evec`, :literal:`avec`, or index :literal:`m`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamultconvert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30939
 *         return new_gen(_ret)
 * 
 *     def zetamultinit(self, long maxw, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data (depending on the precision) used to compute
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1787zetamultinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1786zetamultinit[] = "\n        Initialize data (depending on the precision) used to compute\n        multiple zeta values at\n        integral points :math:`s = [s_1,...,s_k]` for any :math:`s_1 +...+ s_k \\leq\n        maxw`. The corresponding data is inexpensive to compute or store\n        and provides a small speedup (usually about 10\\%) when multiple values are to\n        be computed at a given accuracy.\n        \n        ::\n        \n            ? for(i = 1, 2^12-1, zetamult(i))\n            time = 1,413 ms\n            ? T = zetamultinit(13); \\\\ instantaneous\n            ? for(i = 1, 2^12-1, zetamult(i, T)) \\\\ used cached data\n            time = 1,315 ms\n            ? zetamultall(12); \\\\ much faster !\n            time = 27 ms\n            \n            ? T=zetamultinit(102); sizebyte(T) \\\\ small even for huge weights\n            time = 5 ms.\n            %5 = 1440504\n            ? for(i = 1, 2^5, zetamult(2^100+i))\n            time = 633 ms.\n            ? for(i = 1, 2^5, zetamult(2^100+i, T))\n            time = 550 ms.\n        \n        For small weights, :literal:`zetamultall` will be much more efficient; but it\n        is not an option when the weight gets large.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1787zetamultinit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_maxw;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetamultinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maxw,&__pyx_n_s_precision,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_maxw)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetamultinit") < 0)) __PYX_ERR(4, 30939, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_maxw = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_maxw == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30939, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 30939, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetamultinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 30939, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamultinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1786zetamultinit(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_maxw, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1786zetamultinit(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, long __pyx_v_maxw, long __pyx_v_precision) {
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("zetamultinit", 0);

  /* "cypari/auto_instance.pxi":30969
 *         is not an option when the weight gets large.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamultinit(maxw, precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(4, 30969, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":30970
 *         '''
 *         sig_on()
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetamultinit(maxw, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_instance.pxi":30971
 *         sig_on()
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamultinit(maxw, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetamultinit(__pyx_v_maxw, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":30972
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamultinit(maxw, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchar(self, D):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 30972, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30939
 *         return new_gen(_ret)
 * 
 *     def zetamultinit(self, long maxw, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data (depending on the precision) used to compute
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zetamultinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":30974
 *         return new_gen(_ret)
 * 
 *     def znchar(self, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a datum :math:`D` describing a group :math:`(\mathbb{Z}/N\mathbb{Z})^*` and a Dirichlet
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1789znchar(PyObject *__pyx_v_self, PyObject *__pyx_v_D); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1788znchar[] = "\n        Given a datum :math:`D` describing a group :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` and a Dirichlet\n        character :math:`\\chi`, return the pair :literal:`[G, chi]`, where :literal:`G` is\n        :literal:`znstar(N, 1)`) and :literal:`chi` is a GP character.\n        \n        The following possibilities for :math:`D` are supported\n        \n        - a non-zero :literal:`t_INT` congruent to :math:`0,1` modulo :math:`4`, return the real\n          character modulo :math:`D` given by the Kronecker symbol :math:`(D/.)`;\n        \n        - a :literal:`t_INTMOD` :literal:`Mod(m, N)`, return the Conrey character\n          modulo :math:`N` of index :math:`m` (see :literal:`znconreylog`).\n        \n        - a modular form space as per :literal:`mfinit`:math:`([N,k,\\chi])` or a modular\n          form for such a space, return the underlying Dirichlet character :math:`\\chi`\n          (which may be defined modulo a divisor of :math:`N` but need not be primitive).\n        \n        In the remaining cases, :literal:`G` is initialized by :literal:`znstar(N, 1)`.\n        \n        - a pair :literal:`[G, chi]`, where :literal:`chi` is a standard GP Dirichlet\n          character :math:`c = (c_j)` on :literal:`G` (generic character :literal:`t_VEC` or\n          Conrey characters :literal:`t_COL` or :literal:`t_INT`); given\n          generators :math:`G = \\oplus (\\mathbb{Z}/d_j\\mathbb{Z}) g_j`, :math:`\\chi (g_j) = e(c_j/d_j)`.\n        \n        - a pair :literal:`[G, chin]`, where :literal:`chin` is a :emphasis:`normalized`\n          representation :math:`[n, ~{c}]` of the Dirichlet character :math:`c`; :math:`\\chi (g_j)\n          = e(~{c}_j / n)` where :math:`n` is minimal (order of :math:`\\chi`).\n        \n        ::\n        \n            ? [G,chi] = znchar(-3);\n            ? G.cyc\n            %2 = [2]\n            ? chareval(G, chi, 2)\n            %3 = 1/2\n            ? kronecker(-3,2)\n            %4 = -1\n            ? znchartokronecker(G"",chi)\n            %5 = -3\n            ? mf = mfinit([28, 5/2, Mod(2,7)]); [f] = mfbasis(mf);\n            ? [G,chi] = znchar(mf); [G.mod, chi]\n            %7 = [7, [2]~]\n            ? [G,chi] = znchar(f); chi\n            %8 = [28, [0, 2]~]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1789znchar(PyObject *__pyx_v_self, PyObject *__pyx_v_D) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchar (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1788znchar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_D));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1788znchar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_D) {
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znchar", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_instance.pxi":31020
 *             %8 = [28, [0, 2]~]
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31021
 *         '''
 *         D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = znchar(_D)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31021, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31022
 *         D = objtogen(D)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchar(_D)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31023
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = znchar(_D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchar(__pyx_v__D);

  /* "cypari/auto_instance.pxi":31024
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = znchar(_D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncharconductor(self, G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":30974
 *         return new_gen(_ret)
 * 
 *     def znchar(self, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a datum :math:`D` describing a group :math:`(\mathbb{Z}/N\mathbb{Z})^*` and a Dirichlet
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31026
 *         return new_gen(_ret)
 * 
 *     def zncharconductor(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1791zncharconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1790zncharconductor[] = "\n        Let :emphasis:`G` be attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q, 1)`) and :literal:`chi` be a Dirichlet character on\n        :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`).\n        Return the conductor of :literal:`chi`:\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? zncharconductor(G,11) \\\\ primitive\n            %2 = 126000\n            ? zncharconductor(G,1) \\\\ trivial character, not primitive!\n            %3 = 1\n            ? zncharconductor(G,1009) \\\\ character mod 5^3\n            %4 = 125\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1791zncharconductor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncharconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,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_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncharconductor", 1, 2, 2, 1); __PYX_ERR(4, 31026, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zncharconductor") < 0)) __PYX_ERR(4, 31026, __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_G = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zncharconductor", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31026, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncharconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1790zncharconductor(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1790zncharconductor(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zncharconductor", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":31043
 *             %4 = 125
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31044
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31045
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31045, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31046
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = zncharconductor(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31047
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zncharconductor(_G, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31048
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = zncharconductor(_G, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zncharconductor(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":31049
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = zncharconductor(_G, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchardecompose(self, G, chi, Q):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31026
 *         return new_gen(_ret)
 * 
 *     def zncharconductor(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncharconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31051
 *         return new_gen(_ret)
 * 
 *     def znchardecompose(self, G, chi, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`N = \prod_p p^{e_p}` and a Dirichlet character :math:`\chi`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1793znchardecompose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1792znchardecompose[] = "\n        Let :math:`N = \\prod_p p^{e_p}` and a Dirichlet character :math:`\\chi`,\n        we have a decomposition :math:`\\chi = \\prod_p \\chi_p` into character modulo :math:`N`\n        where the conductor of :math:`\\chi_p` divides :math:`p^{e_p}`; it equals :math:`p^{e_p}` for\n        all :math:`p` if and only if :math:`\\chi` is primitive.\n        \n        Given a :emphasis:`znstar` G describing a group :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, a Dirichlet\n        character :literal:`chi` and an integer :math:`Q`, return :math:`\\prod_{p \\| (Q,N)} \\chi_p`.\n        For instance, if :math:`Q = p` is a prime divisor of :math:`N`, the function returns\n        :math:`\\chi_p` (as a character modulo :math:`N`), given as a Conrey character (:literal:`t_COL`).\n        \n        ::\n        \n            ? G = znstar(40, 1);\n            ? G.cyc\n            %2 = [4, 2, 2]\n            ? chi = [2, 1, 1];\n            ? chi2 = znchardecompose(G, chi, 2)\n            %4 = [1, 1, 0]~\n            ? chi5 = znchardecompose(G, chi, 5)\n            %5 = [0, 0, 2]~\n            ? znchardecompose(G, chi, 3)\n            %6 = [0, 0, 0]~\n            ? c = charmul(G, chi2, chi5)\n            %7 = [1, 1, 2]~ \\\\ t_COL: in terms of Conrey generators !\n            ? znconreychar(G,c)\n            %8 = [2, 1, 1] \\\\ t_VEC: in terms of SNF generators\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1793znchardecompose(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchardecompose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,&__pyx_n_s_Q,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znchardecompose", 1, 3, 3, 1); __PYX_ERR(4, 31051, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znchardecompose", 1, 3, 3, 2); __PYX_ERR(4, 31051, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znchardecompose") < 0)) __PYX_ERR(4, 31051, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_G = values[0];
    __pyx_v_chi = values[1];
    __pyx_v_Q = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znchardecompose", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31051, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchardecompose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1792znchardecompose(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi, __pyx_v_Q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1792znchardecompose(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_Q) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znchardecompose", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_instance.pxi":31080
 *             %8 = [2, 1, 1] \\ t_VEC: in terms of SNF generators
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         Q = objtogen(Q)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31081
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31082
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31083
 *         chi = objtogen(chi)
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31083, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31084
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31085
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31086
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31087
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchardecompose(__pyx_v__G, __pyx_v__chi, __pyx_v__Q);

  /* "cypari/auto_instance.pxi":31088
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchargauss(self, G, chi, a=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31051
 *         return new_gen(_ret)
 * 
 *     def znchardecompose(self, G, chi, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`N = \prod_p p^{e_p}` and a Dirichlet character :math:`\chi`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchardecompose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31090
 *         return new_gen(_ret)
 * 
 *     def znchargauss(self, G, chi, a=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a Dirichlet character :math:`\chi` on :math:`G = (\mathbb{Z}/N\mathbb{Z})^*` (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1795znchargauss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1794znchargauss[] = "\n        Given a Dirichlet character :math:`\\chi` on :math:`G = (\\mathbb{Z}/N\\mathbb{Z})^*` (see\n        :literal:`znchar`), return the complex Gauss sum\n        \n        .. MATH::\n        \n            g(\\chi,a) = \\sum_{n = 1}^N \\chi (n) e(a n/N)\n        \n        ::\n        \n            ? [G,chi] = znchar(-3); \\\\ quadratic Gauss sum: I*sqrt(3)\n            ? znchargauss(G,chi)\n            %2 = 1.7320508075688772935274463415058723670*I\n            ? [G,chi] = znchar(5);\n            ? znchargauss(G,chi) \\\\ sqrt(5)\n            %2 = 2.2360679774997896964091736687312762354\n            ? G = znstar(300,1); chi = [1,1,12]~;\n            ? znchargauss(G,chi) / sqrt(300) - exp(2*I*Pi*11/25) \\\\ = 0\n            %4 = 2.350988701644575016 E-38 + 1.4693679385278593850 E-39*I\n            ? lfuntheta([G,chi], 1) \\\\ = 0\n            %5 = -5.79[...] E-39 - 2.71[...] E-40*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1795znchargauss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_a = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchargauss (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znchargauss", 0, 2, 4, 1); __PYX_ERR(4, 31090, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znchargauss") < 0)) __PYX_ERR(4, 31090, __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);
        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_G = values[0];
    __pyx_v_chi = values[1];
    __pyx_v_a = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 31090, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znchargauss", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31090, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchargauss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1794znchargauss(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1794znchargauss(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_a, long __pyx_v_precision) {
  int __pyx_v__have_a;
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("znchargauss", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_instance.pxi":31113
 *             %5 = -5.79[...] E-39 - 2.71[...] E-40*I
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         cdef bint _have_a = (a is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31114
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31115
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_2 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_2;

  /* "cypari/auto_instance.pxi":31116
 *         chi = objtogen(chi)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31117
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":31116
 *         chi = objtogen(chi)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":31118
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 31118, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31119
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31120
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31121
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_instance.pxi":31122
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31123
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_instance.pxi":31122
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         if not precision:
 */
  }

  /* "cypari/auto_instance.pxi":31124
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31125
 *             _a = (<Gen>a).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_instance.pxi":31124
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 */
  }

  /* "cypari/auto_instance.pxi":31126
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchargauss(__pyx_v__G, __pyx_v__chi, __pyx_v__a, __pyx_v_precision);

  /* "cypari/auto_instance.pxi":31127
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncharinduce(self, G, chi, N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31090
 *         return new_gen(_ret)
 * 
 *     def znchargauss(self, G, chi, a=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a Dirichlet character :math:`\chi` on :math:`G = (\mathbb{Z}/N\mathbb{Z})^*` (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchargauss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31129
 *         return new_gen(_ret)
 * 
 *     def zncharinduce(self, G, chi, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per :literal:`G = znstar(q,1)`)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1797zncharinduce(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1796zncharinduce[] = "\n        Let :math:`G` be attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per :literal:`G = znstar(q,1)`)\n        and let :literal:`chi` be a Dirichlet character on :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`, given by\n        \n        - a :literal:`t_VEC`: a standard character on :literal:`bid.gen`,\n        \n        - a :literal:`t_INT` or a :literal:`t_COL`: a Conrey index in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` or its\n          Conrey logarithm;\n          see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        Let :math:`N` be a multiple of :math:`q`, return the character modulo :math:`N` extending\n        :literal:`chi`. As usual for arithmetic functions, the new modulus :math:`N` can be\n        given as a :literal:`t_INT`, via a factorization matrix or a pair\n        :literal:`[N, factor(N)]`, or by :literal:`znstar(N,1)`.\n        \n        ::\n        \n            ? G = znstar(4, 1);\n            ? chi = znconreylog(G,1); \\\\ trivial character mod 4\n            ? zncharinduce(G, chi, 80) \\\\ now mod 80\n            %3 = [0, 0, 0]~\n            ? zncharinduce(G, 1, 80) \\\\ same using directly Conrey label\n            %4 = [0, 0, 0]~\n            ? G2 = znstar(80, 1);\n            ? zncharinduce(G, 1, G2) \\\\ same\n            %4 = [0, 0, 0]~\n            \n            ? chi = zncharinduce(G, 3, G2) \\\\ extend the non-trivial character mod 4\n            %5 = [1, 0, 0]~\n            ? [G0,chi0] = znchartoprimitive(G2, chi);\n            ? G0.mod\n            %7 = 4\n            ? chi0\n            %8 = [1]~\n        \n        Here is a larger example:\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? label = 1009;\n            ? chi = znconreylog(G, label)\n            %3 = [0, 0, 0, 14, 0]~\n            ? [G0,chi0] = znchartoprimitive(G, label); \\\\ works also with 'chi'\n            ? G0.mod\n            %5 = 125\n            ? chi0 \\\\ primitive character mod 5^3 att""ached to chi\n            %6 = [14]~\n            ? G0 = znstar(N0, 1);\n            ? zncharinduce(G0, chi0, G) \\\\ induce back\n            %8 = [0, 0, 0, 14, 0]~\n            ? znconreyexp(G, %)\n            %9 = 1009\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1797zncharinduce(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncharinduce (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,&__pyx_n_s_N,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncharinduce", 1, 3, 3, 1); __PYX_ERR(4, 31129, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncharinduce", 1, 3, 3, 2); __PYX_ERR(4, 31129, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zncharinduce") < 0)) __PYX_ERR(4, 31129, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_G = values[0];
    __pyx_v_chi = values[1];
    __pyx_v_N = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zncharinduce", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31129, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncharinduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1796zncharinduce(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi, __pyx_v_N);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1796zncharinduce(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_N) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zncharinduce", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_instance.pxi":31184
 *             %9 = 1009
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         N = objtogen(N)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31185
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         N = objtogen(N)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31186
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31187
 *         chi = objtogen(chi)
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31187, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31188
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31189
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31190
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31191
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zncharinduce(__pyx_v__G, __pyx_v__chi, __pyx_v__N);

  /* "cypari/auto_instance.pxi":31192
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncharisodd(self, G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31129
 *         return new_gen(_ret)
 * 
 *     def zncharinduce(self, G, chi, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per :literal:`G = znstar(q,1)`)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncharinduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31194
 *         return new_gen(_ret)
 * 
 *     def zncharisodd(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1799zncharisodd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1798zncharisodd[] = "\n        Let :math:`G` be attached to :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)\n        and let :literal:`chi` be a Dirichlet character on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, given by\n        \n        - a :literal:`t_VEC`: a standard character on :literal:`G.gen`,\n        \n        - a :literal:`t_INT` or a :literal:`t_COL`: a Conrey index in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` or its\n          Conrey logarithm;\n          see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        Return :math:`1` if and only if :literal:`chi`:math:`(-1) = -1` and :math:`0` otherwise.\n        \n        ::\n        \n            ? G = znstar(8, 1);\n            ? zncharisodd(G, 1) \\\\ trivial character\n            %2 = 0\n            ? zncharisodd(G, 3)\n            %3 = 1\n            ? chareval(G, 3, -1)\n            %4 = 1/2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1799zncharisodd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncharisodd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,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_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncharisodd", 1, 2, 2, 1); __PYX_ERR(4, 31194, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zncharisodd") < 0)) __PYX_ERR(4, 31194, __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_G = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zncharisodd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31194, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncharisodd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1798zncharisodd(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1798zncharisodd(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zncharisodd", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":31217
 *             %4 = 1/2
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31218
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31219
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31219, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31220
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef long _ret = zncharisodd(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31221
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = zncharisodd(_G, _chi)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31222
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef long _ret = zncharisodd(_G, _chi)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = zncharisodd(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":31223
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef long _ret = zncharisodd(_G, _chi)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_instance.pxi":31224
 *         cdef long _ret = zncharisodd(_G, _chi)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def znchartokronecker(self, G, chi, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31194
 *         return new_gen(_ret)
 * 
 *     def zncharisodd(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncharisodd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31226
 *         return _ret
 * 
 *     def znchartokronecker(self, G, chi, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1801znchartokronecker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1800znchartokronecker[] = "\n        Let :math:`G` be attached to :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)\n        and let :literal:`chi` be a Dirichlet character on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, given by\n        \n        - a :literal:`t_VEC`: a standard character on :literal:`bid.gen`,\n        \n        - a :literal:`t_INT` or a :literal:`t_COL`: a Conrey index in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` or its\n          Conrey logarithm;\n          see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        If :math:`flag = 0`, return the discriminant :math:`D` if :literal:`chi` is real equal to the\n        Kronecker symbol :math:`(D/.)` and :math:`0` otherwise. The discriminant :math:`D` is\n        fundamental if and only if :literal:`chi` is primitive.\n        \n        If :math:`flag = 1`, return the fundamental discriminant attached to the\n        corresponding primitive character.\n        \n        ::\n        \n            ? G = znstar(8,1); CHARS = [1,3,5,7]; \\\\ Conrey labels\n            ? apply(t->znchartokronecker(G,t), CHARS)\n            %2 = [4, -8, 8, -4]\n            ? apply(t->znchartokronecker(G,t,1), CHARS)\n            %3 = [1, -8, 8, -4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1801znchartokronecker(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchartokronecker (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znchartokronecker", 0, 2, 3, 1); __PYX_ERR(4, 31226, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znchartokronecker") < 0)) __PYX_ERR(4, 31226, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_G = values[0];
    __pyx_v_chi = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 31226, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znchartokronecker", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31226, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchartokronecker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1800znchartokronecker(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1800znchartokronecker(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi, long __pyx_v_flag) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znchartokronecker", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":31252
 *             %3 = [1, -8, 8, -4]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31253
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31254
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31254, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31255
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31256
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31257
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchartokronecker(__pyx_v__G, __pyx_v__chi, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":31258
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchartoprimitive(self, G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31226
 *         return _ret
 * 
 *     def znchartokronecker(self, G, chi, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchartokronecker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31260
 *         return new_gen(_ret)
 * 
 *     def znchartoprimitive(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1803znchartoprimitive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1802znchartoprimitive[] = "\n        Let :emphasis:`G` be attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q, 1)`) and :literal:`chi` be a Dirichlet character on\n        :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`, of conductor :math:`q_0 \\| q`.\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? [G0,chi0] = znchartoprimitive(G,11)\n            ? G0.mod\n            %3 = 126000\n            ? chi0\n            %4 = 11\n            ? [G0,chi0] = znchartoprimitive(G,1);\\\\ trivial character, not primitive!\n            ? G0.mod\n            %6 = 1\n            ? chi0\n            %7 = []~\n            ? [G0,chi0] = znchartoprimitive(G,1009)\n            ? G0.mod\n            %4 = 125\n            ? chi0\n            %5 = [14]~\n        \n        Note that :literal:`znconreyconductor` is more efficient since\n        it can return :math:`\\chi_0` and its conductor :math:`q_0` without needing to initialize\n        :math:`G_0`. (The price to pay is a more cryptic format and the need to\n        initalize :math:`G_0` later but the can be done once for all characters\n        of conductor :math:`q_0`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1803znchartoprimitive(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchartoprimitive (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,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_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znchartoprimitive", 1, 2, 2, 1); __PYX_ERR(4, 31260, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znchartoprimitive") < 0)) __PYX_ERR(4, 31260, __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_G = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znchartoprimitive", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31260, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchartoprimitive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1802znchartoprimitive(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1802znchartoprimitive(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znchartoprimitive", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":31291
 *         of conductor :math:`q_0`.)
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31292
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31293
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31293, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31294
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31295
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31296
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchartoprimitive(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":31297
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znconreychar(self, G, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31260
 *         return new_gen(_ret)
 * 
 *     def znchartoprimitive(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znchartoprimitive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31299
 *         return new_gen(_ret)
 * 
 *     def znconreychar(self, G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1805znconreychar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1804znconreychar[] = "\n        Given a :emphasis:`znstar` :math:`G` attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q,1)`), this function returns the Dirichlet character\n        attached to :math:`m \\in (\\mathbb{Z}/q\\mathbb{Z})^*` via Conrey's logarithm, which\n        establishes a \"canonical\" bijection between :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` and its dual.\n        \n        Let :math:`q = \\prod_p p^{e_p}` be the factorization of :math:`q` into distinct primes.\n        For all odd :math:`p` with :math:`e_p > 0`, let :math:`g_p` be the element in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`\n        which is\n        \n        - congruent to :math:`1` mod :math:`q/p^{e_p}`,\n        \n        - congruent mod :math:`p^{e_p}` to the smallest positive integer that generates\n          :math:`(\\mathbb{Z}/p^2\\mathbb{Z})^*`.\n        \n        For :math:`p = 2`, we let :math:`g_4` (if :math:`2^{e_2} >= 4`) and :math:`g_8` (if furthermore\n        (:math:`2^{e_2} >= 8`) be the elements in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` which are\n        \n        - congruent to :math:`1` mod :math:`q/2^{e_2}`,\n        \n        - :math:`g_4 = -1 mod 2^{e_2}`,\n        \n        - :math:`g_8 = 5 mod 2^{e_2}`.\n        \n        Then the :math:`g_p` (and the extra :math:`g_4` and :math:`g_8` if :math:`2^{e_2} >= 2`) are\n        independent generators of :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`, i.e. every :math:`m` in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` can be\n        written uniquely as :math:`\\prod_p g_p^{m_p}`, where :math:`m_p` is defined modulo the\n        order :math:`o_p` of :math:`g_p` and :math:`p \\in S_q`, the set of prime divisors of :math:`q`\n        together with :math:`4` if :math:`4 \\| q` and :math:`8` if :math:`8 \\| q`. Note that the :math:`g_p`\n        are in general :emphasis:`not` SNF generators as produced by :literal:`znstar` whenever\n        :math:`\\omega (q) >= 2`, although their number is the same. They however allow\n        t""o handle the finite abelian group :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` in a fast and elegant way.\n        (Which unfortunately does not generalize to ray class groups or Hecke\n        characters.)\n        \n        The Conrey logarithm of :math:`m` is the vector :math:`(m_p)_{p\\in S_q}`, obtained\n        via :literal:`znconreylog`. The Conrey character :math:`\\chi_q(m,.)` attached to\n        :math:`m` mod :math:`q` maps\n        each :math:`g_p`, :math:`p\\in S_q` to :math:`e(m_p / o_p)`, where :math:`e(x) = \\exp (2i\\pi x)`.\n        This function returns the Conrey character expressed in the standard PARI\n        way in terms of the SNF generators :literal:`G.gen`.\n        \n        ::\n        \n            ? G = znstar(8,1);\n            ? G.cyc\n            %2 = [2, 2] \\\\ Z/2 x Z/2\n            ? G.gen\n            %3 = [7, 3]\n            ? znconreychar(G,1) \\\\ 1 is always the trivial character\n            %4 = [0, 0]\n            ? znconreychar(G,2) \\\\ 2 is not coprime to 8 !!!\n             *** at top-level: znconreychar(G,2)\n             *** ^-----------------\n             *** znconreychar: elements not coprime in Zideallog:\n             2\n             8\n             *** Break loop: type 'break' to go back to GP prompt\n            break>\n            \n            ? znconreychar(G,3)\n            %5 = [0, 1]\n            ? znconreychar(G,5)\n            %6 = [1, 1]\n            ? znconreychar(G,7)\n            %7 = [1, 0]\n        \n        We indeed get all 4 characters of :math:`(\\mathbb{Z}/8\\mathbb{Z})^*`.\n        \n        For convenience, we allow to input the :emphasis:`Conrey logarithm` of :math:`m`\n        instead of :math:`m`:\n        \n        ::\n        \n            ? G = znstar(55, 1);\n            ? znconreychar(G,7)\n            %2 = [7, 0]\n            ? znconreychar(G, znconreylog(G,7))\n            %3 = [7, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1805znconreychar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znconreychar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_m,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_G)) != 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_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znconreychar", 1, 2, 2, 1); __PYX_ERR(4, 31299, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znconreychar") < 0)) __PYX_ERR(4, 31299, __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_G = values[0];
    __pyx_v_m = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znconreychar", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31299, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znconreychar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1804znconreychar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1804znconreychar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_m) {
  GEN __pyx_v__G;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znconreychar", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":31380
 *             %3 = [7, 0]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31381
 *         '''
 *         G = objtogen(G)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31382
 *         G = objtogen(G)
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31382, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31383
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreychar(_G, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31384
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znconreychar(_G, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31385
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreychar(_G, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znconreychar(__pyx_v__G, __pyx_v__m);

  /* "cypari/auto_instance.pxi":31386
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreychar(_G, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znconreyexp(self, G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31299
 *         return new_gen(_ret)
 * 
 *     def znconreychar(self, G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znconreychar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31388
 *         return new_gen(_ret)
 * 
 *     def znconreyexp(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1807znconreyexp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1806znconreyexp[] = "\n        Given a :emphasis:`znstar` :math:`G` attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q, 1)`), this function returns the Conrey exponential of\n        the character :emphasis:`chi`: it returns the integer\n        :math:`m \\in (\\mathbb{Z}/q\\mathbb{Z})^*` such that :literal:`znconreylog(G, :math:`m`)` is :emphasis:`chi`.\n        \n        The character :emphasis:`chi` is given either as a\n        \n        - :literal:`t_VEC`: in terms of the generators :literal:`G.gen`;\n        \n        - :literal:`t_COL`: a Conrey logarithm.\n        \n        ::\n        \n            ? G = znstar(126000, 1)\n            ? znconreylog(G,1)\n            %2 = [0, 0, 0, 0, 0]~\n            ? znconreyexp(G,%)\n            %3 = 1\n            ? G.cyc \\\\ SNF generators\n            %4 = [300, 12, 2, 2, 2]\n            ? chi = [100, 1, 0, 1, 0]; \\\\ some random character on SNF generators\n            ? znconreylog(G, chi) \\\\ in terms of Conrey generators\n            %6 = [0, 3, 3, 0, 2]~\n            ? znconreyexp(G, %) \\\\ apply to a Conrey log\n            %7 = 18251\n            ? znconreyexp(G, chi) \\\\ ... or a char on SNF generators\n            %8 = 18251\n            ? znconreychar(G,%)\n            %9 = [100, 1, 0, 1, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1807znconreyexp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znconreyexp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_chi,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_G)) != 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_chi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znconreyexp", 1, 2, 2, 1); __PYX_ERR(4, 31388, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znconreyexp") < 0)) __PYX_ERR(4, 31388, __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_G = values[0];
    __pyx_v_chi = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znconreyexp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31388, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znconreyexp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1806znconreyexp(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_chi);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1806znconreyexp(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znconreyexp", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_instance.pxi":31420
 *             %9 = [100, 1, 0, 1, 0]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31421
 *         '''
 *         G = objtogen(G)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31422
 *         G = objtogen(G)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31422, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31423
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znconreyexp(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31424
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znconreyexp(_G, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31425
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znconreyexp(_G, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znconreyexp(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_instance.pxi":31426
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znconreyexp(_G, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znconreylog(self, G, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31388
 *         return new_gen(_ret)
 * 
 *     def znconreyexp(self, G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znconreyexp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31428
 *         return new_gen(_ret)
 * 
 *     def znconreylog(self, G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1809znconreylog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1808znconreylog[] = "\n        Given a :emphasis:`znstar` attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q,1)`), this function returns the Conrey logarithm of\n        :math:`m \\in (\\mathbb{Z}/q\\mathbb{Z})^*`.\n        \n        Let :math:`q = \\prod_p p^{e_p}` be the factorization of :math:`q` into distinct primes,\n        where we assume :math:`e_2 = 0` or :math:`e_2 >= 2`. (If :math:`e_2 = 1`, we can ignore :math:`2`\n        from the factorization, as if we replaced :math:`q` by :math:`q/2`, since :math:`(\\mathbb{Z}/q\\mathbb{Z})^*\n        ~ (\\mathbb{Z}/(q/2)\\mathbb{Z})^*`.)\n        \n        For all odd :math:`p` with :math:`e_p > 0`, let :math:`g_p` be the element in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`\n        which is\n        \n        - congruent to :math:`1` mod :math:`q/p^{e_p}`,\n        \n        - congruent mod :math:`p^{e_p}` to the smallest positive integer that generates\n          :math:`(\\mathbb{Z}/p^2\\mathbb{Z})^*`.\n        \n        For :math:`p = 2`, we let :math:`g_4` (if :math:`2^{e_2} >= 4`) and :math:`g_8` (if furthermore\n        (:math:`2^{e_2} >= 8`) be the elements in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` which are\n        \n        - congruent to :math:`1` mod :math:`q/2^{e_2}`,\n        \n        - :math:`g_4 = -1 mod 2^{e_2}`,\n        \n        - :math:`g_8 = 5 mod 2^{e_2}`.\n        \n        Then the :math:`g_p` (and the extra :math:`g_4` and :math:`g_8` if :math:`2^{e_2} >= 2`) are\n        independent generators of :math:`\\mathbb{Z}/q\\mathbb{Z}^*`, i.e. every :math:`m` in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` can be\n        written uniquely as :math:`\\prod_p g_p^{m_p}`, where :math:`m_p` is defined modulo the\n        order :math:`o_p` of :math:`g_p` and :math:`p \\in S_q`, the set of prime divisors of :math:`q`\n        together with :math:`4` if :math:`4 \\| q` and :math:`8` if :math:`8 \\| q`. Note that the :math:`g_p`\n        are in general :emphasis:`not` SNF generators as produced by :l""iteral:`znstar` whenever\n        :math:`\\omega (q) >= 2`, although their number is the same. They however allow\n        to handle the finite abelian group :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` in a fast and elegant way.\n        (Which unfortunately does not generalize to ray class groups or Hecke\n        characters.)\n        \n        The Conrey logarithm of :math:`m` is the vector :math:`(m_p)_{p\\in S_q}`. The inverse\n        function :literal:`znconreyexp` recovers the Conrey label :math:`m` from a character.\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? znconreylog(G,1)\n            %2 = [0, 0, 0, 0, 0]~\n            ? znconreyexp(G, %)\n            %3 = 1\n            ? znconreylog(G,2) \\\\ 2 is not coprime to modulus !!!\n             *** at top-level: znconreylog(G,2)\n             *** ^-----------------\n             *** znconreylog: elements not coprime in Zideallog:\n             2\n             126000\n             *** Break loop: type 'break' to go back to GP prompt\n            break>\n            ? znconreylog(G,11) \\\\ wrt. Conrey generators\n            %4 = [0, 3, 1, 76, 4]~\n            ? log11 = ideallog(,11,G) \\\\ wrt. SNF generators\n            %5 = [178, 3, -75, 1, 0]~\n        \n        For convenience, we allow to input the ordinary discrete log of :math:`m`,\n        :math:`ideallog(,m,bid)`, which allows to convert discrete logs\n        from :literal:`bid.gen` generators to Conrey generators.\n        \n        ::\n        \n            ? znconreylog(G, log11)\n            %7 = [0, 3, 1, 76, 4]~\n        \n        We also allow a character (:literal:`t_VEC`) on :literal:`bid.gen` and\n        return its representation on the Conrey generators.\n        \n        ::\n        \n            ? G.cyc\n            %8 = [300, 12, 2, 2, 2]\n            ? chi = [10,1,0,1,1];\n            ? znconreylog(G, chi)\n            %10 = [1, 3, 3, 10, 2]~\n            ? n = znconreyexp(G, chi)\n            %11"" = 84149\n            ? znconreychar(G, n)\n            %12 = [10, 1, 0, 1, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1809znconreylog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znconreylog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_m,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_G)) != 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_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znconreylog", 1, 2, 2, 1); __PYX_ERR(4, 31428, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znconreylog") < 0)) __PYX_ERR(4, 31428, __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_G = values[0];
    __pyx_v_m = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znconreylog", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31428, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znconreylog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1808znconreylog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_G, __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1808znconreylog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_G, PyObject *__pyx_v_m) {
  GEN __pyx_v__G;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znconreylog", 0);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_instance.pxi":31514
 *             %12 = [10, 1, 0, 1, 1]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31515
 *         '''
 *         G = objtogen(G)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31516
 *         G = objtogen(G)
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31516, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31517
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreylog(_G, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31518
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znconreylog(_G, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31519
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreylog(_G, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znconreylog(__pyx_v__G, __pyx_v__m);

  /* "cypari/auto_instance.pxi":31520
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreylog(_G, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncoppersmith(self, P, N, X, B=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31428
 *         return new_gen(_ret)
 * 
 *     def znconreylog(self, G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znconreylog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31522
 *         return new_gen(_ret)
 * 
 *     def zncoppersmith(self, P, N, X, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N` being an integer and :math:`P\in \mathbb{Z}[X]`, finds all integers :math:`x` with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1811zncoppersmith(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1810zncoppersmith[] = "\n        :math:`N` being an integer and :math:`P\\in \\mathbb{Z}[X]`, finds all integers :math:`x` with\n        :math:`\\|x\\| <= X` such that\n        \n        .. MATH::\n        \n            \\mathrm{gcd} (N, P(x)) >= B,\n        \n        using Coppersmith's algorithm, a famous application of the LLL\n        algorithm meant to help in the factorization of :math:`N`. The parameter :math:`X` must be\n        smaller than\n        :math:`\\exp (\\log^2 (B/p) / (\\deg (P) \\log (N/p)))`, where :math:`p` is the gcd of the\n        leading coefficient of :math:`P` and :math:`N`. In applications to factorization,\n        we should have :math:`p = 1` (otherwise we have factored :math:`N` if :math:`p != N`\n        or we can reduce the degree of :math:`P`); for :math:`B = N` and :math:`p = 1`, the condition\n        means :math:`X < N^{1/\\deg (P)}`. Some :math:`x` larger than :math:`X` may be returned if you are\n        very lucky. The routine runs in polynomial time in :math:`\\deg (P)` and :math:`\\log N`\n        but the smaller :math:`B`, or the larger :math:`X`, the slower.\n        The strength of Coppersmith method is the ability to find roots modulo a\n        general :emphasis:`composite` :math:`N`: if :math:`N` is a prime or a prime power,\n        :literal:`polrootsmod` or :literal:`polrootspadic` will be much faster.\n        \n        We shall now present two simple applications. The first one is\n        finding non-trivial factors of :math:`N`, given some partial information on the\n        factors; in that case :math:`B` must obviously be smaller than the largest\n        non-trivial divisor of :math:`N`.\n        \n        ::\n        \n            setrand(1); \\\\ to make the example reproducible\n            [a,b] = [10^30, 10^31]; D = 20;\n            p = randomprime([a,b]);\n            q = randomprime([a,b]); N = p*q;\n            \\\\ assume we know 0) p | N; 1) p in [a,b]; 2) the last D digits of p\n            p0 = p % 10^D;\n            ""\n            ? L = zncoppersmith(10^D*x + p0, N, b \\ 10^D, a)\n            time = 1ms.\n            %6 = [738281386540]\n            ? gcd(L[1] * 10^D + p0, N) == p\n            %7 = 1\n        \n        and we recovered :math:`p`, faster than by trying all\n        possibilities :math:`x < 10^{11}`.\n        \n        The second application is an attack on RSA with low exponent, when the\n        message :math:`x` is short and the padding :math:`P` is known to the attacker. We use\n        the same RSA modulus :math:`N` as in the first example:\n        \n        ::\n        \n            setrand(1);\n            P = random(N); \\\\ known padding\n            e = 3; \\\\ small public encryption exponent\n            X = floor(N^0.3); \\\\ N^(1/e - epsilon)\n            x0 = random(X); \\\\ unknown short message\n            C = lift( (Mod(x0,N) + P)^e ); \\\\ known ciphertext, with padding P\n            zncoppersmith((P + x)^3 - C, N, X)\n            \n            \\\\ result in 244ms.\n            %14 = [2679982004001230401]\n            \n            ? %[1] == x0\n            %15 = 1\n        \n        We guessed an integer of the order of :math:`10^{18}`, almost instantly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1811zncoppersmith(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncoppersmith (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_N,&__pyx_n_s_X,&__pyx_n_s_B,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_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_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncoppersmith", 0, 3, 4, 1); __PYX_ERR(4, 31522, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncoppersmith", 0, 3, 4, 2); __PYX_ERR(4, 31522, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zncoppersmith") < 0)) __PYX_ERR(4, 31522, __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_P = values[0];
    __pyx_v_N = values[1];
    __pyx_v_X = values[2];
    __pyx_v_B = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zncoppersmith", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncoppersmith", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1810zncoppersmith(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_P, __pyx_v_N, __pyx_v_X, __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1810zncoppersmith(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_N, PyObject *__pyx_v_X, PyObject *__pyx_v_B) {
  int __pyx_v__have_B;
  GEN __pyx_v__P;
  GEN __pyx_v__N;
  GEN __pyx_v__X;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("zncoppersmith", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_N);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_instance.pxi":31590
 *         We guessed an integer of the order of :math:`10^{18}`, almost instantly.
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         N = objtogen(N)
 *         X = objtogen(X)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31590, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31591
 *         '''
 *         P = objtogen(P)
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31592
 *         P = objtogen(P)
 *         N = objtogen(N)
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31593
 *         N = objtogen(N)
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_instance.pxi":31594
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31595
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31595, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":31594
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":31596
 *         if _have_B:
 *             B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 31596, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31597
 *             B = objtogen(B)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31598
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31599
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31600
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_instance.pxi":31601
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31602
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_instance.pxi":31601
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 */
  }

  /* "cypari/auto_instance.pxi":31603
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zncoppersmith(__pyx_v__P, __pyx_v__N, __pyx_v__X, __pyx_v__B);

  /* "cypari/auto_instance.pxi":31604
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znlog(self, x, g, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31522
 *         return new_gen(_ret)
 * 
 *     def zncoppersmith(self, P, N, X, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N` being an integer and :math:`P\in \mathbb{Z}[X]`, finds all integers :math:`x` with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.zncoppersmith", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31606
 *         return new_gen(_ret)
 * 
 *     def znlog(self, x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This functions allows two distinct modes of operation depending
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1813znlog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1812znlog[] = "\n        This functions allows two distinct modes of operation depending\n        on :math:`g`:\n        \n        - if :math:`g` is the output of :literal:`znstar` (with initialization),\n          we compute the discrete logarithm of :math:`x` with respect to the generators\n          contained in the structure. See :literal:`ideallog` for details.\n        \n        - else :math:`g` is an explicit element in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, we compute the\n          discrete logarithm of :math:`x` in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` in base :math:`g`. The rest of this\n          entry describes the latter possibility.\n        \n        The result is :math:`[]` when :math:`x` is not a power of :math:`g`, though the function may\n        also enter an infinite loop in this case.\n        \n        If present, :math:`o` represents the multiplicative order of :math:`g`, see\n        ``DLfun`` (in the PARI manual); the preferred format for this parameter is\n        :literal:`[ord, factor(ord)]`, where :literal:`ord` is the order of :math:`g`.\n        This provides a definite speedup when the discrete log problem is simple:\n        \n        ::\n        \n            ? p = nextprime(10^4); g = znprimroot(p); o = [p-1, factor(p-1)];\n            ? for(i=1,10^4, znlog(i, g, o))\n            time = 163 ms.\n            ? for(i=1,10^4, znlog(i, g))\n            time = 200 ms. \\\\ a little slower\n        \n        The result is undefined if :math:`g` is not invertible mod :math:`N` or if the supplied\n        order is incorrect.\n        \n        This function uses\n        \n        - a combination of generic discrete log algorithms (see below).\n        \n        - in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` when :math:`N` is prime: a linear sieve index calculus\n          method, suitable for :math:`N < 10^{50}`, say, is used for large prime divisors of\n          the order.\n        \n        The generic discrete log algorithms are:\n        \n        - Poh""lig-Hellman algorithm, to reduce to groups of prime order :math:`q`,\n          where :math:`q \\| p-1` and :math:`p` is an odd prime divisor of :math:`N`,\n        \n        - Shanks baby-step/giant-step (:math:`q < 2^{32}` is small),\n        \n        - Pollard rho method (:math:`q > 2^{32}`).\n        \n        The latter two algorithms require :math:`O(\\sqrt{q})` operations in the group on\n        average, hence will not be able to treat cases where :math:`q > 10^{30}`, say.\n        In addition, Pollard rho is not able to handle the case where there are no\n        solutions: it will enter an infinite loop.\n        \n        ::\n        \n            ? g = znprimroot(101)\n            %1 = Mod(2,101)\n            ? znlog(5, g)\n            %2 = 24\n            ? g^24\n            %3 = Mod(5, 101)\n            \n            ? G = znprimroot(2 * 101^10)\n            %4 = Mod(110462212541120451003, 220924425082240902002)\n            ? znlog(5, G)\n            %5 = 76210072736547066624\n            ? G^% == 5\n            %6 = 1\n            ? N = 2^4*3^2*5^3*7^4*11; g = Mod(13, N); znlog(g^110, g)\n            %7 = 110\n            ? znlog(6, Mod(2,3)) \\\\ no solution\n            %8 = []\n        \n        For convenience, :math:`g` is also allowed to be a :math:`p`-adic number:\n        \n        ::\n        \n            ? g = 3+O(5^10); znlog(2, g)\n            %1 = 1015243\n            ? g^%\n            %2 = 2 + O(5^10)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1813znlog(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znlog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_g,&__pyx_n_s_o,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znlog", 0, 2, 3, 1); __PYX_ERR(4, 31606, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znlog") < 0)) __PYX_ERR(4, 31606, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_g = values[1];
    __pyx_v_o = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znlog", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31606, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znlog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1812znlog(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_g, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1812znlog(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__g;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("znlog", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_g);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_instance.pxi":31689
 *             %2 = 2 + O(5^10)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31690
 *         '''
 *         x = objtogen(x)
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31691
 *         x = objtogen(x)
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_instance.pxi":31692
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31693
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":31692
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":31694
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 31694, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31695
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31696
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31697
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_instance.pxi":31698
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31699
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_instance.pxi":31698
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 */
  }

  /* "cypari/auto_instance.pxi":31700
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znlog0(__pyx_v__x, __pyx_v__g, __pyx_v__o);

  /* "cypari/auto_instance.pxi":31701
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znorder(self, x, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31606
 *         return new_gen(_ret)
 * 
 *     def znlog(self, x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This functions allows two distinct modes of operation depending
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znlog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31703
 *         return new_gen(_ret)
 * 
 *     def znorder(self, x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be an integer mod :math:`n`, and the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1815znorder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1814znorder[] = "\n        :math:`x` must be an integer mod :math:`n`, and the\n        result is the order of :math:`x` in the multiplicative group :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`. Returns\n        an error if :math:`x` is not invertible.\n        The parameter o, if present, represents a non-zero\n        multiple of the order of :math:`x`, see ``DLfun`` (in the PARI manual); the preferred format for\n        this parameter is :literal:`[ord, factor(ord)]`, where :literal:`ord = eulerphi(n)`\n        is the cardinality of the group.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1815znorder(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znorder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_o,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znorder") < 0)) __PYX_ERR(4, 31703, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_o = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znorder", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31703, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1814znorder(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_x, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1814znorder(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("znorder", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_instance.pxi":31713
 *         is the cardinality of the group.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31714
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_instance.pxi":31715
 *         x = objtogen(x)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31716
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_instance.pxi":31715
 *         x = objtogen(x)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_instance.pxi":31717
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(4, 31717, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31718
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_instance.pxi":31719
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_instance.pxi":31720
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_instance.pxi":31721
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znorder(_x, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_instance.pxi":31720
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)
 */
  }

  /* "cypari/auto_instance.pxi":31722
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znorder(__pyx_v__x, __pyx_v__o);

  /* "cypari/auto_instance.pxi":31723
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znprimroot(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31703
 *         return new_gen(_ret)
 * 
 *     def znorder(self, x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be an integer mod :math:`n`, and the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31725
 *         return new_gen(_ret)
 * 
 *     def znprimroot(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a primitive root (generator) of :math:`(\mathbb{Z}/n\mathbb{Z})^*`, whenever this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1817znprimroot(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1816znprimroot[] = "\n        Returns a primitive root (generator) of :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`, whenever this\n        latter group is cyclic (:math:`n = 4` or :math:`n = 2p^k` or :math:`n = p^k`, where :math:`p` is an\n        odd prime and :math:`k >= 0`). If the group is not cyclic, the result is\n        undefined. If :math:`n` is a prime power, then the smallest positive primitive\n        root is returned. This may not be true for :math:`n = 2p^k`, :math:`p` odd.\n        \n        Note that this function requires factoring :math:`p-1` for :math:`p` as above,\n        in order to determine the exact order of elements in\n        :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`: this is likely to be costly if :math:`p` is large.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1817znprimroot(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znprimroot (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1816znprimroot(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1816znprimroot(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znprimroot", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":31737
 *         :math:`(\mathbb{Z}/n\mathbb{Z})^*`: this is likely to be costly if :math:`p` is large.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31738
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znprimroot(_n)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31738, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31739
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znprimroot(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31740
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znprimroot(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znprimroot(__pyx_v__n);

  /* "cypari/auto_instance.pxi":31741
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znprimroot(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znstar(self, n, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31725
 *         return new_gen(_ret)
 * 
 *     def znprimroot(self, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a primitive root (generator) of :math:`(\mathbb{Z}/n\mathbb{Z})^*`, whenever this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znprimroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_instance.pxi":31743
 *         return new_gen(_ret)
 * 
 *     def znstar(self, n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the structure of the multiplicative group :math:`(\mathbb{Z}/n\mathbb{Z})^*`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1819znstar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_9Pari_auto_1818znstar[] = "\n        Gives the structure of the multiplicative group :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`.\n        The output :math:`G` depends on the value of :emphasis:`flag`:\n        \n        - :math:`flag = 0` (default), an abelian group structure :math:`[h,d,g]`,\n          where :math:`h = \\phi (n)` is the order (:literal:`G.no`), :math:`d` (:literal:`G.cyc`)\n          is a :math:`k`-component row-vector :math:`d` of integers :math:`d_i` such that :math:`d_i > 1`,\n          :math:`d_i \\| d_{i-1}` for :math:`i >= 2` and\n          \n        \n        .. MATH::\n        \n            (\\mathbb{Z}/n\\mathbb{Z})^* ~ \\prod_{i = 1}^k (\\mathbb{Z}/d_i\\mathbb{Z}),\n        \n          and :math:`g` (:literal:`G.gen`) is a :math:`k`-component row vector giving generators of\n          the image of the cyclic groups :math:`\\mathbb{Z}/d_i\\mathbb{Z}`.\n        \n        - :math:`flag = 1` the result is a :literal:`bid` structure;\n          this allows computing discrete logarithms using :literal:`znlog` (also in the\n          non-cyclic case!).\n        \n        ::\n        \n            ? G = znstar(40)\n            %1 = [16, [4, 2, 2], [Mod(17, 40), Mod(21, 40), Mod(11, 40)]]\n            ? G.no \\\\ eulerphi(40)\n            %2 = 16\n            ? G.cyc \\\\ cycle structure\n            %3 = [4, 2, 2]\n            ? G.gen \\\\ generators for the cyclic components\n            %4 = [Mod(17, 40), Mod(21, 40), Mod(11, 40)]\n            ? apply(znorder, G.gen)\n            %5 = [4, 2, 2]\n        \n        For user convenience, we define :literal:`znstar(0)` as\n        :literal:`[2, [2], [-1]]`, corresponding to :math:`\\mathbb{Z}^*`, but :math:`flag = 1` is not\n        implemented in this trivial case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1819znstar(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znstar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_flag,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znstar") < 0)) __PYX_ERR(4, 31743, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(4, 31743, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znstar", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(4, 31743, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1818znstar(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), __pyx_v_n, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1818znstar(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znstar", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_instance.pxi":31782
 *         implemented in this trivial case.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_instance.pxi":31783
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znstar0(_n, flag)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(4, 31783, __pyx_L1_error)

  /* "cypari/auto_instance.pxi":31784
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znstar0(_n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_instance.pxi":31785
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znstar0(_n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znstar0(__pyx_v__n, __pyx_v_flag);

  /* "cypari/auto_instance.pxi":31786
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znstar0(_n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 * DEF HAVE_PLOT_SVG = True
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 31786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_instance.pxi":31743
 *         return new_gen(_ret)
 * 
 *     def znstar(self, n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the structure of the multiplicative group :math:`(\mathbb{Z}/n\mathbb{Z})^*`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.znstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1821__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1821__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1820__reduce_cython__(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1820__reduce_cython__(struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = ()             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __Pyx_INCREF(__pyx_empty_tuple);
  __pyx_v_state = __pyx_empty_tuple;

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = False
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = ()
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = False             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":13
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Pari_auto); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, None), state
 *     else:
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Pari_auto__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Pari_auto); if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_222419149);
    __Pyx_GIVEREF(__pyx_int_222419149);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Pari_auto__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1823__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_9Pari_auto_1823__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9Pari_auto_1822__setstate_cython__(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9Pari_auto_1822__setstate_cython__(struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Pari_auto__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(8, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_6cypari_5_pari___pyx_unpickle_Pari_auto__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Pari_auto, (type(self), 0xd41d8cd, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Pari_auto__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari_auto.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":489
 * @cython.final
 * cdef class Pari(Pari_auto):
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         (Re)-initialize the PARI library.
 */

/* Python wrapper */
static int __pyx_pw_6cypari_5_pari_4Pari_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6cypari_5_pari_4Pari_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari___cinit__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6cypari_5_pari_4Pari___cinit__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "cypari/pari_instance.pyx":500
 *         """
 *         # PARI is already initialized, nothing to do...
 *         if avma:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = (avma != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":501
 *         # PARI is already initialized, nothing to do...
 *         if avma:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         # Take 1MB as minimal stack. Use maxprime=0, which PARI will
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":500
 *         """
 *         # PARI is already initialized, nothing to do...
 *         if avma:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "cypari/pari_instance.pyx":505
 *         # Take 1MB as minimal stack. Use maxprime=0, which PARI will
 *         # internally increase to some small value like 65537.
 *         pari_init_opts(1000000, 0, INIT_DFTm)             # <<<<<<<<<<<<<<
 * 
 *         # Disable PARI's stack overflow checking which is incompatible
 */
  pari_init_opts(0xF4240, 0, INIT_DFTm);

  /* "cypari/pari_instance.pyx":509
 *         # Disable PARI's stack overflow checking which is incompatible
 *         # with multi-threading.
 *         pari_stackcheck_init(NULL)             # <<<<<<<<<<<<<<
 * 
 *         _pari_init_error_handling()
 */
  pari_stackcheck_init(NULL);

  /* "cypari/pari_instance.pyx":511
 *         pari_stackcheck_init(NULL)
 * 
 *         _pari_init_error_handling()             # <<<<<<<<<<<<<<
 *         _pari_init_closure()
 * 
 */
  __pyx_f_6cypari_5_pari__pari_init_error_handling();

  /* "cypari/pari_instance.pyx":512
 * 
 *         _pari_init_error_handling()
 *         _pari_init_closure()             # <<<<<<<<<<<<<<
 * 
 *         # Set printing functions
 */
  __pyx_f_6cypari_5_pari__pari_init_closure();

  /* "cypari/pari_instance.pyx":517
 *         global pariOut, pariErr
 * 
 *         pariOut = &sage_pariOut             # <<<<<<<<<<<<<<
 *         pariOut.putch = sage_putchar
 *         pariOut.puts = sage_puts
 */
  pariOut = (&__pyx_v_6cypari_5_pari_sage_pariOut);

  /* "cypari/pari_instance.pyx":518
 * 
 *         pariOut = &sage_pariOut
 *         pariOut.putch = sage_putchar             # <<<<<<<<<<<<<<
 *         pariOut.puts = sage_puts
 *         pariOut.flush = sage_flush
 */
  pariOut->putch = __pyx_f_6cypari_5_pari_sage_putchar;

  /* "cypari/pari_instance.pyx":519
 *         pariOut = &sage_pariOut
 *         pariOut.putch = sage_putchar
 *         pariOut.puts = sage_puts             # <<<<<<<<<<<<<<
 *         pariOut.flush = sage_flush
 * 
 */
  pariOut->puts = __pyx_f_6cypari_5_pari_sage_puts;

  /* "cypari/pari_instance.pyx":520
 *         pariOut.putch = sage_putchar
 *         pariOut.puts = sage_puts
 *         pariOut.flush = sage_flush             # <<<<<<<<<<<<<<
 * 
 *         # Use 53 bits as default precision
 */
  pariOut->flush = __pyx_f_6cypari_5_pari_sage_flush;

  /* "cypari/pari_instance.pyx":523
 * 
 *         # Use 53 bits as default precision
 *         self.set_real_precision_bits(53)             # <<<<<<<<<<<<<<
 * 
 *         # Disable pretty-printing
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_real_precision_bits); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 523, __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_53) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_53);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/pari_instance.pyx":526
 * 
 *         # Disable pretty-printing
 *         GP_DATA.fmt.prettyp = 0             # <<<<<<<<<<<<<<
 * 
 *         # This causes PARI/GP to use output independent of the terminal
 */
  GP_DATA->fmt->prettyp = 0;

  /* "cypari/pari_instance.pyx":530
 *         # This causes PARI/GP to use output independent of the terminal
 *         # (which is what we want for the PARI library interface).
 *         GP_DATA.flags = gpd_TEST             # <<<<<<<<<<<<<<
 * 
 *         # Ensure that Galois groups are represented in a sane way,
 */
  GP_DATA->flags = gpd_TEST;

  /* "cypari/pari_instance.pyx":535
 *         # see the polgalois section of the PARI users manual.
 *         global new_galois_format
 *         new_galois_format = 1             # <<<<<<<<<<<<<<
 * 
 *         # By default, factor() should prove primality of returned
 */
  new_galois_format = 1;

  /* "cypari/pari_instance.pyx":541
 *         # also many functions indirectly using factoring.
 *         global factor_proven
 *         factor_proven = 1             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, size_t size=8000000, size_t sizemax=0, unsigned long maxprime=500000):
 */
  factor_proven = 1;

  /* "cypari/pari_instance.pyx":489
 * @cython.final
 * cdef class Pari(Pari_auto):
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         (Re)-initialize the PARI library.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Pari.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":543
 *         factor_proven = 1
 * 
 *     def __init__(self, size_t size=8000000, size_t sizemax=0, unsigned long maxprime=500000):             # <<<<<<<<<<<<<<
 *         """
 *         (Re)-Initialize the PARI system.
 */

/* Python wrapper */
static int __pyx_pw_6cypari_5_pari_4Pari_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_2__init__[] = "\n        (Re)-Initialize the PARI system.\n\n        INPUT:\n\n        - ``size`` -- (default: 8000000) the number of bytes for the\n          initial PARI stack (see notes below)\n\n        - ``sizemax`` -- the maximal number of bytes for the\n          dynamically increasing PARI stack. The default ``0`` means\n          to use the same value as ``size`` (see notes below)\n\n        - ``maxprime`` -- (default: 500000) limit on the primes in the\n          precomputed prime number table which is used for sieving\n          algorithms\n\n        When the PARI system is already initialized, the PARI stack is only\n        grown if ``size`` is greater than the current stack, and the table\n        of primes is only computed if ``maxprime`` is larger than the current\n        bound.\n\n        EXAMPLES::\n\n            sage: from cypari._pari import Pari\n            sage: pari2 = Pari(10**7)\n            sage: pari2\n            Interface to the PARI C library\n            sage: pari2 is pari\n            False\n            sage: pari2.PARI_ZERO == pari.PARI_ZERO\n            True\n            sage: pari2 = Pari(10**6)\n            sage: pari.stacksize(), pari2.stacksize()\n            (10000000, 10000000)\n\n        For more information about how precision works in the PARI\n        interface, see :mod:`sage.libs.cypari2.pari_instance`.\n\n        .. NOTE::\n\n            PARI has a \"real\" stack size (``size``) and a \"virtual\"\n            stack size (``sizemax``). The idea is that the real stack\n            will be used if possible, but that the stack might be\n            increased up to ``sizemax`` bytes. Therefore, it is not a\n            problem to set ``sizemax`` to a large value. On the other\n            hand, it also makes no sense to set this to a value larger\n            than what your system can handle.\n\n        .. NOTE::\n\n           In CyPari, the PARI stack is different than in GP or the\n           PARI C library. In CyPari, instead of the ""PARI stack\n           holding the results of all computations, it *only* holds\n           the results of an individual computation. Each time a new\n           Python/PARI object is computed, it is copied to its own\n           space in the Python heap, and the memory it occupied on the\n           PARI stack is freed. Thus it is not necessary to make the\n           stack very large.\n\n           This design obviously involves some performance penalties\n           over the way PARI works, but it scales much better and is\n           far more robust for large projects.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_4Pari_2__init__;
#endif
static int __pyx_pw_6cypari_5_pari_4Pari_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_size;
  size_t __pyx_v_sizemax;
  unsigned long __pyx_v_maxprime;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,&__pyx_n_s_sizemax,&__pyx_n_s_maxprime,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sizemax);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxprime);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(3, 543, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_size = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_size == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 543, __pyx_L3_error)
    } else {
      __pyx_v_size = ((size_t)0x7A1200);
    }
    if (values[1]) {
      __pyx_v_sizemax = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_sizemax == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 543, __pyx_L3_error)
    } else {
      __pyx_v_sizemax = ((size_t)0);
    }
    if (values[2]) {
      __pyx_v_maxprime = __Pyx_PyInt_As_unsigned_long(values[2]); if (unlikely((__pyx_v_maxprime == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(3, 543, __pyx_L3_error)
    } else {
      __pyx_v_maxprime = ((unsigned long)0x7A120);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 543, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_2__init__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_size, __pyx_v_sizemax, __pyx_v_maxprime);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6cypari_5_pari_4Pari_2__init__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, size_t __pyx_v_size, size_t __pyx_v_sizemax, unsigned long __pyx_v_maxprime) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  size_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cypari/pari_instance.pyx":609
 *         # Increase (but don't decrease) size and sizemax to the
 *         # requested value
 *         size = max(size, pari_mainstack.rsize)             # <<<<<<<<<<<<<<
 *         sizemax = max(max(size, pari_mainstack.vsize), sizemax)
 *         paristack_setsize(size, sizemax)
 */
  __pyx_t_1 = pari_mainstack->rsize;
  __pyx_t_2 = __pyx_v_size;
  if (((__pyx_t_1 > __pyx_t_2) != 0)) {
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  __pyx_v_size = __pyx_t_3;

  /* "cypari/pari_instance.pyx":610
 *         # requested value
 *         size = max(size, pari_mainstack.rsize)
 *         sizemax = max(max(size, pari_mainstack.vsize), sizemax)             # <<<<<<<<<<<<<<
 *         paristack_setsize(size, sizemax)
 * 
 */
  __pyx_t_3 = __pyx_v_sizemax;
  __pyx_t_1 = pari_mainstack->vsize;
  __pyx_t_2 = __pyx_v_size;
  if (((__pyx_t_1 > __pyx_t_2) != 0)) {
    __pyx_t_4 = __pyx_t_1;
  } else {
    __pyx_t_4 = __pyx_t_2;
  }
  __pyx_t_1 = __pyx_t_4;
  if (((__pyx_t_3 > __pyx_t_1) != 0)) {
    __pyx_t_4 = __pyx_t_3;
  } else {
    __pyx_t_4 = __pyx_t_1;
  }
  __pyx_v_sizemax = __pyx_t_4;

  /* "cypari/pari_instance.pyx":611
 *         size = max(size, pari_mainstack.rsize)
 *         sizemax = max(max(size, pari_mainstack.vsize), sizemax)
 *         paristack_setsize(size, sizemax)             # <<<<<<<<<<<<<<
 * 
 *         # Increase the table of primes if needed
 */
  paristack_setsize(__pyx_v_size, __pyx_v_sizemax);

  /* "cypari/pari_instance.pyx":614
 * 
 *         # Increase the table of primes if needed
 *         self.init_primes(maxprime)             # <<<<<<<<<<<<<<
 * 
 *         # Initialize some constants
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_init_primes); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = __Pyx_PyInt_From_unsigned_long(__pyx_v_maxprime); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "cypari/pari_instance.pyx":617
 * 
 *         # Initialize some constants
 *         sig_on()             # <<<<<<<<<<<<<<
 *         self.PARI_ZERO = new_gen_noclear(gen_0)
 *         self.PARI_ONE = new_gen_noclear(gen_1)
 */
  __pyx_t_9 = sig_on(); if (unlikely(__pyx_t_9 == ((int)0))) __PYX_ERR(3, 617, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":618
 *         # Initialize some constants
 *         sig_on()
 *         self.PARI_ZERO = new_gen_noclear(gen_0)             # <<<<<<<<<<<<<<
 *         self.PARI_ONE = new_gen_noclear(gen_1)
 *         self.PARI_TWO = new_gen_noclear(gen_2)
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(gen_0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->PARI_ZERO);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->PARI_ZERO));
  __pyx_v_self->PARI_ZERO = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cypari/pari_instance.pyx":619
 *         sig_on()
 *         self.PARI_ZERO = new_gen_noclear(gen_0)
 *         self.PARI_ONE = new_gen_noclear(gen_1)             # <<<<<<<<<<<<<<
 *         self.PARI_TWO = new_gen_noclear(gen_2)
 *         sig_off()
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(gen_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->PARI_ONE);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->PARI_ONE));
  __pyx_v_self->PARI_ONE = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cypari/pari_instance.pyx":620
 *         self.PARI_ZERO = new_gen_noclear(gen_0)
 *         self.PARI_ONE = new_gen_noclear(gen_1)
 *         self.PARI_TWO = new_gen_noclear(gen_2)             # <<<<<<<<<<<<<<
 *         sig_off()
 * 
 */
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(gen_2)); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->PARI_TWO);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->PARI_TWO));
  __pyx_v_self->PARI_TWO = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cypari/pari_instance.pyx":621
 *         self.PARI_ONE = new_gen_noclear(gen_1)
 *         self.PARI_TWO = new_gen_noclear(gen_2)
 *         sig_off()             # <<<<<<<<<<<<<<
 * 
 *     def _close(self):
 */
  sig_off();

  /* "cypari/pari_instance.pyx":543
 *         factor_proven = 1
 * 
 *     def __init__(self, size_t size=8000000, size_t sizemax=0, unsigned long maxprime=500000):             # <<<<<<<<<<<<<<
 *         """
 *         (Re)-Initialize the PARI system.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cypari._pari.Pari.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":623
 *         sig_off()
 * 
 *     def _close(self):             # <<<<<<<<<<<<<<
 *         """
 *         Deallocate the PARI library.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_5_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_4_close[] = "\n        Deallocate the PARI library.\n\n        If you want to reallocate the PARI library again, construct\n        a new instance of :class:`Pari`.\n\n        EXAMPLES::\n\n            sage: from cypari._pari import Pari\n            sage: pari2 = Pari(10**7)\n            sage: pari2._close()\n            sage: pari2 = Pari(10**6)\n            sage: pari.stacksize()\n            1000000\n\n        .. WARNING::\n\n            Calling this method is dangerous since any further use of\n            PARI (by this :class:`Pari` or another\n            :class:`Pari` or even another non-Python library)\n            will result in a segmentation fault after calling\n            ``_close()``.\n\n            For this reason, the :class:`Pari` class never\n            deallocates PARI memory automatically.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_5_close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_close (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_4_close(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_4_close(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_close", 0);

  /* "cypari/pari_instance.pyx":651
 *         """
 *         global avma
 *         if avma:             # <<<<<<<<<<<<<<
 *             pari_close()
 *             avma = 0
 */
  __pyx_t_1 = (avma != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":652
 *         global avma
 *         if avma:
 *             pari_close()             # <<<<<<<<<<<<<<
 *             avma = 0
 * 
 */
    pari_close();

    /* "cypari/pari_instance.pyx":653
 *         if avma:
 *             pari_close()
 *             avma = 0             # <<<<<<<<<<<<<<
 * 
 *     def shut_up(self):
 */
    avma = 0;

    /* "cypari/pari_instance.pyx":651
 *         """
 *         global avma
 *         if avma:             # <<<<<<<<<<<<<<
 *             pari_close()
 *             avma = 0
 */
  }

  /* "cypari/pari_instance.pyx":623
 *         sig_off()
 * 
 *     def _close(self):             # <<<<<<<<<<<<<<
 *         """
 *         Deallocate the PARI library.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":655
 *             avma = 0
 * 
 *     def shut_up(self):             # <<<<<<<<<<<<<<
 *         global pariErr
 *         pariErr.putch = swallow_ch
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_7shut_up(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_7shut_up(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shut_up (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_6shut_up(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_6shut_up(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shut_up", 0);

  /* "cypari/pari_instance.pyx":657
 *     def shut_up(self):
 *         global pariErr
 *         pariErr.putch = swallow_ch             # <<<<<<<<<<<<<<
 *         pariErr.puts = swallow_s
 * 
 */
  pariErr->putch = __pyx_f_6cypari_5_pari_swallow_ch;

  /* "cypari/pari_instance.pyx":658
 *         global pariErr
 *         pariErr.putch = swallow_ch
 *         pariErr.puts = swallow_s             # <<<<<<<<<<<<<<
 * 
 *     def speak_up(self):
 */
  pariErr->puts = __pyx_f_6cypari_5_pari_swallow_s;

  /* "cypari/pari_instance.pyx":655
 *             avma = 0
 * 
 *     def shut_up(self):             # <<<<<<<<<<<<<<
 *         global pariErr
 *         pariErr.putch = swallow_ch
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":660
 *         pariErr.puts = swallow_s
 * 
 *     def speak_up(self):             # <<<<<<<<<<<<<<
 *         global pariErr
 *         pariErr.putch = sage_putchar
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_9speak_up(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_9speak_up(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("speak_up (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_8speak_up(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_8speak_up(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("speak_up", 0);

  /* "cypari/pari_instance.pyx":662
 *     def speak_up(self):
 *         global pariErr
 *         pariErr.putch = sage_putchar             # <<<<<<<<<<<<<<
 *         pariErr.puts = sage_puts
 * 
 */
  pariErr->putch = __pyx_f_6cypari_5_pari_sage_putchar;

  /* "cypari/pari_instance.pyx":663
 *         global pariErr
 *         pariErr.putch = sage_putchar
 *         pariErr.puts = sage_puts             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  pariErr->puts = __pyx_f_6cypari_5_pari_sage_puts;

  /* "cypari/pari_instance.pyx":660
 *         pariErr.puts = swallow_s
 * 
 *     def speak_up(self):             # <<<<<<<<<<<<<<
 *         global pariErr
 *         pariErr.putch = sage_putchar
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":666
 * 
 *     @property
 *     def UI_callback(self):             # <<<<<<<<<<<<<<
 *         return self._UI_callback
 *     @UI_callback.setter
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_11UI_callback_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_11UI_callback_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_11UI_callback___get__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_11UI_callback___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "cypari/pari_instance.pyx":667
 *     @property
 *     def UI_callback(self):
 *         return self._UI_callback             # <<<<<<<<<<<<<<
 *     @UI_callback.setter
 *     def UI_callback(self, callback):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_UI_callback);
  __pyx_r = __pyx_v_self->_UI_callback;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":666
 * 
 *     @property
 *     def UI_callback(self):             # <<<<<<<<<<<<<<
 *         return self._UI_callback
 *     @UI_callback.setter
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":669
 *         return self._UI_callback
 *     @UI_callback.setter
 *     def UI_callback(self, callback):             # <<<<<<<<<<<<<<
 *         self._UI_callback = callback
 * 
 */

/* Python wrapper */
static int __pyx_pw_6cypari_5_pari_4Pari_11UI_callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback); /*proto*/
static int __pyx_pw_6cypari_5_pari_4Pari_11UI_callback_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_callback) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_11UI_callback_2__set__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((PyObject *)__pyx_v_callback));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6cypari_5_pari_4Pari_11UI_callback_2__set__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_callback) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);

  /* "cypari/pari_instance.pyx":670
 *     @UI_callback.setter
 *     def UI_callback(self, callback):
 *         self._UI_callback = callback             # <<<<<<<<<<<<<<
 * 
 *     def debugstack(self):
 */
  __Pyx_INCREF(__pyx_v_callback);
  __Pyx_GIVEREF(__pyx_v_callback);
  __Pyx_GOTREF(__pyx_v_self->_UI_callback);
  __Pyx_DECREF(__pyx_v_self->_UI_callback);
  __pyx_v_self->_UI_callback = __pyx_v_callback;

  /* "cypari/pari_instance.pyx":669
 *         return self._UI_callback
 *     @UI_callback.setter
 *     def UI_callback(self, callback):             # <<<<<<<<<<<<<<
 *         self._UI_callback = callback
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":672
 *         self._UI_callback = callback
 * 
 *     def debugstack(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Print the internal PARI variables ``top`` (top of stack), ``avma``
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_11debugstack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_10debugstack[] = "\n        Print the internal PARI variables ``top`` (top of stack), ``avma``\n        (available memory address, think of this as the stack pointer),\n        ``bot`` (bottom of stack).\n\n        EXAMPLE::\n\n            sage: pari.debugstack()  # random\n            top =  0x60b2c60\n            avma = 0x5875c38\n            bot =  0x57295e0\n            size = 1000000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_11debugstack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("debugstack (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_10debugstack(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_10debugstack(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("debugstack", 0);

  /* "cypari/pari_instance.pyx":689
 *         # chances that something goes wrong here (for example, if we
 *         # are out of memory).
 *         printf("top =  %p\navma = %p\nbot =  %p\nsize = %lu\n",             # <<<<<<<<<<<<<<
 *             <void*>pari_mainstack.top,
 *             <void*>avma,
 */
  (void)(printf(((char const *)"top =  %p\navma = %p\nbot =  %p\nsize = %lu\n"), ((void *)pari_mainstack->top), ((void *)avma), ((void *)pari_mainstack->bot), ((unsigned long)pari_mainstack->rsize)));

  /* "cypari/pari_instance.pyx":694
 *             <void*>pari_mainstack.bot,
 *             <unsigned long>pari_mainstack.rsize)
 *         fflush(stdout)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  (void)(fflush(stdout));

  /* "cypari/pari_instance.pyx":672
 *         self._UI_callback = callback
 * 
 *     def debugstack(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Print the internal PARI variables ``top`` (top of stack), ``avma``
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":696
 *         fflush(stdout)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Interface to the PARI C library"
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_13__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_13__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_12__repr__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_12__repr__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cypari/pari_instance.pyx":697
 * 
 *     def __repr__(self):
 *         return "Interface to the PARI C library"             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_kp_s_Interface_to_the_PARI_C_library);
  __pyx_r = __pyx_kp_s_Interface_to_the_PARI_C_library;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":696
 *         fflush(stdout)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Interface to the PARI C library"
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":699
 *         return "Interface to the PARI C library"
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return 907629390   # hash('pari')
 * 
 */

/* Python wrapper */
static Py_hash_t __pyx_pw_6cypari_5_pari_4Pari_15__hash__(PyObject *__pyx_v_self); /*proto*/
static Py_hash_t __pyx_pw_6cypari_5_pari_4Pari_15__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_14__hash__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_6cypari_5_pari_4Pari_14__hash__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "cypari/pari_instance.pyx":700
 * 
 *     def __hash__(self):
 *         return 907629390   # hash('pari')             # <<<<<<<<<<<<<<
 * 
 *     def set_debug_level(self, level):
 */
  __pyx_r = 0x3619534E;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":699
 *         return "Interface to the PARI C library"
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         return 907629390   # hash('pari')
 * 
 */

  /* function exit code */
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":702
 *         return 907629390   # hash('pari')
 * 
 *     def set_debug_level(self, level):             # <<<<<<<<<<<<<<
 *         """
 *         Set the debug PARI C library variable.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_17set_debug_level(PyObject *__pyx_v_self, PyObject *__pyx_v_level); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_16set_debug_level[] = "\n        Set the debug PARI C library variable.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_17set_debug_level(PyObject *__pyx_v_self, PyObject *__pyx_v_level) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_debug_level (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_16set_debug_level(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((PyObject *)__pyx_v_level));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_16set_debug_level(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_level) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("set_debug_level", 0);

  /* "cypari/pari_instance.pyx":706
 *         Set the debug PARI C library variable.
 *         """
 *         self.default('debug', int(level))             # <<<<<<<<<<<<<<
 * 
 *     def get_debug_level(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_level); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_5 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_s_debug, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 706, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_n_s_debug, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 706, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  #endif
  {
    __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_n_s_debug);
    __Pyx_GIVEREF(__pyx_n_s_debug);
    PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_n_s_debug);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 706, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":702
 *         return 907629390   # hash('pari')
 * 
 *     def set_debug_level(self, level):             # <<<<<<<<<<<<<<
 *         """
 *         Set the debug PARI C library variable.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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_6);
  __Pyx_AddTraceback("cypari._pari.Pari.set_debug_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":708
 *         self.default('debug', int(level))
 * 
 *     def get_debug_level(self):             # <<<<<<<<<<<<<<
 *         """
 *         Set the debug PARI C library variable.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_19get_debug_level(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_18get_debug_level[] = "\n        Set the debug PARI C library variable.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_19get_debug_level(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_debug_level (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_18get_debug_level(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_18get_debug_level(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_debug_level", 0);

  /* "cypari/pari_instance.pyx":712
 *         Set the debug PARI C library variable.
 *         """
 *         return int(self.default('debug'))             # <<<<<<<<<<<<<<
 * 
 *     def set_real_precision_bits(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_default); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_debug) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_debug);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":708
 *         self.default('debug', int(level))
 * 
 *     def get_debug_level(self):             # <<<<<<<<<<<<<<
 *         """
 *         Set the debug PARI C library variable.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari.get_debug_level", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":714
 *         return int(self.default('debug'))
 * 
 *     def set_real_precision_bits(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the PARI default real precision in bits.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_21set_real_precision_bits(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_20set_real_precision_bits[] = "\n        Sets the PARI default real precision in bits.\n\n        This is used both for creation of new objects from strings and\n        for printing. It determines the number of digits in which real\n        numbers numbers are printed. It also determines the precision\n        of objects created by parsing strings (e.g. pari('1.2')), which\n        is *not* the normal way of creating new pari objects in Sage.\n        It has *no* effect on the precision of computations within the\n        PARI library.\n\n        .. seealso:: :meth:`set_real_precision` to set the\n           precision in decimal digits.\n\n        EXAMPLES::\n\n            sage: pari.set_real_precision_bits(200)\n            sage: pari('1.2')\n            1.20000000000000000000000000000000000000000000000000000000000\n            sage: pari.set_real_precision_bits(53)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_21set_real_precision_bits(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_real_precision_bits (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_20set_real_precision_bits(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_20set_real_precision_bits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_v_strn = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  char const *__pyx_t_5;
  __Pyx_RefNannySetupContext("set_real_precision_bits", 0);

  /* "cypari/pari_instance.pyx":736
 *             sage: pari.set_real_precision_bits(53)
 *         """
 *         cdef bytes strn = str(n).encode("ascii")             # <<<<<<<<<<<<<<
 *         sig_on()
 *         sd_realbitprecision(strn, d_SILENT)
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 736, __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_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_ascii);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(3, 736, __pyx_L1_error)
  __pyx_v_strn = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":737
 *         """
 *         cdef bytes strn = str(n).encode("ascii")
 *         sig_on()             # <<<<<<<<<<<<<<
 *         sd_realbitprecision(strn, d_SILENT)
 *         sig_off()
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(3, 737, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":738
 *         cdef bytes strn = str(n).encode("ascii")
 *         sig_on()
 *         sd_realbitprecision(strn, d_SILENT)             # <<<<<<<<<<<<<<
 *         sig_off()
 * 
 */
  if (unlikely(__pyx_v_strn == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(3, 738, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_strn); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(3, 738, __pyx_L1_error)
  (void)(sd_realbitprecision(__pyx_t_5, d_SILENT));

  /* "cypari/pari_instance.pyx":739
 *         sig_on()
 *         sd_realbitprecision(strn, d_SILENT)
 *         sig_off()             # <<<<<<<<<<<<<<
 * 
 *     def get_real_precision_bits(self):
 */
  sig_off();

  /* "cypari/pari_instance.pyx":714
 *         return int(self.default('debug'))
 * 
 *     def set_real_precision_bits(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the PARI default real precision in bits.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari.set_real_precision_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_strn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":741
 *         sig_off()
 * 
 *     def get_real_precision_bits(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the current PARI default real precision in bits.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_23get_real_precision_bits(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_22get_real_precision_bits[] = "\n        Return the current PARI default real precision in bits.\n\n        This is used both for creation of new objects from strings and\n        for printing. It determines the number of digits in which real\n        numbers numbers are printed. It also determines the precision\n        of objects created by parsing strings (e.g. pari('1.2')), which\n        is *not* the normal way of creating new pari objects in Sage.\n        It has *no* effect on the precision of computations within the\n        PARI library.\n\n        .. seealso:: :meth:`get_real_precision` to get the\n           precision in decimal digits.\n\n        EXAMPLES::\n\n            sage: pari.set_real_precision(15)\n            15\n            sage: pari.get_real_precision_bits()\n            50\n            sage: pari.set_real_precision_bits(53)\n            sage: pari.get_real_precision_bits()\n            53\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_23get_real_precision_bits(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_real_precision_bits (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_22get_real_precision_bits(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_22get_real_precision_bits(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  long __pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("get_real_precision_bits", 0);

  /* "cypari/pari_instance.pyx":767
 *         """
 *         cdef long r
 *         sig_on()             # <<<<<<<<<<<<<<
 *         r = <long>itos(sd_realbitprecision(NULL, d_RETURN))
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 767, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":768
 *         cdef long r
 *         sig_on()
 *         r = <long>itos(sd_realbitprecision(NULL, d_RETURN))             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return r
 */
  __pyx_v_r = ((long)itos(sd_realbitprecision(NULL, d_RETURN)));

  /* "cypari/pari_instance.pyx":769
 *         sig_on()
 *         r = <long>itos(sd_realbitprecision(NULL, d_RETURN))
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  sig_off();

  /* "cypari/pari_instance.pyx":770
 *         r = <long>itos(sd_realbitprecision(NULL, d_RETURN))
 *         sig_off()
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     def set_real_precision(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_r); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":741
 *         sig_off()
 * 
 *     def get_real_precision_bits(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the current PARI default real precision in bits.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari.get_real_precision_bits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":772
 *         return r
 * 
 *     def set_real_precision(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the PARI default real precision in decimal digits.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_25set_real_precision(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_24set_real_precision[] = "\n        Sets the PARI default real precision in decimal digits.\n\n        This is used both for creation of new objects from strings and for\n        printing. It is the number of digits *IN DECIMAL* in which real\n        numbers are printed. It also determines the precision of objects\n        created by parsing strings (e.g. pari('1.2')), which is *not* the\n        normal way of creating new PARI objects in CyPari2. It has *no*\n        effect on the precision of computations within the pari library.\n\n        Returns the previous PARI real precision.\n\n        .. seealso:: :meth:`set_real_precision_bits` to set the\n           precision in bits.\n\n        EXAMPLES::\n\n            sage: pari.set_real_precision(60)\n            15\n            sage: pari('1.2')\n            1.20000000000000000000000000000000000000000000000000000000000\n            sage: pari.set_real_precision(15)\n            60\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_25set_real_precision(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_real_precision (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 772, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.set_real_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_24set_real_precision(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_24set_real_precision(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n) {
  PyObject *__pyx_v_old = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("set_real_precision", 0);

  /* "cypari/pari_instance.pyx":797
 *             60
 *         """
 *         old = self.get_real_precision()             # <<<<<<<<<<<<<<
 *         self.set_real_precision_bits(prec_dec_to_bits(n))
 *         return old
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_real_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_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_1)) __PYX_ERR(3, 797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_old = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":798
 *         """
 *         old = self.get_real_precision()
 *         self.set_real_precision_bits(prec_dec_to_bits(n))             # <<<<<<<<<<<<<<
 *         return old
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_real_precision_bits); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_prec_dec_to_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":799
 *         old = self.get_real_precision()
 *         self.set_real_precision_bits(prec_dec_to_bits(n))
 *         return old             # <<<<<<<<<<<<<<
 * 
 *     def get_real_precision(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_old);
  __pyx_r = __pyx_v_old;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":772
 *         return r
 * 
 *     def set_real_precision(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the PARI default real precision in decimal digits.
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Pari.set_real_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_old);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":801
 *         return old
 * 
 *     def get_real_precision(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current PARI default real precision.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_27get_real_precision(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_26get_real_precision[] = "\n        Returns the current PARI default real precision.\n\n        This is used both for creation of new objects from strings and for\n        printing. It is the number of digits *IN DECIMAL* in which real\n        numbers are printed. It also determines the precision of objects\n        created by parsing strings (e.g. pari('1.2')), which is *not* the\n        normal way of creating new PARI objects in CyPari2. It has *no*\n        effect on the precision of computations within the pari library.\n\n        .. seealso:: :meth:`get_real_precision_bits` to get the\n           precision in bits.\n\n        EXAMPLES::\n\n            sage: pari.get_real_precision()\n            15\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_27get_real_precision(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_real_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_26get_real_precision(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_26get_real_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  long __pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("get_real_precision", 0);

  /* "cypari/pari_instance.pyx":821
 *         """
 *         cdef long r
 *         sig_on()             # <<<<<<<<<<<<<<
 *         r = itos(sd_realprecision(NULL, d_RETURN))
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 821, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":822
 *         cdef long r
 *         sig_on()
 *         r = itos(sd_realprecision(NULL, d_RETURN))             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return r
 */
  __pyx_v_r = itos(sd_realprecision(NULL, d_RETURN));

  /* "cypari/pari_instance.pyx":823
 *         sig_on()
 *         r = itos(sd_realprecision(NULL, d_RETURN))
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  sig_off();

  /* "cypari/pari_instance.pyx":824
 *         r = itos(sd_realprecision(NULL, d_RETURN))
 *         sig_off()
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     def set_series_precision(self, int n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_r); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 824, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":801
 *         return old
 * 
 *     def get_real_precision(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the current PARI default real precision.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari.get_real_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":826
 *         return r
 * 
 *     def set_series_precision(self, int n):             # <<<<<<<<<<<<<<
 *         global precdl
 *         precdl = n
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_29set_series_precision(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_29set_series_precision(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  int __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_series_precision (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 826, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.set_series_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_28set_series_precision(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((int)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_28set_series_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, int __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_series_precision", 0);

  /* "cypari/pari_instance.pyx":828
 *     def set_series_precision(self, int n):
 *         global precdl
 *         precdl = n             # <<<<<<<<<<<<<<
 * 
 *     def get_default_bit_precision(self):
 */
  precdl = __pyx_v_n;

  /* "cypari/pari_instance.pyx":826
 *         return r
 * 
 *     def set_series_precision(self, int n):             # <<<<<<<<<<<<<<
 *         global precdl
 *         precdl = n
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":830
 *         precdl = n
 * 
 *     def get_default_bit_precision(self):             # <<<<<<<<<<<<<<
 *         return default_bitprec()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_31get_default_bit_precision(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_31get_default_bit_precision(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_default_bit_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_30get_default_bit_precision(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_30get_default_bit_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_default_bit_precision", 0);

  /* "cypari/pari_instance.pyx":831
 * 
 *     def get_default_bit_precision(self):
 *         return default_bitprec()             # <<<<<<<<<<<<<<
 * 
 *     def set_default_bit_precision(self, int n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_f_6cypari_5_pari_default_bitprec(0, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":830
 *         precdl = n
 * 
 *     def get_default_bit_precision(self):             # <<<<<<<<<<<<<<
 *         return default_bitprec()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.get_default_bit_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":833
 *         return default_bitprec()
 * 
 *     def set_default_bit_precision(self, int n):             # <<<<<<<<<<<<<<
 *         """
 *         Set the default bit precision for real and complex gens.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_33set_default_bit_precision(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_32set_default_bit_precision[] = "\n        Set the default bit precision for real and complex gens.\n\n        >>> pari.get_default_bit_precision()\n        64\n        >>> pari.pi()\n        3.14159265358979\n        >>> pari.pi().precision()\n        3  # 64-bit\n        4  # 32-bit\n        >>> pari.set_default_bit_precision(212)\n        64\n        >>> pari.get_default_bit_precision()\n        256 # 64-bit\n        224 # 32-bit\n        >>> pari.pi()\n        3.14159265358979\n        >>> pari.pi().precision()\n        6  # 64-bit\n        9  # 32-bit\n        >>> old_real_precision = pari.set_real_precision(50)\n        >>> pari.pi()\n        3.1415926535897932384626433832795028841971693993751\n        >>> pari.set_default_bit_precision(64)\n        256 # 64-bit\n        224 # 32-bit\n        >>> pari.pi()\n        3.141592653589793239\n        >>> pari.set_real_precision(old_real_precision)\n        50\n        >>> pari.pi()\n        3.14159265358979\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_33set_default_bit_precision(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  int __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_default_bit_precision (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(3, 833, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.set_default_bit_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_32set_default_bit_precision(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((int)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_32set_default_bit_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, int __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  struct __pyx_opt_args_6cypari_5_pari_default_bitprec __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("set_default_bit_precision", 0);

  /* "cypari/pari_instance.pyx":867
 *         3.14159265358979
 *         """
 *         return default_bitprec(n)             # <<<<<<<<<<<<<<
 * 
 *     def get_series_precision(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.bitprec = __pyx_v_n;
  __pyx_t_1 = __pyx_f_6cypari_5_pari_default_bitprec(0, &__pyx_t_2); 
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":833
 *         return default_bitprec()
 * 
 *     def set_default_bit_precision(self, int n):             # <<<<<<<<<<<<<<
 *         """
 *         Set the default bit precision for real and complex gens.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari.set_default_bit_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":869
 *         return default_bitprec(n)
 * 
 *     def get_series_precision(self):             # <<<<<<<<<<<<<<
 *         return <int>precdl
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_35get_series_precision(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_35get_series_precision(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_series_precision (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_34get_series_precision(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_34get_series_precision(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_series_precision", 0);

  /* "cypari/pari_instance.pyx":870
 * 
 *     def get_series_precision(self):
 *         return <int>precdl             # <<<<<<<<<<<<<<
 * 
 *     def double_to_gen(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(((int)precdl)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":869
 *         return default_bitprec(n)
 * 
 *     def get_series_precision(self):             # <<<<<<<<<<<<<<
 *         return <int>precdl
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.get_series_precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":872
 *         return <int>precdl
 * 
 *     def double_to_gen(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Create a new Gen with the value of the double x, using Pari's
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_37double_to_gen(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_36double_to_gen[] = "\n        Create a new Gen with the value of the double x, using Pari's\n        dbltor.\n\n        EXAMPLES::\n\n            sage: pari.double_to_gen(1)\n            doctest:...: DeprecationWarning: pari.double_to_gen(x) is deprecated, use pari(x) instead\n            1.00000000000000\n            sage: pari.double_to_gen(1e30)\n            1.00000000000000 E30\n            sage: pari.double_to_gen(0)\n            0.E-15\n            sage: import math\n            sage: pari.double_to_gen(-math.sqrt(2))\n            -1.41421356237310\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_37double_to_gen(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("double_to_gen (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_36double_to_gen(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_36double_to_gen(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  __Pyx_RefNannySetupContext("double_to_gen", 0);

  /* "cypari/pari_instance.pyx":891
 *         """
 *         # Deprecated in https://trac.sagemath.org/ticket/20241
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn("pari.double_to_gen(x) is deprecated, use pari(x) instead", DeprecationWarning)
 *         return new_gen_from_double(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 891, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/pari_instance.pyx":892
 *         # Deprecated in https://trac.sagemath.org/ticket/20241
 *         from warnings import warn
 *         warn("pari.double_to_gen(x) is deprecated, use pari(x) instead", DeprecationWarning)             # <<<<<<<<<<<<<<
 *         return new_gen_from_double(x)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__41, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/pari_instance.pyx":893
 *         from warnings import warn
 *         warn("pari.double_to_gen(x) is deprecated, use pari(x) instead", DeprecationWarning)
 *         return new_gen_from_double(x)             # <<<<<<<<<<<<<<
 * 
 *     cpdef _real_coerced_to_bits_prec(self, double x, long bits):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_x); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(3, 893, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_from_double(__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":872
 *         return <int>precdl
 * 
 *     def double_to_gen(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Create a new Gen with the value of the double x, using Pari's
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari.double_to_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":895
 *         return new_gen_from_double(x)
 * 
 *     cpdef _real_coerced_to_bits_prec(self, double x, long bits):             # <<<<<<<<<<<<<<
 *         r"""
 *         Creates a PARI t_REAL with value given by the float x, coerced
 */

static PyObject *__pyx_pw_6cypari_5_pari_4Pari_39_real_coerced_to_bits_prec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_4Pari__real_coerced_to_bits_prec(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, double __pyx_v_x, long __pyx_v_bits, CYTHON_UNUSED int __pyx_skip_dispatch) {
  long __pyx_v_words;
  GEN __pyx_v_g;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("_real_coerced_to_bits_prec", 0);

  /* "cypari/pari_instance.pyx":916
 *         quad-double numbers to pari numbers.
 *         """
 *         cdef long words = prec_bits_to_words(bits)             # <<<<<<<<<<<<<<
 *         cdef GEN g
 *         sig_on()
 */
  __pyx_v_words = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_bits, 0);

  /* "cypari/pari_instance.pyx":918
 *         cdef long words = prec_bits_to_words(bits)
 *         cdef GEN g
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if x == 0:
 *             return new_gen(real_0_bit(-bits))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 918, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":919
 *         cdef GEN g
 *         sig_on()
 *         if x == 0:             # <<<<<<<<<<<<<<
 *             return new_gen(real_0_bit(-bits))
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_x == 0.0) != 0);
  if (__pyx_t_2) {

    /* "cypari/pari_instance.pyx":920
 *         sig_on()
 *         if x == 0:
 *             return new_gen(real_0_bit(-bits))             # <<<<<<<<<<<<<<
 *         else:
 *             g = dbltor(x)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(real_0_bit((-__pyx_v_bits)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 920, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":919
 *         cdef GEN g
 *         sig_on()
 *         if x == 0:             # <<<<<<<<<<<<<<
 *             return new_gen(real_0_bit(-bits))
 *         else:
 */
  }

  /* "cypari/pari_instance.pyx":922
 *             return new_gen(real_0_bit(-bits))
 *         else:
 *             g = dbltor(x)             # <<<<<<<<<<<<<<
 *             return new_gen(gtofp(g, words))
 * 
 */
  /*else*/ {
    __pyx_v_g = dbltor(__pyx_v_x);

    /* "cypari/pari_instance.pyx":923
 *         else:
 *             g = dbltor(x)
 *             return new_gen(gtofp(g, words))             # <<<<<<<<<<<<<<
 * 
 *     def complex(self, re, im):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gtofp(__pyx_v_g, __pyx_v_words))); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "cypari/pari_instance.pyx":895
 *         return new_gen_from_double(x)
 * 
 *     cpdef _real_coerced_to_bits_prec(self, double x, long bits):             # <<<<<<<<<<<<<<
 *         r"""
 *         Creates a PARI t_REAL with value given by the float x, coerced
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari._real_coerced_to_bits_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_39_real_coerced_to_bits_prec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_38_real_coerced_to_bits_prec[] = " \n        Creates a PARI t_REAL with value given by the float x, coerced\n        to at least the given precision.  The resulting gen object\n        will have word length (not including codewords) which is large\n        enough to provide the requested number of bits, but no larger.\n\n        >>> from cypari._pari import prec_bits_to_words\n        >>> old_precision = pari.set_real_precision(64)\n        >>> x = pari._real_coerced_to_bits_prec(1.23456789012345678, 100)\n        >>> x\n        1.23456789012345669043213547411141917109\n        >>> x.length() == prec_bits_to_words(100) - 2\n        True\n        >>> pari.set_real_precision(old_precision)\n        64\n\n        Here the pari Gen uses two 64 bit words to provide at least\n        100 bits of precision.  This can be used, for example, to convert\n        quad-double numbers to pari numbers.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_39_real_coerced_to_bits_prec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_x;
  long __pyx_v_bits;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_real_coerced_to_bits_prec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_bits,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bits)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_real_coerced_to_bits_prec", 1, 2, 2, 1); __PYX_ERR(3, 895, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_real_coerced_to_bits_prec") < 0)) __PYX_ERR(3, 895, __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_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(3, 895, __pyx_L3_error)
    __pyx_v_bits = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_bits == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 895, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_real_coerced_to_bits_prec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 895, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari._real_coerced_to_bits_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_38_real_coerced_to_bits_prec(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_x, __pyx_v_bits);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_38_real_coerced_to_bits_prec(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, double __pyx_v_x, long __pyx_v_bits) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_real_coerced_to_bits_prec", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6cypari_5_pari_4Pari__real_coerced_to_bits_prec(__pyx_v_self, __pyx_v_x, __pyx_v_bits, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 895, __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("cypari._pari.Pari._real_coerced_to_bits_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":925
 *             return new_gen(gtofp(g, words))
 * 
 *     def complex(self, re, im):             # <<<<<<<<<<<<<<
 *         """
 *         Create a new complex number, initialized from re and im.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_41complex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_40complex[] = "\n        Create a new complex number, initialized from re and im.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_41complex(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_re = 0;
  PyObject *__pyx_v_im = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("complex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_re,&__pyx_n_s_im,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_re)) != 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_im)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("complex", 1, 2, 2, 1); __PYX_ERR(3, 925, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "complex") < 0)) __PYX_ERR(3, 925, __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_re = values[0];
    __pyx_v_im = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("complex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 925, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.complex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_40complex(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_re, __pyx_v_im);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_40complex(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_re, PyObject *__pyx_v_im) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("complex", 0);

  /* "cypari/pari_instance.pyx":929
 *         Create a new complex number, initialized from re and im.
 *         """
 *         cdef Gen t0 = self(re)             # <<<<<<<<<<<<<<
 *         cdef Gen t1 = self(im)
 *         sig_on()
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = ((PyObject *)__pyx_v_self); __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_re) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_re);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(3, 929, __pyx_L1_error)
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":930
 *         """
 *         cdef Gen t0 = self(re)
 *         cdef Gen t1 = self(im)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(mkcomplex(t0.g, t1.g))
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = ((PyObject *)__pyx_v_self); __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_im) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_im);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(3, 930, __pyx_L1_error)
  __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":931
 *         cdef Gen t0 = self(re)
 *         cdef Gen t1 = self(im)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(mkcomplex(t0.g, t1.g))
 * 
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(3, 931, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":932
 *         cdef Gen t1 = self(im)
 *         sig_on()
 *         return new_gen(mkcomplex(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(mkcomplex(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":925
 *             return new_gen(gtofp(g, words))
 * 
 *     def complex(self, re, im):             # <<<<<<<<<<<<<<
 *         """
 *         Create a new complex number, initialized from re and im.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari.complex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":934
 *         return new_gen(mkcomplex(t0.g, t1.g))
 * 
 *     def __call__(self, s):             # <<<<<<<<<<<<<<
 *         """
 *         Create the PARI object obtained by evaluating s using PARI.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_43__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_42__call__[] = "\n        Create the PARI object obtained by evaluating s using PARI.\n\n        EXAMPLES::\n\n            sage: pari(0)\n            0\n            sage: pari([2,3,5])\n            [2, 3, 5]\n\n        ::\n\n            sage: a = pari(1); a, a.type()\n            (1, 't_INT')\n            sage: a = pari('1/2'); a, a.type()\n            (1/2, 't_FRAC')\n\n        See :func:`pari` for more examples.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_4Pari_42__call__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_43__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,0};
    PyObject* values[1] = {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  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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__call__") < 0)) __PYX_ERR(3, 934, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_s = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 934, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_42__call__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_s);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_42__call__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "cypari/pari_instance.pyx":954
 *         See :func:`pari` for more examples.
 *         """
 *         return objtogen(s)             # <<<<<<<<<<<<<<
 * 
 *     cpdef Gen zero(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":934
 *         return new_gen(mkcomplex(t0.g, t1.g))
 * 
 *     def __call__(self, s):             # <<<<<<<<<<<<<<
 *         """
 *         Create the PARI object obtained by evaluating s using PARI.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":956
 *         return objtogen(s)
 * 
 *     cpdef Gen zero(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

static PyObject *__pyx_pw_6cypari_5_pari_4Pari_45zero(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari_zero(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zero", 0);

  /* "cypari/pari_instance.pyx":963
 *             0
 *         """
 *         return self.PARI_ZERO             # <<<<<<<<<<<<<<
 * 
 *     cpdef Gen one(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->PARI_ZERO));
  __pyx_r = __pyx_v_self->PARI_ZERO;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":956
 *         return objtogen(s)
 * 
 *     cpdef Gen zero(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_45zero(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_44zero[] = "\n        EXAMPLES::\n\n            sage: pari.zero()\n            0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_45zero(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zero (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_44zero(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_44zero(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("zero", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_4Pari_zero(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 956, __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("cypari._pari.Pari.zero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":965
 *         return self.PARI_ZERO
 * 
 *     cpdef Gen one(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

static PyObject *__pyx_pw_6cypari_5_pari_4Pari_47one(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari_one(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, CYTHON_UNUSED int __pyx_skip_dispatch) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("one", 0);

  /* "cypari/pari_instance.pyx":972
 *             1
 *         """
 *         return self.PARI_ONE             # <<<<<<<<<<<<<<
 * 
 *     def new_with_bits_prec(self, s, long precision):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->PARI_ONE));
  __pyx_r = __pyx_v_self->PARI_ONE;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":965
 *         return self.PARI_ZERO
 * 
 *     cpdef Gen one(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_47one(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_46one[] = "\n        EXAMPLES::\n\n            sage: pari.one()\n            1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_47one(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("one (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_46one(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_46one(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("one", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_4Pari_one(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 965, __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("cypari._pari.Pari.one", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":974
 *         return self.PARI_ONE
 * 
 *     def new_with_bits_prec(self, s, long precision):             # <<<<<<<<<<<<<<
 *         r"""
 *         pari.new_with_bits_prec(self, s, precision) creates s as a PARI
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_49new_with_bits_prec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_48new_with_bits_prec[] = "\n        pari.new_with_bits_prec(self, s, precision) creates s as a PARI\n        Gen with (at most) precision *bits* of precision.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_49new_with_bits_prec(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("new_with_bits_prec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_precision,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_s)) != 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_precision)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("new_with_bits_prec", 1, 2, 2, 1); __PYX_ERR(3, 974, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "new_with_bits_prec") < 0)) __PYX_ERR(3, 974, __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_s = values[0];
    __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 974, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("new_with_bits_prec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 974, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.new_with_bits_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_48new_with_bits_prec(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_s, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_48new_with_bits_prec(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_s, long __pyx_v_precision) {
  unsigned long __pyx_v_old_prec;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  long __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("new_with_bits_prec", 0);

  /* "cypari/pari_instance.pyx":980
 *         """
 *         cdef unsigned long old_prec
 *         old_prec = <unsigned long>GP_DATA.fmt.sigd             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_dec(precision)
 *         if not precision:
 */
  __pyx_v_old_prec = ((unsigned long)GP_DATA->fmt->sigd);

  /* "cypari/pari_instance.pyx":981
 *         cdef unsigned long old_prec
 *         old_prec = <unsigned long>GP_DATA.fmt.sigd
 *         precision = prec_bits_to_dec(precision)             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = old_prec
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_prec_bits_to_dec); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 981, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_precision = __pyx_t_5;

  /* "cypari/pari_instance.pyx":982
 *         old_prec = <unsigned long>GP_DATA.fmt.sigd
 *         precision = prec_bits_to_dec(precision)
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = old_prec
 *         self.set_real_precision(precision)
 */
  __pyx_t_6 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_6) {

    /* "cypari/pari_instance.pyx":983
 *         precision = prec_bits_to_dec(precision)
 *         if not precision:
 *             precision = old_prec             # <<<<<<<<<<<<<<
 *         self.set_real_precision(precision)
 *         x = self(s)
 */
    __pyx_v_precision = __pyx_v_old_prec;

    /* "cypari/pari_instance.pyx":982
 *         old_prec = <unsigned long>GP_DATA.fmt.sigd
 *         precision = prec_bits_to_dec(precision)
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = old_prec
 *         self.set_real_precision(precision)
 */
  }

  /* "cypari/pari_instance.pyx":984
 *         if not precision:
 *             precision = old_prec
 *         self.set_real_precision(precision)             # <<<<<<<<<<<<<<
 *         x = self(s)
 *         self.set_real_precision(old_prec)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_real_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_precision); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":985
 *             precision = old_prec
 *         self.set_real_precision(precision)
 *         x = self(s)             # <<<<<<<<<<<<<<
 *         self.set_real_precision(old_prec)
 *         return x
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = ((PyObject *)__pyx_v_self); __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_s) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_s);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 985, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":986
 *         self.set_real_precision(precision)
 *         x = self(s)
 *         self.set_real_precision(old_prec)             # <<<<<<<<<<<<<<
 *         return x
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_real_precision); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_long(__pyx_v_old_prec); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":987
 *         x = self(s)
 *         self.set_real_precision(old_prec)
 *         return x             # <<<<<<<<<<<<<<
 * 
 *     ############################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_x);
  __pyx_r = __pyx_v_x;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":974
 *         return self.PARI_ONE
 * 
 *     def new_with_bits_prec(self, s, long precision):             # <<<<<<<<<<<<<<
 *         r"""
 *         pari.new_with_bits_prec(self, s, precision) creates s as a PARI
 */

  /* 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("cypari._pari.Pari.new_with_bits_prec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":993
 *     ############################################################
 * 
 *     def stacksize(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the current size of the PARI stack, which is `10^6`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_51stacksize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_50stacksize[] = "\n        Return the current size of the PARI stack, which is `10^6`\n        by default.  However, the stack size is automatically doubled\n        when needed up to some maximum.\n\n        .. SEEALSO::\n\n            - :meth:`stacksizemax` to get the maximum stack size\n            - :meth:`allocatemem` to change the current or maximum\n              stack size\n\n        EXAMPLES::\n\n            sage: pari.stacksize() # random\n            1000000\n            sage: pari.allocatemem(2**18, silent=True)\n            sage: pari.stacksize()\n            262144\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_51stacksize(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stacksize (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_50stacksize(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_50stacksize(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("stacksize", 0);

  /* "cypari/pari_instance.pyx":1013
 *             262144
 *         """
 *         return pari_mainstack.size             # <<<<<<<<<<<<<<
 * 
 *     def stacksizemax(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(pari_mainstack->size); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":993
 *     ############################################################
 * 
 *     def stacksize(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the current size of the PARI stack, which is `10^6`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.stacksize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1015
 *         return pari_mainstack.size
 * 
 *     def stacksizemax(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the maximum size of the PARI stack, which is determined
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_53stacksizemax(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_52stacksizemax[] = "\n        Return the maximum size of the PARI stack, which is determined\n        at startup in terms of available memory. Usually, the PARI\n        stack size is (much) smaller than this maximum but the stack\n        will be increased up to this maximum if needed.\n\n        .. SEEALSO::\n\n            - :meth:`stacksize` to get the current stack size\n            - :meth:`allocatemem` to change the current or maximum\n              stack size\n\n        EXAMPLES::\n\n            sage: pari.allocatemem(2**18, 2**26, silent=True)\n            sage: pari.stacksizemax()\n            67108864\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_53stacksizemax(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("stacksizemax (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_52stacksizemax(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_52stacksizemax(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("stacksizemax", 0);

  /* "cypari/pari_instance.pyx":1034
 *             67108864
 *         """
 *         return pari_mainstack.vsize             # <<<<<<<<<<<<<<
 * 
 *     def allocatemem(self, size_t s=0, size_t sizemax=0, *, silent=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(pari_mainstack->vsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1015
 *         return pari_mainstack.size
 * 
 *     def stacksizemax(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the maximum size of the PARI stack, which is determined
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.stacksizemax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1036
 *         return pari_mainstack.vsize
 * 
 *     def allocatemem(self, size_t s=0, size_t sizemax=0, *, silent=False):             # <<<<<<<<<<<<<<
 *         r"""
 *         Change the PARI stack space to the given size ``s`` (or double
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_55allocatemem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_54allocatemem[] = "\n        Change the PARI stack space to the given size ``s`` (or double\n        the current size if ``s`` is `0`) and change the maximum stack\n        size to ``sizemax``.\n\n        PARI tries to use only its current stack (the size which is set\n        by ``s``), but it will increase its stack if needed up to the\n        maximum size which is set by ``sizemax``.\n\n        The PARI stack is never automatically shrunk.  You can use the\n        command ``pari.allocatemem(10**6)`` to reset the size to `10^6`,\n        which is the default size at startup.  Note that the results of\n        computations using Sage's PARI interface are copied to the\n        Python heap, so they take up no space in the PARI stack.\n        The PARI stack is cleared after every computation.\n\n        It does no real harm to set this to a small value as the PARI\n        stack will be automatically doubled when we run out of memory.\n\n        INPUT:\n\n        - ``s`` - an integer (default: 0).  A non-zero argument is the\n          size in bytes of the new PARI stack.  If `s` is zero, double\n          the current stack size.\n\n        - ``sizemax`` - an integer (default: 0).  A non-zero argument\n          is the maximum size in bytes of the PARI stack.  If\n          ``sizemax`` is 0, the maximum of the current maximum and\n          ``s`` is taken.\n\n        EXAMPLES::\n\n            sage: pari.allocatemem(10**7)\n            PARI stack size set to 10000000 bytes, maximum size set to ...\n            sage: pari.allocatemem()  # Double the current size\n            PARI stack size set to 20000000 bytes, maximum size set to ...\n            sage: pari.stacksize()\n            20000000\n            sage: pari.allocatemem(10**6)\n            PARI stack size set to 1000000 bytes, maximum size set to ...\n\n        The following computation will automatically increase the PARI\n        stack size::\n\n            sage: a = pari('2^100000000')\n\n        ``a`` is now a Python vari""able on the Python heap and does not\n        take up any space on the PARI stack.  The PARI stack is still\n        large because of the computation of ``a``::\n\n            sage: pari.stacksize()  # random\n            12500264\n\n        Setting a small maximum size makes this fail::\n\n            sage: pari.allocatemem(10**6, 2**22)\n            PARI stack size set to 1000000 bytes, maximum size set to ...\n            sage: a = pari('2^100000000')\n            Traceback (most recent call last):\n            ...\n            PariError: _^s: the PARI stack overflows (current size: 1000000; maximum size: 4194304)\n            You can use pari.allocatemem() to change the stack size and try again\n\n        TESTS:\n\n        Do the same without using the string interface and starting\n        from a very small stack size::\n\n            sage: pari.allocatemem(1, 2**26)\n            PARI stack size set to 1024 bytes, maximum size set to ...\n            sage: a = pari(2)**100000000\n            sage: pari.stacksize()  # random\n            12500024\n\n        We do not allow ``sizemax`` less than ``s``::\n\n            sage: pari.allocatemem(10**7, 10**6)\n            Traceback (most recent call last):\n            ...\n            ValueError: the maximum size (10000000) should be at least the stack size (1000000)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_55allocatemem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  size_t __pyx_v_s;
  size_t __pyx_v_sizemax;
  PyObject *__pyx_v_silent = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allocatemem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_sizemax,&__pyx_n_s_silent,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)Py_False);
    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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sizemax);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (kw_args == 1) {
        const Py_ssize_t index = 2;
        PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]);
        if (value) { values[index] = value; kw_args--; }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "allocatemem") < 0)) __PYX_ERR(3, 1036, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_s = __Pyx_PyInt_As_size_t(values[0]); if (unlikely((__pyx_v_s == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 1036, __pyx_L3_error)
    } else {
      __pyx_v_s = ((size_t)0);
    }
    if (values[1]) {
      __pyx_v_sizemax = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v_sizemax == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 1036, __pyx_L3_error)
    } else {
      __pyx_v_sizemax = ((size_t)0);
    }
    __pyx_v_silent = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("allocatemem", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1036, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.allocatemem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_54allocatemem(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_s, __pyx_v_sizemax, __pyx_v_silent);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_54allocatemem(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, size_t __pyx_v_s, size_t __pyx_v_sizemax, PyObject *__pyx_v_silent) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("allocatemem", 0);

  /* "cypari/pari_instance.pyx":1118
 *             ValueError: the maximum size (10000000) should be at least the stack size (1000000)
 *         """
 *         if s == 0:             # <<<<<<<<<<<<<<
 *             s = pari_mainstack.size * 2
 *             if s < pari_mainstack.size:
 */
  __pyx_t_1 = ((__pyx_v_s == 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":1119
 *         """
 *         if s == 0:
 *             s = pari_mainstack.size * 2             # <<<<<<<<<<<<<<
 *             if s < pari_mainstack.size:
 *                 raise OverflowError("cannot double stack size")
 */
    __pyx_v_s = (pari_mainstack->size * 2);

    /* "cypari/pari_instance.pyx":1120
 *         if s == 0:
 *             s = pari_mainstack.size * 2
 *             if s < pari_mainstack.size:             # <<<<<<<<<<<<<<
 *                 raise OverflowError("cannot double stack size")
 *         elif s < 1024:
 */
    __pyx_t_1 = ((__pyx_v_s < pari_mainstack->size) != 0);
    if (unlikely(__pyx_t_1)) {

      /* "cypari/pari_instance.pyx":1121
 *             s = pari_mainstack.size * 2
 *             if s < pari_mainstack.size:
 *                 raise OverflowError("cannot double stack size")             # <<<<<<<<<<<<<<
 *         elif s < 1024:
 *             s = 1024  # arbitrary minimum size
 */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_OverflowError, __pyx_tuple__42, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1121, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(3, 1121, __pyx_L1_error)

      /* "cypari/pari_instance.pyx":1120
 *         if s == 0:
 *             s = pari_mainstack.size * 2
 *             if s < pari_mainstack.size:             # <<<<<<<<<<<<<<
 *                 raise OverflowError("cannot double stack size")
 *         elif s < 1024:
 */
    }

    /* "cypari/pari_instance.pyx":1118
 *             ValueError: the maximum size (10000000) should be at least the stack size (1000000)
 *         """
 *         if s == 0:             # <<<<<<<<<<<<<<
 *             s = pari_mainstack.size * 2
 *             if s < pari_mainstack.size:
 */
    goto __pyx_L3;
  }

  /* "cypari/pari_instance.pyx":1122
 *             if s < pari_mainstack.size:
 *                 raise OverflowError("cannot double stack size")
 *         elif s < 1024:             # <<<<<<<<<<<<<<
 *             s = 1024  # arbitrary minimum size
 *         if sizemax == 0:
 */
  __pyx_t_1 = ((__pyx_v_s < 0x400) != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":1123
 *                 raise OverflowError("cannot double stack size")
 *         elif s < 1024:
 *             s = 1024  # arbitrary minimum size             # <<<<<<<<<<<<<<
 *         if sizemax == 0:
 *             # For the default sizemax, use the maximum of current
 */
    __pyx_v_s = 0x400;

    /* "cypari/pari_instance.pyx":1122
 *             if s < pari_mainstack.size:
 *                 raise OverflowError("cannot double stack size")
 *         elif s < 1024:             # <<<<<<<<<<<<<<
 *             s = 1024  # arbitrary minimum size
 *         if sizemax == 0:
 */
  }
  __pyx_L3:;

  /* "cypari/pari_instance.pyx":1124
 *         elif s < 1024:
 *             s = 1024  # arbitrary minimum size
 *         if sizemax == 0:             # <<<<<<<<<<<<<<
 *             # For the default sizemax, use the maximum of current
 *             # sizemax and the given size s.
 */
  __pyx_t_1 = ((__pyx_v_sizemax == 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":1127
 *             # For the default sizemax, use the maximum of current
 *             # sizemax and the given size s.
 *             if pari_mainstack.vsize > s:             # <<<<<<<<<<<<<<
 *                 sizemax = pari_mainstack.vsize
 *             else:
 */
    __pyx_t_1 = ((pari_mainstack->vsize > __pyx_v_s) != 0);
    if (__pyx_t_1) {

      /* "cypari/pari_instance.pyx":1128
 *             # sizemax and the given size s.
 *             if pari_mainstack.vsize > s:
 *                 sizemax = pari_mainstack.vsize             # <<<<<<<<<<<<<<
 *             else:
 *                 sizemax = s
 */
      __pyx_t_3 = pari_mainstack->vsize;
      __pyx_v_sizemax = __pyx_t_3;

      /* "cypari/pari_instance.pyx":1127
 *             # For the default sizemax, use the maximum of current
 *             # sizemax and the given size s.
 *             if pari_mainstack.vsize > s:             # <<<<<<<<<<<<<<
 *                 sizemax = pari_mainstack.vsize
 *             else:
 */
      goto __pyx_L6;
    }

    /* "cypari/pari_instance.pyx":1130
 *                 sizemax = pari_mainstack.vsize
 *             else:
 *                 sizemax = s             # <<<<<<<<<<<<<<
 *         elif sizemax < s:
 *             raise ValueError("the maximum size ({}) should be at least the stack size ({})".format(s, sizemax))
 */
    /*else*/ {
      __pyx_v_sizemax = __pyx_v_s;
    }
    __pyx_L6:;

    /* "cypari/pari_instance.pyx":1124
 *         elif s < 1024:
 *             s = 1024  # arbitrary minimum size
 *         if sizemax == 0:             # <<<<<<<<<<<<<<
 *             # For the default sizemax, use the maximum of current
 *             # sizemax and the given size s.
 */
    goto __pyx_L5;
  }

  /* "cypari/pari_instance.pyx":1131
 *             else:
 *                 sizemax = s
 *         elif sizemax < s:             # <<<<<<<<<<<<<<
 *             raise ValueError("the maximum size ({}) should be at least the stack size ({})".format(s, sizemax))
 *         sig_on()
 */
  __pyx_t_1 = ((__pyx_v_sizemax < __pyx_v_s) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/pari_instance.pyx":1132
 *                 sizemax = s
 *         elif sizemax < s:
 *             raise ValueError("the maximum size ({}) should be at least the stack size ({})".format(s, sizemax))             # <<<<<<<<<<<<<<
 *         sig_on()
 *         paristack_setsize(s, sizemax)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_the_maximum_size_should_be_at_le, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_s); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_sizemax); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1132, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_5, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1132, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 1132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(3, 1132, __pyx_L1_error)

    /* "cypari/pari_instance.pyx":1131
 *             else:
 *                 sizemax = s
 *         elif sizemax < s:             # <<<<<<<<<<<<<<
 *             raise ValueError("the maximum size ({}) should be at least the stack size ({})".format(s, sizemax))
 *         sig_on()
 */
  }
  __pyx_L5:;

  /* "cypari/pari_instance.pyx":1133
 *         elif sizemax < s:
 *             raise ValueError("the maximum size ({}) should be at least the stack size ({})".format(s, sizemax))
 *         sig_on()             # <<<<<<<<<<<<<<
 *         paristack_setsize(s, sizemax)
 *         sig_off()
 */
  __pyx_t_8 = sig_on(); if (unlikely(__pyx_t_8 == ((int)0))) __PYX_ERR(3, 1133, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1134
 *             raise ValueError("the maximum size ({}) should be at least the stack size ({})".format(s, sizemax))
 *         sig_on()
 *         paristack_setsize(s, sizemax)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         if not silent:
 */
  paristack_setsize(__pyx_v_s, __pyx_v_sizemax);

  /* "cypari/pari_instance.pyx":1135
 *         sig_on()
 *         paristack_setsize(s, sizemax)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         if not silent:
 *             print("PARI stack size set to {} bytes, maximum size set to {}".
 */
  sig_off();

  /* "cypari/pari_instance.pyx":1136
 *         paristack_setsize(s, sizemax)
 *         sig_off()
 *         if not silent:             # <<<<<<<<<<<<<<
 *             print("PARI stack size set to {} bytes, maximum size set to {}".
 *                 format(self.stacksize(), self.stacksizemax()))
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_silent); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 1136, __pyx_L1_error)
  __pyx_t_10 = ((!__pyx_t_1) != 0);
  if (__pyx_t_10) {

    /* "cypari/pari_instance.pyx":1137
 *         sig_off()
 *         if not silent:
 *             print("PARI stack size set to {} bytes, maximum size set to {}".             # <<<<<<<<<<<<<<
 *                 format(self.stacksize(), self.stacksizemax()))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_PARI_stack_size_set_to_bytes_max, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "cypari/pari_instance.pyx":1138
 *         if not silent:
 *             print("PARI stack size set to {} bytes, maximum size set to {}".
 *                 format(self.stacksize(), self.stacksizemax()))             # <<<<<<<<<<<<<<
 * 
 *     def pari_version(self):
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stacksize); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_9 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_stacksizemax); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1138, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_9, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1138, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_9, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1138, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 1138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_6);
      __pyx_t_9 = 0;
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1138, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__Pyx_PrintOne(0, __pyx_t_4) < 0) __PYX_ERR(3, 1137, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/pari_instance.pyx":1136
 *         paristack_setsize(s, sizemax)
 *         sig_off()
 *         if not silent:             # <<<<<<<<<<<<<<
 *             print("PARI stack size set to {} bytes, maximum size set to {}".
 *                 format(self.stacksize(), self.stacksizemax()))
 */
  }

  /* "cypari/pari_instance.pyx":1036
 *         return pari_mainstack.vsize
 * 
 *     def allocatemem(self, size_t s=0, size_t sizemax=0, *, silent=False):             # <<<<<<<<<<<<<<
 *         r"""
 *         Change the PARI stack space to the given size ``s`` (or double
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cypari._pari.Pari.allocatemem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1140
 *                 format(self.stacksize(), self.stacksizemax()))
 * 
 *     def pari_version(self):             # <<<<<<<<<<<<<<
 *         return str(PARIVERSION)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_57pari_version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_57pari_version(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pari_version (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_56pari_version(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_56pari_version(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pari_version", 0);

  /* "cypari/pari_instance.pyx":1141
 * 
 *     def pari_version(self):
 *         return str(PARIVERSION)             # <<<<<<<<<<<<<<
 * 
 *     def init_primes(self, unsigned long M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(PARIVERSION); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1140
 *                 format(self.stacksize(), self.stacksizemax()))
 * 
 *     def pari_version(self):             # <<<<<<<<<<<<<<
 *         return str(PARIVERSION)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari.pari_version", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1143
 *         return str(PARIVERSION)
 * 
 *     def init_primes(self, unsigned long M):             # <<<<<<<<<<<<<<
 *         """
 *         Recompute the primes table including at least all primes up to M
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_59init_primes(PyObject *__pyx_v_self, PyObject *__pyx_arg_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_58init_primes[] = "\n        Recompute the primes table including at least all primes up to M\n        (but possibly more).\n\n        EXAMPLES::\n\n            sage: pari.init_primes(200000)\n\n        We make sure that ticket :trac:`11741` has been fixed::\n\n            sage: pari.init_primes(2**30)\n            Traceback (most recent call last):\n            ...\n            ValueError: Cannot compute primes beyond 436273290\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_59init_primes(PyObject *__pyx_v_self, PyObject *__pyx_arg_M) {
  unsigned long __pyx_v_M;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init_primes (wrapper)", 0);
  assert(__pyx_arg_M); {
    __pyx_v_M = __Pyx_PyInt_As_unsigned_long(__pyx_arg_M); if (unlikely((__pyx_v_M == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1143, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.init_primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_58init_primes(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((unsigned long)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_58init_primes(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, unsigned long __pyx_v_M) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("init_primes", 0);

  /* "cypari/pari_instance.pyx":1160
 *         """
 *         # Hardcoded bound in PARI sources
 *         if M > 436273290:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot compute primes beyond 436273290")
 * 
 */
  __pyx_t_1 = ((__pyx_v_M > 0x1A01008A) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/pari_instance.pyx":1161
 *         # Hardcoded bound in PARI sources
 *         if M > 436273290:
 *             raise ValueError("Cannot compute primes beyond 436273290")             # <<<<<<<<<<<<<<
 * 
 *         if M <= maxprime():
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1161, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(3, 1161, __pyx_L1_error)

    /* "cypari/pari_instance.pyx":1160
 *         """
 *         # Hardcoded bound in PARI sources
 *         if M > 436273290:             # <<<<<<<<<<<<<<
 *             raise ValueError("Cannot compute primes beyond 436273290")
 * 
 */
  }

  /* "cypari/pari_instance.pyx":1163
 *             raise ValueError("Cannot compute primes beyond 436273290")
 * 
 *         if M <= maxprime():             # <<<<<<<<<<<<<<
 *             return
 *         sig_on()
 */
  __pyx_t_1 = ((__pyx_v_M <= maxprime()) != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":1164
 * 
 *         if M <= maxprime():
 *             return             # <<<<<<<<<<<<<<
 *         sig_on()
 *         initprimetable(M)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":1163
 *             raise ValueError("Cannot compute primes beyond 436273290")
 * 
 *         if M <= maxprime():             # <<<<<<<<<<<<<<
 *             return
 *         sig_on()
 */
  }

  /* "cypari/pari_instance.pyx":1165
 *         if M <= maxprime():
 *             return
 *         sig_on()             # <<<<<<<<<<<<<<
 *         initprimetable(M)
 *         sig_off()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(3, 1165, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1166
 *             return
 *         sig_on()
 *         initprimetable(M)             # <<<<<<<<<<<<<<
 *         sig_off()
 * 
 */
  initprimetable(__pyx_v_M);

  /* "cypari/pari_instance.pyx":1167
 *         sig_on()
 *         initprimetable(M)
 *         sig_off()             # <<<<<<<<<<<<<<
 * 
 *     def primes(self, n=None, end=None):
 */
  sig_off();

  /* "cypari/pari_instance.pyx":1143
 *         return str(PARIVERSION)
 * 
 *     def init_primes(self, unsigned long M):             # <<<<<<<<<<<<<<
 *         """
 *         Recompute the primes table including at least all primes up to M
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari.init_primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1169
 *         sig_off()
 * 
 *     def primes(self, n=None, end=None):             # <<<<<<<<<<<<<<
 *         """
 *         Return a pari vector containing the first `n` primes, the primes
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_61primes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_60primes[] = "\n        Return a pari vector containing the first `n` primes, the primes\n        in the interval `[n, end]`, or the primes up to `end`.\n\n        INPUT:\n\n        Either\n\n        - ``n`` -- integer\n\n        or\n\n        - ``n`` -- list or tuple `[a, b]` defining an interval of primes\n\n        or\n\n        - ``n, end`` -- start and end point of an interval of primes\n\n        or\n\n        - ``end`` -- end point for the list of primes\n\n        OUTPUT: a PARI list of prime numbers\n\n        EXAMPLES::\n\n            sage: pari.primes(3)\n            [2, 3, 5]\n            sage: pari.primes(10)\n            [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n            sage: pari.primes(20)\n            [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]\n            sage: len(pari.primes(1000))\n            1000\n            sage: pari.primes(11,29)\n            [11, 13, 17, 19, 23, 29]\n            sage: pari.primes((11,29))\n            [11, 13, 17, 19, 23, 29]\n            sage: pari.primes(end=29)\n            [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n            sage: pari.primes(10**30, 10**30 + 100)\n            [1000000000000000000000000000057, 1000000000000000000000000000099]\n\n        TESTS::\n\n            sage: pari.primes(0)\n            []\n            sage: pari.primes(-1)\n            []\n            sage: pari.primes(end=1)\n            []\n            sage: pari.primes(end=-1)\n            []\n            sage: pari.primes(3,2)\n            []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_61primes(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primes (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_end,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "primes") < 0)) __PYX_ERR(3, 1169, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_n = values[0];
    __pyx_v_end = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("primes", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1169, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_60primes(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_n, __pyx_v_end);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_60primes(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_end) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("primes", 0);

  /* "cypari/pari_instance.pyx":1227
 *         """
 *         cdef Gen t0, t1
 *         if end is None:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(n)
 *             sig_on()
 */
  __pyx_t_1 = (__pyx_v_end == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/pari_instance.pyx":1228
 *         cdef Gen t0, t1
 *         if end is None:
 *             t0 = objtogen(n)             # <<<<<<<<<<<<<<
 *             sig_on()
 *             return new_gen(primes0(t0.g))
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1228, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/pari_instance.pyx":1229
 *         if end is None:
 *             t0 = objtogen(n)
 *             sig_on()             # <<<<<<<<<<<<<<
 *             return new_gen(primes0(t0.g))
 *         elif n is None:
 */
    __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(3, 1229, __pyx_L1_error)

    /* "cypari/pari_instance.pyx":1230
 *             t0 = objtogen(n)
 *             sig_on()
 *             return new_gen(primes0(t0.g))             # <<<<<<<<<<<<<<
 *         elif n is None:
 *             t0 = self.PARI_TWO  # First prime
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(primes0(__pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1230, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":1227
 *         """
 *         cdef Gen t0, t1
 *         if end is None:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(n)
 *             sig_on()
 */
  }

  /* "cypari/pari_instance.pyx":1231
 *             sig_on()
 *             return new_gen(primes0(t0.g))
 *         elif n is None:             # <<<<<<<<<<<<<<
 *             t0 = self.PARI_TWO  # First prime
 *         else:
 */
  __pyx_t_2 = (__pyx_v_n == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":1232
 *             return new_gen(primes0(t0.g))
 *         elif n is None:
 *             t0 = self.PARI_TWO  # First prime             # <<<<<<<<<<<<<<
 *         else:
 *             t0 = objtogen(n)
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->PARI_TWO);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/pari_instance.pyx":1231
 *             sig_on()
 *             return new_gen(primes0(t0.g))
 *         elif n is None:             # <<<<<<<<<<<<<<
 *             t0 = self.PARI_TWO  # First prime
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/pari_instance.pyx":1234
 *             t0 = self.PARI_TWO  # First prime
 *         else:
 *             t0 = objtogen(n)             # <<<<<<<<<<<<<<
 *         t1 = objtogen(end)
 *         sig_on()
 */
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "cypari/pari_instance.pyx":1235
 *         else:
 *             t0 = objtogen(n)
 *         t1 = objtogen(end)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(primes_interval(t0.g, t1.g))
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_end, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cypari/pari_instance.pyx":1236
 *             t0 = objtogen(n)
 *         t1 = objtogen(end)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(primes_interval(t0.g, t1.g))
 * 
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(3, 1236, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1237
 *         t1 = objtogen(end)
 *         sig_on()
 *         return new_gen(primes_interval(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     euler = Pari_auto.Euler
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(primes_interval(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1169
 *         sig_off()
 * 
 *     def primes(self, n=None, end=None):             # <<<<<<<<<<<<<<
 *         """
 *         Return a pari vector containing the first `n` primes, the primes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari.primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1242
 *     pi = Pari_auto.Pi
 * 
 *     def polchebyshev(self, long n, v=None):             # <<<<<<<<<<<<<<
 *         """
 *         Chebyshev polynomial of the first kind of degree `n`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_63polchebyshev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_62polchebyshev[] = "\n        Chebyshev polynomial of the first kind of degree `n`,\n        in the variable `v`.\n\n        EXAMPLES::\n\n            sage: pari.polchebyshev(7)\n            64*x^7 - 112*x^5 + 56*x^3 - 7*x\n            sage: pari.polchebyshev(7, 'z')\n            64*z^7 - 112*z^5 + 56*z^3 - 7*z\n            sage: pari.polchebyshev(0)\n            1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_63polchebyshev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polchebyshev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polchebyshev") < 0)) __PYX_ERR(3, 1242, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1242, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polchebyshev", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1242, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.polchebyshev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_62polchebyshev(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_n, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_62polchebyshev(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polchebyshev", 0);

  /* "cypari/pari_instance.pyx":1256
 *             1
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(polchebyshev1(n, get_var(v)))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 1256, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1257
 *         """
 *         sig_on()
 *         return new_gen(polchebyshev1(n, get_var(v)))             # <<<<<<<<<<<<<<
 * 
 *     def factorial(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_2 == ((long)-2L))) __PYX_ERR(3, 1257, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(polchebyshev1(__pyx_v_n, __pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1242
 *     pi = Pari_auto.Pi
 * 
 *     def polchebyshev(self, long n, v=None):             # <<<<<<<<<<<<<<
 *         """
 *         Chebyshev polynomial of the first kind of degree `n`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari.polchebyshev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1259
 *         return new_gen(polchebyshev1(n, get_var(v)))
 * 
 *     def factorial(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the factorial of the integer n as a PARI gen.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_65factorial(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_64factorial[] = "\n        Return the factorial of the integer n as a PARI gen.\n\n        EXAMPLES::\n\n            sage: pari.factorial(0)\n            1\n            sage: pari.factorial(1)\n            1\n            sage: pari.factorial(5)\n            120\n            sage: pari.factorial(25)\n            15511210043330985984000000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_65factorial(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorial (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1259, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.factorial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_64factorial(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_64factorial(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("factorial", 0);

  /* "cypari/pari_instance.pyx":1274
 *             15511210043330985984000000
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(mpfact(n))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 1274, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1275
 *         """
 *         sig_on()
 *         return new_gen(mpfact(n))             # <<<<<<<<<<<<<<
 * 
 *     def polsubcyclo(self, long n, long d, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(mpfact(__pyx_v_n))); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1259
 *         return new_gen(polchebyshev1(n, get_var(v)))
 * 
 *     def factorial(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the factorial of the integer n as a PARI gen.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari.factorial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1277
 *         return new_gen(mpfact(n))
 * 
 *     def polsubcyclo(self, long n, long d, v=None):             # <<<<<<<<<<<<<<
 *         """
 *         polsubcyclo(n, d, v=x): return the pari list of polynomial(s)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_67polsubcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_66polsubcyclo[] = "\n        polsubcyclo(n, d, v=x): return the pari list of polynomial(s)\n        defining the sub-abelian extensions of degree `d` of the\n        cyclotomic field `\\QQ(\\zeta_n)`, where `d`\n        divides `\\phi(n)`.\n\n        EXAMPLES::\n\n            sage: pari.polsubcyclo(8, 4)\n            [x^4 + 1]\n            sage: pari.polsubcyclo(8, 2, 'z')\n            [z^2 + 2, z^2 - 2, z^2 + 1]\n            sage: pari.polsubcyclo(8, 1)\n            [x - 1]\n            sage: pari.polsubcyclo(8, 3)\n            []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_67polsubcyclo(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_d;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsubcyclo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_d,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_n)) != 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_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polsubcyclo", 0, 2, 3, 1); __PYX_ERR(3, 1277, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polsubcyclo") < 0)) __PYX_ERR(3, 1277, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1277, __pyx_L3_error)
    __pyx_v_d = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1277, __pyx_L3_error)
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polsubcyclo", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.polsubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_66polsubcyclo(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_n, __pyx_v_d, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_66polsubcyclo(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n, long __pyx_v_d, PyObject *__pyx_v_v) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_plist = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("polsubcyclo", 0);

  /* "cypari/pari_instance.pyx":1296
 *         """
 *         cdef Gen plist
 *         sig_on()             # <<<<<<<<<<<<<<
 *         plist = new_gen(polsubcyclo(n, d, get_var(v)))
 *         if typ(plist.g) != t_VEC:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 1296, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1297
 *         cdef Gen plist
 *         sig_on()
 *         plist = new_gen(polsubcyclo(n, d, get_var(v)))             # <<<<<<<<<<<<<<
 *         if typ(plist.g) != t_VEC:
 *             return self.vector(1, [plist])
 */
  __pyx_t_2 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_2 == ((long)-2L))) __PYX_ERR(3, 1297, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(polsubcyclo(__pyx_v_n, __pyx_v_d, __pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_plist = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cypari/pari_instance.pyx":1298
 *         sig_on()
 *         plist = new_gen(polsubcyclo(n, d, get_var(v)))
 *         if typ(plist.g) != t_VEC:             # <<<<<<<<<<<<<<
 *             return self.vector(1, [plist])
 *         else:
 */
  __pyx_t_4 = ((typ(__pyx_v_plist->__pyx_base.g) != t_VEC) != 0);
  if (__pyx_t_4) {

    /* "cypari/pari_instance.pyx":1299
 *         plist = new_gen(polsubcyclo(n, d, get_var(v)))
 *         if typ(plist.g) != t_VEC:
 *             return self.vector(1, [plist])             # <<<<<<<<<<<<<<
 *         else:
 *             return plist
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_vector); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1299, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(((PyObject *)__pyx_v_plist));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_plist));
    PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_plist));
    __pyx_t_7 = NULL;
    __pyx_t_1 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_1 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_int_1, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1299, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_int_1, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1299, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_1, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(3, 1299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":1298
 *         sig_on()
 *         plist = new_gen(polsubcyclo(n, d, get_var(v)))
 *         if typ(plist.g) != t_VEC:             # <<<<<<<<<<<<<<
 *             return self.vector(1, [plist])
 *         else:
 */
  }

  /* "cypari/pari_instance.pyx":1301
 *             return self.vector(1, [plist])
 *         else:
 *             return plist             # <<<<<<<<<<<<<<
 * 
 *     def setrand(self, seed):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_plist));
    __pyx_r = ((PyObject *)__pyx_v_plist);
    goto __pyx_L0;
  }

  /* "cypari/pari_instance.pyx":1277
 *         return new_gen(mpfact(n))
 * 
 *     def polsubcyclo(self, long n, long d, v=None):             # <<<<<<<<<<<<<<
 *         """
 *         polsubcyclo(n, d, v=x): return the pari list of polynomial(s)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cypari._pari.Pari.polsubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_plist);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1303
 *             return plist
 * 
 *     def setrand(self, seed):             # <<<<<<<<<<<<<<
 *         """
 *         Sets PARI's current random number seed.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_69setrand(PyObject *__pyx_v_self, PyObject *__pyx_v_seed); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_68setrand[] = "\n        Sets PARI's current random number seed.\n\n        INPUT:\n\n        - ``seed`` -- either a strictly positive integer or a GEN of\n          type ``t_VECSMALL`` as output by ``getrand()``\n\n        This should not be called directly; instead, use Sage's global\n        random number seed handling in ``sage.misc.randstate``\n        and call ``current_randstate().set_seed_pari()``.\n\n        EXAMPLES::\n\n            sage: pari.setrand(50)\n            sage: a = pari.getrand()\n            sage: pari.setrand(a)\n            sage: a == pari.getrand()\n            True\n\n        TESTS:\n\n        Check that invalid inputs are handled properly (:trac:`11825`)::\n\n            sage: pari.setrand(\"foobar\")\n            Traceback (most recent call last):\n            ...\n            PariError: incorrect type in setrand (t_POL)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_69setrand(PyObject *__pyx_v_self, PyObject *__pyx_v_seed) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setrand (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_68setrand(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((PyObject *)__pyx_v_seed));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_68setrand(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_seed) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setrand", 0);

  /* "cypari/pari_instance.pyx":1333
 *             PariError: incorrect type in setrand (t_POL)
 *         """
 *         cdef Gen t0 = self(seed)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         setrand(t0.g)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = ((PyObject *)__pyx_v_self); __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_seed) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_seed);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(3, 1333, __pyx_L1_error)
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":1334
 *         """
 *         cdef Gen t0 = self(seed)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         setrand(t0.g)
 *         sig_off()
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(3, 1334, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1335
 *         cdef Gen t0 = self(seed)
 *         sig_on()
 *         setrand(t0.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 * 
 */
  setrand(__pyx_v_t0->__pyx_base.g);

  /* "cypari/pari_instance.pyx":1336
 *         sig_on()
 *         setrand(t0.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 * 
 *     def vector(self, long n, entries=None):
 */
  sig_off();

  /* "cypari/pari_instance.pyx":1303
 *             return plist
 * 
 *     def setrand(self, seed):             # <<<<<<<<<<<<<<
 *         """
 *         Sets PARI's current random number seed.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Pari.setrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1338
 *         sig_off()
 * 
 *     def vector(self, long n, entries=None):             # <<<<<<<<<<<<<<
 *         """
 *         vector(long n, entries=None): Create and return the length n PARI
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_71vector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_70vector[] = "\n        vector(long n, entries=None): Create and return the length n PARI\n        vector with given list of entries.\n\n        EXAMPLES::\n\n            sage: pari.vector(5, [1, 2, 5, 4, 3])\n            [1, 2, 5, 4, 3]\n            sage: pari.vector(2, ['x', 1])\n            [x, 1]\n            sage: pari.vector(2, ['x', 1, 5])\n            Traceback (most recent call last):\n            ...\n            IndexError: length of entries (=3) must equal n (=2)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_71vector(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_entries = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vector (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_entries,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector") < 0)) __PYX_ERR(3, 1338, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1338, __pyx_L3_error)
    __pyx_v_entries = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vector", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1338, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.vector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_70vector(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_n, __pyx_v_entries);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_70vector(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_entries) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_v = 0;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_RefNannySetupContext("vector", 0);

  /* "cypari/pari_instance.pyx":1354
 *             IndexError: length of entries (=3) must equal n (=2)
 *         """
 *         cdef Gen v = self._empty_vector(n)             # <<<<<<<<<<<<<<
 *         if entries is not None:
 *             if len(entries) != n:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_4Pari__empty_vector(__pyx_v_self, __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_v = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":1355
 *         """
 *         cdef Gen v = self._empty_vector(n)
 *         if entries is not None:             # <<<<<<<<<<<<<<
 *             if len(entries) != n:
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\
 */
  __pyx_t_2 = (__pyx_v_entries != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/pari_instance.pyx":1356
 *         cdef Gen v = self._empty_vector(n)
 *         if entries is not None:
 *             if len(entries) != n:             # <<<<<<<<<<<<<<
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\
 *                       (len(entries), n))
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_entries); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(3, 1356, __pyx_L1_error)
    __pyx_t_3 = ((__pyx_t_4 != __pyx_v_n) != 0);
    if (unlikely(__pyx_t_3)) {

      /* "cypari/pari_instance.pyx":1358
 *             if len(entries) != n:
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\
 *                       (len(entries), n))             # <<<<<<<<<<<<<<
 *             for i, x in enumerate(entries):
 *                 v[i] = x
 */
      __pyx_t_4 = PyObject_Length(__pyx_v_entries); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(3, 1358, __pyx_L1_error)
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1358, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
      __pyx_t_1 = 0;
      __pyx_t_5 = 0;

      /* "cypari/pari_instance.pyx":1357
 *         if entries is not None:
 *             if len(entries) != n:
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\             # <<<<<<<<<<<<<<
 *                       (len(entries), n))
 *             for i, x in enumerate(entries):
 */
      __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_length_of_entries_s_must_equal_n, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(3, 1357, __pyx_L1_error)

      /* "cypari/pari_instance.pyx":1356
 *         cdef Gen v = self._empty_vector(n)
 *         if entries is not None:
 *             if len(entries) != n:             # <<<<<<<<<<<<<<
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\
 *                       (len(entries), n))
 */
    }

    /* "cypari/pari_instance.pyx":1359
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\
 *                       (len(entries), n))
 *             for i, x in enumerate(entries):             # <<<<<<<<<<<<<<
 *                 v[i] = x
 *         return v
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_t_6 = __pyx_int_0;
    if (likely(PyList_CheckExact(__pyx_v_entries)) || PyTuple_CheckExact(__pyx_v_entries)) {
      __pyx_t_5 = __pyx_v_entries; __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_entries); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1359, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 1359, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(3, 1359, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1359, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(3, 1359, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1359, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_7(__pyx_t_5);
        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(3, 1359, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
      __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1359, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6);
      __pyx_t_6 = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "cypari/pari_instance.pyx":1360
 *                       (len(entries), n))
 *             for i, x in enumerate(entries):
 *                 v[i] = x             # <<<<<<<<<<<<<<
 *         return v
 * 
 */
      if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_v_i, __pyx_v_x) < 0)) __PYX_ERR(3, 1360, __pyx_L1_error)

      /* "cypari/pari_instance.pyx":1359
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\
 *                       (len(entries), n))
 *             for i, x in enumerate(entries):             # <<<<<<<<<<<<<<
 *                 v[i] = x
 *         return v
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "cypari/pari_instance.pyx":1355
 *         """
 *         cdef Gen v = self._empty_vector(n)
 *         if entries is not None:             # <<<<<<<<<<<<<<
 *             if len(entries) != n:
 *                 raise IndexError("length of entries (=%s) must equal n (=%s)"%\
 */
  }

  /* "cypari/pari_instance.pyx":1361
 *             for i, x in enumerate(entries):
 *                 v[i] = x
 *         return v             # <<<<<<<<<<<<<<
 * 
 *     cdef Gen _empty_vector(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_v));
  __pyx_r = ((PyObject *)__pyx_v_v);
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1338
 *         sig_off()
 * 
 *     def vector(self, long n, entries=None):             # <<<<<<<<<<<<<<
 *         """
 *         vector(long n, entries=None): Create and return the length n PARI
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Pari.vector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1363
 *         return v
 * 
 *     cdef Gen _empty_vector(self, long n):             # <<<<<<<<<<<<<<
 *         cdef Gen v
 *         sig_on()
 */

static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_4Pari__empty_vector(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_n) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_v = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_empty_vector", 0);

  /* "cypari/pari_instance.pyx":1365
 *     cdef Gen _empty_vector(self, long n):
 *         cdef Gen v
 *         sig_on()             # <<<<<<<<<<<<<<
 *         v = new_gen(zerovec(n))
 *         return v
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 1365, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1366
 *         cdef Gen v
 *         sig_on()
 *         v = new_gen(zerovec(n))             # <<<<<<<<<<<<<<
 *         return v
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(zerovec(__pyx_v_n))); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_v = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/pari_instance.pyx":1367
 *         sig_on()
 *         v = new_gen(zerovec(n))
 *         return v             # <<<<<<<<<<<<<<
 * 
 *     def matrix(self, long m, long n, entries=None):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_v));
  __pyx_r = __pyx_v_v;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1363
 *         return v
 * 
 *     cdef Gen _empty_vector(self, long n):             # <<<<<<<<<<<<<<
 *         cdef Gen v
 *         sig_on()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Pari._empty_vector", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1369
 *         return v
 * 
 *     def matrix(self, long m, long n, entries=None):             # <<<<<<<<<<<<<<
 *         """
 *         matrix(long m, long n, entries=None): Create and return the m x n
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_73matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_72matrix[] = "\n        matrix(long m, long n, entries=None): Create and return the m x n\n        PARI matrix with given list of entries.\n\n        EXAMPLES::\n\n            sage: pari.matrix(3,3,range(9))\n            [0, 1, 2; 3, 4, 5; 6, 7, 8]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_73matrix(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_m;
  long __pyx_v_n;
  PyObject *__pyx_v_entries = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_n,&__pyx_n_s_entries,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_m)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matrix", 0, 2, 3, 1); __PYX_ERR(3, 1369, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matrix") < 0)) __PYX_ERR(3, 1369, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_m = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1369, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(3, 1369, __pyx_L3_error)
    __pyx_v_entries = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matrix", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1369, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_72matrix(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_m, __pyx_v_n, __pyx_v_entries);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_72matrix(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, long __pyx_v_m, long __pyx_v_n, PyObject *__pyx_v_entries) {
  long __pyx_v_i;
  long __pyx_v_j;
  long __pyx_v_k;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_A = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  long __pyx_t_10;
  long __pyx_t_11;
  __Pyx_RefNannySetupContext("matrix", 0);

  /* "cypari/pari_instance.pyx":1383
 *         cdef Gen x
 * 
 *         sig_on()             # <<<<<<<<<<<<<<
 *         A = new_gen(zeromatcopy(m,n))
 *         if entries is not None:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(3, 1383, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1384
 * 
 *         sig_on()
 *         A = new_gen(zeromatcopy(m,n))             # <<<<<<<<<<<<<<
 *         if entries is not None:
 *             if len(entries) != m*n:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(zeromatcopy(__pyx_v_m, __pyx_v_n))); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_A = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/pari_instance.pyx":1385
 *         sig_on()
 *         A = new_gen(zeromatcopy(m,n))
 *         if entries is not None:             # <<<<<<<<<<<<<<
 *             if len(entries) != m*n:
 *                 raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))
 */
  __pyx_t_3 = (__pyx_v_entries != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/pari_instance.pyx":1386
 *         A = new_gen(zeromatcopy(m,n))
 *         if entries is not None:
 *             if len(entries) != m*n:             # <<<<<<<<<<<<<<
 *                 raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))
 *             k = 0
 */
    __pyx_t_5 = PyObject_Length(__pyx_v_entries); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(3, 1386, __pyx_L1_error)
    __pyx_t_4 = ((__pyx_t_5 != (__pyx_v_m * __pyx_v_n)) != 0);
    if (unlikely(__pyx_t_4)) {

      /* "cypari/pari_instance.pyx":1387
 *         if entries is not None:
 *             if len(entries) != m*n:
 *                 raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))             # <<<<<<<<<<<<<<
 *             k = 0
 *             A.refers_to = {}
 */
      __pyx_t_5 = PyObject_Length(__pyx_v_entries); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(3, 1387, __pyx_L1_error)
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_m); if (unlikely(!__pyx_t_6)) __PYX_ERR(3, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyInt_From_long((__pyx_v_m * __pyx_v_n)); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_8);
      __pyx_t_2 = 0;
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_len_of_entries_s_must_be_s_s_s, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(3, 1387, __pyx_L1_error)

      /* "cypari/pari_instance.pyx":1386
 *         A = new_gen(zeromatcopy(m,n))
 *         if entries is not None:
 *             if len(entries) != m*n:             # <<<<<<<<<<<<<<
 *                 raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))
 *             k = 0
 */
    }

    /* "cypari/pari_instance.pyx":1388
 *             if len(entries) != m*n:
 *                 raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))
 *             k = 0             # <<<<<<<<<<<<<<
 *             A.refers_to = {}
 *             for i from 0 <= i < m:
 */
    __pyx_v_k = 0;

    /* "cypari/pari_instance.pyx":1389
 *                 raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))
 *             k = 0
 *             A.refers_to = {}             # <<<<<<<<<<<<<<
 *             for i from 0 <= i < m:
 *                 for j from 0 <= j < n:
 */
    __pyx_t_9 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 1389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __Pyx_GOTREF(__pyx_v_A->__pyx_base.refers_to);
    __Pyx_DECREF(__pyx_v_A->__pyx_base.refers_to);
    __pyx_v_A->__pyx_base.refers_to = ((PyObject*)__pyx_t_9);
    __pyx_t_9 = 0;

    /* "cypari/pari_instance.pyx":1390
 *             k = 0
 *             A.refers_to = {}
 *             for i from 0 <= i < m:             # <<<<<<<<<<<<<<
 *                 for j from 0 <= j < n:
 *                     x = self(entries[k])
 */
    __pyx_t_10 = __pyx_v_m;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_10; __pyx_v_i++) {

      /* "cypari/pari_instance.pyx":1391
 *             A.refers_to = {}
 *             for i from 0 <= i < m:
 *                 for j from 0 <= j < n:             # <<<<<<<<<<<<<<
 *                     x = self(entries[k])
 *                     A.refers_to[(i,j)] = x
 */
      __pyx_t_11 = __pyx_v_n;
      for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_11; __pyx_v_j++) {

        /* "cypari/pari_instance.pyx":1392
 *             for i from 0 <= i < m:
 *                 for j from 0 <= j < n:
 *                     x = self(entries[k])             # <<<<<<<<<<<<<<
 *                     A.refers_to[(i,j)] = x
 *                     (<GEN>(A.g)[j+1])[i+1] = <pari_longword>(x.g)
 */
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_entries, __pyx_v_k, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(((PyObject *)__pyx_v_self));
        __pyx_t_7 = ((PyObject *)__pyx_v_self); __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        __pyx_t_9 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 1392, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(3, 1392, __pyx_L1_error)
        __Pyx_XDECREF_SET(__pyx_v_x, ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_9));
        __pyx_t_9 = 0;

        /* "cypari/pari_instance.pyx":1393
 *                 for j from 0 <= j < n:
 *                     x = self(entries[k])
 *                     A.refers_to[(i,j)] = x             # <<<<<<<<<<<<<<
 *                     (<GEN>(A.g)[j+1])[i+1] = <pari_longword>(x.g)
 *                     k = k + 1
 */
        if (unlikely(__pyx_v_A->__pyx_base.refers_to == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(3, 1393, __pyx_L1_error)
        }
        __pyx_t_9 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(3, 1393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_7 = __Pyx_PyInt_From_long(__pyx_v_j); if (unlikely(!__pyx_t_7)) __PYX_ERR(3, 1393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(3, 1393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
        __pyx_t_9 = 0;
        __pyx_t_7 = 0;
        if (unlikely(PyDict_SetItem(__pyx_v_A->__pyx_base.refers_to, __pyx_t_8, ((PyObject *)__pyx_v_x)) < 0)) __PYX_ERR(3, 1393, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "cypari/pari_instance.pyx":1394
 *                     x = self(entries[k])
 *                     A.refers_to[(i,j)] = x
 *                     (<GEN>(A.g)[j+1])[i+1] = <pari_longword>(x.g)             # <<<<<<<<<<<<<<
 *                     k = k + 1
 *         return A
 */
        (((GEN)(__pyx_v_A->__pyx_base.g[(__pyx_v_j + 1)]))[(__pyx_v_i + 1)]) = ((__pyx_t_6cypari_8paridecl_pari_longword)__pyx_v_x->__pyx_base.g);

        /* "cypari/pari_instance.pyx":1395
 *                     A.refers_to[(i,j)] = x
 *                     (<GEN>(A.g)[j+1])[i+1] = <pari_longword>(x.g)
 *                     k = k + 1             # <<<<<<<<<<<<<<
 *         return A
 * 
 */
        __pyx_v_k = (__pyx_v_k + 1);
      }
    }

    /* "cypari/pari_instance.pyx":1385
 *         sig_on()
 *         A = new_gen(zeromatcopy(m,n))
 *         if entries is not None:             # <<<<<<<<<<<<<<
 *             if len(entries) != m*n:
 *                 raise IndexError("len of entries (=%s) must be %s*%s=%s"%(len(entries),m,n,m*n))
 */
  }

  /* "cypari/pari_instance.pyx":1396
 *                     (<GEN>(A.g)[j+1])[i+1] = <pari_longword>(x.g)
 *                     k = k + 1
 *         return A             # <<<<<<<<<<<<<<
 * 
 *     def genus2red(self, P, P0=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_A));
  __pyx_r = ((PyObject *)__pyx_v_A);
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1369
 *         return v
 * 
 *     def matrix(self, long m, long n, entries=None):             # <<<<<<<<<<<<<<
 *         """
 *         matrix(long m, long n, entries=None): Create and return the m x n
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cypari._pari.Pari.matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_A);
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1398
 *         return A
 * 
 *     def genus2red(self, P, P0=None):             # <<<<<<<<<<<<<<
 *         """
 *         Let `P` be a polynomial with integer coefficients.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_75genus2red(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_74genus2red[] = "\n        Let `P` be a polynomial with integer coefficients.\n        Determines the reduction of the (proper, smooth) genus 2\n        curve `C/\\QQ`, defined by the hyperelliptic equation `y^2 = P`.\n        The special syntax ``genus2red([P,Q])`` is also allowed, where\n        the polynomials `P` and `Q` have integer coefficients, to\n        represent the model `y^2 + Q(x)y = P(x)`.\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: pari.genus2red([-5*x**5, x**3 - 2*x**2 - 2*x + 1])\n            [1416875, [2, -1; 5, 4; 2267, 1], x^6 - 240*x^4 - 2550*x^3 - 11400*x^2 - 24100*x - 19855, [[2, [2, [Mod(1, 2)]], []], [5, [1, []], [\"[V] page 156\", [3]]], [2267, [2, [Mod(432, 2267)]], [\"[I{1-0-0}] page 170\", []]]]]\n            sage: pari.genus2red(x**6+3, 3)\n            [59049, Mat([3, 10]), x^6 + 3, [3, [5, [Mod(0, 3), Mod(0, 3)]], [\"[V] page 156\", [3]]]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_75genus2red(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_P0 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genus2red (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_P0,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P0);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "genus2red") < 0)) __PYX_ERR(3, 1398, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
    __pyx_v_P0 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("genus2red", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1398, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.genus2red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_74genus2red(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_P, __pyx_v_P0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_74genus2red(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_P, PyObject *__pyx_v_P0) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("genus2red", 0);

  /* "cypari/pari_instance.pyx":1415
 *             [59049, Mat([3, 10]), x^6 + 3, [3, [5, [Mod(0, 3), Mod(0, 3)]], ["[V] page 156", [3]]]]
 *         """
 *         cdef Gen t0 = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         if P0 is None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1415, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":1416
 *         """
 *         cdef Gen t0 = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if P0 is None:
 *             return new_gen(genus2red(t0.g, NULL))
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(3, 1416, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1417
 *         cdef Gen t0 = objtogen(P)
 *         sig_on()
 *         if P0 is None:             # <<<<<<<<<<<<<<
 *             return new_gen(genus2red(t0.g, NULL))
 *         cdef Gen t1 = objtogen(P0)
 */
  __pyx_t_3 = (__pyx_v_P0 == Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/pari_instance.pyx":1418
 *         sig_on()
 *         if P0 is None:
 *             return new_gen(genus2red(t0.g, NULL))             # <<<<<<<<<<<<<<
 *         cdef Gen t1 = objtogen(P0)
 *         return new_gen(genus2red(t0.g, t1.g))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(genus2red(__pyx_v_t0->__pyx_base.g, NULL))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1418, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":1417
 *         cdef Gen t0 = objtogen(P)
 *         sig_on()
 *         if P0 is None:             # <<<<<<<<<<<<<<
 *             return new_gen(genus2red(t0.g, NULL))
 *         cdef Gen t1 = objtogen(P0)
 */
  }

  /* "cypari/pari_instance.pyx":1419
 *         if P0 is None:
 *             return new_gen(genus2red(t0.g, NULL))
 *         cdef Gen t1 = objtogen(P0)             # <<<<<<<<<<<<<<
 *         return new_gen(genus2red(t0.g, t1.g))
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P0, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/pari_instance.pyx":1420
 *             return new_gen(genus2red(t0.g, NULL))
 *         cdef Gen t1 = objtogen(P0)
 *         return new_gen(genus2red(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def List(self, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(genus2red(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1398
 *         return A
 * 
 *     def genus2red(self, P, P0=None):             # <<<<<<<<<<<<<<
 *         """
 *         Let `P` be a polynomial with integer coefficients.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.genus2red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1422
 *         return new_gen(genus2red(t0.g, t1.g))
 * 
 *     def List(self, x=None):             # <<<<<<<<<<<<<<
 *         """
 *         Create an empty list or convert `x` to a list.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_77List(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_4Pari_76List[] = "\n        Create an empty list or convert `x` to a list.\n\n        EXAMPLES::\n\n            sage: pari.List(range(5))\n            List([0, 1, 2, 3, 4])\n            sage: L = pari.List()\n            sage: L\n            List([])\n            sage: L.listput(42, 1)\n            42\n            sage: L\n            List([42])\n            sage: L.listinsert(24, 1)\n            24\n            sage: L\n            List([24, 42])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_77List(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("List (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "List") < 0)) __PYX_ERR(3, 1422, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("List", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(3, 1422, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Pari.List", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_76List(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_76List(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, PyObject *__pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("List", 0);

  /* "cypari/pari_instance.pyx":1442
 *             List([24, 42])
 *         """
 *         if x is None:             # <<<<<<<<<<<<<<
 *             sig_on()
 *             return new_gen(listcreate())
 */
  __pyx_t_1 = (__pyx_v_x == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/pari_instance.pyx":1443
 *         """
 *         if x is None:
 *             sig_on()             # <<<<<<<<<<<<<<
 *             return new_gen(listcreate())
 *         cdef Gen t0 = objtogen(x)
 */
    __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(3, 1443, __pyx_L1_error)

    /* "cypari/pari_instance.pyx":1444
 *         if x is None:
 *             sig_on()
 *             return new_gen(listcreate())             # <<<<<<<<<<<<<<
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(listcreate())); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":1442
 *             List([24, 42])
 *         """
 *         if x is None:             # <<<<<<<<<<<<<<
 *             sig_on()
 *             return new_gen(listcreate())
 */
  }

  /* "cypari/pari_instance.pyx":1445
 *             sig_on()
 *             return new_gen(listcreate())
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gtolist(t0.g))
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":1446
 *             return new_gen(listcreate())
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gtolist(t0.g))
 * 
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(3, 1446, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1447
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 *         return new_gen(gtolist(t0.g))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gtolist(__pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1422
 *         return new_gen(genus2red(t0.g, t1.g))
 * 
 *     def List(self, x=None):             # <<<<<<<<<<<<<<
 *         """
 *         Create an empty list or convert `x` to a list.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Pari.List", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/_pari.pxd":34
 * cdef class Pari(Pari_auto):
 *     cdef long _real_precision
 *     cdef readonly Gen PARI_ZERO, PARI_ONE, PARI_TWO             # <<<<<<<<<<<<<<
 *     cpdef Gen zero(self)
 *     cpdef Gen one(self)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_9PARI_ZERO_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_9PARI_ZERO_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_9PARI_ZERO___get__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_9PARI_ZERO___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->PARI_ZERO));
  __pyx_r = ((PyObject *)__pyx_v_self->PARI_ZERO);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_8PARI_ONE_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_8PARI_ONE_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_8PARI_ONE___get__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_8PARI_ONE___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->PARI_ONE));
  __pyx_r = ((PyObject *)__pyx_v_self->PARI_ONE);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_8PARI_TWO_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_8PARI_TWO_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_8PARI_TWO___get__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_8PARI_TWO___get__(struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->PARI_TWO));
  __pyx_r = ((PyObject *)__pyx_v_self->PARI_TWO);
  goto __pyx_L0;

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_79__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_79__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_78__reduce_cython__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_78__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_81__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_4Pari_81__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_4Pari_80__setstate_cython__(((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_4Pari_80__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Pari *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Pari.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/pari_instance.pyx":1450
 * 
 * 
 * cdef long get_var(v) except -2:             # <<<<<<<<<<<<<<
 *     """
 *     Convert ``v`` into a PARI variable number.
 */

static long __pyx_f_6cypari_5_pari_get_var(PyObject *__pyx_v_v) {
  long __pyx_v_varno;
  long __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  char const *__pyx_t_7;
  __Pyx_RefNannySetupContext("get_var", 0);

  /* "cypari/pari_instance.pyx":1496
 *         PariError: incorrect priority in gtopoly: variable x <= xx
 *     """
 *     if v is None:             # <<<<<<<<<<<<<<
 *         return -1
 *     cdef long varno
 */
  __pyx_t_1 = (__pyx_v_v == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/pari_instance.pyx":1497
 *     """
 *     if v is None:
 *         return -1             # <<<<<<<<<<<<<<
 *     cdef long varno
 *     if isinstance(v, Gen):
 */
    __pyx_r = -1L;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":1496
 *         PariError: incorrect priority in gtopoly: variable x <= xx
 *     """
 *     if v is None:             # <<<<<<<<<<<<<<
 *         return -1
 *     cdef long varno
 */
  }

  /* "cypari/pari_instance.pyx":1499
 *         return -1
 *     cdef long varno
 *     if isinstance(v, Gen):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         varno = <long>gvar((<Gen>v).g)
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_v, __pyx_ptype_6cypari_5_pari_Gen); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":1500
 *     cdef long varno
 *     if isinstance(v, Gen):
 *         sig_on()             # <<<<<<<<<<<<<<
 *         varno = <long>gvar((<Gen>v).g)
 *         sig_off()
 */
    __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(3, 1500, __pyx_L1_error)

    /* "cypari/pari_instance.pyx":1501
 *     if isinstance(v, Gen):
 *         sig_on()
 *         varno = <long>gvar((<Gen>v).g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         if varno < 0:
 */
    __pyx_v_varno = ((long)gvar(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g));

    /* "cypari/pari_instance.pyx":1502
 *         sig_on()
 *         varno = <long>gvar((<Gen>v).g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         if varno < 0:
 *             return -1
 */
    sig_off();

    /* "cypari/pari_instance.pyx":1503
 *         varno = <long>gvar((<Gen>v).g)
 *         sig_off()
 *         if varno < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *         else:
 */
    __pyx_t_1 = ((__pyx_v_varno < 0) != 0);
    if (__pyx_t_1) {

      /* "cypari/pari_instance.pyx":1504
 *         sig_off()
 *         if varno < 0:
 *             return -1             # <<<<<<<<<<<<<<
 *         else:
 *             return varno
 */
      __pyx_r = -1L;
      goto __pyx_L0;

      /* "cypari/pari_instance.pyx":1503
 *         varno = <long>gvar((<Gen>v).g)
 *         sig_off()
 *         if varno < 0:             # <<<<<<<<<<<<<<
 *             return -1
 *         else:
 */
    }

    /* "cypari/pari_instance.pyx":1506
 *             return -1
 *         else:
 *             return varno             # <<<<<<<<<<<<<<
 *     if v == -1:
 *         return -1
 */
    /*else*/ {
      __pyx_r = __pyx_v_varno;
      goto __pyx_L0;
    }

    /* "cypari/pari_instance.pyx":1499
 *         return -1
 *     cdef long varno
 *     if isinstance(v, Gen):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         varno = <long>gvar((<Gen>v).g)
 */
  }

  /* "cypari/pari_instance.pyx":1507
 *         else:
 *             return varno
 *     if v == -1:             # <<<<<<<<<<<<<<
 *         return -1
 *     sig_on()
 */
  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_v, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(3, 1507, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "cypari/pari_instance.pyx":1508
 *             return varno
 *     if v == -1:
 *         return -1             # <<<<<<<<<<<<<<
 *     sig_on()
 *     varno = <long>fetch_user_var(v.encode('ascii'))
 */
    __pyx_r = -1L;
    goto __pyx_L0;

    /* "cypari/pari_instance.pyx":1507
 *         else:
 *             return varno
 *     if v == -1:             # <<<<<<<<<<<<<<
 *         return -1
 *     sig_on()
 */
  }

  /* "cypari/pari_instance.pyx":1509
 *     if v == -1:
 *         return -1
 *     sig_on()             # <<<<<<<<<<<<<<
 *     varno = <long>fetch_user_var(v.encode('ascii'))
 *     sig_off()
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(3, 1509, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":1510
 *         return -1
 *     sig_on()
 *     varno = <long>fetch_user_var(v.encode('ascii'))             # <<<<<<<<<<<<<<
 *     sig_off()
 *     return varno
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(3, 1510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ascii);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(3, 1510, __pyx_L1_error)
  __pyx_v_varno = ((long)fetch_user_var(__pyx_t_7));
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":1511
 *     sig_on()
 *     varno = <long>fetch_user_var(v.encode('ascii'))
 *     sig_off()             # <<<<<<<<<<<<<<
 *     return varno
 */
  sig_off();

  /* "cypari/pari_instance.pyx":1512
 *     varno = <long>fetch_user_var(v.encode('ascii'))
 *     sig_off()
 *     return varno             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_varno;
  goto __pyx_L0;

  /* "cypari/pari_instance.pyx":1450
 * 
 * 
 * cdef long get_var(v) except -2:             # <<<<<<<<<<<<<<
 *     """
 *     Convert ``v`` into a PARI variable number.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.get_var", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -2L;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":73
 * ####################################
 * 
 * cpdef integer_to_gen(x):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a Python ``int`` or ``long`` to a PARI ``gen`` of type
 */

static PyObject *__pyx_pw_6cypari_5_pari_25integer_to_gen(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_integer_to_gen(PyObject *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("integer_to_gen", 0);

  /* "cypari/convert.pyx":100
 *     """
 *     # Even though longs do not exist in Python 3, Cython will do the right thing here.
 *     if isinstance(x, int) or isinstance(x, long):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(PyLong_AsGEN(long(x)))
 */
  __pyx_t_2 = PyInt_Check(__pyx_v_x); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = PyLong_Check(__pyx_v_x); 
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cypari/convert.pyx":101
 *     # Even though longs do not exist in Python 3, Cython will do the right thing here.
 *     if isinstance(x, int) or isinstance(x, long):
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(PyLong_AsGEN(long(x)))
 * 
 */
    __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(5, 101, __pyx_L1_error)

    /* "cypari/convert.pyx":102
 *     if isinstance(x, int) or isinstance(x, long):
 *         sig_on()
 *         return new_gen(PyLong_AsGEN(long(x)))             # <<<<<<<<<<<<<<
 * 
 *     raise TypeError(f"integer_to_gen() needs an int or long argument, not {type(x).__name__}")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_f_6cypari_5_pari_PyLong_AsGEN(__pyx_t_5))); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":100
 *     """
 *     # Even though longs do not exist in Python 3, Cython will do the right thing here.
 *     if isinstance(x, int) or isinstance(x, long):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(PyLong_AsGEN(long(x)))
 */
  }

  /* "cypari/convert.pyx":104
 *         return new_gen(PyLong_AsGEN(long(x)))
 * 
 *     raise TypeError(f"integer_to_gen() needs an int or long argument, not {type(x).__name__}")             # <<<<<<<<<<<<<<
 * 
 * cdef PyLong_FromINT(GEN g):
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(__pyx_v_x)), __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_integer_to_gen_needs_an_int_or_l, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(5, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __PYX_ERR(5, 104, __pyx_L1_error)

  /* "cypari/convert.pyx":73
 * ####################################
 * 
 * cpdef integer_to_gen(x):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a Python ``int`` or ``long`` to a PARI ``gen`` of type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.integer_to_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_25integer_to_gen(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_24integer_to_gen[] = "\n    Convert a Python ``int`` or ``long`` to a PARI ``gen`` of type\n    ``t_INT``.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import integer_to_gen\n        sage: a = integer_to_gen(int(12345)); a; isinstance(a, Gen)\n        12345\n        True\n        sage: a = integer_to_gen(123456789012345678901234567890); a; isinstance(a, Gen)\n        123456789012345678901234567890\n        True\n        sage: integer_to_gen(float(12345))\n        Traceback (most recent call last):\n        ...\n        TypeError: integer_to_gen() needs an int or long argument, not float\n\n    TESTS::\n\n        sage: for i in range(10000):\n        ....:     x = 3**i\n        ....:     if int(pari(x)) != x:\n        ....:         print(x)\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_25integer_to_gen(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("integer_to_gen (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_24integer_to_gen(__pyx_self, ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_24integer_to_gen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("integer_to_gen", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6cypari_5_pari_integer_to_gen(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 73, __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("cypari._pari.integer_to_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":106
 *     raise TypeError(f"integer_to_gen() needs an int or long argument, not {type(x).__name__}")
 * 
 * cdef PyLong_FromINT(GEN g):             # <<<<<<<<<<<<<<
 *     # Size of input in words, bits and Python digits. The size in
 *     # digits might be a small over-estimation, but that is not a
 */

static PyObject *__pyx_f_6cypari_5_pari_PyLong_FromINT(GEN __pyx_v_g) {
  size_t __pyx_v_sizewords;
  size_t __pyx_v_sizebits;
  size_t __pyx_v_sizedigits;
  Py_ssize_t __pyx_v_sizedigits_final;
  PyLongObject *__pyx_v_x = NULL;
  digit *__pyx_v_D;
  digit __pyx_v_d;
  pari_ulong __pyx_v_w;
  size_t __pyx_v_i;
  size_t __pyx_v_j;
  size_t __pyx_v_bit;
  Py_ssize_t *__pyx_v_sizeptr;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  digit *__pyx_t_3;
  size_t __pyx_t_4;
  size_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("PyLong_FromINT", 0);

  /* "cypari/convert.pyx":110
 *     # digits might be a small over-estimation, but that is not a
 *     # problem.
 *     cdef size_t sizewords = (lgefint(g) - 2)             # <<<<<<<<<<<<<<
 *     cdef size_t sizebits = sizewords * BITS_IN_LONG
 *     cdef size_t sizedigits = (sizebits + PyLong_SHIFT - 1) // PyLong_SHIFT
 */
  __pyx_v_sizewords = (lgefint(__pyx_v_g) - 2);

  /* "cypari/convert.pyx":111
 *     # problem.
 *     cdef size_t sizewords = (lgefint(g) - 2)
 *     cdef size_t sizebits = sizewords * BITS_IN_LONG             # <<<<<<<<<<<<<<
 *     cdef size_t sizedigits = (sizebits + PyLong_SHIFT - 1) // PyLong_SHIFT
 * 
 */
  __pyx_v_sizebits = (__pyx_v_sizewords * BITS_IN_LONG);

  /* "cypari/convert.pyx":112
 *     cdef size_t sizewords = (lgefint(g) - 2)
 *     cdef size_t sizebits = sizewords * BITS_IN_LONG
 *     cdef size_t sizedigits = (sizebits + PyLong_SHIFT - 1) // PyLong_SHIFT             # <<<<<<<<<<<<<<
 * 
 *     # Actual correct computed size
 */
  __pyx_t_1 = ((__pyx_v_sizebits + PyLong_SHIFT) - 1);
  if (unlikely(PyLong_SHIFT == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(5, 112, __pyx_L1_error)
  }
  __pyx_v_sizedigits = (__pyx_t_1 / PyLong_SHIFT);

  /* "cypari/convert.pyx":115
 * 
 *     # Actual correct computed size
 *     cdef Py_ssize_t sizedigits_final = 0             # <<<<<<<<<<<<<<
 * 
 *     x = _PyLong_New(sizedigits)
 */
  __pyx_v_sizedigits_final = 0;

  /* "cypari/convert.pyx":117
 *     cdef Py_ssize_t sizedigits_final = 0
 * 
 *     x = _PyLong_New(sizedigits)             # <<<<<<<<<<<<<<
 *     cdef digit* D = (<PyLongObject*>x).ob_digit
 * 
 */
  __pyx_t_2 = ((PyObject *)_PyLong_New(__pyx_v_sizedigits)); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_x = ((PyLongObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/convert.pyx":118
 * 
 *     x = _PyLong_New(sizedigits)
 *     cdef digit* D = (<PyLongObject*>x).ob_digit             # <<<<<<<<<<<<<<
 * 
 *     cdef digit d
 */
  __pyx_t_3 = ((PyLongObject *)__pyx_v_x)->ob_digit;
  __pyx_v_D = __pyx_t_3;

  /* "cypari/convert.pyx":123
 *     cdef ulong w
 *     cdef size_t i, j, bit
 *     for i in range(sizedigits):             # <<<<<<<<<<<<<<
 *         # The least significant bit of digit number i of the output
 *         # integer is bit number "bit" of word "j".
 */
  __pyx_t_1 = __pyx_v_sizedigits;
  __pyx_t_4 = __pyx_t_1;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "cypari/convert.pyx":126
 *         # The least significant bit of digit number i of the output
 *         # integer is bit number "bit" of word "j".
 *         bit = i * PyLong_SHIFT             # <<<<<<<<<<<<<<
 *         j = bit // BITS_IN_LONG
 *         bit = bit % BITS_IN_LONG
 */
    __pyx_v_bit = (__pyx_v_i * PyLong_SHIFT);

    /* "cypari/convert.pyx":127
 *         # integer is bit number "bit" of word "j".
 *         bit = i * PyLong_SHIFT
 *         j = bit // BITS_IN_LONG             # <<<<<<<<<<<<<<
 *         bit = bit % BITS_IN_LONG
 * 
 */
    if (unlikely(BITS_IN_LONG == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(5, 127, __pyx_L1_error)
    }
    __pyx_v_j = (__pyx_v_bit / BITS_IN_LONG);

    /* "cypari/convert.pyx":128
 *         bit = i * PyLong_SHIFT
 *         j = bit // BITS_IN_LONG
 *         bit = bit % BITS_IN_LONG             # <<<<<<<<<<<<<<
 * 
 *         w = int_W(g, j)[0]
 */
    if (unlikely(BITS_IN_LONG == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(5, 128, __pyx_L1_error)
    }
    __pyx_v_bit = (__pyx_v_bit % BITS_IN_LONG);

    /* "cypari/convert.pyx":130
 *         bit = bit % BITS_IN_LONG
 * 
 *         w = int_W(g, j)[0]             # <<<<<<<<<<<<<<
 *         d = w >> bit
 * 
 */
    __pyx_v_w = (int_W(__pyx_v_g, __pyx_v_j)[0]);

    /* "cypari/convert.pyx":131
 * 
 *         w = int_W(g, j)[0]
 *         d = w >> bit             # <<<<<<<<<<<<<<
 * 
 *         # Do we need bits from the next word too?
 */
    __pyx_v_d = (__pyx_v_w >> __pyx_v_bit);

    /* "cypari/convert.pyx":134
 * 
 *         # Do we need bits from the next word too?
 *         if BITS_IN_LONG - bit < PyLong_SHIFT and j+1 < sizewords:             # <<<<<<<<<<<<<<
 *             w = int_W(g, j+1)[0]
 *             d += w << (BITS_IN_LONG - bit)
 */
    __pyx_t_7 = (((BITS_IN_LONG - __pyx_v_bit) < PyLong_SHIFT) != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_7 = (((__pyx_v_j + 1) < __pyx_v_sizewords) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_6) {

      /* "cypari/convert.pyx":135
 *         # Do we need bits from the next word too?
 *         if BITS_IN_LONG - bit < PyLong_SHIFT and j+1 < sizewords:
 *             w = int_W(g, j+1)[0]             # <<<<<<<<<<<<<<
 *             d += w << (BITS_IN_LONG - bit)
 * 
 */
      __pyx_v_w = (int_W(__pyx_v_g, (__pyx_v_j + 1))[0]);

      /* "cypari/convert.pyx":136
 *         if BITS_IN_LONG - bit < PyLong_SHIFT and j+1 < sizewords:
 *             w = int_W(g, j+1)[0]
 *             d += w << (BITS_IN_LONG - bit)             # <<<<<<<<<<<<<<
 * 
 *         d = d & PyLong_MASK
 */
      __pyx_v_d = (__pyx_v_d + (__pyx_v_w << (BITS_IN_LONG - __pyx_v_bit)));

      /* "cypari/convert.pyx":134
 * 
 *         # Do we need bits from the next word too?
 *         if BITS_IN_LONG - bit < PyLong_SHIFT and j+1 < sizewords:             # <<<<<<<<<<<<<<
 *             w = int_W(g, j+1)[0]
 *             d += w << (BITS_IN_LONG - bit)
 */
    }

    /* "cypari/convert.pyx":138
 *             d += w << (BITS_IN_LONG - bit)
 * 
 *         d = d & PyLong_MASK             # <<<<<<<<<<<<<<
 *         D[i] = d
 * 
 */
    __pyx_v_d = (__pyx_v_d & PyLong_MASK);

    /* "cypari/convert.pyx":139
 * 
 *         d = d & PyLong_MASK
 *         D[i] = d             # <<<<<<<<<<<<<<
 * 
 *         # Keep track of last non-zero digit
 */
    (__pyx_v_D[__pyx_v_i]) = __pyx_v_d;

    /* "cypari/convert.pyx":142
 * 
 *         # Keep track of last non-zero digit
 *         if d:             # <<<<<<<<<<<<<<
 *             sizedigits_final = i+1
 * 
 */
    __pyx_t_6 = (__pyx_v_d != 0);
    if (__pyx_t_6) {

      /* "cypari/convert.pyx":143
 *         # Keep track of last non-zero digit
 *         if d:
 *             sizedigits_final = i+1             # <<<<<<<<<<<<<<
 * 
 *     # Set correct size (use a pointer to hack around Cython's
 */
      __pyx_v_sizedigits_final = (__pyx_v_i + 1);

      /* "cypari/convert.pyx":142
 * 
 *         # Keep track of last non-zero digit
 *         if d:             # <<<<<<<<<<<<<<
 *             sizedigits_final = i+1
 * 
 */
    }
  }

  /* "cypari/convert.pyx":147
 *     # Set correct size (use a pointer to hack around Cython's
 *     # non-support for lvalues).
 *     cdef Py_ssize_t* sizeptr = Py_SIZE_PTR(x)             # <<<<<<<<<<<<<<
 *     if signe(g) > 0:
 *         sizeptr[0] = sizedigits_final
 */
  __pyx_v_sizeptr = &Py_SIZE(((PyObject *)__pyx_v_x));

  /* "cypari/convert.pyx":148
 *     # non-support for lvalues).
 *     cdef Py_ssize_t* sizeptr = Py_SIZE_PTR(x)
 *     if signe(g) > 0:             # <<<<<<<<<<<<<<
 *         sizeptr[0] = sizedigits_final
 *     else:
 */
  __pyx_t_6 = ((signe(__pyx_v_g) > 0) != 0);
  if (__pyx_t_6) {

    /* "cypari/convert.pyx":149
 *     cdef Py_ssize_t* sizeptr = Py_SIZE_PTR(x)
 *     if signe(g) > 0:
 *         sizeptr[0] = sizedigits_final             # <<<<<<<<<<<<<<
 *     else:
 *         sizeptr[0] = -sizedigits_final
 */
    (__pyx_v_sizeptr[0]) = __pyx_v_sizedigits_final;

    /* "cypari/convert.pyx":148
 *     # non-support for lvalues).
 *     cdef Py_ssize_t* sizeptr = Py_SIZE_PTR(x)
 *     if signe(g) > 0:             # <<<<<<<<<<<<<<
 *         sizeptr[0] = sizedigits_final
 *     else:
 */
    goto __pyx_L9;
  }

  /* "cypari/convert.pyx":151
 *         sizeptr[0] = sizedigits_final
 *     else:
 *         sizeptr[0] = -sizedigits_final             # <<<<<<<<<<<<<<
 * 
 *     return x
 */
  /*else*/ {
    (__pyx_v_sizeptr[0]) = (-__pyx_v_sizedigits_final);
  }
  __pyx_L9:;

  /* "cypari/convert.pyx":153
 *         sizeptr[0] = -sizedigits_final
 * 
 *     return x             # <<<<<<<<<<<<<<
 * 
 * cpdef gen_to_integer(Gen x):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_x));
  __pyx_r = ((PyObject *)__pyx_v_x);
  goto __pyx_L0;

  /* "cypari/convert.pyx":106
 *     raise TypeError(f"integer_to_gen() needs an int or long argument, not {type(x).__name__}")
 * 
 * cdef PyLong_FromINT(GEN g):             # <<<<<<<<<<<<<<
 *     # Size of input in words, bits and Python digits. The size in
 *     # digits might be a small over-estimation, but that is not a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.PyLong_FromINT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":155
 *     return x
 * 
 * cpdef gen_to_integer(Gen x):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a PARI ``Gen`` to a Python ``int`` or ``long``.
 */

static PyObject *__pyx_pw_6cypari_5_pari_27gen_to_integer(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_gen_to_integer(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
  GEN __pyx_v_g;
  pari_ulong __pyx_v_u;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  GEN __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("gen_to_integer", 0);

  /* "cypari/convert.pyx":224
 *     """
 *     # First convert the input to a t_INT
 *     cdef GEN g = gtoi(x.g)             # <<<<<<<<<<<<<<
 * 
 *     if not signe(g):
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_gtoi(__pyx_v_x->__pyx_base.g); if (unlikely(__pyx_t_1 == ((GEN)NULL))) __PYX_ERR(5, 224, __pyx_L1_error)
  __pyx_v_g = __pyx_t_1;

  /* "cypari/convert.pyx":226
 *     cdef GEN g = gtoi(x.g)
 * 
 *     if not signe(g):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_2 = ((!(signe(__pyx_v_g) != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":227
 * 
 *     if not signe(g):
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cdef ulong u
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":226
 *     cdef GEN g = gtoi(x.g)
 * 
 *     if not signe(g):             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  }

  /* "cypari/convert.pyx":230
 * 
 *     cdef ulong u
 *     if PY_MAJOR_VERSION == 2:             # <<<<<<<<<<<<<<
 *         # Try converting to a Python 2 "int" first. Note that we cannot
 *         # use itos() from PARI since that does not deal with LONG_MIN
 */
  __pyx_t_2 = ((PY_MAJOR_VERSION == 2) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":234
 *         # use itos() from PARI since that does not deal with LONG_MIN
 *         # correctly.
 *         if lgefint(g) == 3:  # abs(x) fits in a ulong             # <<<<<<<<<<<<<<
 *             u = g[2]         # u = abs(x)
 *             # Check that <long>(u) or <long>(-u) does not overflow
 */
    __pyx_t_2 = ((lgefint(__pyx_v_g) == 3) != 0);
    if (__pyx_t_2) {

      /* "cypari/convert.pyx":235
 *         # correctly.
 *         if lgefint(g) == 3:  # abs(x) fits in a ulong
 *             u = g[2]         # u = abs(x)             # <<<<<<<<<<<<<<
 *             # Check that <long>(u) or <long>(-u) does not overflow
 *             if signe(g) >= 0:
 */
      __pyx_v_u = (__pyx_v_g[2]);

      /* "cypari/convert.pyx":237
 *             u = g[2]         # u = abs(x)
 *             # Check that <long>(u) or <long>(-u) does not overflow
 *             if signe(g) >= 0:             # <<<<<<<<<<<<<<
 *                 if u <= <ulong>LONG_MAX:
 *                     return PyInt_FromLong(u)
 */
      __pyx_t_2 = ((signe(__pyx_v_g) >= 0) != 0);
      if (__pyx_t_2) {

        /* "cypari/convert.pyx":238
 *             # Check that <long>(u) or <long>(-u) does not overflow
 *             if signe(g) >= 0:
 *                 if u <= <ulong>LONG_MAX:             # <<<<<<<<<<<<<<
 *                     return PyInt_FromLong(u)
 *             else:
 */
        __pyx_t_2 = ((__pyx_v_u <= ((pari_ulong)LONG_MAX)) != 0);
        if (__pyx_t_2) {

          /* "cypari/convert.pyx":239
 *             if signe(g) >= 0:
 *                 if u <= <ulong>LONG_MAX:
 *                     return PyInt_FromLong(u)             # <<<<<<<<<<<<<<
 *             else:
 *                 if u <= -<ulong>LONG_MIN:
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = PyInt_FromLong(__pyx_v_u); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 239, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;

          /* "cypari/convert.pyx":238
 *             # Check that <long>(u) or <long>(-u) does not overflow
 *             if signe(g) >= 0:
 *                 if u <= <ulong>LONG_MAX:             # <<<<<<<<<<<<<<
 *                     return PyInt_FromLong(u)
 *             else:
 */
        }

        /* "cypari/convert.pyx":237
 *             u = g[2]         # u = abs(x)
 *             # Check that <long>(u) or <long>(-u) does not overflow
 *             if signe(g) >= 0:             # <<<<<<<<<<<<<<
 *                 if u <= <ulong>LONG_MAX:
 *                     return PyInt_FromLong(u)
 */
        goto __pyx_L6;
      }

      /* "cypari/convert.pyx":241
 *                     return PyInt_FromLong(u)
 *             else:
 *                 if u <= -<ulong>LONG_MIN:             # <<<<<<<<<<<<<<
 *                     return PyInt_FromLong(-u)
 * 
 */
      /*else*/ {
        __pyx_t_2 = ((__pyx_v_u <= (-((pari_ulong)LONG_MIN))) != 0);
        if (__pyx_t_2) {

          /* "cypari/convert.pyx":242
 *             else:
 *                 if u <= -<ulong>LONG_MIN:
 *                     return PyInt_FromLong(-u)             # <<<<<<<<<<<<<<
 * 
 *     # Result does not fit in a C long
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_3 = PyInt_FromLong((-__pyx_v_u)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 242, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_r = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L0;

          /* "cypari/convert.pyx":241
 *                     return PyInt_FromLong(u)
 *             else:
 *                 if u <= -<ulong>LONG_MIN:             # <<<<<<<<<<<<<<
 *                     return PyInt_FromLong(-u)
 * 
 */
        }
      }
      __pyx_L6:;

      /* "cypari/convert.pyx":234
 *         # use itos() from PARI since that does not deal with LONG_MIN
 *         # correctly.
 *         if lgefint(g) == 3:  # abs(x) fits in a ulong             # <<<<<<<<<<<<<<
 *             u = g[2]         # u = abs(x)
 *             # Check that <long>(u) or <long>(-u) does not overflow
 */
    }

    /* "cypari/convert.pyx":230
 * 
 *     cdef ulong u
 *     if PY_MAJOR_VERSION == 2:             # <<<<<<<<<<<<<<
 *         # Try converting to a Python 2 "int" first. Note that we cannot
 *         # use itos() from PARI since that does not deal with LONG_MIN
 */
  }

  /* "cypari/convert.pyx":245
 * 
 *     # Result does not fit in a C long
 *     res = PyLong_FromINT(g)             # <<<<<<<<<<<<<<
 *     return res
 * 
 */
  __pyx_t_3 = __pyx_f_6cypari_5_pari_PyLong_FromINT(__pyx_v_g); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 245, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cypari/convert.pyx":246
 *     # Result does not fit in a C long
 *     res = PyLong_FromINT(g)
 *     return res             # <<<<<<<<<<<<<<
 * 
 * cdef GEN gtoi(GEN g0) except NULL:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "cypari/convert.pyx":155
 *     return x
 * 
 * cpdef gen_to_integer(Gen x):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a PARI ``Gen`` to a Python ``int`` or ``long``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.gen_to_integer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_27gen_to_integer(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_26gen_to_integer[] = "\n    Convert a PARI ``Gen`` to a Python ``int`` or ``long``.\n\n    INPUT:\n\n    - ``x`` -- a PARI ``t_INT``, ``t_FRAC``, ``t_REAL``, a purely\n      real ``t_COMPLEX``, a ``t_INTMOD`` or ``t_PADIC`` (which are\n      lifted).\n\n    EXAMPLES::\n\n        sage: from cypari._pari import gen_to_integer\n        sage: a = gen_to_integer(pari(\"12345\")); a; isinstance(a, int)\n        12345\n        True\n        sage: int(gen_to_integer(pari(\"10^30\"))) == 1000000000000000000000000000000\n        True\n        sage: gen_to_integer(pari(\"19/5\"))\n        3\n        sage: gen_to_integer(pari(\"1 + 0.0*I\"))\n        1\n        sage: gen_to_integer(pari(\"3/2 + 0.0*I\"))\n        1\n        sage: gen_to_integer(pari(\"Mod(-1, 11)\"))\n        10\n        sage: gen_to_integer(pari(\"5 + O(5^10)\"))\n        5\n        sage: gen_to_integer(pari(\"Pol(42)\"))\n        42\n        sage: gen_to_integer(pari(\"x\"))\n        Traceback (most recent call last):\n        ...\n        TypeError: unable to convert PARI object x of type t_POL to an integer\n        sage: gen_to_integer(pari(\"x + O(x^2)\"))\n        Traceback (most recent call last):\n        ...\n        TypeError: unable to convert PARI object x + O(x^2) of type t_SER to an integer\n        sage: gen_to_integer(pari(\"1 + I\"))\n        Traceback (most recent call last):\n        ...\n        TypeError: unable to convert PARI object 1 + I of type t_COMPLEX to an integer\n\n    TESTS::\n\n        sage: for i in range(10000):\n        ....:     x = 3**i\n        ....:     if int(pari(x)) != int(x):\n        ....:         print(x)\n\n        sage: gen_to_integer(pari(\"1.0 - 2^64\")) == -18446744073709551615\n        True\n        sage: gen_to_integer(pari(\"1 - 2^64\")) == -18446744073709551615\n        True\n\n    Check some corner cases::\n\n        sage: for s in [1, -1]:\n        ....:     for a in [1, 2**31, 2**32, 2**63, 2**64]:\n        ....:         for b in [-1, 0, 1]:\n        ....:             Nstr ="" str(s * (a + b))\n        ....:             N1 = gen_to_integer(pari(Nstr))  # Convert via PARI\n        ....:             N2 = int(Nstr)                   # Convert via Python\n        ....:             if N1 != N2:\n        ....:                 print(Nstr, N1, N2)\n        ....:             if type(N1) is not type(N2):\n        ....:                 print(N1, type(N1), N2, type(N2))\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_27gen_to_integer(PyObject *__pyx_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gen_to_integer (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_6cypari_5_pari_Gen, 1, "x", 0))) __PYX_ERR(5, 155, __pyx_L1_error)
  __pyx_r = __pyx_pf_6cypari_5_pari_26gen_to_integer(__pyx_self, ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_26gen_to_integer(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("gen_to_integer", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6cypari_5_pari_gen_to_integer(__pyx_v_x, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 155, __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("cypari._pari.gen_to_integer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":248
 *     return res
 * 
 * cdef GEN gtoi(GEN g0) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Convert a PARI object to a PARI integer.
 */

static GEN __pyx_f_6cypari_5_pari_gtoi(GEN __pyx_v_g0) {
  GEN __pyx_v_g;
  GEN __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("gtoi", 0);

  /* "cypari/convert.pyx":254
 *     This function is shallow and not stack-clean.
 *     """
 *     if typ(g0) == t_INT:             # <<<<<<<<<<<<<<
 *         return g0
 *     cdef GEN g
 */
  __pyx_t_1 = ((typ(__pyx_v_g0) == t_INT) != 0);
  if (__pyx_t_1) {

    /* "cypari/convert.pyx":255
 *     """
 *     if typ(g0) == t_INT:
 *         return g0             # <<<<<<<<<<<<<<
 *     cdef GEN g
 *     try:
 */
    __pyx_r = __pyx_v_g0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":254
 *     This function is shallow and not stack-clean.
 *     """
 *     if typ(g0) == t_INT:             # <<<<<<<<<<<<<<
 *         return g0
 *     cdef GEN g
 */
  }

  /* "cypari/convert.pyx":257
 *         return g0
 *     cdef GEN g
 *     try:             # <<<<<<<<<<<<<<
 *         sig_on()
 *         g = simplify_shallow(g0)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "cypari/convert.pyx":258
 *     cdef GEN g
 *     try:
 *         sig_on()             # <<<<<<<<<<<<<<
 *         g = simplify_shallow(g0)
 *         if typ(g) == t_COMPLEX:
 */
      __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(5, 258, __pyx_L4_error)

      /* "cypari/convert.pyx":259
 *     try:
 *         sig_on()
 *         g = simplify_shallow(g0)             # <<<<<<<<<<<<<<
 *         if typ(g) == t_COMPLEX:
 *             if gequal0(gel(g,2)):
 */
      __pyx_v_g = simplify_shallow(__pyx_v_g0);

      /* "cypari/convert.pyx":260
 *         sig_on()
 *         g = simplify_shallow(g0)
 *         if typ(g) == t_COMPLEX:             # <<<<<<<<<<<<<<
 *             if gequal0(gel(g,2)):
 *                 g = gel(g,1)
 */
      __pyx_t_1 = ((typ(__pyx_v_g) == t_COMPLEX) != 0);
      if (__pyx_t_1) {

        /* "cypari/convert.pyx":261
 *         g = simplify_shallow(g0)
 *         if typ(g) == t_COMPLEX:
 *             if gequal0(gel(g,2)):             # <<<<<<<<<<<<<<
 *                 g = gel(g,1)
 *         if typ(g) == t_INTMOD:
 */
        __pyx_t_1 = (gequal0(gel(__pyx_v_g, 2)) != 0);
        if (__pyx_t_1) {

          /* "cypari/convert.pyx":262
 *         if typ(g) == t_COMPLEX:
 *             if gequal0(gel(g,2)):
 *                 g = gel(g,1)             # <<<<<<<<<<<<<<
 *         if typ(g) == t_INTMOD:
 *             g = gel(g,2)
 */
          __pyx_v_g = gel(__pyx_v_g, 1);

          /* "cypari/convert.pyx":261
 *         g = simplify_shallow(g0)
 *         if typ(g) == t_COMPLEX:
 *             if gequal0(gel(g,2)):             # <<<<<<<<<<<<<<
 *                 g = gel(g,1)
 *         if typ(g) == t_INTMOD:
 */
        }

        /* "cypari/convert.pyx":260
 *         sig_on()
 *         g = simplify_shallow(g0)
 *         if typ(g) == t_COMPLEX:             # <<<<<<<<<<<<<<
 *             if gequal0(gel(g,2)):
 *                 g = gel(g,1)
 */
      }

      /* "cypari/convert.pyx":263
 *             if gequal0(gel(g,2)):
 *                 g = gel(g,1)
 *         if typ(g) == t_INTMOD:             # <<<<<<<<<<<<<<
 *             g = gel(g,2)
 *         g = trunc_safe(g)
 */
      __pyx_t_1 = ((typ(__pyx_v_g) == t_INTMOD) != 0);
      if (__pyx_t_1) {

        /* "cypari/convert.pyx":264
 *                 g = gel(g,1)
 *         if typ(g) == t_INTMOD:
 *             g = gel(g,2)             # <<<<<<<<<<<<<<
 *         g = trunc_safe(g)
 *         if typ(g) != t_INT:
 */
        __pyx_v_g = gel(__pyx_v_g, 2);

        /* "cypari/convert.pyx":263
 *             if gequal0(gel(g,2)):
 *                 g = gel(g,1)
 *         if typ(g) == t_INTMOD:             # <<<<<<<<<<<<<<
 *             g = gel(g,2)
 *         g = trunc_safe(g)
 */
      }

      /* "cypari/convert.pyx":265
 *         if typ(g) == t_INTMOD:
 *             g = gel(g,2)
 *         g = trunc_safe(g)             # <<<<<<<<<<<<<<
 *         if typ(g) != t_INT:
 *             sig_error()
 */
      __pyx_v_g = trunc_safe(__pyx_v_g);

      /* "cypari/convert.pyx":266
 *             g = gel(g,2)
 *         g = trunc_safe(g)
 *         if typ(g) != t_INT:             # <<<<<<<<<<<<<<
 *             sig_error()
 *         sig_off()
 */
      __pyx_t_1 = ((typ(__pyx_v_g) != t_INT) != 0);
      if (__pyx_t_1) {

        /* "cypari/convert.pyx":267
 *         g = trunc_safe(g)
 *         if typ(g) != t_INT:
 *             sig_error()             # <<<<<<<<<<<<<<
 *         sig_off()
 *     except RuntimeError:
 */
        sig_error();

        /* "cypari/convert.pyx":266
 *             g = gel(g,2)
 *         g = trunc_safe(g)
 *         if typ(g) != t_INT:             # <<<<<<<<<<<<<<
 *             sig_error()
 *         sig_off()
 */
      }

      /* "cypari/convert.pyx":268
 *         if typ(g) != t_INT:
 *             sig_error()
 *         sig_off()             # <<<<<<<<<<<<<<
 *     except RuntimeError:
 *         raise TypeError(stack_sprintf(
 */
      sig_off();

      /* "cypari/convert.pyx":257
 *         return g0
 *     cdef GEN g
 *     try:             # <<<<<<<<<<<<<<
 *         sig_on()
 *         g = simplify_shallow(g0)
 */
    }
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;

    /* "cypari/convert.pyx":269
 *             sig_error()
 *         sig_off()
 *     except RuntimeError:             # <<<<<<<<<<<<<<
 *         raise TypeError(stack_sprintf(
 *             "unable to convert PARI object %Ps of type %s to an integer",
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_RuntimeError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.gtoi", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(5, 269, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_8);

      /* "cypari/convert.pyx":270
 *         sig_off()
 *     except RuntimeError:
 *         raise TypeError(stack_sprintf(             # <<<<<<<<<<<<<<
 *             "unable to convert PARI object %Ps of type %s to an integer",
 *             g0, type_name(typ(g0))))
 */
      __pyx_t_9 = __Pyx_PyBytes_FromString(stack_sprintf(((char const *)"unable to convert PARI object %Ps of type %s to an integer"), __pyx_v_g0, type_name(typ(__pyx_v_g0)))); if (unlikely(!__pyx_t_9)) __PYX_ERR(5, 270, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(5, 270, __pyx_L6_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __PYX_ERR(5, 270, __pyx_L6_except_error)
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "cypari/convert.pyx":257
 *         return g0
 *     cdef GEN g
 *     try:             # <<<<<<<<<<<<<<
 *         sig_on()
 *         g = simplify_shallow(g0)
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "cypari/convert.pyx":273
 *             "unable to convert PARI object %Ps of type %s to an integer",
 *             g0, type_name(typ(g0))))
 *     return g             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_g;
  goto __pyx_L0;

  /* "cypari/convert.pyx":248
 *     return res
 * 
 * cdef GEN gtoi(GEN g0) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Convert a PARI object to a PARI integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cypari._pari.gtoi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":276
 * 
 * 
 * cdef GEN PyLong_AsGEN(x):             # <<<<<<<<<<<<<<
 *     cdef PyLongObject* L = <PyLongObject*>(x)
 *     cdef const digit* D = L.ob_digit
 */

static GEN __pyx_f_6cypari_5_pari_PyLong_AsGEN(PyObject *__pyx_v_x) {
  PyLongObject *__pyx_v_L;
  digit const *__pyx_v_D;
  Py_ssize_t __pyx_v_sizedigits;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_sgn;
  size_t __pyx_v_sizebits;
  size_t __pyx_v_sizewords;
  size_t __pyx_v_bit;
  size_t __pyx_v_dgt;
  pari_ulong __pyx_v_w;
  PyObject *__pyx_v_pariwords = 0;
  GEN __pyx_v_g;
  GEN __pyx_v_ptr;
  size_t __pyx_v_i;
  GEN __pyx_r;
  __Pyx_RefNannyDeclarations
  digit *__pyx_t_1;
  int __pyx_t_2;
  size_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  long __pyx_t_7;
  size_t __pyx_t_8;
  size_t __pyx_t_9;
  __Pyx_RefNannySetupContext("PyLong_AsGEN", 0);

  /* "cypari/convert.pyx":277
 * 
 * cdef GEN PyLong_AsGEN(x):
 *     cdef PyLongObject* L = <PyLongObject*>(x)             # <<<<<<<<<<<<<<
 *     cdef const digit* D = L.ob_digit
 * 
 */
  __pyx_v_L = ((PyLongObject *)__pyx_v_x);

  /* "cypari/convert.pyx":278
 * cdef GEN PyLong_AsGEN(x):
 *     cdef PyLongObject* L = <PyLongObject*>(x)
 *     cdef const digit* D = L.ob_digit             # <<<<<<<<<<<<<<
 * 
 *     # Size of the input
 */
  __pyx_t_1 = __pyx_v_L->ob_digit;
  __pyx_v_D = __pyx_t_1;

  /* "cypari/convert.pyx":284
 *     cdef pari_longword sgn
 * 
 *     if Py_SIZE(x) == 0:             # <<<<<<<<<<<<<<
 *         return gen_0
 *     elif Py_SIZE(x) > 0:
 */
  __pyx_t_2 = ((Py_SIZE(__pyx_v_x) == 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":285
 * 
 *     if Py_SIZE(x) == 0:
 *         return gen_0             # <<<<<<<<<<<<<<
 *     elif Py_SIZE(x) > 0:
 *         sizedigits = Py_SIZE(x)
 */
    __pyx_r = gen_0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":284
 *     cdef pari_longword sgn
 * 
 *     if Py_SIZE(x) == 0:             # <<<<<<<<<<<<<<
 *         return gen_0
 *     elif Py_SIZE(x) > 0:
 */
  }

  /* "cypari/convert.pyx":286
 *     if Py_SIZE(x) == 0:
 *         return gen_0
 *     elif Py_SIZE(x) > 0:             # <<<<<<<<<<<<<<
 *         sizedigits = Py_SIZE(x)
 *         sgn = evalsigne(1)
 */
  __pyx_t_2 = ((Py_SIZE(__pyx_v_x) > 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":287
 *         return gen_0
 *     elif Py_SIZE(x) > 0:
 *         sizedigits = Py_SIZE(x)             # <<<<<<<<<<<<<<
 *         sgn = evalsigne(1)
 *     else:
 */
    __pyx_v_sizedigits = Py_SIZE(__pyx_v_x);

    /* "cypari/convert.pyx":288
 *     elif Py_SIZE(x) > 0:
 *         sizedigits = Py_SIZE(x)
 *         sgn = evalsigne(1)             # <<<<<<<<<<<<<<
 *     else:
 *         sizedigits = -Py_SIZE(x)
 */
    __pyx_v_sgn = evalsigne(1);

    /* "cypari/convert.pyx":286
 *     if Py_SIZE(x) == 0:
 *         return gen_0
 *     elif Py_SIZE(x) > 0:             # <<<<<<<<<<<<<<
 *         sizedigits = Py_SIZE(x)
 *         sgn = evalsigne(1)
 */
    goto __pyx_L3;
  }

  /* "cypari/convert.pyx":290
 *         sgn = evalsigne(1)
 *     else:
 *         sizedigits = -Py_SIZE(x)             # <<<<<<<<<<<<<<
 *         sgn = evalsigne(-1)
 * 
 */
  /*else*/ {
    __pyx_v_sizedigits = (-Py_SIZE(__pyx_v_x));

    /* "cypari/convert.pyx":291
 *     else:
 *         sizedigits = -Py_SIZE(x)
 *         sgn = evalsigne(-1)             # <<<<<<<<<<<<<<
 * 
 *     # Size of the output, in bits and in words
 */
    __pyx_v_sgn = evalsigne(-1L);
  }
  __pyx_L3:;

  /* "cypari/convert.pyx":294
 * 
 *     # Size of the output, in bits and in words
 *     cdef size_t sizebits = sizedigits * PyLong_SHIFT             # <<<<<<<<<<<<<<
 *     cdef size_t sizewords = (sizebits + BITS_IN_LONG - 1) // BITS_IN_LONG
 * 
 */
  __pyx_v_sizebits = (__pyx_v_sizedigits * PyLong_SHIFT);

  /* "cypari/convert.pyx":295
 *     # Size of the output, in bits and in words
 *     cdef size_t sizebits = sizedigits * PyLong_SHIFT
 *     cdef size_t sizewords = (sizebits + BITS_IN_LONG - 1) // BITS_IN_LONG             # <<<<<<<<<<<<<<
 * 
 *     # Compute the most significant word of the output.
 */
  __pyx_t_3 = ((__pyx_v_sizebits + BITS_IN_LONG) - 1);
  if (unlikely(BITS_IN_LONG == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(5, 295, __pyx_L1_error)
  }
  __pyx_v_sizewords = (__pyx_t_3 / BITS_IN_LONG);

  /* "cypari/convert.pyx":302
 *     # in which case we need to decrease sizewords.
 *     # See the loop below for an explanation of this code.
 *     cdef size_t bit = (sizewords - 1) * BITS_IN_LONG             # <<<<<<<<<<<<<<
 *     cdef size_t dgt = bit // PyLong_SHIFT
 *     bit = bit % PyLong_SHIFT
 */
  __pyx_v_bit = ((__pyx_v_sizewords - 1) * BITS_IN_LONG);

  /* "cypari/convert.pyx":303
 *     # See the loop below for an explanation of this code.
 *     cdef size_t bit = (sizewords - 1) * BITS_IN_LONG
 *     cdef size_t dgt = bit // PyLong_SHIFT             # <<<<<<<<<<<<<<
 *     bit = bit % PyLong_SHIFT
 * 
 */
  if (unlikely(PyLong_SHIFT == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(5, 303, __pyx_L1_error)
  }
  __pyx_v_dgt = (__pyx_v_bit / PyLong_SHIFT);

  /* "cypari/convert.pyx":304
 *     cdef size_t bit = (sizewords - 1) * BITS_IN_LONG
 *     cdef size_t dgt = bit // PyLong_SHIFT
 *     bit = bit % PyLong_SHIFT             # <<<<<<<<<<<<<<
 * 
 *     cdef ulong w = <ulong>(D[dgt]) >> bit
 */
  if (unlikely(PyLong_SHIFT == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(5, 304, __pyx_L1_error)
  }
  __pyx_v_bit = (__pyx_v_bit % PyLong_SHIFT);

  /* "cypari/convert.pyx":306
 *     bit = bit % PyLong_SHIFT
 * 
 *     cdef ulong w = <ulong>(D[dgt]) >> bit             # <<<<<<<<<<<<<<
 *     if 1*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+1 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 */
  __pyx_v_w = (((pari_ulong)(__pyx_v_D[__pyx_v_dgt])) >> __pyx_v_bit);

  /* "cypari/convert.pyx":307
 * 
 *     cdef ulong w = <ulong>(D[dgt]) >> bit
 *     if 1*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+1 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:
 */
  __pyx_t_4 = ((((1 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (((__pyx_v_dgt + 1) < ((pari_ulong)__pyx_v_sizedigits)) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":308
 *     cdef ulong w = <ulong>(D[dgt]) >> bit
 *     if 1*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+1 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 */
    __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 1)])) << ((1 * PyLong_SHIFT) - __pyx_v_bit)));

    /* "cypari/convert.pyx":307
 * 
 *     cdef ulong w = <ulong>(D[dgt]) >> bit
 *     if 1*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+1 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:
 */
  }

  /* "cypari/convert.pyx":309
 *     if 1*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+1 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:
 */
  __pyx_t_4 = ((((2 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_4 = (((__pyx_v_dgt + 2) < ((pari_ulong)__pyx_v_sizedigits)) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":310
 *         w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 */
    __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 2)])) << ((2 * PyLong_SHIFT) - __pyx_v_bit)));

    /* "cypari/convert.pyx":309
 *     if 1*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+1 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:
 */
  }

  /* "cypari/convert.pyx":311
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:
 */
  __pyx_t_4 = ((((3 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_4 = (((__pyx_v_dgt + 3) < ((pari_ulong)__pyx_v_sizedigits)) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":312
 *         w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 */
    __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 3)])) << ((3 * PyLong_SHIFT) - __pyx_v_bit)));

    /* "cypari/convert.pyx":311
 *     if 2*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+2 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:
 */
  }

  /* "cypari/convert.pyx":313
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *     if 5*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+5 < <ulong>sizedigits:
 */
  __pyx_t_4 = ((((4 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_4 = (((__pyx_v_dgt + 4) < ((pari_ulong)__pyx_v_sizedigits)) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":314
 *         w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *     if 5*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+5 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
 */
    __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 4)])) << ((4 * PyLong_SHIFT) - __pyx_v_bit)));

    /* "cypari/convert.pyx":313
 *     if 3*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+3 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *     if 5*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+5 < <ulong>sizedigits:
 */
  }

  /* "cypari/convert.pyx":315
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *     if 5*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+5 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
 * 
 */
  __pyx_t_4 = ((((5 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_4 = (((__pyx_v_dgt + 5) < ((pari_ulong)__pyx_v_sizedigits)) != 0);
  __pyx_t_2 = __pyx_t_4;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":316
 *         w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *     if 5*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+5 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 * 
 *     # Effective size in words plus 2 special codewords
 */
    __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 5)])) << ((5 * PyLong_SHIFT) - __pyx_v_bit)));

    /* "cypari/convert.pyx":315
 *     if 4*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+4 < <ulong>sizedigits:
 *         w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *     if 5*PyLong_SHIFT - bit < BITS_IN_LONG and dgt+5 < <ulong>sizedigits:             # <<<<<<<<<<<<<<
 *         w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
 * 
 */
  }

  /* "cypari/convert.pyx":319
 * 
 *     # Effective size in words plus 2 special codewords
 *     cdef pariwords = sizewords+2 if w else sizewords+1             # <<<<<<<<<<<<<<
 *     cdef GEN g = cgeti(pariwords)
 *     g[1] = sgn + evallgefint(pariwords)
 */
  if ((__pyx_v_w != 0)) {
    __pyx_t_6 = __Pyx_PyInt_FromSize_t((__pyx_v_sizewords + 2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __pyx_t_6 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyInt_FromSize_t((__pyx_v_sizewords + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 319, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __pyx_t_6 = 0;
  }
  __pyx_v_pariwords = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "cypari/convert.pyx":320
 *     # Effective size in words plus 2 special codewords
 *     cdef pariwords = sizewords+2 if w else sizewords+1
 *     cdef GEN g = cgeti(pariwords)             # <<<<<<<<<<<<<<
 *     g[1] = sgn + evallgefint(pariwords)
 * 
 */
  __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_v_pariwords); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(5, 320, __pyx_L1_error)
  __pyx_v_g = cgeti(__pyx_t_7);

  /* "cypari/convert.pyx":321
 *     cdef pariwords = sizewords+2 if w else sizewords+1
 *     cdef GEN g = cgeti(pariwords)
 *     g[1] = sgn + evallgefint(pariwords)             # <<<<<<<<<<<<<<
 * 
 *     if w:
 */
  __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_v_pariwords); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(5, 321, __pyx_L1_error)
  (__pyx_v_g[1]) = (__pyx_v_sgn + evallgefint(__pyx_t_7));

  /* "cypari/convert.pyx":323
 *     g[1] = sgn + evallgefint(pariwords)
 * 
 *     if w:             # <<<<<<<<<<<<<<
 *         int_MSW(g)[0] = w
 * 
 */
  __pyx_t_2 = (__pyx_v_w != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":324
 * 
 *     if w:
 *         int_MSW(g)[0] = w             # <<<<<<<<<<<<<<
 * 
 *     # Fill all words
 */
    (int_MSW(__pyx_v_g)[0]) = __pyx_v_w;

    /* "cypari/convert.pyx":323
 *     g[1] = sgn + evallgefint(pariwords)
 * 
 *     if w:             # <<<<<<<<<<<<<<
 *         int_MSW(g)[0] = w
 * 
 */
  }

  /* "cypari/convert.pyx":327
 * 
 *     # Fill all words
 *     cdef GEN ptr = int_LSW(g)             # <<<<<<<<<<<<<<
 *     cdef size_t i
 *     for i in range(sizewords - 1):
 */
  __pyx_v_ptr = int_LSW(__pyx_v_g);

  /* "cypari/convert.pyx":329
 *     cdef GEN ptr = int_LSW(g)
 *     cdef size_t i
 *     for i in range(sizewords - 1):             # <<<<<<<<<<<<<<
 *         # The least significant bit of word number i of the output
 *         # integer is bit number "bit" of Python digit "dgt".
 */
  __pyx_t_3 = (__pyx_v_sizewords - 1);
  __pyx_t_8 = __pyx_t_3;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "cypari/convert.pyx":332
 *         # The least significant bit of word number i of the output
 *         # integer is bit number "bit" of Python digit "dgt".
 *         bit = i * BITS_IN_LONG             # <<<<<<<<<<<<<<
 *         dgt = bit // PyLong_SHIFT
 *         bit = bit % PyLong_SHIFT
 */
    __pyx_v_bit = (__pyx_v_i * BITS_IN_LONG);

    /* "cypari/convert.pyx":333
 *         # integer is bit number "bit" of Python digit "dgt".
 *         bit = i * BITS_IN_LONG
 *         dgt = bit // PyLong_SHIFT             # <<<<<<<<<<<<<<
 *         bit = bit % PyLong_SHIFT
 * 
 */
    if (unlikely(PyLong_SHIFT == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(5, 333, __pyx_L1_error)
    }
    __pyx_v_dgt = (__pyx_v_bit / PyLong_SHIFT);

    /* "cypari/convert.pyx":334
 *         bit = i * BITS_IN_LONG
 *         dgt = bit // PyLong_SHIFT
 *         bit = bit % PyLong_SHIFT             # <<<<<<<<<<<<<<
 * 
 *         # Now construct the output word from the Python digits:
 */
    if (unlikely(PyLong_SHIFT == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(5, 334, __pyx_L1_error)
    }
    __pyx_v_bit = (__pyx_v_bit % PyLong_SHIFT);

    /* "cypari/convert.pyx":340
 *         # BITS_IN_LONG <= 76.  The compiler should optimize away all
 *         # but one of the "if" statements below.
 *         w = <ulong>(D[dgt]) >> bit             # <<<<<<<<<<<<<<
 *         if 1*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 */
    __pyx_v_w = (((pari_ulong)(__pyx_v_D[__pyx_v_dgt])) >> __pyx_v_bit);

    /* "cypari/convert.pyx":341
 *         # but one of the "if" statements below.
 *         w = <ulong>(D[dgt]) >> bit
 *         if 1*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    __pyx_t_2 = ((((1 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
    if (__pyx_t_2) {

      /* "cypari/convert.pyx":342
 *         w = <ulong>(D[dgt]) >> bit
 *         if 1*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 */
      __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 1)])) << ((1 * PyLong_SHIFT) - __pyx_v_bit)));

      /* "cypari/convert.pyx":341
 *         # but one of the "if" statements below.
 *         w = <ulong>(D[dgt]) >> bit
 *         if 1*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    }

    /* "cypari/convert.pyx":343
 *         if 1*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    __pyx_t_2 = ((((2 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
    if (__pyx_t_2) {

      /* "cypari/convert.pyx":344
 *             w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 */
      __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 2)])) << ((2 * PyLong_SHIFT) - __pyx_v_bit)));

      /* "cypari/convert.pyx":343
 *         if 1*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+1]) << (1*PyLong_SHIFT - bit)
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    }

    /* "cypari/convert.pyx":345
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    __pyx_t_2 = ((((3 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
    if (__pyx_t_2) {

      /* "cypari/convert.pyx":346
 *             w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 */
      __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 3)])) << ((3 * PyLong_SHIFT) - __pyx_v_bit)));

      /* "cypari/convert.pyx":345
 *         if 2*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+2]) << (2*PyLong_SHIFT - bit)
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    }

    /* "cypari/convert.pyx":347
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *         if 5*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    __pyx_t_2 = ((((4 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
    if (__pyx_t_2) {

      /* "cypari/convert.pyx":348
 *             w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 *         if 5*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
 */
      __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 4)])) << ((4 * PyLong_SHIFT) - __pyx_v_bit)));

      /* "cypari/convert.pyx":347
 *         if 3*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+3]) << (3*PyLong_SHIFT - bit)
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *         if 5*PyLong_SHIFT - bit < BITS_IN_LONG:
 */
    }

    /* "cypari/convert.pyx":349
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *         if 5*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
 * 
 */
    __pyx_t_2 = ((((5 * PyLong_SHIFT) - __pyx_v_bit) < BITS_IN_LONG) != 0);
    if (__pyx_t_2) {

      /* "cypari/convert.pyx":350
 *             w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *         if 5*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)             # <<<<<<<<<<<<<<
 * 
 *         ptr[0] = w
 */
      __pyx_v_w = (__pyx_v_w + (((pari_ulong)(__pyx_v_D[(__pyx_v_dgt + 5)])) << ((5 * PyLong_SHIFT) - __pyx_v_bit)));

      /* "cypari/convert.pyx":349
 *         if 4*PyLong_SHIFT - bit < BITS_IN_LONG:
 *             w += <ulong>(D[dgt+4]) << (4*PyLong_SHIFT - bit)
 *         if 5*PyLong_SHIFT - bit < BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *             w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
 * 
 */
    }

    /* "cypari/convert.pyx":352
 *             w += <ulong>(D[dgt+5]) << (5*PyLong_SHIFT - bit)
 * 
 *         ptr[0] = w             # <<<<<<<<<<<<<<
 *         ptr = int_nextW(ptr)
 * 
 */
    (__pyx_v_ptr[0]) = __pyx_v_w;

    /* "cypari/convert.pyx":353
 * 
 *         ptr[0] = w
 *         ptr = int_nextW(ptr)             # <<<<<<<<<<<<<<
 * 
 *     return g
 */
    __pyx_v_ptr = int_nextW(__pyx_v_ptr);
  }

  /* "cypari/convert.pyx":355
 *         ptr = int_nextW(ptr)
 * 
 *     return g             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_g;
  goto __pyx_L0;

  /* "cypari/convert.pyx":276
 * 
 * 
 * cdef GEN PyLong_AsGEN(x):             # <<<<<<<<<<<<<<
 *     cdef PyLongObject* L = <PyLongObject*>(x)
 *     cdef const digit* D = L.ob_digit
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_WriteUnraisable("cypari._pari.PyLong_AsGEN", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pariwords);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":362
 * ####################################
 * 
 * cdef Gen new_t_POL_from_int_star(int* vals, unsigned long length, long varnum):             # <<<<<<<<<<<<<<
 *     """
 *     Note that degree + 1 = length, so that recognizing 0 is easier.
 */

static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_t_POL_from_int_star(int *__pyx_v_vals, unsigned long __pyx_v_length, long __pyx_v_varnum) {
  GEN __pyx_v_z;
  unsigned long __pyx_v_i;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  unsigned long __pyx_t_3;
  unsigned long __pyx_t_4;
  unsigned long __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("new_t_POL_from_int_star", 0);

  /* "cypari/convert.pyx":371
 *     cdef unsigned long i
 * 
 *     sig_on()             # <<<<<<<<<<<<<<
 *     z = cgetg(length + 2, t_POL)
 *     if length == 0:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(5, 371, __pyx_L1_error)

  /* "cypari/convert.pyx":372
 * 
 *     sig_on()
 *     z = cgetg(length + 2, t_POL)             # <<<<<<<<<<<<<<
 *     if length == 0:
 *         # Polynomial is zero
 */
  __pyx_v_z = cgetg((__pyx_v_length + 2), t_POL);

  /* "cypari/convert.pyx":373
 *     sig_on()
 *     z = cgetg(length + 2, t_POL)
 *     if length == 0:             # <<<<<<<<<<<<<<
 *         # Polynomial is zero
 *         z[1] = evalvarn(varnum) + evalsigne(0)
 */
  __pyx_t_2 = ((__pyx_v_length == 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":375
 *     if length == 0:
 *         # Polynomial is zero
 *         z[1] = evalvarn(varnum) + evalsigne(0)             # <<<<<<<<<<<<<<
 *     else:
 *         z[1] = evalvarn(varnum) + evalsigne(1)
 */
    (__pyx_v_z[1]) = (evalvarn(__pyx_v_varnum) + evalsigne(0));

    /* "cypari/convert.pyx":373
 *     sig_on()
 *     z = cgetg(length + 2, t_POL)
 *     if length == 0:             # <<<<<<<<<<<<<<
 *         # Polynomial is zero
 *         z[1] = evalvarn(varnum) + evalsigne(0)
 */
    goto __pyx_L3;
  }

  /* "cypari/convert.pyx":377
 *         z[1] = evalvarn(varnum) + evalsigne(0)
 *     else:
 *         z[1] = evalvarn(varnum) + evalsigne(1)             # <<<<<<<<<<<<<<
 *         for i in range(length):
 *             set_gel(z, i+2, stoi(vals[i]))
 */
  /*else*/ {
    (__pyx_v_z[1]) = (evalvarn(__pyx_v_varnum) + evalsigne(1));

    /* "cypari/convert.pyx":378
 *     else:
 *         z[1] = evalvarn(varnum) + evalsigne(1)
 *         for i in range(length):             # <<<<<<<<<<<<<<
 *             set_gel(z, i+2, stoi(vals[i]))
 * 
 */
    __pyx_t_3 = __pyx_v_length;
    __pyx_t_4 = __pyx_t_3;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "cypari/convert.pyx":379
 *         z[1] = evalvarn(varnum) + evalsigne(1)
 *         for i in range(length):
 *             set_gel(z, i+2, stoi(vals[i]))             # <<<<<<<<<<<<<<
 * 
 *     return new_gen(z)
 */
      (void)(set_gel(__pyx_v_z, (__pyx_v_i + 2), stoi((__pyx_v_vals[__pyx_v_i]))));
    }
  }
  __pyx_L3:;

  /* "cypari/convert.pyx":381
 *             set_gel(z, i+2, stoi(vals[i]))
 * 
 *     return new_gen(z)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_z)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/convert.pyx":362
 * ####################################
 * 
 * cdef Gen new_t_POL_from_int_star(int* vals, unsigned long length, long varnum):             # <<<<<<<<<<<<<<
 *     """
 *     Note that degree + 1 = length, so that recognizing 0 is easier.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.new_t_POL_from_int_star", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":384
 * 
 * 
 * cdef Gen new_gen_from_double(double x):             # <<<<<<<<<<<<<<
 *     # Pari has an odd concept where it attempts to track the accuracy
 *     # of floating-point 0; a floating-point zero might be 0.0e-20
 */

static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_gen_from_double(double __pyx_v_x) {
  GEN __pyx_v_g;
  GEN __pyx_v_G;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("new_gen_from_double", 0);

  /* "cypari/convert.pyx":401
 *     global prec
 * 
 *     sig_on()             # <<<<<<<<<<<<<<
 *     if x == 0:
 *         g = real_0_bit(-53)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(5, 401, __pyx_L1_error)

  /* "cypari/convert.pyx":402
 * 
 *     sig_on()
 *     if x == 0:             # <<<<<<<<<<<<<<
 *         g = real_0_bit(-53)
 *     else:
 */
  __pyx_t_2 = ((__pyx_v_x == 0.0) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":403
 *     sig_on()
 *     if x == 0:
 *         g = real_0_bit(-53)             # <<<<<<<<<<<<<<
 *     else:
 *         g = dbltor(x)
 */
    __pyx_v_g = real_0_bit(-53L);

    /* "cypari/convert.pyx":402
 * 
 *     sig_on()
 *     if x == 0:             # <<<<<<<<<<<<<<
 *         g = real_0_bit(-53)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "cypari/convert.pyx":405
 *         g = real_0_bit(-53)
 *     else:
 *         g = dbltor(x)             # <<<<<<<<<<<<<<
 *     if prec - 2 == 64 / BITS_IN_LONG:
 *         return new_gen(g)
 */
  /*else*/ {
    __pyx_v_g = dbltor(__pyx_v_x);
  }
  __pyx_L3:;

  /* "cypari/convert.pyx":406
 *     else:
 *         g = dbltor(x)
 *     if prec - 2 == 64 / BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *         return new_gen(g)
 *     else:
 */
  if (unlikely(BITS_IN_LONG == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(5, 406, __pyx_L1_error)
  }
  else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(BITS_IN_LONG == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(64))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(5, 406, __pyx_L1_error)
  }
  __pyx_t_2 = (((__pyx_v_6cypari_5_pari_prec - 2) == __Pyx_div_long(64, BITS_IN_LONG)) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":407
 *         g = dbltor(x)
 *     if prec - 2 == 64 / BITS_IN_LONG:
 *         return new_gen(g)             # <<<<<<<<<<<<<<
 *     else:
 *         G = bitprecision0(g, (prec - 2)*BITS_IN_LONG)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":406
 *     else:
 *         g = dbltor(x)
 *     if prec - 2 == 64 / BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *         return new_gen(g)
 *     else:
 */
  }

  /* "cypari/convert.pyx":409
 *         return new_gen(g)
 *     else:
 *         G = bitprecision0(g, (prec - 2)*BITS_IN_LONG)             # <<<<<<<<<<<<<<
 *         return new_gen(G)
 * 
 */
  /*else*/ {
    __pyx_v_G = bitprecision0(__pyx_v_g, ((__pyx_v_6cypari_5_pari_prec - 2) * BITS_IN_LONG));

    /* "cypari/convert.pyx":410
 *     else:
 *         G = bitprecision0(g, (prec - 2)*BITS_IN_LONG)
 *         return new_gen(G)             # <<<<<<<<<<<<<<
 * 
 * cdef Gen new_t_COMPLEX_from_double(double re, double im):
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_G)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "cypari/convert.pyx":384
 * 
 * 
 * cdef Gen new_gen_from_double(double x):             # <<<<<<<<<<<<<<
 *     # Pari has an odd concept where it attempts to track the accuracy
 *     # of floating-point 0; a floating-point zero might be 0.0e-20
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.new_gen_from_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":412
 *         return new_gen(G)
 * 
 * cdef Gen new_t_COMPLEX_from_double(double re, double im):             # <<<<<<<<<<<<<<
 *     sig_on()
 *     cdef GEN g = cgetg(3, t_COMPLEX), G
 */

static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_t_COMPLEX_from_double(double __pyx_v_re, double __pyx_v_im) {
  GEN __pyx_v_g;
  GEN __pyx_v_G;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("new_t_COMPLEX_from_double", 0);

  /* "cypari/convert.pyx":413
 * 
 * cdef Gen new_t_COMPLEX_from_double(double re, double im):
 *     sig_on()             # <<<<<<<<<<<<<<
 *     cdef GEN g = cgetg(3, t_COMPLEX), G
 *     if re == 0:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(5, 413, __pyx_L1_error)

  /* "cypari/convert.pyx":414
 * cdef Gen new_t_COMPLEX_from_double(double re, double im):
 *     sig_on()
 *     cdef GEN g = cgetg(3, t_COMPLEX), G             # <<<<<<<<<<<<<<
 *     if re == 0:
 *         set_gel(g, 1, gen_0)
 */
  __pyx_v_g = cgetg(3, t_COMPLEX);

  /* "cypari/convert.pyx":415
 *     sig_on()
 *     cdef GEN g = cgetg(3, t_COMPLEX), G
 *     if re == 0:             # <<<<<<<<<<<<<<
 *         set_gel(g, 1, gen_0)
 *     else:
 */
  __pyx_t_2 = ((__pyx_v_re == 0.0) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":416
 *     cdef GEN g = cgetg(3, t_COMPLEX), G
 *     if re == 0:
 *         set_gel(g, 1, gen_0)             # <<<<<<<<<<<<<<
 *     else:
 *         set_gel(g, 1, dbltor(re))
 */
    (void)(set_gel(__pyx_v_g, 1, gen_0));

    /* "cypari/convert.pyx":415
 *     sig_on()
 *     cdef GEN g = cgetg(3, t_COMPLEX), G
 *     if re == 0:             # <<<<<<<<<<<<<<
 *         set_gel(g, 1, gen_0)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "cypari/convert.pyx":418
 *         set_gel(g, 1, gen_0)
 *     else:
 *         set_gel(g, 1, dbltor(re))             # <<<<<<<<<<<<<<
 *     if im == 0:
 *         set_gel(g, 2, gen_0)
 */
  /*else*/ {
    (void)(set_gel(__pyx_v_g, 1, dbltor(__pyx_v_re)));
  }
  __pyx_L3:;

  /* "cypari/convert.pyx":419
 *     else:
 *         set_gel(g, 1, dbltor(re))
 *     if im == 0:             # <<<<<<<<<<<<<<
 *         set_gel(g, 2, gen_0)
 *     else:
 */
  __pyx_t_2 = ((__pyx_v_im == 0.0) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":420
 *         set_gel(g, 1, dbltor(re))
 *     if im == 0:
 *         set_gel(g, 2, gen_0)             # <<<<<<<<<<<<<<
 *     else:
 *         set_gel(g, 2, dbltor(im))
 */
    (void)(set_gel(__pyx_v_g, 2, gen_0));

    /* "cypari/convert.pyx":419
 *     else:
 *         set_gel(g, 1, dbltor(re))
 *     if im == 0:             # <<<<<<<<<<<<<<
 *         set_gel(g, 2, gen_0)
 *     else:
 */
    goto __pyx_L4;
  }

  /* "cypari/convert.pyx":422
 *         set_gel(g, 2, gen_0)
 *     else:
 *         set_gel(g, 2, dbltor(im))             # <<<<<<<<<<<<<<
 *     if prec - 2 == 64 / BITS_IN_LONG:
 *         return new_gen(g)
 */
  /*else*/ {
    (void)(set_gel(__pyx_v_g, 2, dbltor(__pyx_v_im)));
  }
  __pyx_L4:;

  /* "cypari/convert.pyx":423
 *     else:
 *         set_gel(g, 2, dbltor(im))
 *     if prec - 2 == 64 / BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *         return new_gen(g)
 *     else:
 */
  if (unlikely(BITS_IN_LONG == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(5, 423, __pyx_L1_error)
  }
  else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(BITS_IN_LONG == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(64))) {
    PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
    __PYX_ERR(5, 423, __pyx_L1_error)
  }
  __pyx_t_2 = (((__pyx_v_6cypari_5_pari_prec - 2) == __Pyx_div_long(64, BITS_IN_LONG)) != 0);
  if (__pyx_t_2) {

    /* "cypari/convert.pyx":424
 *         set_gel(g, 2, dbltor(im))
 *     if prec - 2 == 64 / BITS_IN_LONG:
 *         return new_gen(g)             # <<<<<<<<<<<<<<
 *     else:
 *         G = bitprecision0(g, (prec - 2)*BITS_IN_LONG)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 424, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":423
 *     else:
 *         set_gel(g, 2, dbltor(im))
 *     if prec - 2 == 64 / BITS_IN_LONG:             # <<<<<<<<<<<<<<
 *         return new_gen(g)
 *     else:
 */
  }

  /* "cypari/convert.pyx":426
 *         return new_gen(g)
 *     else:
 *         G = bitprecision0(g, (prec - 2)*BITS_IN_LONG)             # <<<<<<<<<<<<<<
 *         return new_gen(G)
 * 
 */
  /*else*/ {
    __pyx_v_G = bitprecision0(__pyx_v_g, ((__pyx_v_6cypari_5_pari_prec - 2) * BITS_IN_LONG));

    /* "cypari/convert.pyx":427
 *     else:
 *         G = bitprecision0(g, (prec - 2)*BITS_IN_LONG)
 *         return new_gen(G)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_G)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 427, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "cypari/convert.pyx":412
 *         return new_gen(G)
 * 
 * cdef Gen new_t_COMPLEX_from_double(double re, double im):             # <<<<<<<<<<<<<<
 *     sig_on()
 *     cdef GEN g = cgetg(3, t_COMPLEX), G
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.new_t_COMPLEX_from_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/convert.pyx":434
 * ####################################
 * 
 * cpdef gen_to_python(Gen z):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert the PARI element ``z`` to a Python object.
 */

static PyObject *__pyx_pw_6cypari_5_pari_29gen_to_python(PyObject *__pyx_self, PyObject *__pyx_v_z); /*proto*/
static PyObject *__pyx_f_6cypari_5_pari_gen_to_python(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_z, CYTHON_UNUSED int __pyx_skip_dispatch) {
  GEN __pyx_v_g;
  long __pyx_v_t;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_j;
  Py_ssize_t __pyx_v_nr;
  Py_ssize_t __pyx_v_nc;
  PyObject *__pyx_v_Fraction = NULL;
  PyObject *__pyx_v_num = NULL;
  PyObject *__pyx_v_den = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  GEN __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  double __pyx_t_16;
  __Pyx_RefNannySetupContext("gen_to_python", 0);

  /* "cypari/convert.pyx":594
 *         NotImplementedError: conversion not implemented for t_PADIC
 *     """
 *     cdef GEN g = z.g             # <<<<<<<<<<<<<<
 *     cdef long t = typ(g)
 *     cdef Py_ssize_t i, j, nr, nc
 */
  __pyx_t_1 = __pyx_v_z->__pyx_base.g;
  __pyx_v_g = __pyx_t_1;

  /* "cypari/convert.pyx":595
 *     """
 *     cdef GEN g = z.g
 *     cdef long t = typ(g)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i, j, nr, nc
 * 
 */
  __pyx_v_t = typ(__pyx_v_g);

  /* "cypari/convert.pyx":598
 *     cdef Py_ssize_t i, j, nr, nc
 * 
 *     if t == t_INT:             # <<<<<<<<<<<<<<
 *         return gen_to_integer(z)
 *     elif t == t_FRAC:
 */
  switch (__pyx_v_t) {
    case t_INT:

    /* "cypari/convert.pyx":599
 * 
 *     if t == t_INT:
 *         return gen_to_integer(z)             # <<<<<<<<<<<<<<
 *     elif t == t_FRAC:
 *         from fractions import Fraction
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_6cypari_5_pari_gen_to_integer(__pyx_v_z, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 599, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":598
 *     cdef Py_ssize_t i, j, nr, nc
 * 
 *     if t == t_INT:             # <<<<<<<<<<<<<<
 *         return gen_to_integer(z)
 *     elif t == t_FRAC:
 */
    break;
    case t_FRAC:

    /* "cypari/convert.pyx":601
 *         return gen_to_integer(z)
 *     elif t == t_FRAC:
 *         from fractions import Fraction             # <<<<<<<<<<<<<<
 *         num = gen_to_integer(z.numerator())
 *         den = gen_to_integer(z.denominator())
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_Fraction);
    __Pyx_GIVEREF(__pyx_n_s_Fraction);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Fraction);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_fractions, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Fraction); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_Fraction = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cypari/convert.pyx":602
 *     elif t == t_FRAC:
 *         from fractions import Fraction
 *         num = gen_to_integer(z.numerator())             # <<<<<<<<<<<<<<
 *         den = gen_to_integer(z.denominator())
 *         return Fraction(num, den)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_z), __pyx_n_s_numerator); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(5, 602, __pyx_L1_error)
    __pyx_t_2 = __pyx_f_6cypari_5_pari_gen_to_integer(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_num = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cypari/convert.pyx":603
 *         from fractions import Fraction
 *         num = gen_to_integer(z.numerator())
 *         den = gen_to_integer(z.denominator())             # <<<<<<<<<<<<<<
 *         return Fraction(num, den)
 *     elif t == t_REAL:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_z), __pyx_n_s_denominator); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 603, __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(5, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(5, 603, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6cypari_5_pari_gen_to_integer(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_den = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cypari/convert.pyx":604
 *         num = gen_to_integer(z.numerator())
 *         den = gen_to_integer(z.denominator())
 *         return Fraction(num, den)             # <<<<<<<<<<<<<<
 *     elif t == t_REAL:
 *         return rtodbl(g)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_Fraction);
    __pyx_t_2 = __pyx_v_Fraction; __pyx_t_4 = NULL;
    __pyx_t_5 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_5 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_num, __pyx_v_den};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 604, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_num, __pyx_v_den};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 604, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_num);
      __Pyx_GIVEREF(__pyx_v_num);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_num);
      __Pyx_INCREF(__pyx_v_den);
      __Pyx_GIVEREF(__pyx_v_den);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_den);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 604, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":600
 *     if t == t_INT:
 *         return gen_to_integer(z)
 *     elif t == t_FRAC:             # <<<<<<<<<<<<<<
 *         from fractions import Fraction
 *         num = gen_to_integer(z.numerator())
 */
    break;
    case t_REAL:

    /* "cypari/convert.pyx":606
 *         return Fraction(num, den)
 *     elif t == t_REAL:
 *         return rtodbl(g)             # <<<<<<<<<<<<<<
 *     elif t == t_COMPLEX:
 *         return complex(gen_to_python(z.real()), gen_to_python(z.imag()))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyFloat_FromDouble(rtodbl(__pyx_v_g)); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 606, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":605
 *         den = gen_to_integer(z.denominator())
 *         return Fraction(num, den)
 *     elif t == t_REAL:             # <<<<<<<<<<<<<<
 *         return rtodbl(g)
 *     elif t == t_COMPLEX:
 */
    break;
    case t_COMPLEX:

    /* "cypari/convert.pyx":608
 *         return rtodbl(g)
 *     elif t == t_COMPLEX:
 *         return complex(gen_to_python(z.real()), gen_to_python(z.imag()))             # <<<<<<<<<<<<<<
 *     elif t == t_VEC or t == t_COL:
 *         return [gen_to_python(x) for x in z.python_list()]
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_z), __pyx_n_s_real); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(5, 608, __pyx_L1_error)
    __pyx_t_2 = __pyx_f_6cypari_5_pari_gen_to_python(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3), 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_z), __pyx_n_s_imag); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(5, 608, __pyx_L1_error)
    __pyx_t_6 = __pyx_f_6cypari_5_pari_gen_to_python(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3), 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 608, __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_6);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":607
 *     elif t == t_REAL:
 *         return rtodbl(g)
 *     elif t == t_COMPLEX:             # <<<<<<<<<<<<<<
 *         return complex(gen_to_python(z.real()), gen_to_python(z.imag()))
 *     elif t == t_VEC or t == t_COL:
 */
    break;
    case t_VEC:

    /* "cypari/convert.pyx":609
 *     elif t == t_COMPLEX:
 *         return complex(gen_to_python(z.real()), gen_to_python(z.imag()))
 *     elif t == t_VEC or t == t_COL:             # <<<<<<<<<<<<<<
 *         return [gen_to_python(x) for x in z.python_list()]
 *     elif t == t_VECSMALL:
 */
    case t_COL:

    /* "cypari/convert.pyx":610
 *         return complex(gen_to_python(z.real()), gen_to_python(z.imag()))
 *     elif t == t_VEC or t == t_COL:
 *         return [gen_to_python(x) for x in z.python_list()]             # <<<<<<<<<<<<<<
 *     elif t == t_VECSMALL:
 *         return z.python_list_small()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_z), __pyx_n_s_python_list); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 610, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(5, 610, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(5, 610, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 610, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(5, 610, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 610, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_8(__pyx_t_2);
        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(5, 610, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_3);
      __pyx_t_3 = 0;
      if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(5, 610, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_6cypari_5_pari_gen_to_python(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(5, 610, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":609
 *     elif t == t_COMPLEX:
 *         return complex(gen_to_python(z.real()), gen_to_python(z.imag()))
 *     elif t == t_VEC or t == t_COL:             # <<<<<<<<<<<<<<
 *         return [gen_to_python(x) for x in z.python_list()]
 *     elif t == t_VECSMALL:
 */
    break;
    case t_VECSMALL:

    /* "cypari/convert.pyx":612
 *         return [gen_to_python(x) for x in z.python_list()]
 *     elif t == t_VECSMALL:
 *         return z.python_list_small()             # <<<<<<<<<<<<<<
 *     elif t == t_MAT:
 *         nc = lg(g)-1
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_z), __pyx_n_s_python_list_small); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_6 = (__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_6)) __PYX_ERR(5, 612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":611
 *     elif t == t_VEC or t == t_COL:
 *         return [gen_to_python(x) for x in z.python_list()]
 *     elif t == t_VECSMALL:             # <<<<<<<<<<<<<<
 *         return z.python_list_small()
 *     elif t == t_MAT:
 */
    break;
    case t_MAT:

    /* "cypari/convert.pyx":614
 *         return z.python_list_small()
 *     elif t == t_MAT:
 *         nc = lg(g)-1             # <<<<<<<<<<<<<<
 *         nr = 0 if nc == 0 else lg(gel(g,1))-1
 *         return [[gen_to_python(z[i,j]) for j in range(nc)] for i in range(nr)]
 */
    __pyx_v_nc = (lg(__pyx_v_g) - 1);

    /* "cypari/convert.pyx":615
 *     elif t == t_MAT:
 *         nc = lg(g)-1
 *         nr = 0 if nc == 0 else lg(gel(g,1))-1             # <<<<<<<<<<<<<<
 *         return [[gen_to_python(z[i,j]) for j in range(nc)] for i in range(nr)]
 *     elif t == t_INFINITY:
 */
    if (((__pyx_v_nc == 0) != 0)) {
      __pyx_t_7 = 0;
    } else {
      __pyx_t_7 = (lg(gel(__pyx_v_g, 1)) - 1);
    }
    __pyx_v_nr = __pyx_t_7;

    /* "cypari/convert.pyx":616
 *         nc = lg(g)-1
 *         nr = 0 if nc == 0 else lg(gel(g,1))-1
 *         return [[gen_to_python(z[i,j]) for j in range(nc)] for i in range(nr)]             # <<<<<<<<<<<<<<
 *     elif t == t_INFINITY:
 *         if inf_get_sign(g) >= 0:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __pyx_v_nr;
    __pyx_t_9 = __pyx_t_7;
    for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
      __pyx_v_i = __pyx_t_10;
      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __pyx_v_nc;
      __pyx_t_12 = __pyx_t_11;
      for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
        __pyx_v_j = __pyx_t_13;
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(5, 616, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_j); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 616, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 616, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_z), __pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(5, 616, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(5, 616, __pyx_L1_error)
        __pyx_t_14 = __pyx_f_6cypari_5_pari_gen_to_python(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4), 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(5, 616, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_14))) __PYX_ERR(5, 616, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_2))) __PYX_ERR(5, 616, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":613
 *     elif t == t_VECSMALL:
 *         return z.python_list_small()
 *     elif t == t_MAT:             # <<<<<<<<<<<<<<
 *         nc = lg(g)-1
 *         nr = 0 if nc == 0 else lg(gel(g,1))-1
 */
    break;
    case t_INFINITY:

    /* "cypari/convert.pyx":618
 *         return [[gen_to_python(z[i,j]) for j in range(nc)] for i in range(nr)]
 *     elif t == t_INFINITY:
 *         if inf_get_sign(g) >= 0:             # <<<<<<<<<<<<<<
 *             return float('inf')
 *         else:
 */
    __pyx_t_15 = ((inf_get_sign(__pyx_v_g) >= 0) != 0);
    if (__pyx_t_15) {

      /* "cypari/convert.pyx":619
 *     elif t == t_INFINITY:
 *         if inf_get_sign(g) >= 0:
 *             return float('inf')             # <<<<<<<<<<<<<<
 *         else:
 *             return -float('inf')
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = __Pyx_PyNumber_Float(__pyx_n_s_inf); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;

      /* "cypari/convert.pyx":618
 *         return [[gen_to_python(z[i,j]) for j in range(nc)] for i in range(nr)]
 *     elif t == t_INFINITY:
 *         if inf_get_sign(g) >= 0:             # <<<<<<<<<<<<<<
 *             return float('inf')
 *         else:
 */
    }

    /* "cypari/convert.pyx":621
 *             return float('inf')
 *         else:
 *             return -float('inf')             # <<<<<<<<<<<<<<
 *     elif t == t_STR:
 *         return str(z)
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_16 = __Pyx_PyObject_AsDouble(__pyx_n_s_inf); if (unlikely(__pyx_t_16 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(5, 621, __pyx_L1_error)
      __pyx_t_6 = PyFloat_FromDouble((-__pyx_t_16)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 621, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;
    }

    /* "cypari/convert.pyx":617
 *         nr = 0 if nc == 0 else lg(gel(g,1))-1
 *         return [[gen_to_python(z[i,j]) for j in range(nc)] for i in range(nr)]
 *     elif t == t_INFINITY:             # <<<<<<<<<<<<<<
 *         if inf_get_sign(g) >= 0:
 *             return float('inf')
 */
    break;
    case t_STR:

    /* "cypari/convert.pyx":623
 *             return -float('inf')
 *     elif t == t_STR:
 *         return str(z)             # <<<<<<<<<<<<<<
 *     else:
 *         raise NotImplementedError(f"conversion not implemented for {z.type()}")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), ((PyObject *)__pyx_v_z)); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/convert.pyx":622
 *         else:
 *             return -float('inf')
 *     elif t == t_STR:             # <<<<<<<<<<<<<<
 *         return str(z)
 *     else:
 */
    break;
    default:

    /* "cypari/convert.pyx":625
 *         return str(z)
 *     else:
 *         raise NotImplementedError(f"conversion not implemented for {z.type()}")             # <<<<<<<<<<<<<<
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_z), __pyx_n_s_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_6 = (__pyx_t_14) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_14) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_conversion_not_implemented_for, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(5, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_NotImplementedError, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(5, 625, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(5, 625, __pyx_L1_error)
    break;
  }

  /* "cypari/convert.pyx":434
 * ####################################
 * 
 * cpdef gen_to_python(Gen z):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert the PARI element ``z`` to a Python object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("cypari._pari.gen_to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Fraction);
  __Pyx_XDECREF(__pyx_v_num);
  __Pyx_XDECREF(__pyx_v_den);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_29gen_to_python(PyObject *__pyx_self, PyObject *__pyx_v_z); /*proto*/
static char __pyx_doc_6cypari_5_pari_28gen_to_python[] = "\n    Convert the PARI element ``z`` to a Python object.\n\n    OUTPUT:\n\n    - a Python integer for integers (type ``t_INT``)\n\n    - a ``Fraction`` (``fractions`` module) for rationals (type ``t_FRAC``)\n\n    - a ``float`` for real numbers (type ``t_REAL``)\n\n    - a ``complex`` for complex numbers (type ``t_COMPLEX``)\n\n    - a ``list`` for vectors (type ``t_VEC`` or ``t_COL``). The function\n      ``gen_to_python`` is then recursively applied on the entries.\n\n    - a ``list`` of Python integers for small vectors (type ``t_VECSMALL``)\n\n    - a ``list`` of ``list``s for matrices (type ``t_MAT``). The function\n      ``gen_to_python`` is then recursively applied on the entries.\n\n    - the floating point ``inf`` or ``-inf`` for infinities (type ``t_INFINITY``)\n\n    - a string for strings (type ``t_STR``)\n\n    - other PARI types are not supported and the function will raise a\n      ``NotImplementedError``\n\n    EXAMPLES::\n\n        sage: from cypari._pari import gen_to_python\n\n    Converting integers::\n\n        sage: z = pari('42'); z\n        42\n        sage: a = gen_to_python(z); a\n        42\n        sage: from builtins import int\n        sage: isinstance(a, int)\n        True\n        sage: a = gen_to_python(pari('3^50'))\n        sage: isinstance(a, int)\n        True\n\n    Converting rational numbers::\n\n        sage: z = pari('2/3'); z\n        2/3\n        sage: a = gen_to_python(z); a\n        Fraction(2, 3)\n        sage: type(a)\n        <class 'fractions.Fraction'>\n\n    Converting real numbers (and infinities)::\n\n        sage: z = pari('1.2'); z\n        1.20000000000000\n        sage: a = gen_to_python(z); a\n        1.2\n        sage: type(a)\n        <... 'float'>\n\n        sage: z = pari('oo'); z\n        +oo\n        sage: a = gen_to_python(z); a\n        inf\n        sage: type(a)\n        <... 'float'>\n\n        sage: z = pari('-oo'); z\n        -oo\n        sage: a = gen_to_python(z); a\n        -inf\n        sage:"" type(a)\n        <... 'float'>\n\n    Converting complex numbers::\n\n        sage: z = pari('1 + I'); z\n        1 + I\n        sage: a = gen_to_python(z); a\n        (1+1j)\n        sage: type(a)\n        <... 'complex'>\n\n        sage: z = pari('2.1 + 3.03*I'); z\n        2.10000000000000 + 3.03000000000000*I\n        sage: a = gen_to_python(z); a\n        (2.1+3.03j)\n\n    Converting vectors::\n\n        sage: z1 = pari('Vecsmall([1,2,3])'); z1\n        Vecsmall([1, 2, 3])\n        sage: z2 = pari('[1, 3.4, [-5, 2], oo]'); z2\n        [1, 3.40000000000000, [-5, 2], +oo]\n        sage: z3 = pari('[1, 5.2]~'); z3\n        [1, 5.20000000000000]~\n        sage: z1.type(), z2.type(), z3.type()\n        ('t_VECSMALL', 't_VEC', 't_COL')\n\n        sage: a1 = gen_to_python(z1); a1\n        [1, 2, 3]\n        sage: type(a1)\n        <... 'list'>\n        sage: list(map(type, a1))\n        [<... 'int'>, <... 'int'>, <... 'int'>]\n\n        sage: a2 = gen_to_python(z2); a2\n        [1, 3.4, [-5, 2], inf]\n        sage: type(a2)\n        <... 'list'>\n        sage: list(map(type, a2))\n        [<... 'int'>, <... 'float'>, <... 'list'>, <... 'float'>]\n\n        sage: a3 = gen_to_python(z3); a3\n        [1, 5.2]\n        sage: type(a3)\n        <... 'list'>\n        sage: list(map(type, a3))\n        [<... 'int'>, <... 'float'>]\n\n    Converting matrices::\n\n        sage: z = pari('[1,2;3,4]')\n        sage: gen_to_python(z)\n        [[1, 2], [3, 4]]\n\n        sage: z = pari('[[1, 3], [[2]]; 3, [4, [5, 6]]]')\n        sage: gen_to_python(z)\n        [[[1, 3], [[2]]], [3, [4, [5, 6]]]]\n\n    Converting strings::\n\n        sage: z = pari('\"Hello\"')\n        sage: a = gen_to_python(z); a\n        'Hello'\n        sage: type(a)\n        <... 'str'>\n\n    Some currently unsupported types::\n\n        sage: z = pari('x')\n        sage: z.type()\n        't_POL'\n        sage: gen_to_python(z)\n        Traceback (most recent call last):\n        ...\n        NotImplement""edError: conversion not implemented for t_POL\n\n        sage: z = pari('12 + O(2^13)')\n        sage: z.type()\n        't_PADIC'\n        sage: gen_to_python(z)\n        Traceback (most recent call last):\n        ...\n        NotImplementedError: conversion not implemented for t_PADIC\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_29gen_to_python(PyObject *__pyx_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gen_to_python (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_z), __pyx_ptype_6cypari_5_pari_Gen, 1, "z", 0))) __PYX_ERR(5, 434, __pyx_L1_error)
  __pyx_r = __pyx_pf_6cypari_5_pari_28gen_to_python(__pyx_self, ((struct __pyx_obj_6cypari_5_pari_Gen *)__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_6cypari_5_pari_28gen_to_python(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_z) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("gen_to_python", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6cypari_5_pari_gen_to_python(__pyx_v_z, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 434, __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("cypari._pari.gen_to_python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/handle_error.pyx":36
 *     Error raised by PARI
 *     """
 *     def errnum(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the PARI error number corresponding to this exception.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_1errnum(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_9PariError_errnum[] = "\n        Return the PARI error number corresponding to this exception.\n\n        EXAMPLES::\n\n            sage: try:\n            ....:     pari('1/0')\n            ....: except PariError as err:\n            ....:     print(err.errnum())\n            31\n        ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_9PariError_1errnum = {"errnum", (PyCFunction)__pyx_pw_6cypari_5_pari_9PariError_1errnum, METH_O, __pyx_doc_6cypari_5_pari_9PariError_errnum};
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_1errnum(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("errnum (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9PariError_errnum(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9PariError_errnum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("errnum", 0);

  /* "cypari/handle_error.pyx":48
 *             31
 *         """
 *         return self.args[0]             # <<<<<<<<<<<<<<
 * 
 *     def errtext(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/handle_error.pyx":36
 *     Error raised by PARI
 *     """
 *     def errnum(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the PARI error number corresponding to this exception.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.PariError.errnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/handle_error.pyx":50
 *         return self.args[0]
 * 
 *     def errtext(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the message output by PARI when this error occurred.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_3errtext(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_9PariError_2errtext[] = "\n        Return the message output by PARI when this error occurred.\n\n        EXAMPLE::\n\n            sage: try:\n            ....:     pari('pi()')\n            ....: except PariError as e:\n            ....:     print(e.errtext())\n            not a function in function call\n\n        ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_9PariError_3errtext = {"errtext", (PyCFunction)__pyx_pw_6cypari_5_pari_9PariError_3errtext, METH_O, __pyx_doc_6cypari_5_pari_9PariError_2errtext};
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_3errtext(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("errtext (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9PariError_2errtext(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9PariError_2errtext(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("errtext", 0);

  /* "cypari/handle_error.pyx":63
 * 
 *         """
 *         return String(self.args[1])             # <<<<<<<<<<<<<<
 * 
 *     def errdata(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_f_6cypari_5_pari_String(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/handle_error.pyx":50
 *         return self.args[0]
 * 
 *     def errtext(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the message output by PARI when this error occurred.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.PariError.errtext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/handle_error.pyx":65
 *         return String(self.args[1])
 * 
 *     def errdata(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the error data (a ``t_ERROR`` gen) corresponding to this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_5errdata(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_9PariError_4errdata[] = "\n        Return the error data (a ``t_ERROR`` gen) corresponding to this\n        error.\n\n        EXAMPLES::\n\n            sage: try:\n            ....:     pari('Mod(2,6)^-1')\n            ....: except PariError as e:\n            ....:     E = e.errdata()\n\n            sage: E\n            error(\"impossible inverse in Fp_inv: Mod(2, 6).\")\n            sage: E.component(2)\n            Mod(2, 6)\n        ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_9PariError_5errdata = {"errdata", (PyCFunction)__pyx_pw_6cypari_5_pari_9PariError_5errdata, METH_O, __pyx_doc_6cypari_5_pari_9PariError_4errdata};
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_5errdata(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("errdata (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9PariError_4errdata(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9PariError_4errdata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("errdata", 0);

  /* "cypari/handle_error.pyx":82
 *             Mod(2, 6)
 *         """
 *         return self.args[2]             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 82, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/handle_error.pyx":65
 *         return String(self.args[1])
 * 
 *     def errdata(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the error data (a ``t_ERROR`` gen) corresponding to this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.PariError.errdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/handle_error.pyx":84
 *         return self.args[2]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         TESTS::
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_7__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_9PariError_6__repr__[] = "\n        TESTS::\n\n            sage: PariError(11)\n            PariError(11)\n        ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_9PariError_7__repr__ = {"__repr__", (PyCFunction)__pyx_pw_6cypari_5_pari_9PariError_7__repr__, METH_O, __pyx_doc_6cypari_5_pari_9PariError_6__repr__};
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_7__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9PariError_6__repr__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9PariError_6__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cypari/handle_error.pyx":91
 *             PariError(11)
 *         """
 *         return "PariError(%d)"%self.errnum()             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errnum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_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_1)) __PYX_ERR(1, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_PariError_d, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/handle_error.pyx":84
 *         return self.args[2]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         TESTS::
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.PariError.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/handle_error.pyx":93
 *         return "PariError(%d)"%self.errnum()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return a suitable message for displaying this exception.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_9__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_9PariError_8__str__[] = "\n        Return a suitable message for displaying this exception.\n\n        This is simply the error text with certain trailing characters\n        stripped.\n\n        EXAMPLES::\n\n            sage: try:\n            ....:     pari('1/0')\n            ....: except PariError as err:\n            ....:     print(err)\n            _/_: impossible inverse in gdiv: 0\n\n        A syntax error::\n\n            sage: pari('!@#$%^&*()')\n            Traceback (most recent call last):\n            ...\n            PariError: syntax error, unexpected $undefined\n        ";
static PyMethodDef __pyx_mdef_6cypari_5_pari_9PariError_9__str__ = {"__str__", (PyCFunction)__pyx_pw_6cypari_5_pari_9PariError_9__str__, METH_O, __pyx_doc_6cypari_5_pari_9PariError_8__str__};
static PyObject *__pyx_pw_6cypari_5_pari_9PariError_9__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_9PariError_8__str__(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_9PariError_8__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cypari/handle_error.pyx":115
 *             PariError: syntax error, unexpected $undefined
 *         """
 *         return self.errtext().rstrip(" .:")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_errtext); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 115, __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(1, 115, __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_rstrip); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 115, __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_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_kp_s__46) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s__46);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/handle_error.pyx":93
 *         return "PariError(%d)"%self.errnum()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return a suitable message for displaying this exception.
 */

  /* 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("cypari._pari.PariError.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/handle_error.pyx":118
 * 
 * 
 * cdef void _pari_init_error_handling():             # <<<<<<<<<<<<<<
 *     """
 *     Set up our code for handling PARI errors.
 */

static void __pyx_f_6cypari_5_pari__pari_init_error_handling(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_pari_init_error_handling", 0);

  /* "cypari/handle_error.pyx":137
 *     global cb_pari_err_handle
 *     global cb_pari_err_recover
 *     cb_pari_err_handle = _pari_err_handle             # <<<<<<<<<<<<<<
 *     cb_pari_err_recover = _pari_err_recover
 * 
 */
  cb_pari_err_handle = __pyx_f_6cypari_5_pari__pari_err_handle;

  /* "cypari/handle_error.pyx":138
 *     global cb_pari_err_recover
 *     cb_pari_err_handle = _pari_err_handle
 *     cb_pari_err_recover = _pari_err_recover             # <<<<<<<<<<<<<<
 * 
 * cdef int _pari_err_handle(GEN E) except 0:
 */
  cb_pari_err_recover = __pyx_f_6cypari_5_pari__pari_err_recover;

  /* "cypari/handle_error.pyx":118
 * 
 * 
 * cdef void _pari_init_error_handling():             # <<<<<<<<<<<<<<
 *     """
 *     Set up our code for handling PARI errors.
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "cypari/handle_error.pyx":140
 *     cb_pari_err_recover = _pari_err_recover
 * 
 * cdef int _pari_err_handle(GEN E) except 0:             # <<<<<<<<<<<<<<
 *     """
 *     Convert a PARI error into a Sage exception, unless the error was
 */

static int __pyx_f_6cypari_5_pari__pari_err_handle(GEN __pyx_v_E) {
  long __pyx_v_errnum;
  char *__pyx_v_errstr;
  char const *__pyx_v_s;
  PyObject *__pyx_v_pari_error_string = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_RefNannySetupContext("_pari_err_handle", 0);

  /* "cypari/handle_error.pyx":159
 * 
 *     """
 *     cdef long errnum = <long>E[1]             # <<<<<<<<<<<<<<
 * 
 *     sig_block()
 */
  __pyx_v_errnum = ((long)(__pyx_v_E[1]));

  /* "cypari/handle_error.pyx":161
 *     cdef long errnum = <long>E[1]
 * 
 *     sig_block()             # <<<<<<<<<<<<<<
 *     cdef char* errstr
 *     cdef const char* s
 */
  sig_block();

  /* "cypari/handle_error.pyx":164
 *     cdef char* errstr
 *     cdef const char* s
 *     try:             # <<<<<<<<<<<<<<
 *         if errnum == e_STACK:
 *             # Custom error message for PARI stack overflow
 */
  /*try:*/ {

    /* "cypari/handle_error.pyx":165
 *     cdef const char* s
 *     try:
 *         if errnum == e_STACK:             # <<<<<<<<<<<<<<
 *             # Custom error message for PARI stack overflow
 *             pari_error_string = "the PARI stack overflows (current size: {}; maximum size: {})\n"
 */
    __pyx_t_1 = ((__pyx_v_errnum == e_STACK) != 0);
    if (__pyx_t_1) {

      /* "cypari/handle_error.pyx":167
 *         if errnum == e_STACK:
 *             # Custom error message for PARI stack overflow
 *             pari_error_string = "the PARI stack overflows (current size: {}; maximum size: {})\n"             # <<<<<<<<<<<<<<
 *             pari_error_string += "You can use pari.allocatemem() to change the stack size and try again"
 *             pari_error_string = pari_error_string.format(pari_mainstack.size, pari_mainstack.vsize)
 */
      __Pyx_INCREF(__pyx_kp_s_the_PARI_stack_overflows_current);
      __pyx_v_pari_error_string = __pyx_kp_s_the_PARI_stack_overflows_current;

      /* "cypari/handle_error.pyx":168
 *             # Custom error message for PARI stack overflow
 *             pari_error_string = "the PARI stack overflows (current size: {}; maximum size: {})\n"
 *             pari_error_string += "You can use pari.allocatemem() to change the stack size and try again"             # <<<<<<<<<<<<<<
 *             pari_error_string = pari_error_string.format(pari_mainstack.size, pari_mainstack.vsize)
 *         else:
 */
      __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_pari_error_string, __pyx_kp_s_You_can_use_pari_allocatemem_to); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 168, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_pari_error_string, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cypari/handle_error.pyx":169
 *             pari_error_string = "the PARI stack overflows (current size: {}; maximum size: {})\n"
 *             pari_error_string += "You can use pari.allocatemem() to change the stack size and try again"
 *             pari_error_string = pari_error_string.format(pari_mainstack.size, pari_mainstack.vsize)             # <<<<<<<<<<<<<<
 *         else:
 *             errstr = pari_err2str(E)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pari_error_string, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 169, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_FromSize_t(pari_mainstack->size); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 169, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_FromSize_t(pari_mainstack->vsize); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 169, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 169, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 169, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 169, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_5);
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 169, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_pari_error_string, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cypari/handle_error.pyx":165
 *     cdef const char* s
 *     try:
 *         if errnum == e_STACK:             # <<<<<<<<<<<<<<
 *             # Custom error message for PARI stack overflow
 *             pari_error_string = "the PARI stack overflows (current size: {}; maximum size: {})\n"
 */
      goto __pyx_L6;
    }

    /* "cypari/handle_error.pyx":171
 *             pari_error_string = pari_error_string.format(pari_mainstack.size, pari_mainstack.vsize)
 *         else:
 *             errstr = pari_err2str(E)             # <<<<<<<<<<<<<<
 *             pari_error_string = errstr.decode('ascii')
 *             pari_free(errstr)
 */
    /*else*/ {
      __pyx_v_errstr = pari_err2str(__pyx_v_E);

      /* "cypari/handle_error.pyx":172
 *         else:
 *             errstr = pari_err2str(E)
 *             pari_error_string = errstr.decode('ascii')             # <<<<<<<<<<<<<<
 *             pari_free(errstr)
 * 
 */
      __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_errstr, 0, strlen(__pyx_v_errstr), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 172, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_v_pari_error_string = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "cypari/handle_error.pyx":173
 *             errstr = pari_err2str(E)
 *             pari_error_string = errstr.decode('ascii')
 *             pari_free(errstr)             # <<<<<<<<<<<<<<
 * 
 *         s = closure_func_err()
 */
      pari_free(__pyx_v_errstr);
    }
    __pyx_L6:;

    /* "cypari/handle_error.pyx":175
 *             pari_free(errstr)
 * 
 *         s = closure_func_err()             # <<<<<<<<<<<<<<
 *         if s is not NULL:
 *             pari_error_string = s.decode('ascii') + ": " + pari_error_string
 */
    __pyx_v_s = closure_func_err();

    /* "cypari/handle_error.pyx":176
 * 
 *         s = closure_func_err()
 *         if s is not NULL:             # <<<<<<<<<<<<<<
 *             pari_error_string = s.decode('ascii') + ": " + pari_error_string
 * 
 */
    __pyx_t_1 = ((__pyx_v_s != NULL) != 0);
    if (__pyx_t_1) {

      /* "cypari/handle_error.pyx":177
 *         s = closure_func_err()
 *         if s is not NULL:
 *             pari_error_string = s.decode('ascii') + ": " + pari_error_string             # <<<<<<<<<<<<<<
 * 
 *         raise PariError(errnum, pari_error_string, new_gen_noclear(E))
 */
      __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 177, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_t_2, __pyx_kp_s__47); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 177, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_pari_error_string); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 177, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_pari_error_string, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "cypari/handle_error.pyx":176
 * 
 *         s = closure_func_err()
 *         if s is not NULL:             # <<<<<<<<<<<<<<
 *             pari_error_string = s.decode('ascii') + ": " + pari_error_string
 * 
 */
    }

    /* "cypari/handle_error.pyx":179
 *             pari_error_string = s.decode('ascii') + ": " + pari_error_string
 * 
 *         raise PariError(errnum, pari_error_string, new_gen_noclear(E))             # <<<<<<<<<<<<<<
 *     finally:
 *         sig_unblock()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_PariError); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 179, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_errnum); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 179, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(__pyx_v_E)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 179, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_8, __pyx_v_pari_error_string, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 179, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_8, __pyx_v_pari_error_string, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 179, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 179, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_8);
      __Pyx_INCREF(__pyx_v_pari_error_string);
      __Pyx_GIVEREF(__pyx_v_pari_error_string);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_pari_error_string);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_t_5);
      __pyx_t_8 = 0;
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 179, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(1, 179, __pyx_L4_error)
  }

  /* "cypari/handle_error.pyx":181
 *         raise PariError(errnum, pari_error_string, new_gen_noclear(E))
 *     finally:
 *         sig_unblock()             # <<<<<<<<<<<<<<
 * 
 * # This gets assigned as Pari's cb_pari_err_recover callback
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_7 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        sig_unblock();
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
    }
  }

  /* "cypari/handle_error.pyx":140
 *     cb_pari_err_recover = _pari_err_recover
 * 
 * cdef int _pari_err_handle(GEN E) except 0:             # <<<<<<<<<<<<<<
 *     """
 *     Convert a PARI error into a Sage exception, unless the error was
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cypari._pari._pari_err_handle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __Pyx_XDECREF(__pyx_v_pari_error_string);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/handle_error.pyx":184
 * 
 * # This gets assigned as Pari's cb_pari_err_recover callback
 * cdef void _pari_err_recover(long errnum):             # <<<<<<<<<<<<<<
 *     """
 *     Reset the error string and jump back to ``sig_on()``, either to
 */

static void __pyx_f_6cypari_5_pari__pari_err_recover(CYTHON_UNUSED long __pyx_v_errnum) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_pari_err_recover", 0);

  /* "cypari/handle_error.pyx":204
 *     # An exception was raised.  Jump to the signal-handling code
 *     # which will cause sig_on() to see the exception.
 *     sig_error()             # <<<<<<<<<<<<<<
 */
  sig_error();

  /* "cypari/handle_error.pyx":184
 * 
 * # This gets assigned as Pari's cb_pari_err_recover callback
 * cdef void _pari_err_recover(long errnum):             # <<<<<<<<<<<<<<
 *     """
 *     Reset the error string and jump back to ``sig_on()``, either to
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "cypari/closure.pyx":48
 * from cpython.ref cimport Py_INCREF
 * 
 * cdef inline GEN call_python_func_impl "call_python_func"(GEN* args, object py_func) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Call ``py_func(*args)`` where ``py_func`` is a Python function
 */

static CYTHON_INLINE GEN call_python_func(GEN *__pyx_v_args, PyObject *__pyx_v_py_func) {
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_t = 0;
  Py_ssize_t __pyx_v_i;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_a = NULL;
  PyObject *__pyx_v_r = NULL;
  GEN __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("call_python_func_impl", 0);

  /* "cypari/closure.pyx":57
 *     """
 *     # How many arguments are there?
 *     cdef Py_ssize_t n = 0             # <<<<<<<<<<<<<<
 *     while args[n] != NULL:
 *         n += 1
 */
  __pyx_v_n = 0;

  /* "cypari/closure.pyx":58
 *     # How many arguments are there?
 *     cdef Py_ssize_t n = 0
 *     while args[n] != NULL:             # <<<<<<<<<<<<<<
 *         n += 1
 * 
 */
  while (1) {
    __pyx_t_1 = (((__pyx_v_args[__pyx_v_n]) != NULL) != 0);
    if (!__pyx_t_1) break;

    /* "cypari/closure.pyx":59
 *     cdef Py_ssize_t n = 0
 *     while args[n] != NULL:
 *         n += 1             # <<<<<<<<<<<<<<
 * 
 *     # Construct a Python tuple for args
 */
    __pyx_v_n = (__pyx_v_n + 1);
  }

  /* "cypari/closure.pyx":62
 * 
 *     # Construct a Python tuple for args
 *     cdef tuple t = PyTuple_New(n)             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t i
 *     for i in range(n):
 */
  __pyx_t_2 = PyTuple_New(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_t = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/closure.pyx":64
 *     cdef tuple t = PyTuple_New(n)
 *     cdef Py_ssize_t i
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         a = new_gen_noclear(args[i])
 *         Py_INCREF(a)  # Need to increase refcount because the tuple steals it
 */
  __pyx_t_3 = __pyx_v_n;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "cypari/closure.pyx":65
 *     cdef Py_ssize_t i
 *     for i in range(n):
 *         a = new_gen_noclear(args[i])             # <<<<<<<<<<<<<<
 *         Py_INCREF(a)  # Need to increase refcount because the tuple steals it
 *         PyTuple_SET_ITEM(t, i, a)
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear((__pyx_v_args[__pyx_v_i]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_a, ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "cypari/closure.pyx":66
 *     for i in range(n):
 *         a = new_gen_noclear(args[i])
 *         Py_INCREF(a)  # Need to increase refcount because the tuple steals it             # <<<<<<<<<<<<<<
 *         PyTuple_SET_ITEM(t, i, a)
 * 
 */
    Py_INCREF(((PyObject *)__pyx_v_a));

    /* "cypari/closure.pyx":67
 *         a = new_gen_noclear(args[i])
 *         Py_INCREF(a)  # Need to increase refcount because the tuple steals it
 *         PyTuple_SET_ITEM(t, i, a)             # <<<<<<<<<<<<<<
 * 
 *     # Call the Python function
 */
    PyTuple_SET_ITEM(__pyx_v_t, __pyx_v_i, ((PyObject *)__pyx_v_a));
  }

  /* "cypari/closure.pyx":70
 * 
 *     # Call the Python function
 *     r = PyObject_Call(py_func, t, <dict>NULL)             # <<<<<<<<<<<<<<
 * 
 *     # Convert the result to a GEN and copy it to the PARI stack
 */
  __pyx_t_2 = PyObject_Call(__pyx_v_py_func, __pyx_v_t, ((PyObject *)NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 70, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_r = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cypari/closure.pyx":74
 *     # Convert the result to a GEN and copy it to the PARI stack
 *     # (with a special case for None)
 *     if r is None:             # <<<<<<<<<<<<<<
 *         return gnil
 *     return gcopy(objtogen(r).g)
 */
  __pyx_t_1 = (__pyx_v_r == Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "cypari/closure.pyx":75
 *     # (with a special case for None)
 *     if r is None:
 *         return gnil             # <<<<<<<<<<<<<<
 *     return gcopy(objtogen(r).g)
 * 
 */
    __pyx_r = gnil;
    goto __pyx_L0;

    /* "cypari/closure.pyx":74
 *     # Convert the result to a GEN and copy it to the PARI stack
 *     # (with a special case for None)
 *     if r is None:             # <<<<<<<<<<<<<<
 *         return gnil
 *     return gcopy(objtogen(r).g)
 */
  }

  /* "cypari/closure.pyx":76
 *     if r is None:
 *         return gnil
 *     return gcopy(objtogen(r).g)             # <<<<<<<<<<<<<<
 * 
 * # We rename this function to be able to call it with a different
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_r, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = gcopy(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2)->__pyx_base.g);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/closure.pyx":48
 * from cpython.ref cimport Py_INCREF
 * 
 * cdef inline GEN call_python_func_impl "call_python_func"(GEN* args, object py_func) except NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Call ``py_func(*args)`` where ``py_func`` is a Python function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.call_python_func_impl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF((PyObject *)__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/closure.pyx":85
 * 
 * 
 * cdef GEN call_python(GEN arg1, GEN arg2, GEN arg3, GEN arg4, GEN arg5, ulong py_func):             # <<<<<<<<<<<<<<
 *     """
 *     This function, which will be installed in PARI, is a front-end for
 */

static GEN __pyx_f_6cypari_5_pari_call_python(GEN __pyx_v_arg1, GEN __pyx_v_arg2, GEN __pyx_v_arg3, GEN __pyx_v_arg4, GEN __pyx_v_arg5, pari_ulong __pyx_v_py_func) {
  GEN __pyx_v_args[6];
  GEN __pyx_v_r;
  GEN __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("call_python", 0);

  /* "cypari/closure.pyx":99
 *     # terminate sooner.
 *     cdef GEN args[6]
 *     args[0] = arg1             # <<<<<<<<<<<<<<
 *     args[1] = arg2
 *     args[2] = arg3
 */
  (__pyx_v_args[0]) = __pyx_v_arg1;

  /* "cypari/closure.pyx":100
 *     cdef GEN args[6]
 *     args[0] = arg1
 *     args[1] = arg2             # <<<<<<<<<<<<<<
 *     args[2] = arg3
 *     args[3] = arg4
 */
  (__pyx_v_args[1]) = __pyx_v_arg2;

  /* "cypari/closure.pyx":101
 *     args[0] = arg1
 *     args[1] = arg2
 *     args[2] = arg3             # <<<<<<<<<<<<<<
 *     args[3] = arg4
 *     args[4] = arg5
 */
  (__pyx_v_args[2]) = __pyx_v_arg3;

  /* "cypari/closure.pyx":102
 *     args[1] = arg2
 *     args[2] = arg3
 *     args[3] = arg4             # <<<<<<<<<<<<<<
 *     args[4] = arg5
 *     args[5] = NULL
 */
  (__pyx_v_args[3]) = __pyx_v_arg4;

  /* "cypari/closure.pyx":103
 *     args[2] = arg3
 *     args[3] = arg4
 *     args[4] = arg5             # <<<<<<<<<<<<<<
 *     args[5] = NULL
 * 
 */
  (__pyx_v_args[4]) = __pyx_v_arg5;

  /* "cypari/closure.pyx":104
 *     args[3] = arg4
 *     args[4] = arg5
 *     args[5] = NULL             # <<<<<<<<<<<<<<
 * 
 *     sig_block()
 */
  (__pyx_v_args[5]) = NULL;

  /* "cypari/closure.pyx":106
 *     args[5] = NULL
 * 
 *     sig_block()             # <<<<<<<<<<<<<<
 *     # Disallow interrupts during the Python code inside
 *     # call_python_func_impl(). We need to do this because this function
 */
  sig_block();

  /* "cypari/closure.pyx":111
 *     # is very likely called within sig_on() and interrupting arbitrary
 *     # Python code is bad.
 *     cdef GEN r = call_python_func(args, <PyObject*>py_func)             # <<<<<<<<<<<<<<
 *     sig_unblock()
 *     if not r:  # An exception was raised
 */
  __pyx_v_r = call_python_func(__pyx_v_args, ((PyObject *)__pyx_v_py_func));

  /* "cypari/closure.pyx":112
 *     # Python code is bad.
 *     cdef GEN r = call_python_func(args, <PyObject*>py_func)
 *     sig_unblock()             # <<<<<<<<<<<<<<
 *     if not r:  # An exception was raised
 *         sig_error()
 */
  sig_unblock();

  /* "cypari/closure.pyx":113
 *     cdef GEN r = call_python_func(args, <PyObject*>py_func)
 *     sig_unblock()
 *     if not r:  # An exception was raised             # <<<<<<<<<<<<<<
 *         sig_error()
 *     return r
 */
  __pyx_t_1 = ((!(__pyx_v_r != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/closure.pyx":114
 *     sig_unblock()
 *     if not r:  # An exception was raised
 *         sig_error()             # <<<<<<<<<<<<<<
 *     return r
 * 
 */
    sig_error();

    /* "cypari/closure.pyx":113
 *     cdef GEN r = call_python_func(args, <PyObject*>py_func)
 *     sig_unblock()
 *     if not r:  # An exception was raised             # <<<<<<<<<<<<<<
 *         sig_error()
 *     return r
 */
  }

  /* "cypari/closure.pyx":115
 *     if not r:  # An exception was raised
 *         sig_error()
 *     return r             # <<<<<<<<<<<<<<
 * 
 * # Install the function "call_python" for use in the PARI library.
 */
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "cypari/closure.pyx":85
 * 
 * 
 * cdef GEN call_python(GEN arg1, GEN arg2, GEN arg3, GEN arg4, GEN arg5, ulong py_func):             # <<<<<<<<<<<<<<
 *     """
 *     This function, which will be installed in PARI, is a front-end for
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/closure.pyx":120
 * cdef entree* ep_call_python
 * 
 * cdef void _pari_init_closure():             # <<<<<<<<<<<<<<
 *     global ep_call_python
 *     ep_call_python = install(<void*>call_python, "call_python", "DGDGDGDGDGU")
 */

static void __pyx_f_6cypari_5_pari__pari_init_closure(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_pari_init_closure", 0);

  /* "cypari/closure.pyx":122
 * cdef void _pari_init_closure():
 *     global ep_call_python
 *     ep_call_python = install(<void*>call_python, "call_python", "DGDGDGDGDGU")             # <<<<<<<<<<<<<<
 * 
 * cpdef Gen objtoclosure(f):
 */
  __pyx_v_6cypari_5_pari_ep_call_python = install(((void *)__pyx_f_6cypari_5_pari_call_python), ((char const *)"call_python"), ((char const *)"DGDGDGDGDGU"));

  /* "cypari/closure.pyx":120
 * cdef entree* ep_call_python
 * 
 * cdef void _pari_init_closure():             # <<<<<<<<<<<<<<
 *     global ep_call_python
 *     ep_call_python = install(<void*>call_python, "call_python", "DGDGDGDGDGU")
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "cypari/closure.pyx":124
 *     ep_call_python = install(<void*>call_python, "call_python", "DGDGDGDGDGU")
 * 
 * cpdef Gen objtoclosure(f):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a Python function (more generally, any callable) to a PARI
 */

static PyObject *__pyx_pw_6cypari_5_pari_31objtoclosure(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_objtoclosure(PyObject *__pyx_v_f, CYTHON_UNUSED int __pyx_skip_dispatch) {
  GEN __pyx_v_f_int;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_c = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("objtoclosure", 0);

  /* "cypari/closure.pyx":174
 *         PariError: call_python: forbidden multiplication t_VEC (1 elts) * t_VEC (1 elts)
 *     """
 *     sig_on()             # <<<<<<<<<<<<<<
 *     # Convert f to a t_INT containing the address of f
 *     cdef GEN f_int = utoi(<ulong><PyObject*>f)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(9, 174, __pyx_L1_error)

  /* "cypari/closure.pyx":176
 *     sig_on()
 *     # Convert f to a t_INT containing the address of f
 *     cdef GEN f_int = utoi(<ulong><PyObject*>f)             # <<<<<<<<<<<<<<
 *     # Create a t_CLOSURE which calls call_python() with py_func equal to f
 *     cdef Gen c = new_gen(snm_closure(ep_call_python, mkvec(f_int)))
 */
  __pyx_v_f_int = utoi(((pari_ulong)((PyObject *)__pyx_v_f)));

  /* "cypari/closure.pyx":178
 *     cdef GEN f_int = utoi(<ulong><PyObject*>f)
 *     # Create a t_CLOSURE which calls call_python() with py_func equal to f
 *     cdef Gen c = new_gen(snm_closure(ep_call_python, mkvec(f_int)))             # <<<<<<<<<<<<<<
 *     c.refers_to = {0:f}  # c needs to keep a reference to f
 *     return c
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(snm_closure(__pyx_v_6cypari_5_pari_ep_call_python, mkvec(__pyx_v_f_int)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_c = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/closure.pyx":179
 *     # Create a t_CLOSURE which calls call_python() with py_func equal to f
 *     cdef Gen c = new_gen(snm_closure(ep_call_python, mkvec(f_int)))
 *     c.refers_to = {0:f}  # c needs to keep a reference to f             # <<<<<<<<<<<<<<
 *     return c
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(9, 179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_int_0, __pyx_v_f) < 0) __PYX_ERR(9, 179, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_c->__pyx_base.refers_to);
  __Pyx_DECREF(__pyx_v_c->__pyx_base.refers_to);
  __pyx_v_c->__pyx_base.refers_to = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/closure.pyx":180
 *     cdef Gen c = new_gen(snm_closure(ep_call_python, mkvec(f_int)))
 *     c.refers_to = {0:f}  # c needs to keep a reference to f
 *     return c             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_c));
  __pyx_r = __pyx_v_c;
  goto __pyx_L0;

  /* "cypari/closure.pyx":124
 *     ep_call_python = install(<void*>call_python, "call_python", "DGDGDGDGDGU")
 * 
 * cpdef Gen objtoclosure(f):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a Python function (more generally, any callable) to a PARI
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.objtoclosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_c);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_31objtoclosure(PyObject *__pyx_self, PyObject *__pyx_v_f); /*proto*/
static char __pyx_doc_6cypari_5_pari_30objtoclosure[] = "\n    Convert a Python function (more generally, any callable) to a PARI\n    ``t_CLOSURE``.\n\n    .. NOTE::\n\n        With the current implementation, the function can be called\n        with at most 5 arguments.\n\n    .. WARNING::\n\n        The function ``f`` which is called through the closure cannot\n        be interrupted. Therefore, it is advised to use this only for\n        simple functions which do not take a long time.\n\n    EXAMPLES::\n\n        sage: from cypari._pari import objtoclosure\n        sage: mul = objtoclosure(lambda i,j: i*j)\n        sage: mul\n        (v1,v2,v3,v4,v5)->call_python(v1,v2,v3,v4,v5,...)\n        sage: mul.type()\n        't_CLOSURE'\n        sage: mul(6,9)\n        54\n        sage: def printme(x):\n        ....:     print(x)\n        sage: objtoclosure(printme)('matid(2)')\n        [1, 0; 0, 1]\n\n    Test various kinds of errors::\n\n        sage: mul(4)\n        Traceback (most recent call last):\n        ...\n        TypeError: <lambda>() takes exactly 2 arguments (1 given)\n        sage: mul(None, None)\n        Traceback (most recent call last):\n        ...\n        ValueError: Cannot convert None to pari\n        sage: mul(*range(100))\n        Traceback (most recent call last):\n        ...\n        PariError: call_python: too many parameters in user-defined function call\n        sage: mul([1], [2])\n        Traceback (most recent call last):\n        ...\n        PariError: call_python: forbidden multiplication t_VEC (1 elts) * t_VEC (1 elts)\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_31objtoclosure(PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("objtoclosure (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_30objtoclosure(__pyx_self, ((PyObject *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_30objtoclosure(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("objtoclosure", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtoclosure(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 124, __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("cypari._pari.objtoclosure", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16
 *     where we cannot use C calls.
 *     """
 *     def Col(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a column vector. The dimension of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1Col(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_Col[] = "\n        Transforms the object :math:`x` into a column vector. The dimension of the\n        resulting vector can be optionally specified via the extra parameter :math:`n`.\n        \n        If :math:`n` is omitted or :math:`0`, the dimension depends on the type of :math:`x`; the\n        vector has a single component, except when :math:`x` is\n        \n        - a vector or a quadratic form (in which case the resulting vector\n          is simply the initial object considered as a row vector),\n        \n        - a polynomial or a power series. In the case of a polynomial, the\n          coefficients of the vector start with the leading coefficient of the\n          polynomial, while for power series only the significant coefficients are\n          taken into account, but this time by increasing order of degree.\n          In this last case, :literal:`Vec` is the reciprocal function of :literal:`Pol` and\n          :literal:`Ser` respectively,\n        \n        - a matrix (the column of row vector comprising the matrix is returned),\n        \n        - a character string (a vector of individual characters is returned).\n        \n        In the last two cases (matrix and character string), :math:`n` is meaningless and\n        must be omitted or an error is raised. Otherwise, if :math:`n` is given, :math:`0`\n        entries are appended at the end of the vector if :math:`n > 0`, and prepended at\n        the beginning if :math:`n < 0`. The dimension of the resulting vector is :math:`\\|n\\|`.\n        \n        See \077\077Vec for examples.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1Col(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Col (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Col") < 0)) __PYX_ERR(10, 16, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Col", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Col", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_Col(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_Col(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Col", 0);

  /* "cypari/auto_gen.pxi":45
 *         See ??Vec for examples.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocol0(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 45, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":46
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtocol0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":47
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocol0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtocol0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":48
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocol0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Colrev(x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16
 *     where we cannot use C calls.
 *     """
 *     def Col(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a column vector. The dimension of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Col", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":50
 *         return new_gen(_ret)
 * 
 *     def Colrev(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Col (x, -n)`, then reverse the result. In particular,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_3Colrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_2Colrev[] = "\n        As :math:`Col (x, -n)`, then reverse the result. In particular,\n        :literal:`Colrev` is the reciprocal function of :literal:`Polrev`: the\n        coefficients of the vector start with the constant coefficient of the\n        polynomial and the others follow by increasing degree.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_3Colrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Colrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Colrev") < 0)) __PYX_ERR(10, 50, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 50, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Colrev", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 50, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Colrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_2Colrev(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_2Colrev(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Colrev", 0);

  /* "cypari/auto_gen.pxi":57
 *         polynomial and the others follow by increasing degree.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocolrev0(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 57, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":58
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtocolrev0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":59
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocolrev0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtocolrev0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":60
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtocolrev0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def List(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":50
 *         return new_gen(_ret)
 * 
 *     def Colrev(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Col (x, -n)`, then reverse the result. In particular,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Colrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":62
 *         return new_gen(_ret)
 * 
 *     def List(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms a (row or column) vector :math:`x` into a list, whose components are
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_5List(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_4List[] = "\n        Transforms a (row or column) vector :math:`x` into a list, whose components are\n        the entries of :math:`x`. Similarly for a list, but rather useless in this case.\n        For other types, creates a list with the single element :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_5List(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("List (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_4List(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_4List(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("List", 0);

  /* "cypari/auto_gen.pxi":68
 *         For other types, creates a list with the single element :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtolist(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 68, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":69
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtolist(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":70
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtolist(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtolist(__pyx_v__x);

  /* "cypari/auto_gen.pxi":71
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtolist(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Map(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 71, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":62
 *         return new_gen(_ret)
 * 
 *     def List(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms a (row or column) vector :math:`x` into a list, whose components are
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.List", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":73
 *         return new_gen(_ret)
 * 
 *     def Map(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         A "Map" is an associative array, or dictionary: a data
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_7Map(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_6Map[] = "\n        A \"Map\" is an associative array, or dictionary: a data\n        type composed of a collection of (:emphasis:`key`, :emphasis:`value`) pairs, such that\n        each key appears just once in the collection. This function\n        converts the matrix :math:`[a_1,b_1;a_2,b_2;...;a_n,b_n]` to the map :math:`a_i:--->\n        b_i`.\n        \n        ::\n        \n            ? M = Map(factor(13!));\n            ? mapget(M,3)\n            %2 = 5\n        \n        If the argument :math:`x` is omitted, creates an empty map, which\n        may be filled later via :literal:`mapput`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_7Map(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Map (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_6Map(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_6Map(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Map", 0);

  /* "cypari/auto_gen.pxi":90
 *         may be filled later via :literal:`mapput`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtomap(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 90, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":91
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtomap(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":92
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtomap(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtomap(__pyx_v__x);

  /* "cypari/auto_gen.pxi":93
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtomap(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Mat(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":73
 *         return new_gen(_ret)
 * 
 *     def Map(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         A "Map" is an associative array, or dictionary: a data
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Map", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":95
 *         return new_gen(_ret)
 * 
 *     def Mat(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_9Mat(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_8Mat[] = "\n        Transforms the object :math:`x` into a matrix.\n        If :math:`x` is already a matrix, a copy of :math:`x` is created.\n        If :math:`x` is a row (resp. column) vector, this creates a 1-row (resp.\n        1-column) matrix, :emphasis:`unless` all elements are column (resp.\302\240row) vectors\n        of the same length, in which case the vectors are concatenated sideways\n        and the attached big matrix is returned.\n        If :math:`x` is a binary quadratic form, creates the attached :math:`2 x 2`\n        matrix. Otherwise, this creates a :math:`1 x 1` matrix containing :math:`x`.\n        \n        ::\n        \n            ? Mat(x + 1)\n            %1 =\n            [x + 1]\n            ? Vec( matid(3) )\n            %2 = [[1, 0, 0]~, [0, 1, 0]~, [0, 0, 1]~]\n            ? Mat(%)\n            %3 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? Col( [1,2; 3,4] )\n            %4 = [[1, 2], [3, 4]]~\n            ? Mat(%)\n            %5 =\n            [1 2]\n            \n            [3 4]\n            ? Mat(Qfb(1,2,3))\n            %6 =\n            [1 1]\n            \n            [1 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_9Mat(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Mat (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_8Mat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_8Mat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Mat", 0);

  /* "cypari/auto_gen.pxi":133
 *             [1 3]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtomat(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 133, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":134
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtomat(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":135
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtomat(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtomat(__pyx_v__x);

  /* "cypari/auto_gen.pxi":136
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtomat(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Mod(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":95
 *         return new_gen(_ret)
 * 
 *     def Mat(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Mat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":138
 *         return new_gen(_ret)
 * 
 *     def Mod(a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         In its basic form, creates an intmod or a polmod :math:`(a mod b)`; :math:`b` must
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_11Mod(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_10Mod[] = "\n        In its basic form, creates an intmod or a polmod :math:`(a mod b)`; :math:`b` must\n        be an integer or a polynomial. We then obtain a :literal:`t_INTMOD` and a\n        :literal:`t_POLMOD` respectively:\n        \n        ::\n        \n            ? t = Mod(2,17); t^8\n            %1 = Mod(1, 17)\n            ? t = Mod(x,x^2+1); t^2\n            %2 = Mod(-1, x^2+1)\n        \n        If :math:`a \\% b` makes sense and yields a result of the\n        appropriate type (:literal:`t_INT` or scalar/:literal:`t_POL`), the operation succeeds as\n        well:\n        \n        ::\n        \n            ? Mod(1/2, 5)\n            %3 = Mod(3, 5)\n            ? Mod(7 + O(3^6), 3)\n            %4 = Mod(1, 3)\n            ? Mod(Mod(1,12), 9)\n            %5 = Mod(1, 3)\n            ? Mod(1/x, x^2+1)\n            %6 = Mod(-1, x^2+1)\n            ? Mod(exp(x), x^4)\n            %7 = Mod(1/6*x^3 + 1/2*x^2 + x + 1, x^4)\n        \n        If :math:`a` is a complex object, \"base change\" it to :math:`\\mathbb{Z}/b\\mathbb{Z}` or :math:`K[x]/(b)`,\n        which is equivalent to, but faster than, multiplying it by :literal:`Mod(1,b)`:\n        \n        ::\n        \n            ? Mod([1,2;3,4], 2)\n            %8 =\n            [Mod(1, 2) Mod(0, 2)]\n            \n            [Mod(1, 2) Mod(0, 2)]\n            ? Mod(3*x+5, 2)\n            %9 = Mod(1, 2)*x + Mod(1, 2)\n            ? Mod(x^2 + y*x + y^3, y^2+1)\n            %10 = Mod(1, y^2 + 1)*x^2 + Mod(y, y^2 + 1)*x + Mod(-y, y^2 + 1)\n        \n        This function is not the same as :math:`x` :literal:`\\%` :math:`y`, the result of which\n        has no knowledge of the intended modulus :math:`y`. Compare\n        \n        ::\n        \n            ? x = 4 % 5; x + 1\n            %1 = 5\n            ? x = Mod(4,5); x + 1\n            %2 = Mod(0,5)\n        \n        Note that such \"modular\" objects can be lifted via :literal:`lift` or\n        :literal:`centerlift`. The modulus of a :literal:`t_INTMOD` or :l""iteral:`t_POLMOD` :math:`z` can\n        be recovered via :literal:`:math:`z`.mod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_11Mod(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Mod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_10Mod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_10Mod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("Mod", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":197
 *         be recovered via :literal:`:math:`z`.mod`.
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":198
 *         '''
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 198, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":199
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = gmodulo(_a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":200
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmodulo(_a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":201
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = gmodulo(_a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmodulo(__pyx_v__a, __pyx_v__b);

  /* "cypari/auto_gen.pxi":202
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = gmodulo(_a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Pol(t, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":138
 *         return new_gen(_ret)
 * 
 *     def Mod(a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         In its basic form, creates an intmod or a polmod :math:`(a mod b)`; :math:`b` must
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Mod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":204
 *         return new_gen(_ret)
 * 
 *     def Pol(t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`t` into a polynomial with main variable :math:`v`. If :math:`t`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_13Pol(PyObject *__pyx_v_t, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_12Pol[] = "\n        Transforms the object :math:`t` into a polynomial with main variable :math:`v`. If :math:`t`\n        is a scalar, this gives a constant polynomial. If :math:`t` is a power series with\n        non-negative valuation or a rational function, the effect is similar to\n        :literal:`truncate`, i.e.\302\240we chop off the :math:`O(X^k)` or compute the Euclidean\n        quotient of the numerator by the denominator, then change the main variable\n        of the result to :math:`v`.\n        \n        The main use of this function is when :math:`t` is a vector: it creates the\n        polynomial whose coefficients are given by :math:`t`, with :math:`t[1]` being the leading\n        coefficient (which can be zero). It is much faster to evaluate\n        :literal:`Pol` on a vector of coefficients in this way, than the corresponding\n        formal expression :math:`a_n X^n +...+ a_0`, which is evaluated naively exactly\n        as written (linear versus quadratic time in :math:`n`). :literal:`Polrev` can be used if\n        one wants :math:`x[1]` to be the constant coefficient:\n        \n        ::\n        \n            ? Pol([1,2,3])\n            %1 = x^2 + 2*x + 3\n            ? Polrev([1,2,3])\n            %2 = 3*x^2 + 2*x + 1\n        \n        The reciprocal function of :literal:`Pol` (resp.\302\240:literal:`Polrev`) is :literal:`Vec` (resp.\302\240\n        :literal:`Vecrev`).\n        \n        ::\n        \n            ? Vec(Pol([1,2,3]))\n            %1 = [1, 2, 3]\n            ? Vecrev( Polrev([1,2,3]) )\n            %2 = [1, 2, 3]\n        \n        :strong:`Warning.` This is :emphasis:`not` a substitution function. It will not\n        transform an object containing variables of higher priority than\302\240:math:`v`.\n        \n        ::\n        \n            ? Pol(x + y, y)\n             *** at top-level: Pol(x+y,y)\n             *** ^----------\n             *** Pol: variable must have higher priority in gtopoly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_13Pol(PyObject *__pyx_v_t, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Pol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Pol") < 0)) __PYX_ERR(10, 204, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Pol", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 204, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Pol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_12Pol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_t), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_12Pol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_t, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("Pol", 0);

  /* "cypari/auto_gen.pxi":248
 *              *** Pol: variable must have higher priority in gtopoly.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":249
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":250
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 250, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":249
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":251
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopoly(_t, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 251, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":252
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtopoly(_t, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_5;

  /* "cypari/auto_gen.pxi":253
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopoly(_t, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtopoly(__pyx_v__t, __pyx_v__v);

  /* "cypari/auto_gen.pxi":254
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopoly(_t, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Polrev(t, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":204
 *         return new_gen(_ret)
 * 
 *     def Pol(t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`t` into a polynomial with main variable :math:`v`. If :math:`t`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Pol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":256
 *         return new_gen(_ret)
 * 
 *     def Polrev(t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transform the object :math:`t` into a polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_15Polrev(PyObject *__pyx_v_t, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_14Polrev[] = "\n        Transform the object :math:`t` into a polynomial\n        with main variable :math:`v`. If :math:`t` is a scalar, this gives a constant polynomial.\n        If :math:`t` is a power series, the effect is identical to :literal:`truncate`, i.e.\302\240it\n        chops off the :math:`O(X^k)`.\n        \n        The main use of this function is when :math:`t` is a vector: it creates the\n        polynomial whose coefficients are given by :math:`t`, with :math:`t[1]` being the\n        constant term. :literal:`Pol` can be used if one wants :math:`t[1]` to be the leading\n        coefficient:\n        \n        ::\n        \n            ? Polrev([1,2,3])\n            %1 = 3*x^2 + 2*x + 1\n            ? Pol([1,2,3])\n            %2 = x^2 + 2*x + 3\n        \n        The reciprocal function of :literal:`Pol` (resp.\302\240:literal:`Polrev`) is :literal:`Vec` (resp.\302\240\n        :literal:`Vecrev`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_15Polrev(PyObject *__pyx_v_t, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Polrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Polrev") < 0)) __PYX_ERR(10, 256, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Polrev", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Polrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_14Polrev(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_t), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_14Polrev(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_t, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("Polrev", 0);

  /* "cypari/auto_gen.pxi":278
 *         :literal:`Vecrev`).
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":279
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":280
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 280, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":279
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":281
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopolyrev(_t, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 281, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":282
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtopolyrev(_t, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_5;

  /* "cypari/auto_gen.pxi":283
 *         sig_on()
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopolyrev(_t, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtopolyrev(__pyx_v__t, __pyx_v__v);

  /* "cypari/auto_gen.pxi":284
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = gtopolyrev(_t, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Qfb(a, b, c, D=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":256
 *         return new_gen(_ret)
 * 
 *     def Polrev(t, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transform the object :math:`t` into a polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Polrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":286
 *         return new_gen(_ret)
 * 
 *     def Qfb(a, b, c, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the binary quadratic form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_17Qfb(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_16Qfb[] = "\n        Creates the binary quadratic form\n        :math:`ax^2+bxy+cy^2`. If :math:`b^2-4ac > 0`, initialize Shanks' distance\n        function to :math:`D`. Negative definite forms are not implemented,\n        use their positive definite counterpart instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_17Qfb(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_c = 0;
  PyObject *__pyx_v_D = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Qfb (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_c,&__pyx_n_s_D,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((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_b)) != 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_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Qfb", 0, 2, 4, 1); __PYX_ERR(10, 286, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Qfb") < 0)) __PYX_ERR(10, 286, __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);
        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_b = values[0];
    __pyx_v_c = values[1];
    __pyx_v_D = values[2];
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 286, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Qfb", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 286, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Qfb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_16Qfb(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_a), __pyx_v_b, __pyx_v_c, __pyx_v_D, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_16Qfb(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_D, long __pyx_v_precision) {
  int __pyx_v__have_D;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__c;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("Qfb", 0);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_c);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":293
 *         use their positive definite counterpart instead.
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":294
 *         '''
 *         b = objtogen(b)
 *         c = objtogen(c)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":295
 *         b = objtogen(b)
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_gen.pxi":296
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":297
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 297, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":296
 *         c = objtogen(c)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":298
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 298, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":299
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _c = (<Gen>c).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_gen.pxi":300
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_4;

  /* "cypari/auto_gen.pxi":301
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _c = (<Gen>c).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c)->__pyx_base.g;
  __pyx_v__c = __pyx_t_4;

  /* "cypari/auto_gen.pxi":302
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":303
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":304
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":303
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":305
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":306
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = Qfb0(__pyx_v__a, __pyx_v__b, __pyx_v__c, __pyx_v__D, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":307
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = Qfb0(_a, _b, _c, _D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Ser(s, v=None, d=None, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":286
 *         return new_gen(_ret)
 * 
 *     def Qfb(a, b, c, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the binary quadratic form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Qfb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":309
 *         return new_gen(_ret)
 * 
 *     def Ser(s, v=None, d=None, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`s` into a power series with main variable :math:`v`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_19Ser(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_18Ser[] = "\n        Transforms the object :math:`s` into a power series with main variable :math:`v`\n        (:math:`x` by default) and precision (number of significant terms) equal to\n        :math:`d >= 0` (:math:`d = seriesprecision` by default). If :math:`s` is a\n        scalar, this gives a constant power series in :math:`v` with precision :literal:`d`.\n        If :math:`s` is a polynomial, the polynomial is truncated to :math:`d` terms if needed\n        \n        ::\n        \n            ? \\ps\n             seriesprecision = 16 significant terms\n            ? Ser(1) \\\\ 16 terms by default\n            %1 = 1 + O(x^16)\n            ? Ser(1, 'y, 5)\n            %2 = 1 + O(y^5)\n            ? Ser(x^2,, 5)\n            %3 = x^2 + O(x^7)\n            ? T = polcyclo(100)\n            %4 = x^40 - x^30 + x^20 - x^10 + 1\n            ? Ser(T, 'x, 11)\n            %5 = 1 - x^10 + O(x^11)\n        \n        The function is more or less equivalent with multiplication by\n        :math:`1 + O(v^d)` in theses cases, only faster.\n        \n        For the remaining types, vectors and power series, we first explain what\n        occurs if :math:`d` is omitted. In this case, the function uses exactly the amount\n        of information given in the input:\n        \n        - If :math:`s` is already a power series in :math:`v`, we return it verbatim;\n        \n        - If :math:`s` is a vector, the coefficients of the vector are\n          understood to be the coefficients of the power series starting from the\n          constant term (as in :literal:`Polrev`:math:`(x)`); in other words we convert\n          :literal:`t_VEC` / :literal:`t_COL` to the power series whose significant terms are exactly\n          given by the vector entries.\n        \n        On the other hand, if :math:`d` is explicitly given, we abide by its value\n        and return a series, truncated or extended with zeros as needed, with\n        :math:`d` significant terms.\n        \n        ::\n       "" \n            ? v = [1,2,3];\n            ? Ser(v, t) \\\\ 3 terms: seriesprecision is ignored!\n            %7 = 1 + 2*t + 3*t^2 + O(t^3)\n            ? Ser(v, t, 7) \\\\ 7 terms as explicitly requested\n            %8 = 1 + 2*t + 3*t^2 + O(t^7)\n            ? s = 1+x+O(x^2);\n            ? Ser(s)\n            %10 = 1 + x + O(x^2) \\\\ 2 terms: seriesprecision is ignored\n            ? Ser(s, x, 7) \\\\ extend to 7 terms\n            %11 = 1 + x + O(x^7)\n            ? Ser(s, x, 1) \\\\ truncate to 1 term\n            %12 = 1 + O(x)\n        \n        The warning given for :literal:`Pol` also applies here: this is not a substitution\n        function.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_19Ser(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_d = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Ser (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_d,&__pyx_n_s_serprec,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Ser") < 0)) __PYX_ERR(10, 309, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
    __pyx_v_d = values[1];
    if (values[2]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 309, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Ser", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 309, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Ser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_18Ser(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_v, __pyx_v_d, __pyx_v_serprec);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_18Ser(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_serprec) {
  long __pyx_v__v;
  int __pyx_v__have_d;
  GEN __pyx_v__s;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("Ser", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":369
 *         function.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":370
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":371
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 371, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":370
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 */
  }

  /* "cypari/auto_gen.pxi":372
 *         if v is not None:
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_2 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_2;

  /* "cypari/auto_gen.pxi":373
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":374
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 374, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cypari/auto_gen.pxi":373
 *             _v = get_var(v)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":375
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 375, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":376
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_6;

  /* "cypari/auto_gen.pxi":377
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_gen.pxi":378
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         if serprec < 0:
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":379
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_6;

    /* "cypari/auto_gen.pxi":378
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         if serprec < 0:
 */
  }

  /* "cypari/auto_gen.pxi":380
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 */
  __pyx_t_2 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":381
 *             _d = (<Gen>d).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":380
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 */
  }

  /* "cypari/auto_gen.pxi":382
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = Ser0(__pyx_v__s, __pyx_v__v, __pyx_v__d, __pyx_v_serprec);

  /* "cypari/auto_gen.pxi":383
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = Ser0(_s, _v, _d, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Set(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":309
 *         return new_gen(_ret)
 * 
 *     def Ser(s, v=None, d=None, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`s` into a power series with main variable :math:`v`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Ser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":385
 *         return new_gen(_ret)
 * 
 *     def Set(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` into a set, i.e.into a row vector, with strictly increasing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_21Set(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_20Set[] = "\n        Converts :math:`x` into a set, i.e.\302\240into a row vector, with strictly increasing\n        entries with respect to the (somewhat arbitrary) universal comparison function\n        :literal:`cmp`. Standard container types :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_LIST` and\n        :literal:`t_VECSMALL` are converted to the set with corresponding elements. All\n        others are converted to a set with one element.\n        \n        ::\n        \n            ? Set([1,2,4,2,1,3])\n            %1 = [1, 2, 3, 4]\n            ? Set(x)\n            %2 = [x]\n            ? Set(Vecsmall([1,3,2,1,3]))\n            %3 = [1, 2, 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_21Set(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Set (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_20Set(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_20Set(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Set", 0);

  /* "cypari/auto_gen.pxi":402
 *             %3 = [1, 2, 3]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtoset(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 402, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":403
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtoset(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":404
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtoset(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtoset(__pyx_v__x);

  /* "cypari/auto_gen.pxi":405
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtoset(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Strchr(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 405, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":385
 *         return new_gen(_ret)
 * 
 *     def Set(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` into a set, i.e.into a row vector, with strictly increasing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Set", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":407
 *         return new_gen(_ret)
 * 
 *     def Strchr(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` to a string, translating each integer
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_23Strchr(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_22Strchr[] = "\n        Converts :math:`x` to a string, translating each integer\n        into a character.\n        \n        ::\n        \n            ? Strchr(97)\n            %1 = \"a\"\n            ? Vecsmall(\"hello world\")\n            %2 = Vecsmall([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100])\n            ? Strchr(%)\n            %3 = \"hello world\"\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_23Strchr(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Strchr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_22Strchr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_22Strchr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Strchr", 0);

  /* "cypari/auto_gen.pxi":421
 *             %3 = "hello world"
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = Strchr(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 421, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":422
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = Strchr(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":423
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = Strchr(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = Strchr(__pyx_v__x);

  /* "cypari/auto_gen.pxi":424
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = Strchr(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Vec(x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":407
 *         return new_gen(_ret)
 * 
 *     def Strchr(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts :math:`x` to a string, translating each integer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Strchr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":426
 *         return new_gen(_ret)
 * 
 *     def Vec(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector. The dimension of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_25Vec(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_24Vec[] = "\n        Transforms the object :math:`x` into a row vector. The dimension of the\n        resulting vector can be optionally specified via the extra parameter :math:`n`.\n        If :math:`n` is omitted or :math:`0`, the dimension depends on the type of :math:`x`; the\n        vector has a single component, except when :math:`x` is\n        \n        - a vector or a quadratic form: returns the initial object considered as a\n          row vector,\n        \n        - a polynomial or a power series: returns a vector consisting of the\n          coefficients. In the case of a polynomial, the coefficients of the vector\n          start with the leading coefficient of the polynomial, while for power series\n          only the significant coefficients are taken into account, but this time by\n          increasing order of degree. In particular the valuation is ignored\n          (which makes the function useful for series of negative valuation):\n        \n        ::\n        \n            ? Vec(3*x^2 + x)\n            %1 = [3, 1, 0]\n            ? Vec(x^2 + 3*x^3 + O(x^5))\n            %2 = [1, 3, 0]\n            ? Vec(x^-2 + 3*x^-1 + O(x))\n            %3 = [1, 3, 0]\n        \n        :literal:`Vec` is the reciprocal function of :literal:`Pol` for a\n        polynomial and of :literal:`Ser` for power series of valuation :math:`0`.\n        \n        - a matrix: returns the vector of columns comprising the matrix,\n        \n        ::\n        \n            ? m = [1,2,3;4,5,6]\n            %4 =\n            [1 2 3]\n            \n            [4 5 6]\n            ? Vec(m)\n            %5 = [[1, 4]~, [2, 5]~, [3, 6]~]\n        \n        - a character string: returns the vector of individual characters,\n        \n        ::\n        \n            ? Vec(\"PARI\")\n            %6 = [\"P\", \"A\", \"R\", \"I\"]\n        \n        - a map: returns the vector of the domain of the map,\n        \n        - an error context (:literal:`t_ERROR`): returns the error components, ""see\n          :literal:`iferr`.\n        \n        In the last four cases (matrix, character string, map, error), :math:`n` is\n        meaningless and must be omitted or an error is raised. Otherwise, if :math:`n` is\n        given, :math:`0` entries are appended at the end of the vector if :math:`n > 0`, and\n        prepended at the beginning if :math:`n < 0`. The dimension of the resulting vector\n        is :math:`\\|n\\|`. This allows to write a conversion function for series that\n        takes positive valuations into account:\n        \n        ::\n        \n            ? serVec(s) = Vec(s, -serprec(s,variable(s)));\n            ? Vec(x^2 + 3*x^3 + O(x^5))\n            %2 = [0, 0, 1, 3, 0]\n        \n        (That function is not intended for series of negative valuation.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_25Vec(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vec") < 0)) __PYX_ERR(10, 426, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 426, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 426, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Vec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_24Vec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_24Vec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Vec", 0);

  /* "cypari/auto_gen.pxi":494
 *         (That function is not intended for series of negative valuation.)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovec0(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 494, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":495
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtovec0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":496
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovec0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtovec0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":497
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovec0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Vecrev(x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":426
 *         return new_gen(_ret)
 * 
 *     def Vec(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector. The dimension of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Vec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":499
 *         return new_gen(_ret)
 * 
 *     def Vecrev(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Vec (x, -n)`, then reverse the result. In particular,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_27Vecrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_26Vecrev[] = "\n        As :math:`Vec (x, -n)`, then reverse the result. In particular,\n        :literal:`Vecrev` is the reciprocal function of :literal:`Polrev`: the\n        coefficients of the vector start with the constant coefficient of the\n        polynomial and the others follow by increasing degree.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_27Vecrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vecrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vecrev") < 0)) __PYX_ERR(10, 499, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 499, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vecrev", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 499, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Vecrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_26Vecrev(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_26Vecrev(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Vecrev", 0);

  /* "cypari/auto_gen.pxi":506
 *         polynomial and the others follow by increasing degree.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecrev0(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 506, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":507
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtovecrev0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":508
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecrev0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtovecrev0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":509
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecrev0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def Vecsmall(x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":499
 *         return new_gen(_ret)
 * 
 *     def Vecrev(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :math:`Vec (x, -n)`, then reverse the result. In particular,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Vecrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":511
 *         return new_gen(_ret)
 * 
 *     def Vecsmall(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector of type :literal:`t_VECSMALL`. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_29Vecsmall(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_28Vecsmall[] = "\n        Transforms the object :math:`x` into a row vector of type :literal:`t_VECSMALL`. The\n        dimension of the resulting vector can be optionally specified via the extra\n        parameter :math:`n`.\n        \n        This acts as :literal:`Vec`:math:`(x,n)`, but only on a limited set of objects:\n        the result must be representable as a vector of small integers.\n        If :math:`x` is a character string, a vector of individual characters in ASCII\n        encoding is returned (:literal:`Strchr` yields back the character string).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_29Vecsmall(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vecsmall (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vecsmall") < 0)) __PYX_ERR(10, 511, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 511, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vecsmall", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 511, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.Vecsmall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_28Vecsmall(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_28Vecsmall(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Vecsmall", 0);

  /* "cypari/auto_gen.pxi":522
 *         encoding is returned (:literal:`Strchr` yields back the character string).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecsmall0(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 522, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":523
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtovecsmall0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":524
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecsmall0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtovecsmall0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":525
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtovecsmall0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def abs(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":511
 *         return new_gen(_ret)
 * 
 *     def Vecsmall(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the object :math:`x` into a row vector of type :literal:`t_VECSMALL`. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.Vecsmall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":527
 *         return new_gen(_ret)
 * 
 *     def abs(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Absolute value of :math:`x` (modulus if :math:`x` is complex).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_31abs(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_30abs[] = "\n        Absolute value of :math:`x` (modulus if :math:`x` is complex).\n        Rational functions are not allowed. Contrary to most transcendental\n        functions, an exact argument is :emphasis:`not` converted to a real number before\n        applying :literal:`abs` and an exact result is returned if possible.\n        \n        ::\n        \n            ? abs(-1)\n            %1 = 1\n            ? abs(3/7 + 4/7*I)\n            %2 = 5/7\n            ? abs(1 + I)\n            %3 = 1.414213562373095048801688724\n        \n        If :math:`x` is a polynomial, returns :math:`-x` if the leading coefficient is\n        real and negative else returns :math:`x`. For a power series, the constant\n        coefficient is considered instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_31abs(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("abs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "abs") < 0)) __PYX_ERR(10, 527, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 527, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("abs", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 527, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.abs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_30abs(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_30abs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("abs", 0);

  /* "cypari/auto_gen.pxi":547
 *         coefficient is considered instead.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 547, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":548
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gabs(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":549
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gabs(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":550
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gabs(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gabs(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":551
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gabs(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def acos(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":527
 *         return new_gen(_ret)
 * 
 *     def abs(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Absolute value of :math:`x` (modulus if :math:`x` is complex).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.abs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":553
 *         return new_gen(_ret)
 * 
 *     def acos(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cos^{-1}(x) = -i \log (x + i\sqrt{1-x^2})`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_33acos(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_32acos[] = "\n        Principal branch of :math:`\\cos^{-1}(x) = -i \\log (x + i\\sqrt{1-x^2})`.\n        In particular, :math:`\\Re (acos(x))\\in [0,\\pi]` and if :math:`x\\in \\mathbb{R}` and :math:`\\|x\\| > 1`,\n        then :math:`acos(x)` is complex. The branch cut is in two pieces:\n        :math:`]- oo ,-1]` , continuous with quadrant II, and :math:`[1,+ oo [`, continuous\n        with quadrant IV. We have :math:`acos(x) = \\pi/2 - asin(x)` for all\n        :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_33acos(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("acos (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "acos") < 0)) __PYX_ERR(10, 553, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 553, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("acos", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 553, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.acos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_32acos(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_32acos(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("acos", 0);

  /* "cypari/auto_gen.pxi":562
 *         :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 562, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":563
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacos(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":564
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gacos(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":565
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacos(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gacos(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":566
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacos(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def acosh(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":553
 *         return new_gen(_ret)
 * 
 *     def acos(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cos^{-1}(x) = -i \log (x + i\sqrt{1-x^2})`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.acos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":568
 *         return new_gen(_ret)
 * 
 *     def acosh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cosh^{-1}(x) = 2
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_35acosh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_34acosh[] = "\n        Principal branch of :math:`\\cosh^{-1}(x) = 2\n        \\log (\\sqrt{(x+1)/2} + \\sqrt{(x-1)/2})`. In particular,\n        :math:`\\Re (acosh(x)) >= 0` and\n        :math:`\\Im (acosh(x))\\in ]-\\pi,\\pi]`; if :math:`x\\in \\mathbb{R}` and :math:`x < 1`, then\n        :math:`acosh(x)` is complex.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_35acosh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("acosh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "acosh") < 0)) __PYX_ERR(10, 568, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 568, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("acosh", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 568, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.acosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_34acosh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_34acosh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("acosh", 0);

  /* "cypari/auto_gen.pxi":576
 *         :math:`acosh(x)` is complex.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 576, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":577
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacosh(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":578
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gacosh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":579
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacosh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gacosh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":580
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gacosh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def addprimes(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":568
 *         return new_gen(_ret)
 * 
 *     def acosh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\cosh^{-1}(x) = 2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.acosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":582
 *         return new_gen(_ret)
 * 
 *     def addprimes(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Adds the integers contained in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_37addprimes(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_36addprimes[] = "\n        Adds the integers contained in the\n        vector :math:`x` (or the single integer :math:`x`) to a special table of\n        \"user-defined primes\", and returns that table. Whenever :literal:`factor` is\n        subsequently called, it will trial divide by the elements in this table.\n        If :math:`x` is empty or omitted, just returns the current list of extra\n        primes.\n        \n        The entries in :math:`x` must be primes: there is no internal check, even if\n        the :literal:`factor_proven` default is set. To remove primes from the list use\n        :literal:`removeprimes`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_37addprimes(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("addprimes (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_36addprimes(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_36addprimes(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("addprimes", 0);

  /* "cypari/auto_gen.pxi":595
 *         :literal:`removeprimes`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = addprimes(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 595, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":596
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = addprimes(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":597
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = addprimes(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = addprimes(__pyx_v__x);

  /* "cypari/auto_gen.pxi":598
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = addprimes(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def agm(x, y, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":582
 *         return new_gen(_ret)
 * 
 *     def addprimes(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Adds the integers contained in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.addprimes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":600
 *         return new_gen(_ret)
 * 
 *     def agm(x, y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Arithmetic-geometric mean of :math:`x` and :math:`y`. In the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_39agm(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_38agm[] = "\n        Arithmetic-geometric mean of :math:`x` and :math:`y`. In the\n        case of complex or negative numbers, the optimal AGM is returned\n        (the largest in absolute value over all choices of the signs of the square\n        roots). :math:`p`-adic or power series arguments are also allowed. Note that\n        a :math:`p`-adic agm exists only if :math:`x/y` is congruent to 1 modulo :math:`p` (modulo\n        16 for :math:`p = 2`). :math:`x` and :math:`y` cannot both be vectors or matrices.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_39agm(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("agm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_precision,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_y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "agm") < 0)) __PYX_ERR(10, 600, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 600, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("agm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 600, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.agm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_38agm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_38agm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("agm", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":609
 *         16 for :math:`p = 2`). :math:`x` and :math:`y` cannot both be vectors or matrices.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":610
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 610, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":611
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":612
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = agm(_x, _y, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":613
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = agm(_x, _y, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":614
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = agm(_x, _y, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = agm(__pyx_v__x, __pyx_v__y, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":615
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = agm(_x, _y, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algadd(al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":600
 *         return new_gen(_ret)
 * 
 *     def agm(x, y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Arithmetic-geometric mean of :math:`x` and :math:`y`. In the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.agm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":617
 *         return new_gen(_ret)
 * 
 *     def algadd(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their sum :math:`x+y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_41algadd(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_40algadd[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their sum :math:`x+y` in\n        the algebra\302\240:emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y),[-1,1]);\n            ? algadd(A,[1,0]~,[1,2]~)\n            %2 = [2, 2]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_41algadd(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algadd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algadd", 1, 2, 2, 1); __PYX_ERR(10, 617, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algadd") < 0)) __PYX_ERR(10, 617, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algadd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 617, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_40algadd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_40algadd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algadd", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":630
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":631
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":632
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 632, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":633
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":634
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algadd(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":635
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algadd(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":636
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algadd(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algadd(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":637
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algadd(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algalgtobasis(al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":617
 *         return new_gen(_ret)
 * 
 *     def algadd(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their sum :math:`x+y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":639
 *         return new_gen(_ret)
 * 
 *     def algalgtobasis(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_43algalgtobasis(PyObject *__pyx_v_al, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_42algalgtobasis[] = "\n        Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output\n        by :literal:`alginit`, transforms it to a column vector on the integral basis of\n        :emphasis:`al`. This is the inverse function of :literal:`algbasistoalg`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y^2-5),[2,y]);\n            ? algalgtobasis(A,[y,1]~)\n            %2 = [0, 2, 0, -1, 2, 0, 0, 0]~\n            ? algbasistoalg(A,algalgtobasis(A,[y,1]~))\n            %3 = [Mod(Mod(y, y^2 - 5), x^2 - 2), 1]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_43algalgtobasis(PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algalgtobasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_42algalgtobasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_42algalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":653
 *             %3 = [Mod(Mod(y, y^2 - 5), x^2 - 2), 1]~
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":654
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 654, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":655
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algalgtobasis(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":656
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algalgtobasis(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":657
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algalgtobasis(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algalgtobasis(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_gen.pxi":658
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algalgtobasis(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algaut(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":639
 *         return new_gen(_ret)
 * 
 *     def algalgtobasis(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":660
 *         return new_gen(_ret)
 * 
 *     def algaut(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_45algaut(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_44algaut[] = "\n        Given a cyclic algebra :math:`al = (L/K,\\sigma,b)` output by\n        :literal:`alginit`, returns the automorphism :math:`\\sigma`.\n        \n        ::\n        \n            ? nf = nfinit(y);\n            ? p = idealprimedec(nf,7)[1];\n            ? p2 = idealprimedec(nf,11)[1];\n            ? A = alginit(nf,[3,[[p,p2],[1/3,2/3]],[0]]);\n            ? algaut(A)\n            %5 = -1/3*x^2 + 1/3*x + 26/3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_45algaut(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algaut (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_44algaut(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_44algaut(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algaut", 0);

  /* "cypari/auto_gen.pxi":674
 *             %5 = -1/3*x^2 + 1/3*x + 26/3
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algaut(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 674, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":675
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algaut(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":676
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algaut(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algaut(__pyx_v__al);

  /* "cypari/auto_gen.pxi":677
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algaut(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algb(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":660
 *         return new_gen(_ret)
 * 
 *     def algaut(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algaut", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":679
 *         return new_gen(_ret)
 * 
 *     def algb(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_47algb(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_46algb[] = "\n        Given a cyclic algebra :math:`al = (L/K,\\sigma,b)` output by\n        :literal:`alginit`, returns the element :math:`b\\in K`.\n        \n        ::\n        \n            nf = nfinit(y);\n            ? p = idealprimedec(nf,7)[1];\n            ? p2 = idealprimedec(nf,11)[1];\n            ? A = alginit(nf,[3,[[p,p2],[1/3,2/3]],[0]]);\n            ? algb(A)\n            %5 = Mod(-77, y)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_47algb(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algb (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_46algb(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_46algb(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algb", 0);

  /* "cypari/auto_gen.pxi":693
 *             %5 = Mod(-77, y)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algb(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 693, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":694
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algb(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":695
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algb(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algb(__pyx_v__al);

  /* "cypari/auto_gen.pxi":696
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algb(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algbasis(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":679
 *         return new_gen(_ret)
 * 
 *     def algb(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a cyclic algebra :math:`al = (L/K,\sigma,b)` output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":698
 *         return new_gen(_ret)
 * 
 *     def algbasis(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_49algbasis(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_48algbasis[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :math:`\\mathbb{Z}`-basis of the order\302\240:math:`O_0` stored in :emphasis:`al` with respect to the\n        natural order in :emphasis:`al`. It is a maximal order if one has been computed.\n        \n        ::\n        \n            A = alginit(nfinit(y), [-1,-1]);\n            ? algbasis(A)\n            %2 =\n            [1 0 0 1/2]\n            \n            [0 1 0 1/2]\n            \n            [0 0 1 1/2]\n            \n            [0 0 0 1/2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_49algbasis(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_48algbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_48algbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algbasis", 0);

  /* "cypari/auto_gen.pxi":717
 *             [0 0 0 1/2]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algbasis(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 717, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":718
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algbasis(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":719
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algbasis(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algbasis(__pyx_v__al);

  /* "cypari/auto_gen.pxi":720
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algbasis(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algbasistoalg(al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":698
 *         return new_gen(_ret)
 * 
 *     def algbasis(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":722
 *         return new_gen(_ret)
 * 
 *     def algbasistoalg(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_51algbasistoalg(PyObject *__pyx_v_al, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_50algbasistoalg[] = "\n        Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output\n        by :literal:`alginit`, transforms it to its algebraic representation in :emphasis:`al`.\n        This is the inverse function of :literal:`algalgtobasis`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y^2-5),[2,y]);\n            ? z = algbasistoalg(A,[0,1,0,0,2,-3,0,0]~);\n            ? liftall(z)\n            %3 = [(-1/2*y - 2)*x + (-1/4*y + 5/4), -3/4*y + 7/4]~\n            ? algalgtobasis(A,z)\n            %4 = [0, 1, 0, 0, 2, -3, 0, 0]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_51algbasistoalg(PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algbasistoalg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_50algbasistoalg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_50algbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":737
 *             %4 = [0, 1, 0, 0, 2, -3, 0, 0]~
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":738
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 738, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":739
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algbasistoalg(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":740
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algbasistoalg(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":741
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algbasistoalg(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algbasistoalg(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_gen.pxi":742
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algbasistoalg(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algcenter(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 742, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":722
 *         return new_gen(_ret)
 * 
 *     def algbasistoalg(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in the central simple algebra :emphasis:`al` output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":744
 *         return new_gen(_ret)
 * 
 *     def algcenter(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit`, returns a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_53algcenter(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_52algcenter[] = "\n        If :emphasis:`al` is a table algebra output by :literal:`algtableinit`, returns a\n        basis of the center of the algebra\302\240:emphasis:`al` over its prime field (:math:`\\mathbb{Q}` or\n        :math:`\\mathbb{F}_p`). If :emphasis:`al` is a central simple algebra output by :literal:`alginit`,\n        returns the center of\302\240:emphasis:`al`, which is stored in :emphasis:`al`.\n        \n        A simple example: the :math:`2 x 2` upper triangular matrices over :math:`\\mathbb{Q}`,\n        generated by :math:`I_2`, :math:`a = [0,1;0,0]` and :math:`b = [0,0;0,1]`,\n        such that :math:`a^2 = 0`, :math:`ab = a`, :math:`ba = 0`, :math:`b^2 = b`: the diagonal matrices\n        form the center.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algcenter(A) \\\\ = (I_2)\n            %3 =\n            [1]\n            \n            [0]\n            \n            [0]\n        \n        An example in the central simple case:\n        \n        ::\n        \n            ? nf = nfinit(y^3-y+1);\n            ? A = alginit(nf, [-1,-1]);\n            ? algcenter(A).pol\n            %3 = y^3 - y + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_53algcenter(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algcenter (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_52algcenter(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_52algcenter(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algcenter", 0);

  /* "cypari/auto_gen.pxi":777
 *             %3 = y^3 - y + 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algcenter(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 777, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":778
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algcenter(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":779
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algcenter(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algcenter(__pyx_v__al);

  /* "cypari/auto_gen.pxi":780
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algcenter(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algcentralproj(al, z, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":744
 *         return new_gen(_ret)
 * 
 *     def algcenter(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit`, returns a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algcenter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":782
 *         return new_gen(_ret)
 * 
 *     def algcentralproj(al, z, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a table algebra :emphasis:`al` output by :literal:`algtableinit` and a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_55algcentralproj(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_54algcentralproj[] = "\n        Given a table algebra :emphasis:`al` output by :literal:`algtableinit` and a\n        :literal:`t_VEC` :math:`z = [z_1,...,z_n]` of orthogonal central idempotents,\n        returns a :literal:`t_VEC` :math:`[al_1,...,al_n]` of algebras such that\n        :math:`al_i = z_i al`. If :math:`maps = 1`, each :math:`al_i` is a :literal:`t_VEC`\n        :math:`[quo,proj,lift]` where :emphasis:`quo` is the quotient algebra, :emphasis:`proj` is a\n        :literal:`t_MAT` representing the projection onto this quotient and :emphasis:`lift` is a\n        :literal:`t_MAT` representing a lift.\n        \n        A simple example: :math:`\\mathbb{F}_2 x \\mathbb{F}_4`, generated by\302\240:math:`1 = (1,1)`, :math:`e = (1,0)`\n        and\302\240:math:`x` such that\302\240:math:`x^2+x+1 = 0`. We have\302\240:math:`e^2 = e`, :math:`x^2 = x+1` and\302\240:math:`ex = 0`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? e = [0,1,0]~;\n            ? e2 = algsub(A,[1,0,0]~,e);\n            ? [a,a2] = algcentralproj(A,[e,e2]);\n            ? algdim(a)\n            %6 = 1\n            ? algdim(a2)\n            %7 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_55algcentralproj(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algcentralproj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_maps,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_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algcentralproj") < 0)) __PYX_ERR(10, 782, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 782, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algcentralproj", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 782, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algcentralproj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_54algcentralproj(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_z, __pyx_v_maps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_54algcentralproj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_z, long __pyx_v_maps) {
  GEN __pyx_v__al;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algcentralproj", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":807
 *             %7 = 2
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":808
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 808, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":809
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":810
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_gen.pxi":811
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alg_centralproj(__pyx_v__al, __pyx_v__z, __pyx_v_maps);

  /* "cypari/auto_gen.pxi":812
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = alg_centralproj(_al, _z, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algchar(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":782
 *         return new_gen(_ret)
 * 
 *     def algcentralproj(al, z, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a table algebra :emphasis:`al` output by :literal:`algtableinit` and a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algcentralproj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":814
 *         return new_gen(_ret)
 * 
 *     def algchar(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or :literal:`algtableinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_57algchar(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_56algchar[] = "\n        Given an algebra :emphasis:`al` output by :literal:`alginit` or :literal:`algtableinit`,\n        returns the characteristic of :emphasis:`al`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,13);\n            ? algchar(A)\n            %3 = 13\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_57algchar(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algchar (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_56algchar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_56algchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algchar", 0);

  /* "cypari/auto_gen.pxi":826
 *             %3 = 13
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algchar(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 826, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":827
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algchar(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":828
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algchar(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algchar(__pyx_v__al);

  /* "cypari/auto_gen.pxi":829
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algchar(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algcharpoly(al, b, v=None, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":814
 *         return new_gen(_ret)
 * 
 *     def algchar(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or :literal:`algtableinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":831
 *         return new_gen(_ret)
 * 
 *     def algcharpoly(al, b, v=None, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al`, returns its characteristic polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_59algcharpoly(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_58algcharpoly[] = "\n        Given an element :math:`b` in :emphasis:`al`, returns its characteristic polynomial\n        as a polynomial in the variable :math:`v`. If :emphasis:`al` is a table algebra output\n        by :literal:`algtableinit` or if :math:`abs = 1`, returns the absolute characteristic\n        polynomial of :emphasis:`b`, which is an element of :math:`\\mathbb{F}_p[v]` or\302\240:math:`\\mathbb{Q}[v]`; if :emphasis:`al`\n        is a central simple algebra output by :literal:`alginit` and :math:`abs = 0`, returns the\n        reduced characteristic polynomial of :emphasis:`b`, which is an element of\302\240:math:`K[v]`\n        where\302\240:math:`K` is the center of :emphasis:`al`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y), [-1,-1]); \\\\ (-1,-1)_Q\n            ? algcharpoly(al, [0,1]~)\n            %2 = x^2 + 1\n            ? algcharpoly(al, [0,1]~,,1)\n            %3 = x^4 + 2*x^2 + 1\n            ? nf = nfinit(y^2-5);\n            ? al = alginit(nf,[-1,y]);\n            ? a = [y,1+x]~*Mod(1,y^2-5)*Mod(1,x^2+1);\n            ? P = lift(algcharpoly(al,a))\n            %7 = x^2 - 2*y*x + (-2*y + 5)\n            ? algcharpoly(al,a,,1)\n            %8 = x^8 - 20*x^6 - 80*x^5 + 110*x^4 + 800*x^3 + 1500*x^2 - 400*x + 25\n            ? lift(P*subst(P,y,-y)*Mod(1,y^2-5))^2\n            %9 = x^8 - 20*x^6 - 80*x^5 + 110*x^4 + 800*x^3 + 1500*x^2 - 400*x + 25\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_59algcharpoly(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algcharpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_v,&__pyx_n_s_abs,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algcharpoly") < 0)) __PYX_ERR(10, 831, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_b = values[0];
    __pyx_v_v = values[1];
    if (values[2]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 831, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algcharpoly", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 831, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_58algcharpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_b, __pyx_v_v, __pyx_v_abs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_58algcharpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_b, PyObject *__pyx_v_v, long __pyx_v_abs) {
  long __pyx_v__v;
  GEN __pyx_v__al;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("algcharpoly", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":860
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":861
 *         '''
 *         b = objtogen(b)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":862
 *         b = objtogen(b)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":863
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 863, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":862
 *         b = objtogen(b)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":864
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 864, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":865
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_6;

  /* "cypari/auto_gen.pxi":866
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_6;

  /* "cypari/auto_gen.pxi":867
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algcharpoly(__pyx_v__al, __pyx_v__b, __pyx_v__v, __pyx_v_abs);

  /* "cypari/auto_gen.pxi":868
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algcharpoly(_al, _b, _v, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdegree(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":831
 *         return new_gen(_ret)
 * 
 *     def algcharpoly(al, b, v=None, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al`, returns its characteristic polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":870
 *         return new_gen(_ret)
 * 
 *     def algdegree(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_61algdegree(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_60algdegree[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        the degree of :emphasis:`al`.\n        \n        ::\n        \n            ? nf = nfinit(y^3-y+1);\n            ? A = alginit(nf, [-1,-1]);\n            ? algdegree(A)\n            %3 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_61algdegree(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdegree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_60algdegree(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_60algdegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algdegree", 0);

  /* "cypari/auto_gen.pxi":882
 *             %3 = 2
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdegree(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 882, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":883
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algdegree(_al)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":884
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdegree(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algdegree(__pyx_v__al);

  /* "cypari/auto_gen.pxi":885
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdegree(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":886
 *         cdef long _ret = algdegree(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algdep(z, long k, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 886, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":870
 *         return new_gen(_ret)
 * 
 *     def algdegree(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":888
 *         return _ret
 * 
 *     def algdep(z, long k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`z` being real/complex, or :math:`p`-adic, finds a polynomial (in the variable
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_63algdep(PyObject *__pyx_v_z, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_62algdep[] = "\n        :math:`z` being real/complex, or :math:`p`-adic, finds a polynomial (in the variable\n        :literal:`'x`) of degree at most\n        :math:`k`, with integer coefficients, having :math:`z` as approximate root. Note that the\n        polynomial which is obtained is not necessarily the \"correct\" one. In fact\n        it is not even guaranteed to be irreducible. One can check the closeness\n        either by a polynomial evaluation (use :literal:`subst`), or by computing the\n        roots of the polynomial given by :literal:`algdep` (use :literal:`polroots` or\n        :literal:`polrootspadic`).\n        \n        Internally, :literal:`lindep`:math:`([1,z,...,z^k], flag)` is used. A non-zero value of\n        :math:`flag` may improve on the default behavior if the input number is known to a\n        :emphasis:`huge` accuracy, and you suspect the last bits are incorrect: if :math:`flag > 0`\n        the computation is done with an accuracy of :math:`flag` decimal digits; to get\n        meaningful results, the parameter :math:`flag` should be smaller than the number of\n        correct decimal digits in the input.\n        But default values are usually sufficient, so try without :math:`flag` first:\n        \n        ::\n        \n            ? \\p200\n            ? z = 2^(1/6)+3^(1/5);\n            ? algdep(z, 30); \\\\ right in 280ms\n            ? algdep(z, 30, 100); \\\\ wrong in 169ms\n            ? algdep(z, 30, 170); \\\\ right in 288ms\n            ? algdep(z, 30, 200); \\\\ wrong in 320ms\n            ? \\p250\n            ? z = 2^(1/6)+3^(1/5); \\\\ recompute to new, higher, accuracy !\n            ? algdep(z, 30); \\\\ right in 329ms\n            ? algdep(z, 30, 200); \\\\ right in 324ms\n            ? \\p500\n            ? algdep(2^(1/6)+3^(1/5), 30); \\\\ right in 677ms\n            ? \\p1000\n            ? algdep(2^(1/6)+3^(1/5), 30); \\\\ right in 1.5s\n        \n        The changes in :literal:`realprecision` only affect the quality of th""e\n        initial approximation to :math:`2^{1/6} + 3^{1/5}`, :literal:`algdep` itself uses\n        exact operations. The size of its operands depend on the accuracy of the\n        input of course: more accurate input means slower operations.\n        \n        Proceeding by increments of 5 digits of accuracy, :literal:`algdep` with default\n        flag produces its first correct result at 195 digits, and from then on a\n        steady stream of correct results:\n        \n        ::\n        \n             \\\\ assume T contains the correct result, for comparison\n             forstep(d=100, 250, 5, localprec(d);\\\n             print(d, \" \", algdep(2^(1/6)+3^(1/5),30) == T))\n        \n        The above example is the test case studied in a 2000 paper by Borwein and\n        Lisonek: Applications of integer relation algorithms, :emphasis:`Discrete Math.`,\n        :strong:`217`, p.\302\24065--82. The version of PARI tested there was 1.39, which\n        succeeded reliably from precision 265 on, in about 200 as much time as the\n        current version.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_63algdep(PyObject *__pyx_v_z, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_flag,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_k)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdep") < 0)) __PYX_ERR(10, 888, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 888, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 888, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdep", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 888, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_62algdep(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_z), __pyx_v_k, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_62algdep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z, long __pyx_v_k, long __pyx_v_flag) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algdep", 0);

  /* "cypari/auto_gen.pxi":945
 *         current version.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = algdep0(_z, k, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 945, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":946
 *         '''
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdep0(_z, k, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_2;

  /* "cypari/auto_gen.pxi":947
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = algdep0(_z, k, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdep0(__pyx_v__z, __pyx_v_k, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":948
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = algdep0(_z, k, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdim(al, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":888
 *         return _ret
 * 
 *     def algdep(z, long k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`z` being real/complex, or :math:`p`-adic, finds a polynomial (in the variable
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":950
 *         return new_gen(_ret)
 * 
 *     def algdim(al, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit` or if:math:`abs = 1`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_65algdim(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_64algdim[] = "\n        If :emphasis:`al` is a table algebra output by :literal:`algtableinit` or if\302\240:math:`abs = 1`,\n        returns the dimension of :emphasis:`al` over its prime subfield (:math:`\\mathbb{Q}` or :math:`\\mathbb{F}_p`).\n        If\302\240:emphasis:`al` is a central simple algebra output by :literal:`alginit` and\302\240:math:`abs = 0`,\n        returns the dimension of :emphasis:`al` over its center.\n        \n        ::\n        \n            ? nf = nfinit(y^3-y+1);\n            ? A = alginit(nf, [-1,-1]);\n            ? algdim(A)\n            %3 = 4\n            ? algdim(A,1)\n            %4 = 12\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_65algdim(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdim (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_abs,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdim") < 0)) __PYX_ERR(10, 950, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 950, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdim", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 950, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_64algdim(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_abs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_64algdim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, long __pyx_v_abs) {
  GEN __pyx_v__al;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algdim", 0);

  /* "cypari/auto_gen.pxi":966
 *             %4 = 12
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdim(_al, abs)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 966, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":967
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algdim(_al, abs)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":968
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdim(_al, abs)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algdim(__pyx_v__al, __pyx_v_abs);

  /* "cypari/auto_gen.pxi":969
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algdim(_al, abs)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":970
 *         cdef long _ret = algdim(_al, abs)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algdisc(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":950
 *         return new_gen(_ret)
 * 
 *     def algdim(al, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra output by :literal:`algtableinit` or if:math:`abs = 1`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":972
 *         return _ret
 * 
 *     def algdisc(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, computes
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_67algdisc(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_66algdisc[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, computes\n        the discriminant of the order :math:`O_0` stored in :emphasis:`al`, that is the\n        determinant of the trace form :math:`\\rm{Tr} : O_0 x O_0 \\to \\mathbb{Z}`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-3,1-y]);\n            ? [PR,h] = alghassef(A)\n            %3 = [[[2, [2, 0]~, 1, 2, 1], [3, [3, 0]~, 1, 2, 1]], Vecsmall([0, 1])]\n            ? n = algdegree(A);\n            ? D = algdim(A,1);\n            ? h = vector(#h, i, n - gcd(n,h[i]));\n            ? n^D * nf.disc^(n^2) * idealnorm(nf, idealfactorback(nf,PR,h))^n\n            %4 = 12960000\n            ? algdisc(A)\n            %5 = 12960000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_67algdisc(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_66algdisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_66algdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algdisc", 0);

  /* "cypari/auto_gen.pxi":992
 *             %5 = 12960000
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algdisc(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 992, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":993
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdisc(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":994
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algdisc(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdisc(__pyx_v__al);

  /* "cypari/auto_gen.pxi":995
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algdisc(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdivl(al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 995, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":972
 *         return _ret
 * 
 *     def algdisc(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, computes
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":997
 *         return new_gen(_ret)
 * 
 *     def algdivl(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their left quotient
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_69algdivl(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_68algdivl[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their left quotient\n        :math:`x\\backslash y` in the algebra :emphasis:`al`: an element :math:`z` such that :math:`xz = y` (such\n        an element is not unique when :math:`x` is a zerodivisor). If\302\240:math:`x` is invertible, this\n        is the same as :math:`x^{-1}y`. Assumes that :math:`y` is left divisible by :math:`x` (i.e. that\n        :math:`z` exists). Also accepts matrices with coefficients in\302\240:emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_69algdivl(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdivl (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algdivl", 1, 2, 2, 1); __PYX_ERR(10, 997, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdivl") < 0)) __PYX_ERR(10, 997, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdivl", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 997, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdivl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_68algdivl(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_68algdivl(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdivl", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":1005
 *         :math:`z` exists). Also accepts matrices with coefficients in:emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1006
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1007
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1007, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1008
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1009
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivl(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1010
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdivl(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1011
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivl(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdivl(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":1012
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivl(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algdivr(al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":997
 *         return new_gen(_ret)
 * 
 *     def algdivl(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their left quotient
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdivl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1014
 *         return new_gen(_ret)
 * 
 *     def algdivr(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, returns :math:`xy^{-1}`. Also accepts
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_71algdivr(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_70algdivr[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, returns :math:`xy^{-1}`. Also accepts\n        matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_71algdivr(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algdivr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algdivr", 1, 2, 2, 1); __PYX_ERR(10, 1014, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algdivr") < 0)) __PYX_ERR(10, 1014, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algdivr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1014, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdivr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_70algdivr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_70algdivr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algdivr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":1019
 *         matrices with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1020
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1021
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1021, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1022
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1023
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivr(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1024
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algdivr(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1025
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivr(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algdivr(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":1026
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algdivr(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alggroup(gal, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1014
 *         return new_gen(_ret)
 * 
 *     def algdivr(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, returns :math:`xy^{-1}`. Also accepts
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algdivr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1028
 *         return new_gen(_ret)
 * 
 *     def alggroup(gal, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the group algebra:math:`K[G]` over:math:`K = \mathbb{Q}` (:math:`p` omitted) or:math:`\mathbb{F}_p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_73alggroup(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_72alggroup[] = "\n        Initializes the group algebra\302\240:math:`K[G]` over\302\240:math:`K = \\mathbb{Q}` (:math:`p` omitted) or\302\240:math:`\\mathbb{F}_p`\n        where\302\240:math:`G` is the underlying group of the :literal:`galoisinit` structure\302\240:emphasis:`gal`.\n        The input\302\240:emphasis:`gal` is also allowed to be a :literal:`t_VEC` of permutations that is\n        closed under products.\n        \n        Example:\n        \n        ::\n        \n            ? K = nfsplitting(x^3-x+1);\n            ? gal = galoisinit(K);\n            ? al = alggroup(gal);\n            ? algissemisimple(al)\n            %4 = 1\n            ? G = [Vecsmall([1,2,3]), Vecsmall([1,3,2])];\n            ? al2 = alggroup(G, 2);\n            ? algissemisimple(al2)\n            %8 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_73alggroup(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alggroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alggroup") < 0)) __PYX_ERR(10, 1028, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alggroup", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1028, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alggroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_72alggroup(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_72alggroup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__gal;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("alggroup", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":1049
 *             %8 = 0
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":1050
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1051
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":1050
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1052
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 1052, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1053
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1054
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":1055
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1056
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alggroup(_gal, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1055
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)
 */
  }

  /* "cypari/auto_gen.pxi":1057
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alggroup(__pyx_v__gal, __pyx_v__p);

  /* "cypari/auto_gen.pxi":1058
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = alggroup(_gal, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alghasse(al, pl):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1028
 *         return new_gen(_ret)
 * 
 *     def alggroup(gal, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the group algebra:math:`K[G]` over:math:`K = \mathbb{Q}` (:math:`p` omitted) or:math:`\mathbb{F}_p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alggroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1060
 *         return new_gen(_ret)
 * 
 *     def alghasse(al, pl):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` and a prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_75alghasse(PyObject *__pyx_v_al, PyObject *__pyx_v_pl); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_74alghasse[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit` and a prime\n        ideal or an integer between :math:`1` and :math:`r_1+r_2`, returns a :literal:`t_FRAC` :math:`h` : the\n        local Hasse invariant of :emphasis:`al` at the place specified by :emphasis:`pl`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? alghasse(A, 1)\n            %3 = 1/2\n            ? alghasse(A, 2)\n            %4 = 0\n            ? alghasse(A, idealprimedec(nf,2)[1])\n            %5 = 1/2\n            ? alghasse(A, idealprimedec(nf,5)[1])\n            %6 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_75alghasse(PyObject *__pyx_v_al, PyObject *__pyx_v_pl) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alghasse (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_74alghasse(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_pl));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_74alghasse(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl) {
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alghasse", 0);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":1079
 *             %6 = 0
 *         '''
 *         pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1079, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1080
 *         '''
 *         pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = (<Gen>pl).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1080, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1081
 *         pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = alghasse(_al, _pl)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1082
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alghasse(_al, _pl)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
  __pyx_v__pl = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1083
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = alghasse(_al, _pl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alghasse(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_gen.pxi":1084
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = alghasse(_al, _pl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alghassef(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1060
 *         return new_gen(_ret)
 * 
 *     def alghasse(al, pl):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` and a prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alghasse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1086
 *         return new_gen(_ret)
 * 
 *     def alghassef(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_77alghassef(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_76alghassef[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :literal:`t_VEC` :math:`[PR, h_f]` describing the local Hasse invariants at the\n        finite places of the center: :literal:`PR` is a :literal:`t_VEC` of primes and :math:`h_f` is a\n        :literal:`t_VECSMALL` of integers modulo the degree :math:`d` of :emphasis:`al`. The Hasse\n        invariant of\302\240:emphasis:`al` at the primes outside\302\240:literal:`PR` is\302\240:math:`0`, but\302\240:literal:`PR` can\n        include primes at which the Hasse invariant is\302\240:math:`0`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,2*y-1]);\n            ? [PR,hf] = alghassef(A);\n            ? PR\n            %4 = [[19, [10, 2]~, 1, 1, [-8, 2; 2, -10]], [2, [2, 0]~, 1, 2, 1]]\n            ? hf\n            %5 = Vecsmall([1, 0])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_77alghassef(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alghassef (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_76alghassef(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_76alghassef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("alghassef", 0);

  /* "cypari/auto_gen.pxi":1105
 *             %5 = Vecsmall([1, 0])
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassef(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1105, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1106
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alghassef(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1107
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassef(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alghassef(__pyx_v__al);

  /* "cypari/auto_gen.pxi":1108
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassef(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alghassei(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1086
 *         return new_gen(_ret)
 * 
 *     def alghassef(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alghassef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1110
 *         return new_gen(_ret)
 * 
 *     def alghassei(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_79alghassei(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_78alghassei[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :literal:`t_VECSMALL` :math:`h_i` of :math:`r_1` integers modulo the degree :math:`d` of :emphasis:`al`,\n        where :math:`r_1` is the number of real places of the center: the local Hasse\n        invariants of :emphasis:`al` at infinite places.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? alghassei(A)\n            %3 = Vecsmall([1, 0])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_79alghassei(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alghassei (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_78alghassei(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_78alghassei(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("alghassei", 0);

  /* "cypari/auto_gen.pxi":1124
 *             %3 = Vecsmall([1, 0])
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassei(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1124, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1125
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alghassei(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1126
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassei(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alghassei(__pyx_v__al);

  /* "cypari/auto_gen.pxi":1127
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alghassei(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algindex(al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1110
 *         return new_gen(_ret)
 * 
 *     def alghassei(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alghassei", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1129
 *         return new_gen(_ret)
 * 
 *     def algindex(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the index of the central simple algebra:math:`A` over:math:`K` (as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_81algindex(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_80algindex[] = "\n        Returns the index of the central simple algebra\302\240:math:`A` over\302\240:math:`K` (as output by\n        alginit), that is the degree\302\240:math:`e` of the unique central division algebra\302\240:math:`D`\n        over :math:`K` such that\302\240:math:`A` is isomorphic to some matrix algebra\302\240:math:`M_k(D)`. If\n        :emphasis:`pl` is set, it should be a prime ideal of\302\240:math:`K` or an integer between\302\240:math:`1`\n        and\302\240:math:`r_1+r_2`, and in that case return the local index at the place :emphasis:`pl`\n        instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algindex(A, 1)\n            %3 = 2\n            ? algindex(A, 2)\n            %4 = 1\n            ? algindex(A, idealprimedec(nf,2)[1])\n            %5 = 2\n            ? algindex(A, idealprimedec(nf,5)[1])\n            %6 = 1\n            ? algindex(A)\n            %7 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_81algindex(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algindex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pl,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algindex") < 0)) __PYX_ERR(10, 1129, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algindex", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1129, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_80algindex(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_pl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_80algindex(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algindex", 0);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":1153
 *             %7 = 2
 *         '''
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_1 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_1;

  /* "cypari/auto_gen.pxi":1154
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1155
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1155, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":1154
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1156
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 1156, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1157
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1158
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_gen.pxi":1159
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1160
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algindex(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1159
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)
 */
  }

  /* "cypari/auto_gen.pxi":1161
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algindex(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_gen.pxi":1162
 *             _pl = (<Gen>pl).g
 *         cdef long _ret = algindex(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1163
 *         cdef long _ret = algindex(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def alginit(B, C, v=None, long maxord=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1129
 *         return new_gen(_ret)
 * 
 *     def algindex(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the index of the central simple algebra:math:`A` over:math:`K` (as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1165
 *         return _ret
 * 
 *     def alginit(B, C, v=None, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the central simple algebra defined by data :math:`B`, :math:`C` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_83alginit(PyObject *__pyx_v_B, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_82alginit[] = "\n        Initializes the central simple algebra defined by data :math:`B`, :math:`C` and\n        variable :math:`v`, as follows.\n        \n        - (multiplication table) :math:`B` is the base number field :math:`K` in :literal:`nfinit`\n          form, :math:`C` is a \"multiplication table\" over :math:`K`.\n          As a :math:`K`-vector space, the algebra is generated by a basis\n          :math:`(e_1 = 1,..., e_n)`; the table is given as a :literal:`t_VEC` of :math:`n` matrices in\n          :math:`M_n(K)`, giving the left multiplication by the basis elements\302\240:math:`e_i`, in the\n          given basis.\n          Assumes that :math:`e_1 = 1`, that the multiplication table is integral, and that\n          :math:`(\\bigoplus_{i = 1}^nK e_i,C)` describes a central simple algebra over :math:`K`.\n        \n        ::\n        \n            { mi = [0,-1,0, 0;\n             1, 0,0, 0;\n             0, 0,0,-1;\n             0, 0,1, 0];\n             mj = [0, 0,-1,0;\n             0, 0, 0,1;\n             1, 0, 0,0;\n             0,-1, 0,0];\n             mk = [0, 0, 0, 0;\n             0, 0,-1, 0;\n             0, 1, 0, 0;\n             1, 0, 0,-1];\n             A = alginit(nfinit(y), [matid(4), mi,mj,mk], 0); }\n        \n        represents (in a complicated way) the quaternion algebra :math:`(-1,-1)_\\mathbb{Q}`.\n        See below for a simpler solution.\n        \n        - (cyclic algebra) :math:`B` is an :literal:`rnf` structure attached to a cyclic\n          number field extension :math:`L/K` of degree :math:`d`, :math:`C` is a :literal:`t_VEC`\n          :literal:`[sigma,b]` with 2 components: :literal:`sigma` is a :literal:`t_POLMOD` representing\n          an automorphism generating :math:`Gal(L/K)`, :math:`b` is an element in :math:`K^*`. This\n          represents the cyclic algebra\302\240:math:`(L/K,\\sigma,b)`. Currently the element :math:`b` has\n          to be integral.\n        \n        ::\n        \n             ? Q = nfinit(y); T = p""olcyclo(5, 'x); F = rnfinit(Q, T);\n             ? A = alginit(F, [Mod(x^2,T), 3]);\n        \n        defines the cyclic algebra :math:`(L/\\mathbb{Q}, \\sigma, 3)`, where\n        :math:`L = \\mathbb{Q} (\\zeta_5)` and :math:`\\sigma:\\zeta:--->\\zeta^2` generates\n        :math:`Gal(L/\\mathbb{Q})`.\n        \n        - (quaternion algebra, special case of the above) :math:`B` is an :literal:`nf`\n          structure attached to a number field :math:`K`, :math:`C = [a,b]` is a vector\n          containing two elements of :math:`K^*` with :math:`a` not a square in :math:`K`, returns the quaternion algebra :math:`(a,b)_K`.\n          The variable :math:`v` (:literal:`'x` by default) must have higher priority than the\n          variable of :math:`K`:literal:`.pol` and is used to represent elements in the splitting\n          field :math:`L = K[x]/(x^2-a)`.\n        \n        ::\n        \n             ? Q = nfinit(y); A = alginit(Q, [-1,-1]); \\\\ (-1,-1)_Q\n        \n        - (algebra/:math:`K` defined by local Hasse invariants)\n          :math:`B` is an :literal:`nf` structure attached to a number field :math:`K`,\n          :math:`C = [d, [PR,h_f], h_i]` is a triple\n          containing an integer :math:`d > 1`, a pair :math:`[PR, h_f]` describing the\n          Hasse invariants at finite places, and :math:`h_i` the Hasse invariants\n          at archimedean (real) places. A local Hasse invariant belongs to :math:`(1/d)\\mathbb{Z}/\\mathbb{Z}\n          \\subset \\mathbb{Q}/\\mathbb{Z}`, and is given either as a :literal:`t_FRAC` (lift to :math:`(1/d)\\mathbb{Z}`),\n          a :literal:`t_INT` or :literal:`t_INTMOD` modulo :math:`d` (lift to :math:`\\mathbb{Z}/d\\mathbb{Z}`); a whole vector\n          of local invariants can also be given as a :literal:`t_VECSMALL`, whose\n          entries are handled as :literal:`t_INT`\302\240s. :literal:`PR` is a list of prime ideals\n          (:literal:`prid` structures), and :math:`h_f` is a vector of the same length ""giving the\n          local invariants at those maximal ideals. The invariants at infinite real\n          places are indexed by the real roots :math:`K`:literal:`.roots`: if the Archimedean\n          place :math:`v` is attached to the :math:`j`-th root, the value of\n          :math:`h_v` is given by :math:`h_i[j]`, must be :math:`0` or :math:`1/2` (or\302\240:math:`d/2` modulo\302\240:math:`d`), and\n          can be nonzero only if\302\240:math:`d` is even.\n        \n        By class field theory, provided the local invariants :math:`h_v` sum to :math:`0`, up\n        to Brauer equivalence, there is a unique central simple algebra over :math:`K`\n        with given local invariants and trivial invariant elsewhere. In particular,\n        up to isomorphism, there is a unique such algebra :math:`A` of degree :math:`d`.\n        \n        We realize :math:`A` as a cyclic algebra through class field theory. The variable :math:`v`\n        (:literal:`'x` by default) must have higher priority than the variable of\n        :math:`K`:literal:`.pol` and is used to represent elements in the (cyclic) splitting\n        field extension :math:`L/K` for :math:`A`.\n        \n        ::\n        \n             ? nf = nfinit(y^2+1);\n             ? PR = idealprimedec(nf,5); #PR\n             %2 = 2\n             ? hi = [];\n             ? hf = [PR, [1/3,-1/3]];\n             ? A = alginit(nf, [3,hf,hi]);\n             ? algsplittingfield(A).pol\n             %6 = x^3 - 21*x + 7\n        \n        - (matrix algebra, toy example) :math:`B` is an :literal:`nf` structure attached\n          to a number field :math:`K`, :math:`C = d` is a positive integer. Returns a cyclic\n          algebra isomorphic to the matrix algebra :math:`M_d(K)`.\n        \n        In all cases, this function computes a maximal order for the algebra by default,\n        which may require a lot of time. Setting :math:`maxord = 0` prevents this computation.\n        \n        The pari object representing su""ch an algebra :math:`A` is a :literal:`t_VEC` with the\n        following data:\n        \n        - A splitting field :math:`L` of :math:`A` of the same degree over :math:`K` as :math:`A`, in\n          :literal:`rnfinit` format, accessed with :literal:`algsplittingfield`.\n        \n        - The Hasse invariants at the real places of :math:`K`, accessed with\n          :literal:`alghassei`.\n        \n        - The Hasse invariants of :math:`A` at the finite primes of :math:`K` that ramify in\n          the natural order of :math:`A`, accessed with :literal:`alghassef`.\n        \n        - A basis of an order :math:`O_0` expressed on the basis of the natural\n          order, accessed with :literal:`algbasis`.\n        \n        - A basis of the natural order expressed on the basis of :math:`O_0`,\n          accessed with :literal:`alginvbasis`.\n        \n        - The left multiplication table of :math:`O_0` on the previous basis,\n          accessed with :literal:`algmultable`.\n        \n        - The characteristic of :math:`A` (always :math:`0`), accessed with :literal:`algchar`.\n        \n        - The absolute traces of the elements of the basis of :math:`O_0`.\n        \n        - If :math:`A` was constructed as a cyclic algebra\302\240:math:`(L/K,\\sigma,b)` of degree\n          :math:`d`, a :literal:`t_VEC` :math:`[\\sigma,\\sigma^2,...,\\sigma^{d-1}]`. The function\n          :literal:`algaut` returns :math:`\\sigma`.\n        \n        - If :math:`A` was constructed as a cyclic algebra\302\240:math:`(L/K,\\sigma,b)`, the\n          element :math:`b`, accessed with :literal:`algb`.\n        \n        - If :math:`A` was constructed with its multiplication table :math:`mt` over :math:`K`,\n          the :literal:`t_VEC` of :literal:`t_MAT` :math:`mt`, accessed with :literal:`algrelmultable`.\n        \n        - If :math:`A` was constructed with its multiplication table :math:`mt` over :math:`K`,\n          a :literal:`t_VEC` with three components: a "":literal:`t_COL` representing an element of :math:`A`\n          generating the splitting field :math:`L` as a maximal subfield of :math:`A`, a :literal:`t_MAT`\n          representing an :math:`L`-basis :math:`B` of :math:`A` expressed on the :math:`\\mathbb{Z}`-basis of\n          :math:`O_0`, and a :literal:`t_MAT` representing the :math:`\\mathbb{Z}`-basis of :math:`O_0`\n          expressed on :math:`B`. This data is accessed with :literal:`algsplittingdata`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_83alginit(PyObject *__pyx_v_B, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_maxord;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alginit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_C,&__pyx_n_s_v,&__pyx_n_s_maxord,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_C)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxord);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alginit") < 0)) __PYX_ERR(10, 1165, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_C = values[0];
    __pyx_v_v = values[1];
    if (values[2]) {
      __pyx_v_maxord = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_maxord == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 1165, __pyx_L3_error)
    } else {
      __pyx_v_maxord = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alginit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1165, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alginit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_82alginit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_B), __pyx_v_C, __pyx_v_v, __pyx_v_maxord);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_82alginit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_v, long __pyx_v_maxord) {
  long __pyx_v__v;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("alginit", 0);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_gen.pxi":1312
 *           expressed on :math:`B`. This data is accessed with :literal:`algsplittingdata`.
 *         '''
 *         C = objtogen(C)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1313
 *         '''
 *         C = objtogen(C)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":1314
 *         C = objtogen(C)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":1315
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 1315, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1314
 *         C = objtogen(C)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1316
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _C = (<Gen>C).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 1316, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1317
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = (<Gen>C).g
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_6;

  /* "cypari/auto_gen.pxi":1318
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
  __pyx_v__C = __pyx_t_6;

  /* "cypari/auto_gen.pxi":1319
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _C = (<Gen>C).g
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alginit(__pyx_v__B, __pyx_v__C, __pyx_v__v, __pyx_v_maxord);

  /* "cypari/auto_gen.pxi":1320
 *         cdef GEN _C = (<Gen>C).g
 *         cdef GEN _ret = alginit(_B, _C, _v, maxord)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alginv(al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1165
 *         return _ret
 * 
 *     def alginit(B, C, v=None, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the central simple algebra defined by data :math:`B`, :math:`C` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alginit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1322
 *         return new_gen(_ret)
 * 
 *     def alginv(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its inverse :math:`x^{-1}` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_85alginv(PyObject *__pyx_v_al, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_84alginv[] = "\n        Given an element :math:`x` in :emphasis:`al`, computes its inverse :math:`x^{-1}` in the\n        algebra :emphasis:`al`. Assumes that :math:`x` is invertible.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? alginv(A,[1,1,0,0]~)\n            %2 = [1/2, 1/2, 0, 0]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_85alginv(PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alginv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_84alginv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_84alginv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alginv", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":1335
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1335, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1336
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1336, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1337
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = alginv(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1338
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alginv(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1339
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = alginv(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alginv(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_gen.pxi":1340
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = alginv(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alginvbasis(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1322
 *         return new_gen(_ret)
 * 
 *     def alginv(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its inverse :math:`x^{-1}` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alginv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1342
 *         return new_gen(_ret)
 * 
 *     def alginvbasis(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_87alginvbasis(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_86alginvbasis[] = "\n        Given an central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        a :math:`\\mathbb{Z}`-basis of the natural order in :emphasis:`al` with respect to the\n        order\302\240:math:`O_0` stored in :emphasis:`al`.\n        \n        ::\n        \n            A = alginit(nfinit(y), [-1,-1]);\n            ? alginvbasis(A)\n            %2 =\n            [1 0 0 -1]\n            \n            [0 1 0 -1]\n            \n            [0 0 1 -1]\n            \n            [0 0 0 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_87alginvbasis(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alginvbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_86alginvbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_86alginvbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("alginvbasis", 0);

  /* "cypari/auto_gen.pxi":1361
 *             [0 0 0 2]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alginvbasis(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1361, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1362
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alginvbasis(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1363
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alginvbasis(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alginvbasis(__pyx_v__al);

  /* "cypari/auto_gen.pxi":1364
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = alginvbasis(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algisassociative(mt, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1342
 *         return new_gen(_ret)
 * 
 *     def alginvbasis(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alginvbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1366
 *         return new_gen(_ret)
 * 
 *     def algisassociative(mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if the multiplication table :literal:`mt` is suitable for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_89algisassociative(PyObject *__pyx_v_mt, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_88algisassociative[] = "\n        Returns 1 if the multiplication table :literal:`mt` is suitable for\n        :literal:`algtableinit(mt,p)`, 0 otherwise. More precisely, :literal:`mt` should be\n        a :literal:`t_VEC` of :math:`n` matrices in :math:`M_n(K)`, giving the left multiplications\n        by the basis elements :math:`e_1,..., e_n` (structure constants).\n        We check whether the first basis element :math:`e_1` is :math:`1` and :math:`e_i(e_je_k) =\n        (e_ie_j)e_k` for all :math:`i,j,k`.\n        \n        ::\n        \n             ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n             ? algisassociative(mt)\n             %2 = 1\n        \n        May be used to check a posteriori an algebra: we also allow :literal:`mt` as\n        output by :literal:`algtableinit` (:math:`p` is ignored in this case).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_89algisassociative(PyObject *__pyx_v_mt, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algisassociative (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algisassociative") < 0)) __PYX_ERR(10, 1366, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algisassociative", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1366, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algisassociative", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_88algisassociative(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mt), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_88algisassociative(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mt, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__mt;
  GEN __pyx_v__p;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algisassociative", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":1384
 *         output by :literal:`algtableinit` (:math:`p` is ignored in this case).
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":1385
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1386
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1386, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":1385
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1387
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 1387, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1388
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = gen_0
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mt)->__pyx_base.g;
  __pyx_v__mt = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1389
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = gen_0;

  /* "cypari/auto_gen.pxi":1390
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1391
 *         cdef GEN _p = gen_0
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algisassociative(_mt, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1390
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = gen_0
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)
 */
  }

  /* "cypari/auto_gen.pxi":1392
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algisassociative(__pyx_v__mt, __pyx_v__p);

  /* "cypari/auto_gen.pxi":1393
 *             _p = (<Gen>p).g
 *         cdef int _ret = algisassociative(_mt, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1394
 *         cdef int _ret = algisassociative(_mt, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algiscommutative(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1366
 *         return new_gen(_ret)
 * 
 *     def algisassociative(mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if the multiplication table :literal:`mt` is suitable for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algisassociative", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1396
 *         return _ret
 * 
 *     def algiscommutative(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_91algiscommutative(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_90algiscommutative[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central\n        simple algebra output by :literal:`alginit`, tests whether the algebra :emphasis:`al` is\n        commutative.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algiscommutative(A)\n            %3 = 0\n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? algiscommutative(A)\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_91algiscommutative(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algiscommutative (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_90algiscommutative(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_90algiscommutative(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algiscommutative", 0);

  /* "cypari/auto_gen.pxi":1413
 *             %6 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algiscommutative(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1413, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1414
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algiscommutative(_al)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1415
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algiscommutative(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algiscommutative(__pyx_v__al);

  /* "cypari/auto_gen.pxi":1416
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algiscommutative(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1417
 *         cdef int _ret = algiscommutative(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algisdivision(al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1396
 *         return _ret
 * 
 *     def algiscommutative(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algiscommutative", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1419
 *         return _ret
 * 
 *     def algisdivision(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_93algisdivision(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_92algisdivision[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests\n        whether :emphasis:`al` is a division algebra. If :emphasis:`pl` is set, it should be a\n        prime ideal of\302\240:math:`K` or an integer between\302\240:math:`1` and\302\240:math:`r_1+r_2`, and in that case\n        tests whether :emphasis:`al` is locally a division algebra at the place :emphasis:`pl`\n        instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algisdivision(A, 1)\n            %3 = 1\n            ? algisdivision(A, 2)\n            %4 = 0\n            ? algisdivision(A, idealprimedec(nf,2)[1])\n            %5 = 1\n            ? algisdivision(A, idealprimedec(nf,5)[1])\n            %6 = 0\n            ? algisdivision(A)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_93algisdivision(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algisdivision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pl,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algisdivision") < 0)) __PYX_ERR(10, 1419, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algisdivision", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1419, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algisdivision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_92algisdivision(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_pl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_92algisdivision(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algisdivision", 0);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":1442
 *             %7 = 1
 *         '''
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_1 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_1;

  /* "cypari/auto_gen.pxi":1443
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1444
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1444, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":1443
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1445
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 1445, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1446
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1447
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_gen.pxi":1448
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1449
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algisdivision(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1448
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)
 */
  }

  /* "cypari/auto_gen.pxi":1450
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algisdivision(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_gen.pxi":1451
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisdivision(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1452
 *         cdef int _ret = algisdivision(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algisramified(al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1419
 *         return _ret
 * 
 *     def algisdivision(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algisdivision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1454
 *         return _ret
 * 
 *     def algisramified(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_95algisramified(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_94algisramified[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests\n        whether :emphasis:`al` is ramified, i.e. not isomorphic to a matrix algebra over its\n        center. If :emphasis:`pl` is set, it should be a prime ideal of\302\240:math:`K` or an integer\n        between\302\240:math:`1` and\302\240:math:`r_1+r_2`, and in that case tests whether :emphasis:`al` is locally\n        ramified at the place :emphasis:`pl` instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algisramified(A, 1)\n            %3 = 1\n            ? algisramified(A, 2)\n            %4 = 0\n            ? algisramified(A, idealprimedec(nf,2)[1])\n            %5 = 1\n            ? algisramified(A, idealprimedec(nf,5)[1])\n            %6 = 0\n            ? algisramified(A)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_95algisramified(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algisramified (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pl,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algisramified") < 0)) __PYX_ERR(10, 1454, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algisramified", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1454, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algisramified", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_94algisramified(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_pl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_94algisramified(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algisramified", 0);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":1477
 *             %7 = 1
 *         '''
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_1 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_1;

  /* "cypari/auto_gen.pxi":1478
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1479
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1479, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":1478
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1480
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 1480, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1481
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1482
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_gen.pxi":1483
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1484
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algisramified(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1483
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)
 */
  }

  /* "cypari/auto_gen.pxi":1485
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algisramified(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_gen.pxi":1486
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algisramified(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1487
 *         cdef int _ret = algisramified(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algissemisimple(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1454
 *         return _ret
 * 
 *     def algisramified(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algisramified", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1489
 *         return _ret
 * 
 *     def algissemisimple(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_97algissemisimple(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_96algissemisimple[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central\n        simple algebra output by :literal:`alginit`, tests whether the algebra :emphasis:`al` is\n        semisimple.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algissemisimple(A)\n            %3 = 0\n            ? m_i=[0,-1,0,0;1,0,0,0;0,0,0,-1;0,0,1,0]; \\\\ quaternion algebra (-1,-1)\n            ? m_j=[0,0,-1,0;0,0,0,1;1,0,0,0;0,-1,0,0];\n            ? m_k=[0,0,0,-1;0,0,-1,0;0,1,0,0;1,0,0,0];\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = algtableinit(mt);\n            ? algissemisimple(A)\n            %9 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_97algissemisimple(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algissemisimple (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_96algissemisimple(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_96algissemisimple(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algissemisimple", 0);

  /* "cypari/auto_gen.pxi":1509
 *             %9 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissemisimple(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1509, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1510
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algissemisimple(_al)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1511
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissemisimple(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algissemisimple(__pyx_v__al);

  /* "cypari/auto_gen.pxi":1512
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissemisimple(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1513
 *         cdef int _ret = algissemisimple(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algissimple(al, long ss=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1489
 *         return _ret
 * 
 *     def algissemisimple(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algissemisimple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1515
 *         return _ret
 * 
 *     def algissimple(al, long ss=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_99algissimple(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_98algissimple[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central\n        simple algebra output by :literal:`alginit`, tests whether the algebra :emphasis:`al` is\n        simple. If :math:`ss = 1`, assumes that the algebra\302\240:emphasis:`al` is semisimple\n        without testing it.\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt); \\\\ matrices [*,*; 0,*]\n            ? algissimple(A)\n            %3 = 0\n            ? algissimple(A,1) \\\\ incorrectly assume that A is semisimple\n            %4 = 1\n            ? m_i=[0,-1,0,0;1,0,0,0;0,0,0,-1;0,0,1,0];\n            ? m_j=[0,0,-1,0;0,0,0,1;1,0,0,0;0,-1,0,0];\n            ? m_k=[0,0,0,-1;0,0,b,0;0,1,0,0;1,0,0,0];\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = algtableinit(mt); \\\\ quaternion algebra (-1,-1)\n            ? algissimple(A)\n            %10 = 1\n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2); \\\\ direct product F_4 x F_2\n            ? algissimple(A)\n            %13 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_99algissimple(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_ss;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algissimple (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ss,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ss);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algissimple") < 0)) __PYX_ERR(10, 1515, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_ss = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_ss == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 1515, __pyx_L3_error)
    } else {
      __pyx_v_ss = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algissimple", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1515, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algissimple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_98algissimple(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_ss);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_98algissimple(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, long __pyx_v_ss) {
  GEN __pyx_v__al;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algissimple", 0);

  /* "cypari/auto_gen.pxi":1542
 *             %13 = 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissimple(_al, ss)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1542, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1543
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algissimple(_al, ss)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1544
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissimple(_al, ss)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algissimple(__pyx_v__al, __pyx_v_ss);

  /* "cypari/auto_gen.pxi":1545
 *         cdef GEN _al = (<Gen>al).g
 *         cdef int _ret = algissimple(_al, ss)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1546
 *         cdef int _ret = algissimple(_al, ss)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def algissplit(al, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1515
 *         return _ret
 * 
 *     def algissimple(al, long ss=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` or a central
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algissimple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1548
 *         return _ret
 * 
 *     def algissplit(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_101algissplit(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_100algissplit[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests\n        whether\302\240:emphasis:`al` is split, i.e. isomorphic to a matrix algebra over its center.\n        If :emphasis:`pl` is set, it should be a prime ideal of\302\240:math:`K` or an integer between\302\240:math:`1`\n        and\302\240:math:`r_1+r_2`, and in that case tests whether :emphasis:`al` is locally split at the\n        place :emphasis:`pl` instead.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algissplit(A, 1)\n            %3 = 0\n            ? algissplit(A, 2)\n            %4 = 1\n            ? algissplit(A, idealprimedec(nf,2)[1])\n            %5 = 0\n            ? algissplit(A, idealprimedec(nf,5)[1])\n            %6 = 1\n            ? algissplit(A)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_101algissplit(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algissplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pl,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algissplit") < 0)) __PYX_ERR(10, 1548, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algissplit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1548, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algissplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_100algissplit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_pl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_100algissplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__al;
  GEN __pyx_v__pl;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algissplit", 0);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":1571
 *             %7 = 0
 *         '''
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_1 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_1;

  /* "cypari/auto_gen.pxi":1572
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1573
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":1572
 *         '''
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1574
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 1574, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1575
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1576
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_gen.pxi":1577
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)
 */
  __pyx_t_1 = (__pyx_v__have_pl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":1578
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = algissplit(_al, _pl)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1577
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)
 */
  }

  /* "cypari/auto_gen.pxi":1579
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algissplit(__pyx_v__al, __pyx_v__pl);

  /* "cypari/auto_gen.pxi":1580
 *             _pl = (<Gen>pl).g
 *         cdef int _ret = algissplit(_al, _pl)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":1581
 *         cdef int _ret = algissplit(_al, _pl)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def alglatelement(al, lat, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 1581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1548
 *         return _ret
 * 
 *     def algissplit(al, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, tests
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algissplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1583
 *         return _ret
 * 
 *     def alglatelement(al, lat, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al`, a lattice :emphasis:`lat` and a:literal:`t_COL`:emphasis:`c`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_103alglatelement(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_102alglatelement[] = "\n        Given an algebra :emphasis:`al`, a lattice :emphasis:`lat` and a\302\240:literal:`t_COL`\302\240:emphasis:`c`,\n        returns the element of\302\240:emphasis:`al` whose coordinates on the \\mathbb{Z}-basis of\302\240:emphasis:`lat`\n        are given by\302\240:emphasis:`c`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? a1 = [1,-1,0,1,2,0,1,2]~;\n            ? lat1 = alglathnf(al,a1);\n            ? c = [1..8]~;\n            ? elt = alglatelement(al,lat1,c);\n            ? alglatcontains(al,lat1,elt,&c2)\n            %6 = 1\n            ? c==c2\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_103alglatelement(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lat = 0;
  PyObject *__pyx_v_c = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatelement (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat,&__pyx_n_s_c,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_lat)) != 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_c)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatelement", 1, 2, 2, 1); __PYX_ERR(10, 1583, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatelement") < 0)) __PYX_ERR(10, 1583, __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_lat = values[0];
    __pyx_v_c = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatelement", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1583, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_102alglatelement(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_lat, __pyx_v_c);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_102alglatelement(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat, PyObject *__pyx_v_c) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat;
  GEN __pyx_v__c;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatelement", 0);
  __Pyx_INCREF(__pyx_v_lat);
  __Pyx_INCREF(__pyx_v_c);

  /* "cypari/auto_gen.pxi":1601
 *             %7 = 1
 *         '''
 *         lat = objtogen(lat)             # <<<<<<<<<<<<<<
 *         c = objtogen(c)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1602
 *         '''
 *         lat = objtogen(lat)
 *         c = objtogen(c)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1603
 *         lat = objtogen(lat)
 *         c = objtogen(c)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat = (<Gen>lat).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1603, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1604
 *         c = objtogen(c)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat = (<Gen>lat).g
 *         cdef GEN _c = (<Gen>c).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1605
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat = (<Gen>lat).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat)->__pyx_base.g;
  __pyx_v__lat = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1606
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat = (<Gen>lat).g
 *         cdef GEN _c = (<Gen>c).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c)->__pyx_base.g;
  __pyx_v__c = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1607
 *         cdef GEN _lat = (<Gen>lat).g
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatelement(__pyx_v__al, __pyx_v__lat, __pyx_v__c);

  /* "cypari/auto_gen.pxi":1608
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = alglatelement(_al, _lat, _c)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglathnf(al, m, d=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1583
 *         return _ret
 * 
 *     def alglatelement(al, lat, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al`, a lattice :emphasis:`lat` and a:literal:`t_COL`:emphasis:`c`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatelement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lat);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1610
 *         return new_gen(_ret)
 * 
 *     def alglathnf(al, m, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and a matrix :emphasis:`m` with columns representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_105alglathnf(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_104alglathnf[] = "\n        Given an algebra :emphasis:`al` and a matrix :emphasis:`m` with columns representing\n        elements of :emphasis:`al`, returns the lattice :math:`L` generated by the columns of\n        :emphasis:`m`. If provided, :emphasis:`d` must be a rational number such that :math:`L` contains\n        :emphasis:`d` times the natural basis of\302\240:emphasis:`al`. The argument :emphasis:`m` is also\n        allowed to be a :literal:`t_VEC` of :literal:`t_MAT`, in which case :emphasis:`m` is replaced by\n        the concatenation of the matrices, or a :literal:`t_COL`, in which case :emphasis:`m` is\n        replaced by its left multiplication table as an element of :emphasis:`al`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? a = [1,1,-1/2,1,1/3,-1,1,1]~;\n            ? mt = algtomatrix(al,a,1);\n            ? lat = alglathnf(al,mt);\n            ? lat[2]\n            %5 = 1/6\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_105alglathnf(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglathnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_d,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_m)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglathnf") < 0)) __PYX_ERR(10, 1610, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_m = values[0];
    __pyx_v_d = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglathnf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1610, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_104alglathnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_m, __pyx_v_d);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_104alglathnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_m, PyObject *__pyx_v_d) {
  int __pyx_v__have_d;
  GEN __pyx_v__al;
  GEN __pyx_v__m;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("alglathnf", 0);
  __Pyx_INCREF(__pyx_v_m);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":1629
 *             %5 = 1/6
 *         '''
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1630
 *         '''
 *         m = objtogen(m)
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_2 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1631
 *         m = objtogen(m)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":1632
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1632, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":1631
 *         m = objtogen(m)
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":1633
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 1633, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1634
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1635
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = gen_0
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_4;

  /* "cypari/auto_gen.pxi":1636
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = gen_0;

  /* "cypari/auto_gen.pxi":1637
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 */
  __pyx_t_2 = (__pyx_v__have_d != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":1638
 *         cdef GEN _d = gen_0
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_gen.pxi":1637
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _d = gen_0
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 */
  }

  /* "cypari/auto_gen.pxi":1639
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglathnf(__pyx_v__al, __pyx_v__m, __pyx_v__d);

  /* "cypari/auto_gen.pxi":1640
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = alglathnf(_al, _m, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatindex(al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1640, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1610
 *         return new_gen(_ret)
 * 
 *     def alglathnf(al, m, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and a matrix :emphasis:`m` with columns representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1642
 *         return new_gen(_ret)
 * 
 *     def alglatindex(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra:emphasis:`al` and two lattices:emphasis:`lat1` and:emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_107alglatindex(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_106alglatindex[] = "\n        Given an algebra\302\240:emphasis:`al` and two lattices\302\240:emphasis:`lat1` and\302\240:emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the generalized index of\302\240:emphasis:`lat1` relative\n        to\302\240:emphasis:`lat2`, i.e.\302\240:math:`\\|lat2/lat1\\cap lat2\\|/\\|lat1/lat1\\cap lat2\\|`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? lat1 = alglathnf(al,[1,1,0,0,0,0,0,0]~);\n            ? lat2 = alglathnf(al,[1,0,1,0,0,0,0,0]~);\n            ? alglatindex(al,lat1,lat2)\n            %4 = 1\n            ? lat1==lat2\n            %5 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_107alglatindex(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatindex (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat1,&__pyx_n_s_lat2,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_lat1)) != 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_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatindex", 1, 2, 2, 1); __PYX_ERR(10, 1642, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatindex") < 0)) __PYX_ERR(10, 1642, __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_lat1 = values[0];
    __pyx_v_lat2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatindex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1642, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_106alglatindex(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_lat1, __pyx_v_lat2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_106alglatindex(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatindex", 0);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_gen.pxi":1658
 *             %5 = 0
 *         '''
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1659
 *         '''
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1660
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1660, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1661
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1662
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1663
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1664
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatindex(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_gen.pxi":1665
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatindex(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatlefttransporter(al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1642
 *         return new_gen(_ret)
 * 
 *     def alglatindex(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra:emphasis:`al` and two lattices:emphasis:`lat1` and:emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatindex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1667
 *         return new_gen(_ret)
 * 
 *     def alglatlefttransporter(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_109alglatlefttransporter(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_108alglatlefttransporter[] = "\n        Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the left transporter from :emphasis:`lat1` to\302\240:emphasis:`lat2`, i.e.\n        the set of\302\240:math:`x\\in al` such that\302\240:math:`x.lat1 \\subset lat2`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? lat1 = alglathnf(al,[1,-1,0,1,2,0,5,2]~);\n            ? lat2 = alglathnf(al,[0,1,-2,-1,0,0,3,1]~);\n            ? tr = alglatlefttransporter(al,lat1,lat2);\n            ? a = alglatelement(al,tr,[0,0,0,0,0,0,1,0]~);\n            ? alglatsubset(al,alglatmul(al,a,lat1),lat2)\n            %6 = 1\n            ? alglatsubset(al,alglatmul(al,lat1,a),lat2)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_109alglatlefttransporter(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatlefttransporter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat1,&__pyx_n_s_lat2,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_lat1)) != 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_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatlefttransporter", 1, 2, 2, 1); __PYX_ERR(10, 1667, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatlefttransporter") < 0)) __PYX_ERR(10, 1667, __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_lat1 = values[0];
    __pyx_v_lat2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatlefttransporter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1667, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatlefttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_108alglatlefttransporter(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_lat1, __pyx_v_lat2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_108alglatlefttransporter(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatlefttransporter", 0);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_gen.pxi":1685
 *             %7 = 0
 *         '''
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1686
 *         '''
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1687
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1687, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1688
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1689
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1690
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1691
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatlefttransporter(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_gen.pxi":1692
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatlefttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatmul(al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1667
 *         return new_gen(_ret)
 * 
 *     def alglatlefttransporter(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatlefttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1694
 *         return new_gen(_ret)
 * 
 *     def alglatmul(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_111alglatmul(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_110alglatmul[] = "\n        Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the lattice generated by the products of elements\n        of\302\240:emphasis:`lat1` and\302\240:emphasis:`lat2`.\n        One of :emphasis:`lat1` and :emphasis:`lat2` is also allowed to be an element of\302\240:emphasis:`al`;\n        in this case, computes the product of the element and the lattice.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? a1 = [1,-1,0,1,2,0,1,2]~;\n            ? a2 = [0,1,2,-1,0,0,3,1]~;\n            ? lat1 = alglathnf(al,a1);\n            ? lat2 = alglathnf(al,a2);\n            ? lat3 = alglatmul(al,lat1,lat2);\n            ? matdet(lat3[1])\n            %7 = 29584\n            ? lat3 == alglathnf(al, algmul(al,a1,a2))\n            %8 = 0\n            ? lat3 == alglatmul(al, lat1, a2)\n            %9 = 0\n            ? lat3 == alglatmul(al, a1, lat2)\n            %10 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_111alglatmul(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat1,&__pyx_n_s_lat2,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_lat1)) != 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_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatmul", 1, 2, 2, 1); __PYX_ERR(10, 1694, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatmul") < 0)) __PYX_ERR(10, 1694, __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_lat1 = values[0];
    __pyx_v_lat2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1694, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_110alglatmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_lat1, __pyx_v_lat2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_110alglatmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatmul", 0);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_gen.pxi":1719
 *             %10 = 0
 *         '''
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1720
 *         '''
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1721
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1721, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1722
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1723
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1724
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1725
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatmul(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_gen.pxi":1726
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatmul(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def alglatrighttransporter(al, lat1, lat2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1694
 *         return new_gen(_ret)
 * 
 *     def alglatmul(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1728
 *         return new_gen(_ret)
 * 
 *     def alglatrighttransporter(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_113alglatrighttransporter(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_112alglatrighttransporter[] = "\n        Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`\n        in\302\240:emphasis:`al`, computes the right transporter from :emphasis:`lat1` to\302\240:emphasis:`lat2`, i.e.\n        the set of\302\240:math:`x\\in al` such that\302\240:math:`lat1.x \\subset lat2`.\n        \n        ::\n        \n            ? al = alginit(nfinit(y^2+7), [-1,-1]);\n            ? lat1 = alglathnf(al,matdiagonal([1,3,7,1,2,8,5,2]));\n            ? lat2 = alglathnf(al,matdiagonal([5,3,8,1,9,8,7,1]));\n            ? tr = alglatrighttransporter(al,lat1,lat2);\n            ? a = alglatelement(al,tr,[0,0,0,0,0,0,0,1]~);\n            ? alglatsubset(al,alglatmul(al,lat1,a),lat2)\n            %6 = 1\n            ? alglatsubset(al,alglatmul(al,a,lat1),lat2)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_113alglatrighttransporter(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lat1 = 0;
  PyObject *__pyx_v_lat2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("alglatrighttransporter (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lat1,&__pyx_n_s_lat2,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_lat1)) != 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_lat2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("alglatrighttransporter", 1, 2, 2, 1); __PYX_ERR(10, 1728, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "alglatrighttransporter") < 0)) __PYX_ERR(10, 1728, __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_lat1 = values[0];
    __pyx_v_lat2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("alglatrighttransporter", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1728, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatrighttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_112alglatrighttransporter(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_lat1, __pyx_v_lat2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_112alglatrighttransporter(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_lat1, PyObject *__pyx_v_lat2) {
  GEN __pyx_v__al;
  GEN __pyx_v__lat1;
  GEN __pyx_v__lat2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("alglatrighttransporter", 0);
  __Pyx_INCREF(__pyx_v_lat1);
  __Pyx_INCREF(__pyx_v_lat2);

  /* "cypari/auto_gen.pxi":1746
 *             %7 = 0
 *         '''
 *         lat1 = objtogen(lat1)             # <<<<<<<<<<<<<<
 *         lat2 = objtogen(lat2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1747
 *         '''
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lat2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lat2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1748
 *         lat1 = objtogen(lat1)
 *         lat2 = objtogen(lat2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1748, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1749
 *         lat2 = objtogen(lat2)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1750
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat1)->__pyx_base.g;
  __pyx_v__lat1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1751
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lat2)->__pyx_base.g;
  __pyx_v__lat2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1752
 *         cdef GEN _lat1 = (<Gen>lat1).g
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alglatrighttransporter(__pyx_v__al, __pyx_v__lat1, __pyx_v__lat2);

  /* "cypari/auto_gen.pxi":1753
 *         cdef GEN _lat2 = (<Gen>lat2).g
 *         cdef GEN _ret = alglatrighttransporter(_al, _lat1, _lat2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algmakeintegral(mt, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1728
 *         return new_gen(_ret)
 * 
 *     def alglatrighttransporter(al, lat1, lat2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and two lattices :emphasis:`lat1` and :emphasis:`lat2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.alglatrighttransporter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lat1);
  __Pyx_XDECREF(__pyx_v_lat2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1755
 *         return new_gen(_ret)
 * 
 *     def algmakeintegral(mt, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`mt` being a multiplication table over :math:`\mathbb{Q}` in the same format as the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_115algmakeintegral(PyObject *__pyx_v_mt, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_114algmakeintegral[] = "\n        :emphasis:`mt` being a multiplication table over :math:`\\mathbb{Q}` in the same format as the\n        input of :literal:`algtableinit`, computes an integral multiplication table for an\n        isomorphic algebra. When :math:`maps = 1`, returns a :literal:`t_VEC`\n        :math:`[mt2,S,T]` where :emphasis:`S` and :emphasis:`T` are matrices\n        respectively representing the map from the algebra defined by :emphasis:`mt` to the\n        one defined by :emphasis:`mt2` and its inverse.\n        \n        ::\n        \n            ? mt = [matid(2),[0,-1/4;1,0]];\n            ? algtableinit(mt);\n             *** at top-level: algtableinit(mt)\n             *** ^----------------\n             *** algtableinit: domain error in algtableinit: denominator(mt) != 1\n            ? mt2 = algmakeintegral(mt);\n            ? al = algtableinit(mt2);\n            ? algisassociative(al)\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_115algmakeintegral(PyObject *__pyx_v_mt, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algmakeintegral (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maps,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algmakeintegral") < 0)) __PYX_ERR(10, 1755, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 1755, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algmakeintegral", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1755, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algmakeintegral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_114algmakeintegral(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mt), __pyx_v_maps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_114algmakeintegral(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mt, long __pyx_v_maps) {
  GEN __pyx_v__mt;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algmakeintegral", 0);

  /* "cypari/auto_gen.pxi":1776
 *             %4 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _ret = algmakeintegral(_mt, maps)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1776, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1777
 *         '''
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algmakeintegral(_mt, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mt)->__pyx_base.g;
  __pyx_v__mt = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1778
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _ret = algmakeintegral(_mt, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algmakeintegral(__pyx_v__mt, __pyx_v_maps);

  /* "cypari/auto_gen.pxi":1779
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _ret = algmakeintegral(_mt, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algmul(al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1755
 *         return new_gen(_ret)
 * 
 *     def algmakeintegral(mt, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`mt` being a multiplication table over :math:`\mathbb{Q}` in the same format as the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algmakeintegral", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1781
 *         return new_gen(_ret)
 * 
 *     def algmul(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their product :math:`xy`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_117algmul(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_116algmul[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their product :math:`xy`\n        in the algebra\302\240:emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algmul(A,[1,1,0,0]~,[0,0,2,1]~)\n            %2 = [2, 3, 5, -4]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_117algmul(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algmul", 1, 2, 2, 1); __PYX_ERR(10, 1781, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algmul") < 0)) __PYX_ERR(10, 1781, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1781, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_116algmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_116algmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algmul", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":1794
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1795
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1796
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1796, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1797
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1798
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algmul(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1799
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algmul(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1800
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algmul(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algmul(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":1801
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algmul(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algmultable(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1781
 *         return new_gen(_ret)
 * 
 *     def algmul(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their product :math:`xy`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1803
 *         return new_gen(_ret)
 * 
 *     def algmultable(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a multiplication table of :emphasis:`al` over its
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_119algmultable(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_118algmultable[] = "\n        Returns a multiplication table of :emphasis:`al` over its\n        prime subfield (:math:`\\mathbb{Q}` or :math:`\\mathbb{F}_p`), as a :literal:`t_VEC` of :literal:`t_MAT`: the left\n        multiplication tables of basis elements. If :emphasis:`al` was output by\n        :literal:`algtableinit`, returns the multiplication table used to define :emphasis:`al`.\n        If :emphasis:`al` was output by :literal:`alginit`, returns the multiplication table of\n        the order\302\240:math:`O_0` stored in :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? M = algmultable(A);\n            ? #M\n            %3 = 4\n            ? M[1] \\\\ multiplication by e_1 = 1\n            %4 =\n            [1 0 0 0]\n            \n            [0 1 0 0]\n            \n            [0 0 1 0]\n            \n            [0 0 0 1]\n            \n            ? M[2]\n            %5 =\n            [0 -1 1 0]\n            \n            [1 0 1 1]\n            \n            [0 0 1 1]\n            \n            [0 0 -2 -1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_119algmultable(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algmultable (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_118algmultable(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_118algmultable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algmultable", 0);

  /* "cypari/auto_gen.pxi":1838
 *             [0 0 -2 -1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algmultable(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1838, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1839
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algmultable(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1840
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algmultable(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algmultable(__pyx_v__al);

  /* "cypari/auto_gen.pxi":1841
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algmultable(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algneg(al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1803
 *         return new_gen(_ret)
 * 
 *     def algmultable(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a multiplication table of :emphasis:`al` over its
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algmultable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1843
 *         return new_gen(_ret)
 * 
 *     def algneg(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its opposite :math:`-x` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_121algneg(PyObject *__pyx_v_al, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_120algneg[] = "\n        Given an element :math:`x` in :emphasis:`al`, computes its opposite :math:`-x` in the\n        algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algneg(A,[1,1,0,0]~)\n            %2 = [-1, -1, 0, 0]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_121algneg(PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algneg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_120algneg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_120algneg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algneg", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":1856
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1856, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1857
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1857, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1858
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algneg(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1859
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algneg(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1860
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algneg(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algneg(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_gen.pxi":1861
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algneg(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algnorm(al, x, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1843
 *         return new_gen(_ret)
 * 
 *     def algneg(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its opposite :math:`-x` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1863
 *         return new_gen(_ret)
 * 
 *     def algnorm(al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its norm. If :emphasis:`al` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_123algnorm(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_122algnorm[] = "\n        Given an element :emphasis:`x` in :emphasis:`al`, computes its norm. If :emphasis:`al` is\n        a table algebra output by :literal:`algtableinit` or if :math:`abs = 1`, returns the\n        absolute norm of :emphasis:`x`, which is an element of :math:`\\mathbb{F}_p` of\302\240:math:`\\mathbb{Q}`; if :emphasis:`al` is\n        a central simple algebra output by :literal:`alginit` and :math:`abs = 0` (default), returns\n        the reduced norm of :emphasis:`x`, which is an element of the center of :emphasis:`al`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,19);\n            ? algnorm(A,[0,-2,3]~)\n            %3 = 18\n            ? nf = nfinit(y^2-5);\n            ? B = alginit(nf,[-1,y]);\n            ? b = [x,1]~;\n            ? n = algnorm(B,b)\n            %7 = Mod(-y + 1, y^2 - 5)\n            ? algnorm(B,b,1)\n            %8 = 16\n            ? nfeltnorm(nf,n)^algdegree(B)\n            %9 = 16\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_123algnorm(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_abs,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algnorm") < 0)) __PYX_ERR(10, 1863, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 1863, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algnorm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1863, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_122algnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_abs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_122algnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algnorm", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":1889
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1890
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1890, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1891
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algnorm(_al, _x, abs)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1892
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algnorm(_al, _x, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1893
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algnorm(_al, _x, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algnorm(__pyx_v__al, __pyx_v__x, __pyx_v_abs);

  /* "cypari/auto_gen.pxi":1894
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algnorm(_al, _x, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algpoleval(al, T, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1863
 *         return new_gen(_ret)
 * 
 *     def algnorm(al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its norm. If :emphasis:`al` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1896
 *         return new_gen(_ret)
 * 
 *     def algpoleval(al, T, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al` and a polynomial :math:`T` in :math:`K[X]`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_125algpoleval(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_124algpoleval[] = "\n        Given an element :math:`b` in :emphasis:`al` and a polynomial :math:`T` in :math:`K[X]`,\n        computes\302\240:math:`T(b)` in\302\240:emphasis:`al`. Also accepts as input a :literal:`t_VEC`\302\240:math:`[b,mb]`\n        where\302\240:math:`mb` is the left multiplication table of\302\240:math:`b`.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? al = alginit(nf,[y,-1]);\n            ? b = [1..8]~;\n            ? pol = algcharpoly(al,b,,1);\n            ? algpoleval(al,pol,b)==0\n            %5 = 1\n            ? mb = algtomatrix(al,b,1);\n            ? algpoleval(al,pol,[b,mb])==0\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_125algpoleval(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algpoleval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_b,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_T)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algpoleval", 1, 2, 2, 1); __PYX_ERR(10, 1896, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algpoleval") < 0)) __PYX_ERR(10, 1896, __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_T = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algpoleval", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1896, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algpoleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_124algpoleval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_T, __pyx_v_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_124algpoleval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_T, PyObject *__pyx_v_b) {
  GEN __pyx_v__al;
  GEN __pyx_v__T;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algpoleval", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":1914
 *             %7 = 1
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1915
 *         '''
 *         T = objtogen(T)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1916
 *         T = objtogen(T)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1916, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1917
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1918
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algpoleval(_al, _T, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1919
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algpoleval(_al, _T, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1920
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algpoleval(_al, _T, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algpoleval(__pyx_v__al, __pyx_v__T, __pyx_v__b);

  /* "cypari/auto_gen.pxi":1921
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algpoleval(_al, _T, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algpow(al, x, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1896
 *         return new_gen(_ret)
 * 
 *     def algpoleval(al, T, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`b` in :emphasis:`al` and a polynomial :math:`T` in :math:`K[X]`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algpoleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1923
 *         return new_gen(_ret)
 * 
 *     def algpow(al, x, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al` and an integer :math:`n`, computes the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_127algpow(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_126algpow[] = "\n        Given an element :math:`x` in :emphasis:`al` and an integer :math:`n`, computes the\n        power :math:`x^n` in the algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algpow(A,[1,1,0,0]~,7)\n            %2 = [8, -8, 0, 0]~\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_127algpow(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algpow", 1, 2, 2, 1); __PYX_ERR(10, 1923, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algpow") < 0)) __PYX_ERR(10, 1923, __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_x = values[0];
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algpow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1923, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_126algpow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_126algpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_n) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algpow", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_gen.pxi":1936
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1937
 *         '''
 *         x = objtogen(x)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1937, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1938
 *         x = objtogen(x)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1938, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1939
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1940
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = algpow(_al, _x, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1941
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algpow(_al, _x, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1942
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = algpow(_al, _x, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algpow(__pyx_v__al, __pyx_v__x, __pyx_v__n);

  /* "cypari/auto_gen.pxi":1943
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = algpow(_al, _x, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algprimesubalg(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1943, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1923
 *         return new_gen(_ret)
 * 
 *     def algpow(al, x, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al` and an integer :math:`n`, computes the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1945
 *         return new_gen(_ret)
 * 
 *     def algprimesubalg(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit` representing a semisimple
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_129algprimesubalg(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_128algprimesubalg[] = "\n        :emphasis:`al` being the output of :literal:`algtableinit` representing a semisimple\n        algebra of positive characteristic, returns a basis of the prime subalgebra\n        of\302\240:emphasis:`al`. The prime subalgebra of\302\240:emphasis:`al` is the subalgebra fixed by the\n        Frobenius automorphism of the center of :emphasis:`al`. It is abstractly isomorphic\n        to a product of copies of :math:`\\mathbb{F}_p`.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? algprimesubalg(A)\n            %3 =\n            [1 0]\n            \n            [0 1]\n            \n            [0 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_129algprimesubalg(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algprimesubalg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_128algprimesubalg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_128algprimesubalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algprimesubalg", 0);

  /* "cypari/auto_gen.pxi":1965
 *             [0 0]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algprimesubalg(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 1965, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1966
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algprimesubalg(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":1967
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algprimesubalg(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algprimesubalg(__pyx_v__al);

  /* "cypari/auto_gen.pxi":1968
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algprimesubalg(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algquotient(al, I, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 1968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1945
 *         return new_gen(_ret)
 * 
 *     def algprimesubalg(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit` representing a semisimple
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algprimesubalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1970
 *         return new_gen(_ret)
 * 
 *     def algquotient(al, I, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`I`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_131algquotient(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_130algquotient[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`I`\n        being a basis of a two-sided ideal of :emphasis:`al` represented by a matrix,\n        returns the quotient :math:`al/I`. When :math:`maps = 1`, returns a\n        :literal:`t_VEC` :math:`[al/I,proj,lift]` where :emphasis:`proj` and\n        :emphasis:`lift` are matrices respectively representing the projection map and a\n        section of it.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? AQ = algquotient(A,[0;1;0]);\n            ? algdim(AQ)\n            %4 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_131algquotient(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algquotient (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_maps,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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algquotient") < 0)) __PYX_ERR(10, 1970, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_I = values[0];
    if (values[1]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 1970, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algquotient", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 1970, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algquotient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_130algquotient(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_I, __pyx_v_maps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_130algquotient(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_I, long __pyx_v_maps) {
  GEN __pyx_v__al;
  GEN __pyx_v__I;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algquotient", 0);
  __Pyx_INCREF(__pyx_v_I);

  /* "cypari/auto_gen.pxi":1987
 *             %4 = 2
 *         '''
 *         I = objtogen(I)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_I, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_I, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":1988
 *         '''
 *         I = objtogen(I)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _I = (<Gen>I).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 1988, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":1989
 *         I = objtogen(I)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1990
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _I = (<Gen>I).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_I)->__pyx_base.g;
  __pyx_v__I = __pyx_t_3;

  /* "cypari/auto_gen.pxi":1991
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = alg_quotient(__pyx_v__al, __pyx_v__I, __pyx_v_maps);

  /* "cypari/auto_gen.pxi":1992
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _ret = alg_quotient(_al, _I, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algradical(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 1992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1970
 *         return new_gen(_ret)
 * 
 *     def algquotient(al, I, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`I`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algquotient", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_I);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":1994
 *         return new_gen(_ret)
 * 
 *     def algradical(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit`, returns a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_133algradical(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_132algradical[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit`, returns a\n        basis of the Jacobson radical of the algebra :emphasis:`al` over its prime field\n        (:math:`\\mathbb{Q}` or :math:`\\mathbb{F}_p`).\n        \n        Here is an example with :math:`A = \\mathbb{Q}[x]/(x^2)`, with the basis\302\240:math:`(1,x)`:\n        \n        ::\n        \n            ? mt = [matid(2),[0,0;1,0]];\n            ? A = algtableinit(mt);\n            ? algradical(A) \\\\ = (x)\n            %3 =\n            [0]\n            \n            [1]\n        \n        Another one with :math:`2 x 2` upper triangular matrices over :math:`\\mathbb{Q}`, with basis\n        :math:`I_2`, :math:`a = [0,1;0,0]` and :math:`b = [0,0;0,1]`, such that :math:`a^2 =\n        0`, :math:`ab = a`, :math:`ba = 0`, :math:`b^2 = b`:\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algradical(A) \\\\ = (a)\n            %6 =\n            [0]\n            \n            [1]\n            \n            [0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_133algradical(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algradical (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_132algradical(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_132algradical(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algradical", 0);

  /* "cypari/auto_gen.pxi":2028
 *             [0]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algradical(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2028, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2029
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algradical(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2030
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algradical(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algradical(__pyx_v__al);

  /* "cypari/auto_gen.pxi":2031
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algradical(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algramifiedplaces(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2031, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":1994
 *         return new_gen(_ret)
 * 
 *     def algradical(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit`, returns a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algradical", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2033
 *         return new_gen(_ret)
 * 
 *     def algramifiedplaces(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_135algramifiedplaces(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_134algramifiedplaces[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns a\n        :literal:`t_VEC` containing the list of places of the center of :emphasis:`al` that are\n        ramified in :emphasis:`al`. Each place is described as an integer between\302\240:math:`1`\n        and\302\240:math:`r_1` or as a prime ideal.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf, [-1,y]);\n            ? algramifiedplaces(A)\n            %3 = [1, [2, [2, 0]~, 1, 2, 1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_135algramifiedplaces(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algramifiedplaces (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_134algramifiedplaces(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_134algramifiedplaces(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algramifiedplaces", 0);

  /* "cypari/auto_gen.pxi":2047
 *             %3 = [1, [2, [2, 0]~, 1, 2, 1]]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algramifiedplaces(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2047, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2048
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algramifiedplaces(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2049
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algramifiedplaces(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algramifiedplaces(__pyx_v__al);

  /* "cypari/auto_gen.pxi":2050
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algramifiedplaces(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algrandom(al, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2033
 *         return new_gen(_ret)
 * 
 *     def algramifiedplaces(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algramifiedplaces", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2052
 *         return new_gen(_ret)
 * 
 *     def algrandom(al, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and an integer :emphasis:`b`, returns a random
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_137algrandom(PyObject *__pyx_v_al, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_136algrandom[] = "\n        Given an algebra :emphasis:`al` and an integer :emphasis:`b`, returns a random\n        element in :emphasis:`al` with coefficients in\302\240:math:`[-b,b]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_137algrandom(PyObject *__pyx_v_al, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algrandom (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_136algrandom(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_136algrandom(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_b) {
  GEN __pyx_v__al;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algrandom", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":2057
 *         element in :emphasis:`al` with coefficients in:math:`[-b,b]`.
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2058
 *         '''
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2058, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2059
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algrandom(_al, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2060
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algrandom(_al, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2061
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algrandom(_al, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algrandom(__pyx_v__al, __pyx_v__b);

  /* "cypari/auto_gen.pxi":2062
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = algrandom(_al, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algrelmultable(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2052
 *         return new_gen(_ret)
 * 
 *     def algrandom(al, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` and an integer :emphasis:`b`, returns a random
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algrandom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2064
 *         return new_gen(_ret)
 * 
 *     def algrelmultable(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined by a multiplication table over its center (a number field), returns this multiplication table.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_139algrelmultable(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_138algrelmultable[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined by a multiplication table over its center (a number field), returns this multiplication table.\n        \n        ::\n        \n            ? nf = nfinit(y^3-5); a = y; b = y^2;\n            ? {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            ? {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            ? {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = alginit(nf,mt,'x);\n            ? M = algrelmultable(A);\n            ? M[2] == m_i\n            %8 = 1\n            ? M[3] == m_j\n            %9 = 1\n            ? M[4] == m_k\n            %10 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_139algrelmultable(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algrelmultable (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_138algrelmultable(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_138algrelmultable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algrelmultable", 0);

  /* "cypari/auto_gen.pxi":2093
 *             %10 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algrelmultable(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2093, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2094
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algrelmultable(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2095
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algrelmultable(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algrelmultable(__pyx_v__al);

  /* "cypari/auto_gen.pxi":2096
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algrelmultable(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsimpledec(al, long maps=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2064
 *         return new_gen(_ret)
 * 
 *     def algrelmultable(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined by a multiplication table over its center (a number field), returns this multiplication table.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algrelmultable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2098
 *         return new_gen(_ret)
 * 
 *     def algsimpledec(al, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit`, returns a :literal:`t_VEC`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_141algsimpledec(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_140algsimpledec[] = "\n        :emphasis:`al` being the output of :literal:`algtableinit`, returns a :literal:`t_VEC`\n        :math:`[J,[al_1,al_2,...,al_n]]` where :math:`J` is a basis of the\n        Jacobson radical of :emphasis:`al` and\302\240:math:`al/J` is isomorphic to the direct\n        product of the simple algebras\302\240:math:`al_i`. When :math:`maps = 1`,\n        each\302\240:math:`al_i` is replaced with a :literal:`t_VEC`\n        :math:`[al_i,proj_i,lift_i]` where :math:`proj_i` and\302\240:math:`lift_i`\n        are matrices respectively representing the projection map\302\240:math:`al \\to\n        al_i` and a section of it. Modulo\302\240:math:`J`, the images of the :math:`lift_i`\n        form a direct sum in\302\240:math:`al/J`, so that the images of\302\240:math:`1\\inal_i`\n        under\302\240:math:`lift_i` are central primitive idempotents of\302\240:math:`al/J`. The\n        factors are sorted by increasing dimension, then increasing dimension of the\n        center. This ensures that the ordering of the isomorphism classes of the\n        factors is deterministic over finite fields, but not necessarily over\302\240:math:`\\mathbb{Q}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_141algsimpledec(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_maps;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsimpledec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_maps,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maps);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsimpledec") < 0)) __PYX_ERR(10, 2098, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_maps = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_maps == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2098, __pyx_L3_error)
    } else {
      __pyx_v_maps = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsimpledec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2098, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsimpledec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_140algsimpledec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_maps);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_140algsimpledec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, long __pyx_v_maps) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algsimpledec", 0);

  /* "cypari/auto_gen.pxi":2114
 *         factors is deterministic over finite fields, but not necessarily over:math:`\mathbb{Q}`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsimpledec(_al, maps)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2114, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2115
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsimpledec(_al, maps)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2116
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsimpledec(_al, maps)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsimpledec(__pyx_v__al, __pyx_v_maps);

  /* "cypari/auto_gen.pxi":2117
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsimpledec(_al, maps)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsplit(al, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2098
 *         return new_gen(_ret)
 * 
 *     def algsimpledec(al, long maps=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being the output of :literal:`algtableinit`, returns a :literal:`t_VEC`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsimpledec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2119
 *         return new_gen(_ret)
 * 
 *     def algsplit(al, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra over:math:`\mathbb{F}_p` output by :literal:`algtableinit`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_143algsplit(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_142algsplit[] = "\n        If :emphasis:`al` is a table algebra over\302\240:math:`\\mathbb{F}_p` output by :literal:`algtableinit`\n        that represents a simple algebra, computes an isomorphism between :emphasis:`al` and\n        a matrix algebra\302\240:math:`M_d(\\mathbb{F}_{p^n})` where\302\240:math:`N = nd^2` is the dimension of\302\240:emphasis:`al`.\n        Returns a :literal:`t_VEC`\302\240:math:`[map,mapi]`, where:\n        \n        - :emphasis:`map` is a :literal:`t_VEC` of\302\240:math:`N` matrices of size\302\240:math:`d x d` with\n          :literal:`t_FFELT` coefficients using the variable\302\240:emphasis:`v`, representing the image of\n          the basis of\302\240:emphasis:`al` under the isomorphism.\n        \n        - :emphasis:`mapi` is an\302\240:math:`N x N` matrix with :literal:`t_INT` coefficients,\n          representing the image in :emphasis:`al` by the inverse isomorphism of the\n          basis\302\240:math:`(b_i)` of\302\240:math:`M_d(\\mathbb{F}_p[\\alpha])` (where\302\240:math:`\\alpha` has degree\302\240:math:`n`\n          over\302\240:math:`\\mathbb{F}_p`) defined as follows:\n          let\302\240:math:`E_{i,j}` be the matrix having all coefficients\302\240:math:`0` except the\302\240:math:`(i,j)`-th\n          coefficient equal to\302\240:math:`1`, and define\n          \n        \n        .. MATH::\n        \n            b_i = E_{((i-1)/nd)+1, ((i-1)/n mod d)+1} \\alpha^{(i-1) mod n}.\n        \n        Example:\n        \n        ::\n        \n            ? al0 = alginit(nfinit(y^2+7), [-1,-1]);\n            ? al = algtableinit(algmultable(al0), 3); \\\\ isomorphic to M_2(F_9)\n            ? [map,mapi] = algsplit(al, 'a);\n            ? x = [1,2,1,0,0,0,0,0]~; fx = map*x\n            %4 =\n            [2*a 0]\n            \n            [ 0 2]\n            ? y = [0,0,0,0,1,0,0,1]~; fy = map*y\n            %5 =\n            [1 2*a]\n            \n            [2 a + 2]\n            ? map*algmul(al,x,y) == fx*fy\n            %6 = 1\n       ""     ? map*mapi[,6]\n            %7 =\n            [0 0]\n            \n            [a 0]\n        \n        :strong:`Warning.` If\302\240:emphasis:`al` is not simple, :literal:`algsplit(al)` can trigger\n        an error, but can also run into an infinite loop. Example:\n        \n        ::\n        \n            ? al = alginit(nfinit(y),[-1,-1]); \\\\ ramified at 2\n            ? al2 = algtableinit(algmultable(al),2); \\\\ maximal order modulo 2\n            ? algsplit(al2); \\\\ not semisimple, infinite loop\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_143algsplit(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsplit") < 0)) __PYX_ERR(10, 2119, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsplit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2119, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_142algsplit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_142algsplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("algsplit", 0);

  /* "cypari/auto_gen.pxi":2176
 *             ? algsplit(al2); \\ not semisimple, infinite loop
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":2177
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":2178
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 2178, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":2177
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":2179
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplit(_al, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 2179, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2180
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsplit(_al, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_5;

  /* "cypari/auto_gen.pxi":2181
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplit(_al, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsplit(__pyx_v__al, __pyx_v__v);

  /* "cypari/auto_gen.pxi":2182
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplit(_al, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsplittingdata(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 2182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2119
 *         return new_gen(_ret)
 * 
 *     def algsplit(al, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`al` is a table algebra over:math:`\mathbb{F}_p` output by :literal:`algtableinit`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2184
 *         return new_gen(_ret)
 * 
 *     def algsplittingdata(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_145algsplittingdata(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_144algsplittingdata[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined\n        by a multiplication table over its center\302\240:math:`K` (a number field), returns data\n        stored to compute a splitting of :emphasis:`al` over an extension. This data is a\n        :literal:`t_VEC` :literal:`[t,Lbas,Lbasinv]` with :math:`3` components:\n        \n        - an element :math:`t` of :emphasis:`al` such that :math:`L = K(t)` is a maximal subfield\n          of :emphasis:`al`;\n        \n        - a matrix :literal:`Lbas` expressing a :math:`L`-basis of :emphasis:`al` (given an\n          :math:`L`-vector space structure by multiplication on the right) on the integral\n          basis of :emphasis:`al`;\n        \n        - a matrix :literal:`Lbasinv` expressing the integral basis of :emphasis:`al` on\n          the previous :math:`L`-basis.\n        \n        ::\n        \n            ? nf = nfinit(y^3-5); a = y; b = y^2;\n            ? {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            ? {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            ? {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = alginit(nf,mt,'x);\n            ? [t,Lb,Lbi] = algsplittingdata(A);\n            ? t\n            %8 = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]~;\n            ? matsize(Lb)\n            %9 = [12, 2]\n            ? matsize(Lbi)\n            %10 = [2, 12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_145algsplittingdata(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsplittingdata (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_144algsplittingdata(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_144algsplittingdata(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algsplittingdata", 0);

  /* "cypari/auto_gen.pxi":2226
 *             %10 = [2, 12]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingdata(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2226, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2227
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsplittingdata(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2228
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingdata(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsplittingdata(__pyx_v__al);

  /* "cypari/auto_gen.pxi":2229
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingdata(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsplittingfield(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2184
 *         return new_gen(_ret)
 * 
 *     def algsplittingdata(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit` defined
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsplittingdata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2231
 *         return new_gen(_ret)
 * 
 *     def algsplittingfield(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_147algsplittingfield(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_146algsplittingfield[] = "\n        Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns\n        an :literal:`rnf` structure: the splitting field of :emphasis:`al` that is stored in\n        :emphasis:`al`, as a relative extension of the center.\n        \n        ::\n        \n            nf = nfinit(y^3-5);\n            a = y; b = y^2;\n            {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            mt = [matid(4), m_i, m_j, m_k];\n            A = alginit(nf,mt,'x);\n            algsplittingfield(A).pol\n            %8 = x^2 - y\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_147algsplittingfield(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsplittingfield (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_146algsplittingfield(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_146algsplittingfield(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algsplittingfield", 0);

  /* "cypari/auto_gen.pxi":2258
 *             %8 = x^2 - y
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingfield(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2258, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2259
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsplittingfield(_al)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2260
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingfield(_al)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsplittingfield(__pyx_v__al);

  /* "cypari/auto_gen.pxi":2261
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _ret = algsplittingfield(_al)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsqr(al, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2231
 *         return new_gen(_ret)
 * 
 *     def algsplittingfield(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a central simple algebra :emphasis:`al` output by :literal:`alginit`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsplittingfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2263
 *         return new_gen(_ret)
 * 
 *     def algsqr(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its square :math:`x^2` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_149algsqr(PyObject *__pyx_v_al, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_148algsqr[] = "\n        Given an element :math:`x` in :emphasis:`al`, computes its square :math:`x^2` in the\n        algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algsqr(A,[1,0,2,0]~)\n            %2 = [-3, 0, 4, 0]~\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_149algsqr(PyObject *__pyx_v_al, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsqr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_148algsqr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_148algsqr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsqr", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2276
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2277
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2277, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2278
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algsqr(_al, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2279
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsqr(_al, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2280
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algsqr(_al, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsqr(__pyx_v__al, __pyx_v__x);

  /* "cypari/auto_gen.pxi":2281
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algsqr(_al, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsub(al, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2263
 *         return new_gen(_ret)
 * 
 *     def algsqr(al, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`al`, computes its square :math:`x^2` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2283
 *         return new_gen(_ret)
 * 
 *     def algsub(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their difference
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_151algsub(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_150algsub[] = "\n        Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their difference\n        :math:`x-y` in the algebra :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algsub(A,[1,1,0,0]~,[1,0,1,0]~)\n            %2 = [0, 1, -1, 0]~\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_151algsub(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsub (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("algsub", 1, 2, 2, 1); __PYX_ERR(10, 2283, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algsub") < 0)) __PYX_ERR(10, 2283, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algsub", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2283, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_150algsub(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_150algsub(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsub", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":2296
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2297
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2298
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2298, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2299
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2300
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algsub(_al, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2301
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsub(_al, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2302
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algsub(_al, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsub(__pyx_v__al, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":2303
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = algsub(_al, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algsubalg(al, B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2283
 *         return new_gen(_ret)
 * 
 *     def algsub(al, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in :emphasis:`al`, computes their difference
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2305
 *         return new_gen(_ret)
 * 
 *     def algsubalg(al, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`B`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_153algsubalg(PyObject *__pyx_v_al, PyObject *__pyx_v_B); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_152algsubalg[] = "\n        :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`B`\n        being a basis of a subalgebra of\302\240:emphasis:`al` represented by a matrix, computes an\n        algebra\302\240:emphasis:`al2` isomorphic to :emphasis:`B`.\n        \n        Returns :math:`[al2,B2]` where :emphasis:`B2` is a possibly different basis of\n        the subalgebra :emphasis:`al2`, with respect to which the multiplication table of\n        :emphasis:`al2` is defined.\n        \n        ::\n        \n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? B = algsubalg(A,[1,0; 0,0; 0,1]);\n            ? algdim(A)\n            %4 = 3\n            ? algdim(B[1])\n            %5 = 2\n            ? m = matcompanion(x^4+1);\n            ? mt = [m^i | i <- [0..3]];\n            ? al = algtableinit(mt);\n            ? B = [1,0;0,0;0,1/2;0,0];\n            ? al2 = algsubalg(al,B);\n            ? algdim(al2[1])\n            ? al2[2]\n            %13 =\n            [1 0]\n            \n            [0 0]\n            \n            [0 1]\n            \n            [0 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_153algsubalg(PyObject *__pyx_v_al, PyObject *__pyx_v_B) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algsubalg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_152algsubalg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), ((PyObject *)__pyx_v_B));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_152algsubalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_B) {
  GEN __pyx_v__al;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algsubalg", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":2340
 *             [0 0]
 *         '''
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2341
 *         '''
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2341, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2342
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = algsubalg(_al, _B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2343
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algsubalg(_al, _B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2344
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = algsubalg(_al, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algsubalg(__pyx_v__al, __pyx_v__B);

  /* "cypari/auto_gen.pxi":2345
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = algsubalg(_al, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtableinit(mt, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2305
 *         return new_gen(_ret)
 * 
 *     def algsubalg(al, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`al` being a table algebra output by :literal:`algtableinit` and :emphasis:`B`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algsubalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2347
 *         return new_gen(_ret)
 * 
 *     def algtableinit(mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the associative algebra over :math:`K = \mathbb{Q}` (:math:`p` omitted) or :math:`\mathbb{F}_p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_155algtableinit(PyObject *__pyx_v_mt, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_154algtableinit[] = "\n        Initializes the associative algebra over :math:`K = \\mathbb{Q}` (:math:`p` omitted) or :math:`\\mathbb{F}_p`\n        defined by the multiplication table :emphasis:`mt`.\n        As a :math:`K`-vector space, the algebra is generated by a basis\n        :math:`(e_1 = 1, e_2,..., e_n)`; the table is given as a :literal:`t_VEC` of :math:`n` matrices in\n        :math:`M_n(K)`, giving the left multiplication by the basis elements :math:`e_i`, in the\n        given basis.\n        Assumes that :math:`e_1 = 1`, that :math:`K e_1\\oplus...\\oplus K e_n]` describes an\n        associative algebra over :math:`K`, and in the case :math:`K = \\mathbb{Q}` that the multiplication\n        table is integral. If the algebra is already known to be central\n        and simple, then the case :math:`K = \\mathbb{F}_p` is useless, and one should use\n        :literal:`alginit` directly.\n        \n        The point of this function is to input a finite dimensional :math:`K`-algebra, so\n        as to later compute its radical, then to split the quotient algebra as a\n        product of simple algebras over :math:`K`.\n        \n        The pari object representing such an algebra :math:`A` is a :literal:`t_VEC` with the\n        following data:\n        \n        - The characteristic of :math:`A`, accessed with :literal:`algchar`.\n        \n        - The multiplication table of :math:`A`, accessed with :literal:`algmultable`.\n        \n        - The traces of the elements of the basis.\n        \n        A simple example: the :math:`2 x 2` upper triangular matrices over :math:`\\mathbb{Q}`,\n        generated by :math:`I_2`, :math:`a = [0,1;0,0]` and :math:`b = [0,0;0,1]`,\n        such that :math:`a^2 = 0`, :math:`ab = a`, :math:`ba = 0`, :math:`b^2 = b`:\n        \n        ::\n        \n            ? mt = [matid(3),[0,0,0;1,0,1;0,0,0],[0,0,0;0,0,0;1,0,1]];\n            ? A = algtableinit(mt);\n            ? algradical(A) \\\\ = (a)\n            %6 =\n            [0]\n   ""         \n            [1]\n            \n            [0]\n            ? algcenter(A) \\\\ = (I_2)\n            %7 =\n            [1]\n            \n            [0]\n            \n            [0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_155algtableinit(PyObject *__pyx_v_mt, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtableinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtableinit") < 0)) __PYX_ERR(10, 2347, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtableinit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2347, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtableinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_154algtableinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mt), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_154algtableinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mt, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__mt;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("algtableinit", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":2397
 *             [0]
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":2398
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":2399
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 2399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":2398
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":2400
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 2400, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2401
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mt)->__pyx_base.g;
  __pyx_v__mt = __pyx_t_4;

  /* "cypari/auto_gen.pxi":2402
 *         sig_on()
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":2403
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":2404
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtableinit(_mt, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":2403
 *         cdef GEN _mt = (<Gen>mt).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)
 */
  }

  /* "cypari/auto_gen.pxi":2405
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtableinit(__pyx_v__mt, __pyx_v__p);

  /* "cypari/auto_gen.pxi":2406
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = algtableinit(_mt, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtensor(al1, al2, long maxord=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 2406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2347
 *         return new_gen(_ret)
 * 
 *     def algtableinit(mt, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the associative algebra over :math:`K = \mathbb{Q}` (:math:`p` omitted) or :math:`\mathbb{F}_p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtableinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2408
 *         return new_gen(_ret)
 * 
 *     def algtensor(al1, al2, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two algebras :emphasis:`al1` and :emphasis:`al2`, computes their tensor
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_157algtensor(PyObject *__pyx_v_al1, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_156algtensor[] = "\n        Given two algebras :emphasis:`al1` and :emphasis:`al2`, computes their tensor\n        product. Computes a maximal order by default. Prevent this computation by\n        setting :math:`maxord = 0`.\n        \n        Currently only implemented for cyclic algebras of coprime degree over the same\n        center\302\240:math:`K`, and the tensor product is over\302\240:math:`K`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_157algtensor(PyObject *__pyx_v_al1, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_al2 = 0;
  long __pyx_v_maxord;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtensor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_al2,&__pyx_n_s_maxord,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_al2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_maxord);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtensor") < 0)) __PYX_ERR(10, 2408, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_al2 = values[0];
    if (values[1]) {
      __pyx_v_maxord = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_maxord == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2408, __pyx_L3_error)
    } else {
      __pyx_v_maxord = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtensor", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2408, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_156algtensor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al1), __pyx_v_al2, __pyx_v_maxord);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_156algtensor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al1, PyObject *__pyx_v_al2, long __pyx_v_maxord) {
  GEN __pyx_v__al1;
  GEN __pyx_v__al2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algtensor", 0);
  __Pyx_INCREF(__pyx_v_al2);

  /* "cypari/auto_gen.pxi":2417
 *         center:math:`K`, and the tensor product is over:math:`K`.
 *         '''
 *         al2 = objtogen(al2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al1 = (<Gen>al1).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_al2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2417, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_al2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2418
 *         '''
 *         al2 = objtogen(al2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al1 = (<Gen>al1).g
 *         cdef GEN _al2 = (<Gen>al2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2418, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2419
 *         al2 = objtogen(al2)
 *         sig_on()
 *         cdef GEN _al1 = (<Gen>al1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _al2 = (<Gen>al2).g
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al1)->__pyx_base.g;
  __pyx_v__al1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2420
 *         sig_on()
 *         cdef GEN _al1 = (<Gen>al1).g
 *         cdef GEN _al2 = (<Gen>al2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al2)->__pyx_base.g;
  __pyx_v__al2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2421
 *         cdef GEN _al1 = (<Gen>al1).g
 *         cdef GEN _al2 = (<Gen>al2).g
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtensor(__pyx_v__al1, __pyx_v__al2, __pyx_v_maxord);

  /* "cypari/auto_gen.pxi":2422
 *         cdef GEN _al2 = (<Gen>al2).g
 *         cdef GEN _ret = algtensor(_al1, _al2, maxord)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtomatrix(al, x, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2408
 *         return new_gen(_ret)
 * 
 *     def algtensor(al1, al2, long maxord=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two algebras :emphasis:`al1` and :emphasis:`al2`, computes their tensor
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtensor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_al2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2424
 *         return new_gen(_ret)
 * 
 *     def algtomatrix(al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, returns the image of :emphasis:`x` under a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_159algtomatrix(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_158algtomatrix[] = "\n        Given an element :emphasis:`x` in :emphasis:`al`, returns the image of :emphasis:`x` under a\n        homomorphism to a matrix algebra. If :emphasis:`al` is a table algebra output by\n        :literal:`algtableinit` or if\302\240:math:`abs = 1`, returns the left multiplication table on the\n        integral basis; if :emphasis:`al` is a central simple algebra and\302\240:math:`abs = 0`,\n        returns\302\240:math:`\\phi (x)` where\302\240:math:`\\phi : A\\otimes_K L \\to M_d(L)` (where :math:`d` is the\n        degree of the algebra and :math:`L` is an extension of :math:`L` with\302\240:math:`[L:K] = d`) is an\n        isomorphism stored in\302\240:emphasis:`al`. Also accepts a square matrix with coefficients\n        in\302\240:emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algtomatrix(A,[0,0,0,2]~)\n            %2 =\n            [Mod(x + 1, x^2 + 1) Mod(Mod(1, y)*x + Mod(-1, y), x^2 + 1)]\n            \n            [Mod(x + 1, x^2 + 1) Mod(-x + 1, x^2 + 1)]\n            ? algtomatrix(A,[0,1,0,0]~,1)\n            %2 =\n            [0 -1 1 0]\n            \n            [1 0 1 1]\n            \n            [0 0 1 1]\n            \n            [0 0 -2 -1]\n            ? algtomatrix(A,[0,x]~,1)\n            %3 =\n            [-1 0 0 -1]\n            \n            [-1 0 1 0]\n            \n            [-1 -1 0 -1]\n            \n            [ 2 0 0 1]\n        \n        Also accepts matrices with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_159algtomatrix(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtomatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_abs,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtomatrix") < 0)) __PYX_ERR(10, 2424, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2424, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtomatrix", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2424, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtomatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_158algtomatrix(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_abs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_158algtomatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algtomatrix", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2464
 *         Also accepts matrices with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2465
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2465, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2466
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2467
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2468
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtomatrix(__pyx_v__al, __pyx_v__x, __pyx_v_abs);

  /* "cypari/auto_gen.pxi":2469
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtomatrix(_al, _x, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtrace(al, x, long abs=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2424
 *         return new_gen(_ret)
 * 
 *     def algtomatrix(al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, returns the image of :emphasis:`x` under a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtomatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2471
 *         return new_gen(_ret)
 * 
 *     def algtrace(al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its trace. If :emphasis:`al` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_161algtrace(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_160algtrace[] = "\n        Given an element :emphasis:`x` in :emphasis:`al`, computes its trace. If :emphasis:`al` is\n        a table algebra output by :literal:`algtableinit` or if :math:`abs = 1`, returns the\n        absolute trace of :emphasis:`x`, which is an element of :math:`\\mathbb{F}_p` or\302\240:math:`\\mathbb{Q}`; if :emphasis:`al`\n        is the output of :literal:`alginit` and :math:`abs = 0` (default), returns the reduced trace\n        of :emphasis:`x`, which is an element of the center of :emphasis:`al`.\n        \n        ::\n        \n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algtrace(A,[5,0,0,1]~)\n            %2 = 11\n            ? algtrace(A,[5,0,0,1]~,1)\n            %3 = 22\n            ? nf = nfinit(y^2-5);\n            ? A = alginit(nf,[-1,y]);\n            ? a = [1+x+y,2*y]~*Mod(1,y^2-5)*Mod(1,x^2+1);\n            ? t = algtrace(A,a)\n            %7 = Mod(2*y + 2, y^2 - 5)\n            ? algtrace(A,a,1)\n            %8 = 8\n            ? algdegree(A)*nfelttrace(nf,t)\n            %9 = 8\n        \n        Also accepts a square matrix with coefficients in :emphasis:`al`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_161algtrace(PyObject *__pyx_v_al, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_abs;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtrace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_abs,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_abs);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "algtrace") < 0)) __PYX_ERR(10, 2471, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_abs = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_abs == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2471, __pyx_L3_error)
    } else {
      __pyx_v_abs = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("algtrace", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2471, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_160algtrace(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al), __pyx_v_x, __pyx_v_abs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_160algtrace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al, PyObject *__pyx_v_x, long __pyx_v_abs) {
  GEN __pyx_v__al;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("algtrace", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2498
 *         Also accepts a square matrix with coefficients in :emphasis:`al`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2499
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2499, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2500
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtrace(_al, _x, abs)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2501
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtrace(_al, _x, abs)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2502
 *         cdef GEN _al = (<Gen>al).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtrace(_al, _x, abs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtrace(__pyx_v__al, __pyx_v__x, __pyx_v_abs);

  /* "cypari/auto_gen.pxi":2503
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtrace(_al, _x, abs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def algtype(al):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2471
 *         return new_gen(_ret)
 * 
 *     def algtrace(al, x, long abs=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :emphasis:`x` in :emphasis:`al`, computes its trace. If :emphasis:`al` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2505
 *         return new_gen(_ret)
 * 
 *     def algtype(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or by :literal:`algtableinit`, returns an integer indicating the type of algebra:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_163algtype(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_162algtype[] = "\n        Given an algebra :emphasis:`al` output by :literal:`alginit` or by :literal:`algtableinit`, returns an integer indicating the type of algebra:\n        \n        - :math:`0`: not a valid algebra.\n        \n        - :math:`1`: table algebra output by :literal:`algtableinit`.\n        \n        - :math:`2`: central simple algebra output by :literal:`alginit` and represented by\n          a multiplication table over its center.\n        \n        - :math:`3`: central simple algebra output by :literal:`alginit` and represented by\n          a cyclic algebra.\n        \n        ::\n        \n            ? algtype([])\n            %1 = 0\n            ? mt = [matid(3), [0,0,0; 1,1,0; 0,0,0], [0,0,1; 0,0,0; 1,0,1]];\n            ? A = algtableinit(mt,2);\n            ? algtype(A)\n            %4 = 1\n            ? nf = nfinit(y^3-5);\n            ? a = y; b = y^2;\n            ? {m_i = [0,a,0,0;\n             1,0,0,0;\n             0,0,0,a;\n             0,0,1,0];}\n            ? {m_j = [0, 0,b, 0;\n             0, 0,0,-b;\n             1, 0,0, 0;\n             0,-1,0, 0];}\n            ? {m_k = [0, 0,0,-a*b;\n             0, 0,b, 0;\n             0,-a,0, 0;\n             1, 0,0, 0];}\n            ? mt = [matid(4), m_i, m_j, m_k];\n            ? A = alginit(nf,mt,'x);\n            ? algtype(A)\n            %12 = 2\n            ? A = alginit(nfinit(y), [-1,-1]);\n            ? algtype(A)\n            %14 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_163algtype(PyObject *__pyx_v_al, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("algtype (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_162algtype(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_al));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_162algtype(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_al) {
  GEN __pyx_v__al;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("algtype", 0);

  /* "cypari/auto_gen.pxi":2549
 *             %14 = 3
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algtype(_al)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2549, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2550
 *         '''
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = algtype(_al)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_al)->__pyx_base.g;
  __pyx_v__al = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2551
 *         sig_on()
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algtype(_al)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = algtype(__pyx_v__al);

  /* "cypari/auto_gen.pxi":2552
 *         cdef GEN _al = (<Gen>al).g
 *         cdef long _ret = algtype(_al)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":2553
 *         cdef long _ret = algtype(_al)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def apply(f, A):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2505
 *         return new_gen(_ret)
 * 
 *     def algtype(al):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebra :emphasis:`al` output by :literal:`alginit` or by :literal:`algtableinit`, returns an integer indicating the type of algebra:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.algtype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2555
 *         return _ret
 * 
 *     def apply(f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` to the entries of :literal:`A`. If :literal:`A`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_165apply(PyObject *__pyx_v_f, PyObject *__pyx_v_A); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_164apply[] = "\n        Apply the :literal:`t_CLOSURE` :literal:`f` to the entries of :literal:`A`. If :literal:`A`\n        is a scalar, return :literal:`f(A)`. If :literal:`A` is a polynomial or power series,\n        apply :literal:`f` on all coefficients. If :literal:`A` is a vector or list, return\n        the elements :math:`f(x)` where :math:`x` runs through :literal:`A`. If :literal:`A` is a matrix,\n        return the matrix whose entries are the :math:`f(A[i,j])`.\n        \n        ::\n        \n            ? apply(x->x^2, [1,2,3,4])\n            %1 = [1, 4, 9, 16]\n            ? apply(x->x^2, [1,2;3,4])\n            %2 =\n            [1 4]\n            \n            [9 16]\n            ? apply(x->x^2, 4*x^2 + 3*x+ 2)\n            %3 = 16*x^2 + 9*x + 4\n        \n        Note that many functions already act componentwise on\n        vectors or matrices, but they almost never act on lists; in this\n        case, :literal:`apply` is a good solution:\n        \n        ::\n        \n            ? L = List([Mod(1,3), Mod(2,4)]);\n            ? lift(L)\n             *** at top-level: lift(L)\n             *** ^-------\n             *** lift: incorrect type in lift.\n            ? apply(lift, L);\n            %2 = List([1, 2])\n        \n        :strong:`Remark.` For :math:`v` a :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_LIST` or :literal:`t_MAT`,\n        the alternative set-notations\n        \n        ::\n        \n            [g(x) | x <- v, f(x)]\n            [x | x <- v, f(x)]\n            [g(x) | x <- v]\n        \n        are available as shortcuts for\n        \n        ::\n        \n            apply(g, select(f, Vec(v)))\n            select(f, Vec(v))\n            apply(g, Vec(v))\n        \n        respectively:\n        \n        ::\n        \n            ? L = List([Mod(1,3), Mod(2,4)]);\n            ? [ lift(x) | x<-L ]\n            %2 = [1, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_165apply(PyObject *__pyx_v_f, PyObject *__pyx_v_A) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("apply (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_164apply(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_A));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_164apply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("apply", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_gen.pxi":2614
 *             %2 = [1, 2]
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2614, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2615
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2615, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2616
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = apply0(_f, _A)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2617
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = apply0(_f, _A)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2618
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = apply0(_f, _A)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = apply0(__pyx_v__f, __pyx_v__A);

  /* "cypari/auto_gen.pxi":2619
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = apply0(_f, _A)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def arg(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2555
 *         return _ret
 * 
 *     def apply(f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` to the entries of :literal:`A`. If :literal:`A`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.apply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2621
 *         return new_gen(_ret)
 * 
 *     def arg(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Argument of the complex number :math:`x`, such that :math:`-\pi < \arg (x) <= \pi`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_167arg(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_166arg[] = "\n        Argument of the complex number :math:`x`, such that :math:`-\\pi < \\arg (x) <= \\pi`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_167arg(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arg") < 0)) __PYX_ERR(10, 2621, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2621, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arg", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2621, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.arg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_166arg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_166arg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("arg", 0);

  /* "cypari/auto_gen.pxi":2625
 *         Argument of the complex number :math:`x`, such that :math:`-\pi < \arg (x) <= \pi`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2625, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2626
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = garg(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2627
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = garg(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2628
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = garg(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = garg(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2629
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = garg(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def asin(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2621
 *         return new_gen(_ret)
 * 
 *     def arg(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Argument of the complex number :math:`x`, such that :math:`-\pi < \arg (x) <= \pi`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.arg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2631
 *         return new_gen(_ret)
 * 
 *     def asin(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sin^{-1}(x) = -i \log (ix + \sqrt{1 - x^2})`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_169asin(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_168asin[] = "\n        Principal branch of :math:`\\sin^{-1}(x) = -i \\log (ix + \\sqrt{1 - x^2})`.\n        In particular, :math:`\\Re (asin(x))\\in [-\\pi/2,\\pi/2]` and if :math:`x\\in \\mathbb{R}` and\n        :math:`\\|x\\| > 1` then :math:`asin(x)` is complex. The branch cut is in two pieces:\n        :math:`]- oo ,-1]`, continuous with quadrant II, and :math:`[1,+ oo [` continuous\n        with quadrant IV. The function satisfies :math:`i asin(x) =\n        asinh(ix)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_169asin(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("asin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "asin") < 0)) __PYX_ERR(10, 2631, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2631, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("asin", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2631, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.asin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_168asin(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_168asin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("asin", 0);

  /* "cypari/auto_gen.pxi":2640
 *         asinh(ix)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2640, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2641
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasin(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2642
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gasin(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2643
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasin(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gasin(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2644
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasin(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def asinh(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2631
 *         return new_gen(_ret)
 * 
 *     def asin(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sin^{-1}(x) = -i \log (ix + \sqrt{1 - x^2})`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.asin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2646
 *         return new_gen(_ret)
 * 
 *     def asinh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sinh^{-1}(x) = \log (x + \sqrt{1+x^2})`. In
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_171asinh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_170asinh[] = "\n        Principal branch of :math:`\\sinh^{-1}(x) = \\log (x + \\sqrt{1+x^2})`. In\n        particular :math:`\\Im (asinh(x))\\in [-\\pi/2,\\pi/2]`.\n        The branch cut is in two pieces: :math:`]-i oo ,-i]`, continuous with quadrant\n        III and :math:`[+i,+i oo [`, continuous with quadrant I.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_171asinh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("asinh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "asinh") < 0)) __PYX_ERR(10, 2646, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2646, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("asinh", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2646, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.asinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_170asinh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_170asinh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("asinh", 0);

  /* "cypari/auto_gen.pxi":2653
 *         III and :math:`[+i,+i oo [`, continuous with quadrant I.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2653, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2654
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasinh(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2655
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gasinh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2656
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasinh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gasinh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2657
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gasinh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def asympnum(expr, long k=0, alpha=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2646
 *         return new_gen(_ret)
 * 
 *     def asinh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`\sinh^{-1}(x) = \log (x + \sqrt{1+x^2})`. In
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.asinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2659
 *         return new_gen(_ret)
 * 
 *     def asympnum(expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Asymptotic expansion of :emphasis:`expr`, corresponding to a sequence :math:`u(n)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_173asympnum(PyObject *__pyx_v_expr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_172asympnum[] = "\n        Asymptotic expansion of :emphasis:`expr`, corresponding to a sequence :math:`u(n)`,\n        assuming it has the shape\n        \n        .. MATH::\n        \n            u(n) ~ \\sum_{i >= 0} a_i n^{-i\\alpha}\n        \n        with rational coefficients :math:`a_i` with reasonable height; the algorithm\n        is heuristic and performs repeated calls to limitnum, with\n        :literal:`k` and :literal:`alpha` are as in :literal:`limitnum`\n        \n        ::\n        \n            ? f(n) = n! / (n^n*exp(-n)*sqrt(n));\n            ? asympnum(f)\n            %2 = [] \\\\ failure !\n            ? l = limitnum(f)\n            %3 = 2.5066282746310005024157652848110452530\n            ? asympnum(n->f(n)/l) \\\\ normalize\n            %4 = [1, 1/12, 1/288, -139/51840]\n        \n        and we indeed get a few terms of Stirling's expansion. Note\n        that it helps to normalize with a limit computed to higher accuracy:\n        \n        ::\n        \n            ? \\p100\n            ? L = limitnum(f)\n            ? \\p38\n            ? asympnum(n->f(n)/L) \\\\ we get more terms!\n            %6 = [1, 1/12, 1/288, -139/51840, -571/2488320, 163879/209018880,\\\n             5246819/75246796800, -534703531/902961561600]\n        \n        If :literal:`alpha` is not an integer, loss of accuracy is\n        expected, so it should be precomputed to double accuracy, say:\n        \n        ::\n        \n            ? \\p38\n            ? asympnum(n->-log(1-1/n^Pi),,Pi)\n            %1 = [0, 1, 1/2, 1/3]\n            ? asympnum(n->-log(1-1/sqrt(n)),,1/2)\n            %2 = [0, 1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12, \\\n             1/13, 1/14, 1/15, 1/16, 1/17, 1/18, 1/19, 1/20, 1/21, 1/22]\n            \n            ? localprec(100); a = Pi;\n            ? asympnum(n->-log(1-1/n^a),,a) \\\\ better !\n            %4 = [0, 1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_173asympnum(PyObject *__pyx_v_expr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  PyObject *__pyx_v_alpha = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("asympnum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_alpha,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "asympnum") < 0)) __PYX_ERR(10, 2659, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2659, __pyx_L3_error)
    } else {
      __pyx_v_k = ((long)0);
    }
    __pyx_v_alpha = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2659, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("asympnum", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2659, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.asympnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_172asympnum(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_expr), __pyx_v_k, __pyx_v_alpha, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_172asympnum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision) {
  int __pyx_v__have_alpha;
  GEN __pyx_v__expr;
  GEN __pyx_v__alpha;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("asympnum", 0);
  __Pyx_INCREF(__pyx_v_alpha);

  /* "cypari/auto_gen.pxi":2710
 *             %4 = [0, 1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7, 1/8, 1/9, 1/10, 1/11, 1/12]
 *         '''
 *         cdef bint _have_alpha = (alpha is not None)             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 */
  __pyx_t_1 = (__pyx_v_alpha != Py_None);
  __pyx_v__have_alpha = __pyx_t_1;

  /* "cypari/auto_gen.pxi":2711
 *         '''
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":2712
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:
 *             alpha = objtogen(alpha)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_alpha, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 2712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":2711
 *         '''
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":2713
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 2713, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2714
 *             alpha = objtogen(alpha)
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_expr)->__pyx_base.g;
  __pyx_v__expr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":2715
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 */
  __pyx_v__alpha = NULL;

  /* "cypari/auto_gen.pxi":2716
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":2717
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_alpha)->__pyx_base.g;
    __pyx_v__alpha = __pyx_t_4;

    /* "cypari/auto_gen.pxi":2716
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":2718
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2719
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = asympnum0(__pyx_v__expr, __pyx_v_k, __pyx_v__alpha, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2720
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = asympnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def atan(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 2720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2659
 *         return new_gen(_ret)
 * 
 *     def asympnum(expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Asymptotic expansion of :emphasis:`expr`, corresponding to a sequence :math:`u(n)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.asympnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2722
 *         return new_gen(_ret)
 * 
 *     def atan(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tan^{-1}(x) = \log ((1+ix)/(1-ix)) /
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_175atan(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_174atan[] = "\n        Principal branch of :math:`tan^{-1}(x) = \\log ((1+ix)/(1-ix)) /\n        2i`. In particular the real part of :math:`atan(x)` belongs to\n        :math:`]-\\pi/2,\\pi/2[`.\n        The branch cut is in two pieces:\n        :math:`]-i oo ,-i[`, continuous with quadrant IV, and :math:`]i,+i oo [` continuous\n        with quadrant II. The function satisfies :math:`atan(x) =\n        -iatanh(ix)` for all :math:`x != \302\261 i`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_175atan(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atan") < 0)) __PYX_ERR(10, 2722, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2722, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atan", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2722, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.atan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_174atan(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_174atan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("atan", 0);

  /* "cypari/auto_gen.pxi":2732
 *         -iatanh(ix)` for all :math:`x !=  i`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2732, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2733
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatan(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2734
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gatan(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2735
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatan(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gatan(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2736
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatan(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def atanh(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2722
 *         return new_gen(_ret)
 * 
 *     def atan(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tan^{-1}(x) = \log ((1+ix)/(1-ix)) /
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.atan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2738
 *         return new_gen(_ret)
 * 
 *     def atanh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tanh^{-1}(x) = \log ((1+x)/(1-x)) / 2`. In
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_177atanh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_176atanh[] = "\n        Principal branch of :math:`tanh^{-1}(x) = \\log ((1+x)/(1-x)) / 2`. In\n        particular the imaginary part of :math:`atanh(x)` belongs to\n        :math:`[-\\pi/2,\\pi/2]`; if :math:`x\\in \\mathbb{R}` and :math:`\\|x\\| > 1` then :math:`atanh(x)` is complex.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_177atanh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("atanh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "atanh") < 0)) __PYX_ERR(10, 2738, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2738, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("atanh", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2738, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.atanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_176atanh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_176atanh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("atanh", 0);

  /* "cypari/auto_gen.pxi":2744
 *         :math:`[-\pi/2,\pi/2]`; if :math:`x\in \mathbb{R}` and :math:`\|x\| > 1` then :math:`atanh(x)` is complex.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2744, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2745
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatanh(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2746
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gatanh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2747
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatanh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gatanh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2748
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gatanh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselh1(nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2738
 *         return new_gen(_ret)
 * 
 *     def atanh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of :math:`tanh^{-1}(x) = \log ((1+x)/(1-x)) / 2`. In
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.atanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2750
 *         return new_gen(_ret)
 * 
 *     def besselh1(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_179besselh1(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_178besselh1[] = "\n        :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_179besselh1(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselh1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselh1") < 0)) __PYX_ERR(10, 2750, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2750, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselh1", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2750, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselh1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_178besselh1(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nu), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_178besselh1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselh1", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2754
 *         :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2755
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2755, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2756
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2757
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2758
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2759
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hbessel1(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2760
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel1(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselh2(nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2750
 *         return new_gen(_ret)
 * 
 *     def besselh1(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^1`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselh1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2762
 *         return new_gen(_ret)
 * 
 *     def besselh2(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_181besselh2(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_180besselh2[] = "\n        :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_181besselh2(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselh2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselh2") < 0)) __PYX_ERR(10, 2762, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2762, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselh2", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2762, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselh2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_180besselh2(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nu), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_180besselh2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselh2", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2766
 *         :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2767
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2767, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2768
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2769
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2770
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2771
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hbessel2(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2772
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hbessel2(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besseli(nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2762
 *         return new_gen(_ret)
 * 
 *     def besselh2(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`H^2`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselh2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2774
 *         return new_gen(_ret)
 * 
 *     def besseli(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`I`-Bessel function of index :emphasis:`nu` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_183besseli(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_182besseli[] = "\n        :math:`I`-Bessel function of index :emphasis:`nu` and\n        argument :math:`x`. If :math:`x` converts to a power series, the initial factor\n        :math:`(x/2)^\\nu/\\Gamma (\\nu+1)` is omitted (since it cannot be represented in PARI\n        when :math:`\\nu` is not integral).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_183besseli(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besseli (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besseli") < 0)) __PYX_ERR(10, 2774, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2774, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besseli", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2774, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.besseli", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_182besseli(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nu), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_182besseli(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besseli", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2781
 *         when :math:`\nu` is not integral).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2782
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2782, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2783
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2784
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ibessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2785
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ibessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2786
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ibessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ibessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2787
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ibessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselj(nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2774
 *         return new_gen(_ret)
 * 
 *     def besseli(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`I`-Bessel function of index :emphasis:`nu` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.besseli", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2789
 *         return new_gen(_ret)
 * 
 *     def besselj(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of index :emphasis:`nu` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_185besselj(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_184besselj[] = "\n        :math:`J`-Bessel function of index :emphasis:`nu` and\n        argument :math:`x`. If :math:`x` converts to a power series, the initial factor\n        :math:`(x/2)^\\nu/\\Gamma (\\nu+1)` is omitted (since it cannot be represented in PARI\n        when :math:`\\nu` is not integral).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_185besselj(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselj") < 0)) __PYX_ERR(10, 2789, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2789, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselj", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2789, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_184besselj(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nu), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_184besselj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselj", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2796
 *         when :math:`\nu` is not integral).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2797
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2797, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2798
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2799
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2800
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jbessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2801
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jbessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2802
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besseljh(n, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2789
 *         return new_gen(_ret)
 * 
 *     def besselj(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of index :emphasis:`nu` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2804
 *         return new_gen(_ret)
 * 
 *     def besseljh(n, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of half integral index.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_187besseljh(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_186besseljh[] = "\n        :math:`J`-Bessel function of half integral index.\n        More precisely, :math:`besseljh (n,x)` computes :math:`J_{n+1/2}(x)` where :math:`n`\n        must be of type integer, and :math:`x` is any element of :math:`\\mathbb{C}`. In the\n        present version :strong:`2.11.3`, this function is not very accurate when :math:`x` is small.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_187besseljh(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besseljh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besseljh") < 0)) __PYX_ERR(10, 2804, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2804, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besseljh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2804, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.besseljh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_186besseljh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_186besseljh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__n;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besseljh", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2811
 *         present version :strong:`2.11.3`, this function is not very accurate when :math:`x` is small.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2812
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2812, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2813
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2814
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbesselh(_n, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2815
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jbesselh(_n, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2816
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbesselh(_n, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jbesselh(__pyx_v__n, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2817
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jbesselh(_n, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besselk(nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2804
 *         return new_gen(_ret)
 * 
 *     def besseljh(n, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`J`-Bessel function of half integral index.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.besseljh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2819
 *         return new_gen(_ret)
 * 
 *     def besselk(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_189besselk(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_188besselk[] = "\n        :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_189besselk(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselk") < 0)) __PYX_ERR(10, 2819, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2819, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselk", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2819, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_188besselk(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nu), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_188besselk(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besselk", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2823
 *         :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2824
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2824, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2825
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2826
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = kbessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2827
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = kbessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2828
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = kbessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = kbessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2829
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = kbessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def besseln(nu, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2819
 *         return new_gen(_ret)
 * 
 *     def besselk(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`K`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.besselk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2831
 *         return new_gen(_ret)
 * 
 *     def besseln(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_191besseln(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_190besseln[] = "\n        :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_191besseln(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besseln (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besseln") < 0)) __PYX_ERR(10, 2831, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2831, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besseln", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2831, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.besseln", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_190besseln(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nu), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_190besseln(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nu, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__nu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("besseln", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":2835
 *         :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2836
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 2836, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2837
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu)->__pyx_base.g;
  __pyx_v__nu = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2838
 *         sig_on()
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nbessel(_nu, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":2839
 *         cdef GEN _nu = (<Gen>nu).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nbessel(_nu, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":2840
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nbessel(_nu, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nbessel(__pyx_v__nu, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":2841
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nbessel(_nu, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bestappr(x, B=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2831
 *         return new_gen(_ret)
 * 
 *     def besseln(nu, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N`-Bessel function of index :emphasis:`nu` and argument :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.besseln", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2843
 *         return new_gen(_ret)
 * 
 *     def bestappr(x, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm, returns a rational
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_193bestappr(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_192bestappr[] = "\n        Using variants of the extended Euclidean algorithm, returns a rational\n        approximation :math:`a/b` to :math:`x`, whose denominator is limited\n        by :math:`B`, if present. If :math:`B` is omitted, return the best approximation\n        affordable given the input accuracy; if you are looking for true rational\n        numbers, presumably approximated to sufficient accuracy, you should first\n        try that option. Otherwise, :math:`B` must be a positive real scalar (impose\n        :math:`0 < b <= B`).\n        \n        - If :math:`x` is a :literal:`t_REAL` or a :literal:`t_FRAC`, this function uses continued\n          fractions.\n        \n        ::\n        \n            ? bestappr(Pi, 100)\n            %1 = 22/7\n            ? bestappr(0.1428571428571428571428571429)\n            %2 = 1/7\n            ? bestappr([Pi, sqrt(2) + 'x], 10^3)\n            %3 = [355/113, x + 1393/985]\n        \n        By definition, :math:`a/b` is the best rational approximation to :math:`x` if\n        :math:`\\|b x - a\\| < \\|v x - u\\|` for all integers :math:`(u,v)` with :math:`0 < v <= B`.\n        (Which implies that :math:`n/d` is a convergent of the continued fraction of :math:`x`.)\n        \n        - If :math:`x` is a :literal:`t_INTMOD` modulo :math:`N` or a :literal:`t_PADIC` of precision :math:`N =\n          p^k`, this function performs rational modular reconstruction modulo :math:`N`. The\n          routine then returns the unique rational number :math:`a/b` in coprime integers\n          :math:`\\|a\\| < N/2B` and :math:`b <= B` which is congruent to :math:`x` modulo :math:`N`. Omitting\n          :math:`B` amounts to choosing it of the order of :math:`\\sqrt{N/2}`. If rational\n          reconstruction is not possible (no suitable :math:`a/b` exists), returns :math:`[]`.\n        \n        ::\n        \n            ? bestappr(Mod(18526731858, 11^10))\n            %1 = 1/7\n            ? bestappr(Mod(18526731858, 11^20))\n            %2 = [""]\n            ? bestappr(3 + 5 + 3*5^2 + 5^3 + 3*5^4 + 5^5 + 3*5^6 + O(5^7))\n            %2 = -1/3\n        \n        In most concrete uses, :math:`B` is a prime power and we performed\n        Hensel lifting to obtain :math:`x`.\n        \n        The function applies recursively to components of complex objects\n        (polynomials, vectors,...). If rational reconstruction fails for even a\n        single entry, return :math:`[]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_193bestappr(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bestappr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bestappr") < 0)) __PYX_ERR(10, 2843, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bestappr", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bestappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_192bestappr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_192bestappr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_B) {
  int __pyx_v__have_B;
  GEN __pyx_v__x;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bestappr", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":2892
 *         single entry, return :math:`[]`.
 *         '''
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_1 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_1;

  /* "cypari/auto_gen.pxi":2893
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":2894
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 2894, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":2893
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":2895
 *         if _have_B:
 *             B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 2895, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2896
 *             B = objtogen(B)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":2897
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_gen.pxi":2898
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":2899
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bestappr(_x, _B)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_gen.pxi":2898
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)
 */
  }

  /* "cypari/auto_gen.pxi":2900
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bestappr(__pyx_v__x, __pyx_v__B);

  /* "cypari/auto_gen.pxi":2901
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = bestappr(_x, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bestapprPade(x, long B=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 2901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2843
 *         return new_gen(_ret)
 * 
 *     def bestappr(x, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm, returns a rational
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bestappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2903
 *         return new_gen(_ret)
 * 
 *     def bestapprPade(x, long B=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm (Pad
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_195bestapprPade(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_194bestapprPade[] = "\n        Using variants of the extended Euclidean algorithm (Pad\303\251\n        approximants), returns a rational\n        function approximation :math:`a/b` to :math:`x`, whose denominator is limited\n        by :math:`B`, if present. If :math:`B` is omitted, return the best approximation\n        affordable given the input accuracy; if you are looking for true rational\n        functions, presumably approximated to sufficient accuracy, you should first\n        try that option. Otherwise, :math:`B` must be a non-negative real\n        (impose :math:`0 <= degree(b) <= B`).\n        \n        - If :math:`x` is a :literal:`t_POLMOD` modulo :math:`N` this function performs rational\n          modular reconstruction modulo :math:`N`. The routine then returns the unique\n          rational function :math:`a/b` in coprime polynomials, with :math:`degree(b) <= B`\n          and :math:`degree(a)` minimal, which is congruent to :math:`x` modulo :math:`N`.\n          Omitting :math:`B` amounts to choosing it equal to the floor of\n          :math:`degree(N) / 2`. If rational reconstruction is not possible (no\n          suitable :math:`a/b` exists), returns :math:`[]`.\n        \n        ::\n        \n            ? T = Mod(x^3 + x^2 + x + 3, x^4 - 2);\n            ? bestapprPade(T)\n            %2 = (2*x - 1)/(x - 1)\n            ? U = Mod(1 + x + x^2 + x^3 + x^5, x^9);\n            ? bestapprPade(U) \\\\ internally chooses B = 4\n            %3 = []\n            ? bestapprPade(U, 5) \\\\ with B = 5, a solution exists\n            %4 = (2*x^4 + x^3 - x - 1)/(-x^5 + x^3 + x^2 - 1)\n        \n        - If :math:`x` is a :literal:`t_SER`, we implicitly\n          convert the input to a :literal:`t_POLMOD` modulo :math:`N = t^k` where :math:`k` is the\n          series absolute precision.\n        \n        ::\n        \n            ? T = 1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + O(t^7); \\\\ mod t^7\n            ? bestapprPade(T)\n            %1 = 1/(-t + 1)\n        \n        -"" If :math:`x` is a :literal:`t_RFRAC`, we implicitly convert the input to a\n          :literal:`t_POLMOD` modulo :math:`N = t^k` where :math:`k = 2B + 1`. If :math:`B` was omitted,\n          we return :math:`x`:\n        \n        ::\n        \n            ? T = (4*t^2 + 2*t + 3)/(t+1)^10;\n            ? bestapprPade(T,1)\n            %2 = [] \\\\ impossible\n            ? bestapprPade(T,2)\n            %3 = 27/(337*t^2 + 84*t + 9)\n            ? bestapprPade(T,3)\n            %4 = (4253*t - 3345)/(-39007*t^3 - 28519*t^2 - 8989*t - 1115)\n        \n        The function applies recursively to components of complex objects\n        (polynomials, vectors,...). If rational reconstruction fails for even a\n        single entry, return :math:`[]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_195bestapprPade(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_B;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bestapprPade (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bestapprPade") < 0)) __PYX_ERR(10, 2903, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_B = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_B == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2903, __pyx_L3_error)
    } else {
      __pyx_v_B = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bestapprPade", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2903, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bestapprPade", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_194bestapprPade(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_194bestapprPade(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_B) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bestapprPade", 0);

  /* "cypari/auto_gen.pxi":2961
 *         single entry, return :math:`[]`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bestapprPade(_x, B)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 2961, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":2962
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bestapprPade(_x, B)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2963
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bestapprPade(_x, B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bestapprPade(__pyx_v__x, __pyx_v_B);

  /* "cypari/auto_gen.pxi":2964
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bestapprPade(_x, B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bestapprnf(V, T, rootT=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 2964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2903
 *         return new_gen(_ret)
 * 
 *     def bestapprPade(x, long B=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Using variants of the extended Euclidean algorithm (Pad
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bestapprPade", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":2966
 *         return new_gen(_ret)
 * 
 *     def bestapprnf(V, T, rootT=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being an integral polynomial and :math:`V` being a scalar, vector, or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_197bestapprnf(PyObject *__pyx_v_V, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_196bestapprnf[] = "\n        :math:`T` being an integral polynomial and :math:`V` being a scalar, vector, or\n        matrix with complex coefficients, return a reasonable approximation of :math:`V`\n        with polmods modulo :math:`T`. :math:`T` can also be any number field structure, in which\n        case the minimal polynomial attached to the structure (:literal:`:math:`T``.pol) is\n        used. The :emphasis:`rootT` argument, if present, must be an element of\n        :literal:`polroots(:math:`T`)` (or :literal:`:math:`T``.pol), i.e.\302\240a complex root of :math:`T` fixing an embedding of\n        :math:`\\mathbb{Q}[x]/(T)` into :math:`\\mathbb{C}`.\n        \n        ::\n        \n            ? bestapprnf(sqrt(5), polcyclo(5))\n            %1 = Mod(-2*x^3 - 2*x^2 - 1, x^4 + x^3 + x^2 + x + 1)\n            ? bestapprnf(sqrt(5), polcyclo(5), exp(4*I*Pi/5))\n            %2 = Mod(2*x^3 + 2*x^2 + 1, x^4 + x^3 + x^2 + x + 1)\n        \n        When the output has huge rational coefficients, try to\n        increase the working :literal:`realbitprecision`: if the answer does not\n        stabilize, consider that the reconstruction failed.\n        Beware that if :math:`T` is not Galois over :math:`\\mathbb{Q}`, some embeddings\n        may not allow to reconstruct :math:`V`:\n        \n        ::\n        \n            ? T = x^3-2; vT = polroots(T); z = 3*2^(1/3)+1;\n            ? bestapprnf(z, T, vT[1])\n            %2 = Mod(3*x + 1, x^3 - 2)\n            ? bestapprnf(z, T, vT[2])\n            %3 = 4213714286230872/186454048314072 \\\\ close to 3*2^(1/3) + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_197bestapprnf(PyObject *__pyx_v_V, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_rootT = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bestapprnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_rootT,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rootT);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bestapprnf") < 0)) __PYX_ERR(10, 2966, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    __pyx_v_rootT = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 2966, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bestapprnf", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 2966, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bestapprnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_196bestapprnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_V), __pyx_v_T, __pyx_v_rootT, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_196bestapprnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_V, PyObject *__pyx_v_T, PyObject *__pyx_v_rootT, long __pyx_v_precision) {
  int __pyx_v__have_rootT;
  GEN __pyx_v__V;
  GEN __pyx_v__T;
  GEN __pyx_v__rootT;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bestapprnf", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_rootT);

  /* "cypari/auto_gen.pxi":2997
 *             %3 = 4213714286230872/186454048314072 \\ close to 3*2^(1/3) + 1
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 2997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":2998
 *         '''
 *         T = objtogen(T)
 *         cdef bint _have_rootT = (rootT is not None)             # <<<<<<<<<<<<<<
 *         if _have_rootT:
 *             rootT = objtogen(rootT)
 */
  __pyx_t_2 = (__pyx_v_rootT != Py_None);
  __pyx_v__have_rootT = __pyx_t_2;

  /* "cypari/auto_gen.pxi":2999
 *         T = objtogen(T)
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             rootT = objtogen(rootT)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_rootT != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":3000
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:
 *             rootT = objtogen(rootT)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _V = (<Gen>V).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rootT, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3000, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_rootT, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":2999
 *         T = objtogen(T)
 *         cdef bint _have_rootT = (rootT is not None)
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             rootT = objtogen(rootT)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":3001
 *         if _have_rootT:
 *             rootT = objtogen(rootT)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 3001, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3002
 *             rootT = objtogen(rootT)
 *         sig_on()
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3003
 *         sig_on()
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3004
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL             # <<<<<<<<<<<<<<
 *         if _have_rootT:
 *             _rootT = (<Gen>rootT).g
 */
  __pyx_v__rootT = NULL;

  /* "cypari/auto_gen.pxi":3005
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_rootT != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":3006
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:
 *             _rootT = (<Gen>rootT).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rootT)->__pyx_base.g;
    __pyx_v__rootT = __pyx_t_4;

    /* "cypari/auto_gen.pxi":3005
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _rootT = NULL
 *         if _have_rootT:             # <<<<<<<<<<<<<<
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":3007
 *         if _have_rootT:
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":3008
 *             _rootT = (<Gen>rootT).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bestapprnf(__pyx_v__V, __pyx_v__T, __pyx_v__rootT, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":3009
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bestapprnf(_V, _T, _rootT, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bezout(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":2966
 *         return new_gen(_ret)
 * 
 *     def bestapprnf(V, T, rootT=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being an integral polynomial and :math:`V` being a scalar, vector, or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bestapprnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_rootT);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3011
 *         return new_gen(_ret)
 * 
 *     def bezout(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`gcdext`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_199bezout(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_198bezout[] = "\n        Deprecated alias for :literal:`gcdext`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_199bezout(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bezout (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_198bezout(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_198bezout(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bezout", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":3015
 *         Deprecated alias for :literal:`gcdext`
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)
 *         y = objtogen(y)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3015, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":3016
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":3017
 *         from warnings import warn
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":3018
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 3018, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3019
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3020
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3021
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcdext0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":3022
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bezoutres(A, B, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3011
 *         return new_gen(_ret)
 * 
 *     def bezout(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`gcdext`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bezout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3024
 *         return new_gen(_ret)
 * 
 *     def bezoutres(A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`polresultantext`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_201bezoutres(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_200bezoutres[] = "\n        Deprecated alias for :literal:`polresultantext`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_201bezoutres(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bezoutres (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_B)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bezoutres") < 0)) __PYX_ERR(10, 3024, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bezoutres", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3024, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bezoutres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_200bezoutres(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_B, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_200bezoutres(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v) {
  PyObject *__pyx_v_warn = NULL;
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  GEN __pyx_t_7;
  __Pyx_RefNannySetupContext("bezoutres", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":3028
 *         Deprecated alias for :literal:`polresultantext`
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)
 *         B = objtogen(B)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3028, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3028, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":3029
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         cdef long _v = -1
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":3030
 *         from warnings import warn
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":3031
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)
 *         B = objtogen(B)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":3032
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_v != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":3033
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_5 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_5 == ((long)-2L))) __PYX_ERR(10, 3033, __pyx_L1_error)
    __pyx_v__v = __pyx_t_5;

    /* "cypari/auto_gen.pxi":3032
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":3034
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(10, 3034, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3035
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 */
  __pyx_t_7 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_7;

  /* "cypari/auto_gen.pxi":3036
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_7 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_7;

  /* "cypari/auto_gen.pxi":3037
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polresultantext0(__pyx_v__A, __pyx_v__B, __pyx_v__v);

  /* "cypari/auto_gen.pxi":3038
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bigomega(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3024
 *         return new_gen(_ret)
 * 
 *     def bezoutres(A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`polresultantext`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bezoutres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3040
 *         return new_gen(_ret)
 * 
 *     def bigomega(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of prime divisors of the integer :math:`\|x\|` counted with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_203bigomega(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_202bigomega[] = "\n        Number of prime divisors of the integer :math:`\\|x\\|` counted with\n        multiplicity:\n        \n        ::\n        \n            ? factor(392)\n            %1 =\n            [2 3]\n            \n            [7 2]\n            \n            ? bigomega(392)\n            %2 = 5; \\\\ = 3+2\n            ? omega(392)\n            %3 = 2; \\\\ without multiplicity\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_203bigomega(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bigomega (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_202bigomega(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_202bigomega(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bigomega", 0);

  /* "cypari/auto_gen.pxi":3058
 *             %3 = 2; \\ without multiplicity
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = bigomega(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3058, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3059
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bigomega(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3060
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = bigomega(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bigomega(__pyx_v__x);

  /* "cypari/auto_gen.pxi":3061
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = bigomega(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":3062
 *         cdef long _ret = bigomega(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def binary(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3040
 *         return new_gen(_ret)
 * 
 *     def bigomega(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of prime divisors of the integer :math:`\|x\|` counted with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bigomega", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3064
 *         return _ret
 * 
 *     def binary(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the binary digits of :math:`\|x\|`. Here :math:`x` can be an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_205binary(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_204binary[] = "\n        Outputs the vector of the binary digits of :math:`\\|x\\|`. Here :math:`x` can be an\n        integer, a real number (in which case the result has two components, one for\n        the integer part, one for the fractional part) or a vector/matrix.\n        \n        ::\n        \n            ? binary(10)\n            %1 = [1, 0, 1, 0]\n            \n            ? binary(3.14)\n            %2 = [[1, 1], [0, 0, 1, 0, 0, 0, [...]]\n            \n            ? binary([1,2])\n            %3 = [[1], [1, 0]]\n        \n        By convention, :math:`0` has no digits:\n        \n        ::\n        \n            ? binary(0)\n            %4 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_205binary(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("binary (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_204binary(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_204binary(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("binary", 0);

  /* "cypari/auto_gen.pxi":3088
 *             %4 = []
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = binaire(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3088, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3089
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = binaire(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3090
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = binaire(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = binaire(__pyx_v__x);

  /* "cypari/auto_gen.pxi":3091
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = binaire(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def binomial(x, k=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3064
 *         return _ret
 * 
 *     def binary(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the binary digits of :math:`\|x\|`. Here :math:`x` can be an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.binary", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3093
 *         return new_gen(_ret)
 * 
 *     def binomial(x, k=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         binomial coefficient :math:`binom{x}{k}`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_207binomial(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_206binomial[] = "\n        binomial coefficient :math:`binom{x}{k}`.\n        Here :math:`k` must be an integer, but :math:`x` can be any PARI object.\n        \n        ::\n        \n            ? binomial(4,2)\n            %1 = 6\n            ? n = 4; vector(n+1, k, binomial(n,k-1))\n            %2 = [1, 4, 6, 4, 1]\n        \n        The argument :math:`k` may be omitted if :math:`x = n` is a\n        non-negative integer; in this case, return the vector with :math:`n+1`\n        components whose :math:`k+1`-th entry is :literal:`binomial`:math:`(n,k)`\n        \n        ::\n        \n            ? binomial(4)\n            %3 = [1, 4, 6, 4, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_207binomial(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("binomial (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "binomial") < 0)) __PYX_ERR(10, 3093, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("binomial", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3093, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.binomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_206binomial(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_k);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_206binomial(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_k) {
  int __pyx_v__have_k;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("binomial", 0);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_gen.pxi":3114
 *             %3 = [1, 4, 6, 4, 1]
 *         '''
 *         cdef bint _have_k = (k is not None)             # <<<<<<<<<<<<<<
 *         if _have_k:
 *             k = objtogen(k)
 */
  __pyx_t_1 = (__pyx_v_k != Py_None);
  __pyx_v__have_k = __pyx_t_1;

  /* "cypari/auto_gen.pxi":3115
 *         '''
 *         cdef bint _have_k = (k is not None)
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             k = objtogen(k)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_k != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3116
 *         cdef bint _have_k = (k is not None)
 *         if _have_k:
 *             k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3116, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":3115
 *         '''
 *         cdef bint _have_k = (k is not None)
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             k = objtogen(k)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":3117
 *         if _have_k:
 *             k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 3117, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3118
 *             k = objtogen(k)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = NULL
 *         if _have_k:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3119
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL             # <<<<<<<<<<<<<<
 *         if _have_k:
 *             _k = (<Gen>k).g
 */
  __pyx_v__k = NULL;

  /* "cypari/auto_gen.pxi":3120
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)
 */
  __pyx_t_1 = (__pyx_v__have_k != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3121
 *         cdef GEN _k = NULL
 *         if _have_k:
 *             _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = binomial0(_x, _k)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
    __pyx_v__k = __pyx_t_4;

    /* "cypari/auto_gen.pxi":3120
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = NULL
 *         if _have_k:             # <<<<<<<<<<<<<<
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)
 */
  }

  /* "cypari/auto_gen.pxi":3122
 *         if _have_k:
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = binomial0(__pyx_v__x, __pyx_v__k);

  /* "cypari/auto_gen.pxi":3123
 *             _k = (<Gen>k).g
 *         cdef GEN _ret = binomial0(_x, _k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitand(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3093
 *         return new_gen(_ret)
 * 
 *     def binomial(x, k=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         binomial coefficient :math:`binom{x}{k}`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.binomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3125
 *         return new_gen(_ret)
 * 
 *     def bitand(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise :literal:`and`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_209bitand(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_208bitand[] = "\n        Bitwise :literal:`and`\n        of two integers :math:`x` and :math:`y`, that is the integer\n        \n        .. MATH::\n        \n            \\sum_i (x_i\302\240and\302\240y_i) 2^i\n        \n        Negative numbers behave :math:`2`-adically, i.e.\302\240the result is the :math:`2`-adic limit\n        of :literal:`bitand`:math:`(x_n,y_n)`, where :math:`x_n` and :math:`y_n` are non-negative integers\n        tending to :math:`x` and :math:`y` respectively. (The result is an ordinary integer,\n        possibly negative.)\n        \n        ::\n        \n            ? bitand(5, 3)\n            %1 = 1\n            ? bitand(-5, 3)\n            %2 = 3\n            ? bitand(-5, -3)\n            %3 = -7\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_209bitand(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitand (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_208bitand(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_208bitand(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitand", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":3148
 *             %3 = -7
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3149
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3149, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3150
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitand(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3151
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitand(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3152
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitand(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitand(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":3153
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitand(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitneg(x, long n=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3125
 *         return new_gen(_ret)
 * 
 *     def bitand(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise :literal:`and`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3155
 *         return new_gen(_ret)
 * 
 *     def bitneg(x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise negation of an integer :math:`x`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_211bitneg(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_210bitneg[] = "\n        bitwise negation of an integer :math:`x`,\n        truncated to :math:`n` bits, :math:`n >= 0`, that is the integer\n        \n        .. MATH::\n        \n            \\sum_{i = 0}^{n-1} not (x_i) 2^i.\n        \n        The special case :math:`n = -1` means no truncation: an infinite sequence of\n        leading :math:`1` is then represented as a negative number.\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_211bitneg(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitneg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitneg") < 0)) __PYX_ERR(10, 3155, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3155, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitneg", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3155, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_210bitneg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_210bitneg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bitneg", 0);

  /* "cypari/auto_gen.pxi":3169
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbitneg(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3169, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3170
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitneg(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3171
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbitneg(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitneg(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":3172
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbitneg(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitnegimply(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3155
 *         return new_gen(_ret)
 * 
 *     def bitneg(x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise negation of an integer :math:`x`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3174
 *         return new_gen(_ret)
 * 
 *     def bitnegimply(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise negated imply of two integers :math:`x` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_213bitnegimply(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_212bitnegimply[] = "\n        Bitwise negated imply of two integers :math:`x` and\n        :math:`y` (or :literal:`not` :math:`(x ==> y)`), that is the integer \n        \n        .. MATH::\n        \n            \\sum\n            (x_i\302\240and not (y_i)) 2^i\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_213bitnegimply(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitnegimply (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_212bitnegimply(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_212bitnegimply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitnegimply", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":3186
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3187
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3187, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3188
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitnegimply(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3189
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitnegimply(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3190
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitnegimply(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitnegimply(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":3191
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitnegimply(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitor(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3174
 *         return new_gen(_ret)
 * 
 *     def bitnegimply(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise negated imply of two integers :math:`x` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitnegimply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3193
 *         return new_gen(_ret)
 * 
 *     def bitor(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise (inclusive)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_215bitor(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_214bitor[] = "\n        bitwise (inclusive)\n        :literal:`or` of two integers :math:`x` and :math:`y`, that is the integer \n        \n        .. MATH::\n        \n            \\sum\n            (x_i\302\240or\302\240y_i) 2^i\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_215bitor(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_214bitor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_214bitor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitor", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":3205
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3206
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3206, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3207
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitor(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3208
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitor(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3209
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitor(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitor(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":3210
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitor(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitprecision(x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3193
 *         return new_gen(_ret)
 * 
 *     def bitor(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         bitwise (inclusive)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3212
 *         return new_gen(_ret)
 * 
 *     def bitprecision(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_217bitprecision(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_216bitprecision[] = "\n        The function behaves differently according to whether :math:`n` is\n        present and positive or not. If :math:`n` is missing, the function returns the\n        (floating point) precision in bits of the PARI object :math:`x`. If :math:`x` is an\n        exact object, the function returns :literal:`+oo`.\n        \n        ::\n        \n            ? bitprecision(exp(1e-100))\n            %1 = 512 \\\\ 512 bits\n            ? bitprecision( [ exp(1e-100), 0.5 ] )\n            %2 = 128 \\\\ minimal accuracy among components\n            ? bitprecision(2 + x)\n            %3 = +oo \\\\ exact object\n        \n        If :math:`n` is present and positive, the function creates a new object equal to :math:`x`\n        with the new bit-precision roughly :math:`n`. In fact, the smallest multiple of 64\n        (resp.\302\24032 on a 32-bit machine) larger than or equal to :math:`n`.\n        \n        For :math:`x` a vector or a matrix, the operation is\n        done componentwise; for series and polynomials, the operation is done\n        coefficientwise. For real :math:`x`, :math:`n` is the number of desired significant\n        :emphasis:`bits`. If :math:`n` is smaller than the precision of :math:`x`, :math:`x` is truncated,\n        otherwise :math:`x` is extended with zeros. For exact or non-floating point types,\n        no change.\n        \n        ::\n        \n            ? bitprecision(Pi, 10) \\\\ actually 64 bits ~ 19 decimal digits\n            %1 = 3.141592653589793239\n            ? bitprecision(1, 10)\n            %2 = 1\n            ? bitprecision(1 + O(x), 10)\n            %3 = 1 + O(x)\n            ? bitprecision(2 + O(3^5), 10)\n            %4 = 2 + O(3^5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_217bitprecision(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitprecision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bitprecision") < 0)) __PYX_ERR(10, 3212, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3212, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bitprecision", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3212, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitprecision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_216bitprecision(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_216bitprecision(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bitprecision", 0);

  /* "cypari/auto_gen.pxi":3250
 *             %4 = 2 + O(3^5)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bitprecision0(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3250, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3251
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bitprecision0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3252
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bitprecision0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bitprecision0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":3253
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bitprecision0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bittest(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3212
 *         return new_gen(_ret)
 * 
 *     def bitprecision(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitprecision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3255
 *         return new_gen(_ret)
 * 
 *     def bittest(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the :math:`n-th` bit of :math:`x` starting
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_219bittest(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_218bittest[] = "\n        Outputs the :math:`n-th` bit of :math:`x` starting\n        from the right (i.e.\302\240the coefficient of :math:`2^n` in the binary expansion of :math:`x`).\n        The result is 0 or 1.\n        \n        ::\n        \n            ? bittest(7, 0)\n            %1 = 1 \\\\ the bit 0 is 1\n            ? bittest(7, 2)\n            %2 = 1 \\\\ the bit 2 is 1\n            ? bittest(7, 3)\n            %3 = 0 \\\\ the bit 3 is 0\n        \n        See ``bitand`` (in the PARI manual) for the behavior at negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_219bittest(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bittest (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3255, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bittest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_218bittest(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_218bittest(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bittest", 0);

  /* "cypari/auto_gen.pxi":3272
 *         See ``bitand`` (in the PARI manual) for the behavior at negative arguments.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbittest(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3272, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3273
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbittest(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3274
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbittest(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbittest(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":3275
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gbittest(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bitxor(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3255
 *         return new_gen(_ret)
 * 
 *     def bittest(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the :math:`n-th` bit of :math:`x` starting
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bittest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3277
 *         return new_gen(_ret)
 * 
 *     def bitxor(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise (exclusive) :literal:`or`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_221bitxor(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_220bitxor[] = "\n        Bitwise (exclusive) :literal:`or`\n        of two integers :math:`x` and :math:`y`, that is the integer\n        \n        .. MATH::\n        \n            \\sum (x_i\302\240xor\302\240y_i) 2^i\n        \n        See ``bitand`` (in the PARI manual) for the behavior for negative arguments.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_221bitxor(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitxor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_220bitxor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_220bitxor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bitxor", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":3288
 *         See ``bitand`` (in the PARI manual) for the behavior for negative arguments.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3289
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3289, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3290
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitxor(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3291
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gbitxor(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3292
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitxor(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gbitxor(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":3293
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gbitxor(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfcertify(bnf, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3277
 *         return new_gen(_ret)
 * 
 *     def bitxor(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Bitwise (exclusive) :literal:`or`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bitxor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3295
 *         return new_gen(_ret)
 * 
 *     def bnfcertify(bnf, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_223bnfcertify(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_222bnfcertify[] = "\n        :math:`bnf` being as output by\n        :literal:`bnfinit`, checks whether the result is correct, i.e.\302\240whether it is\n        possible to remove the assumption of the Generalized Riemann\n        Hypothesis. It is correct if and only if the answer is 1. If it is\n        incorrect, the program may output some error message, or loop indefinitely.\n        You can check its progress by increasing the debug level. The :emphasis:`bnf`\n        structure must contain the fundamental units:\n        \n        ::\n        \n            ? K = bnfinit(x^3+2^2^3+1); bnfcertify(K)\n             *** at top-level: K=bnfinit(x^3+2^2^3+1);bnfcertify(K)\n             *** ^-------------\n             *** bnfcertify: missing units in bnf.\n            ? K = bnfinit(x^3+2^2^3+1, 1); \\\\ include units\n            ? bnfcertify(K)\n            %3 = 1\n        \n        If flag is present, only certify that the class group is a quotient of the\n        one computed in bnf (much simpler in general); likewise, the computed units\n        may form a subgroup of the full unit group. In this variant, the units are\n        no longer needed:\n        \n        ::\n        \n            ? K = bnfinit(x^3+2^2^3+1); bnfcertify(K, 1)\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_223bnfcertify(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfcertify (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfcertify") < 0)) __PYX_ERR(10, 3295, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3295, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfcertify", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3295, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfcertify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_222bnfcertify(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_222bnfcertify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bnfcertify", 0);

  /* "cypari/auto_gen.pxi":3325
 *             %4 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3325, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3326
 *         '''
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3327
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef long _ret = bnfcertify0(_bnf, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bnfcertify0(__pyx_v__bnf, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":3328
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":3329
 *         cdef long _ret = bnfcertify0(_bnf, flag)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def bnfcompress(bnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3295
 *         return new_gen(_ret)
 * 
 *     def bnfcertify(bnf, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfcertify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3331
 *         return _ret
 * 
 *     def bnfcompress(bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a compressed version of :emphasis:`bnf` (from :literal:`bnfinit`), a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_225bnfcompress(PyObject *__pyx_v_bnf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_224bnfcompress[] = "\n        Computes a compressed version of :emphasis:`bnf` (from :literal:`bnfinit`), a\n        \"small Buchmann's number field\" (or :emphasis:`sbnf` for short) which contains\n        enough information to recover a full :math:`bnf` vector very rapidly, but\n        which is much smaller and hence easy to store and print. Calling\n        :literal:`bnfinit` on the result recovers a true :literal:`bnf`, in general different\n        from the original. Note that an :emphasis:`snbf` is useless for almost all\n        purposes besides storage, and must be converted back to :emphasis:`bnf` form\n        before use; for instance, no :literal:`nf*`, :literal:`bnf*` or member function\n        accepts them.\n        \n        An :emphasis:`sbnf` is a 12 component vector :math:`v`, as follows. Let :literal:`bnf` be\n        the result of a full :literal:`bnfinit`, complete with units. Then :math:`v[1]` is\n        :literal:`bnf.pol`, :math:`v[2]` is the number of real embeddings :literal:`bnf.sign[1]`,\n        :math:`v[3]` is :literal:`bnf.disc`, :math:`v[4]` is :literal:`bnf.zk`, :math:`v[5]` is the list of roots\n        :literal:`bnf.roots`, :math:`v[7]` is the matrix :math:`W = bnf[1]`,\n        :math:`v[8]` is the matrix :math:`matalpha = bnf[2]`,\n        :math:`v[9]` is the prime ideal factor base :literal:`bnf[5]` coded in a compact way,\n        and ordered according to the permutation :literal:`bnf[6]`, :math:`v[10]` is the\n        2-component vector giving the number of roots of unity and a generator,\n        expressed on the integral basis, :math:`v[11]` is the list of fundamental units,\n        expressed on the integral basis, :math:`v[12]` is a vector containing the algebraic\n        numbers alpha corresponding to the columns of the matrix :literal:`matalpha`,\n        expressed on the integral basis.\n        \n        All the components are exact (integral or rational), except for the roots in\n        :math:`v[5]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_225bnfcompress(PyObject *__pyx_v_bnf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfcompress (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_224bnfcompress(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_224bnfcompress(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bnfcompress", 0);

  /* "cypari/auto_gen.pxi":3360
 *         :math:`v[5]`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfcompress(_bnf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3360, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3361
 *         '''
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfcompress(_bnf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3362
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfcompress(_bnf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfcompress(__pyx_v__bnf);

  /* "cypari/auto_gen.pxi":3363
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfcompress(_bnf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfdecodemodule(nf, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3331
 *         return _ret
 * 
 *     def bnfcompress(bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a compressed version of :emphasis:`bnf` (from :literal:`bnfinit`), a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfcompress", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3365
 *         return new_gen(_ret)
 * 
 *     def bnfdecodemodule(nf, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`m` is a module as output in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_227bnfdecodemodule(PyObject *__pyx_v_nf, PyObject *__pyx_v_m); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_226bnfdecodemodule[] = "\n        If :math:`m` is a module as output in the\n        first component of an extension given by :literal:`bnrdisclist`, outputs the\n        true module.\n        \n        ::\n        \n            ? K = bnfinit(x^2+23); L = bnrdisclist(K, 10); s = L[2]\n            %1 = [[[Vecsmall([8]), Vecsmall([1])], [[0, 0, 0]]],\n             [[Vecsmall([9]), Vecsmall([1])], [[0, 0, 0]]]]\n            ? bnfdecodemodule(K, s[1][1])\n            %2 =\n            [2 0]\n            \n            [0 1]\n            ? bnfdecodemodule(K,s[2][1])\n            %3 =\n            [2 1]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_227bnfdecodemodule(PyObject *__pyx_v_nf, PyObject *__pyx_v_m) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfdecodemodule (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_226bnfdecodemodule(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_m));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_226bnfdecodemodule(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_m) {
  GEN __pyx_v__nf;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfdecodemodule", 0);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_gen.pxi":3387
 *             [0 1]
 *         '''
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3388
 *         '''
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3388, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3389
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = decodemodule(_nf, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3390
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = decodemodule(_nf, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3391
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = decodemodule(_nf, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = decodemodule(__pyx_v__nf, __pyx_v__m);

  /* "cypari/auto_gen.pxi":3392
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = decodemodule(_nf, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfinit(P, long flag=0, tech=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3365
 *         return new_gen(_ret)
 * 
 *     def bnfdecodemodule(nf, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`m` is a module as output in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfdecodemodule", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3394
 *         return new_gen(_ret)
 * 
 *     def bnfinit(P, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_229bnfinit(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_228bnfinit[] = "\n        Initializes a\n        :literal:`bnf` structure. Used in programs such as :literal:`bnfisprincipal`,\n        :literal:`bnfisunit` or :literal:`bnfnarrow`. By default, the results are conditional\n        on the GRH, see ``GRHbnf`` (in the PARI manual). The result is a\n        10-component vector :emphasis:`bnf`.\n        \n        This implements Buchmann's sub-exponential algorithm for computing the\n        class group, the regulator and a system of fundamental units of the\n        general algebraic number field :math:`K` defined by the irreducible polynomial :math:`P`\n        with integer coefficients.\n        \n        If the precision becomes insufficient, :literal:`gp` does not strive to compute\n        the units by default (:math:`flag = 0`).\n        \n        When :math:`flag = 1`, we insist on finding the fundamental units exactly. Be\n        warned that this can take a very long time when the coefficients of the\n        fundamental units on the integral basis are very large. If the fundamental\n        units are simply too large to be represented in this form, an error message\n        is issued. They could be obtained using the so-called compact representation\n        of algebraic numbers as a formal product of algebraic integers. The latter is\n        implemented internally but not publicly accessible yet.\n        \n        :math:`tech` is a technical vector (empty by default, see ``GRHbnf`` (in the PARI manual)).\n        Careful use of this parameter may speed up your computations,\n        but it is mostly obsolete and you should leave it alone.\n        \n        The components of a :emphasis:`bnf` or :emphasis:`sbnf` are technical and never used by\n        the casual user. In fact: :emphasis:`never access a component directly, always use\n        a proper member function.` However, for the sake of completeness and internal\n        documentation, their description is as follows. We use the notations\n        explained in the b""ook by H. Cohen, :emphasis:`A Course in Computational Algebraic\n        Number Theory`, Graduate Texts in Maths :strong:`138`, Springer-Verlag, 1993,\n        Section 6.5, and subsection 6.5.5 in particular.\n        \n        :math:`bnf[1]` contains the matrix :math:`W`, i.e.\302\240the matrix in Hermite normal\n        form giving relations for the class group on prime ideal generators\n        :math:`(p_i)_{1 <= i <= r}`.\n        \n        :math:`bnf[2]` contains the matrix :math:`B`, i.e.\302\240the matrix containing the\n        expressions of the prime ideal factorbase in terms of the :math:`p_i`.\n        It is an :math:`r x c` matrix.\n        \n        :math:`bnf[3]` contains the complex logarithmic embeddings of the system of\n        fundamental units which has been found. It is an :math:`(r_1+r_2) x (r_1+r_2-1)`\n        matrix.\n        \n        :math:`bnf[4]` contains the matrix :math:`M\"_C` of Archimedean components of the\n        relations of the matrix :math:`(W\\|B)`.\n        \n        :math:`bnf[5]` contains the prime factor base, i.e.\302\240the list of prime\n        ideals used in finding the relations.\n        \n        :math:`bnf[6]` used to contain a permutation of the prime factor base, but\n        has been obsoleted. It contains a dummy :math:`0`.\n        \n        :math:`bnf[7]` or :literal:`:emphasis:`bnf`.nf` is equal to the number field data\n        :math:`nf` as would be given by :literal:`nfinit`.\n        \n        :math:`bnf[8]` is a vector containing the classgroup :literal:`:emphasis:`bnf`.clgp`\n        as a finite abelian group, the regulator :literal:`:emphasis:`bnf`.reg`, a :math:`1` (used to\n        contain an obsolete \"check number\"), the number of roots of unity and a\n        generator :literal:`:emphasis:`bnf`.tu`, the fundamental units :literal:`:emphasis:`bnf`.fu`.\n        \n        :math:`bnf[9]` is a 3-element row vector used in :literal:`bnfisprincipal` only\n        and obtained as follows. Let :math:""`D = U W V` obtained by applying the\n        Smith normal form algorithm to the matrix :math:`W` ( = :math:`bnf[1]`) and\n        let :math:`U_r` be the reduction of :math:`U` modulo :math:`D`. The first elements of the\n        factorbase are given (in terms of :literal:`bnf.gen`) by the columns of :math:`U_r`,\n        with Archimedean component :math:`g_a`; let also :math:`GD_a` be the Archimedean\n        components of the generators of the (principal) ideals defined by the\n        :literal:`bnf.gen[i]^bnf.cyc[i]`. Then :math:`bnf[9] = [U_r, g_a, GD_a]`.\n        \n        :math:`bnf[10]` is by default unused and set equal to 0. This field is used\n        to store further information about the field as it becomes available, which\n        is rarely needed, hence would be too expensive to compute during the initial\n        :literal:`bnfinit` call. For instance, the generators of the principal ideals\n        :literal:`bnf.gen[i]^bnf.cyc[i]` (during a call to :literal:`bnrisprincipal`), or\n        those corresponding to the relations in :math:`W` and :math:`B` (when the :literal:`bnf`\n        internal precision needs to be increased).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_229bnfinit(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_tech = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_tech,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tech);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfinit") < 0)) __PYX_ERR(10, 3394, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3394, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_tech = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3394, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfinit", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3394, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_228bnfinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_P), __pyx_v_flag, __pyx_v_tech, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_228bnfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision) {
  int __pyx_v__have_tech;
  GEN __pyx_v__P;
  GEN __pyx_v__tech;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnfinit", 0);
  __Pyx_INCREF(__pyx_v_tech);

  /* "cypari/auto_gen.pxi":3476
 *         internal precision needs to be increased).
 *         '''
 *         cdef bint _have_tech = (tech is not None)             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             tech = objtogen(tech)
 */
  __pyx_t_1 = (__pyx_v_tech != Py_None);
  __pyx_v__have_tech = __pyx_t_1;

  /* "cypari/auto_gen.pxi":3477
 *         '''
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_tech != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3478
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:
 *             tech = objtogen(tech)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tech, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3478, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_tech, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":3477
 *         '''
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":3479
 *         if _have_tech:
 *             tech = objtogen(tech)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 3479, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3480
 *             tech = objtogen(tech)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3481
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 */
  __pyx_v__tech = NULL;

  /* "cypari/auto_gen.pxi":3482
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_tech != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3483
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 *             _tech = (<Gen>tech).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tech)->__pyx_base.g;
    __pyx_v__tech = __pyx_t_4;

    /* "cypari/auto_gen.pxi":3482
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":3484
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":3485
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfinit0(__pyx_v__P, __pyx_v_flag, __pyx_v__tech, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":3486
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfinit0(_P, flag, _tech, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisintnorm(bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3394
 *         return new_gen(_ret)
 * 
 *     def bnfinit(P, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3488
 *         return new_gen(_ret)
 * 
 *     def bnfisintnorm(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a complete system of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_231bnfisintnorm(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_230bnfisintnorm[] = "\n        Computes a complete system of\n        solutions (modulo units of positive norm) of the absolute norm equation\n        :math:`\\mathrm{Norm} (a) = x`,\n        where :math:`a` is an integer in :math:`bnf`. If :math:`bnf` has not been certified,\n        the correctness of the result depends on the validity of GRH.\n        \n        See also :literal:`bnfisnorm`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_231bnfisintnorm(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisintnorm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_230bnfisintnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_230bnfisintnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisintnorm", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":3498
 *         See also :literal:`bnfisnorm`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3499
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3499, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3500
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3501
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3502
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisintnorm(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":3503
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisintnorm(_bnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisnorm(bnf, x, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3488
 *         return new_gen(_ret)
 * 
 *     def bnfisintnorm(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a complete system of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfisintnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3505
 *         return new_gen(_ret)
 * 
 *     def bnfisnorm(bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tries to tell whether the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_233bnfisnorm(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_232bnfisnorm[] = "\n        Tries to tell whether the\n        rational number :math:`x` is the norm of some element y in :math:`bnf`. Returns a\n        vector :math:`[a,b]` where :math:`x = Norm(a)*b`. Looks for a solution which is an :math:`S`-unit,\n        with :math:`S` a certain set of prime ideals containing (among others) all primes\n        dividing :math:`x`. If :math:`bnf` is known to be Galois, set :math:`flag = 0` (in\n        this case, :math:`x` is a norm iff :math:`b = 1`). If :math:`flag` is non zero the program adds to\n        :math:`S` the following prime ideals, depending on the sign of :math:`flag`. If :math:`flag > 0`,\n        the ideals of norm less than :math:`flag`. And if :math:`flag < 0` the ideals dividing :math:`flag`.\n        \n        Assuming GRH, the answer is guaranteed (i.e.\302\240:math:`x` is a norm iff :math:`b = 1`),\n        if :math:`S` contains all primes less than :math:`12\\log (\\mathrm{disc} (Bnf))^2`, where\n        :math:`Bnf` is the Galois closure of :math:`bnf`.\n        \n        See also :literal:`bnfisintnorm`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_233bnfisnorm(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfisnorm") < 0)) __PYX_ERR(10, 3505, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3505, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfisnorm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3505, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_232bnfisnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_232bnfisnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisnorm", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":3522
 *         See also :literal:`bnfisintnorm`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3523
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3523, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3524
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3525
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3526
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisnorm(__pyx_v__bnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":3527
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisnorm(_bnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisprincipal(bnf, x, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3505
 *         return new_gen(_ret)
 * 
 *     def bnfisnorm(bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tries to tell whether the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3529
 *         return new_gen(_ret)
 * 
 *     def bnfisprincipal(bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_235bnfisprincipal(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_234bnfisprincipal[] = "\n        :math:`bnf` being the\n        number field data output by :literal:`bnfinit`, and :math:`x` being an ideal, this\n        function tests whether the ideal is principal or not. The result is more\n        complete than a simple true/false answer and solves general discrete\n        logarithm problem. Assume the class group is :math:`\\oplus (\\mathbb{Z}/d_i\\mathbb{Z})g_i`\n        (where the generators :math:`g_i` and their orders :math:`d_i` are respectively given by\n        :literal:`bnf.gen` and :literal:`bnf.cyc`). The routine returns a row vector :math:`[e,t]`,\n        where :math:`e` is a vector of exponents :math:`0 <= e_i < d_i`, and :math:`t` is a number\n        field element such that\n        \n        .. MATH::\n        \n            x = (t) \\prod_i g_i^{e_i}.\n        \n        For :emphasis:`given` :math:`g_i` (i.e. for a given :literal:`bnf`), the :math:`e_i` are unique,\n        and :math:`t` is unique modulo units.\n        \n        In particular, :math:`x` is principal if and only if :math:`e` is the zero vector. Note\n        that the empty vector, which is returned when the class number is :math:`1`, is\n        considered to be a zero vector (of dimension :math:`0`).\n        \n        ::\n        \n            ? K = bnfinit(y^2+23);\n            ? K.cyc\n            %2 = [3]\n            ? K.gen\n            %3 = [[2, 0; 0, 1]] \\\\ a prime ideal above 2\n            ? P = idealprimedec(K,3)[1]; \\\\ a prime ideal above 3\n            ? v = bnfisprincipal(K, P)\n            %5 = [[2]~, [3/4, 1/4]~]\n            ? idealmul(K, v[2], idealfactorback(K, K.gen, v[1]))\n            %6 =\n            [3 0]\n            \n            [0 1]\n            ? % == idealhnf(K, P)\n            %7 = 1\n        \n        The binary digits of :emphasis:`flag` mean:\n        \n        - :math:`1`: If set, outputs :math:`[e,t]` as explained above, otherwise returns\n          only :math:`e`, which is much easier to compute. The following idiom only"" tests\n          whether an ideal is principal:\n        \n        ::\n        \n             is_principal(bnf, x) = !bnfisprincipal(bnf,x,0);\n        \n        - :math:`2`: It may not be possible to recover :math:`t`, given the initial accuracy\n          to which the :literal:`bnf` structure was computed. In that case, a warning is\n          printed and :math:`t` is set equal to the empty vector :literal:`[]~`. If this bit is\n          set, increase the precision and recompute needed quantities until :math:`t` can be\n          computed. Warning: setting this may induce :emphasis:`lengthy` computations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_235bnfisprincipal(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisprincipal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfisprincipal") < 0)) __PYX_ERR(10, 3529, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3529, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfisprincipal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3529, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_234bnfisprincipal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_234bnfisprincipal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisprincipal", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":3586
 *           computed. Warning: setting this may induce :emphasis:`lengthy` computations.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3587
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3587, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3588
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3589
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3590
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisprincipal0(__pyx_v__bnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":3591
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisprincipal0(_bnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfissunit(bnf, sfu, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3529
 *         return new_gen(_ret)
 * 
 *     def bnfisprincipal(bnf, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3593
 *         return new_gen(_ret)
 * 
 *     def bnfissunit(bnf, sfu, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_237bnfissunit(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_236bnfissunit[] = "\n        :math:`bnf` being output by\n        :literal:`bnfinit`, :emphasis:`sfu` by :literal:`bnfsunit`, gives the column vector of\n        exponents of :math:`x` on the fundamental :math:`S`-units and the roots of unity, in the\n        following order: the fundamental units\302\240:emphasis:`bnf.fu`, the root of\n        unity\302\240:emphasis:`bnf.tu`, and the :math:`S`-units\302\240:emphasis:`sfu[1]`.\n        If :math:`x` is not an :math:`S`-unit, outputs an empty vector.\n        \n        ::\n        \n             ? bnf = bnfinit(x^4 - x^3 + 4*x^2 + 3*x + 9, 1);\n             ? bnf.sign\n             %2 = [0, 2]\n             ? S = idealprimedec(bnf,5); #S\n             %3 = 2\n             ? sfu = bnfsunit(bnf,S);\n             ? sfu[1]\n             %5 = [-5/6*x^3 + 4/3*x^2 - 4/3*x - 3/2, 5]\n             ? u = [10,-40,24,11]~;\n             ? bnfissunit(bnf,sfu,u)\n             %7 = [1, Mod(2, 6), 2, 0]~\n             ? bnfissunit(bnf,sfu,3)\n             %8 = []~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_237bnfissunit(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sfu = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfissunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sfu,&__pyx_n_s_x,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_sfu)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnfissunit", 1, 2, 2, 1); __PYX_ERR(10, 3593, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfissunit") < 0)) __PYX_ERR(10, 3593, __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_sfu = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfissunit", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3593, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfissunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_236bnfissunit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), __pyx_v_sfu, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_236bnfissunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_sfu, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__sfu;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfissunit", 0);
  __Pyx_INCREF(__pyx_v_sfu);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":3618
 *              %8 = []~
 *         '''
 *         sfu = objtogen(sfu)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sfu, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sfu, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3619
 *         '''
 *         sfu = objtogen(sfu)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3620
 *         sfu = objtogen(sfu)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _sfu = (<Gen>sfu).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3620, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3621
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sfu = (<Gen>sfu).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3622
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _sfu = (<Gen>sfu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sfu)->__pyx_base.g;
  __pyx_v__sfu = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3623
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _sfu = (<Gen>sfu).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3624
 *         cdef GEN _sfu = (<Gen>sfu).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfissunit(__pyx_v__bnf, __pyx_v__sfu, __pyx_v__x);

  /* "cypari/auto_gen.pxi":3625
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfissunit(_bnf, _sfu, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfisunit(bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3593
 *         return new_gen(_ret)
 * 
 *     def bnfissunit(bnf, sfu, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfissunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sfu);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3627
 *         return new_gen(_ret)
 * 
 *     def bnfisunit(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being the number field data
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_239bnfisunit(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_238bnfisunit[] = "\n        :emphasis:`bnf` being the number field data\n        output by :literal:`bnfinit` and :math:`x` being an algebraic number (type integer,\n        rational or polmod), this outputs the decomposition of :math:`x` on the fundamental\n        units and the roots of unity if :math:`x` is a unit, the empty vector otherwise.\n        More precisely, if :math:`u_1`,...,:math:`u_r` are the fundamental units, and :math:`\\zeta`\n        is the generator of the group of roots of unity (:literal:`bnf.tu`), the output is\n        a vector :math:`[x_1,...,x_r,x_{r+1}]` such that :math:`x = u_1^{x_1}...\n        u_r^{x_r}.\\zeta^{x_{r+1}}`. The :math:`x_i` are integers for :math:`i <= r` and is an\n        integer modulo the order of :math:`\\zeta` for :math:`i = r+1`.\n        \n        Note that :emphasis:`bnf` need not contain the fundamental unit explicitly:\n        \n        ::\n        \n            ? setrand(1); bnf = bnfinit(x^2-x-100000);\n            ? bnf.fu\n             *** at top-level: bnf.fu\n             *** ^--\n             *** _.fu: missing units in .fu.\n            ? u = [119836165644250789990462835950022871665178127611316131167, \\\n             379554884019013781006303254896369154068336082609238336]~;\n            ? bnfisunit(bnf, u)\n            %3 = [-1, Mod(0, 2)]~\n        \n        The given :math:`u` is the inverse of the fundamental unit\n        implicitly stored in :emphasis:`bnf`. In this case, the fundamental unit was not\n        computed and stored in algebraic form since the default accuracy was too\n        low. (Re-run the command at \\\\g1 or higher to see such diagnostics.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_239bnfisunit(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfisunit (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_238bnfisunit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_238bnfisunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfisunit", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":3658
 *         low. (Re-run the command at \\g1 or higher to see such diagnostics.)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3659
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3659, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3660
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisunit(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3661
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfisunit(_bnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3662
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisunit(_bnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfisunit(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":3663
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnfisunit(_bnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnflog(bnf, l):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3627
 *         return new_gen(_ret)
 * 
 *     def bnfisunit(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being the number field data
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfisunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3665
 *         return new_gen(_ret)
 * 
 *     def bnflog(bnf, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnf` be a :emphasis:`bnf` structure attached to the number field :math:`F` and let :math:`l` be
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_241bnflog(PyObject *__pyx_v_bnf, PyObject *__pyx_v_l); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_240bnflog[] = "\n        Let :emphasis:`bnf` be a :emphasis:`bnf` structure attached to the number field :math:`F` and let :math:`l` be\n        a prime number (hereafter denoted :math:`\\ell` for typographical reasons). Return\n        the logarithmic :math:`\\ell`-class group :math:`~{Cl}_F`\n        of :math:`F`. This is an abelian group, conjecturally finite (known to be finite\n        if :math:`F/\\mathbb{Q}` is abelian). The function returns if and only if\n        the group is indeed finite (otherwise it would run into an infinite loop).\n        Let :math:`S = { p_1,..., p_k}` be the set of :math:`\\ell`-adic places\n        (maximal ideals containing :math:`\\ell`).\n        The function returns :math:`[D, G(\\ell), G']`, where\n        \n        - :math:`D` is the vector of elementary divisors for :math:`~{Cl}_F`.\n        \n        - :math:`G(\\ell)` is the vector of elementary divisors for\n          the (conjecturally finite) abelian group\n          \n        \n        .. MATH::\n        \n            ~{\\mathrm{Cl}}(\\ell) =\n          \\{ a = \\sum_{i <= k} a_i p_i :\302\240\\deg_F a = 0},\n        \n          where the :math:`p_i` are the :math:`\\ell`-adic places of :math:`F`; this is a\n          subgroup of :math:`~{\\mathrm{Cl}}`.\n        \n        - :math:`G'` is the vector of elementary divisors for the :math:`\\ell`-Sylow :math:`Cl'`\n          of the :math:`S`-class group of :math:`F`; the group :math:`~{\\mathrm{Cl}}` maps to :math:`Cl'`\n          with a simple co-kernel.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_241bnflog(PyObject *__pyx_v_bnf, PyObject *__pyx_v_l) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnflog (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_240bnflog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_l));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_240bnflog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_l) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__l;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnflog", 0);
  __Pyx_INCREF(__pyx_v_l);

  /* "cypari/auto_gen.pxi":3695
 *           with a simple co-kernel.
 *         '''
 *         l = objtogen(l)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_l, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_l, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3696
 *         '''
 *         l = objtogen(l)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _l = (<Gen>l).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3696, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3697
 *         l = objtogen(l)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflog(_bnf, _l)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3698
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _l = (<Gen>l).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnflog(_bnf, _l)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_l)->__pyx_base.g;
  __pyx_v__l = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3699
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflog(_bnf, _l)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnflog(__pyx_v__bnf, __pyx_v__l);

  /* "cypari/auto_gen.pxi":3700
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflog(_bnf, _l)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnflogdegree(nf, A, l):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3665
 *         return new_gen(_ret)
 * 
 *     def bnflog(bnf, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnf` be a :emphasis:`bnf` structure attached to the number field :math:`F` and let :math:`l` be
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnflog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3702
 *         return new_gen(_ret)
 * 
 *     def bnflogdegree(nf, A, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_243bnflogdegree(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_242bnflogdegree[] = "\n        Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`,\n        and let :math:`l` be a prime number (hereafter\n        denoted :math:`\\ell`). The\n        :math:`\\ell`-adified group of id\\\\`{e}les of :math:`F` quotiented by\n        the group of logarithmic units is identified to the :math:`\\ell`-group\n        of logarithmic divisors :math:`\\oplus \\mathbb{Z}_\\ell [p]`, generated by the\n        maximal ideals of :math:`F`.\n        \n        The :emphasis:`degree` map :math:`\\deg_F` is additive with values in :math:`\\mathbb{Z}_\\ell`,\n        defined by :math:`\\deg_F p = ~{f}_{p} \\deg_\\ell p`,\n        where the integer :math:`~{f}_{p}` is as in :literal:`bnflogef` and :math:`\\deg_\\ell p`\n        is :math:`\\log_\\ell p` for :math:`p != \\ell`, :math:`\\log_\\ell (1 + \\ell)` for\n        :math:`p = \\ell != 2` and :math:`\\log_\\ell (1 + 2^2)` for :math:`p = \\ell = 2`.\n        \n        Let :math:`A = \\prod p^{n_{p}}` be an ideal and let :math:`~{A} =\n        \\sum n_p [p]` be the attached logarithmic divisor. Return the\n        exponential of the :math:`\\ell`-adic logarithmic degree :math:`\\deg_F A`, which is a\n        natural number.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_243bnflogdegree(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_l = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnflogdegree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_l,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_A)) != 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_l)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnflogdegree", 1, 2, 2, 1); __PYX_ERR(10, 3702, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnflogdegree") < 0)) __PYX_ERR(10, 3702, __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_A = values[0];
    __pyx_v_l = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnflogdegree", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3702, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnflogdegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_242bnflogdegree(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_A, __pyx_v_l);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_242bnflogdegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_l) {
  GEN __pyx_v__nf;
  GEN __pyx_v__A;
  GEN __pyx_v__l;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnflogdegree", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_l);

  /* "cypari/auto_gen.pxi":3723
 *         natural number.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         l = objtogen(l)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3724
 *         '''
 *         A = objtogen(A)
 *         l = objtogen(l)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_l, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_l, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3725
 *         A = objtogen(A)
 *         l = objtogen(l)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3725, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3726
 *         l = objtogen(l)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _l = (<Gen>l).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3727
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3728
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _l = (<Gen>l).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_l)->__pyx_base.g;
  __pyx_v__l = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3729
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnflogdegree(__pyx_v__nf, __pyx_v__A, __pyx_v__l);

  /* "cypari/auto_gen.pxi":3730
 *         cdef GEN _l = (<Gen>l).g
 *         cdef GEN _ret = bnflogdegree(_nf, _A, _l)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnflogef(nf, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3702
 *         return new_gen(_ret)
 * 
 *     def bnflogdegree(nf, A, l):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnflogdegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3732
 *         return new_gen(_ret)
 * 
 *     def bnflogef(nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_245bnflogef(PyObject *__pyx_v_nf, PyObject *__pyx_v_pr); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_244bnflogef[] = "\n        Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`\n        and let :emphasis:`pr` be a :emphasis:`prid` structure attached to a\n        maximal ideal :math:`p / p`. Return\n        :math:`[~{e}(F_p / \\mathbb{Q}_p), ~{f}(F_p / \\mathbb{Q}_p)]`\n        the logarithmic ramification and residue degrees. Let :math:`\\mathbb{Q}_p^c/\\mathbb{Q}_p` be the\n        cyclotomic :math:`\\mathbb{Z}_p`-extension, then\n        :math:`~{e} = [F_p : F_p \\cap \\mathbb{Q}_p^c]` and\n        :math:`~{f} = [F_p \\cap \\mathbb{Q}_p^c : \\mathbb{Q}_p]`. Note that\n        :math:`~{e}~{f} = e(p/p) f(p/p)`, where :math:`e(p/p)` and :math:`f(p/p)` denote the\n        usual ramification and residue degrees.\n        \n        ::\n        \n            ? F = nfinit(y^6 - 3*y^5 + 5*y^3 - 3*y + 1);\n            ? bnflogef(F, idealprimedec(F,2)[1])\n            %2 = [6, 1]\n            ? bnflogef(F, idealprimedec(F,5)[1])\n            %3 = [1, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_245bnflogef(PyObject *__pyx_v_nf, PyObject *__pyx_v_pr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnflogef (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_244bnflogef(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_pr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_244bnflogef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnflogef", 0);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":3753
 *             %3 = [1, 2]
 *         '''
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3754
 *         '''
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3754, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3755
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = bnflogef(_nf, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3756
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnflogef(_nf, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3757
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = bnflogef(_nf, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnflogef(__pyx_v__nf, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":3758
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = bnflogef(_nf, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfnarrow(bnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3732
 *         return new_gen(_ret)
 * 
 *     def bnflogef(nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`F`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnflogef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3760
 *         return new_gen(_ret)
 * 
 *     def bnfnarrow(bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_247bnfnarrow(PyObject *__pyx_v_bnf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_246bnfnarrow[] = "\n        :emphasis:`bnf` being as output by\n        :literal:`bnfinit`, computes the narrow class group of :emphasis:`bnf`. The output is\n        a 3-component row vector :math:`v` analogous to the corresponding class group\n        component :literal:`:emphasis:`bnf`.clgp`: the first component\n        is the narrow class number :literal:`:math:`v`.no`, the second component is a vector\n        containing the SNF cyclic components :literal:`:math:`v`.cyc` of\n        the narrow class group, and the third is a vector giving the generators of\n        the corresponding :literal:`:math:`v`.gen` cyclic groups. Note that this function is a\n        special case of :literal:`bnrinit`; the :emphasis:`bnf` need not contain fundamental\n        units.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_247bnfnarrow(PyObject *__pyx_v_bnf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfnarrow (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_246bnfnarrow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_246bnfnarrow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bnfnarrow", 0);

  /* "cypari/auto_gen.pxi":3773
 *         units.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfnarrow(_bnf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3773, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3774
 *         '''
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfnarrow(_bnf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3775
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfnarrow(_bnf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfnarrow(__pyx_v__bnf);

  /* "cypari/auto_gen.pxi":3776
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = bnfnarrow(_bnf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfsignunit(bnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3760
 *         return new_gen(_ret)
 * 
 *     def bnfnarrow(bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfnarrow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3778
 *         return new_gen(_ret)
 * 
 *     def bnfsignunit(bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_249bnfsignunit(PyObject *__pyx_v_bnf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_248bnfsignunit[] = "\n        :math:`bnf` being as output by\n        :literal:`bnfinit`, this computes an :math:`r_1 x (r_1+r_2-1)` matrix having :math:`\302\2611`\n        components, giving the signs of the real embeddings of the fundamental units.\n        The following functions compute generators for the totally positive units:\n        \n        ::\n        \n            /* exponents of totally positive units generators on bnf.tufu */\n            tpuexpo(bnf)=\n            { my(K, S = bnfsignunit(bnf), [m,n] = matsize(S));\n             \\\\ m = bnf.r1, n = r1+r2-1\n             S = matrix(m,n, i,j, if (S[i,j] < 0, 1,0));\n             S = concat(vectorv(m,i,1), S); \\\\ add sign(-1)\n             K = matker(S * Mod(1,2));\n             if (K, mathnfmodid(lift(K), 2), 2*matid(n+1))\n            }\n            \n            /* totally positive fundamental units */\n            tpu(bnf)=\n            { my(ex = tpuexpo(bnf)[,2..-1]); \\\\ remove ex[,1], corresponds to 1 or -1\n             vector(#ex, i, nffactorback(bnf, bnf.tufu, ex[,i]));\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_249bnfsignunit(PyObject *__pyx_v_bnf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfsignunit (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_248bnfsignunit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_248bnfsignunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bnfsignunit", 0);

  /* "cypari/auto_gen.pxi":3803
 *             }
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = signunits(_bnf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 3803, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3804
 *         '''
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = signunits(_bnf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3805
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = signunits(_bnf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = signunits(__pyx_v__bnf);

  /* "cypari/auto_gen.pxi":3806
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _ret = signunits(_bnf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnfsunit(bnf, S, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 3806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3778
 *         return new_gen(_ret)
 * 
 *     def bnfsignunit(bnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfsignunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3808
 *         return new_gen(_ret)
 * 
 *     def bnfsunit(bnf, S, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the fundamental :math:`S`-units of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_251bnfsunit(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_250bnfsunit[] = "\n        Computes the fundamental :math:`S`-units of the\n        number field :math:`bnf` (output by :literal:`bnfinit`), where :math:`S` is a list of\n        prime ideals (output by :literal:`idealprimedec`). The output is a vector :math:`v` with\n        6 components.\n        \n        :math:`v[1]` gives a minimal system of (integral) generators of the :math:`S`-unit group\n        modulo the unit group.\n        \n        :math:`v[2]` contains technical data needed by :literal:`bnfissunit`.\n        \n        :math:`v[3]` is an empty vector (used to give the logarithmic embeddings of the\n        generators in :math:`v[1]` in version 2.0.16).\n        \n        :math:`v[4]` is the :math:`S`-regulator (this is the product of the regulator, the\n        determinant of :math:`v[2]` and the natural logarithms of the norms of the ideals\n        in :math:`S`).\n        \n        :math:`v[5]` gives the :math:`S`-class group structure, in the usual format\n        (a row vector whose three components give in order the :math:`S`-class number,\n        the cyclic components and the generators).\n        \n        :math:`v[6]` is a copy of :math:`S`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_251bnfsunit(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_S = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfsunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_S,&__pyx_n_s_precision,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_S)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnfsunit") < 0)) __PYX_ERR(10, 3808, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_S = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3808, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnfsunit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3808, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfsunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_250bnfsunit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), __pyx_v_S, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_250bnfsunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_S, long __pyx_v_precision) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__S;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnfsunit", 0);
  __Pyx_INCREF(__pyx_v_S);

  /* "cypari/auto_gen.pxi":3833
 *         :math:`v[6]` is a copy of :math:`S`.
 *         '''
 *         S = objtogen(S)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_S, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_S, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3834
 *         '''
 *         S = objtogen(S)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _S = (<Gen>S).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 3834, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3835
 *         S = objtogen(S)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _S = (<Gen>S).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3836
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _S = (<Gen>S).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_S)->__pyx_base.g;
  __pyx_v__S = __pyx_t_3;

  /* "cypari/auto_gen.pxi":3837
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _S = (<Gen>S).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":3838
 *         cdef GEN _S = (<Gen>S).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnfsunit(__pyx_v__bnf, __pyx_v__S, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":3839
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnfsunit(_bnf, _S, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrL1(bnr, H=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3808
 *         return new_gen(_ret)
 * 
 *     def bnfsunit(bnf, S, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the fundamental :math:`S`-units of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnfsunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_S);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3841
 *         return new_gen(_ret)
 * 
 *     def bnrL1(bnr, H=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the number field data output by :literal:`bnrinit` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_253bnrL1(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_252bnrL1[] = "\n        Let :emphasis:`bnr` be the number field data output by :literal:`bnrinit` and\n        :emphasis:`H` be a square matrix defining a congruence subgroup of the\n        ray class group corresponding to :emphasis:`bnr` (the trivial congruence subgroup\n        if omitted). This function returns, for each character :math:`\\chi` of the ray\n        class group which is trivial on :math:`H`, the value at :math:`s = 1` (or :math:`s = 0`) of the\n        abelian :math:`L`-function attached to :math:`\\chi`. For the value at :math:`s = 0`, the\n        function returns in fact for each :math:`\\chi` a vector :math:`[r_\\chi, c_\\chi]` where\n        \n        .. MATH::\n        \n            L(s, \\chi) = c.s^r + O(s^{r + 1})\n        \n        near :math:`0`.\n        \n        The argument :emphasis:`flag` is optional, its binary digits\n        mean 1: compute at :math:`s = 0` if unset or :math:`s = 1` if set, 2: compute the\n        primitive :math:`L`-function attached to :math:`\\chi` if unset or the :math:`L`-function\n        with Euler factors at prime ideals dividing the modulus of :emphasis:`bnr` removed\n        if set (that is :math:`L_S(s, \\chi)`, where :math:`S` is the\n        set of infinite places of the number field together with the finite prime\n        ideals dividing the modulus of :emphasis:`bnr`), 3: return also the character if\n        set.\n        \n        ::\n        \n            K = bnfinit(x^2-229);\n            bnr = bnrinit(K,1);\n            bnrL1(bnr)\n        \n        returns the order and the first non-zero term of :math:`L(s, \\chi)` at :math:`s = 0`\n        where :math:`\\chi` runs through the characters of the class group of\n        :math:`K = \\mathbb{Q} (\\sqrt{229})`. Then\n        \n        ::\n        \n            bnr2 = bnrinit(K,2);\n            bnrL1(bnr2,,2)\n        \n        returns the order and the first non-zero terms of :math:`L_S(s, \\chi)` at :math:`s = 0`\n        where :math:`\\chi` runs through th""e characters of the class group of :math:`K` and :math:`S` is\n        the set of infinite places of :math:`K` together with the finite prime :math:`2`. Note\n        that the ray class group modulo :math:`2` is in fact the class group, so\n        :literal:`bnrL1(bnr2,0)` returns the same answer as :literal:`bnrL1(bnr,0)`.\n        \n        This function will fail with the message\n        \n        ::\n        \n             *** bnrL1: overflow in zeta_get_N0 [need too many primes].\n        \n        if the approximate functional equation requires us to sum\n        too many terms (if the discriminant of :math:`K` is too large).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_253bnrL1(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_H = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrL1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_H,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrL1") < 0)) __PYX_ERR(10, 3841, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_H = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3841, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 3841, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrL1", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3841, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_252bnrL1(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_H, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_252bnrL1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_H, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_H;
  GEN __pyx_v__bnr;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrL1", 0);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":3896
 *         too many terms (if the discriminant of :math:`K` is too large).
 *         '''
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_1 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_1;

  /* "cypari/auto_gen.pxi":3897
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3898
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3898, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":3897
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":3899
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 3899, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3900
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3901
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":3902
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3903
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_gen.pxi":3902
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":3904
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":3905
 *             _H = (<Gen>H).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrL1(__pyx_v__bnr, __pyx_v__H, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":3906
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrL1(_bnr, _H, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrchar(bnr, g, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3841
 *         return new_gen(_ret)
 * 
 *     def bnrL1(bnr, H=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the number field data output by :literal:`bnrinit` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3908
 *         return new_gen(_ret)
 * 
 *     def bnrchar(bnr, g, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all characters :math:`\chi` on :literal:`bnr.clgp` such that
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_255bnrchar(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_254bnrchar[] = "\n        Returns all characters :math:`\\chi` on :literal:`bnr.clgp` such that\n        :math:`\\chi (g_i) = e(v_i)`, where :math:`e(x) = \\exp (2i\\pi x)`. If :math:`v` is omitted,\n        returns all characters that are trivial on the :math:`g_i`. Else the vectors :math:`g`\n        and :math:`v` must have the same length, the :math:`g_i` must be ideals in any form, and\n        each :math:`v_i` is a rational number whose denominator must divide the order of\n        :math:`g_i` in the ray class group. For convenience, the vector of the :math:`g_i`\n        can be replaced by a matrix whose columns give their discrete logarithm,\n        as given by :literal:`bnrisprincipal`; this allows to specify abstractly a\n        subgroup of the ray class group.\n        \n        ::\n        \n            ? bnr = bnrinit(bnfinit(x), [160,[1]], 1); /* (Z/160Z)^* */\n            ? bnr.cyc\n            %2 = [8, 4, 2]\n            ? g = bnr.gen;\n            ? bnrchar(bnr, g, [1/2,0,0])\n            %4 = [[4, 0, 0]] \\\\ a unique character\n            ? bnrchar(bnr, [g[1],g[3]]) \\\\ all characters trivial on g[1] and g[3]\n            %5 = [[0, 1, 0], [0, 2, 0], [0, 3, 0], [0, 0, 0]]\n            ? bnrchar(bnr, [1,0,0;0,1,0;0,0,2])\n            %6 = [[0, 0, 1], [0, 0, 0]] \\\\ characters trivial on given subgroup\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_255bnrchar(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrchar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_g)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrchar") < 0)) __PYX_ERR(10, 3908, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrchar", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3908, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_254bnrchar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_g, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_254bnrchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_g, PyObject *__pyx_v_v) {
  int __pyx_v__have_v;
  GEN __pyx_v__bnr;
  GEN __pyx_v__g;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrchar", 0);
  __Pyx_INCREF(__pyx_v_g);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":3933
 *             %6 = [[0, 0, 1], [0, 0, 0]] \\ characters trivial on given subgroup
 *         '''
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":3934
 *         '''
 *         g = objtogen(g)
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_2;

  /* "cypari/auto_gen.pxi":3935
 *         g = objtogen(g)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":3936
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3936, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":3935
 *         g = objtogen(g)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":3937
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 3937, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3938
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3939
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3940
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_gen.pxi":3941
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":3942
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":3941
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 */
  }

  /* "cypari/auto_gen.pxi":3943
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrchar(__pyx_v__bnr, __pyx_v__g, __pyx_v__v);

  /* "cypari/auto_gen.pxi":3944
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = bnrchar(_bnr, _g, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrclassno(A, B=None, C=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 3944, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3908
 *         return new_gen(_ret)
 * 
 *     def bnrchar(bnr, g, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all characters :math:`\chi` on :literal:`bnr.clgp` such that
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3946
 *         return new_gen(_ret)
 * 
 *     def bnrclassno(A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`A`, :math:`B`, :math:`C` define a class field :math:`L` over a ground field :math:`K`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_257bnrclassno(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_256bnrclassno[] = "\n        Let :math:`A`, :math:`B`, :math:`C` define a class field :math:`L` over a ground field :math:`K`\n        (of type :literal:`[:emphasis:`bnr`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`subgroup`]`,\n        or :literal:`[:emphasis:`bnf`, :emphasis:`modulus`]`,\n        or :literal:`[:emphasis:`bnf`, :emphasis:`modulus`,:emphasis:`subgroup`]`,\n        ``CFT`` (in the PARI manual)); this function returns the relative degree :math:`[L:K]`.\n        \n        In particular if :math:`A` is a :emphasis:`bnf` (with units), and :math:`B` a modulus,\n        this function returns the corresponding ray class number modulo :math:`B`.\n        One can input the attached :emphasis:`bid` (with generators if the subgroup\n        :math:`C` is non trivial) for :math:`B` instead of the module itself, saving some time.\n        \n        This function is faster than :literal:`bnrinit` and should be used if only the\n        ray class number is desired. See :literal:`bnrclassnolist` if you need ray class\n        numbers for all moduli less than some bound.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_257bnrclassno(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrclassno (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_C,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrclassno") < 0)) __PYX_ERR(10, 3946, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_B = values[0];
    __pyx_v_C = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrclassno", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 3946, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_256bnrclassno(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_B, __pyx_v_C);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_256bnrclassno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrclassno", 0);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_gen.pxi":3964
 *         numbers for all moduli less than some bound.
 *         '''
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_1 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_1;

  /* "cypari/auto_gen.pxi":3965
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3966
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":3965
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_gen.pxi":3967
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_1 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_1;

  /* "cypari/auto_gen.pxi":3968
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3969
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":3968
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":3970
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 3970, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":3971
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_gen.pxi":3972
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_gen.pxi":3973
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3974
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_gen.pxi":3973
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_gen.pxi":3975
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_gen.pxi":3976
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":3977
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_gen.pxi":3976
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 */
  }

  /* "cypari/auto_gen.pxi":3978
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrclassno0(__pyx_v__A, __pyx_v__B, __pyx_v__C);

  /* "cypari/auto_gen.pxi":3979
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrclassno0(_A, _B, _C)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrclassnolist(bnf, list):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 3979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3946
 *         return new_gen(_ret)
 * 
 *     def bnrclassno(A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`A`, :math:`B`, :math:`C` define a class field :math:`L` over a ground field :math:`K`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":3981
 *         return new_gen(_ret)
 * 
 *     def bnrclassnolist(bnf, list):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_259bnrclassnolist(PyObject *__pyx_v_bnf, PyObject *__pyx_v_list); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_258bnrclassnolist[] = "\n        :math:`bnf` being as\n        output by :literal:`bnfinit`, and :emphasis:`list` being a list of moduli (with units) as\n        output by :literal:`ideallist` or :literal:`ideallistarch`, outputs the list of the\n        class numbers of the corresponding ray class groups. To compute a single\n        class number, :literal:`bnrclassno` is more efficient.\n        \n        ::\n        \n            ? bnf = bnfinit(x^2 - 2);\n            ? L = ideallist(bnf, 100, 2);\n            ? H = bnrclassnolist(bnf, L);\n            ? H[98]\n            %4 = [1, 3, 1]\n            ? l = L[1][98]; ids = vector(#l, i, l[i].mod[1])\n            %5 = [[98, 88; 0, 1], [14, 0; 0, 7], [98, 10; 0, 1]]\n        \n        The weird :literal:`l[i].mod[1]`, is the first component of :literal:`l[i].mod`, i.e.\n        the finite part of the conductor. (This is cosmetic: since by construction\n        the Archimedean part is trivial, I do not want to see it). This tells us that\n        the ray class groups modulo the ideals of norm 98 (printed as :literal:`\\%5`) have\n        respectively order :math:`1`, :math:`3` and :math:`1`. Indeed, we may check directly:\n        \n        ::\n        \n            ? bnrclassno(bnf, ids[2])\n            %6 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_259bnrclassnolist(PyObject *__pyx_v_bnf, PyObject *__pyx_v_list) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrclassnolist (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_258bnrclassnolist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_list));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_258bnrclassnolist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_list) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__list;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrclassnolist", 0);
  __Pyx_INCREF(__pyx_v_list);

  /* "cypari/auto_gen.pxi":4010
 *             %6 = 3
 *         '''
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4011
 *         '''
 *         list = objtogen(list)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4011, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4012
 *         list = objtogen(list)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4013
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4014
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrclassnolist(__pyx_v__bnf, __pyx_v__list);

  /* "cypari/auto_gen.pxi":4015
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = bnrclassnolist(_bnf, _list)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrconductor(A, B=None, C=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":3981
 *         return new_gen(_ret)
 * 
 *     def bnrclassnolist(bnf, list):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrclassnolist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4017
 *         return new_gen(_ret)
 * 
 *     def bnrconductor(A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conductor :math:`f` of the subfield of a ray class field as defined by :math:`[A,B,C]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_261bnrconductor(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_260bnrconductor[] = "\n        Conductor :math:`f` of the subfield of a ray class field as defined by :math:`[A,B,C]`\n        (of type :literal:`[:emphasis:`bnr`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`subgroup`]`,\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`]` or\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`, :emphasis:`subgroup`]`,\n        ``CFT`` (in the PARI manual))\n        \n        If :math:`flag = 0`, returns :math:`f`.\n        \n        If :math:`flag = 1`, returns :math:`[f, Cl_f, H]`, where :math:`Cl_f` is the ray class group\n        modulo :math:`f`, as a finite abelian group; finally :math:`H` is the subgroup of :math:`Cl_f`\n        defining the extension.\n        \n        If :math:`flag = 2`, returns :math:`[f, bnr (f), H]`, as above except :math:`Cl_f` is\n        replaced by a :literal:`bnr` structure, as output by :math:`bnrinit (,f)`, without\n        generators unless the input contained a :emphasis:`bnr` with generators.\n        \n        In place of a subgroup :math:`H`, this function also accepts a character\n        :literal:`chi` :math:`= (a_j)`, expressed as usual in terms of the generators\n        :literal:`bnr.gen`: :math:`\\chi (g_j) = \\exp (2i\\pi a_j / d_j)`, where :math:`g_j` has\n        order :math:`d_j = bnr.cyc[j]`. In which case, the function returns\n        respectively\n        \n        If :math:`flag = 0`, the conductor :math:`f` of :math:`Ker \\chi`.\n        \n        If :math:`flag = 1`, :math:`[f, Cl_f, \\chi_f]`, where :math:`\\chi_f` is :math:`\\chi` expressed\n        on the minimal ray class group, whose modulus is the conductor.\n        \n        If :math:`flag = 2`, :math:`[f, bnr (f), \\chi_f]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_261bnrconductor(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrconductor") < 0)) __PYX_ERR(10, 4017, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
    __pyx_v_C = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4017, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrconductor", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4017, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_260bnrconductor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_B, __pyx_v_C, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_260bnrconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrconductor", 0);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_gen.pxi":4049
 *         If :math:`flag = 2`, :math:`[f, bnr (f), \chi_f]`.
 *         '''
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_1 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4050
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4051
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4051, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4050
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_gen.pxi":4052
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_1 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4053
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4054
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4054, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4053
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4055
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4055, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4056
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4057
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_gen.pxi":4058
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4059
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4058
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_gen.pxi":4060
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_gen.pxi":4061
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4062
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4061
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 */
  }

  /* "cypari/auto_gen.pxi":4063
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrconductor0(__pyx_v__A, __pyx_v__B, __pyx_v__C, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":4064
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrconductor0(_A, _B, _C, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrconductorofchar(bnr, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4017
 *         return new_gen(_ret)
 * 
 *     def bnrconductor(A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conductor :math:`f` of the subfield of a ray class field as defined by :math:`[A,B,C]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4066
 *         return new_gen(_ret)
 * 
 *     def bnrconductorofchar(bnr, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :emphasis:`bnrconductor`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_263bnrconductorofchar(PyObject *__pyx_v_bnr, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_262bnrconductorofchar[] = "\n        This function is obsolete, use :emphasis:`bnrconductor`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_263bnrconductorofchar(PyObject *__pyx_v_bnr, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrconductorofchar (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_262bnrconductorofchar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_262bnrconductorofchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_chi) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__bnr;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrconductorofchar", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":4070
 *         This function is obsolete, use :emphasis:`bnrconductor`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)
 *         chi = objtogen(chi)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4070, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":4071
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__50, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":4072
 *         from warnings import warn
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4072, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":4073
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4073, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4074
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4075
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4076
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrconductorofchar(__pyx_v__bnr, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":4077
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = bnrconductorofchar(_bnr, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrdisc(A, B=None, C=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4077, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4066
 *         return new_gen(_ret)
 * 
 *     def bnrconductorofchar(bnr, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :emphasis:`bnrconductor`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrconductorofchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4079
 *         return new_gen(_ret)
 * 
 *     def bnrdisc(A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A`, :math:`B`, :math:`C` defining a class field :math:`L` over a ground field :math:`K`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_265bnrdisc(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_264bnrdisc[] = "\n        :math:`A`, :math:`B`, :math:`C` defining a class field :math:`L` over a ground field :math:`K`\n        (of type :literal:`[:emphasis:`bnr`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`subgroup`]`,\n        :literal:`[:emphasis:`bnr`, :emphasis:`character`]`,\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`]` or\n        :literal:`[:emphasis:`bnf`, :emphasis:`modulus`, :emphasis:`subgroup`]`,\n        ``CFT`` (in the PARI manual)), outputs data :math:`[N,r_1,D]` giving the discriminant and\n        signature of :math:`L`, depending on the binary digits of :emphasis:`flag`:\n        \n        - 1: if this bit is unset, output absolute data related to :math:`L/\\mathbb{Q}`:\n          :math:`N` is the absolute degree :math:`[L:\\mathbb{Q}]`, :math:`r_1` the number of real places of :math:`L`,\n          and :math:`D` the discriminant of :math:`L/\\mathbb{Q}`. Otherwise, output relative data for :math:`L/K`:\n          :math:`N` is the relative degree :math:`[L:K]`, :math:`r_1` is the number of real places of :math:`K`\n          unramified in :math:`L` (so that the number of real places of :math:`L` is equal to :math:`r_1`\n          times :math:`N`), and :math:`D` is the relative discriminant ideal of :math:`L/K`.\n        \n        - 2: if this bit is set and if the modulus is not the conductor of :math:`L`,\n          only return 0.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_265bnrdisc(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrdisc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrdisc") < 0)) __PYX_ERR(10, 4079, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
    __pyx_v_C = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4079, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrdisc", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4079, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_264bnrdisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_B, __pyx_v_C, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_264bnrdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, long __pyx_v_flag) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrdisc", 0);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_gen.pxi":4100
 *           only return 0.
 *         '''
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_1 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4101
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4102
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4102, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4101
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_gen.pxi":4103
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_1 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4104
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4105
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4105, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4104
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4106
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4106, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4107
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4108
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_gen.pxi":4109
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4110
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4109
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_gen.pxi":4111
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_gen.pxi":4112
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4113
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4112
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 */
  }

  /* "cypari/auto_gen.pxi":4114
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrdisc0(__pyx_v__A, __pyx_v__B, __pyx_v__C, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":4115
 *             _C = (<Gen>C).g
 *         cdef GEN _ret = bnrdisc0(_A, _B, _C, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrdisclist(bnf, bound, arch=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4079
 *         return new_gen(_ret)
 * 
 *     def bnrdisc(A, B=None, C=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A`, :math:`B`, :math:`C` defining a class field :math:`L` over a ground field :math:`K`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4117
 *         return new_gen(_ret)
 * 
 *     def bnrdisclist(bnf, bound, arch=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by :literal:`bnfinit` (with units), computes a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_267bnrdisclist(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_266bnrdisclist[] = "\n        :math:`bnf` being as output by :literal:`bnfinit` (with units), computes a\n        list of discriminants of Abelian extensions of the number field by increasing\n        modulus norm up to bound :emphasis:`bound`. The ramified Archimedean places are\n        given by :emphasis:`arch`; all possible values are taken if :emphasis:`arch` is omitted.\n        \n        The alternative syntax :math:`bnrdisclist (bnf,list)` is\n        supported, where :emphasis:`list` is as output by :literal:`ideallist` or\n        :literal:`ideallistarch` (with units), in which case :emphasis:`arch` is disregarded.\n        \n        The output :math:`v` is a vector, where :math:`v[k]` is itself a vector :math:`w`, whose length\n        is the number of ideals of norm :math:`k`.\n        \n        - We consider first the case where :emphasis:`arch` was specified. Each\n          component of :math:`w` corresponds to an ideal :math:`m` of norm :math:`k`, and\n          gives invariants attached to the ray class field :math:`L` of :math:`bnf` of\n          conductor :math:`[m, arch]`. Namely, each contains a vector :math:`[m,d,r,D]` with\n          the following meaning: :math:`m` is the prime ideal factorization of the modulus,\n          :math:`d = [L:\\mathbb{Q}]` is the absolute degree of :math:`L`, :math:`r` is the number of real places\n          of :math:`L`, and :math:`D` is the factorization of its absolute discriminant. We set :math:`d\n          = r = D = 0` if :math:`m` is not the finite part of a conductor.\n        \n        - If :emphasis:`arch` was omitted, all :math:`t = 2^{r_1}` possible values are taken\n          and a component of :math:`w` has the form\n          :math:`[m, [[d_1,r_1,D_1],..., [d_t,r_t,D_t]]]`,\n          where :math:`m` is the finite part of the conductor as above, and\n          :math:`[d_i,r_i,D_i]` are the invariants of the ray class field of conductor\n          :math:`[m,v_i]`, where :math:`v_i` is the :math:`i`-th Archimedean compon""ent, ordered by\n          inverse lexicographic order; so :math:`v_1 = [0,...,0]`, :math:`v_2 = [1,0...,0]`,\n          etc. Again, we set :math:`d_i = r_i = D_i = 0` if :math:`[m,v_i]` is not a conductor.\n        \n        Finally, each prime ideal :math:`pr = [p,\\alpha,e,f,\\beta]` in the prime\n        factorization :math:`m` is coded as the integer :math:`p.n^2+(f-1).n+(j-1)`,\n        where :math:`n` is the degree of the base field and :math:`j` is such that\n        \n        :literal:`pr = idealprimedec(:emphasis:`nf`,p)[j]`.\n        \n        :math:`m` can be decoded using :literal:`bnfdecodemodule`.\n        \n        Note that to compute such data for a single field, either :literal:`bnrclassno`\n        or :literal:`bnrdisc` are (much) more efficient.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_267bnrdisclist(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bound = 0;
  PyObject *__pyx_v_arch = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrdisclist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bound,&__pyx_n_s_arch,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_bound)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arch);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrdisclist") < 0)) __PYX_ERR(10, 4117, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bound = values[0];
    __pyx_v_arch = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrdisclist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4117, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrdisclist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_266bnrdisclist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), __pyx_v_bound, __pyx_v_arch);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_266bnrdisclist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_bound, PyObject *__pyx_v_arch) {
  int __pyx_v__have_arch;
  GEN __pyx_v__bnf;
  GEN __pyx_v__bound;
  GEN __pyx_v__arch;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrdisclist", 0);
  __Pyx_INCREF(__pyx_v_bound);
  __Pyx_INCREF(__pyx_v_arch);

  /* "cypari/auto_gen.pxi":4160
 *         or :literal:`bnrdisc` are (much) more efficient.
 *         '''
 *         bound = objtogen(bound)             # <<<<<<<<<<<<<<
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bound, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4160, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bound, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4161
 *         '''
 *         bound = objtogen(bound)
 *         cdef bint _have_arch = (arch is not None)             # <<<<<<<<<<<<<<
 *         if _have_arch:
 *             arch = objtogen(arch)
 */
  __pyx_t_2 = (__pyx_v_arch != Py_None);
  __pyx_v__have_arch = __pyx_t_2;

  /* "cypari/auto_gen.pxi":4162
 *         bound = objtogen(bound)
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             arch = objtogen(arch)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_arch != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":4163
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:
 *             arch = objtogen(arch)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_arch, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_arch, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":4162
 *         bound = objtogen(bound)
 *         cdef bint _have_arch = (arch is not None)
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             arch = objtogen(arch)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4164
 *         if _have_arch:
 *             arch = objtogen(arch)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _bound = (<Gen>bound).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4164, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4165
 *             arch = objtogen(arch)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4166
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _bound = (<Gen>bound).g             # <<<<<<<<<<<<<<
 *         cdef GEN _arch = NULL
 *         if _have_arch:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bound)->__pyx_base.g;
  __pyx_v__bound = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4167
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL             # <<<<<<<<<<<<<<
 *         if _have_arch:
 *             _arch = (<Gen>arch).g
 */
  __pyx_v__arch = NULL;

  /* "cypari/auto_gen.pxi":4168
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 */
  __pyx_t_2 = (__pyx_v__have_arch != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":4169
 *         cdef GEN _arch = NULL
 *         if _have_arch:
 *             _arch = (<Gen>arch).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_arch)->__pyx_base.g;
    __pyx_v__arch = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4168
 *         cdef GEN _bound = (<Gen>bound).g
 *         cdef GEN _arch = NULL
 *         if _have_arch:             # <<<<<<<<<<<<<<
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 */
  }

  /* "cypari/auto_gen.pxi":4170
 *         if _have_arch:
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrdisclist0(__pyx_v__bnf, __pyx_v__bound, __pyx_v__arch);

  /* "cypari/auto_gen.pxi":4171
 *             _arch = (<Gen>arch).g
 *         cdef GEN _ret = bnrdisclist0(_bnf, _bound, _arch)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrgaloisapply(bnr, mat, H):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4117
 *         return new_gen(_ret)
 * 
 *     def bnrdisclist(bnf, bound, arch=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` being as output by :literal:`bnfinit` (with units), computes a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrdisclist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bound);
  __Pyx_XDECREF(__pyx_v_arch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4173
 *         return new_gen(_ret)
 * 
 *     def bnrgaloisapply(bnr, mat, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the automorphism given by its matrix :emphasis:`mat` to the congruence
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_269bnrgaloisapply(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_268bnrgaloisapply[] = "\n        Apply the automorphism given by its matrix :emphasis:`mat` to the congruence\n        subgroup :math:`H` given as a HNF matrix.\n        The matrix :emphasis:`mat` can be computed with :literal:`bnrgaloismatrix`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_269bnrgaloisapply(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mat = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrgaloisapply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mat,&__pyx_n_s_H,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_mat)) != 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_H)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrgaloisapply", 1, 2, 2, 1); __PYX_ERR(10, 4173, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrgaloisapply") < 0)) __PYX_ERR(10, 4173, __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_mat = values[0];
    __pyx_v_H = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrgaloisapply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4173, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_268bnrgaloisapply(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_mat, __pyx_v_H);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_268bnrgaloisapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_mat, PyObject *__pyx_v_H) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__mat;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrgaloisapply", 0);
  __Pyx_INCREF(__pyx_v_mat);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":4179
 *         The matrix :emphasis:`mat` can be computed with :literal:`bnrgaloismatrix`.
 *         '''
 *         mat = objtogen(mat)             # <<<<<<<<<<<<<<
 *         H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_mat, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4179, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_mat, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4180
 *         '''
 *         mat = objtogen(mat)
 *         H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4181
 *         mat = objtogen(mat)
 *         H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _mat = (<Gen>mat).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4181, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4182
 *         H = objtogen(H)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _mat = (<Gen>mat).g
 *         cdef GEN _H = (<Gen>H).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4183
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _mat = (<Gen>mat).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mat)->__pyx_base.g;
  __pyx_v__mat = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4184
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _mat = (<Gen>mat).g
 *         cdef GEN _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
  __pyx_v__H = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4185
 *         cdef GEN _mat = (<Gen>mat).g
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrgaloisapply(__pyx_v__bnr, __pyx_v__mat, __pyx_v__H);

  /* "cypari/auto_gen.pxi":4186
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _ret = bnrgaloisapply(_bnr, _mat, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrgaloismatrix(bnr, aut):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4173
 *         return new_gen(_ret)
 * 
 *     def bnrgaloisapply(bnr, mat, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the automorphism given by its matrix :emphasis:`mat` to the congruence
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mat);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4188
 *         return new_gen(_ret)
 * 
 *     def bnrgaloismatrix(bnr, aut):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the matrix of the action of the automorphism :emphasis:`aut` of the base
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_271bnrgaloismatrix(PyObject *__pyx_v_bnr, PyObject *__pyx_v_aut); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_270bnrgaloismatrix[] = "\n        Return the matrix of the action of the automorphism :emphasis:`aut` of the base\n        field :literal:`bnf.nf` on the generators of the ray class field :literal:`bnr.gen`.\n        :emphasis:`aut` can be given as a polynomial, an algebraic number, or a vector of\n        automorphisms or a Galois group as output by :literal:`galoisinit`, in which case a\n        vector of matrices is returned (in the later case, only for the generators\n        :literal:`aut.gen`).\n        \n        See :literal:`bnrisgalois` for an example.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_271bnrgaloismatrix(PyObject *__pyx_v_bnr, PyObject *__pyx_v_aut) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrgaloismatrix (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_270bnrgaloismatrix(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), ((PyObject *)__pyx_v_aut));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_270bnrgaloismatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_aut) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__aut;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrgaloismatrix", 0);
  __Pyx_INCREF(__pyx_v_aut);

  /* "cypari/auto_gen.pxi":4199
 *         See :literal:`bnrisgalois` for an example.
 *         '''
 *         aut = objtogen(aut)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_aut, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_aut, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4200
 *         '''
 *         aut = objtogen(aut)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _aut = (<Gen>aut).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4200, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4201
 *         aut = objtogen(aut)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4202
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _aut = (<Gen>aut).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_aut)->__pyx_base.g;
  __pyx_v__aut = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4203
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrgaloismatrix(__pyx_v__bnr, __pyx_v__aut);

  /* "cypari/auto_gen.pxi":4204
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _ret = bnrgaloismatrix(_bnr, _aut)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrinit(bnf, f, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4188
 *         return new_gen(_ret)
 * 
 *     def bnrgaloismatrix(bnr, aut):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the matrix of the action of the automorphism :emphasis:`aut` of the base
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrgaloismatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_aut);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4206
 *         return new_gen(_ret)
 * 
 *     def bnrinit(bnf, f, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` is as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_273bnrinit(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_272bnrinit[] = "\n        :math:`bnf` is as\n        output by :literal:`bnfinit` (including fundamental units), :math:`f` is a modulus,\n        initializes data linked to the ray class group structure corresponding to\n        this module, a so-called :literal:`bnr` structure. One can input the attached\n        :emphasis:`bid` with generators for :math:`f` instead of the module itself, saving some\n        time. (As in :literal:`idealstar`, the finite part of the conductor may be given\n        by a factorization into prime ideals, as produced by :literal:`idealfactor`.)\n        \n        The following member functions are available\n        on the result: :literal:`.bnf` is the underlying :emphasis:`bnf`,\n        :literal:`.mod` the modulus, :literal:`.bid` the :literal:`bid` structure attached to the\n        modulus; finally, :literal:`.clgp`, :literal:`.no`, :literal:`.cyc`, :literal:`.gen` refer to the\n        ray class group (as a finite abelian group), its cardinality, its elementary\n        divisors, its generators (only computed if :math:`flag = 1`).\n        \n        The last group of functions are different from the members of the underlying\n        :emphasis:`bnf`, which refer to the class group; use :literal:`:emphasis:`bnr`.bnf.:emphasis:`xxx``\n        to access these, e.g.\302\240:literal:`:emphasis:`bnr`.bnf.cyc` to get the cyclic decomposition\n        of the class group.\n        \n        They are also different from the members of the underlying :emphasis:`bid`, which\n        refer to :math:`(\\mathbb{Z}_K/f)^*`; use :literal:`:emphasis:`bnr`.bid.:emphasis:`xxx`` to access these,\n        e.g.\302\240:literal:`:emphasis:`bnr`.bid.no` to get :math:`\\phi (f)`.\n        \n        If :math:`flag = 0` (default), the generators of the ray class group are not computed,\n        which saves time. Hence :literal:`:emphasis:`bnr`.gen` would produce an error.\n        \n        If :math:`flag = 1`, as the default, except that generators are computed.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_273bnrinit(PyObject *__pyx_v_bnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_flag,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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrinit") < 0)) __PYX_ERR(10, 4206, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4206, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4206, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_272bnrinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), __pyx_v_f, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_272bnrinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_f, long __pyx_v_flag) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrinit", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_gen.pxi":4237
 *         If :math:`flag = 1`, as the default, except that generators are computed.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4238
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4238, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4239
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4240
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4241
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrinit0(__pyx_v__bnf, __pyx_v__f, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":4242
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = bnrinit0(_bnf, _f, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrisconductor(A, B=None, C=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4206
 *         return new_gen(_ret)
 * 
 *     def bnrinit(bnf, f, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`bnf` is as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4244
 *         return new_gen(_ret)
 * 
 *     def bnrisconductor(A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fast variant of :literal:`bnrconductor`:math:`(A,B,C)`; :math:`A`, :math:`B`, :math:`C` represent
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_275bnrisconductor(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_274bnrisconductor[] = "\n        Fast variant of :literal:`bnrconductor`:math:`(A,B,C)`; :math:`A`, :math:`B`, :math:`C` represent\n        an extension of the base field, given by class field theory\n        (see\302\240``CFT`` (in the PARI manual)). Outputs 1 if this modulus is the conductor, and 0\n        otherwise. This is slightly faster than :literal:`bnrconductor` when the\n        character or subgroup is not primitive.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_275bnrisconductor(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_C = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrisconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_C,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrisconductor") < 0)) __PYX_ERR(10, 4244, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_B = values[0];
    __pyx_v_C = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrisconductor", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4244, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrisconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_274bnrisconductor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_B, __pyx_v_C);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_274bnrisconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C) {
  int __pyx_v__have_B;
  int __pyx_v__have_C;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__C;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrisconductor", 0);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_C);

  /* "cypari/auto_gen.pxi":4252
 *         character or subgroup is not primitive.
 *         '''
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_1 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4253
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4254
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4254, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4253
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 */
  }

  /* "cypari/auto_gen.pxi":4255
 *         if _have_B:
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             C = objtogen(C)
 */
  __pyx_t_1 = (__pyx_v_C != Py_None);
  __pyx_v__have_C = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4256
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4257
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:
 *             C = objtogen(C)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_C, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_C, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4256
 *             B = objtogen(B)
 *         cdef bint _have_C = (C is not None)
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             C = objtogen(C)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4258
 *         if _have_C:
 *             C = objtogen(C)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4258, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4259
 *             C = objtogen(C)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4260
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_gen.pxi":4261
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4262
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _C = NULL
 *         if _have_C:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4261
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 */
  }

  /* "cypari/auto_gen.pxi":4263
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL             # <<<<<<<<<<<<<<
 *         if _have_C:
 *             _C = (<Gen>C).g
 */
  __pyx_v__C = NULL;

  /* "cypari/auto_gen.pxi":4264
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 */
  __pyx_t_1 = (__pyx_v__have_C != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4265
 *         cdef GEN _C = NULL
 *         if _have_C:
 *             _C = (<Gen>C).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_C)->__pyx_base.g;
    __pyx_v__C = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4264
 *             _B = (<Gen>B).g
 *         cdef GEN _C = NULL
 *         if _have_C:             # <<<<<<<<<<<<<<
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 */
  }

  /* "cypari/auto_gen.pxi":4266
 *         if _have_C:
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bnrisconductor0(__pyx_v__A, __pyx_v__B, __pyx_v__C);

  /* "cypari/auto_gen.pxi":4267
 *             _C = (<Gen>C).g
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":4268
 *         cdef long _ret = bnrisconductor0(_A, _B, _C)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def bnrisgalois(bnr, gal, H):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4268, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4244
 *         return new_gen(_ret)
 * 
 *     def bnrisconductor(A, B=None, C=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fast variant of :literal:`bnrconductor`:math:`(A,B,C)`; :math:`A`, :math:`B`, :math:`C` represent
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrisconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_C);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4270
 *         return _ret
 * 
 *     def bnrisgalois(bnr, gal, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Check whether the class field attached to the subgroup :math:`H` is Galois
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_277bnrisgalois(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_276bnrisgalois[] = "\n        Check whether the class field attached to the subgroup :math:`H` is Galois\n        over the subfield of :literal:`bnr.nf` fixed by the group :emphasis:`gal`, which can be\n        given as output by :literal:`galoisinit`, or as a matrix or a vector of matrices as\n        output by :literal:`bnrgaloismatrix`, the second option being preferable, since it\n        saves the recomputation of the matrices. Note: The function assumes that the\n        ray class field attached to bnr is Galois, which is not checked.\n        \n        In the following example, we lists the congruence subgroups of subextension of\n        degree at most :math:`3` of the ray class field of conductor :math:`9` which are Galois\n        over the rationals.\n        \n        ::\n        \n            K=bnfinit(a^4-3*a^2+253009);\n            G=galoisinit(K);\n            B=bnrinit(K,9,1);\n            L1=[H|H<-subgrouplist(B,3), bnrisgalois(B,G,H)]\n            ##\n            M=bnrgaloismatrix(B,G)\n            L2=[H|H<-subgrouplist(B,3), bnrisgalois(B,M,H)]\n            ##\n        \n        The second computation is much faster since :literal:`bnrgaloismatrix(B,G)` is\n        computed only once.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_277bnrisgalois(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrisgalois (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_H,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_gal)) != 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_H)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("bnrisgalois", 1, 2, 2, 1); __PYX_ERR(10, 4270, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrisgalois") < 0)) __PYX_ERR(10, 4270, __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_gal = values[0];
    __pyx_v_H = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrisgalois", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4270, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrisgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_276bnrisgalois(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_gal, __pyx_v_H);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_276bnrisgalois(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_gal, PyObject *__pyx_v_H) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__gal;
  GEN __pyx_v__H;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrisgalois", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":4297
 *         computed only once.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4298
 *         '''
 *         gal = objtogen(gal)
 *         H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4299
 *         gal = objtogen(gal)
 *         H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4299, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4300
 *         H = objtogen(H)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _H = (<Gen>H).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4301
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = (<Gen>H).g
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4302
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
  __pyx_v__H = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4303
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _H = (<Gen>H).g
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = bnrisgalois(__pyx_v__bnr, __pyx_v__gal, __pyx_v__H);

  /* "cypari/auto_gen.pxi":4304
 *         cdef GEN _H = (<Gen>H).g
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":4305
 *         cdef long _ret = bnrisgalois(_bnr, _gal, _H)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def bnrisprincipal(bnr, x, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4270
 *         return _ret
 * 
 *     def bnrisgalois(bnr, gal, H):             # <<<<<<<<<<<<<<
 *         r'''
 *         Check whether the class field attached to the subgroup :math:`H` is Galois
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrisgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4307
 *         return _ret
 * 
 *     def bnrisprincipal(bnr, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the ray class group data output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_279bnrisprincipal(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_278bnrisprincipal[] = "\n        Let :emphasis:`bnr` be the ray class group data output by\n        :literal:`bnrinit`:math:`(,,1)` and let :math:`x` be an ideal in any form, coprime\n        to the modulus :math:`f = bnr.mod`. Solves the discrete logarithm problem\n        in the ray class group, with respect to the generators :literal:`bnr.gen`,\n        in a way similar to :literal:`bnfisprincipal`. If :math:`x` is not coprime to the\n        modulus of :emphasis:`bnr` the result is undefined.\n        \n        If :math:`flag = 1`, returns a 2-component vector :math:`v` where :math:`v[1]` is the\n        vector of components of :math:`x` on the ray class group generators, :math:`v[2]` is\n        an element :math:`\\alpha` congruent to :math:`1\302\240mod^* f` such that\n        :math:`x = \\alpha \\prod_i g_i^{x_i}`.\n        \n        If :math:`flag = 0`, outputs only :math:`v_1`. In that case, :emphasis:`bnr` need not contain the\n        ray class group generators, i.e.\302\240it may be created with\n        :literal:`bnrinit`:math:`(,,0)`; in that case, although :literal:`bnr.gen` is undefined, we\n        can still define canonical generators attached to the :literal:`bnr` and compute\n        with respect to them.\n        \n        ::\n        \n            ? K = bnfinit(x^2 - 30); bnr = bnrinit(K, [4, [1,1]]);\n            ? bnr.clgp \\\\ ray class group is isomorphic to Z/4 x Z/2 x Z/2\n            %2 = [16, [4, 2, 2]]\n            ? P = idealprimedec(K, 3)[1]; \\\\ a prime ideal above 3\n            ? bnrisprincipal(bnr,P)\n            %4 = [[1, 0, 0]~, 1]\n            ? bnrisprincipal(bnr,P, 0) \\\\ omit the principal part\n            %4 = [1, 0, 0]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_279bnrisprincipal(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrisprincipal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrisprincipal") < 0)) __PYX_ERR(10, 4307, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4307, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrisprincipal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4307, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_278bnrisprincipal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_278bnrisprincipal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrisprincipal", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":4338
 *             %4 = [1, 0, 0]~
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4339
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4339, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4340
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4341
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4342
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrisprincipal(__pyx_v__bnr, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":4343
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = bnrisprincipal(_bnr, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrrootnumber(bnr, chi, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4307
 *         return _ret
 * 
 *     def bnrisprincipal(bnr, x, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`bnr` be the ray class group data output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrisprincipal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4345
 *         return new_gen(_ret)
 * 
 *     def bnrrootnumber(bnr, chi, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`\chi = chi` is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_281bnrrootnumber(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_280bnrrootnumber[] = "\n        If :math:`\\chi = chi` is a\n        character over :emphasis:`bnr`, not necessarily primitive, let\n        :math:`L(s,\\chi) = \\sum_{id} \\chi (id) N(id)^{-s}` be the attached\n        Artin L-function. Returns the so-called Artin root number, i.e.\302\240the\n        complex number :math:`W(\\chi)` of modulus 1 such that\n        \n        .. MATH::\n        \n            \\Lambda (1-s,\\chi) = W(\\chi) \\Lambda (s,\\overline{\\chi})\n        \n        where :math:`\\Lambda (s,\\chi) = A(\\chi)^{s/2}\\gamma_\\chi (s) L(s,\\chi)` is\n        the enlarged L-function attached to :math:`L`.\n        \n        You can set :math:`flag = 1` if the character is known to be primitive. Example:\n        \n        ::\n        \n            bnf = bnfinit(x^2 - x - 57);\n            bnr = bnrinit(bnf, [7,[1,1]]);\n            bnrrootnumber(bnr, [2,1])\n        \n        returns the root number of the character :math:`\\chi` of\n        :math:`\\mathrm{Cl}_{7 oo _1 oo _2}(\\mathbb{Q} (\\sqrt{229}))` defined by :math:`\\chi (g_1^ag_2^b)\n        = \\zeta_1^{2a}\\zeta_2^b`. Here :math:`g_1, g_2` are the generators of the\n        ray-class group given by :literal:`bnr.gen` and :math:`\\zeta_1 = e^{2i\\pi/N_1},\n        \\zeta_2 = e^{2i\\pi/N_2}` where :math:`N_1, N_2` are the orders of :math:`g_1` and\n        :math:`g_2` respectively (:math:`N_1 = 6` and :math:`N_2 = 3` as :literal:`bnr.cyc` readily tells us).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_281bnrrootnumber(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrrootnumber (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_chi)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrrootnumber") < 0)) __PYX_ERR(10, 4345, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chi = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4345, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4345, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrrootnumber", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4345, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrrootnumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_280bnrrootnumber(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_chi, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_280bnrrootnumber(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_chi, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("bnrrootnumber", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":4375
 *         :math:`g_2` respectively (:math:`N_1 = 6` and :math:`N_2 = 3` as :literal:`bnr.cyc` readily tells us).
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4376
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4376, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4377
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4378
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4379
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":4380
 *         cdef GEN _chi = (<Gen>chi).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrrootnumber(__pyx_v__bnr, __pyx_v__chi, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":4381
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrrootnumber(_bnr, _chi, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def bnrstark(bnr, subgroup=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4345
 *         return new_gen(_ret)
 * 
 *     def bnrrootnumber(bnr, chi, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`\chi = chi` is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrrootnumber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4383
 *         return new_gen(_ret)
 * 
 *     def bnrstark(bnr, subgroup=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit`, finds a relative equation
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_283bnrstark(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_282bnrstark[] = "\n        :emphasis:`bnr` being as output by :literal:`bnrinit`, finds a relative equation\n        for the class field corresponding to the modulus in :emphasis:`bnr` and the given\n        congruence subgroup (as usual, omit :math:`subgroup` if you want the whole ray\n        class group).\n        \n        The main variable of :emphasis:`bnr` must not be :math:`x`, and the ground field and the\n        class field must be totally real. When the base field is :math:`\\mathbb{Q}`, the vastly\n        simpler :literal:`galoissubcyclo` is used instead. Here is an example:\n        \n        ::\n        \n            bnf = bnfinit(y^2 - 3);\n            bnr = bnrinit(bnf, 5);\n            bnrstark(bnr)\n        \n        returns the ray class field of :math:`\\mathbb{Q} (\\sqrt{3})` modulo :math:`5`. Usually, one wants\n        to apply to the result one of\n        \n        ::\n        \n            rnfpolredabs(bnf, pol, 16) \\\\ compute a reduced relative polynomial\n            rnfpolredabs(bnf, pol, 16 + 2) \\\\ compute a reduced absolute polynomial\n        \n        The routine uses Stark units and needs to find a suitable auxiliary\n        conductor, which may not exist when the class field is not cyclic over the\n        base. In this case :literal:`bnrstark` is allowed to return a vector of\n        polynomials defining :emphasis:`independent` relative extensions, whose compositum\n        is the requested class field. It was decided that it was more useful\n        to keep the extra information thus made available, hence the user has to take\n        the compositum herself.\n        \n        Even if it exists, the auxiliary conductor may be so large that later\n        computations become unfeasible. (And of course, Stark's conjecture may simply\n        be wrong.) In case of difficulties, try :literal:`rnfkummer`:\n        \n        ::\n        \n            ? bnr = bnrinit(bnfinit(y^8-12*y^6+36*y^4-36*y^2+9,1), 2);\n            ? bnrstark(bnr)\n      ""       *** at top-level: bnrstark(bnr)\n             *** ^-------------\n             *** bnrstark: need 3919350809720744 coefficients in initzeta.\n             *** Computation impossible.\n            ? lift( rnfkummer(bnr) )\n            time = 24 ms.\n            %2 = x^2 + (1/3*y^6 - 11/3*y^4 + 8*y^2 - 5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_283bnrstark(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_subgroup = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnrstark (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_subgroup,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subgroup);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bnrstark") < 0)) __PYX_ERR(10, 4383, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_subgroup = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4383, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bnrstark", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4383, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrstark", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_282bnrstark(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_subgroup, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_282bnrstark(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_subgroup, long __pyx_v_precision) {
  int __pyx_v__have_subgroup;
  GEN __pyx_v__bnr;
  GEN __pyx_v__subgroup;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("bnrstark", 0);
  __Pyx_INCREF(__pyx_v_subgroup);

  /* "cypari/auto_gen.pxi":4432
 *             %2 = x^2 + (1/3*y^6 - 11/3*y^4 + 8*y^2 - 5)
 *         '''
 *         cdef bint _have_subgroup = (subgroup is not None)             # <<<<<<<<<<<<<<
 *         if _have_subgroup:
 *             subgroup = objtogen(subgroup)
 */
  __pyx_t_1 = (__pyx_v_subgroup != Py_None);
  __pyx_v__have_subgroup = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4433
 *         '''
 *         cdef bint _have_subgroup = (subgroup is not None)
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             subgroup = objtogen(subgroup)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_subgroup != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4434
 *         cdef bint _have_subgroup = (subgroup is not None)
 *         if _have_subgroup:
 *             subgroup = objtogen(subgroup)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_subgroup, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_subgroup, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4433
 *         '''
 *         cdef bint _have_subgroup = (subgroup is not None)
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             subgroup = objtogen(subgroup)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4435
 *         if _have_subgroup:
 *             subgroup = objtogen(subgroup)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4435, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4436
 *             subgroup = objtogen(subgroup)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4437
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL             # <<<<<<<<<<<<<<
 *         if _have_subgroup:
 *             _subgroup = (<Gen>subgroup).g
 */
  __pyx_v__subgroup = NULL;

  /* "cypari/auto_gen.pxi":4438
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_subgroup != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4439
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:
 *             _subgroup = (<Gen>subgroup).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_subgroup)->__pyx_base.g;
    __pyx_v__subgroup = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4438
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgroup = NULL
 *         if _have_subgroup:             # <<<<<<<<<<<<<<
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":4440
 *         if _have_subgroup:
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":4441
 *             _subgroup = (<Gen>subgroup).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bnrstark(__pyx_v__bnr, __pyx_v__subgroup, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":4442
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bnrstark(_bnr, _subgroup, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def call(f, A):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4383
 *         return new_gen(_ret)
 * 
 *     def bnrstark(bnr, subgroup=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit`, finds a relative equation
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.bnrstark", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_subgroup);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4444
 *         return new_gen(_ret)
 * 
 *     def call(f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A = [a_1,..., a_n]` being a vector and :math:`f` being a function, returns the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_285call(PyObject *__pyx_v_f, PyObject *__pyx_v_A); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_284call[] = "\n        :math:`A = [a_1,..., a_n]` being a vector and :math:`f` being a function, returns the\n        evaluation of :math:`f(a_1,...,a_n)`.\n        :math:`f` can also be the name of a built-in GP function.\n        If :math:`\\# A = 1`, :literal:`call` (:math:`f,A`) = :literal:`apply` (:math:`f,A`)[1].\n        If :math:`f` is variadic, the variadic arguments must grouped in a vector in\n        the last component of :math:`A`.\n        \n        This function is useful\n        \n        - when writing a variadic function, to call another one:\n        \n        ::\n        \n            fprintf(file,format,args[..]) = write(file,call(Strprintf,[format,args]))\n        \n        - when dealing with function arguments with unspecified arity\n        \n        The function below implements a global memoization interface:\n        \n        ::\n        \n            memo=Map();\n            memoize(f,A[..])=\n            {\n             my(res);\n             if(!mapisdefined(memo, [f,A], &res),\n             res = call(f,A);\n             mapput(memo,[f,A],res));\n             res;\n            }\n        \n        for example:\n        \n        ::\n        \n            ? memoize(factor,2^128+1)\n            %3 = [59649589127497217,1;5704689200685129054721,1]\n            ? ##\n             *** last result computed in 76 ms.\n            ? memoize(factor,2^128+1)\n            %4 = [59649589127497217,1;5704689200685129054721,1]\n            ? ##\n             *** last result computed in 0 ms.\n            ? memoize(ffinit,3,3)\n            %5 = Mod(1,3)*x^3+Mod(1,3)*x^2+Mod(1,3)*x+Mod(2,3)\n            ? fibo(n)=if(n==0,0,n==1,1,memoize(fibo,n-2)+memoize(fibo,n-1));\n            ? fibo(100)\n            %7 = 354224848179261915075\n        \n        - to call operators through their internal names without using\n          :literal:`alias`\n        \n        ::\n        \n            matnbelts(M) = call(\"_*_\",matsize(M))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_285call(PyObject *__pyx_v_f, PyObject *__pyx_v_A) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("call (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_284call(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_A));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_284call(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("call", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_gen.pxi":4502
 *             matnbelts(M) = call("_*_",matsize(M))
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4502, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4503
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4503, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4504
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = call0(_f, _A)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4505
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = call0(_f, _A)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4506
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = call0(_f, _A)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = call0(__pyx_v__f, __pyx_v__A);

  /* "cypari/auto_gen.pxi":4507
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = call0(_f, _A)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ceil(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4444
 *         return new_gen(_ret)
 * 
 *     def call(f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A = [a_1,..., a_n]` being a vector and :math:`f` being a function, returns the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.call", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4509
 *         return new_gen(_ret)
 * 
 *     def ceil(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ceiling of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_287ceil(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_286ceil[] = "\n        Ceiling of :math:`x`. When :math:`x` is in :math:`\\mathbb{R}`, the result is the\n        smallest integer greater than or equal to :math:`x`. Applied to a rational\n        function, :math:`ceil (x)` returns the Euclidean quotient of the numerator by\n        the denominator.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_287ceil(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ceil (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_286ceil(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_286ceil(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ceil", 0);

  /* "cypari/auto_gen.pxi":4516
 *         the denominator.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gceil(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 4516, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4517
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gceil(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":4518
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gceil(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gceil(__pyx_v__x);

  /* "cypari/auto_gen.pxi":4519
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gceil(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def centerlift(x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 4519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4509
 *         return new_gen(_ret)
 * 
 *     def ceil(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ceiling of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ceil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4521
 *         return new_gen(_ret)
 * 
 *     def centerlift(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`lift`, except that :literal:`t_INTMOD` and :literal:`t_PADIC` components
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_289centerlift(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_288centerlift[] = "\n        Same as :literal:`lift`, except that :literal:`t_INTMOD` and :literal:`t_PADIC` components\n        are lifted using centered residues:\n        \n        - for a :literal:`t_INTMOD` :math:`x\\in \\mathbb{Z}/n\\mathbb{Z}`, the lift :math:`y` is such that\n          :math:`-n/2 < y <= n/2`.\n        \n        - a :literal:`t_PADIC` :math:`x` is lifted in the same way as above (modulo\n          :math:`p^padicprec(x)`) if its valuation :math:`v` is non-negative; if not, returns\n          the fraction :math:`p^v` :literal:`centerlift`:math:`(x p^{-v})`; in particular, rational\n          reconstruction is not attempted. Use :literal:`bestappr` for this.\n        \n        For backward compatibility, :literal:`centerlift(x,'v)` is allowed as an alias\n        for :literal:`lift(x,'v)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_289centerlift(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("centerlift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "centerlift") < 0)) __PYX_ERR(10, 4521, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("centerlift", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4521, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.centerlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_288centerlift(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_288centerlift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("centerlift", 0);

  /* "cypari/auto_gen.pxi":4537
 *         for :literal:`lift(x,'v)`.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":4538
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":4539
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 4539, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":4538
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4540
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = centerlift0(_x, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 4540, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4541
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = centerlift0(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":4542
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = centerlift0(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = centerlift0(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":4543
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = centerlift0(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def characteristic(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 4543, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4521
 *         return new_gen(_ret)
 * 
 *     def centerlift(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`lift`, except that :literal:`t_INTMOD` and :literal:`t_PADIC` components
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.centerlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4545
 *         return new_gen(_ret)
 * 
 *     def characteristic(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the characteristic of the base ring over which :math:`x` is defined (as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_291characteristic(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_290characteristic[] = "\n        Returns the characteristic of the base ring over which :math:`x` is defined (as\n        defined by :literal:`t_INTMOD` and :literal:`t_FFELT` components). The function raises an\n        exception if incompatible primes arise from :literal:`t_FFELT` and :literal:`t_PADIC`\n        components.\n        \n        ::\n        \n            ? characteristic(Mod(1,24)*x + Mod(1,18)*y)\n            %1 = 6\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_291characteristic(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("characteristic (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_290characteristic(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_290characteristic(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("characteristic", 0);

  /* "cypari/auto_gen.pxi":4557
 *             %1 = 6
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = characteristic(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 4557, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4558
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = characteristic(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":4559
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = characteristic(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = characteristic(__pyx_v__x);

  /* "cypari/auto_gen.pxi":4560
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = characteristic(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charconj(cyc, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 4560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4545
 *         return new_gen(_ret)
 * 
 *     def characteristic(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the characteristic of the base ring over which :math:`x` is defined (as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.characteristic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4562
 *         return new_gen(_ret)
 * 
 *     def charconj(cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_293charconj(PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_292charconj[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`\\chi = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        This function returns the conjugate character.\n        \n        ::\n        \n            ? cyc = [15,5]; chi = [1,1];\n            ? charconj(cyc, chi)\n            %2 = [14, 4]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charconj(bnf, [1])\n            %5 = [2]\n        \n        For Dirichlet characters (when :literal:`cyc` is\n        :literal:`znstar(q,1)`), characters in Conrey representation are available,\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`:\n        \n        ::\n        \n            ? G = znstar(8, 1); \\\\ (Z/8Z)^*\n            ? charorder(G, 3) \\\\ Conrey label\n            %2 = 2\n            ? chi = znconreylog(G, 3);\n            ? charorder(G, chi) \\\\ Conrey logarithm\n            %4 = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_293charconj(PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charconj (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_292charconj(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cyc), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_292charconj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charconj", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":4598
 *             %4 = 2
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4599
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4599, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4600
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charconj0(_cyc, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4601
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charconj0(_cyc, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4602
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charconj0(_cyc, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charconj0(__pyx_v__cyc, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":4603
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charconj0(_cyc, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chardiv(cyc, a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4562
 *         return new_gen(_ret)
 * 
 *     def charconj(cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.charconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4605
 *         return new_gen(_ret)
 * 
 *     def chardiv(cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_295chardiv(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_294chardiv[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`a = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        Given two characters :math:`a` and :math:`b`, return the character\n        :math:`a / b = a \\overline{b}`.\n        \n        ::\n        \n            ? cyc = [15,5]; a = [1,1]; b = [2,4];\n            ? chardiv(cyc, a,b)\n            %2 = [14, 2]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? chardiv(bnf, [1], [2])\n            %5 = [2]\n        \n        For Dirichlet characters on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, additional\n        representations are available (Conrey labels, Conrey logarithm),\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        If the two characters are in the same format, the\n        result is given in the same format, otherwise a Conrey logarithm is used.\n        \n        ::\n        \n            ? G = znstar(100, 1);\n            ? G.cyc\n            %2 = [20, 2]\n            ? a = [10, 1]; \\\\ usual representation for characters\n            ? b = 7; \\\\ Conrey label;\n            ? c = znconreylog(G, 11); \\\\ Conrey log\n            ? chardiv(G, b,b)\n            %6 = 1 \\\\ Conrey label\n            ? chardiv(G, a,b)\n            %7 = [0, 5]~ \\\\ Conrey log\n            ? chardiv(G, a,c)\n            %7 = [0, 14]~ \\\\ Conrey log\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_295chardiv(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chardiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chardiv", 1, 2, 2, 1); __PYX_ERR(10, 4605, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chardiv") < 0)) __PYX_ERR(10, 4605, __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_a = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chardiv", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4605, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.chardiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_294chardiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cyc), __pyx_v_a, __pyx_v_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_294chardiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("chardiv", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":4650
 *             %7 = [0, 14]~ \\ Conrey log
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4651
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4652
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4652, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4653
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4654
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4655
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4656
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chardiv0(__pyx_v__cyc, __pyx_v__a, __pyx_v__b);

  /* "cypari/auto_gen.pxi":4657
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = chardiv0(_cyc, _a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chareval(G, chi, x, z=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4605
 *         return new_gen(_ret)
 * 
 *     def chardiv(cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.chardiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4659
 *         return new_gen(_ret)
 * 
 *     def chareval(G, chi, x, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be an abelian group structure affording a discrete logarithm
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_297chareval(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_296chareval[] = "\n        Let :math:`G` be an abelian group structure affording a discrete logarithm\n        method, e.g :math:`G = znstar (N, 1)` for :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` or a :literal:`bnr`\n        structure, let :math:`x` be an element of :math:`G` and let :emphasis:`chi` be a character of\n        :math:`G` (see the note below for details). This function returns the value of\n        :emphasis:`chi` at :math:`x`.\n        \n        :strong:`Note on characters.`\n        Let :math:`K` be some field. If :math:`G` is an abelian group,\n        let :math:`\\chi: G \\to K^*` be a character of finite order and let :math:`o` be a\n        multiple of the character order such that :math:`\\chi (n) = \\zeta^{c(n)}` for some\n        fixed :math:`\\zeta\\in K^*` of multiplicative order :math:`o` and a unique morphism :math:`c: G\n        \\to (\\mathbb{Z}/o\\mathbb{Z},+)`. Our usual convention is to write\n        \n        .. MATH::\n        \n            G = (\\mathbb{Z}/o_1\\mathbb{Z}) g_1 \\oplus...\\oplus (\\mathbb{Z}/o_d\\mathbb{Z}) g_d\n        \n        for some generators :math:`(g_i)` of respective order :math:`d_i`, where the group has\n        exponent :math:`o := lcm_i o_i`. Since :math:`\\zeta^o = 1`, the vector :math:`(c_i)` in\n        :math:`\\prod (\\mathbb{Z}/o_i\\mathbb{Z})` defines a character :math:`\\chi` on :math:`G` via :math:`\\chi (g_i) =\n        \\zeta^{c_i (o/o_i)}` for all :math:`i`. Classical Dirichlet characters have values\n        in :math:`K = \\mathbb{C}` and we can take :math:`\\zeta = \\exp (2i\\pi/o)`.\n        \n        :strong:`Note on Dirichlet characters.`\n        In the special case where :emphasis:`bid` is attached to :math:`G = (\\mathbb{Z}/q\\mathbb{Z})^*`\n        (as per :literal:`G = znstar(q,1)`), the Dirichlet\n        character :emphasis:`chi` can be written in one of the usual 3 formats: a :literal:`t_VEC`\n        in terms of :literal:`bid.gen` as above, a :literal:`t_COL` in terms of the Conrey\n        generator""s, or a :literal:`t_INT` (Conrey label);\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        The character value is encoded as follows, depending on the optional\n        argument :math:`z`:\n        \n        - If :math:`z` is omitted: return the rational number :math:`c(x)/o` for :math:`x` coprime\n          to :math:`q`, where we normalize :math:`0 <= c(x) < o`. If :math:`x` can not be mapped to the\n          group (e.g. :math:`x` is not coprime to the conductor of a Dirichlet or Hecke\n          character) we return the sentinel value :math:`-1`.\n        \n        - If :math:`z` is an integer :math:`o`, then we assume that :math:`o` is a multiple of the\n          character order and we return the integer :math:`c(x)` when :math:`x` belongs\n          to the group, and the sentinel value :math:`-1` otherwise.\n        \n        - :math:`z` can be of the form :math:`[zeta, o]`, where :emphasis:`zeta`\n          is an :math:`o`-th root of :math:`1` and :math:`o` is a multiple of the character order.\n          We return :math:`\\zeta^{c(x)}` if :math:`x` belongs to the group, and the sentinel\n          value :math:`0` otherwise. (Note that this coincides with the usual extension\n          of Dirichlet characters to :math:`\\mathbb{Z}`, or of Hecke characters to general ideals.)\n        \n        - Finally, :math:`z` can be of the form :math:`[vzeta, o]`, where\n          :emphasis:`vzeta` is a vector of powers :math:`\\zeta^0,..., \\zeta^{o-1}`\n          of some :math:`o`-th root of :math:`1` and :math:`o` is a multiple of the character order.\n          As above, we return :math:`\\zeta^{c(x)}` after a table lookup. Or the sentinel\n          value :math:`0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_297chareval(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chareval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_x,&__pyx_n_s_z,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_chi)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("chareval", 0, 2, 3, 1); __PYX_ERR(10, 4659, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chareval") < 0)) __PYX_ERR(10, 4659, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_chi = values[0];
    __pyx_v_x = values[1];
    __pyx_v_z = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chareval", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4659, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.chareval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_296chareval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_chi, __pyx_v_x, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_296chareval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_x, PyObject *__pyx_v_z) {
  int __pyx_v__have_z;
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__x;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("chareval", 0);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":4716
 *           value :math:`0`.
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4717
 *         '''
 *         chi = objtogen(chi)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4718
 *         chi = objtogen(chi)
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_2 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_2;

  /* "cypari/auto_gen.pxi":4719
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":4720
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4720, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":4719
 *         x = objtogen(x)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4721
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4721, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4722
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4723
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4724
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4725
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_gen.pxi":4726
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":4727
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4726
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 */
  }

  /* "cypari/auto_gen.pxi":4728
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chareval(__pyx_v__G, __pyx_v__chi, __pyx_v__x, __pyx_v__z);

  /* "cypari/auto_gen.pxi":4729
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = chareval(_G, _chi, _x, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chargalois(cyc, ORD=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4659
 *         return new_gen(_ret)
 * 
 *     def chareval(G, chi, x, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be an abelian group structure affording a discrete logarithm
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.chareval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4731
 *         return new_gen(_ret)
 * 
 *     def chargalois(cyc, ORD=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary divisors
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_299chargalois(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_298chargalois[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary divisors\n        (any object which has a :literal:`.cyc` method is also allowed, i.e. the output of\n        :literal:`znstar` or :literal:`bnrinit`). Return a list of representatives for the\n        Galois orbits of complex characters of :math:`G`.\n        If :literal:`ORD` is present, select characters depending on their orders:\n        \n        - if :literal:`ORD` is a :literal:`t_INT`, restrict to orders less than this\n          bound;\n        \n        - if :literal:`ORD` is a :literal:`t_VEC` or :literal:`t_VECSMALL`, restrict to orders in\n          the list.\n        \n        ::\n        \n            ? G = znstar(96);\n            ? #chargalois(G) \\\\ 16 orbits of characters mod 96\n            %2 = 16\n            ? #chargalois(G,4) \\\\ order less than 4\n            %3 = 12\n            ? chargalois(G,[1,4]) \\\\ order 1 or 4; 5 orbits\n            %4 = [[0, 0, 0], [2, 0, 0], [2, 1, 0], [2, 0, 1], [2, 1, 1]]\n        \n        Given a character :math:`\\chi`, of order :math:`n` (:literal:`charorder(G,chi)`), the\n        elements in its orbit are the :math:`\\phi (n)` characters :math:`\\chi^i`, :math:`(i,n) = 1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_299chargalois(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ORD = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chargalois (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ORD,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ORD);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chargalois") < 0)) __PYX_ERR(10, 4731, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ORD = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chargalois", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4731, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.chargalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_298chargalois(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cyc), __pyx_v_ORD);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_298chargalois(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_ORD) {
  int __pyx_v__have_ORD;
  GEN __pyx_v__cyc;
  GEN __pyx_v__ORD;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("chargalois", 0);
  __Pyx_INCREF(__pyx_v_ORD);

  /* "cypari/auto_gen.pxi":4758
 *         elements in its orbit are the :math:`\phi (n)` characters :math:`\chi^i`, :math:`(i,n) = 1`.
 *         '''
 *         cdef bint _have_ORD = (ORD is not None)             # <<<<<<<<<<<<<<
 *         if _have_ORD:
 *             ORD = objtogen(ORD)
 */
  __pyx_t_1 = (__pyx_v_ORD != Py_None);
  __pyx_v__have_ORD = __pyx_t_1;

  /* "cypari/auto_gen.pxi":4759
 *         '''
 *         cdef bint _have_ORD = (ORD is not None)
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             ORD = objtogen(ORD)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_ORD != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4760
 *         cdef bint _have_ORD = (ORD is not None)
 *         if _have_ORD:
 *             ORD = objtogen(ORD)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ORD, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4760, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_ORD, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":4759
 *         '''
 *         cdef bint _have_ORD = (ORD is not None)
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             ORD = objtogen(ORD)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4761
 *         if _have_ORD:
 *             ORD = objtogen(ORD)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 4761, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4762
 *             ORD = objtogen(ORD)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_4;

  /* "cypari/auto_gen.pxi":4763
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL             # <<<<<<<<<<<<<<
 *         if _have_ORD:
 *             _ORD = (<Gen>ORD).g
 */
  __pyx_v__ORD = NULL;

  /* "cypari/auto_gen.pxi":4764
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 */
  __pyx_t_1 = (__pyx_v__have_ORD != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":4765
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:
 *             _ORD = (<Gen>ORD).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ORD)->__pyx_base.g;
    __pyx_v__ORD = __pyx_t_4;

    /* "cypari/auto_gen.pxi":4764
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _ORD = NULL
 *         if _have_ORD:             # <<<<<<<<<<<<<<
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 */
  }

  /* "cypari/auto_gen.pxi":4766
 *         if _have_ORD:
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chargalois(__pyx_v__cyc, __pyx_v__ORD);

  /* "cypari/auto_gen.pxi":4767
 *             _ORD = (<Gen>ORD).g
 *         cdef GEN _ret = chargalois(_cyc, _ORD)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charker(cyc, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 4767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4731
 *         return new_gen(_ret)
 * 
 *     def chargalois(cyc, ORD=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary divisors
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.chargalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ORD);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4769
 *         return new_gen(_ret)
 * 
 *     def charker(cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_301charker(PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_300charker[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`\\chi = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        This function returns the kernel of :math:`\\chi`, as a matrix :math:`K` in HNF which is a\n        left-divisor of :literal:`matdiagonal(d)`. Its columns express in terms of\n        the :math:`g_j` the generators of the subgroup. The determinant of :math:`K` is the\n        kernel index.\n        \n        ::\n        \n            ? cyc = [15,5]; chi = [1,1];\n            ? charker(cyc, chi)\n            %2 =\n            [15 12]\n            \n            [ 0 1]\n            \n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charker(bnf, [1])\n            %5 =\n            [3]\n        \n        Note that for Dirichlet characters (when :literal:`cyc` is\n        :literal:`znstar(q, 1)`), characters in Conrey representation are available,\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        ::\n        \n            ? G = znstar(8, 1); \\\\ (Z/8Z)^*\n            ? charker(G, 1) \\\\ Conrey label for trivial character\n            %2 =\n            [1 0]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_301charker(PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charker (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_300charker(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cyc), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_300charker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charker", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":4813
 *             [0 1]
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4814
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4814, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4815
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charker0(_cyc, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4816
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charker0(_cyc, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4817
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charker0(_cyc, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charker0(__pyx_v__cyc, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":4818
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charker0(_cyc, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charmul(cyc, a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4769
 *         return new_gen(_ret)
 * 
 *     def charker(cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.charker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4820
 *         return new_gen(_ret)
 * 
 *     def charmul(cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_303charmul(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_302charmul[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`a = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        Given two characters :math:`a` and :math:`b`, return the product character :math:`ab`.\n        \n        ::\n        \n            ? cyc = [15,5]; a = [1,1]; b = [2,4];\n            ? charmul(cyc, a,b)\n            %2 = [3, 0]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charmul(bnf, [1], [2])\n            %5 = [0]\n        \n        For Dirichlet characters on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, additional\n        representations are available (Conrey labels, Conrey logarithm), see\n        ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`. If the two characters are in\n        the same format, their\n        product is given in the same format, otherwise a Conrey logarithm is used.\n        \n        ::\n        \n            ? G = znstar(100, 1);\n            ? G.cyc\n            %2 = [20, 2]\n            ? a = [10, 1]; \\\\ usual representation for characters\n            ? b = 7; \\\\ Conrey label;\n            ? c = znconreylog(G, 11); \\\\ Conrey log\n            ? charmul(G, b,b)\n            %6 = 49 \\\\ Conrey label\n            ? charmul(G, a,b)\n            %7 = [0, 15]~ \\\\ Conrey log\n            ? charmul(G, a,c)\n            %7 = [0, 6]~ \\\\ Conrey log\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_303charmul(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charmul", 1, 2, 2, 1); __PYX_ERR(10, 4820, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charmul") < 0)) __PYX_ERR(10, 4820, __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_a = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4820, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.charmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_302charmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cyc), __pyx_v_a, __pyx_v_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_302charmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charmul", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":4864
 *             %7 = [0, 6]~ \\ Conrey log
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4865
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4866
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4866, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4867
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4868
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4869
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4870
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charmul0(__pyx_v__cyc, __pyx_v__a, __pyx_v__b);

  /* "cypari/auto_gen.pxi":4871
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = charmul0(_cyc, _a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charorder(cyc, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4871, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4820
 *         return new_gen(_ret)
 * 
 *     def charmul(cyc, a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.charmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4873
 *         return new_gen(_ret)
 * 
 *     def charorder(cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_305charorder(PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_304charorder[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`\\chi = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        This function returns the order of the character :literal:`chi`.\n        \n        ::\n        \n            ? cyc = [15,5]; chi = [1,1];\n            ? charorder(cyc, chi)\n            %2 = 15\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charorder(bnf, [1])\n            %5 = 3\n        \n        For Dirichlet characters (when :literal:`cyc` is\n        :literal:`znstar(q, 1)`), characters in Conrey representation are available,\n        see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`:\n        \n        ::\n        \n            ? G = znstar(100, 1); \\\\ (Z/100Z)^*\n            ? charorder(G, 7) \\\\ Conrey label\n            %2 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_305charorder(PyObject *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charorder (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_304charorder(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cyc), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_304charorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_chi) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charorder", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":4906
 *             %2 = 4
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":4907
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 4907, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4908
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charorder0(_cyc, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4909
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charorder0(_cyc, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":4910
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charorder0(_cyc, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charorder0(__pyx_v__cyc, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":4911
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = charorder0(_cyc, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charpoly(A, v=None, long flag=5):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4911, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4873
 *         return new_gen(_ret)
 * 
 *     def charorder(cyc, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.charorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4913
 *         return new_gen(_ret)
 * 
 *     def charpoly(A, v=None, long flag=5):             # <<<<<<<<<<<<<<
 *         r'''
 *         characteristic polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_307charpoly(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_306charpoly[] = "\n        characteristic polynomial\n        of :math:`A` with respect to the variable :math:`v`, i.e.\302\240determinant of :math:`v*I-A` if :math:`A`\n        is a square matrix.\n        \n        ::\n        \n            ? charpoly([1,2;3,4]);\n            %1 = x^2 - 5*x - 2\n            ? charpoly([1,2;3,4],, 't)\n            %2 = t^2 - 5*t - 2\n        \n        If :math:`A` is not a square matrix, the function returns the characteristic\n        polynomial of the map \"multiplication by :math:`A`\" if :math:`A` is a scalar:\n        \n        ::\n        \n            ? charpoly(Mod(x+2, x^3-2))\n            %1 = x^3 - 6*x^2 + 12*x - 10\n            ? charpoly(I)\n            %2 = x^2 + 1\n            ? charpoly(quadgen(5))\n            %3 = x^2 - x - 1\n            ? charpoly(ffgen(ffinit(2,4)))\n            %4 = Mod(1, 2)*x^4 + Mod(1, 2)*x^3 + Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2)\n        \n        The value of :math:`flag` is only significant for matrices, and we advise to stick\n        to the default value. Let :math:`n` be the dimension of :math:`A`.\n        \n        If :math:`flag = 0`, same method (Le Verrier's) as for computing the adjoint matrix,\n        i.e.\302\240using the traces of the powers of :math:`A`. Assumes that :math:`n!` is\n        invertible; uses :math:`O(n^4)` scalar operations.\n        \n        If :math:`flag = 1`, uses Lagrange interpolation which is usually the slowest method.\n        Assumes that :math:`n!` is invertible; uses :math:`O(n^4)` scalar operations.\n        \n        If :math:`flag = 2`, uses the Hessenberg form. Assumes that the base ring is a field.\n        Uses :math:`O(n^3)` scalar operations, but suffers from coefficient explosion\n        unless the base field is finite or :math:`\\mathbb{R}`.\n        \n        If :math:`flag = 3`, uses Berkowitz's division free algorithm, valid over any\n        ring (commutative, with unit). Uses :math:`O(n^4)` scalar operations.\n        \n        If :math:`flag ""= 4`, :math:`x` must be integral. Uses a modular algorithm: Hessenberg form\n        for various small primes, then Chinese remainders.\n        \n        If :math:`flag = 5` (default), uses the \"best\" method given :math:`x`.\n        This means we use Berkowitz unless the base ring is :math:`\\mathbb{Z}` (use :math:`flag = 4`)\n        or a field where coefficient explosion does not occur,\n        e.g.\302\240a finite field or the reals (use :math:`flag = 2`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_307charpoly(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_flag,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charpoly") < 0)) __PYX_ERR(10, 4913, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_v = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 4913, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)5);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charpoly", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4913, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.charpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_306charpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_v, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_306charpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_v, long __pyx_v_flag) {
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("charpoly", 0);

  /* "cypari/auto_gen.pxi":4965
 *         e.g.a finite field or the reals (use :math:`flag = 2`).
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":4966
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":4967
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 4967, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":4966
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":4968
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = charpoly0(_A, _v, flag)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 4968, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":4969
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charpoly0(_A, _v, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_5;

  /* "cypari/auto_gen.pxi":4970
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = charpoly0(_A, _v, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charpoly0(__pyx_v__A, __pyx_v__v, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":4971
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = charpoly0(_A, _v, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def charpow(cyc, a, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 4971, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4913
 *         return new_gen(_ret)
 * 
 *     def charpoly(A, v=None, long flag=5):             # <<<<<<<<<<<<<<
 *         r'''
 *         characteristic polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.charpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":4973
 *         return new_gen(_ret)
 * 
 *     def charpow(cyc, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_309charpow(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_308charpow[] = "\n        Let :emphasis:`cyc` represent a finite abelian group by its elementary\n        divisors, i.e. :math:`(d_j)` represents :math:`\\sum_{j <= k} \\mathbb{Z}/d_j\\mathbb{Z}` with :math:`d_k\n        | ... \\| d_1`; any object which has a :literal:`.cyc` method is also\n        allowed, e.g.\302\240the output of :literal:`znstar` or :literal:`bnrinit`. A character\n        on this group is given by a row vector :math:`a = [a_1,...,a_n]` such that\n        :math:`\\chi (\\prod g_j^{n_j}) = \\exp (2\\pi i\\sum a_j n_j / d_j)`, where :math:`g_j` denotes\n        the generator (of order :math:`d_j`) of the :math:`j`-th cyclic component.\n        \n        Given :math:`n\\in \\mathbb{Z}` and a character :math:`a`, return the character :math:`a^n`.\n        \n        ::\n        \n            ? cyc = [15,5]; a = [1,1];\n            ? charpow(cyc, a, 3)\n            %2 = [3, 3]\n            ? charpow(cyc, a, 5)\n            %2 = [5, 0]\n            ? bnf = bnfinit(x^2+23);\n            ? bnf.cyc\n            %4 = [3]\n            ? charpow(bnf, [1], 3)\n            %5 = [0]\n        \n        For Dirichlet characters on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, additional\n        representations are available (Conrey labels, Conrey logarithm), see\n        ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character` and the output uses the\n        same format as the input.\n        \n        ::\n        \n            ? G = znstar(100, 1);\n            ? G.cyc\n            %2 = [20, 2]\n            ? a = [10, 1]; \\\\ standard representation for characters\n            ? b = 7; \\\\ Conrey label;\n            ? c = znconreylog(G, 11); \\\\ Conrey log\n            ? charpow(G, a,3)\n            %6 = [10, 1] \\\\ standard representation\n            ? charpow(G, b,3)\n            %7 = 43 \\\\ Conrey label\n            ? charpow(G, c,3)\n            %8 = [1, 8]~ \\\\ Conrey log\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_309charpow(PyObject *__pyx_v_cyc, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("charpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_n,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_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("charpow", 1, 2, 2, 1); __PYX_ERR(10, 4973, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "charpow") < 0)) __PYX_ERR(10, 4973, __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_a = values[0];
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("charpow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 4973, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.charpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_308charpow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cyc), __pyx_v_a, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_308charpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cyc, PyObject *__pyx_v_a, PyObject *__pyx_v_n) {
  GEN __pyx_v__cyc;
  GEN __pyx_v__a;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("charpow", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_gen.pxi":5018
 *             %8 = [1, 8]~ \\ Conrey log
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5019
 *         '''
 *         a = objtogen(a)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5020
 *         a = objtogen(a)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5020, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5021
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cyc)->__pyx_base.g;
  __pyx_v__cyc = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5022
 *         sig_on()
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5023
 *         cdef GEN _cyc = (<Gen>cyc).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5024
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = charpow0(__pyx_v__cyc, __pyx_v__a, __pyx_v__n);

  /* "cypari/auto_gen.pxi":5025
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = charpow0(_cyc, _a, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def chinese(x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":4973
 *         return new_gen(_ret)
 * 
 *     def charpow(cyc, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`cyc` represent a finite abelian group by its elementary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.charpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5027
 *         return new_gen(_ret)
 * 
 *     def chinese(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` and :math:`y` are both intmods or both polmods, creates (with the same
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_311chinese(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_310chinese[] = "\n        If :math:`x` and :math:`y` are both intmods or both polmods, creates (with the same\n        type) a :math:`z` in the same residue class as :math:`x` and in the same residue class as\n        :math:`y`, if it is possible.\n        \n        ::\n        \n            ? chinese(Mod(1,2), Mod(2,3))\n            %1 = Mod(5, 6)\n            ? chinese(Mod(x,x^2-1), Mod(x+1,x^2+1))\n            %2 = Mod(-1/2*x^2 + x + 1/2, x^4 - 1)\n        \n        This function also allows vector and matrix arguments, in which case the\n        operation is recursively applied to each component of the vector or matrix.\n        \n        ::\n        \n            ? chinese([Mod(1,2),Mod(1,3)], [Mod(1,5),Mod(2,7)])\n            %3 = [Mod(1, 10), Mod(16, 21)]\n        \n        For polynomial arguments in the same variable, the function is applied to each\n        coefficient; if the polynomials have different degrees, the high degree terms\n        are copied verbatim in the result, as if the missing high degree terms in the\n        polynomial of lowest degree had been :literal:`Mod(0,1)`. Since the latter\n        behavior is usually :emphasis:`not` the desired one, we propose to convert the\n        polynomials to vectors of the same length first:\n        \n        ::\n        \n             ? P = x+1; Q = x^2+2*x+1;\n             ? chinese(P*Mod(1,2), Q*Mod(1,3))\n             %4 = Mod(1, 3)*x^2 + Mod(5, 6)*x + Mod(3, 6)\n             ? chinese(Vec(P,3)*Mod(1,2), Vec(Q,3)*Mod(1,3))\n             %5 = [Mod(1, 6), Mod(5, 6), Mod(4, 6)]\n             ? Pol(%)\n             %6 = Mod(1, 6)*x^2 + Mod(5, 6)*x + Mod(4, 6)\n        \n        If :math:`y` is omitted, and :math:`x` is a vector, :literal:`chinese` is applied recursively\n        to the components of :math:`x`, yielding a residue belonging to the same class as all\n        components of :math:`x`.\n        \n        Finally :math:`chinese (x,x) = x` regardless of the type of :math:`x`; this allows\n        vector argum""ents to contain other data, so long as they are identical in both\n        vectors.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_311chinese(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("chinese (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "chinese") < 0)) __PYX_ERR(10, 5027, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("chinese", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5027, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.chinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_310chinese(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_310chinese(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("chinese", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":5073
 *         vectors.
 *         '''
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_1 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_1;

  /* "cypari/auto_gen.pxi":5074
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5075
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5075, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":5074
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5076
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 5076, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5077
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":5078
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_gen.pxi":5079
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5080
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = chinese(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5079
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)
 */
  }

  /* "cypari/auto_gen.pxi":5081
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = chinese(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":5082
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = chinese(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cmp(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5082, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5027
 *         return new_gen(_ret)
 * 
 *     def chinese(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` and :math:`y` are both intmods or both polmods, creates (with the same
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.chinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5084
 *         return new_gen(_ret)
 * 
 *     def cmp(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a comparison between arbitrary objects :math:`x` and :math:`y`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_313cmp(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_312cmp[] = "\n        Gives the result of a comparison between arbitrary objects :math:`x` and :math:`y`\n        (as :math:`-1`, :math:`0` or :math:`1`). The underlying order relation is transitive,\n        the function returns :math:`0` if and only if :math:`x\302\240 === \302\240y`. It has no\n        mathematical meaning but satisfies the following properties when comparing\n        entries of the same type:\n        \n        - two :literal:`t_INT`\302\240s compare as usual (i.e. :literal:`cmp`:math:`(x,y) < 0` if and only\n          if :math:`x < y`);\n        \n        - two :literal:`t_VECSMALL`\302\240s of the same length compare lexicographically;\n        \n        - two :literal:`t_STR`\302\240s compare lexicographically.\n        \n        In case all components are equal up to the smallest length of the operands,\n        the more complex is considered to be larger. More precisely, the longest is\n        the largest; when lengths are equal, we have matrix :math:`>` vector :math:`>` scalar.\n        For example:\n        \n        ::\n        \n            ? cmp(1, 2)\n            %1 = -1\n            ? cmp(2, 1)\n            %2 = 1\n            ? cmp(1, 1.0) \\\\ note that 1 == 1.0, but (1===1.0) is false.\n            %3 = -1\n            ? cmp(x + Pi, [])\n            %4 = -1\n        \n        This function is mostly useful to handle sorted lists or\n        vectors of arbitrary objects. For instance, if :math:`v` is a vector, the\n        construction :literal:`vecsort(v, cmp)` is equivalent to :literal:`Set(v)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_313cmp(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cmp (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_312cmp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_312cmp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("cmp", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":5119
 *         construction :literal:`vecsort(v, cmp)` is equivalent to :literal:`Set(v)`.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5120
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5120, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5121
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = cmp_universal(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5122
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = cmp_universal(_x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5123
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = cmp_universal(_x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = cmp_universal(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":5124
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = cmp_universal(_x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":5125
 *         cdef int _ret = cmp_universal(_x, _y)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def component(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5125, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5084
 *         return new_gen(_ret)
 * 
 *     def cmp(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a comparison between arbitrary objects :math:`x` and :math:`y`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.cmp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5127
 *         return _ret
 * 
 *     def component(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extracts the :math:`n-th`-component of :math:`x`. This is to be understood
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_315component(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_314component[] = "\n        Extracts the :math:`n-th`-component of :math:`x`. This is to be understood\n        as follows: every PARI type has one or two initial code words. The\n        components are counted, starting at 1, after these code words. In particular\n        if :math:`x` is a vector, this is indeed the :math:`n-th`-component of :math:`x`, if\n        :math:`x` is a matrix, the :math:`n-th` column, if :math:`x` is a polynomial, the\n        :math:`n-th` coefficient (i.e.\302\240of degree :math:`n-1`), and for power series,\n        the :math:`n-th` significant coefficient.\n        \n        For polynomials and power series, one should rather use :literal:`polcoeff`, and\n        for vectors and matrices, the :literal:`[]` operator. Namely, if :math:`x` is a\n        vector, then :literal:`x[n]` represents the :math:`n-th` component of :math:`x`. If\n        :math:`x` is a matrix, :literal:`x[m,n]` represents the coefficient of row :literal:`m` and\n        column :literal:`n` of the matrix, :literal:`x[m,]` represents the :math:`m-th`\n        :emphasis:`row` of :math:`x`, and :literal:`x[,n]` represents the :math:`n-th`\n        :emphasis:`column` of :math:`x`.\n        \n        Using of this function requires detailed knowledge of the structure of the\n        different PARI types, and thus it should almost never be used directly.\n        Some useful exceptions:\n        \n        ::\n        \n             ? x = 3 + O(3^5);\n             ? component(x, 2)\n             %2 = 81 \\\\ p^(p-adic accuracy)\n             ? component(x, 1)\n             %3 = 3 \\\\ p\n             ? q = Qfb(1,2,3);\n             ? component(q, 1)\n             %5 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_315component(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("component (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5127, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.component", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_314component(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_314component(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("component", 0);

  /* "cypari/auto_gen.pxi":5160
 *              %5 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = compo(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5160, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5161
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = compo(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5162
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = compo(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = compo(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":5163
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = compo(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def concat(x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5127
 *         return _ret
 * 
 *     def component(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extracts the :math:`n-th`-component of :math:`x`. This is to be understood
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.component", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5165
 *         return new_gen(_ret)
 * 
 *     def concat(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Concatenation of :math:`x` and :math:`y`. If :math:`x` or :math:`y` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_317concat(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_316concat[] = "\n        Concatenation of :math:`x` and :math:`y`. If :math:`x` or :math:`y` is\n        not a vector or matrix, it is considered as a one-dimensional vector. All\n        types are allowed for :math:`x` and :math:`y`, but the sizes must be compatible. Note\n        that matrices are concatenated horizontally, i.e.\302\240the number of rows stays\n        the same. Using transpositions, one can concatenate them vertically,\n        but it is often simpler to use :literal:`matconcat`.\n        \n        ::\n        \n            ? x = matid(2); y = 2*matid(2);\n            ? concat(x,y)\n            %2 =\n            [1 0 2 0]\n            \n            [0 1 0 2]\n            ? concat(x~,y~)~\n            %3 =\n            [1 0]\n            \n            [0 1]\n            \n            [2 0]\n            \n            [0 2]\n            ? matconcat([x;y])\n            %4 =\n            [1 0]\n            \n            [0 1]\n            \n            [2 0]\n            \n            [0 2]\n        \n        To concatenate vectors sideways (i.e.\302\240to obtain a two-row or two-column\n        matrix), use :literal:`Mat` instead, or :literal:`matconcat`:\n        \n        ::\n        \n            ? x = [1,2];\n            ? y = [3,4];\n            ? concat(x,y)\n            %3 = [1, 2, 3, 4]\n            \n            ? Mat([x,y]~)\n            %4 =\n            [1 2]\n            \n            [3 4]\n            ? matconcat([x;y])\n            %5 =\n            [1 2]\n            \n            [3 4]\n        \n        Concatenating a row vector to a matrix having the same number of columns will\n        add the row to the matrix (top row if the vector is :math:`x`, i.e.\302\240comes first, and\n        bottom row otherwise).\n        \n        The empty matrix :literal:`[;]` is considered to have a number of rows compatible\n        with any operation, in particular concatenation. (Note that this is\n        :emphasis:`not` the case for empty vectors :literal:`""[\302\240]` or :literal:`[\302\240]~`.)\n        \n        If :math:`y` is omitted, :math:`x` has to be a row vector or a list, in which case its\n        elements are concatenated, from left to right, using the above rules.\n        \n        ::\n        \n            ? concat([1,2], [3,4])\n            %1 = [1, 2, 3, 4]\n            ? a = [[1,2]~, [3,4]~]; concat(a)\n            %2 =\n            [1 3]\n            \n            [2 4]\n            \n            ? concat([1,2; 3,4], [5,6]~)\n            %3 =\n            [1 2 5]\n            \n            [3 4 6]\n            ? concat([%, [7,8]~, [1,2,3,4]])\n            %5 =\n            [1 2 5 7]\n            \n            [3 4 6 8]\n            \n            [1 2 3 4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_317concat(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("concat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "concat") < 0)) __PYX_ERR(10, 5165, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("concat", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5165, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_316concat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_316concat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("concat", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":5256
 *             [1 2 3 4]
 *         '''
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_1 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_1;

  /* "cypari/auto_gen.pxi":5257
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5258
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":5257
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5259
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 5259, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5260
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":5261
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_gen.pxi":5262
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5263
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gconcat(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5262
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)
 */
  }

  /* "cypari/auto_gen.pxi":5264
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gconcat(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":5265
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = gconcat(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def conj(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5165
 *         return new_gen(_ret)
 * 
 *     def concat(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Concatenation of :math:`x` and :math:`y`. If :math:`x` or :math:`y` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.concat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5267
 *         return new_gen(_ret)
 * 
 *     def conj(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate of :math:`x`. The meaning of this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_319conj(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_318conj[] = "\n        Conjugate of :math:`x`. The meaning of this\n        is clear, except that for real quadratic numbers, it means conjugation in the\n        real quadratic field. This function has no effect on integers, reals,\n        intmods, fractions or :math:`p`-adics. The only forbidden type is polmod\n        (see :literal:`conjvec` for this).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_319conj(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conj (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_318conj(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_318conj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("conj", 0);

  /* "cypari/auto_gen.pxi":5275
 *         (see :literal:`conjvec` for this).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gconj(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5275, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5276
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gconj(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5277
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gconj(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gconj(__pyx_v__x);

  /* "cypari/auto_gen.pxi":5278
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gconj(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def conjvec(z, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5278, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5267
 *         return new_gen(_ret)
 * 
 *     def conj(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate of :math:`x`. The meaning of this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.conj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5280
 *         return new_gen(_ret)
 * 
 *     def conjvec(z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate vector representation of :math:`z`. If :math:`z` is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_321conjvec(PyObject *__pyx_v_z, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_320conjvec[] = "\n        Conjugate vector representation of :math:`z`. If :math:`z` is a\n        polmod, equal to :literal:`Mod`:math:`(a,T)`, this gives a vector of length\n        :math:`degree(T)` containing:\n        \n        - the complex embeddings of :math:`z` if :math:`T` has rational coefficients,\n          i.e.\302\240the :math:`a(r[i])` where :math:`r = polroots (T)`;\n        \n        - the conjugates of :math:`z` if :math:`T` has some intmod coefficients;\n        \n        if :math:`z` is a finite field element, the result is the vector of\n        conjugates :math:`[z,z^p,z^{p^2},...,z^{p^{n-1}}]` where :math:`n = degree(T)`.\n        \n        If :math:`z` is an integer or a rational number, the result is\302\240:math:`z`. If\n        :math:`z` is a (row or column) vector, the result is a matrix whose columns are\n        the conjugate vectors of the individual elements of :math:`z`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_321conjvec(PyObject *__pyx_v_z, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("conjvec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "conjvec") < 0)) __PYX_ERR(10, 5280, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5280, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("conjvec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5280, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.conjvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_320conjvec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_z), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_320conjvec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z, long __pyx_v_precision) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("conjvec", 0);

  /* "cypari/auto_gen.pxi":5298
 *         the conjugate vectors of the individual elements of :math:`z`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5298, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5299
 *         '''
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = conjvec(_z, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5300
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = conjvec(_z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":5301
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = conjvec(_z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = conjvec(__pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5302
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = conjvec(_z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def content(x, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5280
 *         return new_gen(_ret)
 * 
 *     def conjvec(z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Conjugate vector representation of :math:`z`. If :math:`z` is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.conjvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5304
 *         return new_gen(_ret)
 * 
 *     def content(x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the gcd of all the coefficients of :math:`x`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_323content(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_322content[] = "\n        Computes the gcd of all the coefficients of :math:`x`,\n        when this gcd makes sense. This is the natural definition\n        if :math:`x` is a polynomial (and by extension a power series) or a\n        vector/matrix. This is in general a weaker notion than the :emphasis:`ideal`\n        generated by the coefficients:\n        \n        ::\n        \n            ? content(2*x+y)\n            %1 = 1 \\\\ = gcd(2,y) over Q[y]\n        \n        If :math:`x` is a scalar, this simply returns the absolute value of :math:`x` if :math:`x` is\n        rational (:literal:`t_INT` or :literal:`t_FRAC`), and either :math:`1` (inexact input) or :math:`x`\n        (exact input) otherwise; the result should be identical to :literal:`gcd(x, 0)`.\n        \n        The content of a rational function is the ratio of the contents of the\n        numerator and the denominator. In recursive structures, if a\n        matrix or vector :emphasis:`coefficient` :math:`x` appears, the gcd is taken\n        not with :math:`x`, but with its content:\n        \n        ::\n        \n            ? content([ [2], 4*matid(3) ])\n            %1 = 2\n        \n        The content of a :literal:`t_VECSMALL` is computed assuming the\n        entries are signed integers.\n        \n        The optional argument :math:`D` allows to control over which ring we compute\n        and get a more predictable behaviour:\n        \n        - :math:`1`: we only consider the underlying :math:`\\mathbb{Q}`-structure and the\n          denominator is a (positive) rational number\n        \n        - a simple variable, say :literal:`'x`: all entries are considered as\n          rational functions in :math:`K(x)` for some field :math:`K` and the content is an\n          element of :math:`K`.\n        \n        ::\n        \n            ? f = x + 1/y + 1/2;\n            ? content(f) \\\\ as a t_POL in x\n            %2 = 1/(2*y)\n            ? content(f, 1) \\\\ Q-content\n            %3 = 1/2\n          ""  ? content(f, y) \\\\ as a rational function in y\n            %4 = 1/2\n            ? g = x^2*y + y^2*x;\n            ? content(g, x)\n            %6 = y\n            ? content(g, y)\n            %7 = x\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_323content(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("content (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "content") < 0)) __PYX_ERR(10, 5304, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("content", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5304, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.content", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_322content(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_322content(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("content", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":5359
 *             %7 = x
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":5360
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5361
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5361, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":5360
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5362
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 5362, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5363
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":5364
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":5365
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5366
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = content0(_x, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5365
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)
 */
  }

  /* "cypari/auto_gen.pxi":5367
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = content0(__pyx_v__x, __pyx_v__D);

  /* "cypari/auto_gen.pxi":5368
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = content0(_x, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfrac(x, b=None, long nmax=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5304
 *         return new_gen(_ret)
 * 
 *     def content(x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the gcd of all the coefficients of :math:`x`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.content", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5370
 *         return new_gen(_ret)
 * 
 *     def contfrac(x, b=None, long nmax=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the row vector whose components are the partial quotients of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_325contfrac(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_324contfrac[] = "\n        Returns the row vector whose components are the partial quotients of the\n        continued fraction expansion of :math:`x`. In other words, a result\n        :math:`[a_0,...,a_n]` means that :math:`x ~ a_0+1/(a_1+...+1/a_n)`. The\n        output is normalized so that :math:`a_n != 1` (unless we also have :math:`n = 0`).\n        \n        The number of partial quotients :math:`n+1` is limited by :literal:`nmax`. If\n        :literal:`nmax` is omitted, the expansion stops at the last significant partial\n        quotient.\n        \n        ::\n        \n            ? \\p19\n             realprecision = 19 significant digits\n            ? contfrac(Pi)\n            %1 = [3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2]\n            ? contfrac(Pi,, 3) \\\\ n = 2\n            %2 = [3, 7, 15]\n        \n        :math:`x` can also be a rational function or a power series.\n        \n        If a vector :math:`b` is supplied, the numerators are equal to the coefficients\n        of :math:`b`, instead of all equal to :math:`1` as above; more precisely, :math:`x ~\n        (1/b_0)(a_0+b_1/(a_1+...+b_n/a_n))`; for a numerical continued fraction\n        (:math:`x` real), the :math:`a_i` are integers, as large as possible; if :math:`x` is a\n        rational function, they are polynomials with :math:`\\deg a_i = \\deg b_i + 1`.\n        The length of the result is then equal to the length of :math:`b`, unless the next\n        partial quotient cannot be reliably computed, in which case the expansion\n        stops. This happens when a partial remainder is equal to zero (or too small\n        compared to the available significant digits for :math:`x` a :literal:`t_REAL`).\n        \n        A direct implementation of the numerical continued fraction\n        :literal:`contfrac(x,b)` described above would be\n        \n        ::\n        \n            \\\\ \"greedy\" generalized continued fraction\n            cf(x, b) =\n            { my( a= vector(#b), t "");\n            \n             x *= b[1];\n             for (i = 1, #b,\n             a[i] = floor(x);\n             t = x - a[i]; if (!t || i == #b, break);\n             x = b[i+1] / t;\n             ); a;\n            }\n        \n        There is some degree of freedom when choosing the :math:`a_i`; the\n        program above can easily be modified to derive variants of the standard\n        algorithm. In the same vein, although no builtin\n        function implements the related Engel expansion (a special kind of\n        Egyptian fraction decomposition: :math:`x = 1/a_1 + 1/(a_1a_2) +...` ),\n        it can be obtained as follows:\n        \n        ::\n        \n            \\\\ n terms of the Engel expansion of x\n            engel(x, n = 10) =\n            { my( u = x, a = vector(n) );\n             for (k = 1, n,\n             a[k] = ceil(1/u);\n             u = u*a[k] - 1;\n             if (!u, break);\n             ); a\n            }\n        \n        :strong:`Obsolete hack.` (don't use this): if :math:`b` is an integer, :emphasis:`nmax`\n        is ignored and the command is understood as :literal:`contfrac(:math:`x,, b`)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_325contfrac(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  long __pyx_v_nmax;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfrac (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_nmax,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nmax);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfrac") < 0)) __PYX_ERR(10, 5370, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_b = values[0];
    if (values[1]) {
      __pyx_v_nmax = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_nmax == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5370, __pyx_L3_error)
    } else {
      __pyx_v_nmax = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfrac", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5370, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfrac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_324contfrac(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_b, __pyx_v_nmax);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_324contfrac(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b, long __pyx_v_nmax) {
  int __pyx_v__have_b;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("contfrac", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":5441
 *         is ignored and the command is understood as :literal:`contfrac(:math:`x,, b`)`.
 *         '''
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_1 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_1;

  /* "cypari/auto_gen.pxi":5442
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5443
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5443, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":5442
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5444
 *         if _have_b:
 *             b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 5444, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5445
 *             b = objtogen(b)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":5446
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_gen.pxi":5447
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5448
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5447
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 */
  }

  /* "cypari/auto_gen.pxi":5449
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfrac0(__pyx_v__x, __pyx_v__b, __pyx_v_nmax);

  /* "cypari/auto_gen.pxi":5450
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = contfrac0(_x, _b, nmax)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfraceval(CF, t, long lim=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5370
 *         return new_gen(_ret)
 * 
 *     def contfrac(x, b=None, long nmax=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the row vector whose components are the partial quotients of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfrac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5452
 *         return new_gen(_ret)
 * 
 *     def contfraceval(CF, t, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a continued fraction :literal:`CF` output by :literal:`contfracinit`, evaluate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_327contfraceval(PyObject *__pyx_v_CF, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_326contfraceval[] = "\n        Given a continued fraction :literal:`CF` output by :literal:`contfracinit`, evaluate\n        the first :literal:`lim` terms of the continued fraction at :literal:`t` (all\n        terms if :literal:`lim` is negative or omitted; if positive, :literal:`lim` must be\n        less than or equal to the length of :literal:`CF`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_327contfraceval(PyObject *__pyx_v_CF, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  long __pyx_v_lim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfraceval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_lim,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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfraceval") < 0)) __PYX_ERR(10, 5452, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_t = values[0];
    if (values[1]) {
      __pyx_v_lim = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_lim == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5452, __pyx_L3_error)
    } else {
      __pyx_v_lim = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfraceval", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5452, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfraceval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_326contfraceval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_CF), __pyx_v_t, __pyx_v_lim);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_326contfraceval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_CF, PyObject *__pyx_v_t, long __pyx_v_lim) {
  GEN __pyx_v__CF;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("contfraceval", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_gen.pxi":5459
 *         less than or equal to the length of :literal:`CF`.
 *         '''
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _CF = (<Gen>CF).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5460
 *         '''
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _CF = (<Gen>CF).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5460, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5461
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _CF = (<Gen>CF).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_CF)->__pyx_base.g;
  __pyx_v__CF = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5462
 *         sig_on()
 *         cdef GEN _CF = (<Gen>CF).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5463
 *         cdef GEN _CF = (<Gen>CF).g
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfraceval(__pyx_v__CF, __pyx_v__t, __pyx_v_lim);

  /* "cypari/auto_gen.pxi":5464
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = contfraceval(_CF, _t, lim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfracinit(M, long lim=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5452
 *         return new_gen(_ret)
 * 
 *     def contfraceval(CF, t, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a continued fraction :literal:`CF` output by :literal:`contfracinit`, evaluate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfraceval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5466
 *         return new_gen(_ret)
 * 
 *     def contfracinit(M, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`M` representing the power series :math:`S = \sum_{n >= 0} M[n+1]z^n`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_329contfracinit(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_328contfracinit[] = "\n        Given :math:`M` representing the power series :math:`S = \\sum_{n >= 0} M[n+1]z^n`,\n        transform it into a continued fraction; restrict to :math:`n <= lim`\n        if latter is non-negative. :math:`M` can be a vector, a power\n        series, a polynomial, or a rational function.\n        The result is a 2-component vector :math:`[A,B]` such that\n        :math:`S = M[1] / (1+A[1]z+B[1]z^2/(1+A[2]z+B[2]z^2/(1+...1/(1+A[lim/2]z))))`.\n        Does not work if any coefficient of :math:`M` vanishes, nor for series for\n        which certain partial denominators vanish.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_329contfracinit(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_lim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfracinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lim,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfracinit") < 0)) __PYX_ERR(10, 5466, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_lim = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_lim == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5466, __pyx_L3_error)
    } else {
      __pyx_v_lim = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfracinit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5466, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfracinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_328contfracinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_lim);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_328contfracinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_lim) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("contfracinit", 0);

  /* "cypari/auto_gen.pxi":5477
 *         which certain partial denominators vanish.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = contfracinit(_M, lim)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5477, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5478
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfracinit(_M, lim)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5479
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = contfracinit(_M, lim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfracinit(__pyx_v__M, __pyx_v_lim);

  /* "cypari/auto_gen.pxi":5480
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = contfracinit(_M, lim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def contfracpnqn(x, long n=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5466
 *         return new_gen(_ret)
 * 
 *     def contfracinit(M, long lim=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`M` representing the power series :math:`S = \sum_{n >= 0} M[n+1]z^n`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfracinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5482
 *         return new_gen(_ret)
 * 
 *     def contfracpnqn(x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a vector or a one-row matrix, :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_331contfracpnqn(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_330contfracpnqn[] = "\n        When :math:`x` is a vector or a one-row matrix, :math:`x`\n        is considered as the list of partial quotients :math:`[a_0,a_1,...,a_n]` of a\n        rational number, and the result is the 2 by 2 matrix\n        :math:`[p_n,p_{n-1};q_n,q_{n-1}]` in the standard notation of continued fractions,\n        so :math:`p_n/q_n = a_0+1/(a_1+...+1/a_n)`. If :math:`x` is a matrix with two rows\n        :math:`[b_0,b_1,...,b_n]` and :math:`[a_0,a_1,...,a_n]`, this is then considered as a\n        generalized continued fraction and we have similarly\n        :math:`p_n/q_n = (1/b_0)(a_0+b_1/(a_1+...+b_n/a_n))`. Note that in this case one\n        usually has :math:`b_0 = 1`.\n        \n        If :math:`n >= 0` is present, returns all convergents from :math:`p_0/q_0` up to\n        :math:`p_n/q_n`. (All convergents if :math:`x` is too small to compute the :math:`n+1`\n        requested convergents.)\n        \n        ::\n        \n            ? a = contfrac(Pi,10)\n            %1 = [3, 7, 15, 1, 292, 1, 1, 1, 3]\n            ? allpnqn(x) = contfracpnqn(x,#x) \\\\ all convergents\n            ? allpnqn(a)\n            %3 =\n            [3 22 333 355 103993 104348 208341 312689 1146408]\n            \n            [1 7 106 113 33102 33215 66317 99532 364913]\n            ? contfracpnqn(a) \\\\ last two convergents\n            %4 =\n            [1146408 312689]\n            \n            [ 364913 99532]\n            \n            ? contfracpnqn(a,3) \\\\ first three convergents\n            %5 =\n            [3 22 333 355]\n            \n            [1 7 106 113]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_331contfracpnqn(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("contfracpnqn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "contfracpnqn") < 0)) __PYX_ERR(10, 5482, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5482, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("contfracpnqn", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5482, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfracpnqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_330contfracpnqn(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_330contfracpnqn(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("contfracpnqn", 0);

  /* "cypari/auto_gen.pxi":5520
 *             [1 7 106 113]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = contfracpnqn(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5520, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5521
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = contfracpnqn(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5522
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = contfracpnqn(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = contfracpnqn(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":5523
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = contfracpnqn(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def core(n, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5482
 *         return new_gen(_ret)
 * 
 *     def contfracpnqn(x, long n=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a vector or a one-row matrix, :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.contfracpnqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5525
 *         return new_gen(_ret)
 * 
 *     def core(n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`n` is an integer written as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_333core(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_332core[] = "\n        If :math:`n` is an integer written as\n        :math:`n = df^2` with :math:`d` squarefree, returns :math:`d`. If :math:`flag` is non-zero,\n        returns the two-element row vector :math:`[d,f]`. By convention, we write :math:`0 = 0\n        x 1^2`, so :literal:`core(0, 1)` returns :math:`[0,1]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_333core(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("core (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "core") < 0)) __PYX_ERR(10, 5525, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5525, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("core", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5525, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.core", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_332core(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_332core(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("core", 0);

  /* "cypari/auto_gen.pxi":5532
 *         x 1^2`, so :literal:`core(0, 1)` returns :math:`[0,1]`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = core0(_n, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5532, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5533
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = core0(_n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5534
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = core0(_n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = core0(__pyx_v__n, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":5535
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = core0(_n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def coredisc(n, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5525
 *         return new_gen(_ret)
 * 
 *     def core(n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`n` is an integer written as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.core", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5537
 *         return new_gen(_ret)
 * 
 *     def coredisc(n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         A :emphasis:`fundamental discriminant` is an integer of the form :math:`t = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_335coredisc(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_334coredisc[] = "\n        A :emphasis:`fundamental discriminant` is an integer of the form :math:`t = 1\n        mod 4` or :math:`4t = 8,12 mod 16`, with :math:`t` squarefree (i.e.\302\240:math:`1` or the\n        discriminant of a quadratic number field). Given a non-zero integer\n        :math:`n`, this routine returns the (unique) fundamental discriminant :math:`d`\n        such that :math:`n = df^2`, :math:`f` a positive rational number. If :math:`flag` is non-zero,\n        returns the two-element row vector :math:`[d,f]`. If :math:`n` is congruent to\n        0 or 1 modulo 4, :math:`f` is an integer, and a half-integer otherwise.\n        \n        By convention, :literal:`coredisc(0, 1))` returns :math:`[0,1]`.\n        \n        Note that :literal:`quaddisc`:math:`(n)` returns the same value as :literal:`coredisc`:math:`(n)`,\n        and also works with rational inputs :math:`n\\in\\mathbb{Q}^*`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_335coredisc(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("coredisc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "coredisc") < 0)) __PYX_ERR(10, 5537, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5537, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("coredisc", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5537, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.coredisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_334coredisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_334coredisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("coredisc", 0);

  /* "cypari/auto_gen.pxi":5552
 *         and also works with rational inputs :math:`n\in\mathbb{Q}^*`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = coredisc0(_n, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5552, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5553
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = coredisc0(_n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5554
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = coredisc0(_n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = coredisc0(__pyx_v__n, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":5555
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = coredisc0(_n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cos(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5537
 *         return new_gen(_ret)
 * 
 *     def coredisc(n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         A :emphasis:`fundamental discriminant` is an integer of the form :math:`t = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.coredisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5557
 *         return new_gen(_ret)
 * 
 *     def cos(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cosine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_337cos(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_336cos[] = "\n        Cosine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_337cos(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cos (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cos") < 0)) __PYX_ERR(10, 5557, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5557, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cos", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5557, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.cos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_336cos(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_336cos(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("cos", 0);

  /* "cypari/auto_gen.pxi":5561
 *         Cosine of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5561, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5562
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcos(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5563
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcos(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":5564
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcos(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcos(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5565
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcos(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cosh(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5557
 *         return new_gen(_ret)
 * 
 *     def cos(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cosine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.cos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5567
 *         return new_gen(_ret)
 * 
 *     def cosh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cosine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_339cosh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_338cosh[] = "\n        Hyperbolic cosine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_339cosh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cosh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cosh") < 0)) __PYX_ERR(10, 5567, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5567, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cosh", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5567, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.cosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_338cosh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_338cosh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("cosh", 0);

  /* "cypari/auto_gen.pxi":5571
 *         Hyperbolic cosine of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5571, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5572
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcosh(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5573
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcosh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":5574
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcosh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcosh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5575
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcosh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cotan(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5567
 *         return new_gen(_ret)
 * 
 *     def cosh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cosine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.cosh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5577
 *         return new_gen(_ret)
 * 
 *     def cotan(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cotangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_341cotan(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_340cotan[] = "\n        Cotangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_341cotan(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cotan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cotan") < 0)) __PYX_ERR(10, 5577, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5577, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cotan", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5577, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.cotan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_340cotan(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_340cotan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("cotan", 0);

  /* "cypari/auto_gen.pxi":5581
 *         Cotangent of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5581, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5582
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotan(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5583
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcotan(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":5584
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotan(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcotan(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5585
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotan(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def cotanh(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5577
 *         return new_gen(_ret)
 * 
 *     def cotan(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cotangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.cotan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5587
 *         return new_gen(_ret)
 * 
 *     def cotanh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cotangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_343cotanh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_342cotanh[] = "\n        Hyperbolic cotangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_343cotanh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cotanh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cotanh") < 0)) __PYX_ERR(10, 5587, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5587, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("cotanh", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5587, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.cotanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_342cotanh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_342cotanh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("cotanh", 0);

  /* "cypari/auto_gen.pxi":5591
 *         Hyperbolic cotangent of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5591, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5592
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotanh(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5593
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcotanh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":5594
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotanh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcotanh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5595
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gcotanh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def denominator(f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5595, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5587
 *         return new_gen(_ret)
 * 
 *     def cotanh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic cotangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.cotanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5597
 *         return new_gen(_ret)
 * 
 *     def denominator(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Denominator of :math:`f`. The meaning of this is clear when :math:`f` is a rational number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_345denominator(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_344denominator[] = "\n        Denominator of :math:`f`. The meaning of this is clear when :math:`f` is a rational number\n        or function. If :math:`f` is an integer or a polynomial, it is treated as a rational\n        number or function, respectively, and the result is equal to :math:`1`. For\n        polynomials, you probably want to use\n        \n        ::\n        \n            denominator( content(f) )\n        \n        instead. As for modular objects, :literal:`t_INTMOD` and :literal:`t_PADIC`\n        have denominator :math:`1`, and the denominator of a :literal:`t_POLMOD` is the\n        denominator of its lift.\n        \n        If :math:`f` is a recursive structure, for instance a vector or matrix, the lcm\n        of the denominators of its components (a common denominator) is computed.\n        This also applies for :literal:`t_COMPLEX`\302\240s and :literal:`t_QUAD`\302\240s.\n        \n        :strong:`Warning.` Multivariate objects are created according to variable\n        priorities, with possibly surprising side effects (:math:`x/y` is a polynomial, but\n        :math:`y/x` is a rational function). See ``priority`` (in the PARI manual).\n        \n        The optional argument :math:`D` allows to control over which ring we compute the\n        denominator and get a more predictable behaviour:\n        \n        - :math:`1`: we only consider the underlying :math:`\\mathbb{Q}`-structure and the\n          denominator is a (positive) rational integer\n        \n        - a simple variable, say :literal:`'x`: all entries as rational functions\n          in :math:`K(x)` and the denominator is a polynomial in :math:`x`.\n        \n        ::\n        \n            ? f = x + 1/y + 1/2;\n            ? denominator(f) \\\\ a t_POL in x\n            %2 = 1\n            ? denominator(f, 1) \\\\ Q-denominator\n            %3 = 2\n            ? denominator(f, x) \\\\ as a t_POL in x, seen above\n            %4 = 1\n            ? denominator(f, y) \\\\ as a rational functio""n in y\n            %5 = 2*y\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_345denominator(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("denominator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "denominator") < 0)) __PYX_ERR(10, 5597, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("denominator", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5597, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.denominator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_344denominator(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_344denominator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("denominator", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":5641
 *             %5 = 2*y
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":5642
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5643
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5643, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":5642
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5644
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 5644, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5645
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":5646
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":5647
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5648
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = denominator(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5647
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)
 */
  }

  /* "cypari/auto_gen.pxi":5649
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = denominator(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_gen.pxi":5650
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = denominator(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def deriv(x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5597
 *         return new_gen(_ret)
 * 
 *     def denominator(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Denominator of :math:`f`. The meaning of this is clear when :math:`f` is a rational number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.denominator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5652
 *         return new_gen(_ret)
 * 
 *     def deriv(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Derivative of :math:`x` with respect to the main
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_347deriv(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_346deriv[] = "\n        Derivative of :math:`x` with respect to the main\n        variable if :math:`v` is omitted, and with respect to :math:`v` otherwise. The derivative\n        of a scalar type is zero, and the derivative of a vector or matrix is done\n        componentwise. One can use :math:`x'` as a shortcut if the derivative is with\n        respect to the main variable of :math:`x`.\n        \n        By definition, the main variable of a :literal:`t_POLMOD` is the main variable among\n        the coefficients from its two polynomial components (representative and\n        modulus); in other words, assuming a polmod represents an element of\n        :math:`R[X]/(T(X))`, the variable :math:`X` is a mute variable and the derivative is\n        taken with respect to the main variable used in the base ring :math:`R`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_347deriv(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deriv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "deriv") < 0)) __PYX_ERR(10, 5652, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("deriv", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5652, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.deriv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_346deriv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_346deriv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("deriv", 0);

  /* "cypari/auto_gen.pxi":5666
 *         taken with respect to the main variable used in the base ring :math:`R`.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":5667
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":5668
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 5668, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":5667
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5669
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = deriv(_x, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 5669, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5670
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = deriv(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":5671
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = deriv(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = deriv(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":5672
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = deriv(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def diffop(x, v, d, long n=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 5672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5652
 *         return new_gen(_ret)
 * 
 *     def deriv(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Derivative of :math:`x` with respect to the main
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.deriv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5674
 *         return new_gen(_ret)
 * 
 *     def diffop(x, v, d, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`v` be a vector of variables, and :math:`d` a vector of the same length,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_349diffop(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_348diffop[] = "\n        Let :math:`v` be a vector of variables, and :math:`d` a vector of the same length,\n        return the image of :math:`x` by the :math:`n`-power (:math:`1` if n is not given) of the differential\n        operator :math:`D` that assumes the value :literal:`d[i]` on the variable :literal:`v[i]`.\n        The value of :math:`D` on a scalar type is zero, and :math:`D` applies componentwise to a vector\n        or matrix. When applied to a :literal:`t_POLMOD`, if no value is provided for the variable\n        of the modulus, such value is derived using the implicit function theorem.\n        \n        Some examples:\n        This function can be used to differentiate formal expressions:\n        If :math:`E = \\exp (X^2)` then we have :math:`E' = 2*X*E`. We can derivate :math:`X*exp(X^2)` as follow:\n        \n        ::\n        \n            ? diffop(E*X,[X,E],[1,2*X*E])\n            %1 = (2*X^2 + 1)*E\n        \n        Let :literal:`Sin` and :literal:`Cos` be two function such that :math:`Sin^2+Cos^2 = 1`\n        and :math:`Cos' = -Sin`. We can differentiate :math:`Sin/Cos` as follow,\n        PARI inferring the value of :math:`Sin'` from the equation:\n        \n        ::\n        \n            ? diffop(Mod('Sin/'Cos,'Sin^2+'Cos^2-1),['Cos],[-'Sin])\n            %1 = Mod(1/Cos^2, Sin^2 + (Cos^2 - 1))\n            \n        \n        Compute the Bell polynomials (both complete and partial) via the Faa di Bruno formula:\n        \n        ::\n        \n            Bell(k,n=-1)=\n            {\n             my(var(i)=eval(Str(\"X\",i)));\n             my(x,v,dv);\n             v=vector(k,i,if(i==1,'E,var(i-1)));\n             dv=vector(k,i,if(i==1,'X*var(1)*'E,var(i)));\n             x=diffop('E,v,dv,k)/'E;\n             if(n<0,subst(x,'X,1),polcoeff(x,n,'X))\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_349diffop(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_d = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("diffop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_d,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 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_d)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("diffop", 0, 2, 3, 1); __PYX_ERR(10, 5674, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "diffop") < 0)) __PYX_ERR(10, 5674, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_v = values[0];
    __pyx_v_d = values[1];
    if (values[2]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5674, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("diffop", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5674, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.diffop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_348diffop(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v, __pyx_v_d, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_348diffop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_d, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("diffop", 0);
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":5716
 *             }
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5717
 *         '''
 *         v = objtogen(v)
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5718
 *         v = objtogen(v)
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5718, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5719
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5720
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5721
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5722
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = diffop0(__pyx_v__x, __pyx_v__v, __pyx_v__d, __pyx_v_n);

  /* "cypari/auto_gen.pxi":5723
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = diffop0(_x, _v, _d, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def digits(x, b=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5723, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5674
 *         return new_gen(_ret)
 * 
 *     def diffop(x, v, d, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`v` be a vector of variables, and :math:`d` a vector of the same length,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.diffop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5725
 *         return new_gen(_ret)
 * 
 *     def digits(x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the digits of :math:`\|x\|` in base :math:`b`, where :math:`x` and :math:`b` are
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_351digits(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_350digits[] = "\n        Outputs the vector of the digits of :math:`\\|x\\|` in base :math:`b`, where :math:`x` and :math:`b` are\n        integers (:math:`b = 10` by default). See :literal:`fromdigits` for the reverse\n        operation.\n        \n        ::\n        \n            ? digits(1230)\n            %1 = [1, 2, 3, 0]\n            \n            ? digits(10, 2) \\\\ base 2\n            %2 = [1, 0, 1, 0]\n        \n        By convention, :math:`0` has no digits:\n        \n        ::\n        \n            ? digits(0)\n            %3 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_351digits(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("digits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "digits") < 0)) __PYX_ERR(10, 5725, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_b = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("digits", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5725, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.digits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_350digits(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_350digits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b) {
  int __pyx_v__have_b;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("digits", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":5746
 *             %3 = []
 *         '''
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_1 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_1;

  /* "cypari/auto_gen.pxi":5747
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5748
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":5747
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5749
 *         if _have_b:
 *             b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 5749, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5750
 *             b = objtogen(b)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":5751
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_gen.pxi":5752
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5753
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = digits(_x, _b)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5752
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)
 */
  }

  /* "cypari/auto_gen.pxi":5754
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = digits(__pyx_v__x, __pyx_v__b);

  /* "cypari/auto_gen.pxi":5755
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = digits(_x, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dilog(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5725
 *         return new_gen(_ret)
 * 
 *     def digits(x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the vector of the digits of :math:`\|x\|` in base :math:`b`, where :math:`x` and :math:`b` are
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.digits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5757
 *         return new_gen(_ret)
 * 
 *     def dilog(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the dilogarithm of :math:`x`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_353dilog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_352dilog[] = "\n        Principal branch of the dilogarithm of :math:`x`,\n        i.e.\302\240analytic continuation of the power series :math:`\\log_2(x) = \\sum_{n >= 1}x^n/n^2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_353dilog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dilog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dilog") < 0)) __PYX_ERR(10, 5757, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5757, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("dilog", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5757, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.dilog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_352dilog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_352dilog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("dilog", 0);

  /* "cypari/auto_gen.pxi":5762
 *         i.e.analytic continuation of the power series :math:`\log_2(x) = \sum_{n >= 1}x^n/n^2`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5762, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5763
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = dilog(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5764
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dilog(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":5765
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = dilog(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dilog(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5766
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = dilog(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dirdiv(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5757
 *         return new_gen(_ret)
 * 
 *     def dilog(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the dilogarithm of :math:`x`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.dilog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5768
 *         return new_gen(_ret)
 * 
 *     def dirdiv(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_355dirdiv(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_354dirdiv[] = "\n        :math:`x` and :math:`y` being vectors of perhaps different\n        lengths but with :math:`y[1] != 0` considered as Dirichlet series, computes\n        the quotient of :math:`x` by :math:`y`, again as a vector.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_355dirdiv(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dirdiv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_354dirdiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_354dirdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("dirdiv", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":5774
 *         the quotient of :math:`x` by :math:`y`, again as a vector.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5775
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5775, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5776
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirdiv(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5777
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dirdiv(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5778
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirdiv(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dirdiv(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":5779
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirdiv(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dirmul(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5768
 *         return new_gen(_ret)
 * 
 *     def dirdiv(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.dirdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5781
 *         return new_gen(_ret)
 * 
 *     def dirmul(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different lengths representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_357dirmul(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_356dirmul[] = "\n        :math:`x` and :math:`y` being vectors of perhaps different lengths representing\n        the Dirichlet series :math:`\\sum_n x_n n^{-s}` and :math:`\\sum_n y_n n^{-s}`,\n        computes the product of :math:`x` by :math:`y`, again as a vector.\n        \n        ::\n        \n            ? dirmul(vector(10,n,1), vector(10,n,moebius(n)))\n            %1 = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n        \n        The product\n        length is the minimum of :math:`\\#\302\240x*\302\240v(y)` and :math:`\\#\302\240y*\302\240v(x)`,\n        where :math:`v(x)` is the index of the first non-zero coefficient.\n        \n        ::\n        \n            ? dirmul([0,1], [0,1]);\n            %2 = [0, 0, 0, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_357dirmul(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dirmul (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_356dirmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_356dirmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("dirmul", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":5801
 *             %2 = [0, 0, 0, 1]
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5802
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5802, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5803
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirmul(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5804
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dirmul(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5805
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirmul(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dirmul(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":5806
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = dirmul(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def dirzetak(nf, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5781
 *         return new_gen(_ret)
 * 
 *     def dirmul(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being vectors of perhaps different lengths representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.dirmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5808
 *         return new_gen(_ret)
 * 
 *     def dirzetak(nf, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives as a vector the first :math:`b`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_359dirzetak(PyObject *__pyx_v_nf, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_358dirzetak[] = "\n        Gives as a vector the first :math:`b`\n        coefficients of the Dedekind zeta function of the number field :math:`nf`\n        considered as a Dirichlet series.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_359dirzetak(PyObject *__pyx_v_nf, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("dirzetak (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_358dirzetak(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_358dirzetak(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_b) {
  GEN __pyx_v__nf;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("dirzetak", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":5814
 *         considered as a Dirichlet series.
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5815
 *         '''
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5815, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5816
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = dirzetak(_nf, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5817
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = dirzetak(_nf, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5818
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = dirzetak(_nf, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = dirzetak(__pyx_v__nf, __pyx_v__b);

  /* "cypari/auto_gen.pxi":5819
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = dirzetak(_nf, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def divisors(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5808
 *         return new_gen(_ret)
 * 
 *     def dirzetak(nf, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives as a vector the first :math:`b`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.dirzetak", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5821
 *         return new_gen(_ret)
 * 
 *     def divisors(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_361divisors(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_360divisors[] = "\n        Creates a row vector whose components are the\n        divisors of :math:`x`. The factorization of :math:`x` (as output by :literal:`factor`) can\n        be used instead. If :math:`flag = 1`, return pairs :math:`[d, factor (d)]`.\n        \n        By definition, these divisors are the products of the irreducible\n        factors of :math:`n`, as produced by :literal:`factor(n)`, raised to appropriate\n        powers (no negative exponent may occur in the factorization). If :math:`n` is\n        an integer, they are the positive divisors, in increasing order.\n        \n        ::\n        \n            ? divisors(12)\n            %1 = [1, 2, 3, 4, 6, 12]\n            ? divisors(12, 1) \\\\ include their factorization\n            %2 = [[1, matrix(0,2)], [2, Mat([2, 1])], [3, Mat([3, 1])],\n             [4, Mat([2, 2])], [6, [2, 1; 3, 1]], [12, [2, 2; 3, 1]]]\n            \n            ? divisors(x^4 + 2*x^3 + x^2) \\\\ also works for polynomials\n            %3 = [1, x, x^2, x + 1, x^2 + x, x^3 + x^2, x^2 + 2*x + 1,\n             x^3 + 2*x^2 + x, x^4 + 2*x^3 + x^2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_361divisors(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divisors (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divisors") < 0)) __PYX_ERR(10, 5821, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5821, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divisors", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5821, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.divisors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_360divisors(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_360divisors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("divisors", 0);

  /* "cypari/auto_gen.pxi":5844
 *              x^3 + 2*x^2 + x, x^4 + 2*x^3 + x^2]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = divisors0(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5844, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5845
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = divisors0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5846
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = divisors0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = divisors0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":5847
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = divisors0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def divisorslenstra(N, r, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 5847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5821
 *         return new_gen(_ret)
 * 
 *     def divisors(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.divisors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5849
 *         return new_gen(_ret)
 * 
 *     def divisorslenstra(N, r, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given three integers :math:`N > s > r >= 0` such that :math:`(r,s) = 1`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_363divisorslenstra(PyObject *__pyx_v_N, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_362divisorslenstra[] = "\n        Given three integers :math:`N > s > r >= 0` such that :math:`(r,s) = 1`\n        and :math:`s^3 > N`, find all divisors :math:`d` of :math:`N` such that :math:`d = r (mod s)`.\n        There are at most :math:`11` such divisors (Lenstra).\n        \n        ::\n        \n            ? N = 245784; r = 19; s = 65 ;\n            ? divisorslenstra(N, r, s)\n            %2 = [19, 84, 539, 1254, 3724, 245784]\n            ? [ d | d <- divisors(N), d % s == r]\n            %3 = [19, 84, 539, 1254, 3724, 245784]\n        \n        When the preconditions are not met, the result is undefined:\n        \n        ::\n        \n            ? N = 4484075232; r = 7; s = 1303; s^3 > N\n            %4 = 0\n            ? divisorslenstra(N, r, s)\n            ? [ d | d <- divisors(N), d % s == r ]\n            %6 = [7, 2613, 9128, 19552, 264516, 3407352, 344928864]\n        \n        (Divisors were missing but :math:`s^3 < N`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_363divisorslenstra(PyObject *__pyx_v_N, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_r = 0;
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divisorslenstra (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_r,&__pyx_n_s_s,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_r)) != 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_s)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("divisorslenstra", 1, 2, 2, 1); __PYX_ERR(10, 5849, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divisorslenstra") < 0)) __PYX_ERR(10, 5849, __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_r = values[0];
    __pyx_v_s = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divisorslenstra", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5849, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.divisorslenstra", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_362divisorslenstra(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N), __pyx_v_r, __pyx_v_s);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_362divisorslenstra(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, PyObject *__pyx_v_r, PyObject *__pyx_v_s) {
  GEN __pyx_v__N;
  GEN __pyx_v__r;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("divisorslenstra", 0);
  __Pyx_INCREF(__pyx_v_r);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_gen.pxi":5875
 *         (Divisors were missing but :math:`s^3 < N`.)
 *         '''
 *         r = objtogen(r)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_r, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_r, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5876
 *         '''
 *         r = objtogen(r)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5877
 *         r = objtogen(r)
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _r = (<Gen>r).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5877, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5878
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _r = (<Gen>r).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5879
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _r = (<Gen>r).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_r)->__pyx_base.g;
  __pyx_v__r = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5880
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _r = (<Gen>r).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_gen.pxi":5881
 *         cdef GEN _r = (<Gen>r).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = divisorslenstra(__pyx_v__N, __pyx_v__r, __pyx_v__s);

  /* "cypari/auto_gen.pxi":5882
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = divisorslenstra(_N, _r, _s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def divrem(x, y, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5849
 *         return new_gen(_ret)
 * 
 *     def divisorslenstra(N, r, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given three integers :math:`N > s > r >= 0` such that :math:`(r,s) = 1`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.divisorslenstra", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5884
 *         return new_gen(_ret)
 * 
 *     def divrem(x, y, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a column vector with two components, the first being the Euclidean
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_365divrem(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_364divrem[] = "\n        Creates a column vector with two components, the first being the Euclidean\n        quotient (:literal:`:math:`x` \\\\:math:`y``), the second the Euclidean remainder\n        (:literal:`:math:`x` - (:math:`x`\\\\:math:`y`)*:math:`y``), of the division of :math:`x` by :math:`y`. This avoids the\n        need to do two divisions if one needs both the quotient and the remainder.\n        If :math:`v` is present, and :math:`x`, :math:`y` are multivariate\n        polynomials, divide with respect to the variable :math:`v`.\n        \n        Beware that :literal:`divrem(:math:`x`,:math:`y`)[2]` is in general not the same as\n        :literal:`:math:`x` \\% :math:`y``; no GP operator corresponds to it:\n        \n        ::\n        \n            ? divrem(1/2, 3)[2]\n            %1 = 1/2\n            ? (1/2) % 3\n            %2 = 2\n            ? divrem(Mod(2,9), 3)[2]\n             *** at top-level: divrem(Mod(2,9),3)[2\n             *** ^--------------------\n             *** forbidden division t_INTMOD \\ t_INT.\n            ? Mod(2,9) % 6\n            %3 = Mod(2,3)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_365divrem(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("divrem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "divrem") < 0)) __PYX_ERR(10, 5884, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("divrem", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5884, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.divrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_364divrem(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_364divrem(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("divrem", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":5909
 *             %3 = Mod(2,3)
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5910
 *         '''
 *         y = objtogen(y)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":5911
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":5912
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 5912, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5911
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5913
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 5913, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5914
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = divrem(_x, _y, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_gen.pxi":5915
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = divrem(_x, _y, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_6;

  /* "cypari/auto_gen.pxi":5916
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = divrem(_x, _y, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = divrem(__pyx_v__x, __pyx_v__y, __pyx_v__v);

  /* "cypari/auto_gen.pxi":5917
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = divrem(_x, _y, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def eint1(x, n=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5884
 *         return new_gen(_ret)
 * 
 *     def divrem(x, y, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a column vector with two components, the first being the Euclidean
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.divrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5919
 *         return new_gen(_ret)
 * 
 *     def eint1(x, n=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential integral :math:`\int_x^ oo (e^{-t})/(t)dt =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_367eint1(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_366eint1[] = "\n        Exponential integral :math:`\\int_x^ oo (e^{-t})/(t)dt =\n        incgam (0, x)`, where the latter expression extends the function\n        definition from real :math:`x > 0` to all complex :math:`x != 0`.\n        \n        If :math:`n` is present, we must have :math:`x > 0`; the function returns the\n        :math:`n`-dimensional vector :math:`[eint1 (x),...,eint1 (nx)]`. Contrary to\n        other transcendental functions, and to the default case (:math:`n` omitted), the\n        values are correct up to a bounded :emphasis:`absolute`, rather than relative,\n        error :math:`10^{-n}`, where :math:`n` is :literal:`precision`:math:`(x)` if :math:`x` is a :literal:`t_REAL`\n        and defaults to :literal:`realprecision` otherwise. (In the most important\n        application, to the computation of :math:`L`-functions via approximate functional\n        equations, those values appear as weights in long sums and small individual\n        relative errors are less useful than controlling the absolute error.) This is\n        faster than repeatedly calling :literal:`eint1(:math:`i` * x)`, but less precise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_367eint1(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eint1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eint1") < 0)) __PYX_ERR(10, 5919, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_n = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5919, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("eint1", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5919, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.eint1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_366eint1(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_366eint1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_n, long __pyx_v_precision) {
  int __pyx_v__have_n;
  GEN __pyx_v__x;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("eint1", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_gen.pxi":5936
 *         faster than repeatedly calling :literal:`eint1(:math:`i` * x)`, but less precise.
 *         '''
 *         cdef bint _have_n = (n is not None)             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             n = objtogen(n)
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_v__have_n = __pyx_t_1;

  /* "cypari/auto_gen.pxi":5937
 *         '''
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_n != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5938
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:
 *             n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":5937
 *         '''
 *         cdef bint _have_n = (n is not None)
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             n = objtogen(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":5939
 *         if _have_n:
 *             n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 5939, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5940
 *             n = objtogen(n)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = NULL
 *         if _have_n:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":5941
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL             # <<<<<<<<<<<<<<
 *         if _have_n:
 *             _n = (<Gen>n).g
 */
  __pyx_v__n = NULL;

  /* "cypari/auto_gen.pxi":5942
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_n != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":5943
 *         cdef GEN _n = NULL
 *         if _have_n:
 *             _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = veceint1(_x, _n, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
    __pyx_v__n = __pyx_t_4;

    /* "cypari/auto_gen.pxi":5942
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = NULL
 *         if _have_n:             # <<<<<<<<<<<<<<
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":5944
 *         if _have_n:
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = veceint1(_x, _n, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":5945
 *             _n = (<Gen>n).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = veceint1(_x, _n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = veceint1(__pyx_v__x, __pyx_v__n, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5946
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = veceint1(_x, _n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellL1(E, long r=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 5946, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5919
 *         return new_gen(_ret)
 * 
 *     def eint1(x, n=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential integral :math:`\int_x^ oo (e^{-t})/(t)dt =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.eint1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5948
 *         return new_gen(_ret)
 * 
 *     def ellL1(E, long r=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`s = 1` of the derivative of order :math:`r` of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_369ellL1(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_368ellL1[] = "\n        Returns the value at :math:`s = 1` of the derivative of order :math:`r` of the\n        :math:`L`-function of the elliptic curve :math:`E`.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); \\\\ order of vanishing is 0\n            ? ellL1(E)\n            %2 = 0.2538418608559106843377589233\n            ? E = ellinit(\"389a1\"); \\\\ order of vanishing is 2\n            ? ellL1(E)\n            %4 = -5.384067311837218089235032414 E-29\n            ? ellL1(E, 1)\n            %5 = 0\n            ? ellL1(E, 2)\n            %6 = 1.518633000576853540460385214\n        \n        The main use of this function, after computing at :emphasis:`low` accuracy the\n        order of vanishing using :literal:`ellanalyticrank`, is to compute the\n        leading term at :emphasis:`high` accuracy to check (or use) the Birch and\n        Swinnerton-Dyer conjecture:\n        \n        ::\n        \n            ? \\p18\n             realprecision = 18 significant digits\n            ? E = ellinit(\"5077a1\"); ellanalyticrank(E)\n            time = 8 ms.\n            %1 = [3, 10.3910994007158041]\n            ? \\p200\n             realprecision = 202 significant digits (200 digits displayed)\n            ? ellL1(E, 3)\n            time = 104 ms.\n            %3 = 10.3910994007158041387518505103609170697263563756570092797[...]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_369ellL1(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_r;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellL1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_r,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellL1") < 0)) __PYX_ERR(10, 5948, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_r = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5948, __pyx_L3_error)
    } else {
      __pyx_v_r = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 5948, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellL1", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5948, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_368ellL1(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_r, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_368ellL1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_r, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("ellL1", 0);

  /* "cypari/auto_gen.pxi":5984
 *             %3 = 10.3910994007158041387518505103609170697263563756570092797[...]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 5984, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5985
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":5986
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 */
  __pyx_t_3 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":5987
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":5986
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 */
  }

  /* "cypari/auto_gen.pxi":5988
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellL1_bitprec(__pyx_v__E, __pyx_v_r, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":5989
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellL1_bitprec(_E, r, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elladd(E, z1, z2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 5989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5948
 *         return new_gen(_ret)
 * 
 *     def ellL1(E, long r=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`s = 1` of the derivative of order :math:`r` of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellL1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":5991
 *         return new_gen(_ret)
 * 
 *     def elladd(E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the points :math:`z1` and :math:`z2` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_371elladd(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_370elladd[] = "\n        Sum of the points :math:`z1` and :math:`z2` on the\n        elliptic curve corresponding to :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_371elladd(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z1 = 0;
  PyObject *__pyx_v_z2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elladd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z1,&__pyx_n_s_z2,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_z1)) != 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_z2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elladd", 1, 2, 2, 1); __PYX_ERR(10, 5991, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elladd") < 0)) __PYX_ERR(10, 5991, __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_z1 = values[0];
    __pyx_v_z2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elladd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 5991, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elladd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_370elladd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_z1, __pyx_v_z2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_370elladd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2) {
  GEN __pyx_v__E;
  GEN __pyx_v__z1;
  GEN __pyx_v__z2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elladd", 0);
  __Pyx_INCREF(__pyx_v_z1);
  __Pyx_INCREF(__pyx_v_z2);

  /* "cypari/auto_gen.pxi":5996
 *         elliptic curve corresponding to :math:`E`.
 *         '''
 *         z1 = objtogen(z1)             # <<<<<<<<<<<<<<
 *         z2 = objtogen(z2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5996, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5997
 *         '''
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 5997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":5998
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 5998, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":5999
 *         z2 = objtogen(z2)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6000
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = elladd(_E, _z1, _z2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z1)->__pyx_base.g;
  __pyx_v__z1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6001
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elladd(_E, _z1, _z2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z2)->__pyx_base.g;
  __pyx_v__z2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6002
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = elladd(_E, _z1, _z2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elladd(__pyx_v__E, __pyx_v__z1, __pyx_v__z2);

  /* "cypari/auto_gen.pxi":6003
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = elladd(_E, _z1, _z2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellak(E, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":5991
 *         return new_gen(_ret)
 * 
 *     def elladd(E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the points :math:`z1` and :math:`z2` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elladd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z1);
  __Pyx_XDECREF(__pyx_v_z2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6005
 *         return new_gen(_ret)
 * 
 *     def ellak(E, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the coefficient :math:`a_n` of the :math:`L`-function of the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_373ellak(PyObject *__pyx_v_E, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_372ellak[] = "\n        Computes the coefficient :math:`a_n` of the :math:`L`-function of the elliptic curve\n        :math:`E/\\mathbb{Q}`, i.e.\302\240coefficients of a newform of weight 2 by the modularity theorem\n        (Taniyama-Shimura-Weil conjecture). :math:`E` must be an :literal:`ell` structure\n        over :math:`\\mathbb{Q}` as output by :literal:`ellinit`. :math:`E` must be given by an integral model,\n        not necessarily minimal, although a minimal model will make the function\n        faster.\n        \n        ::\n        \n            ? E = ellinit([1,-1,0,4,3]);\n            ? ellak(E, 10)\n            %2 = -3\n            ? e = ellchangecurve(E, [1/5,0,0,0]); \\\\ made not minimal at 5\n            ? ellak(e, 10) \\\\ wasteful but works\n            %3 = -3\n            ? E = ellminimalmodel(e); \\\\ now minimal\n            ? ellak(E, 5)\n            %5 = -3\n        \n        If the model is not minimal at a number of bad primes, then\n        the function will be slower on those :math:`n` divisible by the bad primes.\n        The speed should be comparable for other :math:`n`:\n        \n        ::\n        \n            ? for(i=1,10^6, ellak(E,5))\n            time = 699 ms.\n            ? for(i=1,10^6, ellak(e,5)) \\\\ 5 is bad, markedly slower\n            time = 1,079 ms.\n            \n            ? for(i=1,10^5,ellak(E,5*i))\n            time = 1,477 ms.\n            ? for(i=1,10^5,ellak(e,5*i)) \\\\ still slower but not so much on average\n            time = 1,569 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_373ellak(PyObject *__pyx_v_E, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellak (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_372ellak(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_372ellak(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellak", 0);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_gen.pxi":6042
 *             time = 1,569 ms.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":6043
 *         '''
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 6043, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6044
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = akell(_E, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6045
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = akell(_E, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6046
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = akell(_E, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = akell(__pyx_v__E, __pyx_v__n);

  /* "cypari/auto_gen.pxi":6047
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = akell(_E, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellan(E, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6005
 *         return new_gen(_ret)
 * 
 *     def ellak(E, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the coefficient :math:`a_n` of the :math:`L`-function of the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellak", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6049
 *         return new_gen(_ret)
 * 
 *     def ellan(E, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the vector of the first :math:`n` Fourier coefficients :math:`a_k`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_375ellan(PyObject *__pyx_v_E, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_374ellan[] = "\n        Computes the vector of the first :math:`n` Fourier coefficients :math:`a_k`\n        corresponding to the elliptic curve :math:`E` defined over a number field.\n        If :math:`E` is defined over :math:`\\mathbb{Q}`, the curve may be given by an\n        arbitrary model, not necessarily minimal,\n        although a minimal model will make the function faster. Over a more general\n        number field, the model must be locally minimal at all primes above :math:`2`\n        and :math:`3`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_375ellan(PyObject *__pyx_v_E, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellan (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6049, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_374ellan(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_374ellan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellan", 0);

  /* "cypari/auto_gen.pxi":6059
 *         and :math:`3`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellan(_E, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6059, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6060
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellan(_E, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6061
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellan(_E, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellan(__pyx_v__E, __pyx_v_n);

  /* "cypari/auto_gen.pxi":6062
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellan(_E, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellanalyticrank(E, eps=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6049
 *         return new_gen(_ret)
 * 
 *     def ellan(E, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the vector of the first :math:`n` Fourier coefficients :math:`a_k`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6064
 *         return new_gen(_ret)
 * 
 *     def ellanalyticrank(E, eps=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the order of vanishing at :math:`s = 1` of the :math:`L`-function of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_377ellanalyticrank(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_376ellanalyticrank[] = "\n        Returns the order of vanishing at :math:`s = 1` of the :math:`L`-function of the\n        elliptic curve :math:`E` and the value of the first non-zero derivative. To\n        determine this order, it is assumed that any value less than :literal:`eps` is\n        zero. If :literal:`eps` is omitted, :math:`2^{-b/2}` is used, where :math:`b`\n        is the current bit precision.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); \\\\ rank 0\n            ? ellanalyticrank(E)\n            %2 = [0, 0.2538418608559106843377589233]\n            ? E = ellinit(\"37a1\"); \\\\ rank 1\n            ? ellanalyticrank(E)\n            %4 = [1, 0.3059997738340523018204836835]\n            ? E = ellinit(\"389a1\"); \\\\ rank 2\n            ? ellanalyticrank(E)\n            %6 = [2, 1.518633000576853540460385214]\n            ? E = ellinit(\"5077a1\"); \\\\ rank 3\n            ? ellanalyticrank(E)\n            %8 = [3, 10.39109940071580413875185035]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_377ellanalyticrank(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_eps = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellanalyticrank (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_eps,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellanalyticrank") < 0)) __PYX_ERR(10, 6064, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_eps = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6064, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellanalyticrank", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6064, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellanalyticrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_376ellanalyticrank(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_eps, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_376ellanalyticrank(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_eps, long __pyx_v_precision) {
  int __pyx_v__have_eps;
  GEN __pyx_v__E;
  GEN __pyx_v__eps;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellanalyticrank", 0);
  __Pyx_INCREF(__pyx_v_eps);

  /* "cypari/auto_gen.pxi":6087
 *             %8 = [3, 10.39109940071580413875185035]
 *         '''
 *         cdef bint _have_eps = (eps is not None)             # <<<<<<<<<<<<<<
 *         if _have_eps:
 *             eps = objtogen(eps)
 */
  __pyx_t_1 = (__pyx_v_eps != Py_None);
  __pyx_v__have_eps = __pyx_t_1;

  /* "cypari/auto_gen.pxi":6088
 *         '''
 *         cdef bint _have_eps = (eps is not None)
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             eps = objtogen(eps)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_eps != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6089
 *         cdef bint _have_eps = (eps is not None)
 *         if _have_eps:
 *             eps = objtogen(eps)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_eps, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6089, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_eps, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":6088
 *         '''
 *         cdef bint _have_eps = (eps is not None)
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             eps = objtogen(eps)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6090
 *         if _have_eps:
 *             eps = objtogen(eps)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 6090, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6091
 *             eps = objtogen(eps)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _eps = NULL
 *         if _have_eps:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6092
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL             # <<<<<<<<<<<<<<
 *         if _have_eps:
 *             _eps = (<Gen>eps).g
 */
  __pyx_v__eps = NULL;

  /* "cypari/auto_gen.pxi":6093
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             _eps = (<Gen>eps).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_eps != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6094
 *         cdef GEN _eps = NULL
 *         if _have_eps:
 *             _eps = (<Gen>eps).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_eps)->__pyx_base.g;
    __pyx_v__eps = __pyx_t_4;

    /* "cypari/auto_gen.pxi":6093
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _eps = NULL
 *         if _have_eps:             # <<<<<<<<<<<<<<
 *             _eps = (<Gen>eps).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":6095
 *         if _have_eps:
 *             _eps = (<Gen>eps).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6096
 *             _eps = (<Gen>eps).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":6095
 *         if _have_eps:
 *             _eps = (<Gen>eps).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 */
  }

  /* "cypari/auto_gen.pxi":6097
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellanalyticrank_bitprec(__pyx_v__E, __pyx_v__eps, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":6098
 *             precision = default_bitprec()
 *         cdef GEN _ret = ellanalyticrank_bitprec(_E, _eps, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellap(E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6064
 *         return new_gen(_ret)
 * 
 *     def ellanalyticrank(E, eps=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the order of vanishing at :math:`s = 1` of the :math:`L`-function of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellanalyticrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_eps);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6100
 *         return new_gen(_ret)
 * 
 *     def ellap(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_379ellap(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_378ellap[] = "\n        Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached\n        to an elliptic curve :math:`E/K`. If the field :math:`K = \\mathbb{F}_q` is finite, return the\n        trace of Frobenius :math:`t`, defined by the equation :math:`\\#E(\\mathbb{F}_q) = q+1 - t`.\n        \n        For other fields of definition and :math:`p` defining a finite residue field\n        :math:`\\mathbb{F}_q`, return the trace of Frobenius for the reduction of :math:`E`: the argument\n        :math:`p` is best left omitted if :math:`K = \\mathbb{Q}_\\ell` (else we must have :math:`p = \\ell`) and\n        must be a prime number (:math:`K = \\mathbb{Q}`) or prime ideal (:math:`K` a general number field)\n        with residue field :math:`\\mathbb{F}_q` otherwise. The equation need not be minimal\n        or even integral at :math:`p`; of course, a minimal model will be more efficient.\n        \n        For a number field :math:`K`, the trace of Frobenius is the :math:`a_p`\n        coefficient in the Euler product defining the curve :math:`L`-series, whence\n        the function name:\n        \n        .. MATH::\n        \n            L(E/K,s) = \\prod_{bad p} (1-a_p (Np)^{-s})^{-1}\n            \\prod_{good p} (1-a_p (Np)^{-s} + (Np)^{1-2s})^{-1}.\n        \n        When the characteristic of the finite field is large, the availability of\n        the :literal:`seadata` package will speed up the computation.\n        \n        ::\n        \n            ? E = ellinit([0,1]); \\\\ y^2 = x^3 + 0.x + 1, defined over Q\n            ? ellap(E, 7) \\\\ 7 necessary here\n            %2 = -4 \\\\ #E(F_7) = 7+1-(-4) = 12\n            ? ellcard(E, 7)\n            %3 = 12 \\\\ OK\n            \n            ? E = ellinit([0,1], 11); \\\\ defined over F_11\n            ? ellap(E) \\\\ no need to repeat 11\n            %4 = 0\n            ? ellap(E, 11) \\\\ ... but it also works\n            %5 = 0\n            ? ellgroup(E, 13) \\\\ ouch, inconsistent input""!\n             *** at top-level: ellap(E,13)\n             *** ^-----------\n             *** ellap: inconsistent moduli in Rg_to_Fp:\n             11\n             13\n            ? a = ffgen(ffinit(11,3), 'a); \\\\ defines F_q := F_{11^3}\n            ? E = ellinit([a+1,a]); \\\\ y^2 = x^3 + (a+1)x + a, defined over F_q\n            ? ellap(E)\n            %8 = -3\n        \n        If the curve is defined over a more general number field than :math:`\\mathbb{Q}`,\n        the maximal ideal :math:`p` must be explicitly given in :literal:`idealprimedec`\n        format. There is no assumption of local minimality at :math:`p`.\n        \n        ::\n        \n            ? K = nfinit(a^2+1); E = ellinit([1+a,0,1,0,0], K);\n            ? fa = idealfactor(K, E.disc)\n            %2 =\n            [ [5, [-2, 1]~, 1, 1, [2, -1; 1, 2]] 1]\n            \n            [[13, [5, 1]~, 1, 1, [-5, -1; 1, -5]] 2]\n            ? ellap(E, fa[1,1])\n            %3 = -1 \\\\ non-split multiplicative reduction\n            ? ellap(E, fa[2,1])\n            %4 = 1 \\\\ split multiplicative reduction\n            ? P17 = idealprimedec(K,17)[1];\n            ? ellap(E, P17)\n            %6 = 6 \\\\ good reduction\n            ? E2 = ellchangecurve(E, [17,0,0,0]);\n            ? ellap(E2, P17)\n            %8 = 6 \\\\ same, starting from a non-miminal model\n            \n            ? P3 = idealprimedec(K,3)[1];\n            ? ellap(E, P3) \\\\ OK: E is minimal at P3\n            %10 = -2\n            ? E3 = ellchangecurve(E, [3,0,0,0]);\n            ? ellap(E3, P3) \\\\ not integral at P3\n             *** at top-level: ellap(E3,P3)\n             *** ^------------\n             *** ellap: impossible inverse in Rg_to_ff: Mod(0, 3).\n        \n        :strong:`Algorithms used.` If :math:`E/\\mathbb{F}_q` has CM by a principal imaginary\n        quadratic order we use a fast explicit formula (involving essentially\n        Kronecker symbols and Cornacchia's algorithm), in :math:`O(\\log q"")^2` bit\n        operations.\n        Otherwise, we use Shanks-Mestre's baby-step/giant-step method, which runs in\n        time :math:`~{O}(q^{1/4})` using :math:`~{O}(q^{1/4})` storage, hence becomes\n        unreasonable when :math:`q` has about 30\302\240digits. Above this range, the :literal:`SEA`\n        algorithm becomes available, heuristically in :math:`~{O}(\\log q)^4`, and\n        primes of the order of 200\302\240digits become feasible. In small\n        characteristic we use Mestre's (p = 2), Kohel's (p = 3,5,7,13), Satoh-Harley\n        (all in :math:`~{O}(p^{2} n^2)`) or Kedlaya's (in :math:`~{O}(p n^3)`)\n        algorithms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_379ellap(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellap (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellap") < 0)) __PYX_ERR(10, 6100, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellap", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6100, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_378ellap(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_378ellap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellap", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":6194
 *         algorithms.
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":6195
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6196
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6196, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":6195
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6197
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 6197, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6198
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6199
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":6200
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6201
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellap(_E, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":6200
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)
 */
  }

  /* "cypari/auto_gen.pxi":6202
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellap(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_gen.pxi":6203
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellap(_E, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellbil(E, z1, z2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6100
 *         return new_gen(_ret)
 * 
 *     def ellap(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6205
 *         return new_gen(_ret)
 * 
 *     def ellbil(E, z1, z2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellheight(E,P,Q)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_381ellbil(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_380ellbil[] = "\n        Deprecated alias for :literal:`ellheight(E,P,Q)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_381ellbil(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z1 = 0;
  PyObject *__pyx_v_z2 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellbil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z1,&__pyx_n_s_z2,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z1)) != 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_z2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellbil", 0, 2, 3, 1); __PYX_ERR(10, 6205, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellbil") < 0)) __PYX_ERR(10, 6205, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_z1 = values[0];
    __pyx_v_z2 = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6205, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellbil", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6205, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_380ellbil(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_z1, __pyx_v_z2, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_380ellbil(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2, long __pyx_v_precision) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__E;
  GEN __pyx_v__z1;
  GEN __pyx_v__z2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellbil", 0);
  __Pyx_INCREF(__pyx_v_z1);
  __Pyx_INCREF(__pyx_v_z2);

  /* "cypari/auto_gen.pxi":6209
 *         Deprecated alias for :literal:`ellheight(E,P,Q)`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)
 *         z1 = objtogen(z1)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6209, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6209, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":6210
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":6211
 *         from warnings import warn
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)
 *         z1 = objtogen(z1)             # <<<<<<<<<<<<<<
 *         z2 = objtogen(z2)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z1, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_z1, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":6212
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z2, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_z2, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":6213
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 6213, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6214
 *         z2 = objtogen(z2)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6215
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z2 = (<Gen>z2).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z1)->__pyx_base.g;
  __pyx_v__z1 = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6216
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z2)->__pyx_base.g;
  __pyx_v__z2 = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6217
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":6218
 *         cdef GEN _z2 = (<Gen>z2).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = bilhell(__pyx_v__E, __pyx_v__z1, __pyx_v__z2, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":6219
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = bilhell(_E, _z1, _z2, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellbsd(E, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6205
 *         return new_gen(_ret)
 * 
 *     def ellbil(E, z1, z2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellheight(E,P,Q)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_z1);
  __Pyx_XDECREF(__pyx_v_z2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6221
 *         return new_gen(_ret)
 * 
 *     def ellbsd(E, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns a real
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_383ellbsd(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_382ellbsd[] = "\n        The object :math:`E` being an elliptic curve over a number field, returns a real\n        number :math:`c` such that the BSD conjecture predicts that\n        :math:`L_{E}^{(r)}(1)/r != c R S` where :math:`r` is the rank, :math:`R` the regulator and\n        :math:`S` the cardinal of the Tate-Shafarevich group.\n        \n        ::\n        \n            ? e = ellinit([0,-1,1,-10,-20]); \\\\ rank 0\n            ? ellbsd(e)\n            %2 = 0.25384186085591068433775892335090946105\n            ? lfun(e,1)\n            %3 = 0.25384186085591068433775892335090946104\n            ? e = ellinit([0,0,1,-1,0]); \\\\ rank 1\n            ? P = ellheegner(e);\n            ? ellbsd(e)*ellheight(e,P)\n            %6 = 0.30599977383405230182048368332167647445\n            ? lfun(e,1,1)\n            %7 = 0.30599977383405230182048368332167647445\n            ? e = ellinit([1+a,0,1,0,0],nfinit(a^2+1)); \\\\ rank 0\n            ? ellbsd(e)\n            %9 = 0.42521832235345764503001271536611593310\n            ? lfun(e,1)\n            %10 = 0.42521832235345764503001271536611593309\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_383ellbsd(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellbsd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellbsd") < 0)) __PYX_ERR(10, 6221, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6221, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellbsd", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6221, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_382ellbsd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_382ellbsd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellbsd", 0);

  /* "cypari/auto_gen.pxi":6247
 *             %10 = 0.42521832235345764503001271536611593309
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6247, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6248
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellbsd(_E, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6249
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellbsd(_E, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":6250
 *         cdef GEN _E = (<Gen>E).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellbsd(_E, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellbsd(__pyx_v__E, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":6251
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellbsd(_E, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellcard(E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6221
 *         return new_gen(_ret)
 * 
 *     def ellbsd(E, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns a real
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6253
 *         return new_gen(_ret)
 * 
 *     def ellcard(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_385ellcard(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_384ellcard[] = "\n        Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached\n        to an elliptic curve :math:`E/K`. If :math:`K = \\mathbb{F}_q` is finite, return the order of the\n        group :math:`E(\\mathbb{F}_q)`.\n        \n        ::\n        \n            ? E = ellinit([-3,1], 5); ellcard(E)\n            %1 = 7\n            ? t = ffgen(3^5,'t); E = ellinit([t,t^2+1]); ellcard(E)\n            %2 = 217\n        \n        For other fields of definition and :math:`p` defining a finite residue field\n        :math:`\\mathbb{F}_q`, return the order of the reduction of :math:`E`: the argument :math:`p` is best\n        left omitted if :math:`K = \\mathbb{Q}_\\ell` (else we must have :math:`p = \\ell`) and must be a\n        prime number (:math:`K = \\mathbb{Q}`) or prime ideal (:math:`K` a general number field) with\n        residue field :math:`\\mathbb{F}_q` otherwise. The equation need not be minimal\n        or even integral at :math:`p`; of course, a minimal model will be more efficient.\n        The function considers the group of non-singular points of the reduction\n        of a minimal model of the curve at :math:`p`, so also makes sense when the curve\n        has bad reduction.\n        \n        ::\n        \n            ? E = ellinit([-3,1]);\n            ? factor(E.disc)\n            %2 =\n            [2 4]\n            \n            [3 4]\n            ? ellcard(E, 5) \\\\ as above !\n            %3 = 7\n            ? ellcard(E, 2) \\\\ additive reduction\n            %4 = 2\n        \n        When the characteristic of the finite field is large, the availability of\n        the :literal:`seadata` package will speed the computation. See also :literal:`ellap`\n        for the list of implemented algorithms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_385ellcard(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellcard (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellcard") < 0)) __PYX_ERR(10, 6253, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellcard", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6253, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellcard", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_384ellcard(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_384ellcard(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellcard", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":6293
 *         for the list of implemented algorithms.
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":6294
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6295
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6295, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":6294
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6296
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 6296, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6297
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6298
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":6299
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6300
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellcard(_E, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":6299
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)
 */
  }

  /* "cypari/auto_gen.pxi":6301
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellcard(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_gen.pxi":6302
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellcard(_E, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellchangecurve(E, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6253
 *         return new_gen(_ret)
 * 
 *     def ellcard(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellcard", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6304
 *         return new_gen(_ret)
 * 
 *     def ellchangecurve(E, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the data for the elliptic curve :math:`E`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_387ellchangecurve(PyObject *__pyx_v_E, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_386ellchangecurve[] = "\n        Changes the data for the elliptic curve :math:`E`\n        by changing the coordinates using the vector :literal:`v = [u,r,s,t]`, i.e.\302\240if :math:`x'`\n        and :math:`y'` are the new coordinates, then :math:`x = u^2x'+r`, :math:`y = u^3y'+su^2x'+t`.\n        :math:`E` must be an :literal:`ell` structure as output by :literal:`ellinit`. The special\n        case :math:`v = 1` is also used instead of :math:`[1,0,0,0]` to denote the\n        trivial coordinate change.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_387ellchangecurve(PyObject *__pyx_v_E, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellchangecurve (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_386ellchangecurve(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_386ellchangecurve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_v) {
  GEN __pyx_v__E;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellchangecurve", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":6313
 *         trivial coordinate change.
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":6314
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 6314, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6315
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangecurve(_E, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6316
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellchangecurve(_E, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6317
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangecurve(_E, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellchangecurve(__pyx_v__E, __pyx_v__v);

  /* "cypari/auto_gen.pxi":6318
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangecurve(_E, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellchangepoint(x, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6304
 *         return new_gen(_ret)
 * 
 *     def ellchangecurve(E, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the data for the elliptic curve :math:`E`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellchangecurve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6320
 *         return new_gen(_ret)
 * 
 *     def ellchangepoint(x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_389ellchangepoint(PyObject *__pyx_v_x, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_388ellchangepoint[] = "\n        Changes the coordinates of the point or\n        vector of points :math:`x` using the vector :literal:`v = [u,r,s,t]`, i.e.\302\240if :math:`x'` and\n        :math:`y'` are the new coordinates, then :math:`x = u^2x'+r`, :math:`y = u^3y'+su^2x'+t` (see also\n        :literal:`ellchangecurve`).\n        \n        ::\n        \n            ? E0 = ellinit([1,1]); P0 = [0,1]; v = [1,2,3,4];\n            ? E = ellchangecurve(E0, v);\n            ? P = ellchangepoint(P0,v)\n            %3 = [-2, 3]\n            ? ellisoncurve(E, P)\n            %4 = 1\n            ? ellchangepointinv(P,v)\n            %5 = [0, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_389ellchangepoint(PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellchangepoint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_388ellchangepoint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_388ellchangepoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellchangepoint", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":6338
 *             %5 = [0, 1]
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":6339
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 6339, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6340
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepoint(_x, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6341
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellchangepoint(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6342
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepoint(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellchangepoint(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":6343
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepoint(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellchangepointinv(x, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6320
 *         return new_gen(_ret)
 * 
 *     def ellchangepoint(x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellchangepoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6345
 *         return new_gen(_ret)
 * 
 *     def ellchangepointinv(x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or vector of points :math:`x` using
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_391ellchangepointinv(PyObject *__pyx_v_x, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_390ellchangepointinv[] = "\n        Changes the coordinates of the point or vector of points :math:`x` using\n        the inverse of the isomorphism attached to :literal:`v = [u,r,s,t]`,\n        i.e.\302\240if :math:`x'` and :math:`y'` are the old coordinates, then :math:`x = u^2x'+r`,\n        :math:`y = u^3y'+su^2x'+t` (inverse of :literal:`ellchangepoint`).\n        \n        ::\n        \n            ? E0 = ellinit([1,1]); P0 = [0,1]; v = [1,2,3,4];\n            ? E = ellchangecurve(E0, v);\n            ? P = ellchangepoint(P0,v)\n            %3 = [-2, 3]\n            ? ellisoncurve(E, P)\n            %4 = 1\n            ? ellchangepointinv(P,v)\n            %5 = [0, 1] \\\\ we get back P0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_391ellchangepointinv(PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellchangepointinv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_390ellchangepointinv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_390ellchangepointinv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellchangepointinv", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":6363
 *             %5 = [0, 1] \\ we get back P0
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":6364
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 6364, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6365
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepointinv(_x, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6366
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellchangepointinv(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6367
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepointinv(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellchangepointinv(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":6368
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = ellchangepointinv(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellconvertname(name):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6345
 *         return new_gen(_ret)
 * 
 *     def ellchangepointinv(x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Changes the coordinates of the point or vector of points :math:`x` using
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellchangepointinv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6370
 *         return new_gen(_ret)
 * 
 *     def ellconvertname(name):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts an elliptic curve name, as found in the :literal:`elldata` database,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_393ellconvertname(PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_392ellconvertname[] = "\n        Converts an elliptic curve name, as found in the :literal:`elldata` database,\n        from a string to a triplet :math:`[conductor, isogeny class,\n        index]`. It will also convert a triplet back to a curve name.\n        Examples:\n        \n        ::\n        \n            ? ellconvertname(\"123b1\")\n            %1 = [123, 1, 1]\n            ? ellconvertname(%)\n            %2 = \"123b1\"\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_393ellconvertname(PyObject *__pyx_v_name, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellconvertname (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_392ellconvertname(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_name));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_392ellconvertname(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_name) {
  GEN __pyx_v__name;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellconvertname", 0);

  /* "cypari/auto_gen.pxi":6384
 *             %2 = "123b1"
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _name = (<Gen>name).g
 *         cdef GEN _ret = ellconvertname(_name)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6384, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6385
 *         '''
 *         sig_on()
 *         cdef GEN _name = (<Gen>name).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellconvertname(_name)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_name)->__pyx_base.g;
  __pyx_v__name = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6386
 *         sig_on()
 *         cdef GEN _name = (<Gen>name).g
 *         cdef GEN _ret = ellconvertname(_name)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellconvertname(__pyx_v__name);

  /* "cypari/auto_gen.pxi":6387
 *         cdef GEN _name = (<Gen>name).g
 *         cdef GEN _ret = ellconvertname(_name)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elldivpol(E, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6370
 *         return new_gen(_ret)
 * 
 *     def ellconvertname(name):             # <<<<<<<<<<<<<<
 *         r'''
 *         Converts an elliptic curve name, as found in the :literal:`elldata` database,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellconvertname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6389
 *         return new_gen(_ret)
 * 
 *     def elldivpol(E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-division polynomial :math:`f_n` for the curve :math:`E` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_395elldivpol(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_394elldivpol[] = "\n        :math:`n`-division polynomial :math:`f_n` for the curve :math:`E` in the\n        variable :math:`v`. In standard notation, for any affine point :math:`P = (X,Y)` on the\n        curve, we have\n        \n        .. MATH::\n        \n            [n]P = (\\phi_n(P)\\psi_n(P) : \\omega_n(P) : \\psi_n(P)^3)\n        \n        for some polynomials :math:`\\phi_n,\\omega_n,\\psi_n` in\n        :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6][X,Y]`. We have :math:`f_n(X) = \\psi_n(X)` for :math:`n` odd, and\n        :math:`f_n(X) = \\psi_n(X,Y) (2Y + a_1X+a_3)` for :math:`n` even. We have\n        \n        .. MATH::\n        \n            f_1 = 1, f_2 = 4X^3 + b_2X^2 + 2b_4 X + b_6, f_3 = 3 X^4 + b_2 X^3 + 3b_4 X^2 + 3 b_6 X + b8,\n        \n        .. MATH::\n        \n            f_4 = f_2(2X^6 + b_2 X^5 + 5b_4 X^4 + 10 b_6 X^3 + 10 b_8 X^2 +\n            (b_2b_8-b_4b_6)X + (b_8b_4 - b_6^2)),...\n        \n        For :math:`n >= 2`, the roots of :math:`f_n` are the :math:`X`-coordinates of points in :math:`E[n]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_395elldivpol(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elldivpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elldivpol") < 0)) __PYX_ERR(10, 6389, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6389, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elldivpol", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6389, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elldivpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_394elldivpol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_n, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_394elldivpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("elldivpol", 0);

  /* "cypari/auto_gen.pxi":6414
 *         For :math:`n >= 2`, the roots of :math:`f_n` are the :math:`X`-coordinates of points in :math:`E[n]`.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":6415
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6416
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 6416, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":6415
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6417
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elldivpol(_E, n, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 6417, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6418
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elldivpol(_E, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":6419
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elldivpol(_E, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elldivpol(__pyx_v__E, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_gen.pxi":6420
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elldivpol(_E, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elleisnum(w, long k, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 6420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6389
 *         return new_gen(_ret)
 * 
 *     def elldivpol(E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-division polynomial :math:`f_n` for the curve :math:`E` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elldivpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6422
 *         return new_gen(_ret)
 * 
 *     def elleisnum(w, long k, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being an even positive integer, computes the numerical value of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_397elleisnum(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_396elleisnum[] = "\n        :math:`k` being an even positive integer, computes the numerical value of the\n        Eisenstein series of weight :math:`k` at the lattice :math:`w`, as given by\n        :literal:`ellperiods`, namely\n        \n        .. MATH::\n        \n            (2i \\pi/\\omega_2)^k\n            (1 + 2/\\zeta (1-k) \\sum_{n >= 1} n^{k-1}q^n / (1-q^n)),\n        \n        where :math:`q = \\exp (2i\\pi \\tau)` and :math:`\\tau := \\omega_1/\\omega_2` belongs to the\n        complex upper half-plane. It is also possible to directly input :math:`w =\n        [\\omega_1,\\omega_2]`, or an elliptic curve :math:`E` as given by :literal:`ellinit`.\n        \n        ::\n        \n            ? w = ellperiods([1,I]);\n            ? elleisnum(w, 4)\n            %2 = 2268.8726415508062275167367584190557607\n            ? elleisnum(w, 6)\n            %3 = -3.977978632282564763 E-33\n            ? E = ellinit([1, 0]);\n            ? elleisnum(E, 4, 1)\n            %5 = -47.999999999999999999999999999999999998\n        \n        When :emphasis:`flag` is non-zero and :math:`k = 4` or 6, returns the elliptic invariants :math:`g_2`\n        or :math:`g_3`, such that\n        \n        .. MATH::\n        \n            y^2 = 4x^3 - g_2 x - g_3\n        \n        is a Weierstrass equation for :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_397elleisnum(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elleisnum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elleisnum") < 0)) __PYX_ERR(10, 6422, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6422, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6422, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6422, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elleisnum", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6422, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elleisnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_396elleisnum(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_w), __pyx_v_k, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_396elleisnum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_k, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("elleisnum", 0);

  /* "cypari/auto_gen.pxi":6457
 *         is a Weierstrass equation for :math:`E`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6457, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6458
 *         '''
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6459
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":6460
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elleisnum(__pyx_v__w, __pyx_v_k, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":6461
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleisnum(_w, k, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elleta(w, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6422
 *         return new_gen(_ret)
 * 
 *     def elleisnum(w, long k, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being an even positive integer, computes the numerical value of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elleisnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6463
 *         return new_gen(_ret)
 * 
 *     def elleta(w, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the quasi-periods :math:`[\eta_1,\eta_2]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_399elleta(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_398elleta[] = "\n        Returns the quasi-periods :math:`[\\eta_1,\\eta_2]`\n        attached to the lattice basis :math:`w = [\\omega_1, \\omega_2]`.\n        Alternatively, :emphasis:`w` can be an elliptic curve :math:`E` as output by\n        :literal:`ellinit`, in which case, the quasi periods attached to the period\n        lattice basis :literal:`:math:`E`.omega` (namely, :literal:`:math:`E`.eta`) are returned.\n        \n        ::\n        \n            ? elleta([1, I])\n            %1 = [3.141592653589793238462643383, 9.424777960769379715387930149*I]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_399elleta(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elleta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elleta") < 0)) __PYX_ERR(10, 6463, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6463, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elleta", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6463, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elleta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_398elleta(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_w), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_398elleta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_precision) {
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("elleta", 0);

  /* "cypari/auto_gen.pxi":6476
 *             %1 = [3.141592653589793238462643383, 9.424777960769379715387930149*I]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6476, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6477
 *         '''
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleta(_w, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6478
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elleta(_w, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":6479
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleta(_w, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elleta(__pyx_v__w, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":6480
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elleta(_w, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformaldifferential(E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6463
 *         return new_gen(_ret)
 * 
 *     def elleta(w, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the quasi-periods :math:`[\eta_1,\eta_2]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elleta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6482
 *         return new_gen(_ret)
 * 
 *     def ellformaldifferential(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\omega := dx / (2y+a_1x+a_3)` be the invariant differential form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_401ellformaldifferential(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_400ellformaldifferential[] = "\n        Let :math:`\\omega := dx / (2y+a_1x+a_3)` be the invariant differential form\n        attached to the model :math:`E` of some elliptic curve (:literal:`ellinit` form),\n        and :math:`\\eta := x(t)\\omega`. Return :math:`n` terms (:literal:`seriesprecision` by default)\n        of :math:`f(t),g(t)` two power series in the formal parameter :math:`t = -x/y` such that\n        :math:`\\omega = f(t) dt`, :math:`\\eta = g(t) dt`:\n        \n        .. MATH::\n        \n            f(t) = 1+a_1 t + (a_1^2 + a_2) t^2 +...,\n            g(t) = t^{-2} +...\n        \n        ::\n        \n             ? E = ellinit([-1,1/4]); [f,g] = ellformaldifferential(E,7,'t);\n             ? f\n             %2 = 1 - 2*t^4 + 3/4*t^6 + O(t^7)\n             ? g\n             %3 = t^-2 - t^2 + 1/2*t^4 + O(t^5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_401ellformaldifferential(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformaldifferential (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformaldifferential") < 0)) __PYX_ERR(10, 6482, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6482, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformaldifferential", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6482, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformaldifferential", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_400ellformaldifferential(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_serprec, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_400ellformaldifferential(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ellformaldifferential", 0);

  /* "cypari/auto_gen.pxi":6503
 *              %3 = t^-2 - t^2 + 1/2*t^4 + O(t^5)
 *         '''
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_gen.pxi":6504
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6505
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 6505, __pyx_L1_error)
    __pyx_v__n = __pyx_t_3;

    /* "cypari/auto_gen.pxi":6504
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6506
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 6506, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6507
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":6508
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 */
  __pyx_t_2 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6509
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":6508
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 */
  }

  /* "cypari/auto_gen.pxi":6510
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformaldifferential(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_gen.pxi":6511
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformaldifferential(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformalexp(E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 6511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6482
 *         return new_gen(_ret)
 * 
 *     def ellformaldifferential(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\omega := dx / (2y+a_1x+a_3)` be the invariant differential form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformaldifferential", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6513
 *         return new_gen(_ret)
 * 
 *     def ellformalexp(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The elliptic formal exponential :literal:`Exp` attached to :math:`E` is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_403ellformalexp(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_402ellformalexp[] = "\n        The elliptic formal exponential :literal:`Exp` attached to :math:`E` is the\n        isomorphism from the formal additive law to the formal group of :math:`E`. It is\n        normalized so as to be the inverse of the elliptic logarithm (see\n        :literal:`ellformallog`): :math:`Exp o L = \\mathrm{Id}`. Return :math:`n` terms of this\n        power series:\n        \n        ::\n        \n            ? E=ellinit([-1,1/4]); Exp = ellformalexp(E,10,'z)\n            %1 = z + 2/5*z^5 - 3/28*z^7 + 2/15*z^9 + O(z^11)\n            ? L = ellformallog(E,10,'t);\n            ? subst(Exp,z,L)\n            %3 = t + O(t^11)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_403ellformalexp(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformalexp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformalexp") < 0)) __PYX_ERR(10, 6513, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6513, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformalexp", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6513, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformalexp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_402ellformalexp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_serprec, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_402ellformalexp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ellformalexp", 0);

  /* "cypari/auto_gen.pxi":6529
 *             %3 = t + O(t^11)
 *         '''
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_gen.pxi":6530
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6531
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 6531, __pyx_L1_error)
    __pyx_v__n = __pyx_t_3;

    /* "cypari/auto_gen.pxi":6530
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6532
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 6532, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6533
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":6534
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 */
  __pyx_t_2 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6535
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":6534
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 */
  }

  /* "cypari/auto_gen.pxi":6536
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformalexp(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_gen.pxi":6537
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalexp(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformallog(E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 6537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6513
 *         return new_gen(_ret)
 * 
 *     def ellformalexp(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The elliptic formal exponential :literal:`Exp` attached to :math:`E` is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformalexp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6539
 *         return new_gen(_ret)
 * 
 *     def ellformallog(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The formal elliptic logarithm is a series :math:`L` in :math:`t K[[t]]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_405ellformallog(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_404ellformallog[] = "\n        The formal elliptic logarithm is a series :math:`L` in :math:`t K[[t]]`\n        such that :math:`d L = \\omega = dx / (2y + a_1x + a_3)`, the canonical invariant\n        differential attached to the model :math:`E`. It gives an isomorphism\n        from the formal group of :math:`E` to the additive formal group.\n        \n        ::\n        \n            ? E = ellinit([-1,1/4]); L = ellformallog(E, 9, 't)\n            %1 = t - 2/5*t^5 + 3/28*t^7 + 2/3*t^9 + O(t^10)\n            ? [f,g] = ellformaldifferential(E,8,'t);\n            ? L' - f\n            %3 = O(t^8)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_405ellformallog(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformallog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformallog") < 0)) __PYX_ERR(10, 6539, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6539, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformallog", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6539, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_404ellformallog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_serprec, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_404ellformallog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ellformallog", 0);

  /* "cypari/auto_gen.pxi":6554
 *             %3 = O(t^8)
 *         '''
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_gen.pxi":6555
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6556
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 6556, __pyx_L1_error)
    __pyx_v__n = __pyx_t_3;

    /* "cypari/auto_gen.pxi":6555
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6557
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 6557, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6558
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":6559
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 */
  __pyx_t_2 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6560
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":6559
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 */
  }

  /* "cypari/auto_gen.pxi":6561
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformallog(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_gen.pxi":6562
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformallog(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformalpoint(E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 6562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6539
 *         return new_gen(_ret)
 * 
 *     def ellformallog(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The formal elliptic logarithm is a series :math:`L` in :math:`t K[[t]]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6564
 *         return new_gen(_ret)
 * 
 *     def ellformalpoint(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve, return the coordinates :math:`x(t), y(t)` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_407ellformalpoint(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_406ellformalpoint[] = "\n        If :math:`E` is an elliptic curve, return the coordinates :math:`x(t), y(t)` in the\n        formal group of the elliptic curve :math:`E` in the formal parameter :math:`t = -x/y`\n        at :math:`oo`:\n        \n        .. MATH::\n        \n            x = t^{-2} -a_1 t^{-1} - a_2 - a_3 t +...\n        \n        .. MATH::\n        \n            y = - t^{-3} -a_1 t^{-2} - a_2t^{-1} -a_3 +...\n        \n        Return :math:`n` terms (:literal:`seriesprecision` by default) of these two power\n        series, whose coefficients are in :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6]`.\n        \n        ::\n        \n            ? E = ellinit([0,0,1,-1,0]); [x,y] = ellformalpoint(E,8,'t);\n            ? x\n            %2 = t^-2 - t + t^2 - t^4 + 2*t^5 + O(t^6)\n            ? y\n            %3 = -t^-3 + 1 - t + t^3 - 2*t^4 + O(t^5)\n            ? E = ellinit([0,1/2]); ellformalpoint(E,7)\n            %4 = [x^-2 - 1/2*x^4 + O(x^5), -x^-3 + 1/2*x^3 + O(x^4)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_407ellformalpoint(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformalpoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformalpoint") < 0)) __PYX_ERR(10, 6564, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6564, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformalpoint", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6564, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformalpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_406ellformalpoint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_serprec, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_406ellformalpoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ellformalpoint", 0);

  /* "cypari/auto_gen.pxi":6591
 *             %4 = [x^-2 - 1/2*x^4 + O(x^5), -x^-3 + 1/2*x^3 + O(x^4)]
 *         '''
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_gen.pxi":6592
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6593
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 6593, __pyx_L1_error)
    __pyx_v__n = __pyx_t_3;

    /* "cypari/auto_gen.pxi":6592
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6594
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 6594, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6595
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":6596
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 */
  __pyx_t_2 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6597
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":6596
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 */
  }

  /* "cypari/auto_gen.pxi":6598
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformalpoint(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_gen.pxi":6599
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalpoint(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellformalw(E, long serprec=-1, n=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 6599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6564
 *         return new_gen(_ret)
 * 
 *     def ellformalpoint(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve, return the coordinates :math:`x(t), y(t)` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformalpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6601
 *         return new_gen(_ret)
 * 
 *     def ellformalw(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the formal power series :math:`w` attached to the elliptic curve :math:`E`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_409ellformalw(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_408ellformalw[] = "\n        Return the formal power series :math:`w` attached to the elliptic curve :math:`E`,\n        in the variable :math:`t`:\n        \n        .. MATH::\n        \n            w(t) = t^3 + a_1 t^4 + (a_2 + a_1^2) t^5 +...+ O(t^{n+3}),\n        \n        which is the formal expansion of :math:`-1/y` in the formal parameter :math:`t := -x/y`\n        at :math:`oo` (take :math:`n = seriesprecision` if :math:`n` is omitted). The\n        coefficients of :math:`w` belong to :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6]`.\n        \n        ::\n        \n            ? E=ellinit([3,2,-4,-2,5]); ellformalw(E, 5, 't)\n            %1 = t^3 + 3*t^4 + 11*t^5 + 35*t^6 + 101*t^7 + O(t^8)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_409ellformalw(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellformalw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellformalw") < 0)) __PYX_ERR(10, 6601, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6601, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellformalw", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6601, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformalw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_408ellformalw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_serprec, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_408ellformalw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec, PyObject *__pyx_v_n) {
  long __pyx_v__n;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ellformalw", 0);

  /* "cypari/auto_gen.pxi":6619
 *             %1 = t^3 + 3*t^4 + 11*t^5 + 35*t^6 + 101*t^7 + O(t^8)
 *         '''
 *         cdef long _n = -1             # <<<<<<<<<<<<<<
 *         if n is not None:
 *             _n = get_var(n)
 */
  __pyx_v__n = -1L;

  /* "cypari/auto_gen.pxi":6620
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_n != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6621
 *         cdef long _n = -1
 *         if n is not None:
 *             _n = get_var(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_n); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 6621, __pyx_L1_error)
    __pyx_v__n = __pyx_t_3;

    /* "cypari/auto_gen.pxi":6620
 *         '''
 *         cdef long _n = -1
 *         if n is not None:             # <<<<<<<<<<<<<<
 *             _n = get_var(n)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6622
 *         if n is not None:
 *             _n = get_var(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 6622, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6623
 *             _n = get_var(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":6624
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 */
  __pyx_t_2 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6625
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":6624
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 */
  }

  /* "cypari/auto_gen.pxi":6626
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellformalw(__pyx_v__E, __pyx_v_serprec, __pyx_v__n);

  /* "cypari/auto_gen.pxi":6627
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = ellformalw(_E, serprec, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellfromeqn(P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 6627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6601
 *         return new_gen(_ret)
 * 
 *     def ellformalw(E, long serprec=-1, n=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the formal power series :math:`w` attached to the elliptic curve :math:`E`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellformalw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6629
 *         return new_gen(_ret)
 * 
 *     def ellfromeqn(P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a genus :math:`1` plane curve, defined by the affine equation :math:`f(x,y) = 0`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_411ellfromeqn(PyObject *__pyx_v_P, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_410ellfromeqn[] = "\n        Given a genus :math:`1` plane curve, defined by the affine equation :math:`f(x,y) = 0`,\n        return the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a Weierstrass equation\n        for its Jacobian. This allows to recover a Weierstrass model for an elliptic\n        curve given by a general plane cubic or by a binary quartic or biquadratic\n        model. The function implements the :math:`f :--->\302\240f^*` formulae of Artin, Tate\n        and Villegas (Advances in Math. 198 (2005), pp. 366--382).\n        \n        In the example below, the function is used to convert between twisted Edwards\n        coordinates and Weierstrass coordinates.\n        \n        ::\n        \n            ? e = ellfromeqn(a*x^2+y^2 - (1+d*x^2*y^2))\n            %1 = [0, -a - d, 0, -4*d*a, 4*d*a^2 + 4*d^2*a]\n            ? E = ellinit(ellfromeqn(y^2-x^2 - 1 +(121665/121666*x^2*y^2)),2^255-19);\n            ? isprime(ellcard(E) / 8)\n            %3 = 1\n        \n        The elliptic curve attached to the sum of two cubes is given by\n        \n        ::\n        \n            ? ellfromeqn(x^3+y^3 - a)\n            %1 = [0, 0, -9*a, 0, -27*a^2]\n        \n        :strong:`Congruent number problem:.`\n        Let :math:`n` be an integer, if :math:`a^2+b^2 = c^2` and :math:`a b = 2 n`,\n        then by substituting :math:`b` by :math:`2 n/a` in the first equation,\n        we get :math:`((a^2+(2 n/a)^2)-c^2) a^2 = 0`.\n        We set :math:`x = a`, :math:`y = a c`.\n        \n        ::\n        \n            ? En = ellfromeqn((x^2 + (2*n/x)^2 - (y/x)^2)*x^2)\n            %1 = [0, 0, 0, -16*n^2, 0]\n        \n        For example :math:`23` is congruent since the curve has a point of infinite order,\n        namely:\n        \n        ::\n        \n            ? ellheegner( ellinit(subst(En, n, 23)) )\n            %2 = [168100/289, 68053440/4913]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_411ellfromeqn(PyObject *__pyx_v_P, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellfromeqn (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_410ellfromeqn(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_P));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_410ellfromeqn(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P) {
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellfromeqn", 0);

  /* "cypari/auto_gen.pxi":6675
 *             %2 = [168100/289, 68053440/4913]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellfromeqn(_P)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6675, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6676
 *         '''
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellfromeqn(_P)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6677
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellfromeqn(_P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellfromeqn(__pyx_v__P);

  /* "cypari/auto_gen.pxi":6678
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellfromeqn(_P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellfromj(j):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6629
 *         return new_gen(_ret)
 * 
 *     def ellfromeqn(P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a genus :math:`1` plane curve, defined by the affine equation :math:`f(x,y) = 0`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellfromeqn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6680
 *         return new_gen(_ret)
 * 
 *     def ellfromj(j):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a fixed elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_413ellfromj(PyObject *__pyx_v_j, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_412ellfromj[] = "\n        Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a fixed elliptic curve\n        with :math:`j`-invariant :math:`j`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_413ellfromj(PyObject *__pyx_v_j, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellfromj (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_412ellfromj(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_j));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_412ellfromj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_j) {
  GEN __pyx_v__j;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellfromj", 0);

  /* "cypari/auto_gen.pxi":6685
 *         with :math:`j`-invariant :math:`j`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _j = (<Gen>j).g
 *         cdef GEN _ret = ellfromj(_j)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6685, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6686
 *         '''
 *         sig_on()
 *         cdef GEN _j = (<Gen>j).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellfromj(_j)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_j)->__pyx_base.g;
  __pyx_v__j = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6687
 *         sig_on()
 *         cdef GEN _j = (<Gen>j).g
 *         cdef GEN _ret = ellfromj(_j)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellfromj(__pyx_v__j);

  /* "cypari/auto_gen.pxi":6688
 *         cdef GEN _j = (<Gen>j).g
 *         cdef GEN _ret = ellfromj(_j)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellgenerators(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6688, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6680
 *         return new_gen(_ret)
 * 
 *     def ellfromj(j):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of a fixed elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellfromj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6690
 *         return new_gen(_ret)
 * 
 *     def ellgenerators(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve over the rationals, return a :math:`\mathbb{Z}`-basis of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_415ellgenerators(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_414ellgenerators[] = "\n        If :math:`E` is an elliptic curve over the rationals, return a :math:`\\mathbb{Z}`-basis of the\n        free part of the Mordell-Weil group attached to :math:`E`. This relies on\n        the :literal:`elldata` database being installed and referencing the curve, and so\n        is only available for curves over :math:`\\mathbb{Z}` of small conductors.\n        If :math:`E` is an elliptic curve over a finite field :math:`\\mathbb{F}_q` as output by\n        :literal:`ellinit`, return a minimal set of generators for the group :math:`E(\\mathbb{F}_q)`.\n        \n        :strong:`Caution.` when the group is not cyclic, of shape :math:`\\mathbb{Z}/d_1\\mathbb{Z} x\n        \\mathbb{Z}/d_2\\mathbb{Z}` with :math:`d_2 \\| d_1`, the points :math:`[P,Q]` returned by ellgenerators\n        need not have order :math:`d_1` and :math:`d_2`: it is true that\n        :math:`P` has order :math:`d_1`, but we only know that :math:`Q` is a generator of\n        :math:`E(\\mathbb{F}_q)/ <P>` and that the Weil pairing :math:`w(P,Q)` has order :math:`d_2`,\n        see :literal:`\077\077ellgroup`.\n        If you need generators :math:`[P,R]` with :math:`R` of order :math:`d_2`, find\n        :math:`x` such that :math:`R = Q-[x]P` has order :math:`d_2` by solving\n        the discrete logarithm problem :math:`[d_2]Q = [x]([d_2]P)` in a cyclic group of\n        order :math:`d_1/d_2`. This will be very expensive if :math:`d_1/d_2` has a large\n        prime factor.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_415ellgenerators(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellgenerators (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_414ellgenerators(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_414ellgenerators(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellgenerators", 0);

  /* "cypari/auto_gen.pxi":6711
 *         prime factor.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellgenerators(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6711, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6712
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellgenerators(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6713
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellgenerators(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellgenerators(__pyx_v__E);

  /* "cypari/auto_gen.pxi":6714
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellgenerators(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellglobalred(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6690
 *         return new_gen(_ret)
 * 
 *     def ellgenerators(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve over the rationals, return a :math:`\mathbb{Z}`-basis of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellgenerators", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6716
 *         return new_gen(_ret)
 * 
 *     def ellglobalred(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit` attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_417ellglobalred(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_416ellglobalred[] = "\n        Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit` attached\n        to an elliptic curve defined over a number field. This function calculates\n        the arithmetic conductor and the global Tamagawa number :math:`c`.\n        The result :math:`[N,v,c,F,L]` is slightly different if :math:`E` is defined\n        over :math:`\\mathbb{Q}` (domain :math:`D = 1` in :literal:`ellinit`) or over a number field\n        (domain :math:`D` is a number field structure, including :literal:`nfinit(x)`\n        representing :math:`\\mathbb{Q}` !):\n        \n        - :math:`N` is the arithmetic conductor of the curve,\n        \n        - :math:`v` is an obsolete field, left in place for backward compatibility.\n          If :math:`E` is defined over :math:`\\mathbb{Q}`, :math:`v` gives the coordinate change for :math:`E` to the\n          standard minimal integral model (:literal:`ellminimalmodel` provides it in a\n          cheaper way); if :math:`E` is defined over another number field, :math:`v` gives a\n          coordinate change to an integral model (:literal:`ellintegralmodel` provides it\n          in a cheaper way).\n        \n        - :math:`c` is the product of the local Tamagawa numbers :math:`c_p`, a quantity\n          which enters in the Birch and Swinnerton-Dyer conjecture,\n        \n        - :math:`F` is the factorization of :math:`N`,\n        \n        - :math:`L` is a vector, whose :math:`i`-th entry contains the local data\n          at the :math:`i`-th prime ideal divisor of :math:`N`, i.e.\n          :literal:`L[i] = elllocalred(E,F[i,1])`. If :math:`E` is defined over :math:`\\mathbb{Q}`, the local\n          coordinate change has been deleted and replaced by a 0; if :math:`E` is defined\n          over another number field the local coordinate change to a local minimal\n          model is given relative to the integral model afforded by :math:`v` (so either\n          start from an integral model so that :math:`v`"" be trivial, or apply :math:`v` first).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_417ellglobalred(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellglobalred (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_416ellglobalred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_416ellglobalred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellglobalred", 0);

  /* "cypari/auto_gen.pxi":6748
 *           start from an integral model so that :math:`v` be trivial, or apply :math:`v` first).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellglobalred(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6748, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6749
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellglobalred(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6750
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellglobalred(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellglobalred(__pyx_v__E);

  /* "cypari/auto_gen.pxi":6751
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellglobalred(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellgroup(E, p=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6716
 *         return new_gen(_ret)
 * 
 *     def ellglobalred(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :literal:`ell` structure as output by :literal:`ellinit` attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellglobalred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6753
 *         return new_gen(_ret)
 * 
 *     def ellgroup(E, p=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_419ellgroup(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_418ellgroup[] = "\n        Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached\n        to an elliptic curve :math:`E/K`. We first describle the function when the field\n        :math:`K = \\mathbb{F}_q` is finite, it computes the structure of the finite abelian group\n        :math:`E(\\mathbb{F}_q)`:\n        \n        - if :math:`flag = 0`, return the structure :math:`[]` (trivial group) or :math:`[d_1]`\n          (non-trivial cyclic group) or :math:`[d_1,d_2]` (non-cyclic group) of\n          :math:`E(\\mathbb{F}_q) ~ \\mathbb{Z}/d_1\\mathbb{Z} x \\mathbb{Z}/d_2\\mathbb{Z}`, with :math:`d_2 \\| d_1`.\n        \n        - if :math:`flag = 1`, return a triple :math:`[h,cyc,gen]`, where\n          :math:`h` is the curve cardinality, :emphasis:`cyc` gives the group structure as a\n          product of cyclic groups (as per :math:`flag = 0`). More precisely, if :math:`d_2 > 1`,\n          the output is :math:`[d_1d_2, [d_1,d_2], [P,Q]]` where :math:`P` is\n          of order :math:`d_1` and :math:`[P,Q]` generates the curve.\n          :strong:`Caution.` It is not guaranteed that :math:`Q` has order :math:`d_2`, which in\n          the worst case requires an expensive discrete log computation. Only that\n          :literal:`ellweilpairing`:math:`(E, P, Q, d_1)` has order :math:`d_2`.\n        \n        For other fields of definition and :math:`p` defining a finite residue field\n        :math:`\\mathbb{F}_q`, return the structure of the reduction of :math:`E`: the argument\n        :math:`p` is best left omitted if :math:`K = \\mathbb{Q}_\\ell` (else we must have :math:`p = \\ell`) and\n        must be a prime number (:math:`K = \\mathbb{Q}`) or prime ideal (:math:`K` a general number field)\n        with residue field :math:`\\mathbb{F}_q` otherwise. The curve is allowed to have bad\n        reduction at :math:`p` and in this case we consider the (cyclic) group of\n        non-singular points for the reduction of a minimal model at :math:`p`.""\n        \n        If :math:`flag = 0`, the equation not be minimal or even integral at :math:`p`; of course,\n        a minimal model will be more efficient.\n        \n        If :math:`flag = 1`, the requested generators depend on the model, which must then\n        be minimal at :math:`p`, otherwise an exception is thrown. Use\n        :literal:`ellintegralmodel` and/or :literal:`ellocalred` first to reduce to this case.\n        \n        ::\n        \n            ? E = ellinit([0,1]); \\\\ y^2 = x^3 + 0.x + 1, defined over Q\n            ? ellgroup(E, 7)\n            %2 = [6, 2] \\\\ Z/6 x Z/2, non-cyclic\n            ? E = ellinit([0,1] * Mod(1,11)); \\\\ defined over F_11\n            ? ellgroup(E) \\\\ no need to repeat 11\n            %4 = [12]\n            ? ellgroup(E, 11) \\\\ ... but it also works\n            %5 = [12]\n            ? ellgroup(E, 13) \\\\ ouch, inconsistent input!\n             *** at top-level: ellgroup(E,13)\n             *** ^--------------\n             *** ellgroup: inconsistent moduli in Rg_to_Fp:\n             11\n             13\n            ? ellgroup(E, 7, 1)\n            %6 = [12, [6, 2], [[Mod(2, 7), Mod(4, 7)], [Mod(4, 7), Mod(4, 7)]]]\n        \n        Let us now consider curves of bad reduction, in this case we return the\n        structure of the (cyclic) group of non-singular points, satisfying\n        :math:`\\#E_{ns}(\\mathbb{F}_p) = p - a_p`:\n        \n        ::\n        \n            ? E = ellinit([0,5]);\n            ? ellgroup(E, 5, 1)\n            %2 = [5, [5], [[Mod(4, 5), Mod(2, 5)]]]\n            ? ellap(E, 5)\n            %3 = 0 \\\\ additive reduction at 5\n            ? E = ellinit([0,-1,0,35,0]);\n            ? ellgroup(E, 5, 1)\n            %5 = [4, [4], [[Mod(2, 5), Mod(2, 5)]]]\n            ? ellap(E, 5)\n            %6 = 1 \\\\ split multiplicative reduction at 5\n            ? ellgroup(E, 7, 1)\n            %7 = [8, [8], [[Mod(3, 7), Mod(5, 7)]]]\n            ? ellap(E, 7)\n            %8 = -1 ""\\\\ non-split multiplicative reduction at 7\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_419ellgroup(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellgroup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_flag,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellgroup") < 0)) __PYX_ERR(10, 6753, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_p = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6753, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellgroup", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6753, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_418ellgroup(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_418ellgroup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_flag) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellgroup", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":6828
 *             %8 = -1 \\ non-split multiplicative reduction at 7
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":6829
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6830
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":6829
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6831
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 6831, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6832
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6833
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":6834
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":6835
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":6834
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 */
  }

  /* "cypari/auto_gen.pxi":6836
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellgroup0(__pyx_v__E, __pyx_v__p, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":6837
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = ellgroup0(_E, _p, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellheegner(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 6837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6753
 *         return new_gen(_ret)
 * 
 *     def ellgroup(E, p=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :literal:`E` be an :literal:`ell` structure as output by :literal:`ellinit`, attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6839
 *         return new_gen(_ret)
 * 
 *     def ellheegner(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve over the rationals, assumed to be of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_421ellheegner(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_420ellheegner[] = "\n        Let :math:`E` be an elliptic curve over the rationals, assumed to be of\n        (analytic) rank :math:`1`. This returns a non-torsion rational point on the curve,\n        whose canonical height is equal to the product of the elliptic regulator by the\n        analytic Sha.\n        \n        This uses the Heegner point method, described in Cohen GTM 239; the complexity\n        is proportional to the product of the square root of the conductor and the\n        height of the point (thus, it is preferable to apply it to strong Weil curves).\n        \n        ::\n        \n            ? E = ellinit([-157^2,0]);\n            ? u = ellheegner(E); print(u[1], \"\\n\", u[2])\n            69648970982596494254458225/166136231668185267540804\n            538962435089604615078004307258785218335/67716816556077455999228495435742408\n            ? ellheegner(ellinit([0,1])) \\\\ E has rank 0 !\n             *** at top-level: ellheegner(E=ellinit\n             *** ^--------------------\n             *** ellheegner: The curve has even analytic rank.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_421ellheegner(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellheegner (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_420ellheegner(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_420ellheegner(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellheegner", 0);

  /* "cypari/auto_gen.pxi":6861
 *              *** ellheegner: The curve has even analytic rank.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellheegner(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6861, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6862
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellheegner(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6863
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellheegner(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellheegner(__pyx_v__E);

  /* "cypari/auto_gen.pxi":6864
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellheegner(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellheight(E, P, Q=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6839
 *         return new_gen(_ret)
 * 
 *     def ellheegner(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve over the rationals, assumed to be of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellheegner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6866
 *         return new_gen(_ret)
 * 
 *     def ellheight(E, P, Q=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Global Nron-Tate height :math:`h(P)` of the point :math:`P` on the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_423ellheight(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_422ellheight[] = "\n        Global N\303\251ron-Tate height :math:`h(P)` of the point :math:`P` on the elliptic curve\n        :math:`E`, defined over :math:`\\mathbb{Q}` or a number field, using the same normalization as\n        Cremona's :emphasis:`Algorithms for modular elliptic curves`. :math:`E` must be an\n        :literal:`ell` as output by :literal:`ellinit`; it needs not be given by a minimal\n        model although the computation will be faster if it is. The height of a\n        torsion point is exactly 0, else a positive real number.\n        \n        If the argument :math:`Q` is present, computes the value of the bilinear\n        form :math:`(h(P+Q)-h(P-Q)) / 4`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_423ellheight(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellheight (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellheight") < 0)) __PYX_ERR(10, 6866, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
    __pyx_v_Q = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6866, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellheight", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6866, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_422ellheight(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_P, __pyx_v_Q, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_422ellheight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_precision) {
  int __pyx_v__have_Q;
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellheight", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_gen.pxi":6878
 *         form :math:`(h(P+Q)-h(P-Q)) / 4`.
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":6879
 *         '''
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             Q = objtogen(Q)
 */
  __pyx_t_2 = (__pyx_v_Q != Py_None);
  __pyx_v__have_Q = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6880
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6881
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 *             Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6881, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":6880
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":6882
 *         if _have_Q:
 *             Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 6882, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6883
 *             Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6884
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_gen.pxi":6885
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 */
  __pyx_v__Q = NULL;

  /* "cypari/auto_gen.pxi":6886
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":6887
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 *             _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
    __pyx_v__Q = __pyx_t_4;

    /* "cypari/auto_gen.pxi":6886
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":6888
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":6889
 *             _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellheight0(__pyx_v__E, __pyx_v__P, __pyx_v__Q, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":6890
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheight0(_E, _P, _Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellheightmatrix(E, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6866
 *         return new_gen(_ret)
 * 
 *     def ellheight(E, P, Q=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Global Nron-Tate height :math:`h(P)` of the point :math:`P` on the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6892
 *         return new_gen(_ret)
 * 
 *     def ellheightmatrix(E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector of points, this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_425ellheightmatrix(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_424ellheightmatrix[] = "\n        :math:`x` being a vector of points, this\n        function outputs the Gram matrix of :math:`x` with respect to the N\303\251ron-Tate\n        height, in other words, the :math:`(i,j)` component of the matrix is equal to\n        :literal:`ellbil(:math:`E`,x[:math:`i`],x[:math:`j`])`. The rank of this matrix, at least in some\n        approximate sense, gives the rank of the set of points, and if :math:`x` is a\n        basis of the Mordell-Weil group of :math:`E`, its determinant is equal to\n        the regulator of :math:`E`. Note our height normalization follows Cremona's\n        :emphasis:`Algorithms for modular elliptic curves`: this matrix should be divided\n        by 2 to be in accordance with, e.g., Silverman's normalizations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_425ellheightmatrix(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellheightmatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellheightmatrix") < 0)) __PYX_ERR(10, 6892, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6892, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellheightmatrix", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6892, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_424ellheightmatrix(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_424ellheightmatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellheightmatrix", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":6904
 *         by 2 to be in accordance with, e.g., Silverman's normalizations.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":6905
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 6905, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6906
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6907
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":6908
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":6909
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellheightmatrix(__pyx_v__E, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":6910
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellheightmatrix(_E, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellidentify(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 6910, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6892
 *         return new_gen(_ret)
 * 
 *     def ellheightmatrix(E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector of points, this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6912
 *         return new_gen(_ret)
 * 
 *     def ellidentify(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Look up the elliptic curve :math:`E`, defined by an arbitrary model over :math:`\mathbb{Q}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_427ellidentify(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_426ellidentify[] = "\n        Look up the elliptic curve :math:`E`, defined by an arbitrary model over :math:`\\mathbb{Q}`,\n        in the :literal:`elldata` database.\n        Return :literal:`[[N, M, G], C]` where :math:`N` is the curve name in Cremona's\n        elliptic curve database, :math:`M` is the minimal model, :math:`G` is a :math:`\\mathbb{Z}`-basis of\n        the free part of the Mordell-Weil group :math:`E(\\mathbb{Q})` and :math:`C` is the\n        change of coordinates change, suitable for :literal:`ellchangecurve`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_427ellidentify(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellidentify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_426ellidentify(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_426ellidentify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellidentify", 0);

  /* "cypari/auto_gen.pxi":6921
 *         change of coordinates change, suitable for :literal:`ellchangecurve`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellidentify(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 6921, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":6922
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellidentify(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":6923
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellidentify(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellidentify(__pyx_v__E);

  /* "cypari/auto_gen.pxi":6924
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellidentify(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellinit(x, D=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 6924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6912
 *         return new_gen(_ret)
 * 
 *     def ellidentify(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Look up the elliptic curve :math:`E`, defined by an arbitrary model over :math:`\mathbb{Q}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellidentify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":6926
 *         return new_gen(_ret)
 * 
 *     def ellinit(x, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize an :literal:`ell` structure, attached to the elliptic curve :math:`E`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_429ellinit(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_428ellinit[] = "\n        Initialize an :literal:`ell` structure, attached to the elliptic curve :math:`E`.\n        :math:`E` is either\n        \n        - a :math:`5`-component vector :math:`[a_1,a_2,a_3,a_4,a_6]` defining the elliptic\n          curve with Weierstrass equation\n          \n        \n        .. MATH::\n        \n            Y^2 + a_1 XY + a_3 Y = X^3 + a_2 X^2 + a_4 X + a_6,\n        \n        - a :math:`2`-component vector :math:`[a_4,a_6]` defining the elliptic\n          curve with short Weierstrass equation\n          \n        \n        .. MATH::\n        \n            Y^2 = X^3 + a_4 X + a_6,\n        \n        - a character string in Cremona's notation, e.g. :literal:`\"11a1\"`, in which\n          case the curve is retrieved from the :literal:`elldata` database if available.\n        \n        The optional argument :math:`D` describes the domain over which the curve is\n        defined:\n        \n        - the :literal:`t_INT` :math:`1` (default): the field of rational numbers :math:`\\mathbb{Q}`.\n        \n        - a :literal:`t_INT` :math:`p`, where :math:`p` is a prime number: the prime finite field\n          :math:`\\mathbb{F}_p`.\n        \n        - an :literal:`t_INTMOD` :literal:`Mod(a, p)`, where :math:`p` is a prime number: the\n          prime finite field :math:`\\mathbb{F}_p`.\n        \n        - a :literal:`t_FFELT`, as returned by :literal:`ffgen`: the corresponding finite\n          field :math:`\\mathbb{F}_q`.\n        \n        - a :literal:`t_PADIC`, :math:`O(p^n)`: the field :math:`\\mathbb{Q}_p`, where :math:`p`-adic quantities\n          will be computed to a relative accuracy of :math:`n` digits. We advise to input a\n          model defined over :math:`\\mathbb{Q}` for such curves. In any case, if you input an\n          approximate model with :literal:`t_PADIC` coefficients, it will be replaced by a lift\n          to :math:`\\mathbb{Q}` (an exact model \"close\" to the one that was input) and all quantities\n          will ""then be computed in terms of this lifted model, at the given accuracy.\n        \n        - a :literal:`t_REAL` :math:`x`: the field :math:`\\mathbb{C}` of complex numbers, where floating\n          point quantities are by default computed to a relative accuracy of\n          :literal:`precision`:math:`(x)`. If no such argument is given, the value of\n          :literal:`realprecision` at the time :literal:`ellinit` is called will be used.\n        \n        - a number field :math:`K`, given by a :literal:`nf` or :literal:`bnf` structure; a\n          :literal:`bnf` is required for :literal:`ellminimalmodel`.\n        \n        - a prime ideal :math:`p`, given by a :literal:`prid` structure; valid if\n          :math:`x` is a curve defined over a number field :math:`K` and the equation is integral\n          and minimal at :math:`p`.\n        \n        This argument :math:`D` is indicative: the curve coefficients are checked for\n        compatibility, possibly changing :math:`D`; for instance if :math:`D = 1` and\n        an :literal:`t_INTMOD` is found. If inconsistencies are detected, an error is\n        raised:\n        \n        ::\n        \n            ? ellinit([1 + O(5), 1], O(7));\n             *** at top-level: ellinit([1+O(5),1],O\n             *** ^--------------------\n             *** ellinit: inconsistent moduli in ellinit: 7 != 5\n        \n        If the curve coefficients are too general to fit any of the\n        above domain categories, only basic operations, such as point addition, will\n        be supported later.\n        \n        If the curve (seen over the domain :math:`D`) is singular, fail and return an\n        empty vector :math:`[]`.\n        \n        ::\n        \n            ? E = ellinit([0,0,0,0,1]); \\\\ y^2 = x^3 + 1, over Q\n            ? E = ellinit([0,1]); \\\\ the same curve, short form\n            ? E = ellinit(\"36a1\"); \\\\ sill the same curve, Cremona's notations\n            ? E = ellinit([0,1], 2) \\\\ over F2: sin""gular curve\n            %4 = []\n            ? E = ellinit(['a4,'a6] * Mod(1,5)); \\\\ over F_5[a4,a6], basic support !\n        \n        The result of :literal:`ellinit` is an :emphasis:`ell` structure. It contains at least\n        the following information in its components:\n        \n        .. MATH::\n        \n            a_1,a_2,a_3,a_4,a_6,b_2,b_4,b_6,b_8,c_4,c_6,\\Delta,j.\n        \n        All are accessible via member functions. In particular, the discriminant is\n        :literal:`:math:`E`.disc`, and the :math:`j`-invariant is :literal:`:math:`E`.j`.\n        \n        ::\n        \n            ? E = ellinit([a4, a6]);\n            ? E.disc\n            %2 = -64*a4^3 - 432*a6^2\n            ? E.j\n            %3 = -6912*a4^3/(-4*a4^3 - 27*a6^2)\n        \n        Further components contain domain-specific data, which are in general dynamic:\n        only computed when needed, and then cached in the structure.\n        \n        ::\n        \n            ? E = ellinit([2,3], 10^60+7); \\\\ E over F_p, p large\n            ? ellap(E)\n            time = 4,440 ms.\n            %2 = -1376268269510579884904540406082\n            ? ellcard(E); \\\\ now instantaneous !\n            time = 0 ms.\n            ? ellgenerators(E);\n            time = 5,965 ms.\n            ? ellgenerators(E); \\\\ second time instantaneous\n            time = 0 ms.\n        \n        See the description of member functions related to elliptic curves at the\n        beginning of this section.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_429ellinit(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellinit") < 0)) __PYX_ERR(10, 6926, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_D = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 6926, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellinit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 6926, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_428ellinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_D, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_428ellinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_D, long __pyx_v_precision) {
  int __pyx_v__have_D;
  GEN __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellinit", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":7048
 *         beginning of this section.
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":7049
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":7050
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":7049
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7051
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 7051, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7052
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7053
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":7054
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":7055
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellinit(_x, _D, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7054
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":7056
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellinit(_x, _D, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":7057
 *             _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellinit(_x, _D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellinit(__pyx_v__x, __pyx_v__D, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":7058
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellinit(_x, _D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisogeny(E, G, long only_image=0, x=None, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":6926
 *         return new_gen(_ret)
 * 
 *     def ellinit(x, D=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize an :literal:`ell` structure, attached to the elliptic curve :math:`E`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7060
 *         return new_gen(_ret)
 * 
 *     def ellisogeny(E, G, long only_image=0, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E`, a finite subgroup :math:`G` of :math:`E` is given either
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_431ellisogeny(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_430ellisogeny[] = "\n        Given an elliptic curve :math:`E`, a finite subgroup :math:`G` of :math:`E` is given either\n        as a generating point :math:`P` (for a cyclic :math:`G`) or as a polynomial whose roots\n        vanish on the :math:`x`-coordinates of the non-zero elements of :math:`G` (general case\n        and more efficient if available). This function returns the\n        :math:`[a_1,a_2,a_3,a_4,a_6]` invariants of the quotient elliptic curve :math:`E/G` and\n        (if :emphasis:`only_image` is zero (the default)) a vector of rational\n        functions :math:`[f, g, h]` such that the isogeny :math:`E \\to E/G` is given by :math:`(x,y)\n        :---> (f(x)/h(x)^2, g(x,y)/h(x)^3)`.\n        \n        ::\n        \n            ? E = ellinit([0,1]);\n            ? elltors(E)\n            %2 = [6, [6], [[2, 3]]]\n            ? ellisogeny(E, [2,3], 1) \\\\ Weierstrass model for E/<P>\n            %3 = [0, 0, 0, -135, -594]\n            ? ellisogeny(E,[-1,0])\n            %4 = [[0,0,0,-15,22], [x^3+2*x^2+4*x+3, y*x^3+3*y*x^2-2*y, x+1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_431ellisogeny(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  long __pyx_v_only_image;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisogeny (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_only_image,&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    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_G)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_only_image);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          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_y);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellisogeny") < 0)) __PYX_ERR(10, 7060, __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);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_G = values[0];
    if (values[1]) {
      __pyx_v_only_image = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_only_image == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7060, __pyx_L3_error)
    } else {
      __pyx_v_only_image = ((long)0);
    }
    __pyx_v_x = values[2];
    __pyx_v_y = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellisogeny", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7060, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellisogeny", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_430ellisogeny(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_G, __pyx_v_only_image, __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_430ellisogeny(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_G, long __pyx_v_only_image, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  long __pyx_v__x;
  long __pyx_v__y;
  GEN __pyx_v__E;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ellisogeny", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_gen.pxi":7081
 *             %4 = [[0,0,0,-15,22], [x^3+2*x^2+4*x+3, y*x^3+3*y*x^2-2*y, x+1]]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         cdef long _x = -1
 *         if x is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7082
 *         '''
 *         G = objtogen(G)
 *         cdef long _x = -1             # <<<<<<<<<<<<<<
 *         if x is not None:
 *             _x = get_var(x)
 */
  __pyx_v__x = -1L;

  /* "cypari/auto_gen.pxi":7083
 *         G = objtogen(G)
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         cdef long _y = -1
 */
  __pyx_t_2 = (__pyx_v_x != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":7084
 *         cdef long _x = -1
 *         if x is not None:
 *             _x = get_var(x)             # <<<<<<<<<<<<<<
 *         cdef long _y = -1
 *         if y is not None:
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_x); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 7084, __pyx_L1_error)
    __pyx_v__x = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7083
 *         G = objtogen(G)
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         cdef long _y = -1
 */
  }

  /* "cypari/auto_gen.pxi":7085
 *         if x is not None:
 *             _x = get_var(x)
 *         cdef long _y = -1             # <<<<<<<<<<<<<<
 *         if y is not None:
 *             _y = get_var(y)
 */
  __pyx_v__y = -1L;

  /* "cypari/auto_gen.pxi":7086
 *             _x = get_var(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_y != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7087
 *         cdef long _y = -1
 *         if y is not None:
 *             _y = get_var(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_y); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 7087, __pyx_L1_error)
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7086
 *             _x = get_var(x)
 *         cdef long _y = -1
 *         if y is not None:             # <<<<<<<<<<<<<<
 *             _y = get_var(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7088
 *         if y is not None:
 *             _y = get_var(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 7088, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7089
 *             _y = get_var(y)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_6;

  /* "cypari/auto_gen.pxi":7090
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_6;

  /* "cypari/auto_gen.pxi":7091
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisogeny(__pyx_v__E, __pyx_v__G, __pyx_v_only_image, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":7092
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = ellisogeny(_E, _G, only_image, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisogenyapply(f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7060
 *         return new_gen(_ret)
 * 
 *     def ellisogeny(E, G, long only_image=0, x=None, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E`, a finite subgroup :math:`G` of :math:`E` is given either
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellisogeny", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7094
 *         return new_gen(_ret)
 * 
 *     def ellisogenyapply(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an isogeny of elliptic curves :math:`f:E'\to E` (being the result of a call
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_433ellisogenyapply(PyObject *__pyx_v_f, PyObject *__pyx_v_g); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_432ellisogenyapply[] = "\n        Given an isogeny of elliptic curves :math:`f:E'\\to E` (being the result of a call\n        to :literal:`ellisogeny`), apply :math:`f` to :math:`g`:\n        \n        - if :math:`g` is a point :math:`P` in the domain of :math:`f`, return the image :math:`f(P)`;\n        \n        - if :math:`g:E\"\\to E'` is a compatible isogeny, return the composite\n          isogeny :math:`f o g: E\"\\to E`.\n        \n        ::\n        \n            ? one = ffgen(101, 't)^0;\n            ? E = ellinit([6, 53, 85, 32, 34] * one);\n            ? P = [84, 71] * one;\n            ? ellorder(E, P)\n            %4 = 5\n            ? [F, f] = ellisogeny(E, P); \\\\ f: E->F = E/<P>\n            ? ellisogenyapply(f, P)\n            %6 = [0]\n            ? F = ellinit(F);\n            ? Q = [89, 44] * one;\n            ? ellorder(F, Q)\n            %9 = 2\n            ? [G, g] = ellisogeny(F, Q); \\\\ g: F->G = F/<Q>\n            ? gof = ellisogenyapply(g, f); \\\\ gof: E -> G\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_433ellisogenyapply(PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisogenyapply (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_432ellisogenyapply(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_g));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_432ellisogenyapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellisogenyapply", 0);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_gen.pxi":7121
 *             ? gof = ellisogenyapply(g, f); \\ gof: E -> G
 *         '''
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7122
 *         '''
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 7122, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7123
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ellisogenyapply(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7124
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisogenyapply(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7125
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ellisogenyapply(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisogenyapply(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_gen.pxi":7126
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ellisogenyapply(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisomat(E, long p=0, long fl=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7094
 *         return new_gen(_ret)
 * 
 *     def ellisogenyapply(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an isogeny of elliptic curves :math:`f:E'\to E` (being the result of a call
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellisogenyapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7128
 *         return new_gen(_ret)
 * 
 *     def ellisomat(E, long p=0, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over a number field, compute
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_435ellisomat(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_434ellisomat[] = "\n        Given an elliptic curve :math:`E` defined over a number field, compute\n        representatives of the isomorphism classes of elliptic curves :math:`\\mathbb{Q}`-isogenous\n        to :math:`E`. The function returns a vector :math:`[L,M]` where :math:`L` is a list of triples\n        :math:`[E_i, f_i, g_i]`, where :math:`E_i` is an elliptic curve in :math:`[a_4,a_6]` form,\n        :math:`f_i: E \\to E_i` is a rational isogeny, :math:`g_i: E_i \\to E` is the dual isogeny\n        of :math:`f_i`, and :math:`M` is the matrix such that :math:`M_{i,j}` is the degree of the\n        isogeny between :math:`E_i` and :math:`E_j`. Furthermore the first curve :math:`E_1` is\n        isomorphic to :math:`E` by :math:`f_1`. If the flag :math:`fl = 1`, the :math:`f_i` and :math:`g_i` are\n        not computed, which saves time, and :math:`L` is the list of the curves :math:`E_i`.\n        If :math:`p` is set, it must be a prime number; in this which case only isogenies of\n        degree a power of :math:`p` are considered.\n        Over a number field, the possible isogeny degrees are determined by\n        Billerey algorithm. As a consequence, CM curves over a number field are not\n        fully supported.\n        \n        ::\n        \n            ? E = ellinit(\"14a1\");\n            ? [L,M] = ellisomat(E);\n            ? LE = apply(x->x[1], L) \\\\ list of curves\n            %3 = [[215/48,-5291/864],[-675/16,6831/32],[-8185/48,-742643/864],\n             [-1705/48,-57707/864],[-13635/16,306207/32],[-131065/48,-47449331/864]]\n            ? L[2][2] \\\\ isogeny f_2\n            %4 = [x^3+3/4*x^2+19/2*x-311/12,\n             1/2*x^4+(y+1)*x^3+(y-4)*x^2+(-9*y+23)*x+(55*y+55/2),x+1/3]\n            ? L[2][3] \\\\ dual isogeny g_2\n            %5 = [1/9*x^3-1/4*x^2-141/16*x+5613/64,\n             -1/18*x^4+(1/27*y-1/3)*x^3+(-1/12*y+87/16)*x^2+(49/16*y-48)*x\n             +(-3601/64*y+16947/512),x-3/4]\n            ? apply(E->ellidentify(ellinit(E))[1][1], LE)\n      ""      %6 = [\"14a1\",\"14a4\",\"14a3\",\"14a2\",\"14a6\",\"14a5\"]\n            ? M\n            %7 =\n            [1 3 3 2 6 6]\n            \n            [3 1 9 6 2 18]\n            \n            [3 9 1 6 18 2]\n            \n            [2 6 6 1 3 3]\n            \n            [6 2 18 3 1 9]\n            \n            [6 18 2 3 9 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_435ellisomat(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_p;
  long __pyx_v_fl;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisomat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_fl,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellisomat") < 0)) __PYX_ERR(10, 7128, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_p = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7128, __pyx_L3_error)
    } else {
      __pyx_v_p = ((long)0);
    }
    if (values[1]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7128, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellisomat", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7128, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellisomat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_434ellisomat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_fl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_434ellisomat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_p, long __pyx_v_fl) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellisomat", 0);

  /* "cypari/auto_gen.pxi":7175
 *             [6 18 2 3 9 1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisomat(_E, p, fl)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 7175, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7176
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisomat(_E, p, fl)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7177
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisomat(_E, p, fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisomat(__pyx_v__E, __pyx_v_p, __pyx_v_fl);

  /* "cypari/auto_gen.pxi":7178
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisomat(_E, p, fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisoncurve(E, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 7178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7128
 *         return new_gen(_ret)
 * 
 *     def ellisomat(E, long p=0, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over a number field, compute
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellisomat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7180
 *         return new_gen(_ret)
 * 
 *     def ellisoncurve(E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives 1 (i.e.true) if the point :math:`z` is on the elliptic curve :math:`E`, 0
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_437ellisoncurve(PyObject *__pyx_v_E, PyObject *__pyx_v_z); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_436ellisoncurve[] = "\n        Gives 1 (i.e.\302\240true) if the point :math:`z` is on the elliptic curve :math:`E`, 0\n        otherwise. If :math:`E` or :math:`z` have imprecise coefficients, an attempt is made to\n        take this into account, i.e.\302\240an imprecise equality is checked, not a precise\n        one. It is allowed for :math:`z` to be a vector of points in which case a vector\n        (of the same type) is returned.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_437ellisoncurve(PyObject *__pyx_v_E, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisoncurve (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_436ellisoncurve(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), ((PyObject *)__pyx_v_z));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_436ellisoncurve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellisoncurve", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":7188
 *         (of the same type) is returned.
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7189
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 7189, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7190
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellisoncurve(_E, _z)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7191
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisoncurve(_E, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7192
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellisoncurve(_E, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisoncurve(__pyx_v__E, __pyx_v__z);

  /* "cypari/auto_gen.pxi":7193
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellisoncurve(_E, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellisotree(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7180
 *         return new_gen(_ret)
 * 
 *     def ellisoncurve(E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives 1 (i.e.true) if the point :math:`z` is on the elliptic curve :math:`E`, 0
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellisoncurve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7195
 *         return new_gen(_ret)
 * 
 *     def ellisotree(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over :math:`\mathbb{Q}` or a set of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_439ellisotree(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_438ellisotree[] = "\n        Given an elliptic curve :math:`E` defined over :math:`\\mathbb{Q}` or a set of\n        :math:`\\mathbb{Q}`-isogenous curves as given by :literal:`ellisomat`, return a pair :math:`[L,M]` where\n        \n        - :math:`L` lists the minimal models of the isomorphism classes of elliptic\n          curves :math:`\\mathbb{Q}`-isogenous to :math:`E` (or in the set of isogenous curves),\n        \n        - :math:`M` is the adjacency matrix of the prime degree isogenies tree:\n          there is an edge from :math:`E_i` to :math:`E_j` if there is an isogeny :math:`E_i \\to E_j` of\n          prime degree such that the N\303\251ron differential forms are preserved.\n        \n        ::\n        \n            ? E = ellinit(\"14a1\");\n            ? [L,M] = ellisotree(E);\n            ? M\n            %3 =\n            [0 0 3 2 0 0]\n            \n            [3 0 0 0 2 0]\n            \n            [0 0 0 0 0 2]\n            \n            [0 0 0 0 0 3]\n            \n            [0 0 0 3 0 0]\n            \n            [0 0 0 0 0 0]\n            ? [L2,M2] = ellisotree(ellisomat(E,2,1));\n            %4 =\n            [0 2]\n            \n            [0 0]\n            ? [L3,M3] = ellisotree(ellisomat(E,3,1));\n            ? M3\n            %6 =\n            [0 0 3]\n            \n            [3 0 0]\n            \n            [0 0 0]\n        \n        Compare with the result of :literal:`ellisomat`.\n        \n        ::\n        \n            ? [L,M]=ellisomat(E,,1);\n            ? M\n            %7 =\n            [1 3 3 2 6 6]\n            \n            [3 1 9 6 2 18]\n            \n            [3 9 1 6 18 2]\n            \n            [2 6 6 1 3 3]\n            \n            [6 2 18 3 1 9]\n            \n            [6 18 2 3 9 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_439ellisotree(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisotree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_438ellisotree(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_438ellisotree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellisotree", 0);

  /* "cypari/auto_gen.pxi":7257
 *             [6 18 2 3 9 1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisotree(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 7257, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7258
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellisotree(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7259
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisotree(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellisotree(__pyx_v__E);

  /* "cypari/auto_gen.pxi":7260
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellisotree(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellissupersingular(E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 7260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7195
 *         return new_gen(_ret)
 * 
 *     def ellisotree(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` defined over :math:`\mathbb{Q}` or a set of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellisotree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7262
 *         return new_gen(_ret)
 * 
 *     def ellissupersingular(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return 1 if the elliptic curve :math:`E` defined over a number field, :math:`\mathbb{Q}_p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_441ellissupersingular(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_440ellissupersingular[] = "\n        Return 1 if the elliptic curve :math:`E` defined over a number field, :math:`\\mathbb{Q}_p`\n        or a finite field is supersingular at :math:`p`, and :math:`0` otherwise.\n        If the curve is defined over a number field, :math:`p` must be explicitly given,\n        and must be a prime number, resp.\302\240a maximal ideal, if the curve is defined\n        over :math:`\\mathbb{Q}`, resp.\302\240a general number field: we return :math:`1` if and only if :math:`E`\n        has supersingular good reduction at :math:`p`.\n        \n        Alternatively, :math:`E` can be given by its :math:`j`-invariant in a finite field. In\n        this case :math:`p` must be omitted.\n        \n        ::\n        \n            ? setrand(1); \\\\ make the choice of g deterministic\n            ? g = ffprimroot(ffgen(7^5))\n            %1 = 4*x^4 + 5*x^3 + 6*x^2 + 5*x + 6\n            ? [g^n | n <- [1 .. 7^5 - 1], ellissupersingular(g^n)]\n            %2 = [6]\n            \n            ? K = nfinit(y^3-2); P = idealprimedec(K, 2)[1];\n            ? E = ellinit([y,1], K);\n            ? ellissupersingular(E, P)\n            %5 = 1\n            ? Q = idealprimedec(K,5)[1];\n            ? ellissupersingular(E, Q)\n            %6 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_441ellissupersingular(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellissupersingular (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellissupersingular") < 0)) __PYX_ERR(10, 7262, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellissupersingular", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7262, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellissupersingular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_440ellissupersingular(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_440ellissupersingular(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellissupersingular", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":7290
 *             %6 = 0
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":7291
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":7292
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":7291
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7293
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 7293, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7294
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7295
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":7296
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":7297
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = ellissupersingular(_E, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7296
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)
 */
  }

  /* "cypari/auto_gen.pxi":7298
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = ellissupersingular(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_gen.pxi":7299
 *             _p = (<Gen>p).g
 *         cdef int _ret = ellissupersingular(_E, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":7300
 *         cdef int _ret = ellissupersingular(_E, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def ellj(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7262
 *         return new_gen(_ret)
 * 
 *     def ellissupersingular(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return 1 if the elliptic curve :math:`E` defined over a number field, :math:`\mathbb{Q}_p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellissupersingular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7302
 *         return _ret
 * 
 *     def ellj(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Elliptic :math:`j`-invariant. :math:`x` must be a complex number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_443ellj(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_442ellj[] = "\n        Elliptic :math:`j`-invariant. :math:`x` must be a complex number\n        with positive imaginary part, or convertible into a power series or a\n        :math:`p`-adic number with positive valuation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_443ellj(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellj") < 0)) __PYX_ERR(10, 7302, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7302, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellj", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7302, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_442ellj(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_442ellj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellj", 0);

  /* "cypari/auto_gen.pxi":7308
 *         :math:`p`-adic number with positive valuation.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 7308, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7309
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jell(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7310
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jell(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":7311
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jell(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jell(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":7312
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jell(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elllocalred(E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 7312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7302
 *         return _ret
 * 
 *     def ellj(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Elliptic :math:`j`-invariant. :math:`x` must be a complex number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7314
 *         return new_gen(_ret)
 * 
 *     def elllocalred(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Calculates the Kodaira type of the local fiber of the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_445elllocalred(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_444elllocalred[] = "\n        Calculates the Kodaira type of the local fiber of the elliptic curve\n        :math:`E` at :math:`p`. :math:`E` must be an :literal:`ell` structure as output by\n        :literal:`ellinit`, over :math:`\\mathbb{Q}_\\ell` (:math:`p` better left omitted, else equal to :math:`\\ell`)\n        over :math:`\\mathbb{Q}` (:math:`p` a rational prime) or a number field :math:`K` (:math:`p`\n        a maximal ideal given by a :literal:`prid` structure).\n        The result is a 4-component vector :math:`[f,kod,v,c]`. Here :math:`f` is the exponent of\n        :math:`p` in the arithmetic conductor of :math:`E`, and :math:`kod` is the Kodaira type which\n        is coded as follows:\n        \n        1 means good reduction (type I:math:`_0`), 2, 3 and 4 mean types II, III and IV\n        respectively, :math:`4+\\nu` with :math:`\\nu > 0` means type I:math:`_\\nu`;\n        finally the opposite values :math:`-1`, :math:`-2`, etc.\302\240refer to the starred types\n        I:math:`_0^*`, II:math:`^*`, etc. The third component :math:`v` is itself a vector :math:`[u,r,s,t]`\n        giving the coordinate changes done during the local reduction;\n        :math:`u = 1` if and only if the given equation was already minimal at :math:`p`.\n        Finally, the last component :math:`c` is the local Tamagawa number :math:`c_p`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_445elllocalred(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elllocalred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elllocalred") < 0)) __PYX_ERR(10, 7314, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elllocalred", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7314, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elllocalred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_444elllocalred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_444elllocalred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("elllocalred", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":7333
 *         Finally, the last component :math:`c` is the local Tamagawa number :math:`c_p`.
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":7334
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":7335
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7335, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":7334
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7336
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 7336, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7337
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7338
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":7339
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":7340
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elllocalred(_E, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7339
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)
 */
  }

  /* "cypari/auto_gen.pxi":7341
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elllocalred(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_gen.pxi":7342
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = elllocalred(_E, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elllog(E, P, G, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7314
 *         return new_gen(_ret)
 * 
 *     def elllocalred(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Calculates the Kodaira type of the local fiber of the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elllocalred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7344
 *         return new_gen(_ret)
 * 
 *     def elllog(E, P, G, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two points :math:`P` and :math:`G` on the elliptic curve :math:`E/\mathbb{F}_q`, returns the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_447elllog(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_446elllog[] = "\n        Given two points :math:`P` and :math:`G` on the elliptic curve :math:`E/\\mathbb{F}_q`, returns the\n        discrete logarithm of :math:`P` in base :math:`G`, i.e. the smallest non-negative\n        integer :math:`n` such that :math:`P = [n]G`.\n        See :literal:`znlog` for the limitations of the underlying discrete log algorithms.\n        If present, :math:`o` represents the order of :math:`G`, see ``DLfun`` (in the PARI manual);\n        the preferred format for this parameter is :literal:`[N, factor(N)]`, where :math:`N`\n        is the order of :math:`G`.\n        \n        If no :math:`o` is given, assume that :math:`G` generates the curve.\n        The function also assumes that :math:`P` is a multiple of :math:`G`.\n        \n        ::\n        \n            ? a = ffgen(ffinit(2,8),'a);\n            ? E = ellinit([a,1,0,0,1]); \\\\ over F_{2^8}\n            ? x = a^3; y = ellordinate(E,x)[1];\n            ? P = [x,y]; G = ellmul(E, P, 113);\n            ? ord = [242, factor(242)]; \\\\ P generates a group of order 242. Initialize.\n            ? ellorder(E, G, ord)\n            %4 = 242\n            ? e = elllog(E, P, G, ord)\n            %5 = 15\n            ? ellmul(E,G,e) == P\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_447elllog(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elllog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_G,&__pyx_n_s_o,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_G)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elllog", 0, 2, 3, 1); __PYX_ERR(10, 7344, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elllog") < 0)) __PYX_ERR(10, 7344, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_G = values[1];
    __pyx_v_o = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elllog", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7344, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elllog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_446elllog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_P, __pyx_v_G, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_446elllog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_G, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__G;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("elllog", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_G);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_gen.pxi":7371
 *             %6 = 1
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7372
 *         '''
 *         P = objtogen(P)
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7373
 *         P = objtogen(P)
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7374
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7375
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7375, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":7374
 *         G = objtogen(G)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7376
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 7376, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7377
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7378
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7379
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7380
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_gen.pxi":7381
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7382
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7381
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 */
  }

  /* "cypari/auto_gen.pxi":7383
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elllog(__pyx_v__E, __pyx_v__P, __pyx_v__G, __pyx_v__o);

  /* "cypari/auto_gen.pxi":7384
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = elllog(_E, _P, _G, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elllseries(E, s, A=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7344
 *         return new_gen(_ret)
 * 
 *     def elllog(E, P, G, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two points :math:`P` and :math:`G` on the elliptic curve :math:`E/\mathbb{F}_q`, returns the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elllog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7386
 *         return new_gen(_ret)
 * 
 *     def elllseries(E, s, A=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`lfun(E,s)` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_449elllseries(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_448elllseries[] = "\n        This function is deprecated, use :literal:`lfun(E,s)` instead.\n        \n        :math:`E` being an elliptic curve, given by an arbitrary model over :math:`\\mathbb{Q}` as output\n        by :literal:`ellinit`, this function computes the value of the :math:`L`-series of :math:`E` at\n        the (complex) point :math:`s`. This function uses an :math:`O(N^{1/2})` algorithm, where\n        :math:`N` is the conductor.\n        \n        The optional parameter :math:`A` fixes a cutoff point for the integral and is best\n        left omitted; the result must be independent of :math:`A`, up to\n        :literal:`realprecision`, so this allows to check the function's accuracy.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_449elllseries(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_A = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elllseries (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_A,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elllseries") < 0)) __PYX_ERR(10, 7386, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_A = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7386, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elllseries", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7386, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elllseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_448elllseries(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_s, __pyx_v_A, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_448elllseries(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_s, PyObject *__pyx_v_A, long __pyx_v_precision) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_A;
  GEN __pyx_v__E;
  GEN __pyx_v__s;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("elllseries", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_gen.pxi":7399
 *         :literal:`realprecision`, so this allows to check the function's accuracy.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)
 *         s = objtogen(s)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7399, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":7400
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":7401
 *         from warnings import warn
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":7402
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)             # <<<<<<<<<<<<<<
 *         if _have_A:
 *             A = objtogen(A)
 */
  __pyx_t_3 = (__pyx_v_A != Py_None);
  __pyx_v__have_A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7403
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             A = objtogen(A)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_A != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":7404
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:
 *             A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7404, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":7403
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             A = objtogen(A)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7405
 *         if _have_A:
 *             A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 7405, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7406
 *             A = objtogen(A)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":7407
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = NULL
 *         if _have_A:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_5;

  /* "cypari/auto_gen.pxi":7408
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL             # <<<<<<<<<<<<<<
 *         if _have_A:
 *             _A = (<Gen>A).g
 */
  __pyx_v__A = NULL;

  /* "cypari/auto_gen.pxi":7409
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = (__pyx_v__have_A != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":7410
 *         cdef GEN _A = NULL
 *         if _have_A:
 *             _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
    __pyx_v__A = __pyx_t_5;

    /* "cypari/auto_gen.pxi":7409
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _A = NULL
 *         if _have_A:             # <<<<<<<<<<<<<<
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":7411
 *         if _have_A:
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":7412
 *             _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elllseries(__pyx_v__E, __pyx_v__s, __pyx_v__A, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":7413
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = elllseries(_E, _s, _A, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellminimaldisc(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 7413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7386
 *         return new_gen(_ret)
 * 
 *     def elllseries(E, s, A=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`lfun(E,s)` instead.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elllseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7415
 *         return new_gen(_ret)
 * 
 *     def ellminimaldisc(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over a number field output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_451ellminimaldisc(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_450ellminimaldisc[] = "\n        :math:`E` being an elliptic curve defined over a number field output by\n        :literal:`ellinit`, return the minimal discriminant ideal of E.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_451ellminimaldisc(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellminimaldisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_450ellminimaldisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_450ellminimaldisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellminimaldisc", 0);

  /* "cypari/auto_gen.pxi":7420
 *         :literal:`ellinit`, return the minimal discriminant ideal of E.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaldisc(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 7420, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7421
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellminimaldisc(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7422
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaldisc(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellminimaldisc(__pyx_v__E);

  /* "cypari/auto_gen.pxi":7423
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaldisc(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellminimaltwist(E, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 7423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7415
 *         return new_gen(_ret)
 * 
 *     def ellminimaldisc(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over a number field output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellminimaldisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7425
 *         return new_gen(_ret)
 * 
 *     def ellminimaltwist(E, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve defined over :math:`\mathbb{Q}`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_453ellminimaltwist(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_452ellminimaltwist[] = "\n        Let :math:`E` be an elliptic curve defined over :math:`\\mathbb{Q}`, return\n        a discriminant :math:`D` such that the twist of :math:`E` by :math:`D` is minimal among all\n        possible quadratic twists, i.e. if :math:`flag = 0`, its minimal model has minimal\n        discriminant, or if :math:`flag = 1`, it has minimal conductor.\n        \n        In the example below, we find a curve with :math:`j`-invariant :math:`3` and minimal\n        conductor.\n        \n        ::\n        \n            ? E = ellminimalmodel(ellinit(ellfromj(3)));\n            ? ellglobalred(E)[1]\n            %2 = 357075\n            ? D = ellminimaltwist(E,1)\n            %3 = -15\n            ? E2 = ellminimalmodel(ellinit(elltwist(E,D)));\n            ? ellglobalred(E2)[1]\n            %5 = 14283\n        \n        In the example below, :math:`flag = 0` and :math:`flag = 1` give different results.\n        \n        ::\n        \n            ? E = ellinit([1,0]);\n            ? D0 = ellminimaltwist(E,0)\n            %7 = 1\n            ? D1 = ellminimaltwist(E,1)\n            %8 = 8\n            ? E0 = ellminimalmodel(ellinit(elltwist(E,D0)));\n            ? [E0.disc, ellglobalred(E0)[1]]\n            %10 = [-64, 64]\n            ? E1 = ellminimalmodel(ellinit(elltwist(E,D1)));\n            ? [E1.disc, ellglobalred(E1)[1]]\n            %12 = [-4096, 32]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_453ellminimaltwist(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellminimaltwist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellminimaltwist") < 0)) __PYX_ERR(10, 7425, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7425, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellminimaltwist", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7425, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellminimaltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_452ellminimaltwist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_452ellminimaltwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_flag) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellminimaltwist", 0);

  /* "cypari/auto_gen.pxi":7462
 *             %12 = [-4096, 32]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 7462, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7463
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7464
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellminimaltwist0(__pyx_v__E, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":7465
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellminimaltwist0(_E, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellmoddegree(e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 7465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7425
 *         return new_gen(_ret)
 * 
 *     def ellminimaltwist(E, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an elliptic curve defined over :math:`\mathbb{Q}`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellminimaltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7467
 *         return new_gen(_ret)
 * 
 *     def ellmoddegree(e):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`e` being an elliptic curve defined over :math:`\mathbb{Q}` output by :literal:`ellinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_455ellmoddegree(PyObject *__pyx_v_e, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_454ellmoddegree[] = "\n        :math:`e` being an elliptic curve defined over :math:`\\mathbb{Q}` output by :literal:`ellinit`,\n        compute the modular degree of :math:`e` divided by the square of\n        the Manin constant :math:`c`. It is conjectured that :math:`c = 1` for the strong Weil\n        curve in the isogeny class (optimal quotient of :math:`J_0(N)`) and this can be\n        proven using :literal:`ellweilcurve` when the conductor :math:`N` is moderate.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); \\\\ from Cremona table: strong Weil curve and c = 1\n            ? [v,smith] = ellweilcurve(E); smith \\\\ proof of the above\n            %2 = [[1, 1], [5, 1], [1, 1/5]]\n            ? ellmoddegree(E)\n            %3 = 1\n            ? [ellidentify(e)[1][1] | e<-v]\n            %4 = [\"11a1\", \"11a2\", \"11a3\"]\n            ? ellmoddegree(ellinit(\"11a2\"))\n            %5 = 5\n            ? ellmoddegree(ellinit(\"11a3\"))\n            %6 = 1/5\n        \n        The modular degree of :literal:`11a1` is :math:`1` (because\n        :literal:`ellweilcurve` or Cremona's table prove that the Manin constant\n        is :math:`1` for this curve); the output of :literal:`ellweilcurve` also proves\n        that the Manin constants of :literal:`11a2` and :literal:`11a3` are 1 and 5\n        respectively, so the actual modular degree of both :literal:`11a2` and :literal:`11a3`\n        is 5.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_455ellmoddegree(PyObject *__pyx_v_e, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellmoddegree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_454ellmoddegree(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_e));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_454ellmoddegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_e) {
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellmoddegree", 0);

  /* "cypari/auto_gen.pxi":7496
 *         is 5.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _e = (<Gen>e).g
 *         cdef GEN _ret = ellmoddegree(_e)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 7496, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7497
 *         '''
 *         sig_on()
 *         cdef GEN _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellmoddegree(_e)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
  __pyx_v__e = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7498
 *         sig_on()
 *         cdef GEN _e = (<Gen>e).g
 *         cdef GEN _ret = ellmoddegree(_e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellmoddegree(__pyx_v__e);

  /* "cypari/auto_gen.pxi":7499
 *         cdef GEN _e = (<Gen>e).g
 *         cdef GEN _ret = ellmoddegree(_e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellmul(E, z, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 7499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7467
 *         return new_gen(_ret)
 * 
 *     def ellmoddegree(e):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`e` being an elliptic curve defined over :math:`\mathbb{Q}` output by :literal:`ellinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellmoddegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7501
 *         return new_gen(_ret)
 * 
 *     def ellmul(E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes :math:`[n]z`, where :math:`z` is a point on the elliptic curve :math:`E`. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_457ellmul(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_456ellmul[] = "\n        Computes :math:`[n]z`, where :math:`z` is a point on the elliptic curve :math:`E`. The\n        exponent :math:`n` is in :math:`\\mathbb{Z}`, or may be a complex quadratic integer if the curve :math:`E`\n        has complex multiplication by :math:`n` (if not, an error message is issued).\n        \n        ::\n        \n            ? Ei = ellinit([1,0]); z = [0,0];\n            ? ellmul(Ei, z, 10)\n            %2 = [0] \\\\ unsurprising: z has order 2\n            ? ellmul(Ei, z, I)\n            %3 = [0, 0] \\\\ Ei has complex multiplication by Z[i]\n            ? ellmul(Ei, z, quadgen(-4))\n            %4 = [0, 0] \\\\ an alternative syntax for the same query\n            ? Ej = ellinit([0,1]); z = [-1,0];\n            ? ellmul(Ej, z, I)\n             *** at top-level: ellmul(Ej,z,I)\n             *** ^--------------\n             *** ellmul: not a complex multiplication in ellmul.\n            ? ellmul(Ej, z, 1+quadgen(-3))\n            %6 = [1 - w, 0]\n        \n        The simple-minded algorithm for the CM case assumes that we are in\n        characteristic :math:`0`, and that the quadratic order to which :math:`n` belongs has\n        small discriminant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_457ellmul(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_n,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_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellmul", 1, 2, 2, 1); __PYX_ERR(10, 7501, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellmul") < 0)) __PYX_ERR(10, 7501, __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_z = values[0];
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7501, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_456ellmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_z, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_456ellmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellmul", 0);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_gen.pxi":7528
 *         small discriminant.
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7529
 *         '''
 *         z = objtogen(z)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7529, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7530
 *         z = objtogen(z)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 7530, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7531
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7532
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7533
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7534
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellmul(__pyx_v__E, __pyx_v__z, __pyx_v__n);

  /* "cypari/auto_gen.pxi":7535
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellneg(E, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7501
 *         return new_gen(_ret)
 * 
 *     def ellmul(E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes :math:`[n]z`, where :math:`z` is a point on the elliptic curve :math:`E`. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7537
 *         return new_gen(_ret)
 * 
 *     def ellneg(E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Opposite of the point :math:`z` on elliptic curve :math:`E`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_459ellneg(PyObject *__pyx_v_E, PyObject *__pyx_v_z); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_458ellneg[] = "\n        Opposite of the point :math:`z` on elliptic curve :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_459ellneg(PyObject *__pyx_v_E, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellneg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_458ellneg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), ((PyObject *)__pyx_v_z));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_458ellneg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellneg", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":7541
 *         Opposite of the point :math:`z` on elliptic curve :math:`E`.
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7542
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 7542, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7543
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellneg(_E, _z)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7544
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellneg(_E, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7545
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellneg(_E, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellneg(__pyx_v__E, __pyx_v__z);

  /* "cypari/auto_gen.pxi":7546
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = ellneg(_E, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellnonsingularmultiple(E, P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7546, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7537
 *         return new_gen(_ret)
 * 
 *     def ellneg(E, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Opposite of the point :math:`z` on elliptic curve :math:`E`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellneg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7548
 *         return new_gen(_ret)
 * 
 *     def ellnonsingularmultiple(E, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E/\mathbb{Q}` (more precisely, a model defined over :math:`\mathbb{Q}`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_461ellnonsingularmultiple(PyObject *__pyx_v_E, PyObject *__pyx_v_P); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_460ellnonsingularmultiple[] = "\n        Given an elliptic curve :math:`E/\\mathbb{Q}` (more precisely, a model defined over :math:`\\mathbb{Q}`\n        of a curve) and a rational point :math:`P \\in E(\\mathbb{Q})`, returns the pair :math:`[R,n]`,\n        where :math:`n` is the least positive integer such that :math:`R := [n]P` has good\n        reduction at every prime. More precisely, its image in a minimal model is\n        everywhere non-singular.\n        \n        ::\n        \n            ? e = ellinit(\"57a1\"); P = [2,-2];\n            ? ellnonsingularmultiple(e, P)\n            %2 = [[1, -1], 2]\n            ? e = ellinit(\"396b2\"); P = [35, -198];\n            ? [R,n] = ellnonsingularmultiple(e, P);\n            ? n\n            %5 = 12\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_461ellnonsingularmultiple(PyObject *__pyx_v_E, PyObject *__pyx_v_P) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellnonsingularmultiple (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_460ellnonsingularmultiple(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), ((PyObject *)__pyx_v_P));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_460ellnonsingularmultiple(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellnonsingularmultiple", 0);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_gen.pxi":7566
 *             %5 = 12
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7567
 *         '''
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 7567, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7568
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7569
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7570
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellnonsingularmultiple(__pyx_v__E, __pyx_v__P);

  /* "cypari/auto_gen.pxi":7571
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellnonsingularmultiple(_E, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellorder(E, z, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7548
 *         return new_gen(_ret)
 * 
 *     def ellnonsingularmultiple(E, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E/\mathbb{Q}` (more precisely, a model defined over :math:`\mathbb{Q}`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellnonsingularmultiple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7573
 *         return new_gen(_ret)
 * 
 *     def ellorder(E, z, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the order of the point :math:`z` on the elliptic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_463ellorder(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_462ellorder[] = "\n        Gives the order of the point :math:`z` on the elliptic\n        curve :math:`E`, defined over a finite field or a number field.\n        Return (the impossible value) zero if the point has infinite order.\n        \n        ::\n        \n            ? E = ellinit([-157^2,0]); \\\\ the \"157-is-congruent\" curve\n            ? P = [2,2]; ellorder(E, P)\n            %2 = 2\n            ? P = ellheegner(E); ellorder(E, P) \\\\ infinite order\n            %3 = 0\n            ? K = nfinit(polcyclo(11,t)); E=ellinit(\"11a3\", K); T = elltors(E);\n            ? ellorder(E, T.gen[1])\n            %5 = 25\n            ? E = ellinit(ellfromj(ffgen(5^10)));\n            ? ellcard(E)\n            %7 = 9762580\n            ? P = random(E); ellorder(E, P)\n            %8 = 4881290\n            ? p = 2^160+7; E = ellinit([1,2], p);\n            ? N = ellcard(E)\n            %9 = 1461501637330902918203686560289225285992592471152\n            ? o = [N, factor(N)];\n            ? for(i=1,100, ellorder(E,random(E)))\n            time = 260 ms.\n        \n        The parameter :math:`o`, is now mostly useless, and kept for backward\n        compatibility. If present, it represents a non-zero multiple of the order\n        of :math:`z`, see ``DLfun`` (in the PARI manual); the preferred format for this parameter is\n        :literal:`[ord, factor(ord)]`, where :literal:`ord` is the cardinality of the curve.\n        It is no longer needed since PARI is now able to compute it over large\n        finite fields (was restricted to small prime fields at the time this feature\n        was introduced), :emphasis:`and` caches the result in :math:`E` so that it is computed\n        and factored only once. Modifying the last example, we see that including\n        this extra parameter provides no improvement:\n        \n        ::\n        \n            ? o = [N, factor(N)];\n            ? for(i=1,100, ellorder(E,random(E),o))\n            time = 260 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_463ellorder(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellorder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_o,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellorder") < 0)) __PYX_ERR(10, 7573, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    __pyx_v_o = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellorder", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7573, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_462ellorder(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_z, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_462ellorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellorder", 0);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_gen.pxi":7617
 *             time = 260 ms.
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7618
 *         '''
 *         z = objtogen(z)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7619
 *         z = objtogen(z)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7620
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7620, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":7619
 *         z = objtogen(z)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7621
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 7621, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7622
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7623
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7624
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_gen.pxi":7625
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7626
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7625
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 */
  }

  /* "cypari/auto_gen.pxi":7627
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellorder(__pyx_v__E, __pyx_v__z, __pyx_v__o);

  /* "cypari/auto_gen.pxi":7628
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = ellorder(_E, _z, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellordinate(E, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7573
 *         return new_gen(_ret)
 * 
 *     def ellorder(E, z, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the order of the point :math:`z` on the elliptic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7630
 *         return new_gen(_ret)
 * 
 *     def ellordinate(E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a 0, 1 or 2-component vector containing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_465ellordinate(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_464ellordinate[] = "\n        Gives a 0, 1 or 2-component vector containing\n        the :math:`y`-coordinates of the points of the curve :math:`E` having :math:`x` as\n        :math:`x`-coordinate.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_465ellordinate(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellordinate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellordinate") < 0)) __PYX_ERR(10, 7630, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7630, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellordinate", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7630, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellordinate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_464ellordinate(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_464ellordinate(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellordinate", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":7636
 *         :math:`x`-coordinate.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7636, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7637
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 7637, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7638
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7639
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellordinate(_E, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":7640
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellordinate(_E, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":7641
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellordinate(_E, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellordinate(__pyx_v__E, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":7642
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellordinate(_E, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicL(E, p, long n, s=None, long r=0, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7642, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7630
 *         return new_gen(_ret)
 * 
 *     def ellordinate(E, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a 0, 1 or 2-component vector containing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellordinate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7644
 *         return new_gen(_ret)
 * 
 *     def ellpadicL(E, p, long n, s=None, long r=0, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative) on a character :math:`\chi^s` of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_467ellpadicL(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_466ellpadicL[] = "\n        Returns the value (or :math:`r`-th derivative) on a character :math:`\\chi^s` of\n        :math:`\\mathbb{Z}_p^*` of the :math:`p`-adic :math:`L`-function of the elliptic curve :math:`E/\\mathbb{Q}`, twisted by\n        :math:`D`, given modulo :math:`p^n`.\n        \n        :strong:`Characters.` The set of continuous characters of\n        :math:`Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})` is identified to :math:`\\mathbb{Z}_p^*` via the\n        cyclotomic character :math:`\\chi` with values in :math:`\\overline{\\mathbb{Q}_p}^*`. Denote by\n        :math:`\\tau:\\mathbb{Z}_p^*\\to\\mathbb{Z}_p^*` the Teichm\303\274ller character, with values\n        in the :math:`(p-1)`-th roots of :math:`1` for :math:`p != 2`, and :math:`{-1,1}` for :math:`p = 2`;\n        finally, let\n        :math:`<\\chi>= \\chi \\tau^{-1}`, with values in :math:`1 + 2p\\mathbb{Z}_p`.\n        In GP, the continuous character of\n        :math:`Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})` given by :math:`<\\chi>^{s_1}\n        \\tau^{s_2}` is represented by the pair of integers :math:`s = (s_1,s_2)`, with :math:`s_1\n        \\in \\mathbb{Z}_p` and :math:`s_2 mod p-1` for :math:`p > 2`, (resp. mod :math:`2` for :math:`p = 2`); :math:`s`\n        may be also an integer, representing :math:`(s,s)` or :math:`\\chi^s`.\n        \n        :strong:`The :math:`p`-adic :math:`L` function.`\n        The :math:`p`-adic :math:`L` function :math:`L_p` is defined on the set of continuous\n        characters of :math:`Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})`, as :math:`\\int_{\\mathbb{Z}_p^*}\n        \\chi^s d \\mu` for a certain :math:`p`-adic distribution :math:`\\mu` on :math:`\\mathbb{Z}_p^*`. The\n        derivative is given by\n        \n        .. MATH::\n        \n            L_p^{(r)}(E, \\chi^s) = \\int_{\\mathbb{Z}_p^*} \\log_p^r(a) \\chi^s(a) d\\mu (a).\n        \n        More precisely:\n        \n        - When :math:`E` has good supersingular reduction, :math:`L_""p` takes its\n          values in :math:`D := H^1_{dR}(E/\\mathbb{Q})\\otimes_\\mathbb{Q} \\mathbb{Q}_p` and satisfies\n          \n        \n        .. MATH::\n        \n            (1-p^{-1} F)^{-2} L_p(E, \\chi^0) = (L(E,1) / \\Omega).\\omega\n        \n          where :math:`F` is the Frobenius, :math:`L(E,1)` is the value of the complex :math:`L`\n          function at :math:`1`, :math:`\\omega` is the N\303\251ron differential\n          and :math:`\\Omega` the attached period on :math:`E(\\mathbb{R})`. Here, :math:`\\chi^0` represents\n          the trivial character.\n        \n        The function returns the components of :math:`L_p^{(r)}(E,\\chi^s)` in\n        the basis :math:`(\\omega, F \\omega)`.\n        \n        - When :math:`E` has ordinary good reduction, this method only defines\n          the projection of :math:`L_p(E,\\chi^s)` on the :math:`\\alpha`-eigenspace,\n          where :math:`\\alpha` is the unit eigenvalue for :math:`F`. This is what the function\n          returns. We have\n          \n        \n        .. MATH::\n        \n            (1- \\alpha^{-1})^{-2} L_{p,\\alpha}(E,\\chi^0) = L(E,1) / \\Omega.\n        \n        Two supersingular examples:\n        \n        ::\n        \n            ? cxL(e) = bestappr( ellL1(e) / e.omega[1] );\n            \n            ? e = ellinit(\"17a1\"); p=3; \\\\ supersingular, a3 = 0\n            ? L = ellpadicL(e,p,4);\n            ? F = [0,-p;1,ellap(e,p)]; \\\\ Frobenius matrix in the basis (omega,F(omega))\n            ? (1-p^(-1)*F)^-2 * L / cxL(e)\n            %5 = [1 + O(3^5), O(3^5)]~ \\\\ [1,0]~\n            \n            ? e = ellinit(\"116a1\"); p=3; \\\\ supersingular, a3 != 0~\n            ? L = ellpadicL(e,p,4);\n            ? F = [0,-p; 1,ellap(e,p)];\n            ? (1-p^(-1)*F)^-2*L~ / cxL(e)\n            %9 = [1 + O(3^4), O(3^5)]~\n        \n        Good ordinary reduction:\n        \n        ::\n        \n            ? e = ellinit(\"17a1\"); p=5; ap = ellap(e,p)\n            %1"" = -2 \\\\ ordinary\n            ? L = ellpadicL(e,p,4)\n            %2 = 4 + 3*5 + 4*5^2 + 2*5^3 + O(5^4)\n            ? al = padicappr(x^2 - ap*x + p, ap + O(p^7))[1];\n            ? (1-al^(-1))^(-2) * L / cxL(e)\n            %4 = 1 + O(5^4)\n        \n        Twist and Teichm\303\274ller:\n        \n        ::\n        \n            ? e = ellinit(\"17a1\"); p=5; \\\\ ordinary\n            \\\\ 2nd derivative at tau^1, twist by -7\n            ? ellpadicL(e, p, 4, [0,1], 2, -7)\n            %2 = 2*5^2 + 5^3 + O(5^4)\n        \n        We give an example of non split multiplicative reduction (see\n        :literal:`ellpadicbsd` for more examples).\n        \n        ::\n        \n            ? e=ellinit(\"15a1\"); p=3; n=5;\n            ? L = ellpadicL(e,p,n)\n            %2 = 2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)\n            ? (1 - ellap(e,p))^(-1) * L / cxL(e)\n            %3 = 1 + O(3^5)\n        \n        This function is a special case of :literal:`mspadicL` and it also appears\n        as the first term of :literal:`mspadicseries`:\n        \n        ::\n        \n            ? e = ellinit(\"17a1\"); p=5;\n            ? L = ellpadicL(e,p,4)\n            %2 = 4 + 3*5 + 4*5^2 + 2*5^3 + O(5^4)\n            ? [M,phi] = msfromell(e, 1);\n            ? Mp = mspadicinit(M, p, 4);\n            ? mu = mspadicmoments(Mp, phi);\n            ? mspadicL(mu)\n            %6 = 4 + 3*5 + 4*5^2 + 2*5^3 + 2*5^4 + 5^5 + O(5^6)\n            ? mspadicseries(mu)\n            %7 = (4 + 3*5 + 4*5^2 + 2*5^3 + 2*5^4 + 5^5 + O(5^6))\n             + (3 + 3*5 + 5^2 + 5^3 + O(5^4))*x\n             + (2 + 3*5 + 5^2 + O(5^3))*x^2\n             + (3 + 4*5 + 4*5^2 + O(5^3))*x^3\n             + (3 + 2*5 + O(5^2))*x^4 + O(x^5)\n        \n        These are more cumbersome than :literal:`ellpadicL` but allow to\n        compute at different characters, or successive derivatives, or to\n        twist by a quadratic character essentially for the cost of a single call to\n        :literal:`ellpadicL` du""e to precomputations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_467ellpadicL(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_s = 0;
  long __pyx_v_r;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicL (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_s,&__pyx_n_s_r,&__pyx_n_s_D,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[4] = ((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  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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicL", 0, 2, 5, 1); __PYX_ERR(10, 7644, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          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_r);
          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_D);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicL") < 0)) __PYX_ERR(10, 7644, __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_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7644, __pyx_L3_error)
    __pyx_v_s = values[2];
    if (values[3]) {
      __pyx_v_r = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7644, __pyx_L3_error)
    } else {
      __pyx_v_r = ((long)0);
    }
    __pyx_v_D = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicL", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7644, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_466ellpadicL(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n, __pyx_v_s, __pyx_v_r, __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_466ellpadicL(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_s, long __pyx_v_r, PyObject *__pyx_v_D) {
  int __pyx_v__have_s;
  int __pyx_v__have_D;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__s;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpadicL", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":7776
 *         :literal:`ellpadicL` due to precomputations.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7777
 *         '''
 *         p = objtogen(p)
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_2 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7778
 *         p = objtogen(p)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7779
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7779, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":7778
 *         p = objtogen(p)
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 */
  }

  /* "cypari/auto_gen.pxi":7780
 *         if _have_s:
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7781
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7782
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":7781
 *             s = objtogen(s)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7783
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 7783, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7784
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7785
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7786
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_gen.pxi":7787
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_2 = (__pyx_v__have_s != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7788
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7787
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 */
  }

  /* "cypari/auto_gen.pxi":7789
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":7790
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7791
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7790
 *             _s = (<Gen>s).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 */
  }

  /* "cypari/auto_gen.pxi":7792
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicL(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__s, __pyx_v_r, __pyx_v__D);

  /* "cypari/auto_gen.pxi":7793
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicL(_E, _p, n, _s, r, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicbsd(E, p, long n, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7644
 *         return new_gen(_ret)
 * 
 *     def ellpadicL(E, p, long n, s=None, long r=0, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative) on a character :math:`\chi^s` of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7795
 *         return new_gen(_ret)
 * 
 *     def ellpadicbsd(E, p, long n, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` over :math:`\mathbb{Q}`, its quadratic twist :math:`E_D`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_469ellpadicbsd(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_468ellpadicbsd[] = "\n        Given an elliptic curve :math:`E` over :math:`\\mathbb{Q}`, its quadratic twist :math:`E_D`\n        and a prime number :math:`p`, this function is a :math:`p`-adic analog of the complex\n        functions :literal:`ellanalyticrank` and :literal:`ellbsd`. It calls :literal:`ellpadicL`\n        with initial accuracy :math:`p^n` and may increase it internally;\n        it returns a vector :math:`[r, L_p]` where\n        \n        - :math:`L_p` is a :math:`p`-adic number (resp. a pair of :math:`p`-adic numbers if\n          :math:`E` has good supersingular reduction) defined modulo :math:`p^N`, conjecturally\n          equal to :math:`R_p S`, where :math:`R_p` is the :math:`p`-adic regulator as given by\n          :literal:`ellpadicregulator` (in the basis :math:`(\\omega, F \\omega)`) and :math:`S` is the\n          cardinal of the Tate-Shafarevich group for the quadratic twist :math:`E_D`.\n        \n        - :math:`r` is an upper bound for the analytic rank of the :math:`p`-adic\n          :math:`L`-function attached to :math:`E_D`: we know for sure that the :math:`i`-th\n          derivative of :math:`L_p(E_D,.)` at :math:`\\chi^0` is :math:`O(p^N)` for all :math:`i < r`\n          and that its :math:`r`-th derivative is non-zero; it is expected that the true\n          analytic rank is equal to the rank of the Mordell-Weil group :math:`E_D(\\mathbb{Q})`,\n          plus :math:`1` if the reduction of :math:`E_D` at :math:`p` is split multiplicative;\n          if :math:`r = 0`, then both the analytic rank and the Mordell-Weil rank are\n          unconditionnally :math:`0`.\n        \n        Recall that the :math:`p`-adic BSD conjecture (Mazur, Tate, Teitelbaum, Bernardi,\n        Perrin-Riou) predicts an explicit link between :math:`R_p S` and\n        \n        .. MATH::\n        \n            (1-p^{-1} F)^{-2}.L_p^{(r)}(E_D, \\chi^0) / r!\n        \n        where :math:`r` is the analytic rank of the :math:`p`-adic :math:`L`-function attached to\n    ""    :math:`E_D` and :math:`F` is the Frobenius on :math:`H^1_{dR}`; see :literal:`ellpadicL`\n        for definitions.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\"); p = 7; n = 5; \\\\ good ordinary\n            ? ellpadicbsd(E, 7, 5) \\\\ rank 0,\n            %2 = [0, 1 + O(7^5)]\n            \n            ? E = ellinit(\"91a1\"); p = 7; n = 5; \\\\ non split multiplicative\n            ? [r,Lp] = ellpadicbsd(E, p, n)\n            %5 = [1, 2*7 + 6*7^2 + 3*7^3 + 7^4 + O(7^5)]\n            ? R = ellpadicregulator(E, p, n, E.gen)\n            %6 = 2*7 + 6*7^2 + 3*7^3 + 7^4 + 5*7^5 + O(7^6)\n            ? sha = Lp/R\n            %7 = 1 + O(7^4)\n            \n            ? E = ellinit(\"91b1\"); p = 7; n = 5; \\\\ split multiplicative\n            ? [r,Lp] = ellpadicbsd(E, p, n)\n            %9 = [2, 2*7 + 7^2 + 5*7^3 + O(7^4)]\n            ? ellpadicregulator(E, p, n, E.gen)\n            %10 = 2*7 + 7^2 + 5*7^3 + 6*7^4 + 2*7^5 + O(7^6)\n            ? [rC, LC] = ellanalyticrank(E);\n            ? [r, rC]\n            %12 = [2, 1] \\\\ r = rC+1 because of split multiplicative reduction\n            \n            ? E = ellinit(\"53a1\"); p = 5; n = 5; \\\\ supersingular\n            ? [r, Lp] = ellpadicbsd(E, p, n);\n            ? r\n            %15 = 1\n            ? Lp\n            %16 = [3*5 + 2*5^2 + 2*5^5 + O(5^6), \\\n             5 + 3*5^2 + 4*5^3 + 2*5^4 + 5^5 + O(5^6)]\n            ? R = ellpadicregulator(E, p, n, E.gen)\n            %17 = [3*5 + 2*5^2 + 2*5^5 + O(5^6), 5 + 3*5^2 + 4*5^3 + 2*5^4 + O(5^5)]\n            \\\\ expect Lp = R*#Sha, hence (conjecturally) #Sha = 1\n            \n            ? E = ellinit(\"84a1\"); p = 11; n = 6; D = -443;\n            ? [r,Lp] = ellpadicbsd(E, 11, 6, D) \\\\ Mordell-Weil rank 0, no regulator\n            %19 = [0, 3 + 2*11 + O(11^6)]\n            ? lift(Lp) \\\\ expected cardinal for Sha is 5^2\n            %20 = 25\n            ? ellpadicbsd(E, 3, 12, D) \\\\ at 3\n            %21 = [1, 1 + 2*3 ""+ 2*3^2 + O(3^8)]\n            ? ellpadicbsd(E, 7, 8, D) \\\\ and at 7\n            %22 = [0, 4 + 3*7 + O(7^8)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_469ellpadicbsd(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicbsd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_D,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicbsd", 0, 2, 3, 1); __PYX_ERR(10, 7795, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicbsd") < 0)) __PYX_ERR(10, 7795, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7795, __pyx_L3_error)
    __pyx_v_D = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicbsd", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7795, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_468ellpadicbsd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n, __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_468ellpadicbsd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpadicbsd", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":7873
 *             %22 = [0, 4 + 3*7 + O(7^8)]
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7873, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":7874
 *         '''
 *         p = objtogen(p)
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_2 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7875
 *         p = objtogen(p)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7876
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7876, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":7875
 *         p = objtogen(p)
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":7877
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 7877, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7878
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7879
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_gen.pxi":7880
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":7881
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 */
  __pyx_t_2 = (__pyx_v__have_D != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":7882
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":7881
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 */
  }

  /* "cypari/auto_gen.pxi":7883
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicbsd(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__D);

  /* "cypari/auto_gen.pxi":7884
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = ellpadicbsd(_E, _p, n, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicfrobenius(E, long p, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 7884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7795
 *         return new_gen(_ret)
 * 
 *     def ellpadicbsd(E, p, long n, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an elliptic curve :math:`E` over :math:`\mathbb{Q}`, its quadratic twist :math:`E_D`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicbsd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7886
 *         return new_gen(_ret)
 * 
 *     def ellpadicfrobenius(E, long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E` is an elliptic curve on :math:`\mathbb{Q}` with good
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_471ellpadicfrobenius(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_470ellpadicfrobenius[] = "\n        If :math:`p > 2` is a prime and :math:`E` is an elliptic curve on :math:`\\mathbb{Q}` with good\n        reduction at :math:`p`, return the matrix of the Frobenius endomorphism :math:`\\varphi` on\n        the crystalline module :math:`D_p(E) = \\mathbb{Q}_p \\otimes H^1_{dR}(E/\\mathbb{Q})` with respect to\n        the basis of the given model :math:`(\\omega, \\eta = x \\omega)`, where\n        :math:`\\omega = dx/(2 y+a_1 x+a_3)` is the invariant differential.\n        The characteristic polynomial of :math:`\\varphi` is :math:`x^2 - a_p x + p`.\n        The matrix is computed to absolute :math:`p`-adic precision :math:`p^n`.\n        \n        ::\n        \n            ? E = ellinit([1,-1,1,0,0]);\n            ? F = ellpadicfrobenius(E,5,3);\n            ? lift(F)\n            %3 =\n            [120 29]\n            \n            [ 55 5]\n            ? charpoly(F)\n            %4 = x^2 + O(5^3)*x + (5 + O(5^3))\n            ? ellap(E, 5)\n            %5 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_471ellpadicfrobenius(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_p;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,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_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicfrobenius", 1, 2, 2, 1); __PYX_ERR(10, 7886, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicfrobenius") < 0)) __PYX_ERR(10, 7886, __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_p = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7886, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7886, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicfrobenius", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7886, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_470ellpadicfrobenius(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_470ellpadicfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_p, long __pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellpadicfrobenius", 0);

  /* "cypari/auto_gen.pxi":7910
 *             %5 = 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 7910, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":7911
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":7912
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicfrobenius(__pyx_v__E, __pyx_v_p, __pyx_v_n);

  /* "cypari/auto_gen.pxi":7913
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellpadicfrobenius(_E, p, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicheight(E, p, long n, P, Q=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 7913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7886
 *         return new_gen(_ret)
 * 
 *     def ellpadicfrobenius(E, long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E` is an elliptic curve on :math:`\mathbb{Q}` with good
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":7915
 *         return new_gen(_ret)
 * 
 *     def ellpadicheight(E, p, long n, P, Q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cyclotomic :math:`p`-adic height of the rational point :math:`P` on the elliptic curve
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_473ellpadicheight(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_472ellpadicheight[] = "\n        Cyclotomic :math:`p`-adic height of the rational point :math:`P` on the elliptic curve\n        :math:`E` (defined over :math:`\\mathbb{Q}`), given to :math:`n` :math:`p`-adic digits.\n        If the argument :math:`Q` is present, computes the value of the bilinear\n        form :math:`(h(P+Q)-h(P-Q)) / 4`.\n        \n        Let :math:`D := H^1_{dR}(E) \\otimes_\\mathbb{Q} \\mathbb{Q}_p` be the :math:`\\mathbb{Q}_p` vector space\n        spanned by :math:`\\omega`\n        (invariant differential :math:`dx/(2y+a_1x+a3)` related to the given model) and\n        :math:`\\eta = x \\omega`. Then the cyclotomic :math:`p`-adic height :math:`h_E` associates to\n        :math:`P\\in E(\\mathbb{Q})` an element :math:`f \\omega + g \\eta` in :math:`D`.\n        This routine returns the vector :math:`[f, g]` to :math:`n` :math:`p`-adic digits.\n        If :math:`P\\in E(\\mathbb{Q})` is in the kernel of reduction mod :math:`p` and if its reduction\n        at all finite places is non singular, then :math:`g = -(\\log_E P)^2`, where\n        :math:`\\log_E` is the logarithm for the formal group of :math:`E` at :math:`p`.\n        \n        If furthermore the model is of the form :math:`Y^2 = X^3 + a X + b` and :math:`P = (x,y)`,\n        then\n        \n        .. MATH::\n        \n            f = \\log_p(denominator (x)) - 2 \\log_p(\\sigma (P))\n        \n        where :math:`\\sigma (P)` is given by :literal:`ellsigma`:math:`(E,P)`.\n        \n        Recall (:emphasis:`Advanced topics in the arithmetic of elliptic\n        curves`, Theorem\302\2403.2) that the local height function over the complex numbers\n        is of the form\n        \n        .. MATH::\n        \n            \\lambda (z) = -\\log (\\|E.disc\\|) / 6 + \\Re (z \\eta (z)) - 2 \\log (\n            \\sigma (z)).\n        \n        (N.B. our normalization for local and global heights is twice that of\n        Silverman's).\n        \n        ::\n        \n             ? E = ellinit([1,-1,1,0,0]);"" P = [0,0];\n             ? ellpadicheight(E,5,3, P)\n             %2 = [3*5 + 5^2 + 2*5^3 + O(5^4), 5^2 + 4*5^4 + O(5^5)]\n             ? E = ellinit(\"11a1\"); P = [5,5]; \\\\ torsion point\n             ? ellpadicheight(E,19,6, P)\n             %4 = [0, 0]\n             ? E = ellinit([0,0,1,-4,2]); P = [-2,1];\n             ? ellpadicheight(E,3,3, P)\n             %6 = [2*3^2 + 2*3^3 + 3^4 + O(3^5), 2*3^2 + 3^4 + O(3^5)]\n             ? ellpadicheight(E,3,5, P, elladd(E,P,P))\n             %7 = [3^2 + 2*3^3 + O(3^7), 3^2 + 3^3 + 2*3^4 + 3^5 + O(3^7)]\n        \n        - When :math:`E` has good ordinary reduction at :math:`p` or non split multiplicative\n          reduction, the \"canonical\" :math:`p`-adic height is given by\n        \n        ::\n        \n            s2 = ellpadics2(E,p,n);\n            ellpadicheight(E, p, n, P) * [1,-s2]~\n        \n        Since :math:`s_2` does not depend on :math:`P`, it is preferable to\n        compute it only once:\n        \n        ::\n        \n            ? E = ellinit(\"5077a1\"); p = 5; n = 7; \\\\ rank 3\n            ? s2 = ellpadics2(E,p,n);\n            ? M = ellpadicheightmatrix(E,p, n, E.gen) * [1,-s2]~;\n            ? matdet(M) \\\\ p-adic regulator on the points in E.gen\n            %4 = 5 + 5^2 + 4*5^3 + 2*5^4 + 2*5^5 + 2*5^6 + O(5^7)\n        \n        - When :math:`E` has split multiplicative reduction at :math:`p` (Tate curve),\n          the \"canonical\" :math:`p`-adic height is given by\n        \n        ::\n        \n            Ep = ellinit(E[1..5], O(p^(n))); \\\\ E seen as a Tate curve over Qp\n            [u2,u,q] = Ep.tate;\n            ellpadicheight(E, p, n, P) * [1,-s2 + 1/log(q)/u2]]~\n        \n        where :math:`s_2` is as above. For example,\n        \n        ::\n        \n            ? E = ellinit(\"91b1\"); P =[-1, 3]; p = 7; n = 5;\n            ? Ep = ellinit(E[1..5], O(p^(n)));\n            ? s2 = ellpadics2(E,p,n);\n            ? [u2,u,q] = Ep.tate;\n            ? H = ellpadic""height(E,p, n, P) * [1,-s2 + 1/log(q)/u2]~\n            %5 = 2*7 + 7^2 + 5*7^3 + 6*7^4 + 2*7^5 + O(7^6)\n        \n        These normalizations are chosen so that :math:`p`-adic BSD conjectures\n        are easy to state, see :literal:`ellpadicbsd`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_473ellpadicheight(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicheight (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_P,&__pyx_n_s_Q,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_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheight", 0, 3, 4, 1); __PYX_ERR(10, 7915, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheight", 0, 3, 4, 2); __PYX_ERR(10, 7915, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicheight") < 0)) __PYX_ERR(10, 7915, __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_p = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 7915, __pyx_L3_error)
    __pyx_v_P = values[2];
    __pyx_v_Q = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicheight", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 7915, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_472ellpadicheight(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n, __pyx_v_P, __pyx_v_Q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_472ellpadicheight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P, PyObject *__pyx_v_Q) {
  int __pyx_v__have_Q;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpadicheight", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_gen.pxi":8009
 *         are easy to state, see :literal:`ellpadicbsd`.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8010
 *         '''
 *         p = objtogen(p)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8011
 *         p = objtogen(p)
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             Q = objtogen(Q)
 */
  __pyx_t_2 = (__pyx_v_Q != Py_None);
  __pyx_v__have_Q = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8012
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":8013
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:
 *             Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":8012
 *         P = objtogen(P)
 *         cdef bint _have_Q = (Q is not None)
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             Q = objtogen(Q)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":8014
 *         if _have_Q:
 *             Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 8014, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8015
 *             Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8016
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8017
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8018
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL             # <<<<<<<<<<<<<<
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 */
  __pyx_v__Q = NULL;

  /* "cypari/auto_gen.pxi":8019
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 */
  __pyx_t_2 = (__pyx_v__have_Q != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":8020
 *         cdef GEN _Q = NULL
 *         if _have_Q:
 *             _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
    __pyx_v__Q = __pyx_t_4;

    /* "cypari/auto_gen.pxi":8019
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = NULL
 *         if _have_Q:             # <<<<<<<<<<<<<<
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 */
  }

  /* "cypari/auto_gen.pxi":8021
 *         if _have_Q:
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicheight0(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__P, __pyx_v__Q);

  /* "cypari/auto_gen.pxi":8022
 *             _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheight0(_E, _p, n, _P, _Q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicheightmatrix(E, p, long n, Q):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":7915
 *         return new_gen(_ret)
 * 
 *     def ellpadicheight(E, p, long n, P, Q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cyclotomic :math:`p`-adic height of the rational point :math:`P` on the elliptic curve
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicheight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8024
 *         return new_gen(_ret)
 * 
 *     def ellpadicheightmatrix(E, p, long n, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being a vector of points, this function returns the "Gram matrix"
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_475ellpadicheightmatrix(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_474ellpadicheightmatrix[] = "\n        :math:`Q` being a vector of points, this function returns the \"Gram matrix\"\n        :math:`[F,G]` of the cyclotomic :math:`p`-adic height :math:`h_E` with respect to\n        the basis :math:`(\\omega, \\eta)` of :math:`D = H^1_{dR}(E) \\otimes_\\mathbb{Q} \\mathbb{Q}_p`\n        given to :math:`n` :math:`p`-adic digits. In other words, if\n        :literal:`ellpadicheight`:math:`(E,p,n, Q[i],Q[j]) = [f,g]`, corresponding to\n        :math:`f \\omega + g \\eta` in :math:`D`, then :math:`F[i,j] = f` and :math:`G[i,j] = g`.\n        \n        ::\n        \n            ? E = ellinit([0,0,1,-7,6]); Q = [[-2,3],[-1,3]]; p = 5; n = 5;\n            ? [F,G] = ellpadicheightmatrix(E,p,n,Q);\n            ? lift(F) \\\\ p-adic entries, integral approximation for readability\n            %3 =\n            [2364 3100]\n            \n            [3100 3119]\n            \n            ? G\n            %4 =\n            [25225 46975]\n            \n            [46975 61850]\n            \n            ? [F,G] * [1,-ellpadics2(E,p,n)]~\n            %5 =\n            [4 + 2*5 + 4*5^2 + 3*5^3 + O(5^5) 4*5^2 + 4*5^3 + 5^4 + O(5^5)]\n            \n            [ 4*5^2 + 4*5^3 + 5^4 + O(5^5) 4 + 3*5 + 4*5^2 + 4*5^3 + 5^4 + O(5^5)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_475ellpadicheightmatrix(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicheightmatrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_Q,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheightmatrix", 1, 3, 3, 1); __PYX_ERR(10, 8024, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicheightmatrix", 1, 3, 3, 2); __PYX_ERR(10, 8024, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicheightmatrix") < 0)) __PYX_ERR(10, 8024, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_p = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8024, __pyx_L3_error)
    __pyx_v_Q = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicheightmatrix", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8024, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_474ellpadicheightmatrix(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n, __pyx_v_Q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_474ellpadicheightmatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_Q) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadicheightmatrix", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_gen.pxi":8055
 *             [ 4*5^2 + 4*5^3 + 5^4 + O(5^5) 4 + 3*5 + 4*5^2 + 4*5^3 + 5^4 + O(5^5)]
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8056
 *         '''
 *         p = objtogen(p)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8057
 *         p = objtogen(p)
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8057, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8058
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8059
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8060
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8061
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicheightmatrix(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__Q);

  /* "cypari/auto_gen.pxi":8062
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = ellpadicheightmatrix(_E, _p, n, _Q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadiclog(E, p, long n, P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8024
 *         return new_gen(_ret)
 * 
 *     def ellpadicheightmatrix(E, p, long n, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being a vector of points, this function returns the "Gram matrix"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicheightmatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8064
 *         return new_gen(_ret)
 * 
 *     def ellpadiclog(E, p, long n, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`E` defined over :math:`K = \mathbb{Q}` or :math:`\mathbb{Q}_p` and :math:`P = [x,y]` on :math:`E(K)` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_477ellpadiclog(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_476ellpadiclog[] = "\n        Given :math:`E` defined over :math:`K = \\mathbb{Q}` or :math:`\\mathbb{Q}_p` and :math:`P = [x,y]` on :math:`E(K)` in the\n        kernel of reduction mod :math:`p`, let :math:`t(P) = -x/y` be the formal group\n        parameter; this function returns :math:`L(t)`, where :math:`L` denotes the formal\n        logarithm (mapping the formal group of :math:`E` to the additive formal group)\n        attached to the canonical invariant differential:\n        :math:`dL = dx/(2y + a_1x + a_3)`.\n        \n        ::\n        \n            ? E = ellinit([0,0,1,-4,2]); P = [-2,1];\n            ? ellpadiclog(E,2,10,P)\n            %2 = 2 + 2^3 + 2^8 + 2^9 + 2^10 + O(2^11)\n            ? E = ellinit([17,42]);\n            ? p=3; Ep = ellinit(E,p); \\\\ E mod p\n            ? P=[114,1218]; ellorder(Ep,P) \\\\ the order of P on (E mod p) is 2\n            %5 = 2\n            ? Q = ellmul(E,P,2) \\\\ we need a point of the form 2*P\n            %6 = [200257/7056, 90637343/592704]\n            ? ellpadiclog(E,3,10,Q)\n            %7 = 3 + 2*3^2 + 3^3 + 3^4 + 3^5 + 3^6 + 2*3^8 + 3^9 + 2*3^10 + O(3^11)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_477ellpadiclog(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadiclog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_P,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadiclog", 1, 3, 3, 1); __PYX_ERR(10, 8064, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadiclog", 1, 3, 3, 2); __PYX_ERR(10, 8064, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadiclog") < 0)) __PYX_ERR(10, 8064, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_p = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8064, __pyx_L3_error)
    __pyx_v_P = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadiclog", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8064, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadiclog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_476ellpadiclog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n, __pyx_v_P);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_476ellpadiclog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_P) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadiclog", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_gen.pxi":8087
 *             %7 = 3 + 2*3^2 + 3^3 + 3^4 + 3^5 + 3^6 + 2*3^8 + 3^9 + 2*3^10 + O(3^11)
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8088
 *         '''
 *         p = objtogen(p)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8089
 *         p = objtogen(p)
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8089, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8090
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8091
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8092
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8093
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadiclog(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__P);

  /* "cypari/auto_gen.pxi":8094
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ellpadiclog(_E, _p, n, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadicregulator(E, p, long n, S):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8094, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8064
 *         return new_gen(_ret)
 * 
 *     def ellpadiclog(E, p, long n, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`E` defined over :math:`K = \mathbb{Q}` or :math:`\mathbb{Q}_p` and :math:`P = [x,y]` on :math:`E(K)` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadiclog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8096
 *         return new_gen(_ret)
 * 
 *     def ellpadicregulator(E, p, long n, S):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve. Return the determinant of the Gram
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_479ellpadicregulator(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_478ellpadicregulator[] = "\n        Let :math:`E/\\mathbb{Q}` be an elliptic curve. Return the determinant of the Gram\n        matrix of the vector of points :math:`S = (S_1,..., S_r)` with respect to the\n        \"canonical\" cyclotomic :math:`p`-adic height on :math:`E`, given to :math:`n` (:math:`p`-adic)\n        digits.\n        \n        When :math:`E` has ordinary reduction at :math:`p`, this is the expected Gram\n        deteterminant in :math:`\\mathbb{Q}_p`.\n        \n        In the case of supersingular reduction of :math:`E` at :math:`p`, the definition\n        requires care: the regulator :math:`R` is an element of\n        :math:`D := H^1_{dR}(E) \\otimes_\\mathbb{Q} \\mathbb{Q}_p`, which is a two-dimensional\n        :math:`\\mathbb{Q}_p`-vector space spanned by :math:`\\omega` and :math:`\\eta = x \\omega`\n        (which are defined over :math:`\\mathbb{Q}`) or equivalently but now over :math:`\\mathbb{Q}_p`\n        by :math:`\\omega` and :math:`F\\omega` where :math:`F` is the Frobenius endomorphism on :math:`D`\n        as defined in :literal:`ellpadicfrobenius`. On :math:`D` we\n        define the cyclotomic height :math:`h_E = f \\omega + g \\eta`\n        (see :literal:`ellpadicheight`) and a canonical alternating bilinear form\n        :math:`[.,.]_D` such that :math:`[\\omega, \\eta]_D = 1`.\n        \n        For any :math:`\\nu \\in D`, we can define a height :math:`h_\\nu := [ h_E, \\nu ]_D`\n        from :math:`E(\\mathbb{Q})` to :math:`\\mathbb{Q}_p` and :math:`<.,.>_\\nu` the attached\n        bilinear form. In particular, if :math:`h_E = f \\omega + g\\eta`, then\n        :math:`h_\\eta = [ h_E, \\eta ]_D` = f and :math:`h_\\omega = [ h_E, \\omega ]_D = - g`\n        hence :math:`h_E = h_\\eta \\omega - h_\\omega \\eta`.\n        Then, :math:`R` is the unique element of :math:`D` such that\n        \n        .. MATH::\n        \n            [\\omega,\\nu]_D^{r-1} [R, \\nu]_D = \\det (<\302\240S_i, S_j >_{\\nu})\n        \n        for all :math:`\\nu \\in D""` not in :math:`\\mathbb{Q}_p \\omega`. The :literal:`ellpadicregulator`\n        function returns :math:`R` in the basis :math:`(\\omega, F\\omega)`, which was chosen\n        so that :math:`p`-adic BSD conjectures are easy to state, see :literal:`ellpadicbsd`.\n        \n        Note that by definition\n        \n        .. MATH::\n        \n            [R, \\eta]_D = \\det (<\302\240S_i, S_j >_{\\eta})\n        \n        and\n        \n        .. MATH::\n        \n            [R, \\omega+\\eta]_D = \\det (<\302\240S_i, S_j >_{\\omega+\\eta}).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_479ellpadicregulator(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_v_S = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadicregulator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_S,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadicregulator", 1, 3, 3, 1); __PYX_ERR(10, 8096, __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("ellpadicregulator", 1, 3, 3, 2); __PYX_ERR(10, 8096, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadicregulator") < 0)) __PYX_ERR(10, 8096, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_p = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8096, __pyx_L3_error)
    __pyx_v_S = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadicregulator", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8096, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_478ellpadicregulator(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n, __pyx_v_S);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_478ellpadicregulator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_S) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__S;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadicregulator", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_S);

  /* "cypari/auto_gen.pxi":8144
 *             [R, \omega+\eta]_D = \det (<S_i, S_j >_{\omega+\eta}).
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         S = objtogen(S)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8144, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8145
 *         '''
 *         p = objtogen(p)
 *         S = objtogen(S)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_S, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_S, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8146
 *         p = objtogen(p)
 *         S = objtogen(S)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8146, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8147
 *         S = objtogen(S)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _S = (<Gen>S).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8148
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8149
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _S = (<Gen>S).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_S)->__pyx_base.g;
  __pyx_v__S = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8150
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadicregulator(__pyx_v__E, __pyx_v__p, __pyx_v_n, __pyx_v__S);

  /* "cypari/auto_gen.pxi":8151
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _ret = ellpadicregulator(_E, _p, n, _S)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpadics2(E, p, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8096
 *         return new_gen(_ret)
 * 
 *     def ellpadicregulator(E, p, long n, S):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve. Return the determinant of the Gram
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadicregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_S);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8153
 *         return new_gen(_ret)
 * 
 *     def ellpadics2(E, p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E/\mathbb{Q}` is an elliptic curve with ordinary good
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_481ellpadics2(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_480ellpadics2[] = "\n        If :math:`p > 2` is a prime and :math:`E/\\mathbb{Q}` is an elliptic curve with ordinary good\n        reduction at :math:`p`, returns the slope of the unit eigenvector\n        of :literal:`ellpadicfrobenius(E,p,n)`, i.e., the action of Frobenius :math:`\\varphi` on\n        the crystalline module :math:`D_p(E) = \\mathbb{Q}_p \\otimes H^1_{dR}(E/\\mathbb{Q})` in the basis of\n        the given model :math:`(\\omega, \\eta = x \\omega)`, where :math:`\\omega` is the invariant\n        differential :math:`dx/(2 y+a_1 x+a_3)`. In other words, :math:`\\eta + s_2\\omega`\n        is an eigenvector for the unit eigenvalue of :math:`\\varphi`.\n        \n        ::\n        \n            ? e=ellinit([17,42]);\n            ? ellpadics2(e,13,4)\n            %2 = 10 + 2*13 + 6*13^3 + O(13^4)\n        \n        This slope is the unique :math:`c \\in 3^{-1}\\mathbb{Z}_p` such that the odd solution\n        :math:`\\sigma (t) = t + O(t^2)` of\n        \n        .. MATH::\n        \n            - d((1)/(\\sigma) (d \\sigma)/(\\omega))\n            = (x(t) + c) \\omega\n        \n        is in :math:`t\\mathbb{Z}_p[[t]]`.\n        \n        It is equal to :math:`b_2/12 - E_2/12` where :math:`E_2` is the value of the Katz\n        :math:`p`-adic Eisenstein series of weight 2 on :math:`(E,\\omega)`. This is\n        used to construct a canonical :math:`p`-adic height when :math:`E` has good ordinary\n        reduction at :math:`p` as follows\n        \n        ::\n        \n            s2 = ellpadics2(E,p,n);\n            h(E,p,n, P, s2) = ellpadicheight(E, [p,[1,-s2]],n, P);\n        \n        Since :math:`s_2` does not depend on the point :math:`P`, we compute it\n        only once.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_481ellpadics2(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpadics2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,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_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpadics2", 1, 2, 2, 1); __PYX_ERR(10, 8153, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpadics2") < 0)) __PYX_ERR(10, 8153, __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_p = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8153, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpadics2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8153, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadics2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_480ellpadics2(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_480ellpadics2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p, long __pyx_v_n) {
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpadics2", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":8192
 *         only once.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8193
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8193, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8194
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ellpadics2(_E, _p, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8195
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellpadics2(_E, _p, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8196
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ellpadics2(_E, _p, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellpadics2(__pyx_v__E, __pyx_v__p, __pyx_v_n);

  /* "cypari/auto_gen.pxi":8197
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ellpadics2(_E, _p, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellperiods(w, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8153
 *         return new_gen(_ret)
 * 
 *     def ellpadics2(E, p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`p > 2` is a prime and :math:`E/\mathbb{Q}` is an elliptic curve with ordinary good
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpadics2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8199
 *         return new_gen(_ret)
 * 
 *     def ellperiods(w, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`w` describe a complex period lattice (:math:`w = [w_1,w_2]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_483ellperiods(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_482ellperiods[] = "\n        Let :math:`w` describe a complex period lattice (:math:`w = [w_1,w_2]`\n        or an :literal:`ellinit` structure). Returns normalized periods :math:`[W_1,W_2]` generating\n        the same lattice such that :math:`\\tau := W_1/W_2` has positive imaginary part\n        and lies in the standard fundamental domain for :math:`SL_2(\\mathbb{Z})`.\n        \n        If :math:`flag = 1`, the function returns :math:`[[W_1,W_2], [\\eta_1,\\eta_2]]`, where\n        :math:`\\eta_1` and :math:`\\eta_2` are the quasi-periods attached to\n        :math:`[W_1,W_2]`, satisfying :math:`\\eta_2 W_1 - \\eta_1 W_2 = 2 i \\pi`.\n        \n        The output of this function is meant to be used as the first argument\n        given to ellwp, ellzeta, ellsigma or elleisnum. Quasi-periods are\n        needed by ellzeta and ellsigma only.\n        \n        ::\n        \n            ? L = ellperiods([1,I],1);\n            ? [w1,w2] = L[1]; [e1,e2] = L[2];\n            ? e2*w1 - e1*w2\n            %3 = 6.2831853071795864769252867665590057684*I\n            ? ellzeta(L, 1/2 + 2*I)\n            %4 = 1.5707963... - 6.283185307...*I\n            ? ellzeta([1,I], 1/2 + 2*I) \\\\ same but less efficient\n            %4 = 1.5707963... - 6.283185307...*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_483ellperiods(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellperiods (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellperiods") < 0)) __PYX_ERR(10, 8199, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8199, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8199, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellperiods", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8199, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellperiods", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_482ellperiods(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_w), __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_482ellperiods(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellperiods", 0);

  /* "cypari/auto_gen.pxi":8225
 *             %4 = 1.5707963... - 6.283185307...*I
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8225, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8226
 *         '''
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellperiods(_w, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8227
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellperiods(_w, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8228
 *         cdef GEN _w = (<Gen>w).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellperiods(_w, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellperiods(__pyx_v__w, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8229
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellperiods(_w, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpointtoz(E, P, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8199
 *         return new_gen(_ret)
 * 
 *     def ellperiods(w, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`w` describe a complex period lattice (:math:`w = [w_1,w_2]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellperiods", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8231
 *         return new_gen(_ret)
 * 
 *     def ellpointtoz(E, P, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E/\mathbb{C} ~ \mathbb{C}/\Lambda` is a complex elliptic curve (:math:`\Lambda =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_485ellpointtoz(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_484ellpointtoz[] = "\n        If :math:`E/\\mathbb{C} ~ \\mathbb{C}/\\Lambda` is a complex elliptic curve (:math:`\\Lambda =\n        E.omega`), computes a complex number :math:`z`, well-defined modulo the\n        lattice :math:`\\Lambda`, corresponding to the point :math:`P`; i.e.\302\240such that\n        :math:`P = [\\wp_\\Lambda (z),\\wp'_\\Lambda (z)]` satisfies the equation\n        \n        .. MATH::\n        \n            y^2 = 4x^3 - g_2 x - g_3,\n        \n        where :math:`g_2`, :math:`g_3` are the elliptic invariants.\n        \n        If :math:`E` is defined over :math:`\\mathbb{R}` and :math:`P\\in E(\\mathbb{R})`, we have more precisely, :math:`0 \\leq\n        \\Re (t) < w1` and :math:`0 <= \\Im (t) < \\Im (w2)`, where :math:`(w1,w2)` are the real and\n        complex periods of :math:`E`.\n        \n        ::\n        \n            ? E = ellinit([0,1]); P = [2,3];\n            ? z = ellpointtoz(E, P)\n            %2 = 3.5054552633136356529375476976257353387\n            ? ellwp(E, z)\n            %3 = 2.0000000000000000000000000000000000000\n            ? ellztopoint(E, z) - P\n            %4 = [2.548947057811923643 E-57, 7.646841173435770930 E-57]\n            ? ellpointtoz(E, [0]) \\\\ the point at infinity\n            %5 = 0\n        \n        If :math:`E` is defined over a general number field, the function returns the\n        values corresponding to the various complex embeddings of the curve\n        and of the point, in the same order as :literal:`E.nf.roots`:\n        \n        ::\n        \n            ? E=ellinit([-22032-15552*x,0], nfinit(x^2-2));\n            ? P=[-72*x-108,0];\n            ? ellisoncurve(E,P)\n            %3 = 1\n            ? ellpointtoz(E,P)\n            %4 = [-0.52751724240790530394437835702346995884*I,\n             -0.090507650025885335533571758708283389896*I]\n            ? E.nf.roots\n            %5 = [-1.4142135623730950488016887242096980786, \\\\ x-> -sqrt(2)\n             1.4142135623730950488016887242096980786] \\\\ x->"" sqrt(2)\n        \n        If :math:`E/\\mathbb{Q}_p` has multiplicative reduction, then :math:`E/\\bar{\\mathbb{Q}_p}` is analytically\n        isomorphic to :math:`\\bar{\\mathbb{Q}}_p^*/q^\\mathbb{Z}` (Tate curve) for some :math:`p`-adic integer :math:`q`.\n        The behavior is then as follows:\n        \n        - If the reduction is split (:math:`E.tate[2]` is a :literal:`t_PADIC`), we have\n          an isomorphism :math:`\\phi: E(\\mathbb{Q}_p) ~ \\mathbb{Q}_p^*/q^\\mathbb{Z}` and the function returns\n          :math:`\\phi (P)\\in \\mathbb{Q}_p`.\n        \n        - If the reduction is :emphasis:`not` split (:math:`E.tate[2]` is a\n          :literal:`t_POLMOD`), we only have an isomorphism :math:`\\phi: E(K) ~ K^*/q^\\mathbb{Z}` over\n          the unramified quadratic extension :math:`K/\\mathbb{Q}_p`. In this case, the output\n          :math:`\\phi (P)\\in K` is a :literal:`t_POLMOD`.\n        \n        ::\n        \n            ? E = ellinit([0,-1,1,0,0], O(11^5)); P = [0,0];\n            ? [u2,u,q] = E.tate; type(u) \\\\ split multiplicative reduction\n            %2 = \"t_PADIC\"\n            ? ellmul(E, P, 5) \\\\ P has order 5\n            %3 = [0]\n            ? z = ellpointtoz(E, [0,0])\n            %4 = 3 + 11^2 + 2*11^3 + 3*11^4 + 6*11^5 + 10*11^6 + 8*11^7 + O(11^8)\n            ? z^5\n            %5 = 1 + O(11^9)\n            ? E = ellinit(ellfromj(1/4), O(2^6)); x=1/2; y=ellordinate(E,x)[1];\n            ? z = ellpointtoz(E,[x,y]); \\\\ t_POLMOD of t_POL with t_PADIC coeffs\n            ? liftint(z) \\\\ lift all p-adics\n            %8 = Mod(8*u + 7, u^2 + 437)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_485ellpointtoz(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpointtoz (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_precision,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_P)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpointtoz") < 0)) __PYX_ERR(10, 8231, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8231, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpointtoz", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8231, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpointtoz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_484ellpointtoz(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_P, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_484ellpointtoz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellpointtoz", 0);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_gen.pxi":8306
 *             %8 = Mod(8*u + 7, u^2 + 437)
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8307
 *         '''
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8307, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8308
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8309
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zell(_E, _P, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8310
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zell(_E, _P, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8311
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zell(_E, _P, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zell(__pyx_v__E, __pyx_v__P, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8312
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zell(_E, _P, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellpow(E, z, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8231
 *         return new_gen(_ret)
 * 
 *     def ellpointtoz(E, P, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E/\mathbb{C} ~ \mathbb{C}/\Lambda` is a complex elliptic curve (:math:`\Lambda =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpointtoz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8314
 *         return new_gen(_ret)
 * 
 *     def ellpow(E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellmul`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_487ellpow(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_486ellpow[] = "\n        Deprecated alias for :literal:`ellmul`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_487ellpow(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_n,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_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellpow", 1, 2, 2, 1); __PYX_ERR(10, 8314, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellpow") < 0)) __PYX_ERR(10, 8314, __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_z = values[0];
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellpow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8314, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_486ellpow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_z, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_486ellpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, PyObject *__pyx_v_n) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellpow", 0);
  __Pyx_INCREF(__pyx_v_z);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_gen.pxi":8318
 *         Deprecated alias for :literal:`ellmul`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)
 *         z = objtogen(z)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8318, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":8319
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         n = objtogen(n)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":8320
 *         from warnings import warn
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":8321
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)
 *         z = objtogen(z)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":8322
 *         z = objtogen(z)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 8322, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8323
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8324
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8325
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8326
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellmul(__pyx_v__E, __pyx_v__z, __pyx_v__n);

  /* "cypari/auto_gen.pxi":8327
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ellmul(_E, _z, _n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellratpoints(E, h, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8314
 *         return new_gen(_ret)
 * 
 *     def ellpow(E, z, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for :literal:`ellmul`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8329
 *         return new_gen(_ret)
 * 
 *     def ellratpoints(E, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an integral model of elliptic curve , return a vector
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_489ellratpoints(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_488ellratpoints[] = "\n        :math:`E` being an integral model of elliptic curve , return a vector\n        containing the affine rational points on the curve of naive height less than\n        :math:`h`. If :math:`flag = 1`, stop as soon as a point is found; return either an empty\n        vector or a vector containing a single point.\n        See :literal:`hyperellratpoints` for how :math:`h` can be specified.\n        \n        ::\n        \n            ? E=ellinit([-25,1]);\n            ? ellratpoints(E,10)\n            %2 = [[-5,1],[-5,-1],[-3,7],[-3,-7],[-1,5],[-1,-5],\n             [0,1],[0,-1],[5,1],[5,-1],[7,13],[7,-13]]\n            ? ellratpoints(E,10,1)\n            %3 = [[-5,1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_489ellratpoints(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_h = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellratpoints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_h,&__pyx_n_s_flag,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_h)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellratpoints") < 0)) __PYX_ERR(10, 8329, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_h = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8329, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellratpoints", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8329, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_488ellratpoints(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_h, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_488ellratpoints(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_h, long __pyx_v_flag) {
  GEN __pyx_v__E;
  GEN __pyx_v__h;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellratpoints", 0);
  __Pyx_INCREF(__pyx_v_h);

  /* "cypari/auto_gen.pxi":8346
 *             %3 = [[-5,1]]
 *         '''
 *         h = objtogen(h)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_h, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8347
 *         '''
 *         h = objtogen(h)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _h = (<Gen>h).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8347, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8348
 *         h = objtogen(h)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8349
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _h = (<Gen>h).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_h)->__pyx_base.g;
  __pyx_v__h = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8350
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellratpoints(__pyx_v__E, __pyx_v__h, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":8351
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = ellratpoints(_E, _h, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellrootno(E, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8329
 *         return new_gen(_ret)
 * 
 *     def ellratpoints(E, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an integral model of elliptic curve , return a vector
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8353
 *         return new_gen(_ret)
 * 
 *     def ellrootno(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :literal:`ell` structure over :math:`\mathbb{Q}` as output by :literal:`ellinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_491ellrootno(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_490ellrootno[] = "\n        :math:`E` being an :literal:`ell` structure over :math:`\\mathbb{Q}` as output by :literal:`ellinit`,\n        this function computes the local root number of its :math:`L`-series at the place\n        :math:`p` (at the infinite place if :math:`p = 0`). If :math:`p` is omitted, return the global\n        root number and in this case the curve can also be defined over a number field.\n        \n        Note that the global root number is the sign of the functional\n        equation and conjecturally is the parity of the rank of the\n        Mordell-Weil group. The equation for :math:`E` needs not be minimal at :math:`p`,\n        but if the model is already minimal the function will run faster.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_491ellrootno(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellrootno (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellrootno") < 0)) __PYX_ERR(10, 8353, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellrootno", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8353, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellrootno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_490ellrootno(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_490ellrootno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__E;
  GEN __pyx_v__p;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellrootno", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":8365
 *         but if the model is already minimal the function will run faster.
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":8366
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8367
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":8366
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":8368
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 8368, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8369
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8370
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":8371
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8372
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = ellrootno(_E, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":8371
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)
 */
  }

  /* "cypari/auto_gen.pxi":8373
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = ellrootno(__pyx_v__E, __pyx_v__p);

  /* "cypari/auto_gen.pxi":8374
 *             _p = (<Gen>p).g
 *         cdef long _ret = ellrootno(_E, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":8375
 *         cdef long _ret = ellrootno(_E, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def ellsea(E, long tors=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8353
 *         return new_gen(_ret)
 * 
 *     def ellrootno(E, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :literal:`ell` structure over :math:`\mathbb{Q}` as output by :literal:`ellinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellrootno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8377
 *         return _ret
 * 
 *     def ellsea(E, long tors=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :emphasis:`ell` structure as output by :literal:`ellinit`, defined over
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_493ellsea(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_492ellsea[] = "\n        Let :math:`E` be an :emphasis:`ell` structure as output by :literal:`ellinit`, defined over\n        a finite field :math:`\\mathbb{F}_q`. This low-level function computes the order of the\n        group :math:`E(\\mathbb{F}_q)` using the SEA algorithm; compared to the high-level\n        function :literal:`ellcard`, which includes SEA among its choice of algorithms,\n        the :literal:`tors` argument allows to speed up a search for curves having almost\n        prime order and whose quadratic twist may also have almost prime order.\n        When :literal:`tors` is set to a non-zero value, the function returns :math:`0` as soon\n        as it detects that the order has a small prime factor not dividing :literal:`tors`;\n        SEA considers modular polynomials of increasing prime degree :math:`\\ell` and we\n        return :math:`0` as soon as we hit an :math:`\\ell` (coprime to :literal:`tors`) dividing\n        :math:`\\#E(\\mathbb{F}_q)`:\n        \n        ::\n        \n            ? ellsea(ellinit([1,1], 2^56+3477), 1)\n            %1 = 72057594135613381\n            ? forprime(p=2^128,oo, q = ellcard(ellinit([1,1],p)); if(isprime(q),break))\n            time = 6,571 ms.\n            ? forprime(p=2^128,oo, q = ellsea(ellinit([1,1],p),1);if(isprime(q),break))\n            time = 522 ms.\n        \n        In particular, set :literal:`tors` to :math:`1` if you want a curve with prime order,\n        to :math:`2` if you want to allow a cofactor which is a power of two (e.g. for\n        Edwards's curves), etc. The early exit on bad curves yields a massive\n        speedup compared to running the cardinal algorithm to completion.\n        \n        When :literal:`tors` is negative, similar checks are performed for the quadratic\n        twist of the curve.\n        \n        The following function returns a curve of prime order over :math:`\\mathbb{F}_p`.\n        \n        ::\n        \n            cryptocurve(p) =\n            {\n             while(""1,\n             my(E, N, j = Mod(random(p), p));\n             E = ellinit(ellfromj(j));\n             N = ellsea(E, 1); if (!N, continue);\n             if (isprime(N), return(E));\n             \\\\ try the quadratic twist for free\n             if (isprime(2*p+2 - N), return(ellinit(elltwist(E))));\n             );\n            }\n            ? p = randomprime([2^255, 2^256]);\n            ? E = cryptocurve(p); \\\\ insist on prime order\n            %2 = 47,447ms\n        \n        The same example without early abort (using :literal:`ellcard(E)`\n        instead of :literal:`ellsea(E, 1)`) runs for about 5 minutes before finding a\n        suitable curve.\n        \n        The availability of the :literal:`seadata` package will speed up the computation,\n        and is strongly recommended. The generic function :literal:`ellcard` should be\n        preferred when you only want to compute the cardinal of a given curve without\n        caring about it having almost prime order:\n        \n        - If the characteristic is too small (:math:`p <= 7`) or the field\n          cardinality is tiny (:math:`q <= 523`) the generic algorithm\n          :literal:`ellcard` is used instead and the :literal:`tors` argument is ignored.\n          (The reason for this is that SEA is not implemented for :math:`p <= 7` and\n          that if :math:`q <= 523` it is likely to run into an infinite loop.)\n        \n        - If the field cardinality is smaller than about :math:`2^{50}`, the\n          generic algorithm will be faster.\n        \n        - Contrary to :literal:`ellcard`, :literal:`ellsea` does not store the computed\n          cardinality in :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_493ellsea(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_tors;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsea (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tors,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tors);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellsea") < 0)) __PYX_ERR(10, 8377, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_tors = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_tors == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8377, __pyx_L3_error)
    } else {
      __pyx_v_tors = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellsea", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8377, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellsea", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_492ellsea(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_tors);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_492ellsea(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_tors) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellsea", 0);

  /* "cypari/auto_gen.pxi":8448
 *           cardinality in :math:`E`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellsea(_E, tors)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8448, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8449
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsea(_E, tors)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8450
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellsea(_E, tors)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsea(__pyx_v__E, __pyx_v_tors);

  /* "cypari/auto_gen.pxi":8451
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellsea(_E, tors)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellsearch(N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8377
 *         return _ret
 * 
 *     def ellsea(E, long tors=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E` be an :emphasis:`ell` structure as output by :literal:`ellinit`, defined over
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellsea", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8453
 *         return new_gen(_ret)
 * 
 *     def ellsearch(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function finds all curves in the :literal:`elldata` database satisfying
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_495ellsearch(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_494ellsearch[] = "\n        This function finds all curves in the :literal:`elldata` database satisfying\n        the constraint defined by the argument :math:`N`:\n        \n        - if :math:`N` is a character string, it selects a given curve, e.g.\n          :literal:`\"11a1\"`, or curves in the given isogeny class, e.g. :literal:`\"11a\"`, or\n          curves with given conductor, e.g. :literal:`\"11\"`;\n        \n        - if :math:`N` is a vector of integers, it encodes the same constraints\n          as the character string above, according to the :literal:`ellconvertname`\n          correspondance, e.g. :literal:`[11,0,1]` for :literal:`\"11a1\"`, :literal:`[11,0]` for\n          :literal:`\"11a\"` and :literal:`[11]` for :literal:`\"11\"`;\n        \n        - if :math:`N` is an integer, curves with conductor :math:`N` are selected.\n        \n        If :math:`N` codes a full curve name, for instance :literal:`\"11a1\"` or :literal:`[11,0,1]`,\n        the output format is :math:`[N, [a_1,a_2,a_3,a_4,a_6], G]` where\n        :math:`[a_1,a_2,a_3,a_4,a_6]` are the coefficients of the Weierstrass equation of\n        the curve and :math:`G` is a :math:`\\mathbb{Z}`-basis of the free part of the\n        Mordell-Weil group attached to the curve.\n        \n        ::\n        \n            ? ellsearch(\"11a3\")\n            %1 = [\"11a3\", [0, -1, 1, 0, 0], []]\n            ? ellsearch([11,0,3])\n            %2 = [\"11a3\", [0, -1, 1, 0, 0], []]\n        \n        If :math:`N` is not a full curve name, then the output is a vector of all matching\n        curves in the above format:\n        \n        ::\n        \n            ? ellsearch(\"11a\")\n            %1 = [[\"11a1\", [0, -1, 1, -10, -20], []],\n             [\"11a2\", [0, -1, 1, -7820, -263580], []],\n             [\"11a3\", [0, -1, 1, 0, 0], []]]\n            ? ellsearch(\"11b\")\n            %2 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_495ellsearch(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsearch (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_494ellsearch(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_494ellsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ellsearch", 0);

  /* "cypari/auto_gen.pxi":8494
 *             %2 = []
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = ellsearch(_N)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8494, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8495
 *         '''
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsearch(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8496
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = ellsearch(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsearch(__pyx_v__N);

  /* "cypari/auto_gen.pxi":8497
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = ellsearch(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellsigma(L, z=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8453
 *         return new_gen(_ret)
 * 
 *     def ellsearch(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function finds all curves in the :literal:`elldata` database satisfying
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8499
 *         return new_gen(_ret)
 * 
 *     def ellsigma(L, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\sigma` function attached to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_497ellsigma(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_496ellsigma[] = "\n        Computes the value at :math:`z` of the Weierstrass :math:`\\sigma` function attached to\n        the lattice :math:`L` as given by :literal:`ellperiods`:math:`(,1)`: including quasi-periods\n        is useful, otherwise there are recomputed from scratch for each new :math:`z`.\n        \n        .. MATH::\n        \n            \\sigma (z, L) = z \\prod_{\\omega\\in L^*} (1 -\n            (z)/(\\omega))e^{(z)/(\\omega) + (z^2)/(2\\omega^2)}.\n        \n        It is also possible to directly input :math:`L = [\\omega_1,\\omega_2]`,\n        or an elliptic curve :math:`E` as given by :literal:`ellinit` (:math:`L = E.omega`).\n        \n        ::\n        \n            ? w = ellperiods([1,I], 1);\n            ? ellsigma(w, 1/2)\n            %2 = 0.47494937998792065033250463632798296855\n            ? E = ellinit([1,0]);\n            ? ellsigma(E) \\\\ at 'x, implicitly at default seriesprecision\n            %4 = x + 1/60*x^5 - 1/10080*x^9 - 23/259459200*x^13 + O(x^17)\n        \n        If :math:`flag = 1`, computes an arbitrary determination of :math:`\\log (\\sigma (z))`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_497ellsigma(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsigma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellsigma") < 0)) __PYX_ERR(10, 8499, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8499, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8499, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellsigma", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8499, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellsigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_496ellsigma(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_z, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_496ellsigma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_z;
  GEN __pyx_v__L;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellsigma", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":8524
 *         If :math:`flag = 1`, computes an arbitrary determination of :math:`\log (\sigma (z))`.
 *         '''
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_1 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_1;

  /* "cypari/auto_gen.pxi":8525
 *         '''
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_z != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8526
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":8525
 *         '''
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":8527
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 8527, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8528
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8529
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_gen.pxi":8530
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_z != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8531
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_gen.pxi":8530
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":8532
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8533
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsigma(__pyx_v__L, __pyx_v__z, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8534
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellsigma(_L, _z, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellsub(E, z1, z2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8499
 *         return new_gen(_ret)
 * 
 *     def ellsigma(L, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\sigma` function attached to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellsigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8536
 *         return new_gen(_ret)
 * 
 *     def ellsub(E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the points :math:`z1` and :math:`z2` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_499ellsub(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_498ellsub[] = "\n        Difference of the points :math:`z1` and :math:`z2` on the\n        elliptic curve corresponding to :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_499ellsub(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z1 = 0;
  PyObject *__pyx_v_z2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellsub (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z1,&__pyx_n_s_z2,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_z1)) != 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_z2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellsub", 1, 2, 2, 1); __PYX_ERR(10, 8536, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellsub") < 0)) __PYX_ERR(10, 8536, __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_z1 = values[0];
    __pyx_v_z2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellsub", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8536, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_498ellsub(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_z1, __pyx_v_z2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_498ellsub(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z1, PyObject *__pyx_v_z2) {
  GEN __pyx_v__E;
  GEN __pyx_v__z1;
  GEN __pyx_v__z2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellsub", 0);
  __Pyx_INCREF(__pyx_v_z1);
  __Pyx_INCREF(__pyx_v_z2);

  /* "cypari/auto_gen.pxi":8541
 *         elliptic curve corresponding to :math:`E`.
 *         '''
 *         z1 = objtogen(z1)             # <<<<<<<<<<<<<<
 *         z2 = objtogen(z2)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z1, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z1, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8542
 *         '''
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8543
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8543, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8544
 *         z2 = objtogen(z2)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8545
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z1)->__pyx_base.g;
  __pyx_v__z1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8546
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z2)->__pyx_base.g;
  __pyx_v__z2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8547
 *         cdef GEN _z1 = (<Gen>z1).g
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellsub(__pyx_v__E, __pyx_v__z1, __pyx_v__z2);

  /* "cypari/auto_gen.pxi":8548
 *         cdef GEN _z2 = (<Gen>z2).g
 *         cdef GEN _ret = ellsub(_E, _z1, _z2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltamagawa(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8536
 *         return new_gen(_ret)
 * 
 *     def ellsub(E, z1, z2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the points :math:`z1` and :math:`z2` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellsub", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z1);
  __Pyx_XDECREF(__pyx_v_z2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8550
 *         return new_gen(_ret)
 * 
 *     def elltamagawa(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns the global
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_501elltamagawa(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_500elltamagawa[] = "\n        The object :math:`E` being an elliptic curve over a number field, returns the global\n        Tamagawa number of the curve (including the factor at infinite places).\n        \n        ::\n        \n            ? e = ellinit([1, -1, 1, -3002, 63929]); \\\\ curve \"90c6\" from elldata\n            ? elltamagawa(e)\n            %2 = 288\n            ? [elllocalred(e,p)[4] | p<-[2,3,5]]\n            %3 = [6, 4, 6]\n            ? vecprod(%) \\\\ since e.disc > 0 the factor at infinity is 2\n            %4 = 144\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_501elltamagawa(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltamagawa (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_500elltamagawa(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_500elltamagawa(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("elltamagawa", 0);

  /* "cypari/auto_gen.pxi":8565
 *             %4 = 144
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltamagawa(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8565, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8566
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltamagawa(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8567
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltamagawa(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltamagawa(__pyx_v__E);

  /* "cypari/auto_gen.pxi":8568
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltamagawa(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltaniyama(E, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8550
 *         return new_gen(_ret)
 * 
 *     def elltamagawa(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         The object :math:`E` being an elliptic curve over a number field, returns the global
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltamagawa", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8570
 *         return new_gen(_ret)
 * 
 *     def elltaniyama(E, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the modular parametrization of the elliptic curve :math:`E/\mathbb{Q}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_503elltaniyama(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_502elltaniyama[] = "\n        Computes the modular parametrization of the elliptic curve :math:`E/\\mathbb{Q}`,\n        where :math:`E` is an :literal:`ell` structure as output by :literal:`ellinit`. This returns\n        a two-component vector :math:`[u,v]` of power series, given to :math:`d` significant\n        terms (:literal:`seriesprecision` by default), characterized by the following two\n        properties. First the point :math:`(u,v)` satisfies the equation of the elliptic\n        curve. Second, let :math:`N` be the conductor of :math:`E` and :math:`\\Phi: X_0(N)\\to E`\n        be a modular parametrization; the pullback by :math:`\\Phi` of the\n        N\303\251ron differential :math:`du/(2v+a_1u+a_3)` is equal to :math:`2i\\pi\n        f(z)dz`, a holomorphic differential form. The variable used in the power\n        series for :math:`u` and :math:`v` is :math:`x`, which is implicitly understood to be equal to\n        :math:`\\exp (2i\\pi z)`.\n        \n        The algorithm assumes that :math:`E` is a :emphasis:`strong` Weil curve\n        and that the Manin constant is equal to 1: in fact, :math:`f(x) = \\sum_{n > 0}\n        ellan (E, n) x^n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_503elltaniyama(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltaniyama (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elltaniyama") < 0)) __PYX_ERR(10, 8570, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8570, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elltaniyama", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8570, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltaniyama", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_502elltaniyama(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_serprec);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_502elltaniyama(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_serprec) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("elltaniyama", 0);

  /* "cypari/auto_gen.pxi":8588
 *         ellan (E, n) x^n`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8588, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8589
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8590
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":8591
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":8590
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 */
  }

  /* "cypari/auto_gen.pxi":8592
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltaniyama(__pyx_v__E, __pyx_v_serprec);

  /* "cypari/auto_gen.pxi":8593
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = elltaniyama(_E, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltatepairing(E, P, Q, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 8593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8570
 *         return new_gen(_ret)
 * 
 *     def elltaniyama(E, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the modular parametrization of the elliptic curve :math:`E/\mathbb{Q}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltaniyama", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8595
 *         return new_gen(_ret)
 * 
 *     def elltatepairing(E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Tate pairing of the two points :math:`P` and :math:`Q` on the elliptic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_505elltatepairing(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_504elltatepairing[] = "\n        Computes the Tate pairing of the two points :math:`P` and :math:`Q` on the elliptic\n        curve :math:`E`. The point :math:`P` must be of :math:`m`-torsion.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_505elltatepairing(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltatepairing (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_m,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elltatepairing", 1, 3, 3, 1); __PYX_ERR(10, 8595, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("elltatepairing", 1, 3, 3, 2); __PYX_ERR(10, 8595, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elltatepairing") < 0)) __PYX_ERR(10, 8595, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_P = values[0];
    __pyx_v_Q = values[1];
    __pyx_v_m = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elltatepairing", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8595, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltatepairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_504elltatepairing(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_P, __pyx_v_Q, __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_504elltatepairing(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("elltatepairing", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_gen.pxi":8600
 *         curve :math:`E`. The point :math:`P` must be of :math:`m`-torsion.
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8601
 *         '''
 *         P = objtogen(P)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8602
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8603
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8603, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8604
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8605
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8606
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8607
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8608
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltatepairing(__pyx_v__E, __pyx_v__P, __pyx_v__Q, __pyx_v__m);

  /* "cypari/auto_gen.pxi":8609
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = elltatepairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltors(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8595
 *         return new_gen(_ret)
 * 
 *     def elltatepairing(E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Tate pairing of the two points :math:`P` and :math:`Q` on the elliptic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltatepairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8611
 *         return new_gen(_ret)
 * 
 *     def elltors(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve defined over a number field or a finite field,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_507elltors(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_506elltors[] = "\n        If :math:`E` is an elliptic curve defined over a number field or a finite field,\n        outputs the torsion subgroup of :math:`E` as a 3-component vector :literal:`[t,v1,v2]`,\n        where :literal:`t` is the order of the torsion group, :literal:`v1` gives the structure\n        of the torsion group as a product of cyclic groups (sorted by decreasing\n        order), and :literal:`v2` gives generators for these cyclic groups. :math:`E` must be an\n        :literal:`ell` structure as output by :literal:`ellinit`.\n        \n        ::\n        \n            ? E = ellinit([-1,0]);\n            ? elltors(E)\n            %1 = [4, [2, 2], [[0, 0], [1, 0]]]\n        \n        Here, the torsion subgroup is isomorphic to :math:`\\mathbb{Z}/2\\mathbb{Z} x \\mathbb{Z}/2\\mathbb{Z}`, with\n        generators :math:`[0,0]` and :math:`[1,0]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_507elltors(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltors (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_506elltors(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_506elltors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("elltors", 0);

  /* "cypari/auto_gen.pxi":8629
 *         generators :math:`[0,0]` and :math:`[1,0]`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltors(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8629, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8630
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltors(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8631
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltors(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltors(__pyx_v__E);

  /* "cypari/auto_gen.pxi":8632
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = elltors(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def elltwist(E, P=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8611
 *         return new_gen(_ret)
 * 
 *     def elltors(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`E` is an elliptic curve defined over a number field or a finite field,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8634
 *         return new_gen(_ret)
 * 
 *     def elltwist(E, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of the twist of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_509elltwist(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_508elltwist[] = "\n        Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of the twist of the\n        elliptic curve :math:`E` by the quadratic extension of the coefficient ring\n        defined by :math:`P` (when :math:`P` is a polynomial) or :literal:`quadpoly(P)` when :math:`P` is an\n        integer. If :math:`E` is defined over a finite field, then :math:`P` can be omitted,\n        in which case a random model of the unique non-trivial twist is returned.\n        If :math:`E` is defined over a number field, the model should be replaced by a\n        minimal model (if one exists).\n        \n        Example: Twist by discriminant :math:`-3`:\n        \n        ::\n        \n            ? elltwist(ellinit([0,a2,0,a4,a6]),-3)\n            %1 = [0,-3*a2,0,9*a4,-27*a6]\n        \n        Twist by the Artin-Shreier extension given by :math:`x^2+x+T` in\n        characteristic :math:`2`:\n        \n        ::\n        \n            ? lift(elltwist(ellinit([a1,a2,a3,a4,a6]*Mod(1,2)),x^2+x+T))\n            %1 = [a1,a2+a1^2*T,a3,a4,a6+a3^2*T]\n        \n        Twist of an elliptic curve defined over a finite field:\n        \n        ::\n        \n            ? E=ellinit([1,7]*Mod(1,19));lift(elltwist(E))\n            %1 = [0,0,0,11,12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_509elltwist(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltwist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "elltwist") < 0)) __PYX_ERR(10, 8634, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("elltwist", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8634, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_508elltwist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_P);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_508elltwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P) {
  int __pyx_v__have_P;
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("elltwist", 0);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_gen.pxi":8666
 *             %1 = [0,0,0,11,12]
 *         '''
 *         cdef bint _have_P = (P is not None)             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             P = objtogen(P)
 */
  __pyx_t_1 = (__pyx_v_P != Py_None);
  __pyx_v__have_P = __pyx_t_1;

  /* "cypari/auto_gen.pxi":8667
 *         '''
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_P != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8668
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:
 *             P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8668, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":8667
 *         '''
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":8669
 *         if _have_P:
 *             P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 8669, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8670
 *             P = objtogen(P)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = NULL
 *         if _have_P:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8671
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             _P = (<Gen>P).g
 */
  __pyx_v__P = NULL;

  /* "cypari/auto_gen.pxi":8672
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)
 */
  __pyx_t_1 = (__pyx_v__have_P != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8673
 *         cdef GEN _P = NULL
 *         if _have_P:
 *             _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = elltwist(_E, _P)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
    __pyx_v__P = __pyx_t_4;

    /* "cypari/auto_gen.pxi":8672
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)
 */
  }

  /* "cypari/auto_gen.pxi":8674
 *         if _have_P:
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = elltwist(__pyx_v__E, __pyx_v__P);

  /* "cypari/auto_gen.pxi":8675
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = elltwist(_E, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellweilpairing(E, P, Q, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8634
 *         return new_gen(_ret)
 * 
 *     def elltwist(E, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the coefficients :math:`[a_1,a_2,a_3,a_4,a_6]` of the twist of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.elltwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8677
 *         return new_gen(_ret)
 * 
 *     def ellweilpairing(E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Weil pairing of the two points of :math:`m`-torsion :math:`P` and :math:`Q`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_511ellweilpairing(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_510ellweilpairing[] = "\n        Computes the Weil pairing of the two points of :math:`m`-torsion :math:`P` and :math:`Q`\n        on the elliptic curve :math:`E`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_511ellweilpairing(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellweilpairing (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_m,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellweilpairing", 1, 3, 3, 1); __PYX_ERR(10, 8677, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellweilpairing", 1, 3, 3, 2); __PYX_ERR(10, 8677, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellweilpairing") < 0)) __PYX_ERR(10, 8677, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_P = values[0];
    __pyx_v_Q = values[1];
    __pyx_v_m = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellweilpairing", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8677, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellweilpairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_510ellweilpairing(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_P, __pyx_v_Q, __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_510ellweilpairing(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, PyObject *__pyx_v_m) {
  GEN __pyx_v__E;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellweilpairing", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_gen.pxi":8682
 *         on the elliptic curve :math:`E`.
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8683
 *         '''
 *         P = objtogen(P)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8684
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8685
 *         Q = objtogen(Q)
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8685, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8686
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8687
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8688
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8689
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8690
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellweilpairing(__pyx_v__E, __pyx_v__P, __pyx_v__Q, __pyx_v__m);

  /* "cypari/auto_gen.pxi":8691
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ellweilpairing(_E, _P, _Q, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellwp(w, z=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8677
 *         return new_gen(_ret)
 * 
 *     def ellweilpairing(E, P, Q, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Weil pairing of the two points of :math:`m`-torsion :math:`P` and :math:`Q`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellweilpairing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8693
 *         return new_gen(_ret)
 * 
 *     def ellwp(w, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\wp` function attached to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_513ellwp(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_512ellwp[] = "\n        Computes the value at :math:`z` of the Weierstrass :math:`\\wp` function attached to\n        the lattice :math:`w` as given by :literal:`ellperiods`. It is also possible to\n        directly input :math:`w = [\\omega_1,\\omega_2]`, or an elliptic curve :math:`E` as given\n        by :literal:`ellinit` (:math:`w = E.omega`).\n        \n        ::\n        \n            ? w = ellperiods([1,I]);\n            ? ellwp(w, 1/2)\n            %2 = 6.8751858180203728274900957798105571978\n            ? E = ellinit([1,1]);\n            ? ellwp(E, 1/2)\n            %4 = 3.9413112427016474646048282462709151389\n        \n        One can also compute the series expansion around :math:`z = 0`:\n        \n        ::\n        \n            ? E = ellinit([1,0]);\n            ? ellwp(E) \\\\ 'x implicitly at default seriesprecision\n            %5 = x^-2 - 1/5*x^2 + 1/75*x^6 - 2/4875*x^10 + O(x^14)\n            ? ellwp(E, x + O(x^12)) \\\\ explicit precision\n            %6 = x^-2 - 1/5*x^2 + 1/75*x^6 + O(x^9)\n        \n        Optional :emphasis:`flag` means 0 (default): compute only :math:`\\wp (z)`, 1: compute\n        :math:`[\\wp (z),\\wp'(z)]`.\n        \n        For instance, the Dickson elliptic functions :emphasis:`sm` and :emphasis:`sn` can be\n        implemented as follows\n        \n        ::\n        \n             smcm(z) =\n             { my(a, b, E = ellinit([0,-1/(4*27)])); \\\\ ell. invariants (g2,g3)=(0,1/27)\n             [a,b] = ellwp(E, z, 1);\n             [6*a / (1-3*b), (3*b+1)/(3*b-1)];\n             }\n             ? [s,c] = smcm(0.5);\n             ? s\n             %2 = 0.4898258757782682170733218609\n             ? c\n             %3 = 0.9591820206453842491187464098\n             ? s^3+c^3\n             %4 = 1.000000000000000000000000000\n             ? smcm('x + O('x^11))\n             %5 = [x - 1/6*x^4 + 2/63*x^7 - 13/2268*x^10 + O(x^11),\n             1 - 1/3*x^3 + 1/18*x^6 - 23/2268*x^9 + O(x^10)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_513ellwp(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellwp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellwp") < 0)) __PYX_ERR(10, 8693, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8693, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8693, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellwp", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8693, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellwp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_512ellwp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_w), __pyx_v_z, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_512ellwp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_z;
  GEN __pyx_v__w;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellwp", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":8743
 *              1 - 1/3*x^3 + 1/18*x^6 - 23/2268*x^9 + O(x^10)]
 *         '''
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_1 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_1;

  /* "cypari/auto_gen.pxi":8744
 *         '''
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_z != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8745
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8745, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":8744
 *         '''
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":8746
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 8746, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8747
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8748
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_gen.pxi":8749
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_z != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8750
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_gen.pxi":8749
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":8751
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8752
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellwp0(__pyx_v__w, __pyx_v__z, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8753
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellwp0(_w, _z, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellxn(E, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8693
 *         return new_gen(_ret)
 * 
 *     def ellwp(w, z=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\wp` function attached to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellwp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8755
 *         return new_gen(_ret)
 * 
 *     def ellxn(E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         In standard notation, for any affine point :math:`P = (v,w)` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_515ellxn(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_514ellxn[] = "\n        In standard notation, for any affine point :math:`P = (v,w)` on the\n        curve :math:`E`, we have\n        \n        .. MATH::\n        \n            [n]P = (\\phi_n(P)\\psi_n(P) : \\omega_n(P) : \\psi_n(P)^3)\n        \n        for some polynomials :math:`\\phi_n,\\omega_n,\\psi_n` in\n        :math:`\\mathbb{Z}[a_1,a_2,a_3,a_4,a_6][v,w]`. This function returns\n        :math:`[\\phi_n(P),\\psi_n(P)^2]`, which give the numerator and denominator of\n        the abscissa of :math:`[n]P` and depend only on :math:`v`.\n        \n        ::\n        \n            ? E = ellinit([17,42]);\n            ? T = ellxn(E, 2, 'X)\n            %2 = [X^4 - 34*X^2 - 336*X + 289, 4*X^3 + 68*X + 168]\n            ? P = [114,1218]; ellmul(E,P,2)\n            %3 = [200257/7056, 90637343/592704]\n            ? [x,y] = subst(T,'X,P[1]) \\\\ substitute P[1] in ellxn(E,2)\n            %4 = [168416137, 5934096] \\\\ numerator and denominator of 2*P\n            ? x/y \\\\ check we find ellmul(e,P,2)[1]\n            %5 = 200257/7056\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_515ellxn(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellxn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellxn") < 0)) __PYX_ERR(10, 8755, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8755, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellxn", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8755, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellxn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_514ellxn(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_n, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_514ellxn(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ellxn", 0);

  /* "cypari/auto_gen.pxi":8781
 *             %5 = 200257/7056
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":8782
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":8783
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 8783, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":8782
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":8784
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellxn(_E, n, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 8784, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8785
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellxn(_E, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_5;

  /* "cypari/auto_gen.pxi":8786
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellxn(_E, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellxn(__pyx_v__E, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_gen.pxi":8787
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = ellxn(_E, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellzeta(w, z=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 8787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8755
 *         return new_gen(_ret)
 * 
 *     def ellxn(E, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         In standard notation, for any affine point :math:`P = (v,w)` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellxn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8789
 *         return new_gen(_ret)
 * 
 *     def ellzeta(w, z=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\zeta` function attached to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_517ellzeta(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_516ellzeta[] = "\n        Computes the value at :math:`z` of the Weierstrass :math:`\\zeta` function attached to\n        the lattice :math:`w` as given by :literal:`ellperiods`:math:`(,1)`: including quasi-periods\n        is useful, otherwise there are recomputed from scratch for each new :math:`z`.\n        \n        .. MATH::\n        \n            \\zeta (z, L) = (1)/(z) + z^2\\sum_{\\omega\\in L^*}\n            (1)/(\\omega^2(z-\\omega)).\n        \n        It is also possible to directly input :math:`w = [\\omega_1,\\omega_2]`,\n        or an elliptic curve :math:`E` as given by :literal:`ellinit` (:math:`w = E.omega`).\n        The quasi-periods of :math:`\\zeta`, such that\n        \n        .. MATH::\n        \n            \\zeta (z + a\\omega_1 + b\\omega_2) = \\zeta (z) + a\\eta_1 + b\\eta_2\n        \n        for integers :math:`a` and :math:`b` are obtained as :math:`\\eta_i = 2\\zeta (\\omega_i/2)`.\n        Or using directly :literal:`elleta`.\n        \n        ::\n        \n            ? w = ellperiods([1,I],1);\n            ? ellzeta(w, 1/2)\n            %2 = 1.5707963267948966192313216916397514421\n            ? E = ellinit([1,0]);\n            ? ellzeta(E, E.omega[1]/2)\n            %4 = 0.84721308479397908660649912348219163647\n        \n        One can also compute the series expansion around :math:`z = 0`\n        (the quasi-periods are useless in this case):\n        \n        ::\n        \n            ? E = ellinit([0,1]);\n            ? ellzeta(E) \\\\ at 'x, implicitly at default seriesprecision\n            %4 = x^-1 + 1/35*x^5 - 1/7007*x^11 + O(x^15)\n            ? ellzeta(E, x + O(x^20)) \\\\ explicit precision\n            %5 = x^-1 + 1/35*x^5 - 1/7007*x^11 + 1/1440257*x^17 + O(x^18)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_517ellzeta(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellzeta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellzeta") < 0)) __PYX_ERR(10, 8789, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8789, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellzeta", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8789, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellzeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_516ellzeta(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_w), __pyx_v_z, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_516ellzeta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, PyObject *__pyx_v_z, long __pyx_v_precision) {
  int __pyx_v__have_z;
  GEN __pyx_v__w;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("ellzeta", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":8831
 *             %5 = x^-1 + 1/35*x^5 - 1/7007*x^11 + 1/1440257*x^17 + O(x^18)
 *         '''
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_1 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_1;

  /* "cypari/auto_gen.pxi":8832
 *         '''
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_z != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8833
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":8832
 *         '''
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":8834
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 8834, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8835
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_4;

  /* "cypari/auto_gen.pxi":8836
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_gen.pxi":8837
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_z != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":8838
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellzeta(_w, _z, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_gen.pxi":8837
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":8839
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ellzeta(_w, _z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8840
 *             _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellzeta(_w, _z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ellzeta(__pyx_v__w, __pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8841
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ellzeta(_w, _z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ellztopoint(E, z, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 8841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8789
 *         return new_gen(_ret)
 * 
 *     def ellzeta(w, z=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the value at :math:`z` of the Weierstrass :math:`\zeta` function attached to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellzeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8843
 *         return new_gen(_ret)
 * 
 *     def ellztopoint(E, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :emphasis:`ell` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_519ellztopoint(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_518ellztopoint[] = "\n        :math:`E` being an :emphasis:`ell` as output by\n        :literal:`ellinit`, computes the coordinates :math:`[x,y]` on the curve :math:`E`\n        corresponding to the complex or :math:`p`-adic parameter :math:`z`. Hence this is the\n        inverse function of :literal:`ellpointtoz`.\n        \n        - If :math:`E` is defined over a :math:`p`-adic field and has multiplicative\n          reduction, then :math:`z` is understood as an element on the\n          Tate curve :math:`\\bar{Q}_p^* / q^\\mathbb{Z}`.\n        \n        ::\n        \n            ? E = ellinit([0,-1,1,0,0], O(11^5));\n            ? [u2,u,q] = E.tate; type(u)\n            %2 = \"t_PADIC\" \\\\ split multiplicative reduction\n            ? z = ellpointtoz(E, [0,0])\n            %3 = 3 + 11^2 + 2*11^3 + 3*11^4 + 6*11^5 + 10*11^6 + 8*11^7 + O(11^8)\n            ? ellztopoint(E,z)\n            %4 = [O(11^9), O(11^9)]\n            \n            ? E = ellinit(ellfromj(1/4), O(2^6)); x=1/2; y=ellordinate(E,x)[1];\n            ? z = ellpointtoz(E,[x,y]); \\\\ non-split: t_POLMOD with t_PADIC coefficients\n            ? P = ellztopoint(E, z);\n            ? P[1] \\\\ y coordinate is analogous, more complicated\n            %8 = Mod(O(2^4)*x + (2^-1 + O(2^5)), x^2 + (1 + 2^2 + 2^4 + 2^5 + O(2^7)))\n        \n        - If :math:`E` is defined over the complex numbers (for instance over :math:`\\mathbb{Q}`),\n          :math:`z` is understood as a complex number in :math:`\\mathbb{C}/\\Lambda_E`. If the\n          short Weierstrass equation is :math:`y^2 = 4x^3 - g_2x - g_3`, then :math:`[x,y]`\n          represents the Weierstrass :math:`\\wp`-function\n          and its derivative. For a general Weierstrass equation we have\n          \n        \n        .. MATH::\n        \n            x = \\wp (z) - b_2/12, y = \\wp'(z)/2 - (a_1 x + a_3)/2.\n        \n          If :math:`z` is in the lattice defining :math:`E` over :math:`\\mathbb{C}`, the result is the point at\n          infinity :math:`[0""]`.\n        \n        ::\n        \n            ? E = ellinit([0,1]); P = [2,3];\n            ? z = ellpointtoz(E, P)\n            %2 = 3.5054552633136356529375476976257353387\n            ? ellwp(E, z)\n            %3 = 2.0000000000000000000000000000000000000\n            ? ellztopoint(E, z) - P\n            %4 = [2.548947057811923643 E-57, 7.646841173435770930 E-57]\n            ? ellztopoint(E, 0)\n            %5 = [0] \\\\ point at infinity\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_519ellztopoint(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellztopoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_precision,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_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellztopoint") < 0)) __PYX_ERR(10, 8843, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8843, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellztopoint", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellztopoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_518ellztopoint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_z, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_518ellztopoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, PyObject *__pyx_v_z, long __pyx_v_precision) {
  GEN __pyx_v__E;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ellztopoint", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":8896
 *             %5 = [0] \\ point at infinity
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":8897
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 8897, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8898
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8899
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = pointell(_E, _z, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_gen.pxi":8900
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pointell(_E, _z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8901
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = pointell(_E, _z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pointell(__pyx_v__E, __pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8902
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = pointell(_E, _z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def erfc(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 8902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8843
 *         return new_gen(_ret)
 * 
 *     def ellztopoint(E, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an :emphasis:`ell` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ellztopoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8904
 *         return new_gen(_ret)
 * 
 *     def erfc(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary error function, analytic continuation of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_521erfc(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_520erfc[] = "\n        Complementary error function, analytic continuation of\n        :math:`(2/\\sqrt\\pi)\\int_x^ oo e^{-t^2}dt = incgam (1/2,x^2)/\\sqrt\\pi`,\n        where the latter expression extends the function definition from real :math:`x` to\n        all complex :math:`x != 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_521erfc(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("erfc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "erfc") < 0)) __PYX_ERR(10, 8904, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8904, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("erfc", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8904, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.erfc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_520erfc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_520erfc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("erfc", 0);

  /* "cypari/auto_gen.pxi":8911
 *         all complex :math:`x != 0`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8911, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8912
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gerfc(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8913
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gerfc(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8914
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gerfc(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gerfc(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8915
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gerfc(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def errname(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8904
 *         return new_gen(_ret)
 * 
 *     def erfc(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary error function, analytic continuation of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.erfc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8917
 *         return new_gen(_ret)
 * 
 *     def errname(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the type of the error message :literal:`E` as a string.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_523errname(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_522errname[] = "\n        Returns the type of the error message :literal:`E` as a string.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_523errname(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("errname (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_522errname(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_522errname(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("errname", 0);

  /* "cypari/auto_gen.pxi":8921
 *         Returns the type of the error message :literal:`E` as a string.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = errname(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8921, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8922
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = errname(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8923
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = errname(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = errname(__pyx_v__E);

  /* "cypari/auto_gen.pxi":8924
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = errname(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def eta(z, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8917
 *         return new_gen(_ret)
 * 
 *     def errname(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the type of the error message :literal:`E` as a string.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.errname", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8926
 *         return new_gen(_ret)
 * 
 *     def eta(z, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variants of Dedekind's :math:`\eta` function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_525eta(PyObject *__pyx_v_z, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_524eta[] = "\n        Variants of Dedekind's :math:`\\eta` function.\n        If :math:`flag = 0`, return :math:`\\prod_{n = 1}^ oo (1-q^n)`, where :math:`q` depends on :math:`x`\n        in the following way:\n        \n        - :math:`q = e^{2i\\pi x}` if :math:`x` is a :emphasis:`complex number` (which must then\n          have positive imaginary part); notice that the factor :math:`q^{1/24}` is\n          missing!\n        \n        - :math:`q = x` if :math:`x` is a :literal:`t_PADIC`, or can be converted to a\n          :emphasis:`power series` (which must then have positive valuation).\n        \n        If :math:`flag` is non-zero, :math:`x` is converted to a complex number and we return the\n        true :math:`\\eta` function, :math:`q^{1/24}\\prod_{n = 1}^ oo (1-q^n)`,\n        where :math:`q = e^{2i\\pi x}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_525eta(PyObject *__pyx_v_z, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eta") < 0)) __PYX_ERR(10, 8926, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8926, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8926, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("eta", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8926, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.eta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_524eta(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_z), __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_524eta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("eta", 0);

  /* "cypari/auto_gen.pxi":8943
 *         where :math:`q = e^{2i\pi x}`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8943, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8944
 *         '''
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = eta0(_z, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8945
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = eta0(_z, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8946
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = eta0(_z, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = eta0(__pyx_v__z, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8947
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = eta0(_z, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def eulerphi(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8926
 *         return new_gen(_ret)
 * 
 *     def eta(z, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variants of Dedekind's :math:`\eta` function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.eta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8949
 *         return new_gen(_ret)
 * 
 *     def eulerphi(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Euler's :math:`\phi` (totient) function of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_527eulerphi(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_526eulerphi[] = "\n        Euler's :math:`\\phi` (totient) function of the\n        integer :math:`\\|x\\|`, in other words :math:`\\|(\\mathbb{Z}/x\\mathbb{Z})^*\\|`.\n        \n        ::\n        \n            ? eulerphi(40)\n            %1 = 16\n        \n        According to this definition we let :math:`\\phi (0) := 2`, since :math:`\\mathbb{Z}^ *= {-1,1}`;\n        this is consistent with :literal:`znstar(0)`: we have\n        :literal:`znstar:math:`(n)`.no = eulerphi(n)` for all :math:`n\\in\\mathbb{Z}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_527eulerphi(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eulerphi (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_526eulerphi(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_526eulerphi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("eulerphi", 0);

  /* "cypari/auto_gen.pxi":8963
 *         :literal:`znstar:math:`(n)`.no = eulerphi(n)` for all :math:`n\in\mathbb{Z}`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = eulerphi(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8963, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8964
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = eulerphi(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8965
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = eulerphi(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = eulerphi(__pyx_v__x);

  /* "cypari/auto_gen.pxi":8966
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = eulerphi(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def exp(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8949
 *         return new_gen(_ret)
 * 
 *     def eulerphi(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Euler's :math:`\phi` (totient) function of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.eulerphi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8968
 *         return new_gen(_ret)
 * 
 *     def exp(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_529exp(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_528exp[] = "\n        Exponential of :math:`x`.\n        :math:`p`-adic arguments with positive valuation are accepted.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_529exp(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "exp") < 0)) __PYX_ERR(10, 8968, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8968, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("exp", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8968, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_528exp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_528exp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("exp", 0);

  /* "cypari/auto_gen.pxi":8973
 *         :math:`p`-adic arguments with positive valuation are accepted.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 8973, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":8974
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexp(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":8975
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gexp(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":8976
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexp(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gexp(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":8977
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexp(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def expm1(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 8977, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8968
 *         return new_gen(_ret)
 * 
 *     def exp(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Exponential of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.exp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":8979
 *         return new_gen(_ret)
 * 
 *     def expm1(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\exp (x)-1`, computed in a way that is also accurate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_531expm1(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_530expm1[] = "\n        Return :math:`\\exp (x)-1`, computed in a way that is also accurate\n        when the real part of :math:`x` is near :math:`0`.\n        A naive direct computation would suffer from catastrophic cancellation;\n        PARI's direct computation of :math:`\\exp (x)` alleviates this well known problem at\n        the expense of computing :math:`\\exp (x)` to a higher accuracy when :math:`x` is small.\n        Using :literal:`expm1` is recommended instead:\n        \n        ::\n        \n            ? default(realprecision, 10000); x = 1e-100;\n            ? a = expm1(x);\n            time = 4 ms.\n            ? b = exp(x)-1;\n            time = 4 ms.\n            ? default(realprecision, 10040); x = 1e-100;\n            ? c = expm1(x); \\\\ reference point\n            ? abs(a-c)/c \\\\ relative error in expm1(x)\n            %7 = 1.4027986153764843997 E-10019\n            ? abs(b-c)/c \\\\ relative error in exp(x)-1\n            %8 = 1.7907031188259675794 E-9919\n        \n        As the example above shows, when :math:`x` is near :math:`0`,\n        :literal:`expm1` is more accurate than :literal:`exp(x)-1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_531expm1(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("expm1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "expm1") < 0)) __PYX_ERR(10, 8979, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 8979, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("expm1", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 8979, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.expm1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_530expm1(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_530expm1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("expm1", 0);

  /* "cypari/auto_gen.pxi":9005
 *         :literal:`expm1` is more accurate than :literal:`exp(x)-1`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 9005, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9006
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexpm1(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":9007
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gexpm1(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":9008
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexpm1(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gexpm1(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":9009
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gexpm1(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def exponent(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 9009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":8979
 *         return new_gen(_ret)
 * 
 *     def expm1(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\exp (x)-1`, computed in a way that is also accurate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.expm1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9011
 *         return new_gen(_ret)
 * 
 *     def exponent(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a :literal:`t_REAL`, the result is the binary exponent :math:`e` of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_533exponent(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_532exponent[] = "\n        When :math:`x` is a :literal:`t_REAL`, the result is the binary exponent :math:`e` of :math:`x`.\n        For a non-zero :math:`x`, this is the unique integer :math:`e` such that\n        :math:`2^e <= \\|x\\| < 2^{e+1}`. For a real :math:`0`, this returns the PARI exponent :math:`e`\n        attached to :math:`x` (which may represent any floating-point number less than\n        :math:`2^e` in absolute value).\n        \n        ::\n        \n            ? exponent(Pi)\n            %1 = 1\n            ? exponent(4.0)\n            %2 = 2\n            ? exponent(0.0)\n            %3 = -128\n            ? default(realbitprecision)\n            %4 = 128\n        \n        This definition extends naturally to non-zero integers,\n        and the exponent of an exact :math:`0` is :math:`-oo` by convention.\n        \n        For convenience, we :emphasis:`define` the exponent of a :literal:`t_FRAC` :math:`a/b` as\n        the difference of :literal:`exponent`:math:`(a)` and :literal:`exponent`:math:`(b)`; note that,\n        if :math:`e'` denotes the exponent of :literal:`:math:`a/b` * 1.0`, then the exponent :math:`e`\n        we return is either :math:`e'` or :math:`e'+1`, thus :math:`2^{e+1}` is an upper bound for\n        :math:`\\|a/b\\|`.\n        \n        ::\n        \n            ? [ exponent(9), exponent(10), exponent(9/10), exponent(9/10*1.) ]\n            %5 = [3, 3, 0, -1]\n        \n        For a PARI object of type :literal:`t_COMPLEX`, :literal:`t_POL`, :literal:`t_SER`, :literal:`t_VEC`,\n        :literal:`t_COL`, :literal:`t_MAT` this returns the largest exponent found among the\n        components of :math:`x`. Hence :math:`2^{e+1}` is a quick upper bound for the sup norm\n        of real matrices or polynomials; and :math:`2^{e+(3/2)}` for complex ones.\n        \n        ::\n        \n            ? exponent(3*x^2 + 15*x - 100)\n            %5 = 6\n            ? exponent(0)\n            %6 = -oo\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_533exponent(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("exponent (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_532exponent(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_532exponent(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("exponent", 0);

  /* "cypari/auto_gen.pxi":9056
 *             %6 = -oo
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpexponent(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 9056, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9057
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpexponent(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":9058
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpexponent(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpexponent(__pyx_v__x);

  /* "cypari/auto_gen.pxi":9059
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpexponent(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factor(x, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 9059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9011
 *         return new_gen(_ret)
 * 
 *     def exponent(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         When :math:`x` is a :literal:`t_REAL`, the result is the binary exponent :math:`e` of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.exponent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9061
 *         return new_gen(_ret)
 * 
 *     def factor(x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor :math:`x` over domain :math:`D`; if :math:`D` is omitted, it is determined from :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_535factor(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_534factor[] = "\n        Factor :math:`x` over domain :math:`D`; if :math:`D` is omitted, it is determined from :math:`x`.\n        For instance, if :math:`x` is an integer, it is factored in :math:`\\mathbb{Z}`, if it is a\n        polynomial with rational coefficients, it is factored in :math:`\\mathbb{Q}[x]`, etc., see\n        below for details. The result is a two-column matrix: the first contains the\n        irreducibles dividing :math:`x` (rational or Gaussian primes, irreducible\n        polynomials), and the second the exponents. By convention, :math:`0` is factored\n        as :math:`0^1`.\n        \n        :strong:`:math:`x \\in \\mathbb{Q}`.`\n        See :literal:`factorint` for the algorithms used. The factorization includes the\n        unit :math:`-1` when :math:`x < 0` and all other factors are positive; a denominator is\n        factored with negative exponents. The factors are sorted in increasing order.\n        \n        ::\n        \n            ? factor(-7/106)\n            %1 =\n            [-1 1]\n            \n            [ 2 -1]\n            \n            [ 7 1]\n            \n            [53 -1]\n        \n        By convention, :math:`1` is factored as :literal:`matrix(0,2)`\n        (the empty factorization, printed as :literal:`[;]`).\n        \n        Large rational \"primes\" :math:`> 2^{64}` in the factorization are in fact\n        :emphasis:`pseudoprimes` (see :literal:`ispseudoprime`), a priori not rigorously proven\n        primes. Use :literal:`isprime` to prove primality of these factors, as in\n        \n        ::\n        \n            ? fa = factor(2^2^7 + 1)\n            %1 =\n            [59649589127497217 1]\n            \n            [5704689200685129054721 1]\n            \n            ? isprime( fa[,1] )\n            %2 = [1, 1]~ \\\\ both entries are proven primes\n        \n        Another possibility is to globally set the default :literal:`factor_proven`, which\n        will perform a rigorous primality proof for each pseudo""prime factor but will\n        slow down PARI.\n        \n        A :literal:`t_INT` argument :math:`D` can be added, meaning that we look only for\n        prime factors :math:`p < D`. The limit :math:`D` must be non-negative.\n        In this case, all but the last factor are proven primes, but the remaining\n        factor may actually be a proven composite! If the remaining factor is less\n        than :math:`D^2`, then it is prime.\n        \n        ::\n        \n            ? factor(2^2^7 +1, 10^5)\n            %3 =\n            [340282366920938463463374607431768211457 1]\n        \n        :strong:`Deprecated feature.` Setting :math:`D = 0` is the same\n        as setting it to :math:`primelimit + 1`.\n        \n        This routine uses trial division and perfect power tests, and should not be\n        used for huge values of :math:`D` (at most :math:`10^9`, say):\n        :literal:`factorint(, 1 + 8)` will in general be faster. The latter does not\n        guarantee that all small prime factors are found, but it also finds larger\n        factors and in a more efficient way.\n        \n        ::\n        \n            ? F = (2^2^7 + 1) * 1009 * (10^5+3); factor(F, 10^5) \\\\ fast, incomplete\n            time = 0 ms.\n            %4 =\n            [1009 1]\n            \n            [34029257539194609161727850866999116450334371 1]\n            \n            ? factor(F, 10^9) \\\\ slow\n            time = 3,260 ms.\n            %6 =\n            [1009 1]\n            \n            [100003 1]\n            \n            [340282366920938463463374607431768211457 1]\n            \n            ? factorint(F, 1+8) \\\\ much faster and all small primes were found\n            time = 8 ms.\n            %7 =\n            [1009 1]\n            \n            [100003 1]\n            \n            [340282366920938463463374607431768211457 1]\n            \n            ? factor(F) \\\\ complete factorization\n            time = 60 ms.\n            %8 =\n            [1009 ""1]\n            \n            [100003 1]\n            \n            [59649589127497217 1]\n            \n            [5704689200685129054721 1]\n        \n        Setting :math:`D = I` will factor in the Gaussian integers\n        :math:`\\mathbb{Z}[i]`:\n        \n        :strong:`:math:`x \\in \\mathbb{Q} (i)`.` The factorization is performed with Gaussian\n        primes in :math:`\\mathbb{Z}[i]` and includes Gaussian units in :math:`{\302\2611, \302\261 i}`;\n        factors are sorted by increasing norm. Except for a possible leading unit,\n        the Gaussian factors are normalized: rational factors are positive and\n        irrational factors have positive imaginary part (a canonical represneta.\n        \n        Unless :literal:`factor_proven` is set, large factors are actually pseudoprimes,\n        not proven primes; a rational factor is prime if less than :math:`2^{64}` and an\n        irrational one if its norm is less than :math:`2^{64}`.\n        \n        ::\n        \n            ? factor(5*I)\n            %1 =\n            [ 2 + I 1]\n            \n            [1 + 2*I 1]\n        \n        One can force the factorization of a rational number\n        by setting the domain :math:`D = I`:\n        \n        ::\n        \n            ? factor(-5, I)\n            %2 =\n            [ I 1]\n            \n            [ 2 + I 1]\n            \n            [1 + 2*I 1]\n            ? factorback(%)\n            %3 = -5\n        \n        :strong:`Univariate polynomials and rational functions.`\n        PARI can factor univariate polynomials in :math:`K[t]`. The following base fields\n        :math:`K` are currently supported: :math:`\\mathbb{Q}`, :math:`\\mathbb{R}`, :math:`\\mathbb{C}`, :math:`\\mathbb{Q}_p`, finite fields and\n        number fields. See :literal:`factormod` and :literal:`factorff` for the algorithms used\n        over finite fields and :literal:`nffactor` for the algorithms over number fields.\n        The irreducible factors are sorted b""y increasing degree and normalized: they\n        are monic except when :math:`K = \\mathbb{Q}` where they are primitive in :math:`\\mathbb{Z}[t]`.\n        \n        The content is :emphasis:`not` included in the factorization, in particular\n        :literal:`factorback` will in general recover the original :math:`x` only up to\n        multiplication by an element of :math:`K^*`: when :math:`K != \\mathbb{Q}`, this scalar is\n        :literal:`pollead`:math:`(x)` (since irreducible factors are monic); and when :math:`K = \\mathbb{Q}`\n        you can either ask for the :math:`\\mathbb{Q}`-content explicitly of use factorback:\n        \n        ::\n        \n            ? P = t^2 + 5*t/2 + 1; F = factor(P)\n            %1 =\n            [t + 2 1]\n            \n            [2*t + 1 1]\n            \n            ? content(P, 1) \\\\ Q-content\n            %2 = 1/2\n            \n            ? pollead(factorback(F)) / pollead(P)\n            %3 = 2\n        \n        You can specify :math:`K` using the optional \"domain\" argument :math:`D` as follows\n        \n        - :math:`K = \\mathbb{Q}` : :math:`D` a rational number (:literal:`t_INT` or :literal:`t_FRAC`),\n        \n        - :math:`K = \\mathbb{Z}/p\\mathbb{Z}` with :math:`p` prime : :math:`D` a :literal:`t_INTMOD` modulo :math:`p`;\n          factoring modulo a non-prime number is not supported.\n        \n        - :math:`K = \\mathbb{F}_q` : :math:`D` a :literal:`t_FFELT` encoding the finite field; you can also\n          use a :literal:`t_POLMOD` of :literal:`t_INTMOD` modulo a prime :math:`p` but this is usualy\n          less convenient;\n        \n        - :math:`K = \\mathbb{Q}[X]/(T)` a number field : :math:`D` a :literal:`t_POLMOD` modulo :math:`T`,\n        \n        - :math:`K = \\mathbb{Q} (i)` (alternate syntax for special case): :math:`D = I`,\n        \n        - :math:`K = \\mathbb{Q} (w)` a quadratic number field (alternate syntax for special\n          case): :math:`D` a :literal:`t_Q""UAD`,\n        \n        - :math:`K = \\mathbb{R}` : :math:`D` a real number (:literal:`t_REAL`); truncate the factorization\n          at accuracy :literal:`precision`:math:`(D)`. If :math:`x` is inexact and :literal:`precision`:math:`(x)`\n          is less than :literal:`precision`:math:`(D)`, then the precision of :math:`x` is used instead.\n        \n        - :math:`K = \\mathbb{C}` : :math:`D` a complex number with a :literal:`t_REAL` component, e.g.\n          :literal:`I * 1.`; truncate the factorization as for :math:`K = \\mathbb{R}`,\n        \n        - :math:`K = \\mathbb{Q}_p` : :math:`D` a :literal:`t_PADIC`; truncate the factorization at\n          :math:`p`-adic accuracy :literal:`padicprec`:math:`(D)`, possibly less if :math:`x` is inexact\n          with insufficient :math:`p`-adic accuracy;\n        \n        ::\n        \n            ? T = x^2+1;\n            ? factor(T, 1); \\\\ over Q\n            ? factor(T, Mod(1,3)) \\\\ over F_3\n            ? factor(T, ffgen(ffinit(3,2,'t))^0) \\\\ over F_{3^2}\n            ? factor(T, Mod(Mod(1,3), t^2+t+2)) \\\\ over F_{3^2}, again\n            ? factor(T, O(3^6)) \\\\ over Q_3, precision 6\n            ? factor(T, 1.) \\\\ over R, current precision\n            ? factor(T, I*1.) \\\\ over C\n            ? factor(T, Mod(1, y^3-2)) \\\\ over Q(2^{1/3})\n        \n        In most cases, it is possible and simpler to call a\n        specialized variant rather than use the above scheme:\n        \n        ::\n        \n            ? factormod(T, 3) \\\\ over F_3\n            ? factormod(T, [t^2+t+2, 3]) \\\\ over F_{3^2}\n            ? factormod(T, ffgen(3^2, 't)) \\\\ over F_{3^2}\n            ? factorpadic(T, 3,6) \\\\ over Q_3, precision 6\n            ? nffactor(y^3-2, T) \\\\ over Q(2^{1/3})\n            ? polroots(T) \\\\ over C\n            ? polrootsreal(T) \\\\ over R (real polynomial)\n        \n        It is also possible to let the routine use the smallest field containing all\n        coefficie""nts, taking into account quotient structures induced by\n        :literal:`t_INTMOD`\302\240s and :literal:`t_POLMOD`\302\240s (e.g.\302\240if a coefficient in :math:`\\mathbb{Z}/n\\mathbb{Z}` is known,\n        all rational numbers encountered are first mapped to :math:`\\mathbb{Z}/n\\mathbb{Z}`; different\n        moduli will produce an error):\n        \n        ::\n        \n            ? T = x^2+1;\n            ? factor(T); \\\\ over Q\n            ? factor(T*Mod(1,3)) \\\\ over F_3\n            ? factor(T*ffgen(ffinit(3,2,'t))^0) \\\\ over F_{3^2}\n            ? factor(T*Mod(Mod(1,3), t^2+t+2)) \\\\ over F_{3^2}, again\n            ? factor(T*(1 + O(3^6)) \\\\ over Q_3, precision 6\n            ? factor(T*1.) \\\\ over R, current precision\n            ? factor(T*(1.+0.*I)) \\\\ over C\n            ? factor(T*Mod(1, y^3-2)) \\\\ over Q(2^{1/3})\n        \n        Multiplying by a suitable field element equal to :math:`1 \\in K`\n        in this way is error-prone and is not recommanded. Factoring existing\n        polynomials with obvious fields of coefficients is fine, the domain\n        argument :math:`D` should be used instead ad hoc conversions.\n        \n        :strong:`Note on inexact polynomials.`\n        Polynomials with inexact coefficients\n        (e.g. floating point or :math:`p`-adic numbers)\n        are first rounded to an exact representation, then factored to (potentially)\n        infinite accuracy and we return a truncated approximation of that\n        virtual factorization. To avoid pitfalls, we advise to only factor\n        :emphasis:`exact` polynomials:\n        \n        ::\n        \n            ? factor(x^2-1+O(2^2)) \\\\ rounded to x^2 + 3, irreducible in Q_2\n            %1 =\n            [(1 + O(2^2))*x^2 + O(2^2)*x + (1 + 2 + O(2^2)) 1]\n            \n            ? factor(x^2-1+O(2^3)) \\\\ rounded to x^2 + 7, reducible !\n            %2 =\n            [ (1 + O(2^3))*x + (1 + 2 + O(2^3)) 1]\n            \n            [(1 + O(""2^3))*x + (1 + 2^2 + O(2^3)) 1]\n            \n            ? factor(x^2-1, O(2^2)) \\\\ no ambiguity now\n            %3 =\n            [ (1 + O(2^2))*x + (1 + O(2^2)) 1]\n            \n            [(1 + O(2^2))*x + (1 + 2 + O(2^2)) 1]\n        \n        :strong:`Note about inseparable polynomials.` Polynomials with inexact\n        coefficients are considered to be squarefree: indeed, there exist a\n        squarefree polynomial arbitrarily close to the input, and they cannot be\n        distinguished at the input accuracy. This means that irreducible factors are\n        repeated according to their apparent multiplicity. On the contrary, using a\n        specialized function such as :literal:`factorpadic` with an :emphasis:`exact` rational\n        input yields the correct multiplicity when the (now exact) input is not\n        separable. Compare:\n        \n        ::\n        \n            ? factor(z^2 + O(5^2)))\n            %1 =\n            [(1 + O(5^2))*z + O(5^2) 1]\n            \n            [(1 + O(5^2))*z + O(5^2) 1]\n            ? factor(z^2, O(5^2))\n            %2 =\n            [1 + O(5^2))*z + O(5^2) 2]\n        \n        :strong:`Multivariate polynomials and rational functions.`\n        PARI recursively factors :emphasis:`multivariate` polynomials in\n        :math:`K[t_1,..., t_d]` for the same fields :math:`K` as above and the argument :math:`D`\n        is used in the same way to specify :math:`K`. The irreducible factors are sorted\n        by their main variable (least priority first) then by increasing degree.\n        \n        ::\n        \n            ? factor(x^2 + y^2, Mod(1,5))\n            %1 =\n            [ x + Mod(2, 5)*y 1]\n            \n            [Mod(1, 5)*x + Mod(3, 5)*y 1]\n            \n            ? factor(x^2 + y^2, O(5^2))\n            %2 =\n            [ (1 + O(5^2))*x + (O(5^2)*y^2 + (2 + 5 + O(5^2))*y + O(5^2)) 1]\n            \n            [(1 + O(5^2))*x + (O(5^2)*y^2 + (3 + 3*5 + O(5^2))*y + O(5^2)) 1]\n          ""  \n            ? lift(%)\n            %3 =\n            [ x + 7*y 1]\n            \n            [x + 18*y 1]\n        \n        Note that the implementation does not really support inexact\n        real fields (:math:`\\mathbb{R}` or :math:`\\mathbb{C}`) and usually misses factors even if the input\n        is exact:\n        \n        ::\n        \n            ? factor(x^2 + y^2, I) \\\\ over Q(i)\n            %4 =\n            [x - I*y 1]\n            \n            [x + I*y 1]\n            \n            ? factor(x^2 + y^2, I*1.) \\\\ over C\n            %5 =\n            [x^2 + y^2 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_535factor(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factor") < 0)) __PYX_ERR(10, 9061, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factor", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9061, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_534factor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_534factor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factor", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":9398
 *             [x^2 + y^2 1]
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":9399
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9400
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9400, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":9399
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9401
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 9401, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9402
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9403
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":9404
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9405
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factor0(_x, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":9404
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)
 */
  }

  /* "cypari/auto_gen.pxi":9406
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factor0(__pyx_v__x, __pyx_v__D);

  /* "cypari/auto_gen.pxi":9407
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factor0(_x, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorback(f, e=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9061
 *         return new_gen(_ret)
 * 
 *     def factor(x, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor :math:`x` over domain :math:`D`; if :math:`D` is omitted, it is determined from :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9409
 *         return new_gen(_ret)
 * 
 *     def factorback(f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the factored object corresponding to a factorization. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_537factorback(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_536factorback[] = "\n        Gives back the factored object corresponding to a factorization. The\n        integer :math:`1` corresponds to the empty factorization.\n        \n        If :math:`e` is present, :math:`e` and :math:`f` must be vectors of the same length (:math:`e` being\n        integral), and the corresponding factorization is the product of the\n        :math:`f[i]^{e[i]}`.\n        \n        If not, and :math:`f` is vector, it is understood as in the preceding case with :math:`e`\n        a vector of 1s: we return the product of the :math:`f[i]`. Finally, :math:`f` can be a\n        regular factorization, as produced with any :literal:`factor` command. A few\n        examples:\n        \n        ::\n        \n            ? factor(12)\n            %1 =\n            [2 2]\n            \n            [3 1]\n            \n            ? factorback(%)\n            %2 = 12\n            ? factorback([2,3], [2,1]) \\\\ 2^3 * 3^1\n            %3 = 12\n            ? factorback([5,2,3])\n            %4 = 30\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_537factorback(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_e = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_e,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorback") < 0)) __PYX_ERR(10, 9409, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_e = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorback", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9409, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_536factorback(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_e);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_536factorback(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_e) {
  int __pyx_v__have_e;
  GEN __pyx_v__f;
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factorback", 0);
  __Pyx_INCREF(__pyx_v_e);

  /* "cypari/auto_gen.pxi":9438
 *             %4 = 30
 *         '''
 *         cdef bint _have_e = (e is not None)             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             e = objtogen(e)
 */
  __pyx_t_1 = (__pyx_v_e != Py_None);
  __pyx_v__have_e = __pyx_t_1;

  /* "cypari/auto_gen.pxi":9439
 *         '''
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_e != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9440
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 *             e = objtogen(e)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_e, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9440, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":9439
 *         '''
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9441
 *         if _have_e:
 *             e = objtogen(e)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 9441, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9442
 *             e = objtogen(e)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _e = NULL
 *         if _have_e:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9443
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             _e = (<Gen>e).g
 */
  __pyx_v__e = NULL;

  /* "cypari/auto_gen.pxi":9444
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)
 */
  __pyx_t_1 = (__pyx_v__have_e != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9445
 *         cdef GEN _e = NULL
 *         if _have_e:
 *             _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorback2(_f, _e)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
    __pyx_v__e = __pyx_t_4;

    /* "cypari/auto_gen.pxi":9444
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)
 */
  }

  /* "cypari/auto_gen.pxi":9446
 *         if _have_e:
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorback2(__pyx_v__f, __pyx_v__e);

  /* "cypari/auto_gen.pxi":9447
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = factorback2(_f, _e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorcantor(x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9409
 *         return new_gen(_ret)
 * 
 *     def factorback(f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the factored object corresponding to a factorization. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9449
 *         return new_gen(_ret)
 * 
 *     def factorcantor(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use factormod.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_539factorcantor(PyObject *__pyx_v_x, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_538factorcantor[] = "\n        This function is obsolete, use factormod.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_539factorcantor(PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorcantor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_538factorcantor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_538factorcantor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factorcantor", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":9453
 *         This function is obsolete, use factormod.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)
 *         p = objtogen(p)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9453, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9454
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9455
 *         from warnings import warn
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9456
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 9456, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9457
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factmod(_x, _p)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9458
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factmod(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9459
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factmod(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factmod(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_gen.pxi":9460
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factmod(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorff(x, p=None, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9449
 *         return new_gen(_ret)
 * 
 *     def factorcantor(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use factormod.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorcantor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9462
 *         return new_gen(_ret)
 * 
 *     def factorff(x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_541factorff(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_540factorff[] = "\n        Obsolete, kept for backward compatibility: use factormod.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_541factorff(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorff (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_a,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorff") < 0)) __PYX_ERR(10, 9462, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_a = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorff", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9462, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_540factorff(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_p, __pyx_v_a);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_540factorff(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_p;
  int __pyx_v__have_a;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("factorff", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":9466
 *         Obsolete, kept for backward compatibility: use factormod.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9466, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9467
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9468
 *         from warnings import warn
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_3 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9469
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":9470
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9470, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":9469
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  }

  /* "cypari/auto_gen.pxi":9471
 *         if _have_p:
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_3 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9472
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":9473
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9473, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":9472
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9474
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 9474, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9475
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":9476
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":9477
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":9478
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_5;

    /* "cypari/auto_gen.pxi":9477
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  }

  /* "cypari/auto_gen.pxi":9479
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_gen.pxi":9480
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":9481
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorff(_x, _p, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_5;

    /* "cypari/auto_gen.pxi":9480
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)
 */
  }

  /* "cypari/auto_gen.pxi":9482
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorff(__pyx_v__x, __pyx_v__p, __pyx_v__a);

  /* "cypari/auto_gen.pxi":9483
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = factorff(_x, _p, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorint(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9483, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9462
 *         return new_gen(_ret)
 * 
 *     def factorff(x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9485
 *         return new_gen(_ret)
 * 
 *     def factorint(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the integer :math:`n` into a product of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_543factorint(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_542factorint[] = "\n        Factors the integer :math:`n` into a product of\n        pseudoprimes (see :literal:`ispseudoprime`), using a combination of the\n        Shanks SQUFOF and Pollard Rho method (with modifications due to\n        Brent), Lenstra's ECM (with modifications by Montgomery), and\n        MPQS (the latter adapted from the LiDIA code with the kind\n        permission of the LiDIA maintainers), as well as a search for pure powers.\n        The output is a two-column matrix as for :literal:`factor`: the first column\n        contains the \"prime\" divisors of :math:`n`, the second one contains the\n        (positive) exponents.\n        \n        By convention :math:`0` is factored as :math:`0^1`, and :math:`1` as the empty factorization;\n        also the divisors are by default not proven primes if they are larger than\n        :math:`2^{64}`, they only failed the BPSW compositeness test (see\n        :literal:`ispseudoprime`). Use :literal:`isprime` on the result if you want to\n        guarantee primality or set the :literal:`factor_proven` default to :math:`1`.\n        Entries of the private prime tables (see :literal:`addprimes`) are also included\n        as is.\n        \n        This gives direct access to the integer factoring engine called by most\n        arithmetical functions. :emphasis:`flag` is optional; its binary digits mean 1: avoid\n        MPQS, 2: skip first stage ECM (we may still fall back to it later), 4: avoid\n        Rho and SQUFOF, 8: don't run final ECM (as a result, a huge composite may be\n        declared to be prime). Note that a (strong) probabilistic primality test is\n        used; thus composites might not be detected, although no example is known.\n        \n        You are invited to play with the flag settings and watch the internals at\n        work by using :literal:`gp`'s :literal:`debug` default parameter (level 3 shows\n        just the outline, 4 turns on time keeping, 5 and above show an increasing\n        amount of i""nternal details).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_543factorint(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorint") < 0)) __PYX_ERR(10, 9485, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 9485, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorint", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9485, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_542factorint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_542factorint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("factorint", 0);

  /* "cypari/auto_gen.pxi":9517
 *         amount of internal details).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = factorint(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 9517, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9518
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorint(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":9519
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = factorint(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorint(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":9520
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = factorint(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factormod(f, D=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 9520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9485
 *         return new_gen(_ret)
 * 
 *     def factorint(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the integer :math:`n` into a product of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9522
 *         return new_gen(_ret)
 * 
 *     def factormod(f, D=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the polynomial :math:`f` over the finite field defined by the domain
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_545factormod(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_544factormod[] = "\n        Factors the polynomial :math:`f` over the finite field defined by the domain\n        :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        The coefficients of :math:`f` must be operation-compatible with the corresponding\n        finite field. The result is a two-column matrix, the first column being the\n        irreducible polynomials dividing :math:`f`, and the second the exponents.\n        By convention, the :math:`0` polynomial factors as :math:`0^1`; a non-zero constant\n        polynomial has empty factorization, a :math:`0 x 2` matrix. The irreducible\n        factors are ordered by increasing degree and the result is canonical: it will\n        not change across multiple calls or sessions.\n        \n        ::\n        \n            ? factormod(x^2 + 1, 3) \\\\ over F_3\n            %1 =\n            [Mod(1, 3)*x^2 + Mod(1, 3) 1]\n            ? liftall( factormod(x^2 + 1, [3, t^2+1]) ) \\\\ over F_9\n            %2 =\n            [ x + t 1]\n            \n            [x + 2*t 1]\n            ? t = ffgen(t^2+Mod(1,3)); factormod(x^2 + t^0) \\\\ same using t_FFELT\n            %3 =\n            [ x + t 1]\n            \n            [x + 2*t 1]\n            ? factormod(x^2+Mod(1,3))\n            %4 =\n            [Mod(1, 3)*x^2 + Mod(1, 3) 1]\n            ? liftall( factormod(x^2 + Mod(Mod(1,3),y^2+1)) )\n            %5 =\n            [ x + y 1]\n            \n            [x + 2*y 1]\n        \n        If :math:`flag` is non-zero, outputs only the :emphasis:`degrees` of the irreducible\n     ""   polynomials (for example to compute an :math:`L`-function). By convention, a\n        constant polynomial (including the :math:`0` polynomial) has empty factorization.\n        The degrees appear in increasing order but need not correspond to the\n        ordering with :math:`flag = 0` when multiplicities are present.\n        \n        ::\n        \n            ? f = x^3 + 2*x^2 + x + 2;\n            ? factormod(f, 5) \\\\ (x+2)^2 * (x+3)\n            %1 =\n            [Mod(1, 5)*x + Mod(2, 5) 2]\n            \n            [Mod(1, 5)*x + Mod(3, 5) 1]\n            ? factormod(f, 5, 1) \\\\ (deg 1) * (deg 1)^2\n            %2 =\n            [1 1]\n            \n            [1 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_545factormod(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factormod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_flag,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factormod") < 0)) __PYX_ERR(10, 9522, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_D = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 9522, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factormod", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_544factormod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_D, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_544factormod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D, long __pyx_v_flag) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factormod", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":9589
 *             [1 2]
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":9590
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9591
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9591, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":9590
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9592
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 9592, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9593
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9594
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":9595
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9596
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":9595
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 */
  }

  /* "cypari/auto_gen.pxi":9597
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factormod0(__pyx_v__f, __pyx_v__D, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":9598
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormod0(_f, _D, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factormodDDF(f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9522
 *         return new_gen(_ret)
 * 
 *     def factormod(f, D=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors the polynomial :math:`f` over the finite field defined by the domain
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9600
 *         return new_gen(_ret)
 * 
 *     def factormodDDF(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Distinct-degree factorization of the squarefree polynomial :math:`f` over the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_547factormodDDF(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_546factormodDDF[] = "\n        Distinct-degree factorization of the squarefree polynomial :math:`f` over the\n        finite field defined by the domain :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        This is somewhat faster than full factorization. The coefficients of :math:`f`\n        must be operation-compatible with the corresponding finite field. The result\n        is a two-column matrix:\n        \n        - the first column contains monic (squarefree) pairwise coprime polynomials\n          dividing :math:`f`, all of whose irreducible factors have degree :math:`d`;\n        \n        - the second column contains the degrees of the irreducible factors.\n        \n        The factors are ordered by increasing degree and the result is canonical: it\n        will not change across multiple calls or sessions.\n        \n        ::\n        \n            ? f = (x^2 + 1) * (x^2-1);\n            ? factormodSQF(f,3) \\\\ squarefree over F_3\n            %2 =\n            [Mod(1, 3)*x^4 + Mod(2, 3) 1]\n            \n            ? factormodDDF(f, 3)\n            %3 =\n            [Mod(1, 3)*x^2 + Mod(2, 3) 1] \\\\ two degree 1 factors\n            \n            [Mod(1, 3)*x^2 + Mod(1, 3) 2] \\\\ irred of degree 2\n            \n            ? for(i=1,10^5,factormodDDF(f,3))\n            time = 424 ms.\n            ? for(i=1,10^5,factormod(f,3)) \\\\ full factorization is slower\n            time = 464 ms.\n            \n            ? liftall( factormodDDF(x^2 + 1, [3, t^2+1]) ) \\\\ over F_9\n            %6 =\n            [x^2 +"" 1 1] \\\\ product of two degree 1 factors\n            \n            ? t = ffgen(t^2+Mod(1,3)); factormodDDF(x^2 + t^0) \\\\ same using t_FFELT\n            %7 =\n            [x^2 + 1 1]\n            \n            ? factormodDDF(x^2-Mod(1,3))\n            %8 =\n            [Mod(1, 3)*x^2 + Mod(2, 3) 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_547factormodDDF(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factormodDDF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factormodDDF") < 0)) __PYX_ERR(10, 9600, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factormodDDF", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9600, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factormodDDF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_546factormodDDF(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_546factormodDDF(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factormodDDF", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":9657
 *             [Mod(1, 3)*x^2 + Mod(2, 3) 1]
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":9658
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9659
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9659, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":9658
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9660
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 9660, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9661
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9662
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":9663
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9664
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factormodDDF(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":9663
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)
 */
  }

  /* "cypari/auto_gen.pxi":9665
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factormodDDF(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_gen.pxi":9666
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodDDF(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factormodSQF(f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9600
 *         return new_gen(_ret)
 * 
 *     def factormodDDF(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Distinct-degree factorization of the squarefree polynomial :math:`f` over the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factormodDDF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9668
 *         return new_gen(_ret)
 * 
 *     def factormodSQF(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Squarefree factorization of the polynomial :math:`f` over the finite field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_549factormodSQF(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_548factormodSQF[] = "\n        Squarefree factorization of the polynomial :math:`f` over the finite field\n        defined by the domain :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        This is somewhat faster than full factorization. The coefficients of :math:`f`\n        must be operation-compatible with the corresponding finite field. The result\n        is a two-column matrix:\n        \n        - the first column contains monic squarefree pairwise coprime polynomials\n          dividing :math:`f`;\n        \n        - the second column contains the power to which the polynomial in column\n          :math:`1` divides :math:`f`;\n        \n        The factors are ordered by increasing degree and the result is canonical: it\n        will not change across multiple calls or sessions.\n        \n        ::\n        \n            ? f = (x^2 + 1)^3 * (x^2-1)^2;\n            ? factormodSQF(f, 3) \\\\ over F_3\n            %1 =\n            [Mod(1, 3)*x^2 + Mod(2, 3) 2]\n            \n            [Mod(1, 3)*x^2 + Mod(1, 3) 3]\n            \n            ? for(i=1,10^5,factormodSQF(f,3))\n            time = 192 ms.\n            ? for(i=1,10^5,factormod(f,3)) \\\\ full factorization is slower\n            time = 409 ms.\n            \n            ? liftall( factormodSQF((x^2 + 1)^3, [3, t^2+1]) ) \\\\ over F_9\n            %4 =\n            [x^2 + 1 3]\n            \n            ? t = ffgen(t^2+Mod(1,3)); factormodSQF((x^2 + t^0)^3) \\\\ same using t_FFELT\n            %5 =\n            [x^2 + 1 3]\n            \n            ? factor""modSQF(x^8 + x^7 + x^6 + x^2 + x + Mod(1,2))\n            %6 =\n            [ Mod(1, 2)*x + Mod(1, 2) 2]\n            \n            [Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2) 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_549factormodSQF(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factormodSQF (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factormodSQF") < 0)) __PYX_ERR(10, 9668, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factormodSQF", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9668, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factormodSQF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_548factormodSQF(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_548factormodSQF(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factormodSQF", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":9724
 *             [Mod(1, 2)*x^2 + Mod(1, 2)*x + Mod(1, 2) 3]
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":9725
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9726
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":9725
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9727
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 9727, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9728
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9729
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":9730
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":9731
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factormodSQF(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":9730
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)
 */
  }

  /* "cypari/auto_gen.pxi":9732
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factormodSQF(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_gen.pxi":9733
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = factormodSQF(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factornf(x, t):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9668
 *         return new_gen(_ret)
 * 
 *     def factormodSQF(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Squarefree factorization of the polynomial :math:`f` over the finite field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factormodSQF", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9735
 *         return new_gen(_ret)
 * 
 *     def factornf(x, t):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nffactor`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_551factornf(PyObject *__pyx_v_x, PyObject *__pyx_v_t); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_550factornf[] = "\n        This function is obsolete, use :literal:`nffactor`.\n        \n        factorization of the univariate polynomial :math:`x`\n        over the number field defined by the (univariate) polynomial :math:`t`. :math:`x` may\n        have coefficients in :math:`\\mathbb{Q}` or in the number field. The algorithm reduces to\n        factorization over :math:`\\mathbb{Q}` (Trager's trick). The direct approach of\n        :literal:`nffactor`, which uses van Hoeij's method in a relative setting, is\n        in general faster.\n        \n        The main variable of :math:`t` must be of :emphasis:`lower` priority than that of :math:`x`\n        (see ``priority`` (in the PARI manual)). However if non-rational number field elements\n        occur (as polmods or polynomials) as coefficients of :math:`x`, the variable of\n        these polmods :emphasis:`must` be the same as the main variable of :math:`t`. For\n        example\n        \n        ::\n        \n            ? factornf(x^2 + Mod(y, y^2+1), y^2+1);\n            ? factornf(x^2 + y, y^2+1); \\\\ these two are OK\n            ? factornf(x^2 + Mod(z,z^2+1), y^2+1)\n             *** at top-level: factornf(x^2+Mod(z,z\n             *** ^--------------------\n             *** factornf: inconsistent data in rnf function.\n            ? factornf(x^2 + z, y^2+1)\n             *** at top-level: factornf(x^2+z,y^2+1\n             *** ^--------------------\n             *** factornf: incorrect variable in rnf function.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_551factornf(PyObject *__pyx_v_x, PyObject *__pyx_v_t) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factornf (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_550factornf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_t));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_550factornf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_t) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("factornf", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_gen.pxi":9765
 *              *** factornf: incorrect variable in rnf function.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)
 *         t = objtogen(t)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9765, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9766
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9767
 *         from warnings import warn
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9767, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":9768
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 9768, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9769
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = polfnf(_x, _t)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9770
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polfnf(_x, _t)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_4;

  /* "cypari/auto_gen.pxi":9771
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = polfnf(_x, _t)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polfnf(__pyx_v__x, __pyx_v__t);

  /* "cypari/auto_gen.pxi":9772
 *         cdef GEN _t = (<Gen>t).g
 *         cdef GEN _ret = polfnf(_x, _t)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def factorpadic(pol, p, long r):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 9772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9735
 *         return new_gen(_ret)
 * 
 *     def factornf(x, t):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nffactor`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factornf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9774
 *         return new_gen(_ret)
 * 
 *     def factorpadic(pol, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`p`-adic factorization
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_553factorpadic(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_552factorpadic[] = "\n        :math:`p`-adic factorization\n        of the polynomial :emphasis:`pol` to precision :math:`r`, the result being a\n        two-column matrix as in :literal:`factor`. Note that this is not the same\n        as a factorization over :math:`\\mathbb{Z}/p^r\\mathbb{Z}` (polynomials over that ring do not form a\n        unique factorization domain, anyway), but approximations in :math:`\\mathbb{Q}/p^r\\mathbb{Z}` of\n        the true factorization in :math:`\\mathbb{Q}_p[X]`.\n        \n        ::\n        \n            ? factorpadic(x^2 + 9, 3,5)\n            %1 =\n            [(1 + O(3^5))*x^2 + O(3^5)*x + (3^2 + O(3^5)) 1]\n            ? factorpadic(x^2 + 1, 5,3)\n            %2 =\n            [ (1 + O(5^3))*x + (2 + 5 + 2*5^2 + O(5^3)) 1]\n            \n            [(1 + O(5^3))*x + (3 + 3*5 + 2*5^2 + O(5^3)) 1]\n        \n        The factors are normalized so that their leading coefficient is a power of\n        :math:`p`. The method used is a modified version of the round 4 algorithm of\n        Zassenhaus.\n        \n        If :emphasis:`pol` has inexact :literal:`t_PADIC` coefficients, this is not always\n        well-defined; in this case, the polynomial is first made integral by dividing\n        out the :math:`p`-adic content, then lifted to :math:`\\mathbb{Z}` using :literal:`truncate`\n        coefficientwise.\n        Hence we actually factor exactly a polynomial which is only :math:`p`-adically\n        close to the input. To avoid pitfalls, we advise to only factor polynomials\n        with exact rational coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_553factorpadic(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorpadic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_r,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_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("factorpadic", 1, 2, 2, 1); __PYX_ERR(10, 9774, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorpadic") < 0)) __PYX_ERR(10, 9774, __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_p = values[0];
    __pyx_v_r = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 9774, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorpadic", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9774, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorpadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_552factorpadic(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol), __pyx_v_p, __pyx_v_r);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_552factorpadic(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_p, long __pyx_v_r) {
  GEN __pyx_v__pol;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("factorpadic", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":9806
 *         with exact rational coefficients.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":9807
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 9807, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9808
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factorpadic(_pol, _p, r)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9809
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = factorpadic(_pol, _p, r)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9810
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factorpadic(_pol, _p, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = factorpadic(__pyx_v__pol, __pyx_v__p, __pyx_v_r);

  /* "cypari/auto_gen.pxi":9811
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = factorpadic(_pol, _p, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffcompomap(f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9774
 *         return new_gen(_ret)
 * 
 *     def factorpadic(pol, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`p`-adic factorization
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.factorpadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9813
 *         return new_gen(_ret)
 * 
 *     def ffcompomap(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`k`, :math:`l`, :math:`m` be three finite fields and :math:`f` a (partial) map from :math:`l`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_555ffcompomap(PyObject *__pyx_v_f, PyObject *__pyx_v_g); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_554ffcompomap[] = "\n        Let :math:`k`, :math:`l`, :math:`m` be three finite fields and :math:`f` a (partial) map from :math:`l`\n        to :math:`m` and :math:`g` a (partial) map from :math:`k` to :math:`l`, return the (partial) map :math:`f\n        o g` from :math:`k` to :math:`m`.\n        \n        ::\n        \n            a = ffgen([3,5],'a); b = ffgen([3,10],'b); c = ffgen([3,20],'c);\n            m = ffembed(a, b); n = ffembed(b, c);\n            rm = ffinvmap(m); rn = ffinvmap(n);\n            nm = ffcompomap(n,m);\n            ffmap(n,ffmap(m,a)) == ffmap(nm, a)\n            %5 = 1\n            ffcompomap(rm, rn) == ffinvmap(nm)\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_555ffcompomap(PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffcompomap (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_554ffcompomap(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_g));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_554ffcompomap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffcompomap", 0);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_gen.pxi":9830
 *             %6 = 1
 *         '''
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":9831
 *         '''
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 9831, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9832
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ffcompomap(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9833
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffcompomap(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9834
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ffcompomap(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffcompomap(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_gen.pxi":9835
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = ffcompomap(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffembed(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9813
 *         return new_gen(_ret)
 * 
 *     def ffcompomap(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`k`, :math:`l`, :math:`m` be three finite fields and :math:`f` a (partial) map from :math:`l`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffcompomap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9837
 *         return new_gen(_ret)
 * 
 *     def ffembed(a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two finite fields elements :math:`a` and :math:`b`, return a :emphasis:`map`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_557ffembed(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_556ffembed[] = "\n        Given two finite fields elements :math:`a` and :math:`b`, return a :emphasis:`map`\n        embedding the definition field of :math:`a` to the definition field of :math:`b`.\n        Assume that the latter contains the former.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? b = ffgen([3,10],'b);\n            ? m = ffembed(a, b);\n            ? A = ffmap(m, a);\n            ? minpoly(A) == minpoly(a)\n            %5 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_557ffembed(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffembed (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_556ffembed(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_556ffembed(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffembed", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":9852
 *             %5 = 1
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":9853
 *         '''
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 9853, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9854
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = ffembed(_a, _b)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9855
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffembed(_a, _b)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":9856
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = ffembed(_a, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffembed(__pyx_v__a, __pyx_v__b);

  /* "cypari/auto_gen.pxi":9857
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _ret = ffembed(_a, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffextend(a, P, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9837
 *         return new_gen(_ret)
 * 
 *     def ffembed(a, b):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two finite fields elements :math:`a` and :math:`b`, return a :emphasis:`map`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9859
 *         return new_gen(_ret)
 * 
 *     def ffextend(a, P, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extend the field :math:`K` of definition of :math:`a` by a root of the polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_559ffextend(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_558ffextend[] = "\n        Extend the field :math:`K` of definition of :math:`a` by a root of the polynomial\n        :math:`P\\in K[X]` assumed to be irreducible over :math:`K`. Return :math:`[r, m]` where :math:`r`\n        is a root of :math:`P` in the extension field :math:`L` and :math:`m` is a map from :math:`K` to :math:`L`,\n        see :literal:`ffmap`.\n        If :math:`v` is given, the variable name is used to display the generator of :math:`L`,\n        else the name of the variable of :math:`P` is used.\n        A generator of :math:`L` can be recovered using :math:`b = ffgen(r)`.\n        The image of :math:`P` in :math:`L[X]` can be recovered using :math:`PL = ffmap(m,P)`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? P = x^2-a; polisirreducible(P)\n            %2 = 1\n            ? [r,m] = ffextend(a, P, 'b);\n            ? r\n            %3 = b^9+2*b^8+b^7+2*b^6+b^4+1\n            ? subst(ffmap(m, P), x, r)\n            %4 = 0\n            ? ffgen(r)\n            %5 = b\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_559ffextend(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffextend (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffextend") < 0)) __PYX_ERR(10, 9859, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffextend", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9859, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffextend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_558ffextend(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_a), __pyx_v_P, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_558ffextend(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_P, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__a;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("ffextend", 0);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_gen.pxi":9883
 *             %5 = b
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9883, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":9884
 *         '''
 *         P = objtogen(P)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":9885
 *         P = objtogen(P)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":9886
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 9886, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":9885
 *         P = objtogen(P)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9887
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 9887, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9888
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ffextend(_a, _P, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_6;

  /* "cypari/auto_gen.pxi":9889
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffextend(_a, _P, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_6;

  /* "cypari/auto_gen.pxi":9890
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ffextend(_a, _P, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffextend(__pyx_v__a, __pyx_v__P, __pyx_v__v);

  /* "cypari/auto_gen.pxi":9891
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = ffextend(_a, _P, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fffrobenius(m, long n=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 9891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9859
 *         return new_gen(_ret)
 * 
 *     def ffextend(a, P, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extend the field :math:`K` of definition of :math:`a` by a root of the polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffextend", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9893
 *         return new_gen(_ret)
 * 
 *     def fffrobenius(m, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the :math:`n`-th power of the Frobenius map over the field of definition
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_561fffrobenius(PyObject *__pyx_v_m, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_560fffrobenius[] = "\n        Return the :math:`n`-th power of the Frobenius map over the field of definition\n        of :math:`m`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? f = fffrobenius(a);\n            ? ffmap(f,a) == a^3\n            %3 = 1\n            ? g = fffrobenius(a, 5);\n            ? ffmap(g,a) == a\n            %5 = 1\n            ? h = fffrobenius(a, 2);\n            ? h == ffcompomap(f,f)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_561fffrobenius(PyObject *__pyx_v_m, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fffrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fffrobenius") < 0)) __PYX_ERR(10, 9893, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 9893, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fffrobenius", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9893, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.fffrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_560fffrobenius(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_m), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_560fffrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_m, long __pyx_v_n) {
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("fffrobenius", 0);

  /* "cypari/auto_gen.pxi":9911
 *             %7 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = fffrobenius(_m, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 9911, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9912
 *         '''
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fffrobenius(_m, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_2;

  /* "cypari/auto_gen.pxi":9913
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = fffrobenius(_m, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fffrobenius(__pyx_v__m, __pyx_v_n);

  /* "cypari/auto_gen.pxi":9914
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = fffrobenius(_m, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffgen(k, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 9914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9893
 *         return new_gen(_ret)
 * 
 *     def fffrobenius(m, long n=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the :math:`n`-th power of the Frobenius map over the field of definition
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.fffrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9916
 *         return new_gen(_ret)
 * 
 *     def ffgen(k, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a generator for the finite field :math:`k` as a :literal:`t_FFELT`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_563ffgen(PyObject *__pyx_v_k, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_562ffgen[] = "\n        Return a generator for the finite field :math:`k` as a :literal:`t_FFELT`.\n        The field :math:`k` can be given by\n        \n        - its order :math:`q`\n        \n        - the pair :math:`[p,f]` where :math:`q = p^f`\n        \n        - a monic irreducible polynomial with :literal:`t_INTMOD` coefficients modulo a\n          prime.\n        \n        - a :literal:`t_FFELT` belonging to :math:`k`.\n        \n        If :literal:`v` is given, the variable name is used to display :math:`g`, else the\n        variable of the polynomial or the :literal:`t_FFELT` is used, else :math:`x` is used.\n        \n        When only the order is specified, the function uses the polynomial generated\n        by :literal:`ffinit` and is deterministic: two calls to the function with the\n        same parameters will always give the same generator.\n        \n        For efficiency, the characteristic is not checked to be prime; similarly\n        if a polynomial is given, we do not check whether it is irreducible.\n        \n        To obtain a multiplicative generator, call :literal:`ffprimroot` on the result.\n        \n        ::\n        \n            ? g = ffgen(16, 't);\n            ? g.mod \\\\ recover the underlying polynomial.\n            %2 = t^4+t^3+t^2+t+1\n            ? g.p \\\\ recover the characteristic\n            %3 = 2\n            ? fforder(g) \\\\ g is not a multiplicative generator\n            %4 = 5\n            ? a = ffprimroot(g) \\\\ recover a multiplicative generator\n            %5 = t^3+t^2+t\n            ? fforder(a)\n            %6 = 15\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_563ffgen(PyObject *__pyx_v_k, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffgen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffgen") < 0)) __PYX_ERR(10, 9916, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffgen", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9916, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_562ffgen(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_k), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_562ffgen(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_k, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ffgen", 0);

  /* "cypari/auto_gen.pxi":9956
 *             %6 = 15
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":9957
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":9958
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 9958, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":9957
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9959
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = ffgen(_k, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 9959, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9960
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffgen(_k, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_5;

  /* "cypari/auto_gen.pxi":9961
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = ffgen(_k, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffgen(__pyx_v__k, __pyx_v__v);

  /* "cypari/auto_gen.pxi":9962
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = ffgen(_k, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffinit(p, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 9962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9916
 *         return new_gen(_ret)
 * 
 *     def ffgen(k, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a generator for the finite field :math:`k` as a :literal:`t_FFELT`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9964
 *         return new_gen(_ret)
 * 
 *     def ffinit(p, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a monic polynomial of degree :math:`n` which is irreducible over
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_565ffinit(PyObject *__pyx_v_p, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_564ffinit[] = "\n        Computes a monic polynomial of degree :math:`n` which is irreducible over\n        :math:`\\mathbb{F}_p`, where :math:`p` is assumed to be prime. This function uses a fast variant\n        of Adleman and Lenstra's algorithm.\n        \n        It is useful in conjunction with :literal:`ffgen`; for instance if\n        :literal:`P = ffinit(3,2)`, you can represent elements in :math:`\\mathbb{F}_{3^2}` in term of\n        :literal:`g = ffgen(P,'t)`. This can be abbreviated as\n        :literal:`g = ffgen(3^2, 't)`, where the defining polynomial :math:`P` can be later\n        recovered as :literal:`g.mod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_565ffinit(PyObject *__pyx_v_p, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffinit") < 0)) __PYX_ERR(10, 9964, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 9964, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 9964, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_564ffinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_p), __pyx_v_n, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_564ffinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_p, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ffinit", 0);

  /* "cypari/auto_gen.pxi":9976
 *         recovered as :literal:`g.mod`.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":9977
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":9978
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 9978, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":9977
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":9979
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ffinit(_p, n, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 9979, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":9980
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffinit(_p, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_5;

  /* "cypari/auto_gen.pxi":9981
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ffinit(_p, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffinit(__pyx_v__p, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_gen.pxi":9982
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = ffinit(_p, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffinvmap(m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 9982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9964
 *         return new_gen(_ret)
 * 
 *     def ffinit(p, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a monic polynomial of degree :math:`n` which is irreducible over
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":9984
 *         return new_gen(_ret)
 * 
 *     def ffinvmap(m):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m` being a map from :math:`K` to :math:`L` two finite fields, return the partial map
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_567ffinvmap(PyObject *__pyx_v_m, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_566ffinvmap[] = "\n        :math:`m` being a map from :math:`K` to :math:`L` two finite fields, return the partial map\n        :math:`p` from :math:`L` to :math:`K` such that for all :math:`k\\in K`, :math:`p(m(k)) = k`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? b = ffgen([3,10],'b);\n            ? m = ffembed(a, b);\n            ? p = ffinvmap(m);\n            ? u = random(a);\n            ? v = ffmap(m, u);\n            ? ffmap(p, v^2+v+2) == u^2+u+2\n            %7 = 1\n            ? ffmap(p, b)\n            %8 = []\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_567ffinvmap(PyObject *__pyx_v_m, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffinvmap (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_566ffinvmap(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_m));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_566ffinvmap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_m) {
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ffinvmap", 0);

  /* "cypari/auto_gen.pxi":10002
 *             %8 = []
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ffinvmap(_m)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10002, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10003
 *         '''
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffinvmap(_m)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10004
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ffinvmap(_m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffinvmap(__pyx_v__m);

  /* "cypari/auto_gen.pxi":10005
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = ffinvmap(_m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fflog(x, g, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":9984
 *         return new_gen(_ret)
 * 
 *     def ffinvmap(m):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m` being a map from :math:`K` to :math:`L` two finite fields, return the partial map
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffinvmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10007
 *         return new_gen(_ret)
 * 
 *     def fflog(x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discrete logarithm of the finite field element :math:`x` in base :math:`g`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_569fflog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_568fflog[] = "\n        Discrete logarithm of the finite field element :math:`x` in base :math:`g`,\n        i.e.\302\240an :math:`e` in :math:`\\mathbb{Z}` such that :math:`g^e = o`. If\n        present, :math:`o` represents the multiplicative order of :math:`g`, see\n        ``DLfun`` (in the PARI manual); the preferred format for\n        this parameter is :literal:`[ord, factor(ord)]`, where :literal:`ord` is the\n        order of :math:`g`. It may be set as a side effect of calling :literal:`ffprimroot`.\n        \n        If no :math:`o` is given, assume that :math:`g` is a primitive root. The result is\n        undefined if :math:`e` does not exist. This function uses\n        \n        - a combination of generic discrete log algorithms (see :literal:`znlog`)\n        \n        - a cubic sieve index calculus algorithm for large fields of degree at\n          least :math:`5`.\n        \n        - Coppersmith's algorithm for fields of characteristic at most :math:`5`.\n        \n        ::\n        \n            ? t = ffgen(ffinit(7,5));\n            ? o = fforder(t)\n            %2 = 5602 \\\\ not a primitive root.\n            ? fflog(t^10,t)\n            %3 = 10\n            ? fflog(t^10,t, o)\n            %4 = 10\n            ? g = ffprimroot(t, &o);\n            ? o \\\\ order is 16806, bundled with its factorization matrix\n            %6 = [16806, [2, 1; 3, 1; 2801, 1]]\n            ? fforder(g, o)\n            %7 = 16806\n            ? fflog(g^10000, g, o)\n            %8 = 10000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_569fflog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fflog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g,&__pyx_n_s_o,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_g)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fflog") < 0)) __PYX_ERR(10, 10007, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g = values[0];
    __pyx_v_o = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fflog", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10007, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.fflog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_568fflog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_g, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_568fflog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__g;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("fflog", 0);
  __Pyx_INCREF(__pyx_v_g);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_gen.pxi":10043
 *             %8 = 10000
 *         '''
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10044
 *         '''
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10045
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":10046
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10046, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":10045
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10047
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 10047, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10048
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":10049
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_4;

  /* "cypari/auto_gen.pxi":10050
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_gen.pxi":10051
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":10052
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fflog(_x, _g, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_gen.pxi":10051
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)
 */
  }

  /* "cypari/auto_gen.pxi":10053
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fflog(__pyx_v__x, __pyx_v__g, __pyx_v__o);

  /* "cypari/auto_gen.pxi":10054
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fflog(_x, _g, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffmap(m, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10007
 *         return new_gen(_ret)
 * 
 *     def fflog(x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discrete logarithm of the finite field element :math:`x` in base :math:`g`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.fflog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10056
 *         return new_gen(_ret)
 * 
 *     def ffmap(m, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a (partial) map :math:`m` between two finite fields, return the image of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_571ffmap(PyObject *__pyx_v_m, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_570ffmap[] = "\n        Given a (partial) map :math:`m` between two finite fields, return the image of\n        :math:`x` by :math:`m`. The function is applied recursively to the component of vectors,\n        matrices and polynomials. If :math:`m` is a partial map that is not defined at :math:`x`,\n        return :math:`[]`.\n        \n        ::\n        \n            ? a = ffgen([3,5],'a);\n            ? b = ffgen([3,10],'b);\n            ? m = ffembed(a, b);\n            ? P = x^2+a*x+1;\n            ? Q = ffmap(m,P);\n            ? ffmap(m,poldisc(P)) == poldisc(Q)\n            %6 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_571ffmap(PyObject *__pyx_v_m, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffmap (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_570ffmap(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_m), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_570ffmap(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_m, PyObject *__pyx_v_x) {
  GEN __pyx_v__m;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ffmap", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":10073
 *             %6 = 1
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10074
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 10074, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10075
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = ffmap(_m, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10076
 *         sig_on()
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffmap(_m, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10077
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = ffmap(_m, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffmap(__pyx_v__m, __pyx_v__x);

  /* "cypari/auto_gen.pxi":10078
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = ffmap(_m, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ffnbirred(q, long n, long fl=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10056
 *         return new_gen(_ret)
 * 
 *     def ffmap(m, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a (partial) map :math:`m` between two finite fields, return the image of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10080
 *         return new_gen(_ret)
 * 
 *     def ffnbirred(q, long n, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the number of monic irreducible polynomials over :math:`\mathbb{F}_q` of degree exactly :math:`n`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_573ffnbirred(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_572ffnbirred[] = "\n        Computes the number of monic irreducible polynomials over :math:`\\mathbb{F}_q` of degree exactly :math:`n`,\n        (:math:`flag = 0` or omitted) or at most :math:`n` (:math:`flag = 1`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_573ffnbirred(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_fl;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffnbirred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_fl,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ffnbirred") < 0)) __PYX_ERR(10, 10080, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10080, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10080, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ffnbirred", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10080, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffnbirred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_572ffnbirred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_q), __pyx_v_n, __pyx_v_fl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_572ffnbirred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, long __pyx_v_n, long __pyx_v_fl) {
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ffnbirred", 0);

  /* "cypari/auto_gen.pxi":10085
 *         (:math:`flag = 0` or omitted) or at most :math:`n` (:math:`flag = 1`).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10085, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10086
 *         '''
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10087
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ffnbirred0(__pyx_v__q, __pyx_v_n, __pyx_v_fl);

  /* "cypari/auto_gen.pxi":10088
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = ffnbirred0(_q, n, fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fforder(x, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10080
 *         return new_gen(_ret)
 * 
 *     def ffnbirred(q, long n, long fl=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the number of monic irreducible polynomials over :math:`\mathbb{F}_q` of degree exactly :math:`n`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ffnbirred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10090
 *         return new_gen(_ret)
 * 
 *     def fforder(x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplicative order of the finite field element :math:`x`. If :math:`o` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_575fforder(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_574fforder[] = "\n        Multiplicative order of the finite field element :math:`x`. If :math:`o` is\n        present, it represents a multiple of the order of the element,\n        see ``DLfun`` (in the PARI manual); the preferred format for\n        this parameter is :literal:`[N, factor(N)]`, where :literal:`N` is the cardinality\n        of the multiplicative group of the underlying finite field.\n        \n        ::\n        \n            ? t = ffgen(ffinit(nextprime(10^8), 5));\n            ? g = ffprimroot(t, &o); \\\\ o will be useful!\n            ? fforder(g^1000000, o)\n            time = 0 ms.\n            %5 = 5000001750000245000017150000600250008403\n            ? fforder(g^1000000)\n            time = 16 ms. \\\\ noticeably slower, same result of course\n            %6 = 5000001750000245000017150000600250008403\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_575fforder(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fforder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_o,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fforder") < 0)) __PYX_ERR(10, 10090, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_o = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fforder", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10090, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.fforder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_574fforder(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_574fforder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("fforder", 0);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_gen.pxi":10109
 *             %6 = 5000001750000245000017150000600250008403
 *         '''
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_1 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_1;

  /* "cypari/auto_gen.pxi":10110
 *         '''
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_o != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10111
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":10110
 *         '''
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10112
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 10112, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10113
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":10114
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_gen.pxi":10115
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)
 */
  __pyx_t_1 = (__pyx_v__have_o != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10116
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fforder(_x, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_gen.pxi":10115
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)
 */
  }

  /* "cypari/auto_gen.pxi":10117
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fforder(__pyx_v__x, __pyx_v__o);

  /* "cypari/auto_gen.pxi":10118
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = fforder(_x, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fileflush(n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10090
 *         return new_gen(_ret)
 * 
 *     def fforder(x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplicative order of the finite field element :math:`x`. If :math:`o` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.fforder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10120
 *         return new_gen(_ret)
 * 
 *     def fileflush(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Flushes the file descriptor :math:`n`, created via :literal:`fileopen` or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_577fileflush(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_576fileflush[] = "\n        Flushes the file descriptor :math:`n`, created via :literal:`fileopen` or\n        :literal:`fileextern`. On files opened for writing, this function forces a write\n        of all buffered data to the file system and completes all pending write\n        operations. This function is implicitly called by :literal:`fileclose` but you may\n        want to call it explicitly at synchronization points, for instance after\n        writing a large result to file and before printing diagnostics on screen.\n        (In order to be sure that the file contains the expected content on\n        inspection.)\n        \n        If :math:`n` is omitted, flush all descriptors to output streams.\n        \n        ::\n        \n            ? n = fileopen(\"./here\", \"w\");\n            ? for (i = 1, 10^5, \\\n             filewrite(n, i^2+1); \\\n             if (i % 10000 == 0, fileflush(n)))\n        \n        Until a :literal:`fileflush` or :literal:`fileclose`, there is no guarantee\n        that the file contains all the expected data from previous :literal:`filewrite`\302\240s.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_577fileflush(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fileflush (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_576fileflush(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_576fileflush(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n) {
  GEN __pyx_v__n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  __Pyx_RefNannySetupContext("fileflush", 0);

  /* "cypari/auto_gen.pxi":10143
 *         that the file contains all the expected data from previous :literal:`filewrite`s.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         gp_fileflush0(_n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10143, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10144
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         gp_fileflush0(_n)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10145
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         gp_fileflush0(_n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  gp_fileflush0(__pyx_v__n);

  /* "cypari/auto_gen.pxi":10146
 *         cdef GEN _n = (<Gen>n).g
 *         gp_fileflush0(_n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def floor(x):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":10120
 *         return new_gen(_ret)
 * 
 *     def fileflush(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Flushes the file descriptor :math:`n`, created via :literal:`fileopen` or
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.fileflush", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10148
 *         clear_stack()
 * 
 *     def floor(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Floor of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_579floor(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_578floor[] = "\n        Floor of :math:`x`. When :math:`x` is in :math:`\\mathbb{R}`, the result is the\n        largest integer smaller than or equal to :math:`x`. Applied to a rational function,\n        :math:`floor (x)` returns the Euclidean quotient of the numerator by the\n        denominator.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_579floor(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("floor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_578floor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_578floor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("floor", 0);

  /* "cypari/auto_gen.pxi":10155
 *         denominator.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfloor(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10155, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10156
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gfloor(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10157
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfloor(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gfloor(__pyx_v__x);

  /* "cypari/auto_gen.pxi":10158
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfloor(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fold(f, A):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10148
 *         clear_stack()
 * 
 *     def floor(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Floor of :math:`x`. When :math:`x` is in :math:`\mathbb{R}`, the result is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.floor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10160
 *         return new_gen(_ret)
 * 
 *     def fold(f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` of arity :math:`2` to the entries of :literal:`A`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_581fold(PyObject *__pyx_v_f, PyObject *__pyx_v_A); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_580fold[] = "\n        Apply the :literal:`t_CLOSURE` :literal:`f` of arity :math:`2` to the entries of :literal:`A`,\n        in order to return :literal:`f(...f(f(A[1],A[2]),A[3])...,A[\\#A])`.\n        \n        ::\n        \n            ? fold((x,y)->x*y, [1,2,3,4])\n            %1 = 24\n            ? fold((x,y)->[x,y], [1,2,3,4])\n            %2 = [[[1, 2], 3], 4]\n            ? fold((x,f)->f(x), [2,sqr,sqr,sqr])\n            %3 = 256\n            ? fold((x,y)->(x+y)/(1-x*y),[1..5])\n            %4 = -9/19\n            ? bestappr(tan(sum(i=1,5,atan(i))))\n            %5 = -9/19\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_581fold(PyObject *__pyx_v_f, PyObject *__pyx_v_A) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fold (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_580fold(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_A));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_580fold(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("fold", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_gen.pxi":10178
 *             %5 = -9/19
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10179
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 10179, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10180
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = fold0(_f, _A)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10181
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fold0(_f, _A)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10182
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = fold0(_f, _A)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fold0(__pyx_v__f, __pyx_v__A);

  /* "cypari/auto_gen.pxi":10183
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = fold0(_f, _A)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def frac(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10160
 *         return new_gen(_ret)
 * 
 *     def fold(f, A):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply the :literal:`t_CLOSURE` :literal:`f` of arity :math:`2` to the entries of :literal:`A`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.fold", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10185
 *         return new_gen(_ret)
 * 
 *     def frac(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fractional part of :math:`x`. Identical to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_583frac(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_582frac[] = "\n        Fractional part of :math:`x`. Identical to\n        :math:`x-floor(x)`. If :math:`x` is real, the result is in :math:`[0,1[`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_583frac(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("frac (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_582frac(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_582frac(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("frac", 0);

  /* "cypari/auto_gen.pxi":10190
 *         :math:`x-floor(x)`. If :math:`x` is real, the result is in :math:`[0,1[`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfrac(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10190, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10191
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gfrac(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10192
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfrac(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gfrac(__pyx_v__x);

  /* "cypari/auto_gen.pxi":10193
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gfrac(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def fromdigits(x, b=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10193, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10185
 *         return new_gen(_ret)
 * 
 *     def frac(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fractional part of :math:`x`. Identical to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.frac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10195
 *         return new_gen(_ret)
 * 
 *     def fromdigits(x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the integer formed by the elements of :math:`x` seen as the digits of a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_585fromdigits(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_584fromdigits[] = "\n        Gives the integer formed by the elements of :math:`x` seen as the digits of a\n        number in base :math:`b` (:math:`b = 10` by default). This is the reverse of :literal:`digits`:\n        \n        ::\n        \n            ? digits(1234,5)\n            %1 = [1,4,4,1,4]\n            ? fromdigits([1,4,4,1,4],5)\n            %2 = 1234\n        \n        By convention, :math:`0` has no digits:\n        \n        ::\n        \n            ? fromdigits([])\n            %3 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_585fromdigits(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fromdigits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fromdigits") < 0)) __PYX_ERR(10, 10195, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_b = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fromdigits", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10195, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.fromdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_584fromdigits(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_584fromdigits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b) {
  int __pyx_v__have_b;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("fromdigits", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":10214
 *             %3 = 0
 *         '''
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_1 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_1;

  /* "cypari/auto_gen.pxi":10215
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10216
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":10215
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10217
 *         if _have_b:
 *             b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 10217, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10218
 *             b = objtogen(b)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":10219
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_gen.pxi":10220
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10221
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = fromdigits(_x, _b)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_gen.pxi":10220
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)
 */
  }

  /* "cypari/auto_gen.pxi":10222
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = fromdigits(__pyx_v__x, __pyx_v__b);

  /* "cypari/auto_gen.pxi":10223
 *             _b = (<Gen>b).g
 *         cdef GEN _ret = fromdigits(_x, _b)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoischardet(gal, chi, long o=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10195
 *         return new_gen(_ret)
 * 
 *     def fromdigits(x, b=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the integer formed by the elements of :math:`x` seen as the digits of a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.fromdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10225
 *         return new_gen(_ret)
 * 
 *     def galoischardet(gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_587galoischardet(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_586galoischardet[] = "\n        Let :math:`G` be the group attached to the :literal:`galoisinit`\n        structure\302\240:emphasis:`gal`, and\n        let :math:`\\chi` be the character of some representation :math:`\\rho` of the group :math:`G`,\n        where a polynomial variable is to be interpreted as an :math:`o`-th root of 1.\n        For instance, if :literal:`[T,o] = galoischartable(gal)` the characters\n        :math:`\\chi` are input as the columns of :literal:`T`.\n        \n        Return the degree-:math:`1` character :math:`\\det\\rho` as the list of :math:`\\det \\rho (g)`,\n        where :math:`g` runs through representatives of the conjugacy classes\n        in :literal:`galoisconjclasses(gal)`, with the same ordering.\n        \n        ::\n        \n            ? P = x^5 - x^4 - 5*x^3 + 4*x^2 + 3*x - 1;\n            ? polgalois(P)\n            %2 = [10, 1, 1, \"D(5) = 5:2\"]\n            ? K = nfsplitting(P);\n            ? gal = galoisinit(K); \\\\ dihedral of order 10\n            ? [T,o] = galoischartable(gal);\n            ? chi = T[,1]; \\\\ trivial character\n            ? galoischardet(gal, chi, o)\n            %7 = [1, 1, 1, 1]~\n            ? [galoischardet(gal, T[,i], o) | i <- [1..#T]] \\\\ all characters\n            %8 = [[1, 1, 1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_587galoischardet(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_o;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoischardet (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_o,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_chi)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoischardet") < 0)) __PYX_ERR(10, 10225, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chi = values[0];
    if (values[1]) {
      __pyx_v_o = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_o == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10225, __pyx_L3_error)
    } else {
      __pyx_v_o = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoischardet", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10225, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoischardet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_586galoischardet(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), __pyx_v_chi, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_586galoischardet(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o) {
  GEN __pyx_v__gal;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoischardet", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":10252
 *             %8 = [[1, 1, 1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~, [1, 1, -1, 1]~]
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10253
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 10253, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10254
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10255
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10256
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoischardet(__pyx_v__gal, __pyx_v__chi, __pyx_v_o);

  /* "cypari/auto_gen.pxi":10257
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischardet(_gal, _chi, o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoischarpoly(gal, chi, long o=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10225
 *         return new_gen(_ret)
 * 
 *     def galoischardet(gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoischardet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10259
 *         return new_gen(_ret)
 * 
 *     def galoischarpoly(gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_589galoischarpoly(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_588galoischarpoly[] = "\n        Let :math:`G` be the group attached to the :literal:`galoisinit`\n        structure\302\240:emphasis:`gal`, and\n        let :math:`\\chi` be the character of some representation :math:`\\rho` of the group\n        :math:`G`, where a polynomial variable is to be interpreted as an :math:`o`-th root of\n        1, e.g., if :literal:`[T,o] = galoischartable(gal)` and :math:`\\chi` is a column of\n        :literal:`T`.\n        Return the list of characteristic polynomials :math:`\\det (1 - \\rho (g)T)`,\n        where :math:`g` runs through representatives of the conjugacy classes\n        in :literal:`galoisconjclasses(gal)`, with the same ordering.\n        \n        ::\n        \n            ? T = x^5 - x^4 - 5*x^3 + 4*x^2 + 3*x - 1;\n            ? polgalois(T)\n            %2 = [10, 1, 1, \"D(5) = 5:2\"]\n            ? K = nfsplitting(T);\n            ? gal = galoisinit(K); \\\\ dihedral of order 10\n            ? [T,o] = galoischartable(gal);\n            ? o\n            %5 = 5\n            ? galoischarpoly(gal, T[,1], o) \\\\ T[,1] is the trivial character\n            %6 = [-x + 1, -x + 1, -x + 1, -x + 1]~\n            ? galoischarpoly(gal, T[,3], o)\n            %7 = [x^2 - 2*x + 1,\n             x^2 + (y^3 + y^2 + 1)*x + 1,\n             -x^2 + 1,\n             x^2 + (-y^3 - y^2)*x + 1]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_589galoischarpoly(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_o;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoischarpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_o,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_chi)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoischarpoly") < 0)) __PYX_ERR(10, 10259, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chi = values[0];
    if (values[1]) {
      __pyx_v_o = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_o == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10259, __pyx_L3_error)
    } else {
      __pyx_v_o = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoischarpoly", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10259, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoischarpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_588galoischarpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), __pyx_v_chi, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_588galoischarpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_chi, long __pyx_v_o) {
  GEN __pyx_v__gal;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoischarpoly", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":10289
 *              x^2 + (-y^3 - y^2)*x + 1]~
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10290
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 10290, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10291
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10292
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10293
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoischarpoly(__pyx_v__gal, __pyx_v__chi, __pyx_v_o);

  /* "cypari/auto_gen.pxi":10294
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = galoischarpoly(_gal, _chi, o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoischartable(gal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10259
 *         return new_gen(_ret)
 * 
 *     def galoischarpoly(gal, chi, long o=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be the group attached to the :literal:`galoisinit`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoischarpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10296
 *         return new_gen(_ret)
 * 
 *     def galoischartable(gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the character table of:math:`G`, where:math:`G` is the underlying group of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_591galoischartable(PyObject *__pyx_v_gal, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_590galoischartable[] = "\n        Compute the character table of\302\240:math:`G`, where\302\240:math:`G` is the underlying group of\n        the :literal:`galoisinit` structure\302\240:emphasis:`gal`. The input\302\240:emphasis:`gal` is also allowed\n        to be a :literal:`t_VEC` of permutations that is closed under products.\n        Let\302\240:math:`N` be the number of conjugacy classes of\302\240:math:`G`.\n        Return a :literal:`t_VEC`\302\240:math:`[M,e]` where :math:`e >= 1` is an integer\n        and :math:`M` is a square :literal:`t_MAT` of size\302\240:math:`N` giving the character table\n        of\302\240:math:`G`.\n        \n        - Each column corresponds to an irreducible character; the characters\n          are ordered by increasing dimension and the first column is the trivial\n          character (hence contains only :math:`1`'s).\n        \n        - Each row corresponds to a conjugacy class; the conjugacy classes are\n          ordered as specified by :literal:`galoisconjclasses(gal)`, in particular the\n          first row corresponds to the identity and gives the dimension :math:`\\chi (1)`\n          of the irreducible representation attached to the successive characters\n          :math:`\\chi`.\n        \n        The value :math:`M[i,j]` of the character :math:`j` at the conjugacy class :math:`i`\n        is represented by a polynomial in :literal:`y` whose variable should be\n        interpreted as an :math:`e`-th root of unity, i.e. as the lift of\n        \n        ::\n        \n             Mod(y, polcyclo(e,'y))\n        \n        (Note that :math:`M` is the transpose of the usual orientation for\n        character tables.)\n        \n        The integer :math:`e` divides the exponent of the group :math:`G` and is chosen as small\n        as posible; for instance :math:`e = 1` when the characters are all defined over\n        :math:`\\mathbb{Q}`, as is the case for :math:`S_n`. Examples:\n        \n        ::\n        \n            ? K = nfsplitting(""x^4+x+1);\n            ? gal = galoisinit(K);\n            ? [M,e] = galoischartable(gal);\n            ? M~ \\\\ take the transpose to get the usual orientation\n            %4 =\n            [1 1 1 1 1]\n            \n            [1 -1 -1 1 1]\n            \n            [2 0 0 -1 2]\n            \n            [3 -1 1 0 -1]\n            \n            [3 1 -1 0 -1]\n            ? e\n            %5 = 1\n            ? {G = [Vecsmall([1, 2, 3, 4, 5]), Vecsmall([1, 5, 4, 3, 2]),\n             Vecsmall([2, 1, 5, 4, 3]), Vecsmall([2, 3, 4, 5, 1]),\n             Vecsmall([3, 2, 1, 5, 4]), Vecsmall([3, 4, 5, 1, 2]),\n             Vecsmall([4, 3, 2, 1, 5]), Vecsmall([4, 5, 1, 2, 3]),\n             Vecsmall([5, 1, 2, 3, 4]), Vecsmall([5, 4, 3, 2, 1])];}\n             \\\\G = D10\n            ? [M,e] = galoischartable(G);\n            ? M~\n            %8 =\n            [1 1 1 1]\n            \n            [1 -1 1 1]\n            \n            [2 0 -y^3 - y^2 - 1 y^3 + y^2]\n            \n            [2 0 y^3 + y^2 -y^3 - y^2 - 1]\n            ? e\n            %9 = 5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_591galoischartable(PyObject *__pyx_v_gal, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoischartable (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_590galoischartable(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_590galoischartable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("galoischartable", 0);

  /* "cypari/auto_gen.pxi":10368
 *             %9 = 5
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoischartable(_gal)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10368, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10369
 *         '''
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoischartable(_gal)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10370
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoischartable(_gal)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoischartable(__pyx_v__gal);

  /* "cypari/auto_gen.pxi":10371
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoischartable(_gal)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisconjclasses(gal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10296
 *         return new_gen(_ret)
 * 
 *     def galoischartable(gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the character table of:math:`G`, where:math:`G` is the underlying group of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoischartable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10373
 *         return new_gen(_ret)
 * 
 *     def galoisconjclasses(gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being output by :literal:`galoisinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_593galoisconjclasses(PyObject *__pyx_v_gal, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_592galoisconjclasses[] = "\n        :emphasis:`gal` being output by :literal:`galoisinit`,\n        return the list of conjugacy classes of the underlying group.\n        The ordering of the classes is consistent with :literal:`galoischartable`\n        and the trivial class comes first.\n        \n        ::\n        \n            ? G = galoisinit(x^6+108);\n            ? galoisidentify(G)\n            %2 = [6, 1] \\\\ S_3\n            ? S = galoisconjclasses(G)\n            %3 = [[Vecsmall([1,2,3,4,5,6])],\n             [Vecsmall([3,1,2,6,4,5]),Vecsmall([2,3,1,5,6,4])],\n             [Vecsmall([6,5,4,3,2,1]),Vecsmall([5,4,6,2,1,3]),\n             Vecsmall([4,6,5,1,3,2])]]\n            ? [[permorder(c[1]),#c] | c <- S ]\n            %4 = [[1,1], [3,2], [2,3]]\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`:\n        \n        ::\n        \n            ? subs = galoissubgroups(G); H = subs[5];\n            ? galoisidentify(H)\n            %2 = [2, 1] \\\\ Z/2\n            ? S = galoisconjclasses(subgroups_of_G[5]);\n            ? [[permorder(c[1]),#c] | c <- S ]\n            %4 = [[1,1], [2,1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_593galoisconjclasses(PyObject *__pyx_v_gal, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisconjclasses (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_592galoisconjclasses(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_592galoisconjclasses(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("galoisconjclasses", 0);

  /* "cypari/auto_gen.pxi":10404
 *             %4 = [[1,1], [2,1]]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisconjclasses(_gal)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10404, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10405
 *         '''
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisconjclasses(_gal)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10406
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisconjclasses(_gal)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisconjclasses(__pyx_v__gal);

  /* "cypari/auto_gen.pxi":10407
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisconjclasses(_gal)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisexport(gal, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10373
 *         return new_gen(_ret)
 * 
 *     def galoisconjclasses(gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being output by :literal:`galoisinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisconjclasses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10409
 *         return new_gen(_ret)
 * 
 *     def galoisexport(gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_595galoisexport(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_594galoisexport[] = "\n        :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,\n        export the underlying permutation group as a string suitable\n        for (no flags or :math:`flag = 0`) GAP or (:math:`flag = 1`) Magma. The following example\n        compute the index of the underlying abstract group in the GAP library:\n        \n        ::\n        \n            ? G = galoisinit(x^6+108);\n            ? s = galoisexport(G)\n            %2 = \"Group((1, 2, 3)(4, 5, 6), (1, 4)(2, 6)(3, 5))\"\n            ? extern(\"echo \\\"IdGroup(\"s\");\\\" | gap -q\")\n            %3 = [6, 1]\n            ? galoisidentify(G)\n            %4 = [6, 1]\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        \n        To :emphasis:`import` a GAP permutation into gp (for :literal:`galoissubfields` for\n        instance), the following GAP function may be useful:\n        \n        ::\n        \n            PermToGP := function(p, n)\n             return Permuted([1..n],p);\n            end;\n            \n            gap> p:= (1,26)(2,5)(3,17)(4,32)(6,9)(7,11)(8,24)(10,13)(12,15)(14,27)\n             (16,22)(18,28)(19,20)(21,29)(23,31)(25,30)\n            gap> PermToGP(p,32);\n            [ 26, 5, 17, 32, 2, 9, 11, 24, 6, 13, 7, 15, 10, 27, 12, 22, 3, 28, 20, 19,\n             29, 16, 31, 8, 30, 1, 14, 18, 21, 25, 23, 4 ]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_595galoisexport(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisexport") < 0)) __PYX_ERR(10, 10409, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10409, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisexport", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10409, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_594galoisexport(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_594galoisexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, long __pyx_v_flag) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("galoisexport", 0);

  /* "cypari/auto_gen.pxi":10443
 *              29, 16, 31, 8, 30, 1, 14, 18, 21, 25, 23, 4 ]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisexport(_gal, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10443, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10444
 *         '''
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisexport(_gal, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10445
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisexport(_gal, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisexport(__pyx_v__gal, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":10446
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisexport(_gal, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisfixedfield(gal, perm, long flag=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10409
 *         return new_gen(_ret)
 * 
 *     def galoisexport(gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10448
 *         return new_gen(_ret)
 * 
 *     def galoisfixedfield(gal, perm, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_597galoisfixedfield(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_596galoisfixedfield[] = "\n        :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit` and\n        :emphasis:`perm` an element of :math:`gal.group`, a vector of such elements\n        or a subgroup of :emphasis:`gal` as returned by galoissubgroups,\n        computes the fixed field of :emphasis:`gal` by the automorphism defined by the\n        permutations :emphasis:`perm` of the roots :math:`gal.roots`. :math:`P` is guaranteed to\n        be squarefree modulo :math:`gal.p`.\n        \n        If no flags or :math:`flag = 0`, output format is the same as for :literal:`nfsubfield`,\n        returning :math:`[P,x]` such that :math:`P` is a polynomial defining the fixed field, and\n        :math:`x` is a root of :math:`P` expressed as a polmod in :math:`gal.pol`.\n        \n        If :math:`flag = 1` return only the polynomial :math:`P`.\n        \n        If :math:`flag = 2` return :math:`[P,x,F]` where :math:`P` and :math:`x` are as above and :math:`F` is the\n        factorization of :math:`gal.pol` over the field defined by :math:`P`, where\n        variable :math:`v` (:math:`y` by default) stands for a root of :math:`P`. The priority of :math:`v`\n        must be less than the priority of the variable of :math:`gal.pol` (see\n        ``priority`` (in the PARI manual)).\n        In this case, :math:`P` is also expressed in the variable :math:`v` for compatibility\n        with :math:`F`. Example:\n        \n        ::\n        \n            ? G = galoisinit(x^4+1);\n            ? galoisfixedfield(G,G.group[2],2)\n            %2 = [y^2 - 2, Mod(- x^3 + x, x^4 + 1), [x^2 - y*x + 1, x^2 + y*x + 1]]\n        \n        computes the factorization :math:`x^4+1 = (x^2-\\sqrt{2}x+1)(x^2+\\sqrt{2}x+1)`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_597galoisfixedfield(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_perm = 0;
  long __pyx_v_flag;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisfixedfield (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_perm,&__pyx_n_s_flag,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_perm)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisfixedfield") < 0)) __PYX_ERR(10, 10448, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_perm = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10448, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisfixedfield", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10448, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisfixedfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_596galoisfixedfield(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), __pyx_v_perm, __pyx_v_flag, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_596galoisfixedfield(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_perm, long __pyx_v_flag, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__gal;
  GEN __pyx_v__perm;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("galoisfixedfield", 0);
  __Pyx_INCREF(__pyx_v_perm);

  /* "cypari/auto_gen.pxi":10479
 *         computes the factorization :math:`x^4+1 = (x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)`
 *         '''
 *         perm = objtogen(perm)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_perm, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_perm, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10480
 *         '''
 *         perm = objtogen(perm)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":10481
 *         perm = objtogen(perm)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":10482
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 10482, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":10481
 *         perm = objtogen(perm)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10483
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 10483, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10484
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_6;

  /* "cypari/auto_gen.pxi":10485
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_perm)->__pyx_base.g;
  __pyx_v__perm = __pyx_t_6;

  /* "cypari/auto_gen.pxi":10486
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisfixedfield(__pyx_v__gal, __pyx_v__perm, __pyx_v_flag, __pyx_v__v);

  /* "cypari/auto_gen.pxi":10487
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoisfixedfield(_gal, _perm, flag, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisidentify(gal):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10448
 *         return new_gen(_ret)
 * 
 *     def galoisfixedfield(gal, perm, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisfixedfield", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_perm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10489
 *         return new_gen(_ret)
 * 
 *     def galoisidentify(gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_599galoisidentify(PyObject *__pyx_v_gal, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_598galoisidentify[] = "\n        :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,\n        output the isomorphism class of the underlying abstract group as a\n        two-components vector :math:`[o,i]`, where :math:`o` is the group order, and :math:`i` is the\n        group index in the GAP4 Small Group library, by Hans Ulrich Besche, Bettina\n        Eick and Eamonn O'Brien.\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        \n        The current implementation is limited to degree less or equal to :math:`127`.\n        Some larger \"easy\" orders are also supported.\n        \n        The output is similar to the output of the function :literal:`IdGroup` in GAP4.\n        Note that GAP4 :literal:`IdGroup` handles all groups of order less than :math:`2000`\n        except :math:`1024`, so you can use :literal:`galoisexport` and GAP4 to identify large\n        Galois groups.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_599galoisidentify(PyObject *__pyx_v_gal, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisidentify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_598galoisidentify(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_598galoisidentify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("galoisidentify", 0);

  /* "cypari/auto_gen.pxi":10507
 *         Galois groups.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisidentify(_gal)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10507, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10508
 *         '''
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisidentify(_gal)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10509
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisidentify(_gal)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisidentify(__pyx_v__gal);

  /* "cypari/auto_gen.pxi":10510
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisidentify(_gal)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisinit(pol, den=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10489
 *         return new_gen(_ret)
 * 
 *     def galoisidentify(gal):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being be a Galois group as output by :literal:`galoisinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisidentify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10512
 *         return new_gen(_ret)
 * 
 *     def galoisinit(pol, den=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Galois group
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_601galoisinit(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_600galoisinit[] = "\n        Computes the Galois group\n        and all necessary information for computing the fixed fields of the\n        Galois extension :math:`K/\\mathbb{Q}` where :math:`K` is the number field defined by\n        :math:`pol` (monic irreducible polynomial in :math:`\\mathbb{Z}[X]` or\n        a number field as output by :literal:`nfinit`). The extension :math:`K/\\mathbb{Q}` must be\n        Galois with Galois group \"weakly\" super-solvable, see below;\n        returns 0 otherwise. Hence this permits to quickly check whether a polynomial\n        of order strictly less than :math:`36` is Galois or not.\n        \n        The algorithm used is an improved version of the paper\n        \"An efficient algorithm for the computation of Galois automorphisms\",\n        Bill Allombert, Math.\302\240Comp, vol.\302\24073, 245, 2001, pp.\302\240359--375.\n        \n        A group :math:`G` is said to be \"weakly\" super-solvable if there exists a\n        normal series\n        \n        :math:`{1} = H_0 \\triangleleft H_1 \\triangleleft...\\triangleleft H_{n-1}\n        \\triangleleft H_n`\n        \n        such that each :math:`H_i` is normal in :math:`G` and for :math:`i < n`, each quotient group\n        :math:`H_{i+1}/H_i` is cyclic, and either :math:`H_n = G` (then :math:`G` is super-solvable) or\n        :math:`G/H_n` is isomorphic to either :math:`A_4` or :math:`S_4`.\n        \n        In practice, almost all small groups are WKSS, the exceptions having order\n        36(1 exception), 48(2), 56(1), 60(1), 72(5), 75(1), 80(1), 96(10) and :math:`\\geq\n        108`.\n        \n        This function is a prerequisite for most of the :literal:`galois`:math:`xxx` routines.\n        For instance:\n        \n        ::\n        \n            P = x^6 + 108;\n            G = galoisinit(P);\n            L = galoissubgroups(G);\n            vector(#L, i, galoisisabelian(L[i],1))\n            vector(#L, i, galoisidentify(L[i]))\n        \n        The output is an 8-compone""nt vector :emphasis:`gal`.\n        \n        :math:`gal[1]` contains the polynomial :emphasis:`pol`\n        (:literal:`:emphasis:`gal`.pol`).\n        \n        :math:`gal[2]` is a three-components vector :math:`[p,e,q]` where :math:`p` is a\n        prime number (:literal:`:emphasis:`gal`.p`) such that :emphasis:`pol` totally split\n        modulo :math:`p` , :math:`e` is an integer and :math:`q = p^e` (:literal:`:emphasis:`gal`.mod`) is the\n        modulus of the roots in :literal:`:emphasis:`gal`.roots`.\n        \n        :math:`gal[3]` is a vector :math:`L` containing the :math:`p`-adic roots of\n        :emphasis:`pol` as integers implicitly modulo :literal:`:emphasis:`gal`.mod`.\n        (:literal:`:emphasis:`gal`.roots`).\n        \n        :math:`gal[4]` is the inverse of the Vandermonde matrix of the\n        :math:`p`-adic roots of :emphasis:`pol`, multiplied by :math:`gal[5]`.\n        \n        :math:`gal[5]` is a multiple of the least common denominator of the\n        automorphisms expressed as polynomial in a root of :emphasis:`pol`.\n        \n        :math:`gal[6]` is the Galois group :math:`G` expressed as a vector of\n        permutations of :math:`L` (:literal:`:emphasis:`gal`.group`).\n        \n        :math:`gal[7]` is a generating subset :math:`S = [s_1,...,s_g]` of :math:`G`\n        expressed as a vector of permutations of :math:`L` (:literal:`:emphasis:`gal`.gen`).\n        \n        :math:`gal[8]` contains the relative orders :math:`[o_1,...,o_g]` of\n        the generators of :math:`S` (:literal:`:emphasis:`gal`.orders`).\n        \n        Let :math:`H_n` be as above, we have the following properties:\n        \n        \302\240\302\240:strong:`*` if :math:`G/H_n ~ A_4` then :math:`[o_1,...,o_g]` ends by\n        :math:`[2,2,3]`.\n        \n        \302\240\302\240:strong:`*` if :math:`G/H_n ~ S_4` then :math:`[o_1,...,o_g]` ends by\n        :math:`[2,2,3,2]`.\n        \n        \302\240\302\240:strong:`*` for :math:`1 <= i <= g` th""e subgroup of :math:`G` generated by\n        :math:`[s_1,...,s_i]` is normal, with the exception of :math:`i = g-2` in the\n        :math:`A_4` case and of :math:`i = g-3` in the :math:`S_4` case.\n        \n        \302\240\302\240:strong:`*` the relative order :math:`o_i` of :math:`s_i` is its order in the\n        quotient group :math:`G/<\302\240s_1,...,s_{i-1}>`, with the same\n        exceptions.\n        \n        \302\240\302\240:strong:`*` for any :math:`x\\in G` there exists a unique family\n        :math:`[e_1,...,e_g]` such that (no exceptions):\n        \n        -- for :math:`1 <= i <= g` we have :math:`0 <= e_i < o_i`\n        \n        -- :math:`x = g_1^{e_1}g_2^{e_2}...g_n^{e_n}`\n        \n        If present :math:`den` must be a suitable value for :math:`gal[5]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_601galoisinit(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_den = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_den,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_den);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisinit") < 0)) __PYX_ERR(10, 10512, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_den = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisinit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10512, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_600galoisinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol), __pyx_v_den);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_600galoisinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_den) {
  int __pyx_v__have_den;
  GEN __pyx_v__pol;
  GEN __pyx_v__den;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("galoisinit", 0);
  __Pyx_INCREF(__pyx_v_den);

  /* "cypari/auto_gen.pxi":10606
 *         If present :math:`den` must be a suitable value for :math:`gal[5]`.
 *         '''
 *         cdef bint _have_den = (den is not None)             # <<<<<<<<<<<<<<
 *         if _have_den:
 *             den = objtogen(den)
 */
  __pyx_t_1 = (__pyx_v_den != Py_None);
  __pyx_v__have_den = __pyx_t_1;

  /* "cypari/auto_gen.pxi":10607
 *         '''
 *         cdef bint _have_den = (den is not None)
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             den = objtogen(den)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_den != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10608
 *         cdef bint _have_den = (den is not None)
 *         if _have_den:
 *             den = objtogen(den)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_den, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_den, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":10607
 *         '''
 *         cdef bint _have_den = (den is not None)
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             den = objtogen(den)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10609
 *         if _have_den:
 *             den = objtogen(den)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 10609, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10610
 *             den = objtogen(den)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _den = NULL
 *         if _have_den:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_4;

  /* "cypari/auto_gen.pxi":10611
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL             # <<<<<<<<<<<<<<
 *         if _have_den:
 *             _den = (<Gen>den).g
 */
  __pyx_v__den = NULL;

  /* "cypari/auto_gen.pxi":10612
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)
 */
  __pyx_t_1 = (__pyx_v__have_den != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10613
 *         cdef GEN _den = NULL
 *         if _have_den:
 *             _den = (<Gen>den).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisinit(_pol, _den)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_den)->__pyx_base.g;
    __pyx_v__den = __pyx_t_4;

    /* "cypari/auto_gen.pxi":10612
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _den = NULL
 *         if _have_den:             # <<<<<<<<<<<<<<
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)
 */
  }

  /* "cypari/auto_gen.pxi":10614
 *         if _have_den:
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisinit(__pyx_v__pol, __pyx_v__den);

  /* "cypari/auto_gen.pxi":10615
 *             _den = (<Gen>den).g
 *         cdef GEN _ret = galoisinit(_pol, _den)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisisabelian(gal, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10512
 *         return new_gen(_ret)
 * 
 *     def galoisinit(pol, den=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the Galois group
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_den);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10617
 *         return new_gen(_ret)
 * 
 *     def galoisisabelian(gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, return :math:`0` if
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_603galoisisabelian(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_602galoisisabelian[] = "\n        :emphasis:`gal` being as output by :literal:`galoisinit`, return :math:`0` if\n        :emphasis:`gal` is not an abelian group, and the HNF matrix of :emphasis:`gal` over\n        :literal:`gal.gen` if :math:`flag = 0`, :math:`1` if :math:`flag = 1`, and the SNF matrix of :emphasis:`gal`\n        if :math:`flag = 2`.\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_603galoisisabelian(PyObject *__pyx_v_gal, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisisabelian (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoisisabelian") < 0)) __PYX_ERR(10, 10617, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10617, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoisisabelian", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10617, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisisabelian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_602galoisisabelian(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_602galoisisabelian(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, long __pyx_v_flag) {
  GEN __pyx_v__gal;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("galoisisabelian", 0);

  /* "cypari/auto_gen.pxi":10626
 *         This command also accepts subgroups returned by :literal:`galoissubgroups`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisisabelian(_gal, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10626, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10627
 *         '''
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisisabelian(_gal, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10628
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisisabelian(_gal, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisisabelian(__pyx_v__gal, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":10629
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _ret = galoisisabelian(_gal, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoisisnormal(gal, subgrp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10617
 *         return new_gen(_ret)
 * 
 *     def galoisisabelian(gal, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, return :math:`0` if
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisisabelian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10631
 *         return new_gen(_ret)
 * 
 *     def galoisisnormal(gal, subgrp):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, and :emphasis:`subgrp` a subgroup
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_605galoisisnormal(PyObject *__pyx_v_gal, PyObject *__pyx_v_subgrp); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_604galoisisnormal[] = "\n        :emphasis:`gal` being as output by :literal:`galoisinit`, and :emphasis:`subgrp` a subgroup\n        of :emphasis:`gal` as output by :literal:`galoissubgroups`,return :math:`1` if :emphasis:`subgrp` is a\n        normal subgroup of :emphasis:`gal`, else return 0.\n        \n        This command also accepts subgroups returned by :literal:`galoissubgroups`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_605galoisisnormal(PyObject *__pyx_v_gal, PyObject *__pyx_v_subgrp) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoisisnormal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_604galoisisnormal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), ((PyObject *)__pyx_v_subgrp));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_604galoisisnormal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_subgrp) {
  GEN __pyx_v__gal;
  GEN __pyx_v__subgrp;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoisisnormal", 0);
  __Pyx_INCREF(__pyx_v_subgrp);

  /* "cypari/auto_gen.pxi":10639
 *         This command also accepts subgroups returned by :literal:`galoissubgroups`.
 *         '''
 *         subgrp = objtogen(subgrp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_subgrp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10639, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_subgrp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10640
 *         '''
 *         subgrp = objtogen(subgrp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 10640, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10641
 *         subgrp = objtogen(subgrp)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10642
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _subgrp = (<Gen>subgrp).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_subgrp)->__pyx_base.g;
  __pyx_v__subgrp = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10643
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = galoisisnormal(__pyx_v__gal, __pyx_v__subgrp);

  /* "cypari/auto_gen.pxi":10644
 *         cdef GEN _subgrp = (<Gen>subgrp).g
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":10645
 *         cdef long _ret = galoisisnormal(_gal, _subgrp)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def galoispermtopol(gal, perm):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10631
 *         return new_gen(_ret)
 * 
 *     def galoisisnormal(gal, subgrp):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being as output by :literal:`galoisinit`, and :emphasis:`subgrp` a subgroup
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoisisnormal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_subgrp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10647
 *         return _ret
 * 
 *     def galoispermtopol(gal, perm):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_607galoispermtopol(PyObject *__pyx_v_gal, PyObject *__pyx_v_perm); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_606galoispermtopol[] = "\n        :emphasis:`gal` being a\n        Galois group as output by :literal:`galoisinit` and :emphasis:`perm` a element of\n        :math:`gal.group`, return the polynomial defining the Galois\n        automorphism, as output by :literal:`nfgaloisconj`, attached to the\n        permutation :emphasis:`perm` of the roots :math:`gal.roots`. :emphasis:`perm` can\n        also be a vector or matrix, in this case, :literal:`galoispermtopol` is\n        applied to all components recursively.\n        \n        Note that\n        \n        ::\n        \n            G = galoisinit(pol);\n            galoispermtopol(G, G[6])~\n        \n        is equivalent to :literal:`nfgaloisconj(pol)`, if degree of :emphasis:`pol` is greater\n        or equal to :math:`2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_607galoispermtopol(PyObject *__pyx_v_gal, PyObject *__pyx_v_perm) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoispermtopol (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_606galoispermtopol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_gal), ((PyObject *)__pyx_v_perm));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_606galoispermtopol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_gal, PyObject *__pyx_v_perm) {
  GEN __pyx_v__gal;
  GEN __pyx_v__perm;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("galoispermtopol", 0);
  __Pyx_INCREF(__pyx_v_perm);

  /* "cypari/auto_gen.pxi":10667
 *         or equal to :math:`2`.
 *         '''
 *         perm = objtogen(perm)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_perm, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_perm, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10668
 *         '''
 *         perm = objtogen(perm)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 10668, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10669
 *         perm = objtogen(perm)
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10670
 *         sig_on()
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_perm)->__pyx_base.g;
  __pyx_v__perm = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10671
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoispermtopol(__pyx_v__gal, __pyx_v__perm);

  /* "cypari/auto_gen.pxi":10672
 *         cdef GEN _perm = (<Gen>perm).g
 *         cdef GEN _ret = galoispermtopol(_gal, _perm)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoissubcyclo(N, H=None, long fl=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10647
 *         return _ret
 * 
 *     def galoispermtopol(gal, perm):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`gal` being a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoispermtopol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_perm);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10674
 *         return new_gen(_ret)
 * 
 *     def galoissubcyclo(N, H=None, long fl=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the subextension of :math:`\mathbb{Q} (\zeta_n)` fixed by the subgroup
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_609galoissubcyclo(PyObject *__pyx_v_N, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_608galoissubcyclo[] = "\n        Computes the subextension of :math:`\\mathbb{Q} (\\zeta_n)` fixed by the subgroup\n        :math:`H \\subset (\\mathbb{Z}/n\\mathbb{Z})^*`. By the Kronecker-Weber theorem, all abelian number\n        fields can be generated in this way (uniquely if :math:`n` is taken to be minimal).\n        \n        The pair :math:`(n, H)` is deduced from the parameters :math:`(N, H)` as follows\n        \n        - :math:`N` an integer: then :math:`n = N`; :math:`H` is a generator, i.e. an\n          integer or an integer modulo :math:`n`; or a vector of generators.\n        \n        - :math:`N` the output of :literal:`znstar`:math:`(n)` or :literal:`znstar`:math:`(n,1)`.\n          :math:`H` as in the first case above, or a matrix, taken to be a HNF left divisor\n          of the SNF for :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`\n          (:literal:`:math:`N`.cyc`), giving the generators of :math:`H` in terms of :literal:`:math:`N`.gen`.\n        \n        - :math:`N` the output of :literal:`bnrinit(bnfinit(y), :math:`m`)` where :math:`m` is a\n          module. :math:`H` as in the first case, or a matrix taken to be a HNF left\n          divisor of the SNF for the ray class group modulo :math:`m`\n          (of type :literal:`:math:`N`.cyc`), giving the generators of :math:`H` in terms of\n          :literal:`:math:`N`.bid.gen` ( = :literal:`:math:`N``.gen if :math:`N` includes generators).\n        \n        In this last case, beware that :math:`H` is understood relatively to :math:`N`; in\n        particular, if the infinite place does not divide the module, e.g if :math:`m` is\n        an integer, then it is not a subgroup of :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`, but of its quotient by\n        :math:`{\302\261 1}`.\n        \n        If :math:`fl = 0`, compute a polynomial (in the variable :emphasis:`v`) defining\n        the subfield of :math:`\\mathbb{Q} (\\zeta_n)` fixed by the subgroup :emphasis:`H` of :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`.\n        \n        If :""math:`fl = 1`, compute only the conductor of the abelian extension, as a module.\n        \n        If :math:`fl = 2`, output :math:`[pol, N]`, where :math:`pol` is the polynomial as output when\n        :math:`fl = 0` and :math:`N` the conductor as output when :math:`fl = 1`.\n        \n        The following function can be used to compute all subfields of\n        :math:`\\mathbb{Q} (\\zeta_n)` (of exact degree :literal:`d`, if :literal:`d` is set):\n        \n        ::\n        \n            subcyclo(n, d = -1)=\n            { my(bnr,L,IndexBound);\n             IndexBound = if (d < 0, n, [d]);\n             bnr = bnrinit(bnfinit(y), [n,[1]]);\n             L = subgrouplist(bnr, IndexBound, 1);\n             vector(#L,i, galoissubcyclo(bnr,L[i]));\n            }\n        \n        Setting :literal:`L = subgrouplist(bnr, IndexBound)` would produce subfields of\n        exact conductor :math:`n oo`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_609galoissubcyclo(PyObject *__pyx_v_N, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_H = 0;
  long __pyx_v_fl;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoissubcyclo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_H,&__pyx_n_s_fl,&__pyx_n_s_v,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[2] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoissubcyclo") < 0)) __PYX_ERR(10, 10674, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_H = values[0];
    if (values[1]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10674, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)0);
    }
    __pyx_v_v = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoissubcyclo", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10674, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoissubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_608galoissubcyclo(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N), __pyx_v_H, __pyx_v_fl, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_608galoissubcyclo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, PyObject *__pyx_v_H, long __pyx_v_fl, PyObject *__pyx_v_v) {
  int __pyx_v__have_H;
  long __pyx_v__v;
  GEN __pyx_v__N;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("galoissubcyclo", 0);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":10725
 *         exact conductor :math:`n oo`.
 *         '''
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_1 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_1;

  /* "cypari/auto_gen.pxi":10726
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         cdef long _v = -1
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10727
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":10726
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         cdef long _v = -1
 */
  }

  /* "cypari/auto_gen.pxi":10728
 *         if _have_H:
 *             H = objtogen(H)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":10729
 *             H = objtogen(H)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_1 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":10730
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 10730, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":10729
 *             H = objtogen(H)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10731
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 10731, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10732
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_6;

  /* "cypari/auto_gen.pxi":10733
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":10734
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 */
  __pyx_t_3 = (__pyx_v__have_H != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":10735
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_6;

    /* "cypari/auto_gen.pxi":10734
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 */
  }

  /* "cypari/auto_gen.pxi":10736
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoissubcyclo(__pyx_v__N, __pyx_v__H, __pyx_v_fl, __pyx_v__v);

  /* "cypari/auto_gen.pxi":10737
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = galoissubcyclo(_N, _H, fl, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoissubfields(G, long flag=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10674
 *         return new_gen(_ret)
 * 
 *     def galoissubcyclo(N, H=None, long fl=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the subextension of :math:`\mathbb{Q} (\zeta_n)` fixed by the subgroup
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoissubcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10739
 *         return new_gen(_ret)
 * 
 *     def galoissubfields(G, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subfields of the Galois group :emphasis:`G`, as a vector.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_611galoissubfields(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_610galoissubfields[] = "\n        Outputs all the subfields of the Galois group :emphasis:`G`, as a vector.\n        This works by applying :literal:`galoisfixedfield` to all subgroups. The meaning of\n        :emphasis:`flag` is the same as for :literal:`galoisfixedfield`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_611galoissubfields(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoissubfields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoissubfields") < 0)) __PYX_ERR(10, 10739, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10739, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoissubfields", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10739, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoissubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_610galoissubfields(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_flag, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_610galoissubfields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, long __pyx_v_flag, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("galoissubfields", 0);

  /* "cypari/auto_gen.pxi":10745
 *         :emphasis:`flag` is the same as for :literal:`galoisfixedfield`.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":10746
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":10747
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 10747, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":10746
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10748
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 10748, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10749
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_5;

  /* "cypari/auto_gen.pxi":10750
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoissubfields(__pyx_v__G, __pyx_v_flag, __pyx_v__v);

  /* "cypari/auto_gen.pxi":10751
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubfields(_G, flag, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def galoissubgroups(G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 10751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10739
 *         return new_gen(_ret)
 * 
 *     def galoissubfields(G, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subfields of the Galois group :emphasis:`G`, as a vector.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoissubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10753
 *         return new_gen(_ret)
 * 
 *     def galoissubgroups(G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subgroups of the Galois group :literal:`gal`. A subgroup is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_613galoissubgroups(PyObject *__pyx_v_G, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_612galoissubgroups[] = "\n        Outputs all the subgroups of the Galois group :literal:`gal`. A subgroup is a\n        vector [:emphasis:`gen`, :emphasis:`orders`], with the same meaning\n        as for :math:`gal.gen` and :math:`gal.orders`. Hence :emphasis:`gen` is a vector of\n        permutations generating the subgroup, and :emphasis:`orders` is the relatives\n        orders of the generators. The cardinality of a subgroup is the product of the\n        relative orders. Such subgroup can be used instead of a Galois group in the\n        following command: :literal:`galoisisabelian`, :literal:`galoissubgroups`,\n        :literal:`galoisexport` and :literal:`galoisidentify`.\n        \n        To get the subfield fixed by a subgroup :emphasis:`sub` of :emphasis:`gal`, use\n        \n        ::\n        \n            galoisfixedfield(gal,sub[1])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_613galoissubgroups(PyObject *__pyx_v_G, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoissubgroups (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_612galoissubgroups(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_612galoissubgroups(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("galoissubgroups", 0);

  /* "cypari/auto_gen.pxi":10770
 *             galoisfixedfield(gal,sub[1])
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubgroups(_G)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10770, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10771
 *         '''
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoissubgroups(_G)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10772
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubgroups(_G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoissubgroups(__pyx_v__G);

  /* "cypari/auto_gen.pxi":10773
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = galoissubgroups(_G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gamma(s, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10753
 *         return new_gen(_ret)
 * 
 *     def galoissubgroups(G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs all the subgroups of the Galois group :literal:`gal`. A subgroup is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.galoissubgroups", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10775
 *         return new_gen(_ret)
 * 
 *     def gamma(s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a complex number, evaluates Euler's gamma
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_615gamma(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_614gamma[] = "\n        For :math:`s` a complex number, evaluates Euler's gamma\n        function\n        \n        .. MATH::\n        \n            \\Gamma (s) = \\int_0^ oo t^{s-1}\\exp (-t)dt.\n        \n        Error if :math:`s` is a non-positive integer, where :math:`\\Gamma` has a pole.\n        \n        For :math:`s` a :literal:`t_PADIC`, evaluates the Morita gamma function at :math:`s`, that\n        is the unique continuous :math:`p`-adic function on the :math:`p`-adic integers\n        extending :math:`\\Gamma_p(k) = (-1)^k \\prod_{j < k}'j`, where the prime means that :math:`p`\n        does not divide :math:`j`.\n        \n        ::\n        \n            ? gamma(1/4 + O(5^10))\n            %1= 1 + 4*5 + 3*5^4 + 5^6 + 5^7 + 4*5^9 + O(5^10)\n            ? algdep(%,4)\n            %2 = x^4 + 4*x^2 + 5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_615gamma(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gamma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gamma") < 0)) __PYX_ERR(10, 10775, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10775, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gamma", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10775, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.gamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_614gamma(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_614gamma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("gamma", 0);

  /* "cypari/auto_gen.pxi":10798
 *             %2 = x^4 + 4*x^2 + 5
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10798, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10799
 *         '''
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggamma(_s, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10800
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ggamma(_s, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":10801
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggamma(_s, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ggamma(__pyx_v__s, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":10802
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggamma(_s, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammah(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10802, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10775
 *         return new_gen(_ret)
 * 
 *     def gamma(s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a complex number, evaluates Euler's gamma
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.gamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10804
 *         return new_gen(_ret)
 * 
 *     def gammah(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gamma function evaluated at the argument :math:`x+1/2`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_617gammah(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_616gammah[] = "\n        Gamma function evaluated at the argument :math:`x+1/2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_617gammah(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammah (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammah") < 0)) __PYX_ERR(10, 10804, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10804, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammah", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10804, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammah", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_616gammah(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_616gammah(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("gammah", 0);

  /* "cypari/auto_gen.pxi":10808
 *         Gamma function evaluated at the argument :math:`x+1/2`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10808, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10809
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggammah(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10810
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ggammah(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":10811
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggammah(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ggammah(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":10812
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = ggammah(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammamellininv(G, t, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 10812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10804
 *         return new_gen(_ret)
 * 
 *     def gammah(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gamma function evaluated at the argument :math:`x+1/2`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammah", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10814
 *         return new_gen(_ret)
 * 
 *     def gammamellininv(G, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`t` of the inverse Mellin transform
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_619gammamellininv(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_618gammamellininv[] = "\n        Returns the value at :math:`t` of the inverse Mellin transform\n        :math:`G` initialized by :literal:`gammamellininvinit`.\n        \n        ::\n        \n            ? G = gammamellininvinit([0]);\n            ? gammamellininv(G, 2) - 2*exp(-Pi*2^2)\n            %2 = -4.484155085839414627 E-44\n        \n        The alternative shortcut\n        \n        ::\n        \n             gammamellininv(A,t,m)\n        \n        for\n        \n        ::\n        \n             gammamellininv(gammamellininvinit(A,m), t)\n        \n        is available.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_619gammamellininv(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammamellininv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammamellininv") < 0)) __PYX_ERR(10, 10814, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_t = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10814, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10814, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammamellininv", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10814, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammamellininv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_618gammamellininv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_t, __pyx_v_m, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_618gammamellininv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__G;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("gammamellininv", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_gen.pxi":10839
 *         is available.
 *         '''
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10839, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":10840
 *         '''
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 10840, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10841
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10842
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_gen.pxi":10843
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":10844
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":10843
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 */
  }

  /* "cypari/auto_gen.pxi":10845
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gammamellininv(__pyx_v__G, __pyx_v__t, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":10846
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininv(_G, _t, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammamellininvasymp(A, long serprec=-1, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 10846, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10814
 *         return new_gen(_ret)
 * 
 *     def gammamellininv(G, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value at :math:`t` of the inverse Mellin transform
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammamellininv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10848
 *         return new_gen(_ret)
 * 
 *     def gammamellininvasymp(A, long serprec=-1, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the first :math:`n` terms of the asymptotic expansion at infinity
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_621gammamellininvasymp(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_620gammamellininvasymp[] = "\n        Return the first :math:`n` terms of the asymptotic expansion at infinity\n        of the :math:`m`-th derivative :math:`K^{(m)}(t)` of the inverse Mellin transform of the\n        function\n        \n        .. MATH::\n        \n            f(s) = \\Gamma_\\mathbb{R} (s+a_1)...\\Gamma_\\mathbb{R} (s+a_d) ,\n        \n        where :literal:`A` is the vector :math:`[a_1,...,a_d]` and\n        :math:`\\Gamma_\\mathbb{R} (s) = \\pi^{-s/2} \\Gamma (s/2)` (Euler's :literal:`gamma`).\n        The result is a vector\n        :math:`[M[1]...M[n]]` with M[1] = 1, such that\n        \n        .. MATH::\n        \n            K^{(m)}(t) = \\sqrt{2^{d+1}/d}t^{a+m(2/d-1)}e^{-d\\pi t^{2/d}}\n            \\sum_{n >= 0} M[n+1] (\\pi t^{2/d})^{-n}\n        \n        with :math:`a = (1-d+\\sum_{1 <= j <= d}a_j)/d`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_621gammamellininvasymp(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammamellininvasymp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,&__pyx_n_s_n,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammamellininvasymp") < 0)) __PYX_ERR(10, 10848, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10848, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10848, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammamellininvasymp", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10848, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammamellininvasymp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_620gammamellininvasymp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_serprec, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_620gammamellininvasymp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, long __pyx_v_serprec, long __pyx_v_n) {
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("gammamellininvasymp", 0);

  /* "cypari/auto_gen.pxi":10870
 *         with :math:`a = (1-d+\sum_{1 <= j <= d}a_j)/d`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10870, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10871
 *         '''
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10872
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 */
  __pyx_t_3 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":10873
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":10872
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 */
  }

  /* "cypari/auto_gen.pxi":10874
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gammamellininvasymp(__pyx_v__A, __pyx_v_serprec, __pyx_v_n);

  /* "cypari/auto_gen.pxi":10875
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = gammamellininvasymp(_A, serprec, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gammamellininvinit(A, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 10875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10848
 *         return new_gen(_ret)
 * 
 *     def gammamellininvasymp(A, long serprec=-1, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the first :math:`n` terms of the asymptotic expansion at infinity
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammamellininvasymp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10877
 *         return new_gen(_ret)
 * 
 *     def gammamellininvinit(A, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for the computation by :literal:`gammamellininv` of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_623gammamellininvinit(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_622gammamellininvinit[] = "\n        Initialize data for the computation by :literal:`gammamellininv` of\n        the :math:`m`-th derivative of the inverse Mellin transform of the function\n        \n        .. MATH::\n        \n            f(s) = \\Gamma_\\mathbb{R} (s+a_1)...\\Gamma_\\mathbb{R} (s+a_d)\n        \n        where :literal:`A` is the vector :math:`[a_1,...,a_d]` and\n        :math:`\\Gamma_\\mathbb{R} (s) = \\pi^{-s/2} \\Gamma (s/2)` (Euler's :literal:`gamma`). This is the\n        special case of Meijer's :math:`G` functions used to compute :math:`L`-values via the\n        approximate functional equation.\n        \n        :strong:`Caveat.` Contrary to the PARI convention, this function\n        guarantees an :emphasis:`absolute` (rather than relative) error bound.\n        \n        For instance, the inverse Mellin transform of :math:`\\Gamma_\\mathbb{R} (s)` is\n        :math:`2\\exp (-\\pi z^2)`:\n        \n        ::\n        \n            ? G = gammamellininvinit([0]);\n            ? gammamellininv(G, 2) - 2*exp(-Pi*2^2)\n            %2 = -4.484155085839414627 E-44\n        \n        The inverse Mellin transform of :math:`\\Gamma_\\mathbb{R} (s+1)` is\n        :math:`2 z\\exp (-\\pi z^2)`, and its second derivative is\n        :math:`4\\pi z \\exp (-\\pi z^2)(2\\pi z^2 - 3)`:\n        \n        ::\n        \n            ? G = gammamellininvinit([1], 2);\n            ? a(z) = 4*Pi*z*exp(-Pi*z^2)*(2*Pi*z^2-3);\n            ? b(z) = gammamellininv(G,z);\n            ? t(z) = b(z) - a(z);\n            ? t(3/2)\n            %3 = -1.4693679385278593850 E-39\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_623gammamellininvinit(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gammamellininvinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gammamellininvinit") < 0)) __PYX_ERR(10, 10877, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10877, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 10877, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gammamellininvinit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10877, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammamellininvinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_622gammamellininvinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_m, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_622gammamellininvinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("gammamellininvinit", 0);

  /* "cypari/auto_gen.pxi":10916
 *             %3 = -1.4693679385278593850 E-39
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 10916, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10917
 *         '''
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_2;

  /* "cypari/auto_gen.pxi":10918
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 */
  __pyx_t_3 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":10919
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":10918
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 */
  }

  /* "cypari/auto_gen.pxi":10920
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gammamellininvinit(__pyx_v__A, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":10921
 *             precision = default_bitprec()
 *         cdef GEN _ret = gammamellininvinit(_A, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gcd(x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 10921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10877
 *         return new_gen(_ret)
 * 
 *     def gammamellininvinit(A, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for the computation by :literal:`gammamellininv` of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.gammamellininvinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10923
 *         return new_gen(_ret)
 * 
 *     def gcd(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the greatest common divisor of :math:`x` and :math:`y`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_625gcd(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_624gcd[] = "\n        Creates the greatest common divisor of :math:`x` and :math:`y`.\n        If you also need the :math:`u` and :math:`v` such that :math:`x*u + y*v = \\mathrm{gcd} (x,y)`,\n        use the :literal:`gcdext` function. :math:`x` and :math:`y` can have rather quite general\n        types, for instance both rational numbers. If :math:`y` is omitted and :math:`x` is a\n        vector, returns the :math:`gcd` of all components of :math:`x`, i.e.\302\240this is\n        equivalent to :literal:`content(x)`.\n        \n        When :math:`x` and :math:`y` are both given and one of them is a vector/matrix type,\n        the GCD is again taken recursively on each component, but in a different way.\n        If :math:`y` is a vector, resp.\302\240matrix, then the result has the same type as :math:`y`,\n        and components equal to :literal:`gcd(x, y[i])`, resp.\302\240:literal:`gcd(x, y[,i])`. Else\n        if :math:`x` is a vector/matrix the result has the same type as :math:`x` and an\n        analogous definition. Note that for these types, :literal:`gcd` is not\n        commutative.\n        \n        The algorithm used is a naive Euclid except for the following inputs:\n        \n        - integers: use modified right-shift binary (\"plus-minus\"\n          variant).\n        \n        - univariate polynomials with coefficients in the same number\n          field (in particular rational): use modular gcd algorithm.\n        \n        - general polynomials: use the subresultant algorithm if\n          coefficient explosion is likely (non modular coefficients).\n        \n        If :math:`u` and :math:`v` are polynomials in the same variable with :emphasis:`inexact`\n        coefficients, their gcd is defined to be scalar, so that\n        \n        ::\n        \n            ? a = x + 0.0; gcd(a,a)\n            %1 = 1\n            ? b = y*x + O(y); gcd(b,b)\n            %2 = y\n            ? c = 4*x + O(2^3); gcd(c,c)\n            %3 = 4\n        \n        A good q""uantitative check to decide whether such a\n        gcd \"should be\" non-trivial, is to use :literal:`polresultant`: a value\n        close to :math:`0` means that a small deformation of the inputs has non-trivial gcd.\n        You may also use :literal:`gcdext`, which does try to compute an approximate gcd\n        :math:`d` and provides :math:`u`, :math:`v` to check whether :math:`u x + v y` is close to :math:`d`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_625gcd(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gcd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcd") < 0)) __PYX_ERR(10, 10923, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("gcd", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 10923, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.gcd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_624gcd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_624gcd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("gcd", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":10969
 *         :math:`d` and provides :math:`u`, :math:`v` to check whether :math:`u x + v y` is close to :math:`d`.
 *         '''
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_1 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_1;

  /* "cypari/auto_gen.pxi":10970
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10971
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":10970
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":10972
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 10972, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":10973
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":10974
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_gen.pxi":10975
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":10976
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ggcd0(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":10975
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)
 */
  }

  /* "cypari/auto_gen.pxi":10977
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ggcd0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":10978
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = ggcd0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def gcdext(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 10978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10923
 *         return new_gen(_ret)
 * 
 *     def gcd(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the greatest common divisor of :math:`x` and :math:`y`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.gcd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":10980
 *         return new_gen(_ret)
 * 
 *     def gcdext(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[u,v,d]` such that :math:`d` is the gcd of :math:`x,y`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_627gcdext(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_626gcdext[] = "\n        Returns :math:`[u,v,d]` such that :math:`d` is the gcd of :math:`x,y`,\n        :math:`x*u+y*v = \\mathrm{gcd} (x,y)`, and :math:`u` and :math:`v` minimal in a natural sense.\n        The arguments must be integers or polynomials.\n        \n        ::\n        \n            ? [u, v, d] = gcdext(32,102)\n            %1 = [16, -5, 2]\n            ? d\n            %2 = 2\n            ? gcdext(x^2-x, x^2+x-2)\n            %3 = [-1/2, 1/2, x - 1]\n        \n        If :math:`x,y` are polynomials in the same variable and :emphasis:`inexact`\n        coefficients, then compute :math:`u,v,d` such that :math:`x*u+y*v = d`, where :math:`d`\n        approximately divides both and :math:`x` and :math:`y`; in particular, we do not obtain\n        :literal:`gcd(x,y)` which is :emphasis:`defined` to be a scalar in this case:\n        \n        ::\n        \n            ? a = x + 0.0; gcd(a,a)\n            %1 = 1\n            \n            ? gcdext(a,a)\n            %2 = [0, 1, x + 0.E-28]\n            \n            ? gcdext(x-Pi, 6*x^2-zeta(2))\n            %3 = [-6*x - 18.8495559, 1, 57.5726923]\n        \n        For inexact inputs, the output is thus not well defined\n        mathematically, but you obtain explicit polynomials to check whether the\n        approximation is close enough for your needs.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_627gcdext(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gcdext (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_626gcdext(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_626gcdext(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("gcdext", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":11015
 *         approximation is close enough for your needs.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11016
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11016, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11017
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11018
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11019
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gcdext0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":11020
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gcdext0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def genus2red(PQ, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":10980
 *         return new_gen(_ret)
 * 
 *     def gcdext(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[u,v,d]` such that :math:`d` is the gcd of :math:`x,y`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.gcdext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11022
 *         return new_gen(_ret)
 * 
 *     def genus2red(PQ, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`PQ` be a polynomial :math:`P`, resp. a vector :math:`[P,Q]` of polynomials, with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_629genus2red(PyObject *__pyx_v_PQ, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_628genus2red[] = "\n        Let :math:`PQ` be a polynomial :math:`P`, resp. a vector :math:`[P,Q]` of polynomials, with\n        rational coefficients.\n        Determines the reduction at :math:`p > 2` of the (proper, smooth) genus\302\2402\n        curve :math:`C/\\mathbb{Q}`, defined by the hyperelliptic equation :math:`y^2 = P(x)`, resp.\n        :math:`y^2 + Q(x)*y = P(x)`.\n        (The special fiber :math:`X_p` of the minimal regular model :math:`X` of :math:`C` over :math:`\\mathbb{Z}`.)\n        \n        If :math:`p` is omitted, determines the reduction type for all (odd) prime\n        divisors of the discriminant.\n        \n        This function was rewritten from an implementation of Liu's\n        algorithm by Cohen and Liu (1994), :literal:`genus2reduction-0.3`, see\n        :literal:`http://www.math.u-bordeaux.fr/~liu/G2R/`.\n        \n        :strong:`CAVEAT.` The function interface may change: for the\n        time being, it returns :math:`[N,FaN, T, V]`\n        where :math:`N` is either the local conductor at :math:`p` or the\n        global conductor, :emphasis:`FaN` is its factorization, :math:`y^2 = T` defines a\n        minimal model over :math:`\\mathbb{Z}[1/2]` and :math:`V` describes the reduction type at the\n        various considered\302\240:math:`p`. Unfortunately, the program is not complete for\n        :math:`p = 2`, and we may return the odd part of the conductor only: this is the\n        case if the factorization includes the (impossible) term :math:`2^{-1}`; if the\n        factorization contains another power of :math:`2`, then this is the exact local\n        conductor at :math:`2` and :math:`N` is the global conductor.\n        \n        ::\n        \n            ? default(debuglevel, 1);\n            ? genus2red(x^6 + 3*x^3 + 63, 3)\n            (potential) stable reduction: [1, []]\n            reduction at p: [III{9}] page 184, [3, 3], f = 10\n            %1 = [59049, Mat([3, 10]), x^6 + 3*x^3 + 63, [3, [1, []],\n             [\"[III{9}] p""age 184\", [3, 3]]]]\n            ? [N, FaN, T, V] = genus2red(x^3-x^2-1, x^2-x); \\\\ X_1(13), global reduction\n            p = 13\n            (potential) stable reduction: [5, [Mod(0, 13), Mod(0, 13)]]\n            reduction at p: [I{0}-II-0] page 159, [], f = 2\n            ? N\n            %3 = 169\n            ? FaN\n            %4 = Mat([13, 2]) \\\\ in particular, good reduction at 2 !\n            ? T\n            %5 = x^6 + 58*x^5 + 1401*x^4 + 18038*x^3 + 130546*x^2 + 503516*x + 808561\n            ? V\n            %6 = [[13, [5, [Mod(0, 13), Mod(0, 13)]], [\"[I{0}-II-0] page 159\", []]]]\n        \n        We now first describe the format of the vector :math:`V = V_p` in the case where\n        :math:`p` was specified (local reduction at\302\240:math:`p`): it is a triple :math:`[p, stable,\n        red]`. The component :math:`stable = [type, vecj]` contains\n        information about the stable reduction after a field extension;\n        depending on :emphasis:`type`\302\240s, the stable reduction is\n        \n        - 1: smooth (i.e. the curve has potentially good reduction). The\n          Jacobian :math:`J(C)` has potentially good reduction.\n        \n        - 2: an elliptic curve :math:`E` with an ordinary double point; :emphasis:`vecj`\n          contains :math:`j` mod :math:`p`, the modular invariant of :math:`E`. The (potential)\n          semi-abelian reduction of :math:`J(C)` is the extension of an elliptic curve (with\n          modular invariant :math:`j` mod :math:`p`) by a torus.\n        \n        - 3: a projective line with two ordinary double points. The Jacobian\n          :math:`J(C)` has potentially multiplicative reduction.\n        \n        - 4: the union of two projective lines crossing transversally at three\n          points. The Jacobian :math:`J(C)` has potentially multiplicative reduction.\n        \n        - 5: the union of two elliptic curves :math:`E_1` and :math:`E_2` intersecting\n          transversally at one point""; :emphasis:`vecj` contains their modular invariants\n          :math:`j_1` and :math:`j_2`, which may live in a quadratic extension of :math:`\\mathbb{F}_p` and need\n          not be distinct. The Jacobian :math:`J(C)` has potentially good reduction,\n          isomorphic to the product of the reductions of :math:`E_1` and :math:`E_2`.\n        \n        - 6: the union of an elliptic curve :math:`E` and a projective line which has\n          an ordinary double point, and these two components intersect transversally\n          at one point; :emphasis:`vecj` contains :math:`j` mod :math:`p`, the modular invariant of :math:`E`.\n          The (potential) semi-abelian reduction of :math:`J(C)` is the extension of an\n          elliptic curve (with modular invariant :math:`j` mod :math:`p`) by a torus.\n        \n        - 7: as in type 6, but the two components are both singular. The\n          Jacobian :math:`J(C)` has potentially multiplicative reduction.\n        \n        The component :math:`red = [NUtype, neron]` contains two data\n        concerning the reduction at :math:`p` without any ramified field extension.\n        \n        The :emphasis:`NUtype` is a :literal:`t_STR` describing the reduction at :math:`p` of :math:`C`,\n        following Namikawa-Ueno, :emphasis:`The complete classification of fibers in\n        pencils of curves of genus two`, Manuscripta Math., vol. 9, (1973), pages\n        143-186. The reduction symbol is followed by the corresponding page number\n        or page range in this article.\n        \n        The second datum :emphasis:`neron` is the group of connected components (over an\n        algebraic closure of :math:`\\mathbb{F}_p`) of the N\303\251ron model of :math:`J(C)`, given as a\n        finite abelian group (vector of elementary divisors).\n        \n        If :math:`p = 2`, the :emphasis:`red` component may be omitted altogether (and\n        replaced by :literal:`[]`, in the case where the program could not compute it.""\n        When :math:`p` was not specified, :math:`V` is the vector of all :math:`V_p`, for all\n        considered :math:`p`.\n        \n        :strong:`Notes about Namikawa-Ueno types.`\n        \n        - A lower index is denoted between braces: for instance,\n          :literal:`[I{2}-II-5]` means :literal:`[I_2-II-5]`.\n        \n        - If :math:`K` and :math:`K'` are Kodaira symbols for singular fibers of elliptic\n          curves, then :literal:`[:math:`K`-:math:`K'`-m]` and :literal:`[:math:`K'`-:math:`K`-m]` are the same.\n        \n        We define a total ordering on Kodaira symbol by fixing :math:`I < I* <\n        II < II*,...`. If the reduction type is the same, we order by\n        the number of components, e.g. :math:`I_2 < I_4`, etc.\n        Then we normalize our output so that :math:`K <= K'`.\n        \n        - :literal:`[:math:`K`-:math:`K'`-:math:`-1`]` is :literal:`[:math:`K`-:math:`K'`-:math:`\\alpha`]` in the notation of\n          Namikawa-Ueno.\n        \n        - The figure :literal:`[2I_0-m]` in Namikawa-Ueno, page 159, must be denoted\n          by :literal:`[2I_0-(m+1)]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_629genus2red(PyObject *__pyx_v_PQ, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genus2red (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "genus2red") < 0)) __PYX_ERR(10, 11022, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("genus2red", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11022, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.genus2red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_628genus2red(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_PQ), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_628genus2red(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_PQ, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__PQ;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("genus2red", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":11142
 *           by :literal:`[2I_0-(m+1)]`.
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":11143
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":11144
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _PQ = (<Gen>PQ).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 11144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":11143
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11145
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11145, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11146
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _PQ = (<Gen>PQ).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_PQ)->__pyx_base.g;
  __pyx_v__PQ = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11147
 *         sig_on()
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":11148
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":11149
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = genus2red(_PQ, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11148
 *         cdef GEN _PQ = (<Gen>PQ).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)
 */
  }

  /* "cypari/auto_gen.pxi":11150
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = genus2red(__pyx_v__PQ, __pyx_v__p);

  /* "cypari/auto_gen.pxi":11151
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = genus2red(_PQ, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hammingweight(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 11151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11022
 *         return new_gen(_ret)
 * 
 *     def genus2red(PQ, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`PQ` be a polynomial :math:`P`, resp. a vector :math:`[P,Q]` of polynomials, with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.genus2red", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11153
 *         return new_gen(_ret)
 * 
 *     def hammingweight(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a :literal:`t_INT`, return the binary Hamming weight of :math:`\|x\|`. Otherwise
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_631hammingweight(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_630hammingweight[] = "\n        If :math:`x` is a :literal:`t_INT`, return the binary Hamming weight of :math:`\\|x\\|`. Otherwise\n        :math:`x` must be of type :literal:`t_POL`, :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_VECSMALL`, or\n        :literal:`t_MAT` and the function returns the number of non-zero coefficients of\n        :math:`x`.\n        \n        ::\n        \n            ? hammingweight(15)\n            %1 = 4\n            ? hammingweight(x^100 + 2*x + 1)\n            %2 = 3\n            ? hammingweight([Mod(1,2), 2, Mod(0,3)])\n            %3 = 2\n            ? hammingweight(matid(100))\n            %4 = 100\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_631hammingweight(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hammingweight (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_630hammingweight(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_630hammingweight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("hammingweight", 0);

  /* "cypari/auto_gen.pxi":11171
 *             %4 = 100
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = hammingweight(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 11171, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11172
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = hammingweight(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11173
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = hammingweight(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = hammingweight(__pyx_v__x);

  /* "cypari/auto_gen.pxi":11174
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = hammingweight(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":11175
 *         cdef long _ret = hammingweight(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def hilbert(x, y, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 11175, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11153
 *         return new_gen(_ret)
 * 
 *     def hammingweight(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a :literal:`t_INT`, return the binary Hamming weight of :math:`\|x\|`. Otherwise
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.hammingweight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11177
 *         return _ret
 * 
 *     def hilbert(x, y, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hilbert symbol of :math:`x` and :math:`y` modulo the prime :math:`p`, :math:`p = 0` meaning
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_633hilbert(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_632hilbert[] = "\n        Hilbert symbol of :math:`x` and :math:`y` modulo the prime :math:`p`, :math:`p = 0` meaning\n        the place at infinity (the result is undefined if :math:`p != 0` is not prime).\n        \n        It is possible to omit :math:`p`, in which case we take :math:`p = 0` if both :math:`x`\n        and :math:`y` are rational, or one of them is a real number. And take :math:`p = q`\n        if one of :math:`x`, :math:`y` is a :literal:`t_INTMOD` modulo :math:`q` or a :math:`q`-adic. (Incompatible\n        types will raise an error.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_633hilbert(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hilbert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hilbert") < 0)) __PYX_ERR(10, 11177, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hilbert", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11177, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.hilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_632hilbert(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_632hilbert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__p;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("hilbert", 0);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":11187
 *         types will raise an error.)
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11188
 *         '''
 *         y = objtogen(y)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11189
 *         y = objtogen(y)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11190
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":11189
 *         y = objtogen(y)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11191
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11191, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11192
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11193
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11194
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":11195
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11196
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = hilbert(_x, _y, _p)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11195
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)
 */
  }

  /* "cypari/auto_gen.pxi":11197
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = hilbert(__pyx_v__x, __pyx_v__y, __pyx_v__p);

  /* "cypari/auto_gen.pxi":11198
 *             _p = (<Gen>p).g
 *         cdef long _ret = hilbert(_x, _y, _p)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":11199
 *         cdef long _ret = hilbert(_x, _y, _p)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def hyperellcharpoly(X):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11177
 *         return _ret
 * 
 *     def hilbert(x, y, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hilbert symbol of :math:`x` and :math:`y` modulo the prime :math:`p`, :math:`p = 0` meaning
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.hilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11201
 *         return _ret
 * 
 *     def hyperellcharpoly(X):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve defined over a finite field,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_635hyperellcharpoly(PyObject *__pyx_v_X, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_634hyperellcharpoly[] = "\n        :math:`X` being a non-singular hyperelliptic curve defined over a finite field,\n        return the characteristic polynomial of the Frobenius automorphism.\n        :math:`X` can be given either by a squarefree polynomial :math:`P` such that\n        :math:`X: y^2 = P(x)` or by a vector :math:`[P,Q]` such that\n        :math:`X: y^2 + Q(x) y = P(x)` and :math:`Q^2+4 P` is squarefree.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_635hyperellcharpoly(PyObject *__pyx_v_X, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperellcharpoly (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_634hyperellcharpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_X));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_634hyperellcharpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X) {
  GEN __pyx_v__X;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("hyperellcharpoly", 0);

  /* "cypari/auto_gen.pxi":11209
 *         :math:`X: y^2 + Q(x) y = P(x)` and :math:`Q^2+4 P` is squarefree.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = hyperellcharpoly(_X)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 11209, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11210
 *         '''
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperellcharpoly(_X)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11211
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = hyperellcharpoly(_X)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperellcharpoly(__pyx_v__X);

  /* "cypari/auto_gen.pxi":11212
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = hyperellcharpoly(_X)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hyperellpadicfrobenius(Q, unsigned long p, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 11212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11201
 *         return _ret
 * 
 *     def hyperellcharpoly(X):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve defined over a finite field,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.hyperellcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11214
 *         return new_gen(_ret)
 * 
 *     def hyperellpadicfrobenius(Q, unsigned long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`X` be the curve defined by :math:`y^2 = Q(x)`, where :math:`Q` is a polynomial of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_637hyperellpadicfrobenius(PyObject *__pyx_v_Q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_636hyperellpadicfrobenius[] = "\n        Let :math:`X` be the curve defined by :math:`y^2 = Q(x)`, where :math:`Q` is a polynomial of\n        degree :math:`d` over :math:`\\mathbb{Q}` and :math:`p >= d` a prime such that :math:`X` has good reduction\n        at :math:`p` return the matrix of the Frobenius endomorphism :math:`\\varphi` on the\n        crystalline module :math:`D_p(X) = \\mathbb{Q}_p \\otimes H^1_{dR}(X/\\mathbb{Q})` with respect to the\n        basis of the given model :math:`(\\omega, x \\omega,...,x^{g-1} \\omega)`, where\n        :math:`\\omega = dx/(2 y)` is the invariant differential, where :math:`g` is the genus of\n        :math:`X` (either :math:`d = 2 g+1` or :math:`d = 2 g+2`). The characteristic polynomial of\n        :math:`\\varphi` is the numerator of the zeta-function of the reduction of the curve\n        :math:`X` modulo :math:`p`. The matrix is computed to absolute :math:`p`-adic precision :math:`p^n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_637hyperellpadicfrobenius(PyObject *__pyx_v_Q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_p;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperellpadicfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,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_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hyperellpadicfrobenius", 1, 2, 2, 1); __PYX_ERR(10, 11214, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hyperellpadicfrobenius") < 0)) __PYX_ERR(10, 11214, __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_p = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_p == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11214, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11214, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hyperellpadicfrobenius", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11214, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.hyperellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_636hyperellpadicfrobenius(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Q), __pyx_v_p, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_636hyperellpadicfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, unsigned long __pyx_v_p, long __pyx_v_n) {
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("hyperellpadicfrobenius", 0);

  /* "cypari/auto_gen.pxi":11226
 *         :math:`X` modulo :math:`p`. The matrix is computed to absolute :math:`p`-adic precision :math:`p^n`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 11226, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11227
 *         '''
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11228
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperellpadicfrobenius(__pyx_v__Q, __pyx_v_p, __pyx_v_n);

  /* "cypari/auto_gen.pxi":11229
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = hyperellpadicfrobenius(_Q, p, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hyperellratpoints(X, h, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 11229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11214
 *         return new_gen(_ret)
 * 
 *     def hyperellpadicfrobenius(Q, unsigned long p, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`X` be the curve defined by :math:`y^2 = Q(x)`, where :math:`Q` is a polynomial of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.hyperellpadicfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11231
 *         return new_gen(_ret)
 * 
 *     def hyperellratpoints(X, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve given by an integral model,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_639hyperellratpoints(PyObject *__pyx_v_X, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_638hyperellratpoints[] = "\n        :math:`X` being a non-singular hyperelliptic curve given by an integral model,\n        return a vector containing the affine rational points on the curve of naive height less than :math:`h`.\n        If :math:`flag = 1`, stop as soon as a point is found; return either an empty vector or a vector containing a single point.\n        \n        :math:`X` is given either by a squarefree polynomial :math:`P` such that :math:`X: y^2 = P(x)`\n        or by a vector :math:`[P,Q]` such that :math:`X: y^2+Q(x) y = P(x)` and :math:`Q^2+4 P` is\n        squarefree.\n        \n        The parameter :math:`h` can be\n        \n        - an integer :math:`H`: find the points :math:`[n/d,y]` whose abscissas :math:`x = n/d` have\n          naive height ( = :math:`\\max (\\|n\\|, d)`) less than :math:`H`;\n        \n        - a vector :math:`[N,D]` with :math:`D <= N`: find the points :math:`[n/d,y]` with\n          :math:`\\|n\\| <= N`, :math:`d <= D`.\n        \n        - a vector :math:`[N,[D_1,D_2]]` with :math:`D_1 < D_2 <= N` find the points\n          :math:`[n/d,y]` with :math:`\\|n\\| <= N` and :math:`D_1 <= d <= D_2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_639hyperellratpoints(PyObject *__pyx_v_X, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_h = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperellratpoints (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_h,&__pyx_n_s_flag,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_h)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hyperellratpoints") < 0)) __PYX_ERR(10, 11231, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_h = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11231, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hyperellratpoints", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11231, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.hyperellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_638hyperellratpoints(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_X), __pyx_v_h, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_638hyperellratpoints(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X, PyObject *__pyx_v_h, long __pyx_v_flag) {
  GEN __pyx_v__X;
  GEN __pyx_v__h;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("hyperellratpoints", 0);
  __Pyx_INCREF(__pyx_v_h);

  /* "cypari/auto_gen.pxi":11252
 *           :math:`[n/d,y]` with :math:`\|n\| <= N` and :math:`D_1 <= d <= D_2`.
 *         '''
 *         h = objtogen(h)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_h, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11253
 *         '''
 *         h = objtogen(h)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _h = (<Gen>h).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11253, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11254
 *         h = objtogen(h)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11255
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _h = (<Gen>h).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_h)->__pyx_base.g;
  __pyx_v__h = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11256
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperellratpoints(__pyx_v__X, __pyx_v__h, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":11257
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _ret = hyperellratpoints(_X, _h, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def hyperu(a, b, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11231
 *         return new_gen(_ret)
 * 
 *     def hyperellratpoints(X, h, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`X` being a non-singular hyperelliptic curve given by an integral model,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.hyperellratpoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11259
 *         return new_gen(_ret)
 * 
 *     def hyperu(a, b, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`U`-confluent hypergeometric function with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_641hyperu(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_640hyperu[] = "\n        :math:`U`-confluent hypergeometric function with\n        parameters :math:`a` and :math:`b`. The parameters :math:`a` and :math:`b` can be complex but\n        the present implementation requires :math:`x` to be positive.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_641hyperu(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("hyperu (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_x,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("hyperu", 0, 2, 3, 1); __PYX_ERR(10, 11259, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hyperu") < 0)) __PYX_ERR(10, 11259, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_b = values[0];
    __pyx_v_x = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11259, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("hyperu", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11259, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.hyperu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_640hyperu(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_a), __pyx_v_b, __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_640hyperu(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("hyperu", 0);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":11265
 *         the present implementation requires :math:`x` to be positive.
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11265, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11266
 *         '''
 *         b = objtogen(b)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11266, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11267
 *         b = objtogen(b)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11267, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11268
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11269
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11270
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11271
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":11272
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hyperu(__pyx_v__a, __pyx_v__b, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":11273
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = hyperu(_a, _b, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealadd(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11259
 *         return new_gen(_ret)
 * 
 *     def hyperu(a, b, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`U`-confluent hypergeometric function with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.hyperu", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11275
 *         return new_gen(_ret)
 * 
 *     def idealadd(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the two ideals :math:`x` and :math:`y` in the number field :math:`nf`. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_643idealadd(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_642idealadd[] = "\n        Sum of the two ideals :math:`x` and :math:`y` in the number field :math:`nf`. The\n        result is given in HNF.\n        \n        ::\n        \n             ? K = nfinit(x^2 + 1);\n             ? a = idealadd(K, 2, x + 1) \\\\ ideal generated by 2 and 1+I\n             %2 =\n             [2 1]\n            \n             [0 1]\n             ? pr = idealprimedec(K, 5)[1]; \\\\ a prime ideal above 5\n             ? idealadd(K, a, pr) \\\\ coprime, as expected\n             %4 =\n             [1 0]\n            \n             [0 1]\n        \n        This function cannot be used to add arbitrary :math:`\\mathbb{Z}`-modules, since it assumes\n        that its arguments are ideals:\n        \n        ::\n        \n             ? b = Mat([1,0]~);\n             ? idealadd(K, b, b) \\\\ only square t_MATs represent ideals\n             *** idealadd: non-square t_MAT in idealtyp.\n             ? c = [2, 0; 2, 0]; idealadd(K, c, c) \\\\ non-sense\n             %6 =\n             [2 0]\n            \n             [0 2]\n             ? d = [1, 0; 0, 2]; idealadd(K, d, d) \\\\ non-sense\n             %7 =\n             [1 0]\n            \n             [0 1]\n            \n        \n        In the last two examples, we get wrong results since the\n        matrices :math:`c` and :math:`d` do not correspond to an ideal: the :math:`\\mathbb{Z}`-span of their\n        columns (as usual interpreted as coordinates with respect to the integer basis\n        :literal:`K.zk`) is not an :math:`O_K`-module. To add arbitrary :math:`\\mathbb{Z}`-modules generated\n        by the columns of matrices :math:`A` and :math:`B`, use :literal:`mathnf(concat(A,B))`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_643idealadd(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealadd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealadd", 1, 2, 2, 1); __PYX_ERR(10, 11275, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealadd") < 0)) __PYX_ERR(10, 11275, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealadd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11275, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_642idealadd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_642idealadd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealadd", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":11321
 *         by the columns of matrices :math:`A` and :math:`B`, use :literal:`mathnf(concat(A,B))`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11322
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11323
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11323, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11324
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11325
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealadd(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11326
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealadd(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11327
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealadd(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealadd(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":11328
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealadd(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealaddtoone(nf, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11275
 *         return new_gen(_ret)
 * 
 *     def idealadd(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the two ideals :math:`x` and :math:`y` in the number field :math:`nf`. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11330
 *         return new_gen(_ret)
 * 
 *     def idealaddtoone(nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two co-prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_645idealaddtoone(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_644idealaddtoone[] = "\n        :math:`x` and :math:`y` being two co-prime\n        integral ideals (given in any form), this gives a two-component row vector\n        :math:`[a,b]` such that :math:`a\\in x`, :math:`b\\in y` and :math:`a+b = 1`.\n        \n        The alternative syntax :math:`idealaddtoone (nf,v)`, is supported, where\n        :math:`v` is a :math:`k`-component vector of ideals (given in any form) which sum to\n        :math:`\\mathbb{Z}_K`. This outputs a :math:`k`-component vector :math:`e` such that :math:`e[i]\\in x[i]` for\n        :math:`1 <= i <= k` and :math:`\\sum_{1 <= i <= k}e[i] = 1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_645idealaddtoone(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealaddtoone (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealaddtoone") < 0)) __PYX_ERR(10, 11330, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealaddtoone", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11330, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealaddtoone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_644idealaddtoone(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_644idealaddtoone(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealaddtoone", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":11341
 *         :math:`1 <= i <= k` and :math:`\sum_{1 <= i <= k}e[i] = 1`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11342
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11343
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11344
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":11343
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11345
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11345, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11346
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11347
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11348
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_gen.pxi":11349
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11350
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11349
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 */
  }

  /* "cypari/auto_gen.pxi":11351
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealaddtoone0(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":11352
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealaddtoone0(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealappr(nf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11330
 *         return new_gen(_ret)
 * 
 *     def idealaddtoone(nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two co-prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealaddtoone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11354
 *         return new_gen(_ret)
 * 
 *     def idealappr(nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a fractional ideal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_647idealappr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_646idealappr[] = "\n        If :math:`x` is a fractional ideal\n        (given in any form), gives an element :math:`\\alpha` in :math:`nf` such that for\n        all prime ideals :math:`p` such that the valuation of :math:`x` at :math:`p` is\n        non-zero, we have :math:`v_{p}(\\alpha) = v_{p}(x)`, and\n        :math:`v_{p}(\\alpha) >= 0` for all other :math:`p`.\n        \n        The argument :math:`x` may also be given as a prime ideal factorization, as\n        output by :literal:`idealfactor`, but allowing zero exponents.\n        This yields an element :math:`\\alpha` such that for all prime ideals :math:`p`\n        occurring in :math:`x`, :math:`v_{p}(\\alpha) = v_{p}(x)`;\n        for all other prime ideals, :math:`v_{p}(\\alpha) >= 0`.\n        \n        flag is deprecated (ignored), kept for backward compatibility.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_647idealappr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealappr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealappr") < 0)) __PYX_ERR(10, 11354, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11354, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealappr", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11354, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_646idealappr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_646idealappr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealappr", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":11370
 *         flag is deprecated (ignored), kept for backward compatibility.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11371
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11371, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11372
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11373
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11374
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealappr0(__pyx_v__nf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":11375
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealappr0(_nf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealchinese(nf, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11375, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11354
 *         return new_gen(_ret)
 * 
 *     def idealappr(nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a fractional ideal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11377
 *         return new_gen(_ret)
 * 
 *     def idealchinese(nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a prime ideal factorization (i.e.a 2-columns matrix whose first
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_649idealchinese(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_648idealchinese[] = "\n        :math:`x` being a prime ideal factorization (i.e.\302\240a 2-columns matrix whose first\n        column contains prime ideals and the second column contains integral\n        exponents), :math:`y` a vector of elements in :math:`nf` indexed by the ideals in\n        :math:`x`, computes an element :math:`b` such that\n        \n        :math:`v_{p}(b - y_{p}) >= v_{p}(x)` for all prime ideals\n        in :math:`x` and :math:`v_{p}(b) >= 0` for all other :math:`p`.\n        \n        ::\n        \n            ? K = nfinit(t^2-2);\n            ? x = idealfactor(K, 2^2*3)\n            %2 =\n            [[2, [0, 1]~, 2, 1, [0, 2; 1, 0]] 4]\n            \n            [ [3, [3, 0]~, 1, 2, 1] 1]\n            ? y = [t,1];\n            ? idealchinese(K, x, y)\n            %4 = [4, -3]~\n        \n        The argument :math:`x` may also be of the form :math:`[x, s]` where the first component\n        is as above and :math:`s` is a vector of signs, with :math:`r_1` components\n        :math:`s_i` in :math:`{-1,0,1}`:\n        if :math:`\\sigma_i` denotes the :math:`i`-th real embedding of the number field,\n        the element :math:`b` returned satisfies further\n        :math:`sign (\\sigma_i(b)) = s_i` for all :math:`i` such that :math:`s_i = \302\2611`.\n        In other words, the sign is fixed to :math:`s_i` at the :math:`i`-th embedding whenever\n        :math:`s_i` is non-zero.\n        \n        ::\n        \n            ? idealchinese(K, [x, [1,1]], y)\n            %5 = [16, -3]~\n            ? idealchinese(K, [x, [-1,-1]], y)\n            %6 = [-20, -3]~\n            ? idealchinese(K, [x, [1,-1]], y)\n            %7 = [4, -3]~\n        \n        If :math:`y` is omitted, return a data structure which can be used in\n        place of :math:`x` in later calls and allows to solve many chinese remainder\n        problems for a given :math:`x` more efficiently.\n        \n        ::\n        \n            ? C = idealchinese(K, [x, [1,1]]);\n            ? idealchin""ese(K, C, y) \\\\ as above\n            %9 = [16, -3]~\n            ? for(i=1,10^4, idealchinese(K,C,y)) \\\\ ... but faster !\n            time = 80 ms.\n            ? for(i=1,10^4, idealchinese(K,[x,[1,1]],y))\n            time = 224 ms.\n        \n        Finally, this structure is itself allowed in place of :math:`x`, the\n        new :math:`s` overriding the one already present in the structure. This allows to\n        initialize for different sign conditions more efficiently when the underlying\n        ideal factorization remains the same.\n        \n        ::\n        \n            ? D = idealchinese(K, [C, [1,-1]]); \\\\ replaces [1,1]\n            ? idealchinese(K, D, y)\n            %13 = [4, -3]~\n            ? for(i=1,10^4,idealchinese(K,[C,[1,-1]]))\n            time = 40 ms. \\\\ faster than starting from scratch\n            ? for(i=1,10^4,idealchinese(K,[x,[1,-1]]))\n            time = 128 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_649idealchinese(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealchinese (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealchinese") < 0)) __PYX_ERR(10, 11377, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealchinese", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11377, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealchinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_648idealchinese(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_648idealchinese(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealchinese", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":11446
 *             time = 128 ms.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11446, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11447
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11448
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11449
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11449, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":11448
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11450
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11450, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11451
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11452
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11453
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_gen.pxi":11454
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11455
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11454
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 */
  }

  /* "cypari/auto_gen.pxi":11456
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealchinese(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":11457
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = idealchinese(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealcoprime(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11377
 *         return new_gen(_ret)
 * 
 *     def idealchinese(nf, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a prime ideal factorization (i.e.a 2-columns matrix whose first
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealchinese", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11459
 *         return new_gen(_ret)
 * 
 *     def idealcoprime(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two integral ideals :math:`x` and :math:`y`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_651idealcoprime(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_650idealcoprime[] = "\n        Given two integral ideals :math:`x` and :math:`y`\n        in the number field :math:`nf`, returns a :math:`\\beta` in the field,\n        such that :math:`\\beta.x` is an integral ideal coprime to :math:`y`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_651idealcoprime(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealcoprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealcoprime", 1, 2, 2, 1); __PYX_ERR(10, 11459, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealcoprime") < 0)) __PYX_ERR(10, 11459, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealcoprime", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11459, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealcoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_650idealcoprime(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_650idealcoprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealcoprime", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":11465
 *         such that :math:`\beta.x` is an integral ideal coprime to :math:`y`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11466
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11467
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11467, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11468
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11469
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11470
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11471
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealcoprime(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":11472
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealcoprime(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealdiv(nf, x, y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11472, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11459
 *         return new_gen(_ret)
 * 
 *     def idealcoprime(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two integral ideals :math:`x` and :math:`y`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealcoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11474
 *         return new_gen(_ret)
 * 
 *     def idealdiv(nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Quotient :math:`x.y^{-1}` of the two ideals :math:`x` and :math:`y` in the number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_653idealdiv(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_652idealdiv[] = "\n        Quotient :math:`x.y^{-1}` of the two ideals :math:`x` and :math:`y` in the number\n        field :math:`nf`. The result is given in HNF.\n        \n        If :math:`flag` is non-zero, the quotient :math:`x.y^{-1}` is assumed to be an\n        integral ideal. This can be much faster when the norm of the quotient is\n        small even though the norms of :math:`x` and :math:`y` are large. More precisely,\n        the algorithm cheaply removes all maximal ideals above rational\n        primes such that :math:`v_p(Nx) = v_p(Ny)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_653idealdiv(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealdiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealdiv", 0, 2, 3, 1); __PYX_ERR(10, 11474, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealdiv") < 0)) __PYX_ERR(10, 11474, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_y = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11474, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealdiv", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11474, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_652idealdiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_652idealdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealdiv", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":11485
 *         primes such that :math:`v_p(Nx) = v_p(Ny)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11486
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11487
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11487, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11488
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11489
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11490
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11491
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealdiv0(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":11492
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealdiv0(_nf, _x, _y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealfactor(nf, x, lim=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11474
 *         return new_gen(_ret)
 * 
 *     def idealdiv(nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Quotient :math:`x.y^{-1}` of the two ideals :math:`x` and :math:`y` in the number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11494
 *         return new_gen(_ret)
 * 
 *     def idealfactor(nf, x, lim=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors into prime ideal powers the ideal :math:`x` in the number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_655idealfactor(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_654idealfactor[] = "\n        Factors into prime ideal powers the ideal :math:`x` in the number field\n        :math:`nf`. The output format is similar to the :literal:`factor` function, and\n        the prime ideals are represented in the form output by the\n        :literal:`idealprimedec` function. If :emphasis:`lim` is set, return partial\n        factorization, including only prime ideals above rational primes\n        :math:`< lim`.\n        \n        ::\n        \n            ? nf = nfinit(x^3-2);\n            ? idealfactor(nf, x) \\\\ a prime ideal above 2\n            %2 =\n            [[2, [0, 1, 0]~, 3, 1, ...] 1]\n            \n            ? A = idealhnf(nf, 6*x, 4+2*x+x^2)\n            %3 =\n            [6 0 4]\n            \n            [0 6 2]\n            \n            [0 0 1]\n            \n            ? idealfactor(nf, A)\n            %4 =\n             [[2, [0, 1, 0]~, 3, 1, ...] 2]\n            \n             [[3, [1, 1, 0]~, 3, 1, ...] 2]\n            \n            ? idealfactor(nf, A, 3) \\\\ restrict to primes above p < 3\n            %5 =\n            [[2, [0, 1, 0]~, 3, 1, ...] 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_655idealfactor(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_lim = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealfactor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_lim,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealfactor") < 0)) __PYX_ERR(10, 11494, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_lim = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealfactor", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11494, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealfactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_654idealfactor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_lim);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_654idealfactor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_lim) {
  int __pyx_v__have_lim;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__lim;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealfactor", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_lim);

  /* "cypari/auto_gen.pxi":11528
 *             [[2, [0, 1, 0]~, 3, 1, ...] 2]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11529
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_lim = (lim is not None)             # <<<<<<<<<<<<<<
 *         if _have_lim:
 *             lim = objtogen(lim)
 */
  __pyx_t_2 = (__pyx_v_lim != Py_None);
  __pyx_v__have_lim = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11530
 *         x = objtogen(x)
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             lim = objtogen(lim)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_lim != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11531
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:
 *             lim = objtogen(lim)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lim, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11531, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_lim, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":11530
 *         x = objtogen(x)
 *         cdef bint _have_lim = (lim is not None)
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             lim = objtogen(lim)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11532
 *         if _have_lim:
 *             lim = objtogen(lim)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11532, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11533
 *             lim = objtogen(lim)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11534
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lim = NULL
 *         if _have_lim:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11535
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL             # <<<<<<<<<<<<<<
 *         if _have_lim:
 *             _lim = (<Gen>lim).g
 */
  __pyx_v__lim = NULL;

  /* "cypari/auto_gen.pxi":11536
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 */
  __pyx_t_2 = (__pyx_v__have_lim != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11537
 *         cdef GEN _lim = NULL
 *         if _have_lim:
 *             _lim = (<Gen>lim).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lim)->__pyx_base.g;
    __pyx_v__lim = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11536
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _lim = NULL
 *         if _have_lim:             # <<<<<<<<<<<<<<
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 */
  }

  /* "cypari/auto_gen.pxi":11538
 *         if _have_lim:
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpidealfactor(__pyx_v__nf, __pyx_v__x, __pyx_v__lim);

  /* "cypari/auto_gen.pxi":11539
 *             _lim = (<Gen>lim).g
 *         cdef GEN _ret = gpidealfactor(_nf, _x, _lim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealfactorback(nf, f, e=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11494
 *         return new_gen(_ret)
 * 
 *     def idealfactor(nf, x, lim=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factors into prime ideal powers the ideal :math:`x` in the number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealfactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_lim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11541
 *         return new_gen(_ret)
 * 
 *     def idealfactorback(nf, f, e=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the ideal corresponding to a factorization. The integer :math:`1`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_657idealfactorback(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_656idealfactorback[] = "\n        Gives back the ideal corresponding to a factorization. The integer :math:`1`\n        corresponds to the empty factorization.\n        If :math:`e` is present, :math:`e` and :math:`f` must be vectors of the same length (:math:`e` being\n        integral), and the corresponding factorization is the product of the\n        :math:`f[i]^{e[i]}`.\n        \n        If not, and :math:`f` is vector, it is understood as in the preceding case with :math:`e`\n        a vector of 1s: we return the product of the :math:`f[i]`. Finally, :math:`f` can be a\n        regular factorization, as produced by :literal:`idealfactor`.\n        \n        ::\n        \n            ? nf = nfinit(y^2+1); idealfactor(nf, 4 + 2*y)\n            %1 =\n            [[2, [1, 1]~, 2, 1, [1, 1]~] 2]\n            \n            [[5, [2, 1]~, 1, 1, [-2, 1]~] 1]\n            \n            ? idealfactorback(nf, %)\n            %2 =\n            [10 4]\n            \n            [0 2]\n            \n            ? f = %1[,1]; e = %1[,2]; idealfactorback(nf, f, e)\n            %3 =\n            [10 4]\n            \n            [0 2]\n            \n            ? % == idealhnf(nf, 4 + 2*y)\n            %4 = 1\n        \n        If :literal:`flag` is non-zero, perform ideal reductions (:literal:`idealred`) along the\n        way. This is most useful if the ideals involved are all :emphasis:`extended`\n        ideals (for instance with trivial principal part), so that the principal parts\n        extracted by :literal:`idealred` are not lost. Here is an example:\n        \n        ::\n        \n            ? f = vector(#f, i, [f[i], [;]]); \\\\ transform to extended ideals\n            ? idealfactorback(nf, f, e, 1)\n            %6 = [[1, 0; 0, 1], [2, 1; [2, 1]~, 1]]\n            ? nffactorback(nf, %[2])\n            %7 = [4, 2]~\n        \n        The extended ideal returned in :literal:`\\%6` is the trivial ideal :math:`1`, extended\n        with a principal generator given in factored form. We use "":literal:`nffactorback`\n        to recover it in standard form.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_657idealfactorback(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_e = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealfactorback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_e,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealfactorback") < 0)) __PYX_ERR(10, 11541, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_e = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11541, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealfactorback", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11541, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealfactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_656idealfactorback(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_f, __pyx_v_e, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_656idealfactorback(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e, long __pyx_v_flag) {
  int __pyx_v__have_e;
  GEN __pyx_v__nf;
  GEN __pyx_v__f;
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealfactorback", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_e);

  /* "cypari/auto_gen.pxi":11593
 *         to recover it in standard form.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11594
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             e = objtogen(e)
 */
  __pyx_t_2 = (__pyx_v_e != Py_None);
  __pyx_v__have_e = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11595
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11596
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 *             e = objtogen(e)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_e, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11596, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":11595
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11597
 *         if _have_e:
 *             e = objtogen(e)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11597, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11598
 *             e = objtogen(e)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11599
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _e = NULL
 *         if _have_e:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11600
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             _e = (<Gen>e).g
 */
  __pyx_v__e = NULL;

  /* "cypari/auto_gen.pxi":11601
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11602
 *         cdef GEN _e = NULL
 *         if _have_e:
 *             _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
    __pyx_v__e = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11601
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 */
  }

  /* "cypari/auto_gen.pxi":11603
 *         if _have_e:
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealfactorback(__pyx_v__nf, __pyx_v__f, __pyx_v__e, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":11604
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = idealfactorback(_nf, _f, _e, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealfrobenius(nf, gal, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11541
 *         return new_gen(_ret)
 * 
 *     def idealfactorback(nf, f, e=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the ideal corresponding to a factorization. The integer :math:`1`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealfactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11606
 *         return new_gen(_ret)
 * 
 *     def idealfrobenius(nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :math:`nf` and assume :math:`K/\mathbb{Q}` be a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_659idealfrobenius(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_658idealfrobenius[] = "\n        Let :math:`K` be the number field defined by :math:`nf` and assume :math:`K/\\mathbb{Q}` be a\n        Galois extension with Galois group given :literal:`gal = galoisinit(nf)`,\n        and that :emphasis:`pr` is an unramified prime ideal :math:`p` in :literal:`prid`\n        format.\n        This function returns a permutation of :literal:`gal.group` which defines\n        the Frobenius element :math:`\\text{Frob}_{p}` attached to :math:`p`.\n        If :math:`p` is the unique prime number in :math:`p`, then\n        :math:`\\text{Frob} (x) = x^p mod p` for all :math:`x\\in\\mathbb{Z}_K`.\n        \n        ::\n        \n            ? nf = nfinit(polcyclo(31));\n            ? gal = galoisinit(nf);\n            ? pr = idealprimedec(nf,101)[1];\n            ? g = idealfrobenius(nf,gal,pr);\n            ? galoispermtopol(gal,g)\n            %5 = x^8\n        \n        This is correct since :math:`101 = 8 mod 31`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_659idealfrobenius(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_pr,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_gal)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealfrobenius", 1, 2, 2, 1); __PYX_ERR(10, 11606, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealfrobenius") < 0)) __PYX_ERR(10, 11606, __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_gal = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealfrobenius", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11606, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_658idealfrobenius(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_gal, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_658idealfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__gal;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealfrobenius", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":11628
 *         This is correct since :math:`101 = 8 mod 31`.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11629
 *         '''
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11630
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11630, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11631
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11632
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11633
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11634
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealfrobenius(__pyx_v__nf, __pyx_v__gal, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":11635
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealfrobenius(_nf, _gal, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealhnf(nf, u, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11606
 *         return new_gen(_ret)
 * 
 *     def idealfrobenius(nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :math:`nf` and assume :math:`K/\mathbb{Q}` be a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11637
 *         return new_gen(_ret)
 * 
 *     def idealhnf(nf, u, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Hermite normal form of the ideal :math:`u\mathbb{Z}_K+v\mathbb{Z}_K`, where :math:`u`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_661idealhnf(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_660idealhnf[] = "\n        Gives the Hermite normal form of the ideal :math:`u\\mathbb{Z}_K+v\\mathbb{Z}_K`, where :math:`u`\n        and :math:`v` are elements of the number field :math:`K` defined by :emphasis:`nf`.\n        \n        ::\n        \n            ? nf = nfinit(y^3 - 2);\n            ? idealhnf(nf, 2, y+1)\n            %2 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? idealhnf(nf, y/2, [0,0,1/3]~)\n            %3 =\n            [1/3 0 0]\n            \n            [0 1/6 0]\n            \n            [0 0 1/6]\n        \n        If :math:`b` is omitted, returns the HNF of the ideal defined by :math:`u`: :math:`u` may be an\n        algebraic number (defining a principal ideal), a maximal ideal (as given by\n        :literal:`idealprimedec` or :literal:`idealfactor`), or a matrix whose columns give\n        generators for the ideal. This last format is a little complicated, but\n        useful to reduce general modules to the canonical form once in a while:\n        \n        - if strictly less than :math:`N = [K:\\mathbb{Q}]` generators are given, :math:`u`\n          is the :math:`\\mathbb{Z}_K`-module they generate,\n        \n        - if :math:`N` or more are given, it is :emphasis:`assumed` that they form a\n          :math:`\\mathbb{Z}`-basis of the ideal, in particular that the matrix has maximal rank :math:`N`.\n          This acts as :literal:`mathnf` since the :math:`\\mathbb{Z}_K`-module structure is (taken for\n          granted hence) not taken into account in this case.\n        \n        ::\n        \n            ? idealhnf(nf, idealprimedec(nf,2)[1])\n            %4 =\n            [2 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? idealhnf(nf, [1,2;2,3;3,4])\n            %5 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n        \n        Finally, when :math:`K` is quadratic with discriminant :math:`D_K`, ""we\n        allow :math:`u =` :literal:`Qfb(a,b,c)`, provided :math:`b^2 - 4ac = D_K`. As usual,\n        this represents the ideal :math:`a \\mathbb{Z} + (1/2)(-b + \\sqrt{D_K}) \\mathbb{Z}`.\n        \n        ::\n        \n            ? K = nfinit(x^2 - 60); K.disc\n            %1 = 60\n            ? idealhnf(K, qfbprimeform(60,2))\n            %2 =\n            [2 1]\n            \n            [0 1]\n            ? idealhnf(K, Qfb(1,2,3))\n             *** at top-level: idealhnf(K,Qfb(1,2,3\n             *** ^--------------------\n             *** idealhnf: Qfb(1, 2, 3) has discriminant != 60 in idealhnf.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_661idealhnf(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_u = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealhnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_u,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealhnf") < 0)) __PYX_ERR(10, 11637, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_u = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealhnf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11637, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_660idealhnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_u, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_660idealhnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_u, PyObject *__pyx_v_v) {
  int __pyx_v__have_v;
  GEN __pyx_v__nf;
  GEN __pyx_v__u;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealhnf", 0);
  __Pyx_INCREF(__pyx_v_u);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":11709
 *              *** idealhnf: Qfb(1, 2, 3) has discriminant != 60 in idealhnf.
 *         '''
 *         u = objtogen(u)             # <<<<<<<<<<<<<<
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_u, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_u, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11710
 *         '''
 *         u = objtogen(u)
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11711
 *         u = objtogen(u)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11712
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":11711
 *         u = objtogen(u)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11713
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _u = (<Gen>u).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11713, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11714
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11715
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _u = (<Gen>u).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_u)->__pyx_base.g;
  __pyx_v__u = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11716
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_gen.pxi":11717
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11718
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11717
 *         cdef GEN _u = (<Gen>u).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 */
  }

  /* "cypari/auto_gen.pxi":11719
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealhnf0(__pyx_v__nf, __pyx_v__u, __pyx_v__v);

  /* "cypari/auto_gen.pxi":11720
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealhnf0(_nf, _u, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealintersect(nf, A, B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11637
 *         return new_gen(_ret)
 * 
 *     def idealhnf(nf, u, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Hermite normal form of the ideal :math:`u\mathbb{Z}_K+v\mathbb{Z}_K`, where :math:`u`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_u);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11722
 *         return new_gen(_ret)
 * 
 *     def idealintersect(nf, A, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two ideals
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_663idealintersect(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_662idealintersect[] = "\n        Intersection of the two ideals\n        :math:`A` and :math:`B` in the number field :math:`nf`. The result is given in HNF.\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? idealintersect(nf, 2, x+1)\n            %2 =\n            [2 0]\n            \n            [0 2]\n        \n        This function does not apply to general :math:`\\mathbb{Z}`-modules, e.g.\302\240orders, since its\n        arguments are replaced by the ideals they generate. The following script\n        intersects :math:`\\mathbb{Z}`-modules :math:`A` and :math:`B` given by matrices of compatible\n        dimensions with integer coefficients:\n        \n        ::\n        \n            ZM_intersect(A,B) =\n            { my(Ker = matkerint(concat(A,B)));\n             mathnf( A * Ker[1..#A,] )\n            }\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_663idealintersect(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealintersect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,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_A)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealintersect", 1, 2, 2, 1); __PYX_ERR(10, 11722, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealintersect") < 0)) __PYX_ERR(10, 11722, __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_A = values[0];
    __pyx_v_B = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealintersect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11722, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_662idealintersect(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_A, __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_662idealintersect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_A, PyObject *__pyx_v_B) {
  GEN __pyx_v__nf;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealintersect", 0);
  __Pyx_INCREF(__pyx_v_A);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":11748
 *             }
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11749
 *         '''
 *         A = objtogen(A)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11750
 *         A = objtogen(A)
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11750, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11751
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11752
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11753
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11754
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealintersect(__pyx_v__nf, __pyx_v__A, __pyx_v__B);

  /* "cypari/auto_gen.pxi":11755
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = idealintersect(_nf, _A, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealinv(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11755, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11722
 *         return new_gen(_ret)
 * 
 *     def idealintersect(nf, A, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two ideals
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11757
 *         return new_gen(_ret)
 * 
 *     def idealinv(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inverse of the ideal :math:`x` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_665idealinv(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_664idealinv[] = "\n        Inverse of the ideal :math:`x` in the\n        number field :math:`nf`, given in HNF. If :math:`x` is an extended\n        ideal, its principal part is suitably\n        updated: i.e. inverting :math:`[I,t]`, yields :math:`[I^{-1}, 1/t]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_665idealinv(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealinv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_664idealinv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_664idealinv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealinv", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":11764
 *         updated: i.e. inverting :math:`[I,t]`, yields :math:`[I^{-1}, 1/t]`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11764, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11765
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11765, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11766
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealinv(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11767
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealinv(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11768
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealinv(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealinv(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":11769
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealinv(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ideallist(nf, long bound, long flag=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11757
 *         return new_gen(_ret)
 * 
 *     def idealinv(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inverse of the ideal :math:`x` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealinv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11771
 *         return new_gen(_ret)
 * 
 *     def ideallist(nf, long bound, long flag=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the list
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_667ideallist(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_666ideallist[] = "\n        Computes the list\n        of all ideals of norm less or equal to :emphasis:`bound` in the number field\n        :emphasis:`nf`. The result is a row vector with exactly :emphasis:`bound` components.\n        Each component is itself a row vector containing the information about\n        ideals of a given norm, in no specific order, depending on the value of\n        :math:`flag`:\n        \n        The possible values of :math:`flag` are:\n        \n        \302\240\302\2400: give the :emphasis:`bid` attached to the ideals, without generators.\n        \n        \302\240\302\2401: as 0, but include the generators in the :emphasis:`bid`.\n        \n        \302\240\302\2402: in this case, :emphasis:`nf` must be a :emphasis:`bnf` with units. Each\n        component is of the form :math:`[bid,U]`, where :emphasis:`bid` is as case 0\n        and :math:`U` is a vector of discrete logarithms of the units. More precisely, it\n        gives the :literal:`ideallog`\302\240s with respect to :emphasis:`bid` of :literal:`bnf.tufu`.\n        This structure is technical, and only meant to be used in conjunction with\n        :literal:`bnrclassnolist` or :literal:`bnrdisclist`.\n        \n        \302\240\302\2403: as 2, but include the generators in the :emphasis:`bid`.\n        \n        \302\240\302\2404: give only the HNF of the ideal.\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? L = ideallist(nf, 100);\n            ? L[1]\n            %3 = [[1, 0; 0, 1]] \\\\ A single ideal of norm 1\n            ? #L[65]\n            %4 = 4 \\\\ There are 4 ideals of norm 4 in Z[i]\n        \n        If one wants more information, one could do instead:\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? L = ideallist(nf, 100, 0);\n            ? l = L[25]; vector(#l, i, l[i].clgp)\n            %3 = [[20, [20]], [16, [4, 4]], [20, [20]]]\n            ? l[1].mod\n            %4 = [[25, 18; 0, 1], []]\n            ? l[2""].mod\n            %5 = [[5, 0; 0, 5], []]\n            ? l[3].mod\n            %6 = [[25, 7; 0, 1], []]\n        \n        where we ask for the structures of the :math:`(\\mathbb{Z}[i]/I)^*` for all\n        three ideals of norm :math:`25`. In fact, for all moduli with finite part of norm\n        :math:`25` and trivial Archimedean part, as the last 3 commands show. See\n        :literal:`ideallistarch` to treat general moduli.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_667ideallist(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_bound;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ideallist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bound,&__pyx_n_s_flag,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_bound)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ideallist") < 0)) __PYX_ERR(10, 11771, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_bound = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_bound == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11771, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11771, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ideallist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11771, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ideallist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_666ideallist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_bound, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_666ideallist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, long __pyx_v_bound, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ideallist", 0);

  /* "cypari/auto_gen.pxi":11826
 *         :literal:`ideallistarch` to treat general moduli.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 11826, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11827
 *         '''
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11828
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ideallist0(__pyx_v__nf, __pyx_v_bound, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":11829
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = ideallist0(_nf, bound, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ideallistarch(nf, list, arch):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 11829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11771
 *         return new_gen(_ret)
 * 
 *     def ideallist(nf, long bound, long flag=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the list
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ideallist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11831
 *         return new_gen(_ret)
 * 
 *     def ideallistarch(nf, list, arch):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`list` is a vector of vectors of bid's, as output by :literal:`ideallist` with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_669ideallistarch(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_668ideallistarch[] = "\n        :emphasis:`list` is a vector of vectors of bid's, as output by :literal:`ideallist` with\n        flag :math:`0` to :math:`3`. Return a vector of vectors with the same number of\n        components as the original :emphasis:`list`. The leaves give information about\n        moduli whose finite part is as in original list, in the same order, and\n        Archimedean part is now :emphasis:`arch` (it was originally trivial). The\n        information contained is of the same kind as was present in the input; see\n        :literal:`ideallist`, in particular the meaning of :emphasis:`flag`.\n        \n        ::\n        \n            ? bnf = bnfinit(x^2-2);\n            ? bnf.sign\n            %2 = [2, 0] \\\\ two places at infinity\n            ? L = ideallist(bnf, 100, 0);\n            ? l = L[98]; vector(#l, i, l[i].clgp)\n            %4 = [[42, [42]], [36, [6, 6]], [42, [42]]]\n            ? La = ideallistarch(bnf, L, [1,1]); \\\\ add them to the modulus\n            ? l = La[98]; vector(#l, i, l[i].clgp)\n            %6 = [[168, [42, 2, 2]], [144, [6, 6, 2, 2]], [168, [42, 2, 2]]]\n        \n        Of course, the results above are obvious: adding :math:`t` places at infinity will\n        add :math:`t` copies of :math:`\\mathbb{Z}/2\\mathbb{Z}` to :math:`(\\mathbb{Z}_K/f)^*`. The following application\n        is more typical:\n        \n        ::\n        \n            ? L = ideallist(bnf, 100, 2); \\\\ units are required now\n            ? La = ideallistarch(bnf, L, [1,1]);\n            ? H = bnrclassnolist(bnf, La);\n            ? H[98];\n            %4 = [2, 12, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_669ideallistarch(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_list = 0;
  PyObject *__pyx_v_arch = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ideallistarch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_list,&__pyx_n_s_arch,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_list)) != 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_arch)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ideallistarch", 1, 2, 2, 1); __PYX_ERR(10, 11831, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ideallistarch") < 0)) __PYX_ERR(10, 11831, __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_list = values[0];
    __pyx_v_arch = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ideallistarch", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11831, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ideallistarch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_668ideallistarch(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_list, __pyx_v_arch);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_668ideallistarch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_list, PyObject *__pyx_v_arch) {
  GEN __pyx_v__nf;
  GEN __pyx_v__list;
  GEN __pyx_v__arch;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ideallistarch", 0);
  __Pyx_INCREF(__pyx_v_list);
  __Pyx_INCREF(__pyx_v_arch);

  /* "cypari/auto_gen.pxi":11865
 *             %4 = [2, 12, 2]
 *         '''
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         arch = objtogen(arch)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11865, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11866
 *         '''
 *         list = objtogen(list)
 *         arch = objtogen(arch)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_arch, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_arch, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11867
 *         list = objtogen(list)
 *         arch = objtogen(arch)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11867, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11868
 *         arch = objtogen(arch)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _arch = (<Gen>arch).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11869
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _arch = (<Gen>arch).g
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11870
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _arch = (<Gen>arch).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_arch)->__pyx_base.g;
  __pyx_v__arch = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11871
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _arch = (<Gen>arch).g
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ideallistarch(__pyx_v__nf, __pyx_v__list, __pyx_v__arch);

  /* "cypari/auto_gen.pxi":11872
 *         cdef GEN _arch = (<Gen>arch).g
 *         cdef GEN _ret = ideallistarch(_nf, _list, _arch)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ideallog(nf, x, bid):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11831
 *         return new_gen(_ret)
 * 
 *     def ideallistarch(nf, list, arch):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`list` is a vector of vectors of bid's, as output by :literal:`ideallist` with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ideallistarch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XDECREF(__pyx_v_arch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11874
 *         return new_gen(_ret)
 * 
 *     def ideallog(nf, x, bid):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` is a number field,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_671ideallog(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_670ideallog[] = "\n        :math:`nf` is a number field,\n        :emphasis:`bid` is as output by :literal:`idealstar(nf, D,...)` and :math:`x` a\n        non-necessarily integral element of :emphasis:`nf` which must have valuation\n        equal to 0 at all prime ideals in the support of :math:`D`. This function\n        computes the discrete logarithm of :math:`x` on the generators given in\n        :literal:`:emphasis:`bid`.gen`. In other words, if :math:`g_i` are these generators, of orders\n        :math:`d_i` respectively, the result is a column vector of integers :math:`(x_i)` such\n        that :math:`0 <= x_i < d_i` and\n        \n        .. MATH::\n        \n            x = \\prod_i g_i^{x_i} (mod ^*D) .\n        \n        Note that when the support of :literal:`D` contains places at infinity, this\n        congruence implies also sign conditions on the attached real embeddings.\n        See :literal:`znlog` for the limitations of the underlying discrete log algorithms.\n        \n        When :emphasis:`nf` is omitted, take it to be the rational number field. In that\n        case, :math:`x` must be a :literal:`t_INT` and :emphasis:`bid` must have been initialized by\n        :literal:`znstar(N,1)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_671ideallog(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_bid = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ideallog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_bid,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bid)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ideallog", 1, 2, 2, 1); __PYX_ERR(10, 11874, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ideallog") < 0)) __PYX_ERR(10, 11874, __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_x = values[0];
    __pyx_v_bid = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ideallog", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11874, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ideallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_670ideallog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_bid);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_670ideallog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_bid) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__bid;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("ideallog", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_bid);

  /* "cypari/auto_gen.pxi":11897
 *         :literal:`znstar(N,1)`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         bid = objtogen(bid)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11898
 *         '''
 *         x = objtogen(x)
 *         bid = objtogen(bid)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bid, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bid, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11899
 *         x = objtogen(x)
 *         bid = objtogen(bid)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11899, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11900
 *         bid = objtogen(bid)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _bid = (<Gen>bid).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11901
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bid = (<Gen>bid).g
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11902
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _bid = (<Gen>bid).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bid)->__pyx_base.g;
  __pyx_v__bid = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11903
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _bid = (<Gen>bid).g
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ideallog(__pyx_v__nf, __pyx_v__x, __pyx_v__bid);

  /* "cypari/auto_gen.pxi":11904
 *         cdef GEN _bid = (<Gen>bid).g
 *         cdef GEN _ret = ideallog(_nf, _x, _bid)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealmin(nf, ix, vdir=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11904, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11874
 *         return new_gen(_ret)
 * 
 *     def ideallog(nf, x, bid):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` is a number field,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ideallog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_bid);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11906
 *         return new_gen(_ret)
 * 
 *     def idealmin(nf, ix, vdir=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`This function is useless and kept for backward compatibility only,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_673idealmin(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_672idealmin[] = "\n        :emphasis:`This function is useless and kept for backward compatibility only,\n        use :literal:`idealred``. Computes a pseudo-minimum of the ideal :math:`x` in the\n        direction :emphasis:`vdir` in the number field :emphasis:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_673idealmin(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ix = 0;
  PyObject *__pyx_v_vdir = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealmin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ix,&__pyx_n_s_vdir,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_ix)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vdir);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealmin") < 0)) __PYX_ERR(10, 11906, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ix = values[0];
    __pyx_v_vdir = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealmin", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11906, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_672idealmin(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_ix, __pyx_v_vdir);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_672idealmin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_ix, PyObject *__pyx_v_vdir) {
  int __pyx_v__have_vdir;
  GEN __pyx_v__nf;
  GEN __pyx_v__ix;
  GEN __pyx_v__vdir;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealmin", 0);
  __Pyx_INCREF(__pyx_v_ix);
  __Pyx_INCREF(__pyx_v_vdir);

  /* "cypari/auto_gen.pxi":11912
 *         direction :emphasis:`vdir` in the number field :emphasis:`nf`.
 *         '''
 *         ix = objtogen(ix)             # <<<<<<<<<<<<<<
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ix, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_ix, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11913
 *         '''
 *         ix = objtogen(ix)
 *         cdef bint _have_vdir = (vdir is not None)             # <<<<<<<<<<<<<<
 *         if _have_vdir:
 *             vdir = objtogen(vdir)
 */
  __pyx_t_2 = (__pyx_v_vdir != Py_None);
  __pyx_v__have_vdir = __pyx_t_2;

  /* "cypari/auto_gen.pxi":11914
 *         ix = objtogen(ix)
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             vdir = objtogen(vdir)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_vdir != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11915
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:
 *             vdir = objtogen(vdir)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_vdir, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_vdir, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":11914
 *         ix = objtogen(ix)
 *         cdef bint _have_vdir = (vdir is not None)
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             vdir = objtogen(vdir)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":11916
 *         if _have_vdir:
 *             vdir = objtogen(vdir)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ix = (<Gen>ix).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 11916, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11917
 *             vdir = objtogen(vdir)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11918
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ix = (<Gen>ix).g             # <<<<<<<<<<<<<<
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ix)->__pyx_base.g;
  __pyx_v__ix = __pyx_t_4;

  /* "cypari/auto_gen.pxi":11919
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL             # <<<<<<<<<<<<<<
 *         if _have_vdir:
 *             _vdir = (<Gen>vdir).g
 */
  __pyx_v__vdir = NULL;

  /* "cypari/auto_gen.pxi":11920
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 */
  __pyx_t_2 = (__pyx_v__have_vdir != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":11921
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:
 *             _vdir = (<Gen>vdir).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vdir)->__pyx_base.g;
    __pyx_v__vdir = __pyx_t_4;

    /* "cypari/auto_gen.pxi":11920
 *         cdef GEN _ix = (<Gen>ix).g
 *         cdef GEN _vdir = NULL
 *         if _have_vdir:             # <<<<<<<<<<<<<<
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 */
  }

  /* "cypari/auto_gen.pxi":11922
 *         if _have_vdir:
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealmin(__pyx_v__nf, __pyx_v__ix, __pyx_v__vdir);

  /* "cypari/auto_gen.pxi":11923
 *             _vdir = (<Gen>vdir).g
 *         cdef GEN _ret = idealmin(_nf, _ix, _vdir)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealmul(nf, x, y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11906
 *         return new_gen(_ret)
 * 
 *     def idealmin(nf, ix, vdir=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`This function is useless and kept for backward compatibility only,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ix);
  __Pyx_XDECREF(__pyx_v_vdir);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11925
 *         return new_gen(_ret)
 * 
 *     def idealmul(nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ideal multiplication of the ideals :math:`x` and :math:`y` in the number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_675idealmul(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_674idealmul[] = "\n        Ideal multiplication of the ideals :math:`x` and :math:`y` in the number field\n        :emphasis:`nf`; the result is the ideal product in HNF. If either :math:`x` or :math:`y`\n        are extended ideals, their principal part is suitably\n        updated: i.e. multiplying :math:`[I,t]`, :math:`[J,u]` yields :math:`[IJ, tu]`; multiplying\n        :math:`I` and :math:`[J, u]` yields :math:`[IJ, u]`.\n        \n        ::\n        \n            ? nf = nfinit(x^2 + 1);\n            ? idealmul(nf, 2, x+1)\n            %2 =\n            [4 2]\n            \n            [0 2]\n            ? idealmul(nf, [2, x], x+1) \\\\ extended ideal * ideal\n            %3 = [[4, 2; 0, 2], x]\n            ? idealmul(nf, [2, x], [x+1, x]) \\\\ two extended ideals\n            %4 = [[4, 2; 0, 2], [-1, 0]~]\n        \n        If :math:`flag` is non-zero, reduce the result using :literal:`idealred`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_675idealmul(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealmul", 0, 2, 3, 1); __PYX_ERR(10, 11925, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealmul") < 0)) __PYX_ERR(10, 11925, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_y = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11925, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealmul", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11925, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_674idealmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_674idealmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealmul", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":11948
 *         If :math:`flag` is non-zero, reduce the result using :literal:`idealred`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11948, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11949
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11950
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11950, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11951
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11952
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11953
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11954
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealmul0(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":11955
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = idealmul0(_nf, _x, _y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealnorm(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11925
 *         return new_gen(_ret)
 * 
 *     def idealmul(nf, x, y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ideal multiplication of the ideals :math:`x` and :math:`y` in the number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11957
 *         return new_gen(_ret)
 * 
 *     def idealnorm(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the norm of the ideal:math:`x` in the number field:math:`nf`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_677idealnorm(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_676idealnorm[] = "\n        Computes the norm of the ideal\302\240:math:`x` in the number field\302\240:math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_677idealnorm(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealnorm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_676idealnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_676idealnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealnorm", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":11961
 *         Computes the norm of the ideal:math:`x` in the number field:math:`nf`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11961, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11962
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11962, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11963
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnorm(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11964
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealnorm(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11965
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnorm(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealnorm(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":11966
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnorm(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealnumden(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11966, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11957
 *         return new_gen(_ret)
 * 
 *     def idealnorm(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the norm of the ideal:math:`x` in the number field:math:`nf`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11968
 *         return new_gen(_ret)
 * 
 *     def idealnumden(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[A,B]`, where :math:`A,B` are coprime integer ideals
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_679idealnumden(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_678idealnumden[] = "\n        Returns :math:`[A,B]`, where :math:`A,B` are coprime integer ideals\n        such that :math:`x = A/B`, in the number field :math:`nf`.\n        \n        ::\n        \n            ? nf = nfinit(x^2+1);\n            ? idealnumden(nf, (x+1)/2)\n            %2 = [[1, 0; 0, 1], [2, 1; 0, 1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_679idealnumden(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealnumden (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_678idealnumden(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_678idealnumden(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealnumden", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":11979
 *             %2 = [[1, 0; 0, 1], [2, 1; 0, 1]]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11979, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11980
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 11980, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":11981
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnumden(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11982
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealnumden(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":11983
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnumden(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealnumden(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":11984
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealnumden(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealpow(nf, x, k, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11968
 *         return new_gen(_ret)
 * 
 *     def idealnumden(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[A,B]`, where :math:`A,B` are coprime integer ideals
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealnumden", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":11986
 *         return new_gen(_ret)
 * 
 *     def idealpow(nf, x, k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the :math:`k`-th power of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_681idealpow(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_680idealpow[] = "\n        Computes the :math:`k`-th power of\n        the ideal :math:`x` in the number field :math:`nf`; :math:`k\\in\\mathbb{Z}`.\n        If :math:`x` is an extended\n        ideal, its principal part is suitably\n        updated: i.e. raising :math:`[I,t]` to the :math:`k`-th power, yields :math:`[I^k, t^k]`.\n        \n        If :math:`flag` is non-zero, reduce the result using :literal:`idealred`, :emphasis:`throughout\n        the (binary) powering process`; in particular, this is :emphasis:`not` the same\n        as :math:`idealpow (nf,x,k)` followed by reduction.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_681idealpow(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_k = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_k,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealpow", 0, 2, 3, 1); __PYX_ERR(10, 11986, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealpow") < 0)) __PYX_ERR(10, 11986, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_k = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 11986, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealpow", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 11986, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_680idealpow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_k, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_680idealpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealpow", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_gen.pxi":11998
 *         as :math:`idealpow (nf,x,k)` followed by reduction.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         k = objtogen(k)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11998, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":11999
 *         '''
 *         x = objtogen(x)
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 11999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12000
 *         x = objtogen(x)
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12000, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12001
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12002
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12003
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12004
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealpow0(__pyx_v__nf, __pyx_v__x, __pyx_v__k, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":12005
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = idealpow0(_nf, _x, _k, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealprimedec(nf, p, long f=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":11986
 *         return new_gen(_ret)
 * 
 *     def idealpow(nf, x, k, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the :math:`k`-th power of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12007
 *         return new_gen(_ret)
 * 
 *     def idealprimedec(nf, p, long f=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the prime ideal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_683idealprimedec(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_682idealprimedec[] = "\n        Computes the prime ideal\n        decomposition of the (positive) prime number :math:`p` in the number field :math:`K`\n        represented by :emphasis:`nf`. If a non-prime :math:`p` is given the result is undefined.\n        If :math:`f` is present and non-zero, restrict the result to primes of residue\n        degree :math:`<= f`.\n        \n        The result is a vector of :emphasis:`prid` structures, each representing one of the\n        prime ideals above :math:`p` in the number field :math:`nf`. The representation\n        :math:`pr = [p,a,e,f,mb]` of a prime ideal means the following: :math:`a`\n        is an algebraic integer in the maximal order :math:`\\mathbb{Z}_K` and the prime ideal is\n        equal to :math:`p = p\\mathbb{Z}_K + a\\mathbb{Z}_K`;\n        :math:`e` is the ramification index; :math:`f` is the residual index;\n        finally, :emphasis:`mb` is the multiplication table attached to the algebraic\n        integer :math:`b` is such that :math:`p^{-1} = \\mathbb{Z}_K+ b/ p\\mathbb{Z}_K`, which is used\n        internally to compute valuations. In other words if :math:`p` is inert,\n        then :emphasis:`mb` is the integer :math:`1`, and otherwise it is a square :literal:`t_MAT`\n        whose :math:`j`-th column is :math:`b.nf.zk[j]`.\n        \n        The algebraic number :math:`a` is guaranteed to have a\n        valuation equal to 1 at the prime ideal (this is automatic if :math:`e > 1`).\n        \n        The components of :literal:`pr` should be accessed by member functions: :literal:`pr.p`,\n        :literal:`pr.e`, :literal:`pr.f`, and :literal:`pr.gen` (returns the vector :math:`[p,a]`):\n        \n        ::\n        \n            ? K = nfinit(x^3-2);\n            ? P = idealprimedec(K, 5);\n            ? #P \\\\ 2 primes above 5 in Q(2^(1/3))\n            %3 = 2\n            ? [p1,p2] = P;\n            ? [p1.e, p1.f] \\\\ the first is unramified of degree 1\n            %5 = [1, 1]\n            ? [p2.e, p2.f] ""\\\\ the second is unramified of degree 2\n            %6 = [1, 2]\n            ? p1.gen\n            %7 = [5, [2, 1, 0]~]\n            ? nfbasistoalg(K, %[2]) \\\\ a uniformizer for p1\n            %8 = Mod(x + 2, x^3 - 2)\n            ? #idealprimedec(K, 5, 1) \\\\ restrict to f = 1\n            %9 = 1 \\\\ now only p1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_683idealprimedec(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_f;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealprimedec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_f,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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealprimedec") < 0)) __PYX_ERR(10, 12007, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    if (values[1]) {
      __pyx_v_f = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_f == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12007, __pyx_L3_error)
    } else {
      __pyx_v_f = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealprimedec", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12007, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealprimedec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_682idealprimedec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_p, __pyx_v_f);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_682idealprimedec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_p, long __pyx_v_f) {
  GEN __pyx_v__nf;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealprimedec", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":12051
 *             %9 = 1 \\ now only p1
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12052
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12052, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12053
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12054
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12055
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealprimedec_limit_f(__pyx_v__nf, __pyx_v__p, __pyx_v_f);

  /* "cypari/auto_gen.pxi":12056
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = idealprimedec_limit_f(_nf, _p, f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealprincipalunits(nf, pr, long k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12007
 *         return new_gen(_ret)
 * 
 *     def idealprimedec(nf, p, long f=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the prime ideal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealprimedec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12058
 *         return new_gen(_ret)
 * 
 *     def idealprincipalunits(nf, pr, long k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime ideal in :literal:`idealprimedec` format,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_685idealprincipalunits(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_684idealprincipalunits[] = "\n        Given a prime ideal in :literal:`idealprimedec` format,\n        returns the multiplicative group :math:`(1 + pr) / (1 + pr^k)` as an\n        abelian group. This function is much faster than :literal:`idealstar` when the\n        norm of :emphasis:`pr` is large, since it avoids (useless) work in the\n        multiplicative group of the residue field.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K,2)[1];\n            ? G = idealprincipalunits(K, P, 20);\n            ? G.cyc\n            %4 = [512, 256, 4] \\\\ Z/512 x Z/256 x Z/4\n            ? G.gen\n            %5 = [[-1, -2]~, 1021, [0, -1]~] \\\\ minimal generators of given order\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_685idealprincipalunits(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pr = 0;
  long __pyx_v_k;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealprincipalunits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pr,&__pyx_n_s_k,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_pr)) != 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_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealprincipalunits", 1, 2, 2, 1); __PYX_ERR(10, 12058, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealprincipalunits") < 0)) __PYX_ERR(10, 12058, __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_pr = values[0];
    __pyx_v_k = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12058, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealprincipalunits", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12058, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealprincipalunits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_684idealprincipalunits(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pr, __pyx_v_k);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_684idealprincipalunits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr, long __pyx_v_k) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealprincipalunits", 0);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":12076
 *             %5 = [[-1, -2]~, 1021, [0, -1]~] \\ minimal generators of given order
 *         '''
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12077
 *         '''
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12077, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12078
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12079
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12080
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealprincipalunits(__pyx_v__nf, __pyx_v__pr, __pyx_v_k);

  /* "cypari/auto_gen.pxi":12081
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealprincipalunits(_nf, _pr, k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealramgroups(nf, gal, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12058
 *         return new_gen(_ret)
 * 
 *     def idealprincipalunits(nf, pr, long k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime ideal in :literal:`idealprimedec` format,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealprincipalunits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12083
 *         return new_gen(_ret)
 * 
 *     def idealramgroups(nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :emphasis:`nf` and assume that :math:`K/\mathbb{Q}` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_687idealramgroups(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_686idealramgroups[] = "\n        Let :math:`K` be the number field defined by :emphasis:`nf` and assume that :math:`K/\\mathbb{Q}` is\n        Galois with Galois group :math:`G` given by :literal:`gal = galoisinit(nf)`.\n        Let :emphasis:`pr` be the prime ideal :math:`P` in prid format.\n        This function returns a vector :math:`g` of subgroups of :literal:`gal`\n        as follow:\n        \n        - :literal:`g[1]` is the decomposition group of :math:`P`,\n        \n        - :literal:`g[2]` is :math:`G_0(P)`, the inertia group of :math:`P`,\n        \n        and for :math:`i >= 2`,\n        \n        - :literal:`g[i]` is :math:`G_{i-2}(P)`, the :math:`i-2`-th\n          ramification group of :math:`P`.\n        \n        The length of :math:`g` is the number of non-trivial groups in the\n        sequence, thus is :math:`0` if :math:`e = 1` and :math:`f = 1`, and :math:`1` if :math:`f > 1` and :math:`e = 1`.\n        The following function computes the cardinality of a subgroup of :math:`G`,\n        as given by the components of :math:`g`:\n        \n        ::\n        \n            card(H) =my(o=H[2]); prod(i=1,#o,o[i]);\n        \n        ::\n        \n            ? nf=nfinit(x^6+3); gal=galoisinit(nf); pr=idealprimedec(nf,3)[1];\n            ? g = idealramgroups(nf, gal, pr);\n            ? apply(card,g)\n            %3 = [6, 6, 3, 3, 3] \\\\ cardinalities of the G_i\n        \n        ::\n        \n            ? nf=nfinit(x^6+108); gal=galoisinit(nf); pr=idealprimedec(nf,2)[1];\n            ? iso=idealramgroups(nf,gal,pr)[2]\n            %5 = [[Vecsmall([2, 3, 1, 5, 6, 4])], Vecsmall([3])]\n            ? nfdisc(galoisfixedfield(gal,iso,1))\n            %6 = -3\n        \n        The field fixed by the inertia group of :math:`2` is not ramified at\n        :math:`2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_687idealramgroups(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealramgroups (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_pr,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_gal)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealramgroups", 1, 2, 2, 1); __PYX_ERR(10, 12083, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealramgroups") < 0)) __PYX_ERR(10, 12083, __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_gal = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealramgroups", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12083, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealramgroups", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_686idealramgroups(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_gal, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_686idealramgroups(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__gal;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealramgroups", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":12127
 *         :math:`2`.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12127, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12128
 *         '''
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12129
 *         gal = objtogen(gal)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12129, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12130
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12131
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12132
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12133
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealramgroups(__pyx_v__nf, __pyx_v__gal, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":12134
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = idealramgroups(_nf, _gal, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealred(nf, I, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12083
 *         return new_gen(_ret)
 * 
 *     def idealramgroups(nf, gal, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be the number field defined by :emphasis:`nf` and assume that :math:`K/\mathbb{Q}` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealramgroups", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12136
 *         return new_gen(_ret)
 * 
 *     def idealred(nf, I, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL reduction of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_689idealred(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_688idealred[] = "\n        LLL reduction of\n        the ideal :math:`I` in the number field :math:`K` attached to :emphasis:`nf`, along the\n        direction :math:`v`. The :math:`v` parameter is best left omitted, but if it is present,\n        it must be an :math:`nf.r1 + nf.r2`-component vector of\n        :emphasis:`non-negative` integers. (What counts is the relative magnitude of the\n        entries: if all entries are equal, the effect is the same as if the vector\n        had been omitted.)\n        \n        This function finds an :math:`a\\in K^*` such that :math:`J = (a)I` is\n        \"small\" and integral (see the end for technical details).\n        The result is the Hermite normal form of\n        the \"reduced\" ideal :math:`J`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K,5)[1];\n            ? idealred(K, P)\n            %3 =\n            [1 0]\n            \n            [0 1]\n        \n        More often than not, a principal ideal yields the unit\n        ideal as above. This is a quick and dirty way to check if ideals are principal,\n        but it is not a necessary condition: a non-trivial result does not prove that\n        the ideal is non-principal. For guaranteed results, see :literal:`bnfisprincipal`,\n        which requires the computation of a full :literal:`bnf` structure.\n        \n        If the input is an extended ideal :math:`[I,s]`, the output is :math:`[J, sa]`; in\n        this way, one keeps track of the principal ideal part:\n        \n        ::\n        \n            ? idealred(K, [P, 1])\n            %5 = [[1, 0; 0, 1], [2, -1]~]\n        \n        meaning that :math:`P` is generated by :math:`[2, -1]`. The number field element in the\n        extended part is an algebraic number in any form :emphasis:`or` a factorization\n        matrix (in terms of number field elements, not ideals!). In the latter case,\n        elements stay in factored form, which is a convenient way to avoid""\n        coefficient explosion; see also :literal:`idealpow`.\n        \n        :strong:`Technical note.` The routine computes an LLL-reduced\n        basis for the lattice :math:`I^{-1}` equipped with the quadratic\n        form\n        \n        .. MATH::\n        \n            \\|\\| x \\|\\|_v^2 = \\sum_{i = 1}^{r_1+r_2} 2^{v_i}\\varepsilon_i\\|\\sigma_i(x)\\|^2,\n        \n        where as usual the :math:`\\sigma_i` are the (real and) complex embeddings and\n        :math:`\\varepsilon_i = 1`, resp.\302\240:math:`2`, for a real, resp.\302\240complex place. The element\n        :math:`a` is simply the first vector in the LLL basis. The only reason you may want\n        to try to change some directions and set some :math:`v_i != 0` is to randomize\n        the elements found for a fixed ideal, which is heuristically useful in index\n        calculus algorithms like :literal:`bnfinit` and :literal:`bnfisprincipal`.\n        \n        :strong:`Even more technical note.` In fact, the above is a white lie.\n        We do not use :math:`\\|\\|.\\|\\|_v` exactly but a rescaled rounded variant which\n        gets us faster and simpler LLLs. There's no harm since we are not using any\n        theoretical property of :math:`a` after all, except that it belongs to :math:`I^{-1}`\n        and that :math:`a I` is \"expected to be small\".\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_689idealred(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_I = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_I,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_I)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealred") < 0)) __PYX_ERR(10, 12136, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_I = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealred", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12136, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_688idealred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_I, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_688idealred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_I, PyObject *__pyx_v_v) {
  int __pyx_v__have_v;
  GEN __pyx_v__nf;
  GEN __pyx_v__I;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealred", 0);
  __Pyx_INCREF(__pyx_v_I);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":12202
 *         and that :math:`a I` is "expected to be small".
 *         '''
 *         I = objtogen(I)             # <<<<<<<<<<<<<<
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_I, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_I, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12203
 *         '''
 *         I = objtogen(I)
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12204
 *         I = objtogen(I)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12205
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":12204
 *         I = objtogen(I)
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":12206
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _I = (<Gen>I).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 12206, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12207
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":12208
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _I = (<Gen>I).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_I)->__pyx_base.g;
  __pyx_v__I = __pyx_t_4;

  /* "cypari/auto_gen.pxi":12209
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_gen.pxi":12210
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 */
  __pyx_t_2 = (__pyx_v__have_v != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12211
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":12210
 *         cdef GEN _I = (<Gen>I).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 */
  }

  /* "cypari/auto_gen.pxi":12212
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealred0(__pyx_v__nf, __pyx_v__I, __pyx_v__v);

  /* "cypari/auto_gen.pxi":12213
 *             _v = (<Gen>v).g
 *         cdef GEN _ret = idealred0(_nf, _I, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealredmodpower(nf, x, unsigned long n, unsigned long B=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12136
 *         return new_gen(_ret)
 * 
 *     def idealred(nf, I, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL reduction of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_I);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12215
 *         return new_gen(_ret)
 * 
 *     def idealredmodpower(nf, x, unsigned long n, unsigned long B=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field, :math:`x` an ideal in :emphasis:`nf` and :math:`n > 0` be a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_691idealredmodpower(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_690idealredmodpower[] = "\n        Let :emphasis:`nf` be a number field, :math:`x` an ideal in :emphasis:`nf` and :math:`n > 0` be a\n        positive integer. Return a number field element :math:`b` such that :math:`x b^n = v`\n        is small. If :math:`x` is integral, then :math:`v` is also integral.\n        \n        More precisely, :literal:`idealnumden` reduces the problem to :math:`x` integral. Then,\n        factoring out the prime ideals dividing a rational prime :math:`p <= B`,\n        we rewrite :math:`x = I J^n` where the ideals :math:`I` and :math:`J` are both integral and\n        :math:`I` is :math:`B`-smooth. Then we return a small element :math:`b` in :math:`J^{-1}`.\n        \n        The bound :math:`B` avoids a costly complete factorization of :math:`x`; as soon as the\n        :math:`n`-core of :math:`x` is :math:`B`-smooth (i.e., as soon as :math:`I` is :math:`n`-power free),\n        then :math:`J` is as large as possible and so is the expected reduction.\n        \n        ::\n        \n            ? T = x^6+108; nf = nfinit(T); a = Mod(x,T);\n            ? setrand(1); u = (2*a^2+a+3)*random(2^1000*x^6)^6;\n            ? sizebyte(u)\n            %3 = 4864\n            ? b = idealredmodpower(nf,u,2);\n            ? v2 = nfeltmul(nf,u, nfeltpow(nf,b,2))\n            %5 = [34, 47, 15, 35, 9, 3]~\n            ? b = idealredmodpower(nf,u,6);\n            ? v6 = nfeltmul(nf,u, nfeltpow(nf,b,6))\n            %7 = [3, 0, 2, 6, -7, 1]~\n        \n        The last element :literal:`v6`, obtained by reducing\n        modulo :math:`6`-th powers instead of squares, looks smaller than :literal:`v2`\n        but its norm is actually a little larger:\n        \n        ::\n        \n            ? idealnorm(nf,v2)\n            %8 = 81309\n            ? idealnorm(nf,v6)\n            %9 = 731781\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_691idealredmodpower(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  unsigned long __pyx_v_n;
  unsigned long __pyx_v_B;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealredmodpower (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,&__pyx_n_s_B,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealredmodpower", 0, 2, 3, 1); __PYX_ERR(10, 12215, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealredmodpower") < 0)) __PYX_ERR(10, 12215, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_n == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12215, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_B = __Pyx_PyInt_As_unsigned_long(values[2]); if (unlikely((__pyx_v_B == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12215, __pyx_L3_error)
    } else {
      __pyx_v_B = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealredmodpower", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12215, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealredmodpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_690idealredmodpower(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_n, __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_690idealredmodpower(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, unsigned long __pyx_v_n, unsigned long __pyx_v_B) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealredmodpower", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":12254
 *             %9 = 731781
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12255
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12255, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12256
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12257
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12258
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealredmodpower(__pyx_v__nf, __pyx_v__x, __pyx_v_n, __pyx_v_B);

  /* "cypari/auto_gen.pxi":12259
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = idealredmodpower(_nf, _x, n, B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealstar(nf, N, long flag=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12215
 *         return new_gen(_ret)
 * 
 *     def idealredmodpower(nf, x, unsigned long n, unsigned long B=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field, :math:`x` an ideal in :emphasis:`nf` and :math:`n > 0` be a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealredmodpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12261
 *         return new_gen(_ret)
 * 
 *     def idealstar(nf, N, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs a :literal:`bid` structure,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_693idealstar(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_692idealstar[] = "\n        Outputs a :literal:`bid` structure,\n        necessary for computing in the finite abelian group :math:`G = (\\mathbb{Z}_K/N)^*`. Here,\n        :emphasis:`nf` is a number field and :math:`N` is a :emphasis:`modulus`: either an ideal in any\n        form, or a row vector whose first component is an ideal and whose second\n        component is a row vector of :math:`r_1` 0 or 1. Ideals can also be given\n        by a factorization into prime ideals, as produced by :literal:`idealfactor`.\n        \n        This :emphasis:`bid` is used in :literal:`ideallog` to compute discrete logarithms. It\n        also contains useful information which can be conveniently retrieved as\n        :literal:`:emphasis:`bid`.mod` (the modulus),\n        :literal:`:emphasis:`bid`.clgp` (:math:`G` as a finite abelian group),\n        :literal:`:emphasis:`bid`.no` (the cardinality of :math:`G`),\n        :literal:`:emphasis:`bid`.cyc` (elementary divisors) and\n        :literal:`:emphasis:`bid`.gen` (generators).\n        \n        If :math:`flag = 1` (default), the result is a :literal:`bid` structure without\n        generators: they are well defined but not explicitly computed, which saves\n        time.\n        \n        If :math:`flag = 2`, as :math:`flag = 1`, but including generators.\n        \n        If :math:`flag = 0`, only outputs :math:`(\\mathbb{Z}_K/N)^*` as an abelian group,\n        i.e as a 3-component vector :math:`[h,d,g]`: :math:`h` is the order, :math:`d` is the vector of\n        SNF cyclic components and :math:`g` the corresponding\n        generators.\n        \n        If :emphasis:`nf` is omitted, we take it to be the rational number fields, :math:`N` must\n        be an integer and we return the structure of :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`. In other words\n        :literal:`idealstar(, N, flag)` is short for\n        \n        ::\n        \n             idealstar(nfinit(x), N, flag)\n        \n        but faster. The alternative syntax :literal:""`znstar(N, flag)`\n        is also available for an analogous effect but, due to an unfortunate\n        historical oversight, the default value of :literal:`flag` is different in\n        the two functions (:literal:`znstar` does not initialize by default, you probably\n        want :literal:`znstar(N,1)`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_693idealstar(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealstar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_flag,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_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealstar") < 0)) __PYX_ERR(10, 12261, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12261, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealstar", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12261, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_692idealstar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_N, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_692idealstar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_N, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealstar", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_gen.pxi":12303
 *         want :literal:`znstar(N,1)`).
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12304
 *         '''
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12304, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12305
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12306
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12307
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealstar0(__pyx_v__nf, __pyx_v__N, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":12308
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = idealstar0(_nf, _N, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealtwoelt(nf, x, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12261
 *         return new_gen(_ret)
 * 
 *     def idealstar(nf, N, long flag=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs a :literal:`bid` structure,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12310
 *         return new_gen(_ret)
 * 
 *     def idealtwoelt(nf, x, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a two-element representation of the ideal :math:`x` in the number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_695idealtwoelt(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_694idealtwoelt[] = "\n        Computes a two-element representation of the ideal :math:`x` in the number\n        field :math:`nf`, combining a random search and an approximation theorem; :math:`x`\n        is an ideal in any form (possibly an extended ideal, whose principal part is\n        ignored)\n        \n        - When called as :literal:`idealtwoelt(nf,x)`, the result is a row vector\n          :math:`[a,\\alpha]` with two components such that :math:`x = a\\mathbb{Z}_K+\\alpha\\mathbb{Z}_K` and :math:`a` is\n          chosen to be the positive generator of :math:`x\\cap\\mathbb{Z}`, unless :math:`x` was given as a\n          principal ideal in which case we may choose :math:`a = 0`. The algorithm\n          uses a fast lazy factorization of :math:`x\\cap \\mathbb{Z}` and runs in randomized\n          polynomial time.\n        \n        ::\n        \n            ? K = nfinit(t^5-23);\n            ? x = idealhnf(K, t^2*(t+1), t^3*(t+1))\n            %2 = \\\\ some random ideal of norm 552*23\n            [552 23 23 529 23]\n            \n            [ 0 23 0 0 0]\n            \n            [ 0 0 1 0 0]\n            \n            [ 0 0 0 1 0]\n            \n            [ 0 0 0 0 1]\n            \n            ? [a,alpha] = idealtwoelt(K, x)\n            %3 = [552, [23, 0, 1, 0, 0]~]\n            ? nfbasistoalg(K, alpha)\n            %4 = Mod(t^2 + 23, t^5 - 23)\n        \n        - When called as :literal:`idealtwoelt(nf,x,a)` with an explicit non-zero :math:`a`\n          supplied as third argument, the function assumes that :math:`a \\in x` and returns\n          :math:`\\alpha\\in x` such that :math:`x = a\\mathbb{Z}_K + \\alpha\\mathbb{Z}_K`. Note that we must factor\n          :math:`a` in this case, and the algorithm is generally slower than the\n          default variant and gives larger generators:\n        \n        ::\n        \n            ? alpha2 = idealtwoelt(K, x, 552)\n            %5 = [-161, -161, -183, -207, 0]~\n            ? idealhnf(K, 552, alpha2) == x\n      ""      %6 = 1\n        \n        Note that, in both cases, the return value is :emphasis:`not`\n        recognized as an ideal by GP functions; one must use :literal:`idealhnf` as\n        above to recover a valid ideal structure from the two-element representation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_695idealtwoelt(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealtwoelt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_a,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealtwoelt") < 0)) __PYX_ERR(10, 12310, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_a = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealtwoelt", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12310, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealtwoelt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_694idealtwoelt(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_a);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_694idealtwoelt(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_a) {
  int __pyx_v__have_a;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("idealtwoelt", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":12361
 *         above to recover a valid ideal structure from the two-element representation.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12362
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_2 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12363
 *         x = objtogen(x)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12364
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":12363
 *         x = objtogen(x)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":12365
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 12365, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12366
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":12367
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":12368
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_gen.pxi":12369
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12370
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_gen.pxi":12369
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 */
  }

  /* "cypari/auto_gen.pxi":12371
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = idealtwoelt0(__pyx_v__nf, __pyx_v__x, __pyx_v__a);

  /* "cypari/auto_gen.pxi":12372
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = idealtwoelt0(_nf, _x, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def idealval(nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12310
 *         return new_gen(_ret)
 * 
 *     def idealtwoelt(nf, x, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a two-element representation of the ideal :math:`x` in the number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealtwoelt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12374
 *         return new_gen(_ret)
 * 
 *     def idealval(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the valuation of the ideal :math:`x` at the prime ideal :emphasis:`pr` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_697idealval(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_696idealval[] = "\n        Gives the valuation of the ideal :math:`x` at the prime ideal :emphasis:`pr` in the\n        number field :math:`nf`, where :emphasis:`pr` is in :literal:`idealprimedec` format.\n        The valuation of the :math:`0` ideal is :literal:`+oo`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_697idealval(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("idealval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_pr,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("idealval", 1, 2, 2, 1); __PYX_ERR(10, 12374, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "idealval") < 0)) __PYX_ERR(10, 12374, __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_x = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("idealval", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12374, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_696idealval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_696idealval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("idealval", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":12380
 *         The valuation of the :math:`0` ideal is :literal:`+oo`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12381
 *         '''
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12382
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12382, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12383
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12384
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12385
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12386
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpidealval(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":12387
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = gpidealval(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def imag(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12374
 *         return new_gen(_ret)
 * 
 *     def idealval(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the valuation of the ideal :math:`x` at the prime ideal :emphasis:`pr` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.idealval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12389
 *         return new_gen(_ret)
 * 
 *     def imag(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Imaginary part of :math:`x`. When :math:`x` is a quadratic number, this is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_699imag(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_698imag[] = "\n        Imaginary part of :math:`x`. When :math:`x` is a quadratic number, this is the\n        coefficient of :math:`\\omega` in the \"canonical\" integral basis :math:`(1,\\omega)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_699imag(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("imag (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_698imag(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_698imag(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("imag", 0);

  /* "cypari/auto_gen.pxi":12394
 *         coefficient of :math:`\omega` in the "canonical" integral basis :math:`(1,\omega)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gimag(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12394, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12395
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gimag(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12396
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gimag(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gimag(__pyx_v__x);

  /* "cypari/auto_gen.pxi":12397
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gimag(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def incgam(s, x, g=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12389
 *         return new_gen(_ret)
 * 
 *     def imag(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Imaginary part of :math:`x`. When :math:`x` is a quadratic number, this is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.imag", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12399
 *         return new_gen(_ret)
 * 
 *     def incgam(s, x, g=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Incomplete gamma function :math:`\int_x^ oo e^{-t}t^{s-1}dt`, extended by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_701incgam(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_700incgam[] = "\n        Incomplete gamma function :math:`\\int_x^ oo e^{-t}t^{s-1}dt`, extended by\n        analytic continuation to all complex :math:`x, s` not both :math:`0`. The relative error\n        is bounded in terms of the precision of :math:`s` (the accuracy of :math:`x` is ignored\n        when determining the output precision). When :math:`g` is given, assume that\n        :math:`g = \\Gamma (s)`. For small :math:`\\|x\\|`, this will speed up the computation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_701incgam(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_g = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("incgam (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_g,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_g);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "incgam") < 0)) __PYX_ERR(10, 12399, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_g = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12399, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("incgam", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12399, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.incgam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_700incgam(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_x, __pyx_v_g, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_700incgam(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_x, PyObject *__pyx_v_g, long __pyx_v_precision) {
  int __pyx_v__have_g;
  GEN __pyx_v__s;
  GEN __pyx_v__x;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("incgam", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_gen.pxi":12407
 *         :math:`g = \Gamma (s)`. For small :math:`\|x\|`, this will speed up the computation.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12408
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_g = (g is not None)             # <<<<<<<<<<<<<<
 *         if _have_g:
 *             g = objtogen(g)
 */
  __pyx_t_2 = (__pyx_v_g != Py_None);
  __pyx_v__have_g = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12409
 *         x = objtogen(x)
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             g = objtogen(g)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_g != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12410
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:
 *             g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":12409
 *         x = objtogen(x)
 *         cdef bint _have_g = (g is not None)
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             g = objtogen(g)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":12411
 *         if _have_g:
 *             g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 12411, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12412
 *             g = objtogen(g)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_4;

  /* "cypari/auto_gen.pxi":12413
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = NULL
 *         if _have_g:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":12414
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL             # <<<<<<<<<<<<<<
 *         if _have_g:
 *             _g = (<Gen>g).g
 */
  __pyx_v__g = NULL;

  /* "cypari/auto_gen.pxi":12415
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_g != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12416
 *         cdef GEN _g = NULL
 *         if _have_g:
 *             _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
    __pyx_v__g = __pyx_t_4;

    /* "cypari/auto_gen.pxi":12415
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = NULL
 *         if _have_g:             # <<<<<<<<<<<<<<
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":12417
 *         if _have_g:
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":12418
 *             _g = (<Gen>g).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = incgam0(__pyx_v__s, __pyx_v__x, __pyx_v__g, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":12419
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgam0(_s, _x, _g, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def incgamc(s, x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12399
 *         return new_gen(_ret)
 * 
 *     def incgam(s, x, g=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Incomplete gamma function :math:`\int_x^ oo e^{-t}t^{s-1}dt`, extended by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.incgam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12421
 *         return new_gen(_ret)
 * 
 *     def incgamc(s, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary incomplete gamma function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_703incgamc(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_702incgamc[] = "\n        Complementary incomplete gamma function.\n        The arguments :math:`x` and :math:`s` are complex numbers such that :math:`s` is not a pole of\n        :math:`\\Gamma` and :math:`\\|x\\|/(\\|s\\|+1)` is not much larger than 1 (otherwise the\n        convergence is very slow). The result returned is :math:`\\int_0^x\n        e^{-t}t^{s-1}dt`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_703incgamc(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("incgamc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_precision,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "incgamc") < 0)) __PYX_ERR(10, 12421, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12421, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("incgamc", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12421, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.incgamc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_702incgamc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_x, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_702incgamc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("incgamc", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":12429
 *         e^{-t}t^{s-1}dt`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12429, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12430
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12430, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12431
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12432
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgamc(_s, _x, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12433
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = incgamc(_s, _x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":12434
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgamc(_s, _x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = incgamc(__pyx_v__s, __pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":12435
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = incgamc(_s, _x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def intformal(x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12421
 *         return new_gen(_ret)
 * 
 *     def incgamc(s, x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complementary incomplete gamma function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.incgamc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12437
 *         return new_gen(_ret)
 * 
 *     def intformal(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal integration of :math:`x` with respect to the variable :math:`v` (wrt.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_705intformal(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_704intformal[] = "\n        formal integration of :math:`x` with respect to the variable :math:`v` (wrt.\n        the main variable if :math:`v` is omitted). Since PARI cannot represent\n        logarithmic or arctangent terms, any such term in the result will yield an\n        error:\n        \n        ::\n        \n             ? intformal(x^2)\n             %1 = 1/3*x^3\n             ? intformal(x^2, y)\n             %2 = y*x^2\n             ? intformal(1/x)\n             *** at top-level: intformal(1/x)\n             *** ^--------------\n             *** intformal: domain error in intformal: residue(series, pole) != 0\n        \n        The argument :math:`x` can be of any type. When :math:`x` is a rational function, we\n        assume that the base ring is an integral domain of characteristic zero.\n        \n        By definition, the main variable of a :literal:`t_POLMOD` is the main variable\n        among the coefficients from its two polynomial components\n        (representative and modulus); in other words, assuming a polmod represents an\n        element of :math:`R[X]/(T(X))`, the variable :math:`X` is a mute variable and the\n        integral is taken with respect to the main variable used in the base ring :math:`R`.\n        In particular, it is meaningless to integrate with respect to the main\n        variable of :literal:`x.mod`:\n        \n        ::\n        \n            ? intformal(Mod(1,x^2+1), 'x)\n            *** intformal: incorrect priority in intformal: variable x = x\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_705intformal(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("intformal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "intformal") < 0)) __PYX_ERR(10, 12437, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("intformal", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12437, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.intformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_704intformal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_704intformal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("intformal", 0);

  /* "cypari/auto_gen.pxi":12471
 *             *** intformal: incorrect priority in intformal: variable x = x
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":12472
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12473
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 12473, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":12472
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":12474
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = integ(_x, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 12474, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12475
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = integ(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":12476
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = integ(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = integ(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":12477
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = integ(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def intnuminit(a, b, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 12477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12437
 *         return new_gen(_ret)
 * 
 *     def intformal(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal integration of :math:`x` with respect to the variable :math:`v` (wrt.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.intformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12479
 *         return new_gen(_ret)
 * 
 *     def intnuminit(a, b, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for integration from
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_707intnuminit(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_706intnuminit[] = "\n        Initialize tables for integration from\n        :math:`a` to :math:`b`, where :math:`a` and :math:`b` are coded as in :literal:`intnum`. Only the\n        compactness, the possible existence of singularities, the speed of decrease\n        or the oscillations at infinity are taken into account, and not the values.\n        For instance ``intnuminit(-1,1)`` is equivalent to ``intnuminit(0,Pi)``,\n        and ``intnuminit([0,-1/2],oo)`` is equivalent to\n        ``intnuminit([-1,-1/2], -oo)``; on the other hand, the order matters\n        and\n        ``intnuminit([0,-1/2], [1,-1/3])`` is :emphasis:`not` equivalent to\n        ``intnuminit([0,-1/3], [1,-1/2])`` !\n        \n        If :math:`m` is present, it must be non-negative and we multiply the default\n        number of sampling points by :math:`2^m` (increasing the running time by a\n        similar factor).\n        \n        The result is technical and liable to change in the future, but we document\n        it here for completeness. Let :math:`x = \\phi (t)`, :math:`t\\in ]- oo , oo [` be an\n        internally chosen change of variable, achieving double exponential decrease of\n        the integrand at infinity. The integrator :literal:`intnum` will compute\n        \n        .. MATH::\n        \n            h \\sum_{\\|n\\| < N} \\phi'(nh) F(\\phi (nh))\n        \n        for some integration step :math:`h` and truncation parameter :math:`N`.\n        In basic use, let\n        \n        ::\n        \n            [h, x0, w0, xp, wp, xm, wm] = intnuminit(a,b);\n        \n        - :math:`h` is the integration step\n        \n        - :math:`x_0 = \\phi (0)` and :math:`w_0 = \\phi'(0)`,\n        \n        - :emphasis:`xp` contains the :math:`\\phi (nh)`, :math:`0 < n < N`,\n        \n        - :emphasis:`xm` contains the :math:`\\phi (nh)`, :math:`0 < -n < N`, or is empty.\n        \n        - :emphasis:`wp` contains the :math:`\\phi'(nh)`, :math:`0 < n < N`,\n        \n        - :emphasis:`wm` co""ntains the :math:`\\phi'(nh)`, :math:`0 < -n < N`, or is empty.\n        \n        The arrays :emphasis:`xm` and :emphasis:`wm` are left empty when :math:`\\phi` is an odd\n        function. In complicated situations when non-default behavior is specified at\n        end points, :literal:`intnuminit` may return up to :math:`3` such arrays, corresponding\n        to a splitting of up to :math:`3` integrals of basic type.\n        \n        If the functions to be integrated later are of the form :math:`F = f(t) k(t,z)`\n        for some kernel :math:`k` (e.g. Fourier, Laplace, Mellin,...), it is\n        useful to also precompute the values of :math:`f(\\phi (nh))`, which is accomplished\n        by :literal:`intfuncinit`. The hard part is to determine the behavior\n        of :math:`F` at endpoints, depending on :math:`z`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_707intnuminit(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("intnuminit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "intnuminit") < 0)) __PYX_ERR(10, 12479, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_b = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12479, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12479, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("intnuminit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12479, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.intnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_706intnuminit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_a), __pyx_v_b, __pyx_v_m, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_706intnuminit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, PyObject *__pyx_v_b, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("intnuminit", 0);
  __Pyx_INCREF(__pyx_v_b);

  /* "cypari/auto_gen.pxi":12535
 *         of :math:`F` at endpoints, depending on :math:`z`.
 *         '''
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12536
 *         '''
 *         b = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12536, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12537
 *         b = objtogen(b)
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12538
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12539
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":12540
 *         cdef GEN _b = (<Gen>b).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = intnuminit(__pyx_v__a, __pyx_v__b, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":12541
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = intnuminit(_a, _b, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def isfundamental(D):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12479
 *         return new_gen(_ret)
 * 
 *     def intnuminit(a, b, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for integration from
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.intnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12543
 *         return new_gen(_ret)
 * 
 *     def isfundamental(D):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`D` is equal to 1 or to the discriminant of a quadratic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_709isfundamental(PyObject *__pyx_v_D, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_708isfundamental[] = "\n        True (1) if :math:`D` is equal to 1 or to the discriminant of a quadratic\n        field, false (0) otherwise. :math:`D` can be input in factored form as for\n        arithmetic functions:\n        \n        ::\n        \n            ? isfundamental(factor(-8))\n            %1 = 1\n            \\\\ count fundamental discriminants up to 10^8\n            ? c = 0; forfactored(d = 1, 10^8, if (isfundamental(d), c++)); c\n            time = 40,840 ms.\n            %2 = 30396325\n            ? c = 0; for(d = 1, 10^8, if (isfundamental(d), c++)); c\n            time = 1min, 33,593 ms. \\\\ slower !\n            %3 = 30396325\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_709isfundamental(PyObject *__pyx_v_D, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isfundamental (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_708isfundamental(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_708isfundamental(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D) {
  GEN __pyx_v__D;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("isfundamental", 0);

  /* "cypari/auto_gen.pxi":12561
 *             %3 = 30396325
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef long _ret = isfundamental(_D)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12561, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12562
 *         '''
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = isfundamental(_D)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12563
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef long _ret = isfundamental(_D)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isfundamental(__pyx_v__D);

  /* "cypari/auto_gen.pxi":12564
 *         cdef GEN _D = (<Gen>D).g
 *         cdef long _ret = isfundamental(_D)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":12565
 *         cdef long _ret = isfundamental(_D)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def ispowerful(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12543
 *         return new_gen(_ret)
 * 
 *     def isfundamental(D):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`D` is equal to 1 or to the discriminant of a quadratic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.isfundamental", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12567
 *         return _ret
 * 
 *     def ispowerful(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a powerful integer, false (0) if not;
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_711ispowerful(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_710ispowerful[] = "\n        True (1) if :math:`x` is a powerful integer, false (0) if not;\n        an integer is powerful if and only if its valuation at all primes dividing\n        :math:`x` is greater than 1.\n        \n        ::\n        \n            ? ispowerful(50)\n            %1 = 0\n            ? ispowerful(100)\n            %2 = 1\n            ? ispowerful(5^3*(10^1000+1)^2)\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_711ispowerful(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ispowerful (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_710ispowerful(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_710ispowerful(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ispowerful", 0);

  /* "cypari/auto_gen.pxi":12582
 *             %3 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = ispowerful(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12582, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12583
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = ispowerful(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12584
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = ispowerful(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = ispowerful(__pyx_v__x);

  /* "cypari/auto_gen.pxi":12585
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = ispowerful(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":12586
 *         cdef long _ret = ispowerful(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def isprime(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12567
 *         return _ret
 * 
 *     def ispowerful(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a powerful integer, false (0) if not;
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ispowerful", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12588
 *         return _ret
 * 
 *     def isprime(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_713isprime(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_712isprime[] = "\n        True (1) if :math:`x` is a prime\n        number, false (0) otherwise. A prime number is a positive integer having\n        exactly two distinct divisors among the natural numbers, namely 1 and\n        itself.\n        \n        This routine proves or disproves rigorously that a number is prime, which can\n        be very slow when :math:`x` is indeed a large prime integer. For instance\n        a :math:`1000` digits prime should require 15 to 30 minutes with default algorithms.\n        Use :literal:`ispseudoprime` to quickly check for compositeness. Use\n        :literal:`primecert` in order to obtain a primality proof instead of a yes/no\n        answer; see also :literal:`factor`.\n        \n        The function accepts vector/matrices arguments, and is then\n        applied componentwise.\n        \n        If :math:`flag = 0`, use a combination of\n        \n        - Baillie-Pomerance-Selfridge-Wagstaff compositeness test\n          (see :literal:`ispseudoprime`),\n        \n        - Selfridge \":math:`p-1`\" test if :math:`x-1` is smooth enough,\n        \n        - Adleman-Pomerance-Rumely-Cohen-Lenstra (APRCL) for general\n          medium-sized :math:`x` (less than 1500 bits),\n        \n        - Atkin-Morain's Elliptic Curve Primality Prover (ECPP) for general\n          large :math:`x`.\n        \n        If :math:`flag = 1`, use Selfridge-Pocklington-Lehmer \":math:`p-1`\" test; this requires\n        partially factoring various auxilliary integers and is likely to be very slow.\n        \n        If :math:`flag = 2`, use APRCL only.\n        \n        If :math:`flag = 3`, use ECPP only.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_713isprime(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isprime") < 0)) __PYX_ERR(10, 12588, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12588, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isprime", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12588, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.isprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_712isprime(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_712isprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("isprime", 0);

  /* "cypari/auto_gen.pxi":12625
 *         If :math:`flag = 3`, use ECPP only.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gisprime(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12625, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12626
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gisprime(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12627
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gisprime(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gisprime(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":12628
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gisprime(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ispseudoprime(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12588
 *         return _ret
 * 
 *     def isprime(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.isprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12630
 *         return new_gen(_ret)
 * 
 *     def ispseudoprime(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a strong pseudo
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_715ispseudoprime(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_714ispseudoprime[] = "\n        True (1) if :math:`x` is a strong pseudo\n        prime (see below), false (0) otherwise. If this function returns false, :math:`x`\n        is not prime; if, on the other hand it returns true, it is only highly likely\n        that :math:`x` is a prime number. Use :literal:`isprime` (which is of course much\n        slower) to prove that :math:`x` is indeed prime.\n        The function accepts vector/matrices arguments, and is then applied\n        componentwise.\n        \n        If :math:`flag = 0`, checks whether :math:`x` has no small prime divisors (up to :math:`101`\n        included) and is a Baillie-Pomerance-Selfridge-Wagstaff pseudo prime.\n        Such a pseudo prime passes a Rabin-Miller test for base :math:`2`,\n        followed by a Lucas test for the sequence :math:`(P,1)`, where :math:`P >= 3`\n        is the smallest odd integer such that :math:`P^2 - 4` is not a square mod :math:`x`.\n        (Technically, we are using an \"almost extra strong Lucas test\" that\n        checks whether :math:`V_n` is :math:`\302\261 2`, without computing :math:`U_n`.)\n        \n        There are no known composite numbers passing the above test, although it is\n        expected that infinitely many such numbers exist. In particular, all\n        composites :math:`<= 2^{64}` are correctly detected (checked using\n        :literal:`http://www.cecm.sfu.ca/Pseudoprimes/index-2-to-64.html`).\n        \n        If :math:`flag > 0`, checks whether :math:`x` is a strong Miller-Rabin pseudo prime for\n        :math:`flag` randomly chosen bases (with end-matching to catch square roots of :math:`-1`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_715ispseudoprime(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ispseudoprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ispseudoprime") < 0)) __PYX_ERR(10, 12630, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12630, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ispseudoprime", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12630, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.ispseudoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_714ispseudoprime(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_714ispseudoprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ispseudoprime", 0);

  /* "cypari/auto_gen.pxi":12656
 *         :math:`flag` randomly chosen bases (with end-matching to catch square roots of :math:`-1`).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gispseudoprime(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12656, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12657
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gispseudoprime(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12658
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gispseudoprime(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gispseudoprime(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":12659
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gispseudoprime(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def issquarefree(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12630
 *         return new_gen(_ret)
 * 
 *     def ispseudoprime(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is a strong pseudo
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ispseudoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12661
 *         return new_gen(_ret)
 * 
 *     def issquarefree(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is squarefree, false (0) if not. Here :math:`x` can be an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_717issquarefree(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_716issquarefree[] = "\n        True (1) if :math:`x` is squarefree, false (0) if not. Here :math:`x` can be an\n        integer or a polynomial with coefficients in an integral domain.\n        \n        ::\n        \n            ? issquarefree(12)\n            %1 = 0\n            ? issquarefree(6)\n            %2 = 1\n            ? issquarefree(x^3+x^2)\n            %3 = 0\n            ? issquarefree(Mod(1,4)*(x^2+x+1)) \\\\ Z/4Z is not a domain !\n             *** at top-level: issquarefree(Mod(1,4)*(x^2+x+1))\n             *** ^--------------------------------\n             *** issquarefree: impossible inverse in Fp_inv: Mod(2, 4).\n        \n        A polynomial is declared squarefree if :literal:`gcd`:math:`(x,x')` is\n        :math:`1`. In particular a non-zero polynomial with inexact coefficients is\n        considered to be squarefree. Note that this may be inconsistent with\n        :literal:`factor`, which first rounds the input to some exact approximation before\n        factoring in the apropriate domain; this is correct when the input is not\n        close to an inseparable polynomial (the resultant of :math:`x` and :math:`x'` is not\n        close to :math:`0`).\n        \n        An integer can be input in factored form as in arithmetic functions.\n        \n        ::\n        \n            ? issquarefree(factor(6))\n            %1 = 1\n            \\\\ count squarefree integers up to 10^8\n            ? c = 0; for(d = 1, 10^8, if (issquarefree(d), c++)); c\n            time = 3min, 2,590 ms.\n            %2 = 60792694\n            ? c = 0; forfactored(d = 1, 10^8, if (issquarefree(d), c++)); c\n            time = 45,348 ms. \\\\ faster !\n            %3 = 60792694\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_717issquarefree(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("issquarefree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_716issquarefree(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_716issquarefree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("issquarefree", 0);

  /* "cypari/auto_gen.pxi":12701
 *             %3 = 60792694
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = issquarefree(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12701, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12702
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = issquarefree(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12703
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = issquarefree(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = issquarefree(__pyx_v__x);

  /* "cypari/auto_gen.pxi":12704
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = issquarefree(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":12705
 *         cdef long _ret = issquarefree(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def kronecker(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12705, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12661
 *         return new_gen(_ret)
 * 
 *     def issquarefree(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         True (1) if :math:`x` is squarefree, false (0) if not. Here :math:`x` can be an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.issquarefree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12707
 *         return _ret
 * 
 *     def kronecker(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Kronecker symbol :math:`(x\|y)`, where :math:`x` and :math:`y` must be of type integer. By
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_719kronecker(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_718kronecker[] = "\n        Kronecker symbol :math:`(x\\|y)`, where :math:`x` and :math:`y` must be of type integer. By\n        definition, this is the extension of Legendre symbol to :math:`\\mathbb{Z} x \\mathbb{Z}`\n        by total multiplicativity in both arguments with the following special rules\n        for :math:`y = 0, -1` or :math:`2`:\n        \n        - :math:`(x\\|0) = 1` if :math:`\\|x \\|= 1` and :math:`0` otherwise.\n        \n        - :math:`(x\\|-1) = 1` if :math:`x >= 0` and :math:`-1` otherwise.\n        \n        - :math:`(x\\|2) = 0` if :math:`x` is even and :math:`1` if :math:`x = 1,-1 mod 8` and :math:`-1`\n          if :math:`x = 3,-3 mod 8`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_719kronecker(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kronecker (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_718kronecker(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_718kronecker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("kronecker", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":12721
 *           if :math:`x = 3,-3 mod 8`.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12722
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12722, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12723
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef long _ret = kronecker(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12724
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = kronecker(_x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12725
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef long _ret = kronecker(_x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = kronecker(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":12726
 *         cdef GEN _y = (<Gen>y).g
 *         cdef long _ret = kronecker(_x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":12727
 *         cdef long _ret = kronecker(_x, _y)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lambertw(y, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12707
 *         return _ret
 * 
 *     def kronecker(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Kronecker symbol :math:`(x\|y)`, where :math:`x` and :math:`y` must be of type integer. By
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.kronecker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12729
 *         return _ret
 * 
 *     def lambertw(y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lambert :math:`W` function, solution of the implicit equation :math:`xe^x = y`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_721lambertw(PyObject *__pyx_v_y, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_720lambertw[] = "\n        Lambert :math:`W` function, solution of the implicit equation :math:`xe^x = y`,\n        for :math:`y > 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_721lambertw(PyObject *__pyx_v_y, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambertw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambertw") < 0)) __PYX_ERR(10, 12729, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12729, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lambertw", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12729, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lambertw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_720lambertw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_y), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_720lambertw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_y, long __pyx_v_precision) {
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lambertw", 0);

  /* "cypari/auto_gen.pxi":12734
 *         for :math:`y > 0`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12734, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12735
 *         '''
 *         sig_on()
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glambertW(_y, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12736
 *         sig_on()
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glambertW(_y, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":12737
 *         cdef GEN _y = (<Gen>y).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glambertW(_y, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glambertW(__pyx_v__y, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":12738
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glambertW(_y, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def laurentseries(f, long serprec=-1, M=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12729
 *         return _ret
 * 
 *     def lambertw(y, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lambert :math:`W` function, solution of the implicit equation :math:`xe^x = y`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lambertw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12740
 *         return new_gen(_ret)
 * 
 *     def laurentseries(f, long serprec=-1, M=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expand :math:`f` as a Laurent series around :math:`x = 0` to order :math:`M`. This
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_723laurentseries(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_722laurentseries[] = "\n        Expand :math:`f` as a Laurent series around :math:`x = 0` to order :math:`M`. This\n        function computes :math:`f(x + O(x^n))` until :math:`n` is large enough: it\n        must be possible to evaluate :math:`f` on a power series with :math:`0` constant term.\n        \n        ::\n        \n            ? laurentseries(t->sin(t)/(1-cos(t)), 5)\n            %1 = 2*x^-1 - 1/6*x - 1/360*x^3 - 1/15120*x^5 + O(x^6)\n            ? laurentseries(log)\n             *** at top-level: laurentseries(log)\n             *** ^------------------\n             *** in function laurentseries: log\n             *** ^---\n             *** log: domain error in log: series valuation != 0\n        \n        Note that individual Laurent coefficients of order :math:`<= M`\n        can be retrieved from :math:`s = laurentseries (f,M)` via :literal:`polcoeff(s,i)`\n        for any :math:`i <= M`. The series :math:`s` may occasionally be more precise that\n        the required :math:`O(x^{M+1})`.\n        \n        With respect to successive calls to :literal:`derivnum`,\n        :literal:`laurentseries` is both faster and more precise:\n        \n        ::\n        \n            ? laurentseries(t->log(3+t),1)\n            %1 = 1.0986122886681096913952452369225257047 + 1/3*x - 1/18*x^2 + O(x^3)\n            ? derivnum(t=0,log(3+t),1)\n            %2 = 0.33333333333333333333333333333333333333\n            ? derivnum(t=0,log(3+t),2)\n            %3 = -0.11111111111111111111111111111111111111\n            \n            ? f = x->sin(exp(x));\n            ? polcoeff(laurentseries(x->f(x+2), 1), 1)\n            %5 = 3.3129294231043339804683687620360224365\n            ? exp(2) * cos(exp(2));\n            %6 = 3.3129294231043339804683687620360224365\n            ? derivnum(x = 2, f(x))\n            %7 = 3.3129294231043339804683687620360224364 \\\\ 1 ulp off\n            \n            ? default(realprecision,115);\n            ? for(i=1,10^4, laurentseries(x->f(x+2),1))\n            tim""e = 279 ms.\n            ? for(i=1,10^4, derivnum(x=2,f(x))) \\\\ ... and slower\n            time = 1,134 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_723laurentseries(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_serprec;
  PyObject *__pyx_v_M = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("laurentseries (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_serprec,&__pyx_n_s_M,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "laurentseries") < 0)) __PYX_ERR(10, 12740, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12740, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
    __pyx_v_M = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12740, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("laurentseries", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12740, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.laurentseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_722laurentseries(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_serprec, __pyx_v_M, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_722laurentseries(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, long __pyx_v_serprec, PyObject *__pyx_v_M, long __pyx_v_precision) {
  long __pyx_v__M;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("laurentseries", 0);

  /* "cypari/auto_gen.pxi":12788
 *             time = 1,134 ms.
 *         '''
 *         cdef long _M = -1             # <<<<<<<<<<<<<<
 *         if M is not None:
 *             _M = get_var(M)
 */
  __pyx_v__M = -1L;

  /* "cypari/auto_gen.pxi":12789
 *         '''
 *         cdef long _M = -1
 *         if M is not None:             # <<<<<<<<<<<<<<
 *             _M = get_var(M)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_M != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12790
 *         cdef long _M = -1
 *         if M is not None:
 *             _M = get_var(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_M); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 12790, __pyx_L1_error)
    __pyx_v__M = __pyx_t_3;

    /* "cypari/auto_gen.pxi":12789
 *         '''
 *         cdef long _M = -1
 *         if M is not None:             # <<<<<<<<<<<<<<
 *             _M = get_var(M)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":12791
 *         if M is not None:
 *             _M = get_var(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 12791, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12792
 *             _M = get_var(M)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_5;

  /* "cypari/auto_gen.pxi":12793
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":12794
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":12793
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":12795
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":12796
 *             serprec = precdl  # Global PARI series precision
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = laurentseries0(__pyx_v__f, __pyx_v_serprec, __pyx_v__M, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":12797
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = laurentseries0(_f, serprec, _M, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lcm(x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 12797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12740
 *         return new_gen(_ret)
 * 
 *     def laurentseries(f, long serprec=-1, M=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expand :math:`f` as a Laurent series around :math:`x = 0` to order :math:`M`. This
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.laurentseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12799
 *         return new_gen(_ret)
 * 
 *     def lcm(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Least common multiple of :math:`x` and :math:`y`, i.e.such
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_725lcm(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_724lcm[] = "\n        Least common multiple of :math:`x` and :math:`y`, i.e.\302\240such\n        that :math:`\\mathrm{lcm} (x,y)*\\mathrm{gcd} (x,y) = x*y`, up to units. If :math:`y` is omitted and :math:`x`\n        is a vector, returns the :math:`lcm` of all components of :math:`x`.\n        For integer arguments, return the non-negative lcm.\n        \n        When :math:`x` and :math:`y` are both given and one of them is a vector/matrix type,\n        the LCM is again taken recursively on each component, but in a different way.\n        If :math:`y` is a vector, resp.\302\240matrix, then the result has the same type as :math:`y`,\n        and components equal to :literal:`lcm(x, y[i])`, resp.\302\240:literal:`lcm(x, y[,i])`. Else\n        if :math:`x` is a vector/matrix the result has the same type as :math:`x` and an\n        analogous definition. Note that for these types, :literal:`lcm` is not\n        commutative.\n        \n        Note that :literal:`lcm(v)` is quite different from\n        \n        ::\n        \n            l = v[1]; for (i = 1, #v, l = lcm(l, v[i]))\n        \n        Indeed, :literal:`lcm(v)` is a scalar, but :literal:`l` may not be (if one of\n        the :literal:`v[i]` is a vector/matrix). The computation uses a divide-conquer tree\n        and should be much more efficient, especially when using the GMP\n        multiprecision kernel (and more subquadratic algorithms become available):\n        \n        ::\n        \n            ? v = vector(10^5, i, random);\n            ? lcm(v);\n            time = 546 ms.\n            ? l = v[1]; for (i = 1, #v, l = lcm(l, v[i]))\n            time = 4,561 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_725lcm(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lcm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lcm") < 0)) __PYX_ERR(10, 12799, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lcm", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12799, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lcm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_724lcm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_724lcm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lcm", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":12833
 *             time = 4,561 ms.
 *         '''
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_1 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_1;

  /* "cypari/auto_gen.pxi":12834
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":12835
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 12835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":12834
 *         '''
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":12836
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 12836, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12837
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":12838
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_gen.pxi":12839
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)
 */
  __pyx_t_1 = (__pyx_v__have_y != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":12840
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glcm0(_x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":12839
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)
 */
  }

  /* "cypari/auto_gen.pxi":12841
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glcm0(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":12842
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = glcm0(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def length(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 12842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12799
 *         return new_gen(_ret)
 * 
 *     def lcm(x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Least common multiple of :math:`x` and :math:`y`, i.e.such
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lcm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12844
 *         return new_gen(_ret)
 * 
 *     def length(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Length of :math:`x`; :literal:`\#`:math:`x` is a shortcut for :literal:`length`:math:`(x)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_727length(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_726length[] = "\n        Length of :math:`x`; :literal:`\\#`:math:`x` is a shortcut for :literal:`length`:math:`(x)`.\n        This is mostly useful for\n        \n        - vectors: dimension (0 for empty vectors),\n        \n        - lists: number of entries (0 for empty lists),\n        \n        - matrices: number of columns,\n        \n        - character strings: number of actual characters (without\n          trailing :literal:`\\\\0`, should you expect it from :math:`C` :literal:`char*`).\n        \n        ::\n        \n             ? #\"a string\"\n             %1 = 8\n             ? #[3,2,1]\n             %2 = 3\n             ? #[]\n             %3 = 0\n             ? #matrix(2,5)\n             %4 = 5\n             ? L = List([1,2,3,4]); #L\n             %5 = 4\n        \n        The routine is in fact defined for arbitrary GP types, but is awkward and\n        useless in other cases: it returns the number of non-code words in :math:`x`, e.g.\n        the effective length minus 2 for integers since the :literal:`t_INT` type has two code\n        words.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_727length(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("length (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_726length(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_726length(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("length", 0);

  /* "cypari/auto_gen.pxi":12876
 *         words.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = glength(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 12876, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12877
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = glength(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":12878
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = glength(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = glength(__pyx_v__x);

  /* "cypari/auto_gen.pxi":12879
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = glength(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":12880
 *         cdef long _ret = glength(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lex(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 12880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12844
 *         return new_gen(_ret)
 * 
 *     def length(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Length of :math:`x`; :literal:`\#`:math:`x` is a shortcut for :literal:`length`:math:`(x)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.length", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12882
 *         return _ret
 * 
 *     def lex(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a lexicographic comparison
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_729lex(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_728lex[] = "\n        Gives the result of a lexicographic comparison\n        between :math:`x` and :math:`y` (as :math:`-1`, :math:`0` or :math:`1`). This is to be interpreted in quite\n        a wide sense: It is admissible to compare objects of different types\n        (scalars, vectors, matrices), provided the scalars can be compared, as well\n        as vectors/matrices of different lengths. The comparison is recursive.\n        \n        In case all components are equal up to the smallest length of the operands,\n        the more complex is considered to be larger. More precisely, the longest is\n        the largest; when lengths are equal, we have matrix :math:`>` vector :math:`>` scalar.\n        For example:\n        \n        ::\n        \n            ? lex([1,3], [1,2,5])\n            %1 = 1\n            ? lex([1,3], [1,3,-1])\n            %2 = -1\n            ? lex([1], [[1]])\n            %3 = -1\n            ? lex([1], [1]~)\n            %4 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_729lex(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lex (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_728lex(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_728lex(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lex", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":12906
 *             %4 = 0
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12906, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12907
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12907, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12908
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = lexcmp(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12909
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = lexcmp(_x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12910
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = lexcmp(_x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lexcmp(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":12911
 *         cdef GEN _y = (<Gen>y).g
 *         cdef int _ret = lexcmp(_x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":12912
 *         cdef int _ret = lexcmp(_x, _y)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfun(L, s, long D=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12912, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12882
 *         return _ret
 * 
 *     def lex(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the result of a lexicographic comparison
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12914
 *         return _ret
 * 
 *     def lfun(L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the L-function value :math:`L(s)`, or if :literal:`D` is set, the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_731lfun(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_730lfun[] = "\n        Compute the L-function value :math:`L(s)`, or if :literal:`D` is set, the\n        derivative of order :literal:`D` at :math:`s`. The parameter\n        :literal:`L` is either an Lmath, an Ldata (created by :literal:`lfuncreate`, or an\n        Linit (created by :literal:`lfuninit`), preferrably the latter if many values\n        are to be computed.\n        \n        The argument :math:`s` is also allowed to be a power series; for instance, if :math:`s =\n        \\alpha + x + O(x^n)`, the function returns the Taylor expansion of order :math:`n`\n        around :math:`\\alpha`. The result is given with absolute error less than :math:`2^{-B}`,\n        where :math:`B = realbitprecision`.\n        \n        :strong:`Caveat.` The requested precision has a major impact on runtimes.\n        It is advised to manipulate precision via :literal:`realbitprecision` as\n        explained above instead of :literal:`realprecision` as the latter allows less\n        granularity: :literal:`realprecision` increases by increments of 64 bits, i.e. 19\n        decimal digits at a time.\n        \n        ::\n        \n            ? lfun(x^2+1, 2) \\\\ Lmath: Dedekind zeta for Q(i) at 2\n            %1 = 1.5067030099229850308865650481820713960\n            \n            ? L = lfuncreate(ellinit(\"5077a1\")); \\\\ Ldata: Hasse-Weil zeta function\n            ? lfun(L, 1+x+O(x^4)) \\\\ zero of order 3 at the central point\n            %3 = 0.E-58 - 5.[...] E-40*x + 9.[...] E-40*x^2 + 1.7318[...]*x^3 + O(x^4)\n            \n            \\\\ Linit: zeta(1/2+it), |t| < 100, and derivative\n            ? L = lfuninit(1, [100], 1);\n            ? T = lfunzeros(L, [1,25]);\n            %5 = [14.134725[...], 21.022039[...]]\n            ? z = 1/2 + I*T[1];\n            ? abs( lfun(L, z) )\n            %7 = 8.7066865533412207420780392991125136196 E-39\n            ? abs( lfun(L, z, 1) )\n            %8 = 0.79316043335650611601389756527435211412 \\\\ simple zero\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_731lfun(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_D;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfun (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_D,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfun") < 0)) __PYX_ERR(10, 12914, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12914, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12914, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfun", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12914, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_730lfun(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_s, __pyx_v_D, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_730lfun(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfun", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_gen.pxi":12952
 *             %8 = 0.79316043335650611601389756527435211412 \\ simple zero
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12953
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12953, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12954
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12955
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12956
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":12957
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":12956
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 */
  }

  /* "cypari/auto_gen.pxi":12958
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfun0(__pyx_v__L, __pyx_v__s, __pyx_v_D, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":12959
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfun0(_L, _s, D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunabelianrelinit(bnfL, bnfK, polrel, sdom, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12959, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12914
 *         return _ret
 * 
 *     def lfun(L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the L-function value :math:`L(s)`, or if :literal:`D` is set, the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12961
 *         return new_gen(_ret)
 * 
 *     def lfunabelianrelinit(bnfL, bnfK, polrel, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Linit` structure attached to the Dedekind zeta function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_733lfunabelianrelinit(PyObject *__pyx_v_bnfL, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_732lfunabelianrelinit[] = "\n        Returns the :literal:`Linit` structure attached to the Dedekind zeta function\n        of the number field :math:`L` (see :literal:`lfuninit`), given a subfield :math:`K` such that\n        :math:`L/K` is abelian.\n        Here :literal:`polrel` defines :math:`L` over :math:`K`, as usual with the priority of the\n        variable of :literal:`bnfK` lower than that of :literal:`polrel`.\n        :literal:`sdom` and :literal:`der` are as in :literal:`lfuninit`.\n        \n        ::\n        \n             ? D = -47; K = bnfinit(y^2-D);\n             ? rel = quadhilbert(D); T = rnfequation(K.pol, rel); \\\\ degree 10\n             ? L = lfunabelianrelinit(T,K,rel, [2,0,0]); \\\\ at 2\n             time = 84 ms.\n             ? lfun(L, 2)\n             %4 = 1.0154213394402443929880666894468182650\n             ? lfun(T, 2) \\\\ using parisize > 300MB\n             time = 652 ms.\n             %5 = 1.0154213394402443929880666894468182656\n        \n        As the example shows, using the (abelian) relative structure\n        is more efficient than a direct computation. The difference becomes drastic\n        as the absolute degree increases while the subfield degree remains constant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_733lfunabelianrelinit(PyObject *__pyx_v_bnfL, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bnfK = 0;
  PyObject *__pyx_v_polrel = 0;
  PyObject *__pyx_v_sdom = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunabelianrelinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bnfK,&__pyx_n_s_polrel,&__pyx_n_s_sdom,&__pyx_n_s_der,&__pyx_n_s_precision,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bnfK)) != 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_polrel)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunabelianrelinit", 0, 3, 5, 1); __PYX_ERR(10, 12961, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sdom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunabelianrelinit", 0, 3, 5, 2); __PYX_ERR(10, 12961, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          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_precision);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunabelianrelinit") < 0)) __PYX_ERR(10, 12961, __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);
        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_bnfK = values[0];
    __pyx_v_polrel = values[1];
    __pyx_v_sdom = values[2];
    if (values[3]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12961, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[4]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[4]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12961, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunabelianrelinit", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12961, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunabelianrelinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_732lfunabelianrelinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnfL), __pyx_v_bnfK, __pyx_v_polrel, __pyx_v_sdom, __pyx_v_der, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_732lfunabelianrelinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnfL, PyObject *__pyx_v_bnfK, PyObject *__pyx_v_polrel, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision) {
  GEN __pyx_v__bnfL;
  GEN __pyx_v__bnfK;
  GEN __pyx_v__polrel;
  GEN __pyx_v__sdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunabelianrelinit", 0);
  __Pyx_INCREF(__pyx_v_bnfK);
  __Pyx_INCREF(__pyx_v_polrel);
  __Pyx_INCREF(__pyx_v_sdom);

  /* "cypari/auto_gen.pxi":12986
 *         as the absolute degree increases while the subfield degree remains constant.
 *         '''
 *         bnfK = objtogen(bnfK)             # <<<<<<<<<<<<<<
 *         polrel = objtogen(polrel)
 *         sdom = objtogen(sdom)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bnfK, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bnfK, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12987
 *         '''
 *         bnfK = objtogen(bnfK)
 *         polrel = objtogen(polrel)             # <<<<<<<<<<<<<<
 *         sdom = objtogen(sdom)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_polrel, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_polrel, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12988
 *         bnfK = objtogen(bnfK)
 *         polrel = objtogen(polrel)
 *         sdom = objtogen(sdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sdom, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sdom, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":12989
 *         polrel = objtogen(polrel)
 *         sdom = objtogen(sdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 12989, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":12990
 *         sdom = objtogen(sdom)
 *         sig_on()
 *         cdef GEN _bnfL = (<Gen>bnfL).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnfL)->__pyx_base.g;
  __pyx_v__bnfL = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12991
 *         sig_on()
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 *         cdef GEN _bnfK = (<Gen>bnfK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnfK)->__pyx_base.g;
  __pyx_v__bnfK = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12992
 *         cdef GEN _bnfL = (<Gen>bnfL).g
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 *         cdef GEN _polrel = (<Gen>polrel).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_polrel)->__pyx_base.g;
  __pyx_v__polrel = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12993
 *         cdef GEN _bnfK = (<Gen>bnfK).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sdom)->__pyx_base.g;
  __pyx_v__sdom = __pyx_t_3;

  /* "cypari/auto_gen.pxi":12994
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":12995
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":12994
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 */
  }

  /* "cypari/auto_gen.pxi":12996
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunabelianrelinit(__pyx_v__bnfL, __pyx_v__bnfK, __pyx_v__polrel, __pyx_v__sdom, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":12997
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunabelianrelinit(_bnfL, _bnfK, _polrel, _sdom, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunan(L, long n, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 12997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12961
 *         return new_gen(_ret)
 * 
 *     def lfunabelianrelinit(bnfL, bnfK, polrel, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Linit` structure attached to the Dedekind zeta function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunabelianrelinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bnfK);
  __Pyx_XDECREF(__pyx_v_polrel);
  __Pyx_XDECREF(__pyx_v_sdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":12999
 *         return new_gen(_ret)
 * 
 *     def lfunan(L, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the first :math:`n` terms of the Dirichlet series attached to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_735lfunan(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_734lfunan[] = "\n        Compute the first :math:`n` terms of the Dirichlet series attached to the\n        :math:`L`-function given by :literal:`L` (:literal:`Lmath`, :literal:`Ldata` or :literal:`Linit`).\n        \n        ::\n        \n             ? lfunan(1, 10) \\\\ Riemann zeta\n             %1 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n             ? lfunan(5, 10) \\\\ Dirichlet L-function for kronecker(5,.)\n             %2 = [1, -1, -1, 1, 0, 1, -1, -1, 1, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_735lfunan(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_precision,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunan") < 0)) __PYX_ERR(10, 12999, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12999, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 12999, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunan", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 12999, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_734lfunan(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_n, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_734lfunan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_n, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lfunan", 0);

  /* "cypari/auto_gen.pxi":13011
 *              %2 = [1, -1, -1, 1, 0, 1, -1, -1, 1, 0]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13011, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13012
 *         '''
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunan(_L, n, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13013
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunan(_L, n, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":13014
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunan(_L, n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunan(__pyx_v__L, __pyx_v_n, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13015
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunan(_L, n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunartin(nf, gal, rho, long n, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 13015, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":12999
 *         return new_gen(_ret)
 * 
 *     def lfunan(L, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the first :math:`n` terms of the Dirichlet series attached to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13017
 *         return new_gen(_ret)
 * 
 *     def lfunartin(nf, gal, rho, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_737lfunartin(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_736lfunartin[] = "\n        Returns the :literal:`Ldata` structure attached to the\n        Artin :math:`L`-function provided by the representation :math:`\\rho` of the Galois group\n        of the extension :math:`K/\\mathbb{Q}`, defined over the cyclotomic field :math:`\\mathbb{Q} (\\zeta_n)`,\n        where :emphasis:`nf` is the nfinit structure attached to :math:`K`,\n        :emphasis:`gal` is the galoisinit structure attached to :math:`K/\\mathbb{Q}`, and :emphasis:`rho` is\n        given either\n        \n        - by the values of its character on the conjugacy classes\n          (see :literal:`galoisconjclasses` and :literal:`galoischartable`)\n        \n        - or by the matrices that are the images of the generators\n          :literal:`:emphasis:`gal`.gen`.\n        \n        Cyclotomic numbers in :literal:`rho` are represented by polynomials, whose\n        variable is understood as the complex number :math:`\\exp (2 i \\pi/n)`.\n        \n        In the following example we build the Artin :math:`L`-functions attached to the two\n        irreducible degree :math:`2` representations of the dihedral group :math:`D_{10}` defined\n        over :math:`\\mathbb{Q} (\\zeta_5)`, for the extension :math:`H/\\mathbb{Q}` where :math:`H` is the Hilbert class\n        field of :math:`\\mathbb{Q} (\\sqrt{-47})`.\n        We show numerically some identities involving Dedekind :math:`\\zeta` functions and\n        Hecke :math:`L` series.\n        \n        ::\n        \n            ? P = quadhilbert(-47)\n            %1 = x^5 + 2*x^4 + 2*x^3 + x^2 - 1\n            ? N = nfinit(nfsplitting(P));\n            ? G = galoisinit(N); \\\\ D_10\n            ? [T,n] = galoischartable(G);\n            ? T \\\\ columns give the irreducible characters\n            %5 =\n            [1 1 2 2]\n            \n            [1 -1 0 0]\n            \n            [1 1 -y^3 - y^2 - 1 y^3 + y^2]\n            \n            [1 1 y^3 + y^2 -y^3 - y^2 - 1]\n            ? n\n            %6 = 5\n            ? L""2 = lfunartin(N,G, T[,2], n);\n            ? L3 = lfunartin(N,G, T[,3], n);\n            ? L4 = lfunartin(N,G, T[,4], n);\n            ? s = 1 + x + O(x^4);\n            ? lfun(-47,s) - lfun(L2,s)\n            %11 ~ 0\n            ? lfun(1,s)*lfun(-47,s)*lfun(L3,s)^2*lfun(L4,s)^2 - lfun(N,s)\n            %12 ~ 0\n            ? lfun(1,s)*lfun(L3,s)*lfun(L4,s) - lfun(P,s)\n            %13 ~ 0\n            ? bnr = bnrinit(bnfinit(x^2+47),1,1);\n            ? bnr.cyc\n            %15 = [5] \\\\ Z/5Z: 4 non-trivial ray class characters\n            ? lfun([bnr,[1]], s) - lfun(L3, s)\n            %16 ~ 0\n            ? lfun([bnr,[2]], s) - lfun(L4, s)\n            %17 ~ 0\n            ? lfun([bnr,[3]], s) - lfun(L3, s)\n            %18 ~ 0\n            ? lfun([bnr,[4]], s) - lfun(L4, s)\n            %19 ~ 0\n        \n        The first identity identifies the non-trivial abelian character with\n        :math:`(-47,.)`; the second is the factorization of the regular representation of\n        :math:`D_{10}`; the third is the factorization of the natural representation of\n        :math:`D_{10}\\subset S_5`; and the final four are the expressions of the degree :math:`2`\n        representations as induced from degree :math:`1` representations.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_737lfunartin(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gal = 0;
  PyObject *__pyx_v_rho = 0;
  long __pyx_v_n;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunartin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gal,&__pyx_n_s_rho,&__pyx_n_s_n,&__pyx_n_s_precision,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_gal)) != 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_rho)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunartin", 0, 3, 4, 1); __PYX_ERR(10, 13017, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lfunartin", 0, 3, 4, 2); __PYX_ERR(10, 13017, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunartin") < 0)) __PYX_ERR(10, 13017, __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_gal = values[0];
    __pyx_v_rho = values[1];
    __pyx_v_n = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13017, __pyx_L3_error)
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13017, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunartin", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13017, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunartin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_736lfunartin(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_gal, __pyx_v_rho, __pyx_v_n, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_736lfunartin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_gal, PyObject *__pyx_v_rho, long __pyx_v_n, long __pyx_v_precision) {
  GEN __pyx_v__nf;
  GEN __pyx_v__gal;
  GEN __pyx_v__rho;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunartin", 0);
  __Pyx_INCREF(__pyx_v_gal);
  __Pyx_INCREF(__pyx_v_rho);

  /* "cypari/auto_gen.pxi":13088
 *         representations as induced from degree :math:`1` representations.
 *         '''
 *         gal = objtogen(gal)             # <<<<<<<<<<<<<<
 *         rho = objtogen(rho)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gal, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_gal, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13089
 *         '''
 *         gal = objtogen(gal)
 *         rho = objtogen(rho)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_rho, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_rho, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13090
 *         gal = objtogen(gal)
 *         rho = objtogen(rho)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13090, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13091
 *         rho = objtogen(rho)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13092
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g             # <<<<<<<<<<<<<<
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gal)->__pyx_base.g;
  __pyx_v__gal = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13093
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rho)->__pyx_base.g;
  __pyx_v__rho = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13094
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13095
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13094
 *         cdef GEN _gal = (<Gen>gal).g
 *         cdef GEN _rho = (<Gen>rho).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13096
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunartin(__pyx_v__nf, __pyx_v__gal, __pyx_v__rho, __pyx_v_n, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13097
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunartin(_nf, _gal, _rho, n, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuncheckfeq(L, t=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13097, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13017
 *         return new_gen(_ret)
 * 
 *     def lfunartin(nf, gal, rho, long n, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunartin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gal);
  __Pyx_XDECREF(__pyx_v_rho);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13099
 *         return new_gen(_ret)
 * 
 *     def lfuncheckfeq(L, t=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the data attached to an :math:`L`-function (:literal:`Lmath`, :literal:`Ldata`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_739lfuncheckfeq(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_738lfuncheckfeq[] = "\n        Given the data attached to an :math:`L`-function (:literal:`Lmath`, :literal:`Ldata`\n        or :literal:`Linit`), check whether the functional equation is satisfied.\n        This is most useful for an :literal:`Ldata` constructed \"by hand\", via\n        :literal:`lfuncreate`, to detect mistakes.\n        \n        If the function has poles, the polar part must be specified. The routine\n        returns a bit accuracy :math:`b` such that :math:`\\|w - ^{w}\\| < 2^{b}`, where :math:`w` is\n        the root number contained in :literal:`data`, and\n        \n        .. MATH::\n        \n            ^{w} = \\theta (1/t) t^{-k} / \\overline{\\theta}(t)\n        \n        is a computed value\n        derived from the assumed functional equation. If the parameter :math:`t` is\n        omitted, we try random samples on the real line in the segment\n        :math:`[1, 1.25]`. Of course, a large negative value of the order of\n        :literal:`realbitprecision` is expected but if :math:`\\overline{\\theta}` is very small\n        all over the sampled segment, you should first increase\n        :literal:`realbitprecision` by :math:`-\\log_2 \\|\\overline{\\theta}(t)\\|` (which is\n        positive if :math:`\\theta` is small) to get a meaningful result.\n        \n        If :math:`t` is given, it should be close to the unit disc for efficiency and\n        such that :math:`\\overline{\\theta}(t) != 0`. We then check the functional\n        equation at that :math:`t`. Again, if :math:`\\overline{\\theta}(t)` is very small, you\n        should first increase :literal:`realbitprecision` to get a useful result.\n        \n        ::\n        \n            ? \\pb 128 \\\\ 128 bits of accuracy\n            ? default(realbitprecision)\n            %1 = 128\n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? lfuncheckfeq(L)\n            %3 = -124\n        \n        i.e. the given data is consistent to within 4 bits for the\n        particular check cons""isting of estimating the root number from all other\n        given quantities. Checking away from the unit disc will either fail with\n        a precision error, or give disappointing results (if :math:`\\theta (1/t)` is\n        large it will be computed with a large absolute error)\n        \n        ::\n        \n            ? lfuncheckfeq(L, 2+I)\n            %4 = -115\n            ? lfuncheckfeq(L,10)\n             *** at top-level: lfuncheckfeq(L,10)\n             *** ^------------------\n             *** lfuncheckfeq: precision too low in lfuncheckfeq.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_739lfuncheckfeq(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuncheckfeq (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuncheckfeq") < 0)) __PYX_ERR(10, 13099, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_t = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13099, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuncheckfeq", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13099, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuncheckfeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_738lfuncheckfeq(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_t, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_738lfuncheckfeq(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision) {
  int __pyx_v__have_t;
  GEN __pyx_v__L;
  GEN __pyx_v__t;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuncheckfeq", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_gen.pxi":13152
 *              *** lfuncheckfeq: precision too low in lfuncheckfeq.
 *         '''
 *         cdef bint _have_t = (t is not None)             # <<<<<<<<<<<<<<
 *         if _have_t:
 *             t = objtogen(t)
 */
  __pyx_t_1 = (__pyx_v_t != Py_None);
  __pyx_v__have_t = __pyx_t_1;

  /* "cypari/auto_gen.pxi":13153
 *         '''
 *         cdef bint _have_t = (t is not None)
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             t = objtogen(t)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_t != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13154
 *         cdef bint _have_t = (t is not None)
 *         if _have_t:
 *             t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":13153
 *         '''
 *         cdef bint _have_t = (t is not None)
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             t = objtogen(t)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":13155
 *         if _have_t:
 *             t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 13155, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13156
 *             t = objtogen(t)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = NULL
 *         if _have_t:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_gen.pxi":13157
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL             # <<<<<<<<<<<<<<
 *         if _have_t:
 *             _t = (<Gen>t).g
 */
  __pyx_v__t = NULL;

  /* "cypari/auto_gen.pxi":13158
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_t != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13159
 *         cdef GEN _t = NULL
 *         if _have_t:
 *             _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
    __pyx_v__t = __pyx_t_4;

    /* "cypari/auto_gen.pxi":13158
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = NULL
 *         if _have_t:             # <<<<<<<<<<<<<<
 *             _t = (<Gen>t).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":13160
 *         if _have_t:
 *             _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13161
 *             _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 *         clear_stack()
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13160
 *         if _have_t:
 *             _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13162
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lfuncheckfeq(__pyx_v__L, __pyx_v__t, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13163
 *             precision = default_bitprec()
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":13164
 *         cdef long _ret = lfuncheckfeq(_L, _t, precision)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfunconductor(L, ab=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13099
 *         return new_gen(_ret)
 * 
 *     def lfuncheckfeq(L, t=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the data attached to an :math:`L`-function (:literal:`Lmath`, :literal:`Ldata`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuncheckfeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13166
 *         return _ret
 * 
 *     def lfunconductor(L, ab=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the conductor of the given :math:`L`-function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_741lfunconductor(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_740lfunconductor[] = "\n        Compute the conductor of the given :math:`L`-function\n        (if the structure contains a conductor, it is ignored);\n        :math:`ab = [a,b]` is the interval where we expect to find the conductor;\n        it may be given as a single scalar :math:`b`, in which case we look in :math:`[1,b]`.\n        Increasing :literal:`ab` slows down the program but gives better accuracy for the\n        result.\n        \n        If :literal:`flag` is :math:`0` (default), give either the conductor found as an\n        integer, or a vector (possibly empty) of conductors found. If :literal:`flag` is\n        :math:`1`, same but give the computed floating point approximations to the\n        conductors found, without rounding to integers. It :literal:`flag` is :math:`2`, give\n        all the conductors found, even those far from integers.\n        \n        :strong:`Caveat.` This is a heuristic program and the result is not\n        proven in any way:\n        \n        ::\n        \n             ? L = lfuncreate(857); \\\\ Dirichlet L function for kronecker(857,.)\n             ? \\p19\n             realprecision = 19 significant digits\n             ? lfunconductor(L)\n             %2 = [17, 857]\n             ? lfunconductor(L,,1) \\\\ don't round\n             %3 = [16.99999999999999999, 857.0000000000000000]\n            \n             ? \\p38\n             realprecision = 38 significant digits\n             ? lfunconductor(L)\n             %4 = 857\n        \n        :strong:`Note.` This program should only be used if the primes dividing the\n        conductor are unknown, which is rare. If they are known, a direct\n        search through possible prime exponents using :literal:`lfuncheckfeq` will\n        be more efficient and rigorous:\n        \n        ::\n        \n             ? E = ellinit([0,0,0,4,0]); /* Elliptic curve y^2 = x^3+4x */\n             ? E.disc \\\\ |disc E| = 2^12\n             %2 = -4096\n             \\\\ create Ldata by hand. Guess that"" root number is 1 and conductor N\n             ? L(N) = lfuncreate([n->ellan(E,n), 0, [0,1], 2, N, 1]);\n             ? fordiv(E.disc, d, print(d,\": \",lfuncheckfeq(L(d))))\n             1: 0\n             2: 0\n             4: -1\n             8: -2\n             16: -3\n             32: -127\n             64: -3\n             128: -2\n             256: -2\n             512: -1\n             1024: -1\n             2048: 0\n             4096: 0\n             ? lfunconductor(L(1)) \\\\ lfunconductor ignores conductor = 1 in Ldata !\n             %5 = 32\n        \n        The above code assumed that root number was :math:`1`;\n        had we set it to :math:`-1`, none of the :literal:`lfuncheckfeq` values would have been\n        acceptable:\n        \n        ::\n        \n             ? L2(N) = lfuncreate([n->ellan(E,n), 0, [0,1], 2, N, -1]);\n             ? [ lfuncheckfeq(L2(d)) | d<-divisors(E.disc) ]\n             %7 = [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_741lfunconductor(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ab = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunconductor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ab,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ab);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunconductor") < 0)) __PYX_ERR(10, 13166, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ab = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13166, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13166, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunconductor", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_740lfunconductor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_ab, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_740lfunconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_ab, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_ab;
  GEN __pyx_v__L;
  GEN __pyx_v__ab;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunconductor", 0);
  __Pyx_INCREF(__pyx_v_ab);

  /* "cypari/auto_gen.pxi":13238
 *              %7 = [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, -1, -1]
 *         '''
 *         cdef bint _have_ab = (ab is not None)             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             ab = objtogen(ab)
 */
  __pyx_t_1 = (__pyx_v_ab != Py_None);
  __pyx_v__have_ab = __pyx_t_1;

  /* "cypari/auto_gen.pxi":13239
 *         '''
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_ab != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13240
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 *             ab = objtogen(ab)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ab, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13240, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_ab, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":13239
 *         '''
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":13241
 *         if _have_ab:
 *             ab = objtogen(ab)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 13241, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13242
 *             ab = objtogen(ab)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_gen.pxi":13243
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 */
  __pyx_v__ab = NULL;

  /* "cypari/auto_gen.pxi":13244
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_ab != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13245
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 *             _ab = (<Gen>ab).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ab)->__pyx_base.g;
    __pyx_v__ab = __pyx_t_4;

    /* "cypari/auto_gen.pxi":13244
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":13246
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13247
 *             _ab = (<Gen>ab).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13246
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13248
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunconductor(__pyx_v__L, __pyx_v__ab, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13249
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunconductor(_L, _ab, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuncost(L, sdom=None, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13166
 *         return _ret
 * 
 *     def lfunconductor(L, ab=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the conductor of the given :math:`L`-function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ab);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13251
 *         return new_gen(_ret)
 * 
 *     def lfuncost(L, sdom=None, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Estimate the cost of running
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_743lfuncost(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_742lfuncost[] = "\n        Estimate the cost of running\n        :literal:`lfuninit(L,sdom,der)` at current bit precision. Returns :math:`[t,b]`, to\n        indicate that :math:`t` coefficients :math:`a_n` will be computed, as well as :math:`t` values of\n        :literal:`gammamellininv`, all at bit accuracy :math:`b`.\n        A subsequent call to :literal:`lfun` at :math:`s` evaluates a polynomial of degree :math:`t`\n        at :math:`\\exp (h s)` for some real parameter :math:`h`, at the same bit accuracy :math:`b`.\n        If :math:`L` is already an :literal:`Linit`, then :emphasis:`sdom` and :emphasis:`der` are ignored\n        and are best left omitted; the bit accuracy is also inferred from :math:`L`: in\n        short we get an estimate of the cost of using that particular :literal:`Linit`.\n        \n        ::\n        \n            ? \\pb 128\n            ? lfuncost(1, [100]) \\\\ for zeta(1/2+I*t), |t| < 100\n            %1 = [7, 242] \\\\ 7 coefficients, 242 bits\n            ? lfuncost(1, [1/2, 100]) \\\\ for zeta(s) in the critical strip, |Im s| < 100\n            %2 = [7, 246] \\\\ now 246 bits\n            ? lfuncost(1, [100], 10) \\\\ for zeta(1/2+I*t), |t| < 100\n            %3 = [8, 263] \\\\ 10th derivative increases the cost by a small amount\n            ? lfuncost(1, [10^5])\n            %3 = [158, 113438] \\\\ larger imaginary part: huge accuracy increase\n            \n            ? L = lfuncreate(polcyclo(5)); \\\\ Dedekind zeta for Q(zeta_5)\n            ? lfuncost(L, [100]) \\\\ at s = 1/2+I*t), |t| < 100\n            %5 = [11457, 582]\n            ? lfuncost(L, [200]) \\\\ twice higher\n            %6 = [36294, 1035]\n            ? lfuncost(L, [10^4]) \\\\ much higher: very costly !\n            %7 = [70256473, 45452]\n            ? \\pb 256\n            ? lfuncost(L, [100]); \\\\ doubling bit accuracy\n            %8 = [17080, 710]\n        \n        In fact, some :math:`L` functions can be factorized algebraically\n        by the :literal:`lfunini""t` call, e.g. the Dedekind zeta function of abelian\n        fields, leading to much faster evaluations than the above upper bounds.\n        In that case, the function returns a vector of costs as above for each\n        individual function in the product actually evaluated:\n        \n        ::\n        \n            ? L = lfuncreate(polcyclo(5)); \\\\ Dedekind zeta for Q(zeta_5)\n            ? lfuncost(L, [100]) \\\\ a priori cost\n            %2 = [11457, 582]\n            ? L = lfuninit(L, [100]); \\\\ actually perform all initializations\n            ? lfuncost(L)\n            %4 = [[16, 242], [16, 242], [7, 242]]\n        \n        The Dedekind function of this abelian quartic field\n        is the product of four Dirichlet :math:`L`-functions attached to the trivial\n        character, a non-trivial real character and two complex conjugate\n        characters. The non-trivial characters happen to have the same conductor\n        (hence same evaluation costs), and correspond to two evaluations only\n        since the two conjugate characters are evaluated simultaneously.\n        For a total of three :math:`L`-functions evaluations, which explains the three\n        components above. Note that the actual cost is much lower than the a priori\n        cost in this case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_743lfuncost(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sdom = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuncost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sdom,&__pyx_n_s_der,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sdom);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuncost") < 0)) __PYX_ERR(10, 13251, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sdom = values[0];
    if (values[1]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13251, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13251, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuncost", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13251, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuncost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_742lfuncost(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_sdom, __pyx_v_der, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_742lfuncost(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision) {
  int __pyx_v__have_sdom;
  GEN __pyx_v__L;
  GEN __pyx_v__sdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuncost", 0);
  __Pyx_INCREF(__pyx_v_sdom);

  /* "cypari/auto_gen.pxi":13311
 *         cost in this case.
 *         '''
 *         cdef bint _have_sdom = (sdom is not None)             # <<<<<<<<<<<<<<
 *         if _have_sdom:
 *             sdom = objtogen(sdom)
 */
  __pyx_t_1 = (__pyx_v_sdom != Py_None);
  __pyx_v__have_sdom = __pyx_t_1;

  /* "cypari/auto_gen.pxi":13312
 *         '''
 *         cdef bint _have_sdom = (sdom is not None)
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             sdom = objtogen(sdom)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_sdom != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13313
 *         cdef bint _have_sdom = (sdom is not None)
 *         if _have_sdom:
 *             sdom = objtogen(sdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sdom, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_sdom, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":13312
 *         '''
 *         cdef bint _have_sdom = (sdom is not None)
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             sdom = objtogen(sdom)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":13314
 *         if _have_sdom:
 *             sdom = objtogen(sdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 13314, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13315
 *             sdom = objtogen(sdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_gen.pxi":13316
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL             # <<<<<<<<<<<<<<
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g
 */
  __pyx_v__sdom = NULL;

  /* "cypari/auto_gen.pxi":13317
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_sdom != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13318
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sdom)->__pyx_base.g;
    __pyx_v__sdom = __pyx_t_4;

    /* "cypari/auto_gen.pxi":13317
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = NULL
 *         if _have_sdom:             # <<<<<<<<<<<<<<
 *             _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":13319
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13320
 *             _sdom = (<Gen>sdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13319
 *         if _have_sdom:
 *             _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13321
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuncost0(__pyx_v__L, __pyx_v__sdom, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13322
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuncost0(_L, _sdom, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuncreate(obj):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13251
 *         return new_gen(_ret)
 * 
 *     def lfuncost(L, sdom=None, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Estimate the cost of running
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuncost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13324
 *         return new_gen(_ret)
 * 
 *     def lfuncreate(obj):             # <<<<<<<<<<<<<<
 *         r'''
 *         This low-level routine creates :literal:`Ldata` structures, needed by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_745lfuncreate(PyObject *__pyx_v_obj, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_744lfuncreate[] = "\n        This low-level routine creates :literal:`Ldata` structures, needed by\n        :emphasis:`lfun` functions, describing an :math:`L`-function and its functional equation.\n        You are urged to use a high-level constructor when one is available,\n        and this function accepts them, see :literal:`\077\077lfun`:\n        \n        ::\n        \n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? L = lfuncreate(5); \\\\ Dirichlet L-function for quadratic character (5/.)\n            ? L = lfuncreate(x^2+1); \\\\ Dedekind zeta for Q(i)\n            ? L = lfuncreate(ellinit([0,1])); \\\\ L-function of E/Q: y^2=x^3+1\n        \n        One can then use, e.g., :literal:`Lfun(L,s)` to directly\n        evaluate the respective :math:`L`-functions at :math:`s`, or :literal:`lfuninit(L, [c,w,h]`\n        to initialize computations in the rectangular box :math:`\\Re (s-c) <= w`,\n        :math:`\\Im (s) <= h`.\n        \n        We now describe the low-level interface, used to input non-builtin\n        :math:`L`-functions. The input is now a :math:`6` or :math:`7` component vector\n        :math:`V = [a, astar, Vga, k, N, eps, poles]`, whose components are as follows:\n        \n        - :literal:`V[1] = a` encodes the Dirichlet series coefficients :math:`(a_n)`. The\n          preferred format is a closure of arity 1: :literal:`n- > vector(n,i,a(i))` giving\n          the vector of the first :math:`n` coefficients. The closure is allowed to return\n          a vector of more than :math:`n` coefficients (only the first :math:`n` will be\n          considered) or even less than :math:`n`, in which case loss of accuracy will occur\n          and a warning that :literal:`\\#an` is less than expected is issued. This\n          allows to precompute and store a fixed large number of Dirichlet\n          coefficients in a vector :math:`v` and use the closure :literal:`n- > v`, which\n          does not depend on :math:`n`. As a shorthand for this latter ""case, you can input\n          the vector :math:`v` itself instead of the closure.\n        \n        ::\n        \n            ? z = lfuncreate([n->vector(n,i,1), 1, [0], 1, 1, 1, 1]); \\\\ Riemann zeta\n            ? lfun(z,2) - Pi^2/6\n            %2 = -5.877471754111437540 E-39\n        \n        A second format is limited to :math:`L`-functions affording an\n        Euler product. It is a closure of arity 2 :literal:`(p,d)- > F(p)` giving the\n        local factor :math:`L_p(X)` at :math:`p` as a rational function, to be evaluated at\n        :math:`p^{-s}` as in :literal:`direuler`; :math:`d` is set to :literal:`logint`:math:`(n,p)` + 1, where\n        :math:`n` is the total number of Dirichlet coefficients :math:`(a_1,...,a_n)` that will\n        be computed. In other words, the smallest integer :math:`d` such that :math:`p^d > n`.\n        This parameter :math:`d` allows to compute only part of\n        :math:`L_p` when :math:`p` is large and :math:`L_p` expensive to compute: any polynomial\n        (or :literal:`t_SER`) congruent to :math:`L_p` modulo :math:`X^d` is acceptable since only\n        the coefficients of :math:`X^0,..., X^{d-1}` are needed to expand the Dirichlet\n        series. The closure can of course ignore this parameter:\n        \n        ::\n        \n            ? z = lfuncreate([(p,d)->1/(1-x), 1, [0], 1, 1, 1, 1]); \\\\ Riemann zeta\n            ? lfun(z,2) - Pi^2/6\n            %4 = -5.877471754111437540 E-39\n        \n        One can describe separately the generic local factors coefficients\n        and the bad local factors by setting :math:`dir = [F, L_{bad}]`,\n        were :math:`L_{bad} = [[p_1,L_{p_1}],...,[p_k,L_{p_k}]]`, where :math:`F`\n        describes the generic local factors as above, except that when :math:`p = p_i`\n        for some :math:`i <= k`, the coefficient :math:`a_p` is directly set to :math:`L_{p_i}`\n        instead of calling :math:`F`.\n        \n        ::\n        \n            N = 15;\n            ""E = ellinit([1, 1, 1, -10, -10]); \\\\ = \"15a1\"\n            F(p,d) = 1 / (1 - ellap(E,p)*'x + p*'x^2);\n            Lbad = [[3, 1/(1+'x)], [5, 1/(1-'x)]];\n            L = lfuncreate([[F,Lbad], 0, [0,1], 2, N, ellrootno(E)]);\n        \n        Of course, in this case, :literal:`lfuncreate(E)` is preferable!\n        \n        - :literal:`V[2] = astar` is the Dirichlet series coefficients of the dual\n          function, encoded as :literal:`a` above. The sentinel values :math:`0` and :math:`1` may\n          be used for the special cases where :math:`a = a^*` and :math:`a = \\overline{a^*}`,\n          respectively.\n        \n        - :literal:`V[3] = Vga` is the vector of :math:`\\alpha_j` such that the gamma\n          factor of the :math:`L`-function is equal to\n          \n        \n        .. MATH::\n        \n            \\gamma_A(s) = \\prod_{1 <= j <= d}\\Gamma_{\\mathbb{R}}(s+\\alpha_j),\n        \n          where :math:`\\Gamma_{\\mathbb{R}}(s) = \\pi^{-s/2}\\Gamma (s/2)`.\n          This same syntax is used in the :literal:`gammamellininv` functions.\n          In particular the length :math:`d` of :literal:`Vga` is the degree of the :math:`L`-function.\n          In the present implementation, the :math:`\\alpha_j` are assumed to be exact\n          rational numbers. However when calling theta functions with :emphasis:`complex`\n          (as opposed to real) arguments, determination problems occur which may\n          give wrong results when the :math:`\\alpha_j` are not integral.\n        \n        - :literal:`V[4] = k` is a positive integer :math:`k`. The functional equation relates\n          values at :math:`s` and :math:`k-s`. For instance, for an Artin :math:`L`-series such as a\n          Dedekind zeta function we have :math:`k = 1`, for an elliptic curve :math:`k = 2`, and\n          for a modular form, :math:`k` is its weight. For motivic :math:`L`-functions, the\n          :emphasis:`motivic` weight :math:`w` is :math:`w = k-1`.\n      ""  \n        By default we assume that :math:`a_n = O_\\epsilon (n^{k_1+\\epsilon})`, where\n        :math:`k_1 = w` and even :math:`k_1 = w/2` when the :math:`L` function has no pole\n        (Ramanujan-Petersson). If this is not the case, you can replace the\n        :math:`k` argument by a vector :math:`[k,k_1]`, where :math:`k_1` is the upper bound you can\n        assume.\n        \n        - :literal:`V[5] = N` is the conductor, an integer :math:`N >= 1`, such that\n          :math:`\\Lambda (s) = N^{s/2}\\gamma_A(s)L(s)` with :math:`\\gamma_A(s)` as above.\n        \n        - :literal:`V[6] = eps` is the root number :math:`\\varepsilon`, i.e., the\n          complex number (usually of modulus :math:`1`) such that\n          :math:`\\Lambda (a, k-s) = \\varepsilon \\Lambda (a^*, s)`.\n        \n        - The last optional component :literal:`V[7] = poles` encodes the poles of the\n          :math:`L` or :math:`\\Lambda`-functions, and is omitted if they have no poles.\n          A polar part is given by a list of :math:`2`-component vectors\n          :math:`[\\beta,P_{\\beta}(x)]`, where\n          :math:`\\beta` is a pole and the power series :math:`P_{\\beta}(x)` describes\n          the attached polar part, such that :math:`L(s) - P_\\beta (s-\\beta)` is holomorphic\n          in a neighbourhood of :math:`\\beta`. For instance :math:`P_\\beta = r/x+O(1)` for a\n          simple pole at :math:`\\beta` or :math:`r_1/x^2+r_2/x+O(1)` for a double pole.\n          The type of the list describing the polar part allows to distinguish between\n          :math:`L` and :math:`\\Lambda`: a :literal:`t_VEC` is attached to :math:`L`, and a :literal:`t_COL`\n          is attached to :math:`\\Lambda`. Unless :math:`a = \\overline{a^*}` (coded by :literal:`astar`\n          equal to :math:`0` or :math:`1`), it is mandatory to specify the polar part of :math:`\\Lambda`\n          rather than those of :math:`L` since the poles of :math:`L^*` cannot be infered from the\n    ""      latter ! Whereas the functional equation allows to deduce the polar part of\n          :math:`\\Lambda^*` from the polar part of :math:`\\Lambda`.\n        \n        Finally, if :math:`a = \\overline{a^*}`, we allow a shortcut to describe\n        the frequent situation where :math:`L` has at most simple pole, at :math:`s = k`,\n        with residue :math:`r` a complex scalar: you may then input :math:`poles = r`.\n        This value :math:`r` can be set to :math:`0` if unknown and it will be computed.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_745lfuncreate(PyObject *__pyx_v_obj, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuncreate (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_744lfuncreate(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_obj));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_744lfuncreate(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_obj) {
  GEN __pyx_v__obj;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lfuncreate", 0);

  /* "cypari/auto_gen.pxi":13460
 *         This value :math:`r` can be set to :math:`0` if unknown and it will be computed.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _obj = (<Gen>obj).g
 *         cdef GEN _ret = lfuncreate(_obj)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13460, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13461
 *         '''
 *         sig_on()
 *         cdef GEN _obj = (<Gen>obj).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuncreate(_obj)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_obj)->__pyx_base.g;
  __pyx_v__obj = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13462
 *         sig_on()
 *         cdef GEN _obj = (<Gen>obj).g
 *         cdef GEN _ret = lfuncreate(_obj)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuncreate(__pyx_v__obj);

  /* "cypari/auto_gen.pxi":13463
 *         cdef GEN _obj = (<Gen>obj).g
 *         cdef GEN _ret = lfuncreate(_obj)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfundiv(L1, L2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 13463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13324
 *         return new_gen(_ret)
 * 
 *     def lfuncreate(obj):             # <<<<<<<<<<<<<<
 *         r'''
 *         This low-level routine creates :literal:`Ldata` structures, needed by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuncreate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13465
 *         return new_gen(_ret)
 * 
 *     def lfundiv(L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_747lfundiv(PyObject *__pyx_v_L1, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_746lfundiv[] = "\n        Creates the :literal:`Ldata` structure (without initialization) corresponding\n        to the quotient of the Dirichlet series :math:`L_1` and :math:`L_2` given by\n        :literal:`L1` and :literal:`L2`. Assume that :math:`v_z(L_1) >= v_z(L_2)` at all\n        complex numbers :math:`z`: the construction may not create new poles, nor increase\n        the order of existing ones.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_747lfundiv(PyObject *__pyx_v_L1, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L2 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfundiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L2,&__pyx_n_s_precision,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_L2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfundiv") < 0)) __PYX_ERR(10, 13465, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L2 = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13465, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfundiv", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13465, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfundiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_746lfundiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L1), __pyx_v_L2, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_746lfundiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision) {
  GEN __pyx_v__L1;
  GEN __pyx_v__L2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfundiv", 0);
  __Pyx_INCREF(__pyx_v_L2);

  /* "cypari/auto_gen.pxi":13473
 *         the order of existing ones.
 *         '''
 *         L2 = objtogen(L2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13474
 *         '''
 *         L2 = objtogen(L2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13474, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13475
 *         L2 = objtogen(L2)
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L1)->__pyx_base.g;
  __pyx_v__L1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13476
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L2)->__pyx_base.g;
  __pyx_v__L2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13477
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13478
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13477
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13479
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfundiv(__pyx_v__L1, __pyx_v__L2, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13480
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfundiv(_L1, _L2, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunetaquo(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13465
 *         return new_gen(_ret)
 * 
 *     def lfundiv(L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfundiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13482
 *         return new_gen(_ret)
 * 
 *     def lfunetaquo(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_749lfunetaquo(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_748lfunetaquo[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`L` function\n        attached to the modular form\n        :math:`z:--->\\prod_{i = 1}^n \\eta (M_{i,1} z)^{M_{i,2}}`\n        It is currently assumed that :math:`f` is a self-dual cuspidal form on\n        :math:`\\Gamma_0(N)` for some :math:`N`.\n        For instance, the :math:`L`-function :math:`\\sum \\tau (n) n^{-s}`\n        attached to Ramanujan's :math:`\\Delta` function is encoded as follows\n        \n        ::\n        \n            ? L = lfunetaquo(Mat([1,24]));\n            ? lfunan(L, 100) \\\\ first 100 values of tau(n)\n        \n        For convenience, a :literal:`t_VEC` is also accepted instead of\n        a factorization matrix with a single row:\n        \n        ::\n        \n            ? L = lfunetaquo([1,24]); \\\\ same as above\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_749lfunetaquo(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunetaquo (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_748lfunetaquo(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_748lfunetaquo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lfunetaquo", 0);

  /* "cypari/auto_gen.pxi":13504
 *             ? L = lfunetaquo([1,24]); \\ same as above
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = lfunetaquo(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13504, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13505
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunetaquo(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13506
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = lfunetaquo(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunetaquo(__pyx_v__M);

  /* "cypari/auto_gen.pxi":13507
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = lfunetaquo(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfungenus2(F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 13507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13482
 *         return new_gen(_ret)
 * 
 *     def lfunetaquo(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunetaquo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13509
 *         return new_gen(_ret)
 * 
 *     def lfungenus2(F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_751lfungenus2(PyObject *__pyx_v_F, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_750lfungenus2[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`L` function\n        attached to the genus-2 curve defined by :math:`y^2 = F(x)` or\n        :math:`y^2+Q(x) y = P(x)` if :math:`F = [P,Q]`.\n        Currently, the model needs to be minimal at 2, and if the conductor\n        is even, its valuation at :math:`2` might be incorrect (a warning is issued).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_751lfungenus2(PyObject *__pyx_v_F, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfungenus2 (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_750lfungenus2(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_750lfungenus2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lfungenus2", 0);

  /* "cypari/auto_gen.pxi":13517
 *         is even, its valuation at :math:`2` might be incorrect (a warning is issued).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = lfungenus2(_F)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13517, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13518
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfungenus2(_F)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13519
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = lfungenus2(_F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfungenus2(__pyx_v__F);

  /* "cypari/auto_gen.pxi":13520
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = lfungenus2(_F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunhardy(L, t, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 13520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13509
 *         return new_gen(_ret)
 * 
 *     def lfungenus2(F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfungenus2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13522
 *         return new_gen(_ret)
 * 
 *     def lfunhardy(L, t, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variant of the Hardy :math:`Z`-function given by :literal:`L`, used for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_753lfunhardy(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_752lfunhardy[] = "\n        Variant of the Hardy :math:`Z`-function given by :literal:`L`, used for\n        plotting or locating zeros of :math:`L(k/2+it)` on the critical line.\n        The precise definition is as\n        follows: if as usual :math:`k/2` is the center of the critical strip, :math:`d` is the\n        degree, :math:`\\alpha_j` the entries of :literal:`Vga` giving the gamma factors,\n        and :math:`\\varepsilon` the root number, then if we set\n        :math:`s = k/2+it = \\rho e^{i\\theta}` and\n        :math:`E = (d(k/2-1)+\\sum_{1 <= j <= d}\\alpha_j)/2`, the computed function at :math:`t` is\n        equal to\n        \n        .. MATH::\n        \n            Z(t) = \\varepsilon^{-1/2}\\Lambda (s).\\|s\\|^{-E}e^{dt\\theta/2} ,\n        \n        which is a real function of :math:`t` for self-dual :math:`\\Lambda`,\n        vanishing exactly when :math:`L(k/2+it)` does on the critical line. The\n        normalizing factor :math:`\\|s\\|^{-E}e^{dt\\theta/2}` compensates the\n        exponential decrease of :math:`\\gamma_A(s)` as :math:`t\\to oo` so that\n        :math:`Z(t) ~ 1`.\n        \n        ::\n        \n            ? T = 100; \\\\ maximal height\n            ? L = lfuninit(1, [T]); \\\\ initialize for zeta(1/2+it), |t|<T\n            ? \\p19 \\\\ no need for large accuracy\n            ? ploth(t = 0, T, lfunhardy(L,t))\n        \n        Using :literal:`lfuninit` is critical for this particular\n        applications since thousands of values are computed. Make sure to initialize\n        up to the maximal :math:`t` needed: otherwise expect to see many warnings for\n        unsufficient initialization and suffer major slowdowns.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_753lfunhardy(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunhardy (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_precision,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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunhardy") < 0)) __PYX_ERR(10, 13522, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_t = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13522, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunhardy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13522, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunhardy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_752lfunhardy(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_t, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_752lfunhardy(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_t, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunhardy", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_gen.pxi":13556
 *         unsufficient initialization and suffer major slowdowns.
 *         '''
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13557
 *         '''
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13557, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13558
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13559
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13560
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13561
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13560
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13562
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunhardy(__pyx_v__L, __pyx_v__t, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13563
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunhardy(_L, _t, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuninit(L, sdom, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13522
 *         return new_gen(_ret)
 * 
 *     def lfunhardy(L, t, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Variant of the Hardy :math:`Z`-function given by :literal:`L`, used for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunhardy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13565
 *         return new_gen(_ret)
 * 
 *     def lfuninit(L, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for all functions linked to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_755lfuninit(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_754lfuninit[] = "\n        Initalization function for all functions linked to the\n        computation of the :math:`L`-function :math:`L(s)` encoded by :literal:`L`, where\n        :math:`s` belongs to the rectangular domain :math:`sdom = [center,w,h]`\n        centered on the real axis, :math:`\\|\\Re (s)-center\\| <= w`, :math:`\\|\\Im (s)\\| <= h`,\n        where all three components of :literal:`sdom` are real and :math:`w`, :math:`h` are\n        non-negative. :literal:`der` is the maximum order of derivation that will be used.\n        The subdomain :math:`[k/2, 0, h]` on the critical line (up to height :math:`h`)\n        can be encoded as :math:`[h]` for brevity. The subdomain :math:`[k/2, w, h]`\n        centered on the critical line can be encoded as :math:`[w, h]` for brevity.\n        \n        The argument :literal:`L` is an :literal:`Lmath`, an :literal:`Ldata` or an :literal:`Linit`. See\n        :literal:`\077\077Ldata` and :literal:`\077\077lfuncreate` for how to create it.\n        \n        The height :math:`h` of the domain is a :emphasis:`crucial` parameter: if you only\n        need :math:`L(s)` for real :math:`s`, set :math:`h` to\302\2400.\n        The running time is roughly proportional to\n        \n        .. MATH::\n        \n            (B / d+\\pi h/4)^{d/2+3}N^{1/2},\n        \n        where :math:`B` is the default bit accuracy, :math:`d` is the degree of the\n        :math:`L`-function, and :math:`N` is the conductor (the exponent :math:`d/2+3` is reduced\n        to :math:`d/2+2` when :math:`d = 1` and :math:`d = 2`). There is also a dependency on :math:`w`,\n        which is less crucial, but make sure to use the smallest rectangular\n        domain that you need.\n        \n        ::\n        \n            ? L0 = lfuncreate(1); \\\\ Riemann zeta\n            ? L = lfuninit(L0, [1/2, 0, 100]); \\\\ for zeta(1/2+it), |t| < 100\n            ? lfun(L, 1/2 + I)\n            ? L = lfuninit(L0, [100]); \\\\ same as above !\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_755lfuninit(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sdom = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuninit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sdom,&__pyx_n_s_der,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sdom)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuninit") < 0)) __PYX_ERR(10, 13565, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sdom = values[0];
    if (values[1]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13565, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13565, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuninit", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13565, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_754lfuninit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_sdom, __pyx_v_der, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_754lfuninit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_sdom, long __pyx_v_der, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__sdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuninit", 0);
  __Pyx_INCREF(__pyx_v_sdom);

  /* "cypari/auto_gen.pxi":13601
 *             ? L = lfuninit(L0, [100]); \\ same as above !
 *         '''
 *         sdom = objtogen(sdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sdom, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sdom, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13602
 *         '''
 *         sdom = objtogen(sdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13602, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13603
 *         sdom = objtogen(sdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13604
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sdom)->__pyx_base.g;
  __pyx_v__sdom = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13605
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13606
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13605
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _sdom = (<Gen>sdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13607
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuninit0(__pyx_v__L, __pyx_v__sdom, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13608
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuninit0(_L, _sdom, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunlambda(L, s, long D=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13565
 *         return new_gen(_ret)
 * 
 *     def lfuninit(L, sdom, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for all functions linked to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13610
 *         return new_gen(_ret)
 * 
 *     def lfunlambda(L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the completed :math:`L`-function :math:`\Lambda (s) = N^{s/2}\gamma (s)L(s)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_757lfunlambda(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_756lfunlambda[] = "\n        Compute the completed :math:`L`-function :math:`\\Lambda (s) = N^{s/2}\\gamma (s)L(s)`,\n        or if :literal:`D` is set, the derivative of order :literal:`D` at :math:`s`.\n        The parameter :literal:`L` is either an :literal:`Lmath`, an :literal:`Ldata` (created by\n        :literal:`lfuncreate`, or an :literal:`Linit` (created by :literal:`lfuninit`), preferrably the\n        latter if many values are to be computed.\n        \n        The result is given with absolute error less than :math:`2^{-B}\\|\\gamma (s)N^{s/2}\\|`,\n        where :math:`B = realbitprecision`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_757lfunlambda(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_D;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunlambda (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_D,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunlambda") < 0)) __PYX_ERR(10, 13610, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13610, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13610, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunlambda", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13610, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunlambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_756lfunlambda(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_s, __pyx_v_D, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_756lfunlambda(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_s, long __pyx_v_D, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunlambda", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_gen.pxi":13621
 *         where :math:`B = realbitprecision`.
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13622
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13622, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13623
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13624
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13625
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13626
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13625
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _s = (<Gen>s).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13627
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunlambda0(__pyx_v__L, __pyx_v__s, __pyx_v_D, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13628
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunlambda0(_L, _s, D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunmf(mf, F=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13610
 *         return new_gen(_ret)
 * 
 *     def lfunlambda(L, s, long D=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the completed :math:`L`-function :math:`\Lambda (s) = N^{s/2}\gamma (s)L(s)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunlambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13630
 *         return new_gen(_ret)
 * 
 *     def lfunmf(mf, F=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form in :literal:`mf`, output the L-functions
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_759lfunmf(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_758lfunmf[] = "\n        If :math:`F` is a modular form in :literal:`mf`, output the L-functions\n        corresponding to its :math:`[\\mathbb{Q} (F):\\mathbb{Q} (\\chi)]` complex embeddings, ready for use with\n        the :literal:`lfun` package. If :math:`F` is omitted, output the :math:`L`-functions attached\n        to all eigenforms in the new space; the result is a vector whose length is\n        the number of Galois orbits of newforms. Each entry contains the vector of\n        :math:`L`-functions corresponding to the :math:`d` complex embeddings of an orbit of\n        dimension :math:`d` over :math:`\\mathbb{Q} (\\chi)`.\n        \n        ::\n        \n            ? mf = mfinit([35,2],0);mffields(mf)\n            %1 = [y, y^2 - y - 4]\n            ? f = mfeigenbasis(mf)[2]; mfparams(f) \\\\ orbit of dimension two\n            %2 = [35, 2, 1, y^2 - y - 4]\n            ? [L1,L2] = lfunmf(mf, f); \\\\ Two L-functions\n            ? lfun(L1,1)\n            %4 = 0.81018461849460161754947375433874745585\n            ? lfun(L2,1)\n            %5 = 0.46007635204895314548435893464149369804\n            ? [ lfun(L,1) | L <- concat(lfunmf(mf)) ]\n            %6 = [0.70291..., 0.81018..., 0.46007...]\n        \n        The :literal:`concat` instruction concatenates the vectors\n        corresponding to the various (here two) orbits, so that we obtain the vector\n        of all the :math:`L`-functions attached to eigenforms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_759lfunmf(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunmf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunmf") < 0)) __PYX_ERR(10, 13630, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_F = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13630, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunmf", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13630, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunmf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_758lfunmf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_F, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_758lfunmf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_precision) {
  int __pyx_v__have_F;
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunmf", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":13658
 *         of all the :math:`L`-functions attached to eigenforms.
 *         '''
 *         cdef bint _have_F = (F is not None)             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             F = objtogen(F)
 */
  __pyx_t_1 = (__pyx_v_F != Py_None);
  __pyx_v__have_F = __pyx_t_1;

  /* "cypari/auto_gen.pxi":13659
 *         '''
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_F != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13660
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 *             F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":13659
 *         '''
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":13661
 *         if _have_F:
 *             F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 13661, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13662
 *             F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = NULL
 *         if _have_F:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":13663
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             _F = (<Gen>F).g
 */
  __pyx_v__F = NULL;

  /* "cypari/auto_gen.pxi":13664
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_F != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13665
 *         cdef GEN _F = NULL
 *         if _have_F:
 *             _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
    __pyx_v__F = __pyx_t_4;

    /* "cypari/auto_gen.pxi":13664
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":13666
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13667
 *             _F = (<Gen>F).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13666
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13668
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunmf(__pyx_v__mf, __pyx_v__F, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13669
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmf(_mf, _F, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunmfspec(L, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13630
 *         return new_gen(_ret)
 * 
 *     def lfunmf(mf, F=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form in :literal:`mf`, output the L-functions
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunmf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13671
 *         return new_gen(_ret)
 * 
 *     def lfunmfspec(L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :literal:`[valeven,valodd,omminus,omplus]`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_761lfunmfspec(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_760lfunmfspec[] = "\n        Returns :literal:`[valeven,valodd,omminus,omplus]`,\n        where :literal:`valeven` (resp., :literal:`valodd`) is the vector of even (resp., odd)\n        periods of the modular form given by :literal:`L`, and :literal:`omminus` and\n        :literal:`omplus` the corresponding real numbers :math:`\\omega^-` and :math:`\\omega^+`\n        normalized in a noncanonical way. For the moment, only for modular forms of even weight.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_761lfunmfspec(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunmfspec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunmfspec") < 0)) __PYX_ERR(10, 13671, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13671, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunmfspec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13671, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunmfspec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_760lfunmfspec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_760lfunmfspec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("lfunmfspec", 0);

  /* "cypari/auto_gen.pxi":13679
 *         normalized in a noncanonical way. For the moment, only for modular forms of even weight.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13679, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13680
 *         '''
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13681
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 */
  __pyx_t_3 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":13682
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13681
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13683
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunmfspec(__pyx_v__L, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13684
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmfspec(_L, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunmul(L1, L2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 13684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13671
 *         return new_gen(_ret)
 * 
 *     def lfunmfspec(L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :literal:`[valeven,valodd,omminus,omplus]`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunmfspec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13686
 *         return new_gen(_ret)
 * 
 *     def lfunmul(L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_763lfunmul(PyObject *__pyx_v_L1, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_762lfunmul[] = "\n        Creates the :literal:`Ldata` structure (without initialization) corresponding\n        to the product of the Dirichlet series given by :literal:`L1` and\n        :literal:`L2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_763lfunmul(PyObject *__pyx_v_L1, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_L2 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L2,&__pyx_n_s_precision,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_L2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunmul") < 0)) __PYX_ERR(10, 13686, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_L2 = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13686, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunmul", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13686, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_762lfunmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L1), __pyx_v_L2, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_762lfunmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L1, PyObject *__pyx_v_L2, long __pyx_v_precision) {
  GEN __pyx_v__L1;
  GEN __pyx_v__L2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunmul", 0);
  __Pyx_INCREF(__pyx_v_L2);

  /* "cypari/auto_gen.pxi":13692
 *         :literal:`L2`.
 *         '''
 *         L2 = objtogen(L2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L2, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13693
 *         '''
 *         L2 = objtogen(L2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13693, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13694
 *         L2 = objtogen(L2)
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L1)->__pyx_base.g;
  __pyx_v__L1 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13695
 *         sig_on()
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L2)->__pyx_base.g;
  __pyx_v__L2 = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13696
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13697
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13696
 *         cdef GEN _L1 = (<Gen>L1).g
 *         cdef GEN _L2 = (<Gen>L2).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13698
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunmul(__pyx_v__L1, __pyx_v__L2, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13699
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunmul(_L1, _L2, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunorderzero(L, long m=-1, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13686
 *         return new_gen(_ret)
 * 
 *     def lfunmul(L1, L2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the :literal:`Ldata` structure (without initialization) corresponding
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13701
 *         return new_gen(_ret)
 * 
 *     def lfunorderzero(L, long m=-1, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the order of the possible zero of the :math:`L`-function at the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_765lfunorderzero(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_764lfunorderzero[] = "\n        Computes the order of the possible zero of the :math:`L`-function at the\n        center :math:`k/2` of the critical strip; return :math:`0` if :math:`L(k/2)` does not vanish.\n        \n        If :math:`m` is given and has a non-negative value, assumes the order is at most :math:`m`.\n        Otherwise, the algorithm chooses a sensible default:\n        \n        - if the :math:`L` argument is an :literal:`Linit`, assume that a multiple zero at\n          :math:`s = k / 2` has order less than or equal to the maximal allowed derivation\n          order.\n        \n        - else assume the order is less than :math:`4`.\n        \n        You may explicitly increase this value using optional argument\302\240:math:`m`; this\n        overrides the default value above. (Possibly forcing a recomputation\n        of the :literal:`Linit`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_765lfunorderzero(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunorderzero (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunorderzero") < 0)) __PYX_ERR(10, 13701, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13701, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)-1L);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13701, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunorderzero", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13701, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunorderzero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_764lfunorderzero(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_m, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_764lfunorderzero(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__L;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("lfunorderzero", 0);

  /* "cypari/auto_gen.pxi":13719
 *         of the :literal:`Linit`.)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13719, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13720
 *         '''
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13721
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 */
  __pyx_t_3 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":13722
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 *         clear_stack()
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13721
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13723
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lfunorderzero(__pyx_v__L, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13724
 *             precision = default_bitprec()
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":13725
 *         cdef long _ret = lfunorderzero(_L, m, precision)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfunqf(Q, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 13725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13701
 *         return new_gen(_ret)
 * 
 *     def lfunorderzero(L, long m=-1, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the order of the possible zero of the :math:`L`-function at the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunorderzero", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13727
 *         return _ret
 * 
 *     def lfunqf(Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`\Theta` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_767lfunqf(PyObject *__pyx_v_Q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_766lfunqf[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`\\Theta` function\n        of the lattice attached to the definite positive quadratic form :math:`Q`.\n        \n        ::\n        \n            ? L = lfunqf(matid(2));\n            ? lfunqf(L,2)\n            %2 = 6.0268120396919401235462601927282855839\n            ? lfun(x^2+1,2)*4\n            %3 = 6.0268120396919401235462601927282855839\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_767lfunqf(PyObject *__pyx_v_Q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunqf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunqf") < 0)) __PYX_ERR(10, 13727, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13727, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunqf", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13727, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_766lfunqf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Q), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_766lfunqf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, long __pyx_v_precision) {
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lfunqf", 0);

  /* "cypari/auto_gen.pxi":13740
 *             %3 = 6.0268120396919401235462601927282855839
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13740, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13741
 *         '''
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunqf(_Q, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13742
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunqf(_Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":13743
 *         cdef GEN _Q = (<Gen>Q).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunqf(_Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunqf(__pyx_v__Q, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13744
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = lfunqf(_Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunrootres(data, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 13744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13727
 *         return _ret
 * 
 *     def lfunqf(Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`\Theta` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13746
 *         return new_gen(_ret)
 * 
 *     def lfunrootres(data, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the :literal:`Ldata` attached to an :math:`L`-function (or the output of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_769lfunrootres(PyObject *__pyx_v_data, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_768lfunrootres[] = "\n        Given the :literal:`Ldata` attached to an :math:`L`-function (or the output of\n        :literal:`lfunthetainit`), compute the root number and the residues.\n        \n        The output is a 3-component vector\n        :math:`[[[a_1,r_1],...,[a_n, r_n], [[b_1, R_1],...,[b_m, R_m]], w]`,\n        where :math:`r_i` is the\n        polar part of :math:`L(s)` at :math:`a_i`, :math:`R_i` is is the polar part of :math:`\\Lambda (s)` at\n        :math:`b_i` or :math:`[0,0,r]` if there is no pole,\n        and :math:`w` is the root number. In the present implementation,\n        \n        - either the polar part must be completely known (and is then arbitrary):\n          the function determines the root number,\n        \n        ::\n        \n            ? L = lfunmul(1,1); \\\\ zeta^2\n            ? [r,R,w] = lfunrootres(L);\n            ? r \\\\ single pole at 1, double\n            %3 = [[1, 1.[...]*x^-2 + 1.1544[...]*x^-1 + O(x^0)]]\n            ? w\n            %4 = 1\n            ? R \\\\ double pole at 0 and 1\n            %5 = [[1,[...]], [0,[...]]\n        \n        - or at most a single pole is allowed: the function computes both\n          the root number and the residue (:math:`0` if no pole).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_769lfunrootres(PyObject *__pyx_v_data, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunrootres (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunrootres") < 0)) __PYX_ERR(10, 13746, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13746, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunrootres", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13746, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunrootres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_768lfunrootres(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_data), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_768lfunrootres(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_data, long __pyx_v_precision) {
  GEN __pyx_v__data;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("lfunrootres", 0);

  /* "cypari/auto_gen.pxi":13775
 *           the root number and the residue (:math:`0` if no pole).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13775, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13776
 *         '''
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_data)->__pyx_base.g;
  __pyx_v__data = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13777
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)
 */
  __pyx_t_3 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":13778
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunrootres(_data, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13777
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13779
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunrootres(__pyx_v__data, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13780
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunrootres(_data, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunsympow(E, unsigned long m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 13780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13746
 *         return new_gen(_ret)
 * 
 *     def lfunrootres(data, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the :literal:`Ldata` attached to an :math:`L`-function (or the output of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunrootres", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13782
 *         return new_gen(_ret)
 * 
 *     def lfunsympow(E, unsigned long m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_771lfunsympow(PyObject *__pyx_v_E, PyObject *__pyx_arg_m); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_770lfunsympow[] = "\n        Returns the :literal:`Ldata` structure attached to the :math:`L` function\n        attached to the :math:`m`-th symmetric power of the elliptic curve :math:`E` defined over\n        the rationals.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_771lfunsympow(PyObject *__pyx_v_E, PyObject *__pyx_arg_m) {
  unsigned long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunsympow (wrapper)", 0);
  assert(__pyx_arg_m); {
    __pyx_v_m = __Pyx_PyInt_As_unsigned_long(__pyx_arg_m); if (unlikely((__pyx_v_m == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13782, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunsympow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_770lfunsympow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), ((unsigned long)__pyx_v_m));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_770lfunsympow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, unsigned long __pyx_v_m) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lfunsympow", 0);

  /* "cypari/auto_gen.pxi":13788
 *         the rationals.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = lfunsympow(_E, m)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 13788, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13789
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunsympow(_E, m)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":13790
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = lfunsympow(_E, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunsympow(__pyx_v__E, __pyx_v_m);

  /* "cypari/auto_gen.pxi":13791
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = lfunsympow(_E, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuntheta(data, t, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 13791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13782
 *         return new_gen(_ret)
 * 
 *     def lfunsympow(E, unsigned long m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the :literal:`Ldata` structure attached to the :math:`L` function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunsympow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13793
 *         return new_gen(_ret)
 * 
 *     def lfuntheta(data, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of the :math:`m`-th derivative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_773lfuntheta(PyObject *__pyx_v_data, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_772lfuntheta[] = "\n        Compute the value of the :math:`m`-th derivative\n        at :math:`t` of the theta function attached to the :math:`L`-function given by :literal:`data`.\n        :literal:`data` can be either the standard :math:`L`-function data, or the output of\n        :literal:`lfunthetainit`. The result is given with absolute error less than\n        :math:`2^{-B}`, where :math:`B = realbitprecision`.\n        \n        The theta function is defined by the formula\n        :math:`\\Theta (t) = \\sum_{n >= 1}a(n)K(nt/\\sqrt (N))`, where :math:`a(n)` are the coefficients\n        of the Dirichlet series, :math:`N` is the conductor, and :math:`K` is the inverse Mellin\n        transform of the gamma product defined by the :literal:`Vga` component.\n        Its Mellin transform is equal to :math:`\\Lambda (s)-P(s)`, where :math:`\\Lambda (s)`\n        is the completed :math:`L`-function and the rational function :math:`P(s)` its polar part.\n        In particular, if the :math:`L`-function is the :math:`L`-function of a modular form\n        :math:`f(\\tau) = \\sum_{n >= 0}a(n)q^n` with :math:`q = \\exp (2\\pi i\\tau)`, we have\n        :math:`\\Theta (t) = 2(f(it/\\sqrt{N})-a(0))`. Note that :math:`a(0) = -L(f,0)` in this case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_773lfuntheta(PyObject *__pyx_v_data, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuntheta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfuntheta") < 0)) __PYX_ERR(10, 13793, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_t = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13793, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13793, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfuntheta", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13793, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuntheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_772lfuntheta(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_data), __pyx_v_t, __pyx_v_m, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_772lfuntheta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_data, PyObject *__pyx_v_t, long __pyx_v_m, long __pyx_v_precision) {
  GEN __pyx_v__data;
  GEN __pyx_v__t;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfuntheta", 0);
  __Pyx_INCREF(__pyx_v_t);

  /* "cypari/auto_gen.pxi":13811
 *         :math:`\Theta (t) = 2(f(it/\sqrt{N})-a(0))`. Note that :math:`a(0) = -L(f,0)` in this case.
 *         '''
 *         t = objtogen(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_t, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13811, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_t, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13812
 *         '''
 *         t = objtogen(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13812, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13813
 *         t = objtogen(t)
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g             # <<<<<<<<<<<<<<
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_data)->__pyx_base.g;
  __pyx_v__data = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13814
 *         sig_on()
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_t)->__pyx_base.g;
  __pyx_v__t = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13815
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13816
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13815
 *         cdef GEN _data = (<Gen>data).g
 *         cdef GEN _t = (<Gen>t).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13817
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuntheta(__pyx_v__data, __pyx_v__t, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13818
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfuntheta(_data, _t, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunthetacost(L, tdom=None, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13793
 *         return new_gen(_ret)
 * 
 *     def lfuntheta(data, t, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of the :math:`m`-th derivative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuntheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13820
 *         return new_gen(_ret)
 * 
 *     def lfunthetacost(L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function estimates the cost of running
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_775lfunthetacost(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_774lfunthetacost[] = "\n        This function estimates the cost of running\n        :literal:`lfunthetainit(L,tdom,m)` at current bit precision. Returns the number of\n        coefficients :math:`a_n` that would be computed. This also estimates the\n        cost of a subsequent evaluation :literal:`lfuntheta`, which must compute\n        that many values of :literal:`gammamellininv` at the current bit precision.\n        If :math:`L` is already an :literal:`Linit`, then :emphasis:`tdom` and :math:`m` are ignored\n        and are best left omitted: we get an estimate of the cost of using that\n        particular :literal:`Linit`.\n        \n        ::\n        \n            ? \\pb 1000\n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? lfunthetacost(L); \\\\ cost for theta(t), t real >= 1\n            %1 = 15\n            ? lfunthetacost(L, 1 + I); \\\\ cost for theta(1+I). Domain error !\n             *** at top-level: lfunthetacost(1,1+I)\n             *** ^--------------------\n             *** lfunthetacost: domain error in lfunthetaneed: arg t > 0.785\n            ? lfunthetacost(L, 1 + I/2) \\\\ for theta(1+I/2).\n            %2 = 23\n            ? lfunthetacost(L, 1 + I/2, 10) \\\\ for theta^((10))(1+I/2).\n            %3 = 24\n            ? lfunthetacost(L, [2, 1/10]) \\\\ cost for theta(t), |t| >= 2, |arg(t)| < 1/10\n            %4 = 8\n            \n            ? L = lfuncreate( ellinit([1,1]) );\n            ? lfunthetacost(L) \\\\ for t >= 1\n            %6 = 2471\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_775lfunthetacost(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tdom = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunthetacost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tdom,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tdom);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunthetacost") < 0)) __PYX_ERR(10, 13820, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tdom = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13820, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13820, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunthetacost", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13820, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunthetacost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_774lfunthetacost(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_tdom, __pyx_v_m, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_774lfunthetacost(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision) {
  int __pyx_v__have_tdom;
  GEN __pyx_v__L;
  GEN __pyx_v__tdom;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunthetacost", 0);
  __Pyx_INCREF(__pyx_v_tdom);

  /* "cypari/auto_gen.pxi":13852
 *             %6 = 2471
 *         '''
 *         cdef bint _have_tdom = (tdom is not None)             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 */
  __pyx_t_1 = (__pyx_v_tdom != Py_None);
  __pyx_v__have_tdom = __pyx_t_1;

  /* "cypari/auto_gen.pxi":13853
 *         '''
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13854
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:
 *             tdom = objtogen(tdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tdom, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13854, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_tdom, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":13853
 *         '''
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":13855
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 13855, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13856
 *             tdom = objtogen(tdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_gen.pxi":13857
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 */
  __pyx_v__tdom = NULL;

  /* "cypari/auto_gen.pxi":13858
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13859
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tdom)->__pyx_base.g;
    __pyx_v__tdom = __pyx_t_4;

    /* "cypari/auto_gen.pxi":13858
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":13860
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13861
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 *         clear_stack()
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13860
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13862
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = lfunthetacost0(__pyx_v__L, __pyx_v__tdom, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13863
 *             precision = default_bitprec()
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":13864
 *         cdef long _ret = lfunthetacost0(_L, _tdom, m, precision)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def lfunthetainit(L, tdom=None, long m=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13820
 *         return new_gen(_ret)
 * 
 *     def lfunthetacost(L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function estimates the cost of running
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunthetacost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13866
 *         return _ret
 * 
 *     def lfunthetainit(L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for evaluating the :math:`m`-th derivative of theta
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_777lfunthetainit(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_776lfunthetainit[] = "\n        Initalization function for evaluating the :math:`m`-th derivative of theta\n        functions with argument :math:`t` in domain :emphasis:`tdom`. By default (:emphasis:`tdom`\n        omitted), :math:`t` is real, :math:`t >= 1`. Otherwise, :emphasis:`tdom` may be\n        \n        - a positive real scalar :math:`\\rho`: :math:`t` is real, :math:`t >= \\rho`.\n        \n        - a non-real complex number: compute at this particular :math:`t`; this\n          allows to compute :math:`\\theta (z)` for any complex :math:`z` satisfying :math:`\\|z\\| >= \\|t\\|`\n          and :math:`\\|\\arg z\\| <= \\|\\arg t\\|`; we must have :math:`\\|2 \\arg z / d\\| < \\pi/2`, where\n          :math:`d` is the degree of the :math:`\\Gamma` factor.\n        \n        - a pair :math:`[\\rho,\\alpha]`: assume that :math:`\\|t\\| >= \\rho` and :math:`\\|\\arg t\\| \\leq\n          \\alpha`; we must have :math:`\\|2\\alpha / d\\| < \\pi/2`, where :math:`d` is the degree of\n          the :math:`\\Gamma` factor.\n        \n        ::\n        \n            ? \\p500\n            ? L = lfuncreate(1); \\\\ Riemann zeta\n            ? t = 1+I/2;\n            ? lfuntheta(L, t); \\\\ direct computation\n            time = 30 ms.\n            ? T = lfunthetainit(L, 1+I/2);\n            time = 30 ms.\n            ? lfuntheta(T, t); \\\\ instantaneous\n        \n        The :math:`T` structure would allow to quickly compute :math:`\\theta (z)`\n        for any :math:`z` in the cone delimited by :math:`t` as explained above. On the other hand\n        \n        ::\n        \n            ? lfuntheta(T,I)\n             *** at top-level: lfuntheta(T,I)\n             *** ^--------------\n             *** lfuntheta: domain error in lfunthetaneed: arg t > 0.785398163397448\n        \n        The initialization is equivalent to\n        \n        ::\n        \n            ? lfunthetainit(L, [abs(t), arg(t)])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_777lfunthetainit(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tdom = 0;
  long __pyx_v_m;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunthetainit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tdom,&__pyx_n_s_m,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tdom);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunthetainit") < 0)) __PYX_ERR(10, 13866, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tdom = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13866, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13866, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunthetainit", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13866, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunthetainit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_776lfunthetainit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_tdom, __pyx_v_m, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_776lfunthetainit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_tdom, long __pyx_v_m, long __pyx_v_precision) {
  int __pyx_v__have_tdom;
  GEN __pyx_v__L;
  GEN __pyx_v__tdom;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunthetainit", 0);
  __Pyx_INCREF(__pyx_v_tdom);

  /* "cypari/auto_gen.pxi":13910
 *             ? lfunthetainit(L, [abs(t), arg(t)])
 *         '''
 *         cdef bint _have_tdom = (tdom is not None)             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 */
  __pyx_t_1 = (__pyx_v_tdom != Py_None);
  __pyx_v__have_tdom = __pyx_t_1;

  /* "cypari/auto_gen.pxi":13911
 *         '''
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13912
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:
 *             tdom = objtogen(tdom)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tdom, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_tdom, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":13911
 *         '''
 *         cdef bint _have_tdom = (tdom is not None)
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             tdom = objtogen(tdom)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":13913
 *         if _have_tdom:
 *             tdom = objtogen(tdom)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 13913, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13914
 *             tdom = objtogen(tdom)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_gen.pxi":13915
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL             # <<<<<<<<<<<<<<
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 */
  __pyx_v__tdom = NULL;

  /* "cypari/auto_gen.pxi":13916
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_tdom != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13917
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tdom)->__pyx_base.g;
    __pyx_v__tdom = __pyx_t_4;

    /* "cypari/auto_gen.pxi":13916
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _tdom = NULL
 *         if _have_tdom:             # <<<<<<<<<<<<<<
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":13918
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":13919
 *             _tdom = (<Gen>tdom).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13918
 *         if _have_tdom:
 *             _tdom = (<Gen>tdom).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13920
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunthetainit(__pyx_v__L, __pyx_v__tdom, __pyx_v_m, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13921
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunthetainit(_L, _tdom, m, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfuntwist(L, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 13921, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13866
 *         return _ret
 * 
 *     def lfunthetainit(L, tdom=None, long m=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initalization function for evaluating the :math:`m`-th derivative of theta
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunthetainit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tdom);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13923
 *         return new_gen(_ret)
 * 
 *     def lfuntwist(L, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the Ldata structure (without initialization) corresponding to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_779lfuntwist(PyObject *__pyx_v_L, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_778lfuntwist[] = "\n        Creates the Ldata structure (without initialization) corresponding to the\n        twist of L by the primitive character attached to the Dirichlet character\n        :literal:`chi`. The conductor of the character must be coprime to the conductor\n        of the L-function :math:`L`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_779lfuntwist(PyObject *__pyx_v_L, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfuntwist (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_778lfuntwist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_778lfuntwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_chi) {
  GEN __pyx_v__L;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("lfuntwist", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":13930
 *         of the L-function :math:`L`.
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13931
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13931, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13932
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = lfuntwist(_L, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13933
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfuntwist(_L, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13934
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = lfuntwist(_L, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfuntwist(__pyx_v__L, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":13935
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = lfuntwist(_L, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lfunzeros(L, lim, long divz=8, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13923
 *         return new_gen(_ret)
 * 
 *     def lfuntwist(L, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the Ldata structure (without initialization) corresponding to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfuntwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13937
 *         return new_gen(_ret)
 * 
 *     def lfunzeros(L, lim, long divz=8, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`lim` being either a positive upper limit or a non-empty real
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_781lfunzeros(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_780lfunzeros[] = "\n        :literal:`lim` being either a positive upper limit or a non-empty real\n        interval inside :math:`[0,+ oo [`, computes an\n        ordered list of zeros of :math:`L(s)` on the critical line up to the given\n        upper limit or in the given interval. Use a naive algorithm which may miss\n        some zeros: it assumes that two consecutive zeros at height :math:`T >= 1`\n        differ at least by :math:`2\\pi/\\omega`, where\n        \n        .. MATH::\n        \n            \\omega := divz.(d\\log (T/2\\pi) +d+ 2\\log (N/(\\pi/2)^d)).\n        \n        To use a finer search mesh, set divz to some integral value\n        larger than the default ( = 8).\n        \n        ::\n        \n            ? lfunzeros(1, 30) \\\\ zeros of Rieman zeta up to height 30\n            %1 = [14.134[...], 21.022[...], 25.010[...]]\n            ? #lfunzeros(1, [100,110]) \\\\ count zeros with 100 <= Im(s) <= 110\n            %2 = 4\n        \n        The algorithm also assumes that all zeros are simple except\n        possibly on the real axis at :math:`s = k/2` and that there are no poles in the\n        search interval. (The possible zero at :math:`s = k/2` is repeated according to\n        its multiplicity.)\n        \n        Should you pass an :literal:`Linit` argument to the function, beware that the\n        algorithm needs at least\n        \n        ::\n        \n             L = lfuninit(Ldata, [T+1])\n        \n        where :math:`T` is the upper bound of the interval defined by\n        :literal:`lim`: this allows to detect zeros near :math:`T`. Make sure that your\n        :literal:`Linit` domain contains this one, i.e. a domain :math:`[1,T+1]` is fine but\n        :math:`[0, T]` is not! The algorithm assumes that a multiple zero at :math:`s = k / 2`\n        has order less than or equal to the maximal derivation order allowed by the\n        :literal:`Linit`. You may increase that value in the :literal:`Linit` but this is\n        costly: only do it f""or zeros of low height or in :literal:`lfunorderzero` instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_781lfunzeros(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_lim = 0;
  long __pyx_v_divz;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lfunzeros (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lim,&__pyx_n_s_divz,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_divz);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lfunzeros") < 0)) __PYX_ERR(10, 13937, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_lim = values[0];
    if (values[1]) {
      __pyx_v_divz = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_divz == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13937, __pyx_L3_error)
    } else {
      __pyx_v_divz = ((long)8);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 13937, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lfunzeros", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13937, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunzeros", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_780lfunzeros(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_lim, __pyx_v_divz, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_780lfunzeros(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_lim, long __pyx_v_divz, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__lim;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("lfunzeros", 0);
  __Pyx_INCREF(__pyx_v_lim);

  /* "cypari/auto_gen.pxi":13980
 *         costly: only do it for zeros of low height or in :literal:`lfunorderzero` instead.
 *         '''
 *         lim = objtogen(lim)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_lim, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_lim, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":13981
 *         '''
 *         lim = objtogen(lim)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 13981, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":13982
 *         lim = objtogen(lim)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13983
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_lim)->__pyx_base.g;
  __pyx_v__lim = __pyx_t_3;

  /* "cypari/auto_gen.pxi":13984
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":13985
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":13984
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _lim = (<Gen>lim).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 */
  }

  /* "cypari/auto_gen.pxi":13986
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lfunzeros(__pyx_v__L, __pyx_v__lim, __pyx_v_divz, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":13987
 *             precision = default_bitprec()
 *         cdef GEN _ret = lfunzeros(_L, _lim, divz, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lift(x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 13987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13937
 *         return new_gen(_ret)
 * 
 *     def lfunzeros(L, lim, long divz=8, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`lim` being either a positive upper limit or a non-empty real
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lfunzeros", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_lim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":13989
 *         return new_gen(_ret)
 * 
 *     def lift(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`v` is omitted, lifts intmods from :math:`\mathbb{Z}/n\mathbb{Z}` in :math:`\mathbb{Z}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_783lift(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_782lift[] = "\n        If :math:`v` is omitted, lifts intmods from :math:`\\mathbb{Z}/n\\mathbb{Z}` in :math:`\\mathbb{Z}`,\n        :math:`p`-adics from :math:`\\mathbb{Q}_p` to :math:`\\mathbb{Q}` (as :literal:`truncate`), and polmods to\n        polynomials. Otherwise, lifts only polmods whose modulus has main\n        variable\302\240:math:`v`. :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(lift,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? lift(Mod(5,3))\n            %1 = 2\n            ? lift(3 + O(3^9))\n            %2 = 3\n            ? lift(Mod(x,x^2+1))\n            %3 = x\n            ? lift(Mod(x,x^2+1))\n            %4 = x\n        \n        Lifts are performed recursively on an object components, but only\n        by :emphasis:`one level`: once a :literal:`t_POLMOD` is lifted, the components of\n        the result are :emphasis:`not` lifted further.\n        \n        ::\n        \n            ? lift(x * Mod(1,3) + Mod(2,3))\n            %4 = x + 2\n            ? lift(x * Mod(y,y^2+1) + Mod(2,3))\n            %5 = y*x + Mod(2, 3) \\\\ do you understand this one?\n            ? lift(x * Mod(y,y^2+1) + Mod(2,3), 'x)\n            %6 = Mod(y, y^2 + 1)*x + Mod(Mod(2, 3), y^2 + 1)\n            ? lift(%, y)\n            %7 = y*x + Mod(2, 3)\n        \n        To recursively lift all components not only by one level,\n        but as long as possible, use :literal:`liftall`. To lift only :literal:`t_INTMOD`\302\240s and\n        :literal:`t_PADIC`\302\240s components, use :literal:`liftint`. To lift only :literal:`t_POLMOD`\302\240s\n        components, use :literal:`liftpol`. Finally, :literal:`centerlift` allows to lift\n        :literal:`t_INTMOD`\302\240s and :literal:`t_PADIC`\302\240s using centered residues (lift of smallest\n        absolute value)"".\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_783lift(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lift") < 0)) __PYX_ERR(10, 13989, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lift", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 13989, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_782lift(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_782lift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("lift", 0);

  /* "cypari/auto_gen.pxi":14032
 *         absolute value).
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":14033
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":14034
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 14034, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":14033
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":14035
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = lift0(_x, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 14035, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14036
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lift0(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":14037
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = lift0(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lift0(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":14038
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = lift0(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def liftall(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 14038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":13989
 *         return new_gen(_ret)
 * 
 *     def lift(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`v` is omitted, lifts intmods from :math:`\mathbb{Z}/n\mathbb{Z}` in :math:`\mathbb{Z}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14040
 *         return new_gen(_ret)
 * 
 *     def liftall(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_785liftall(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_784liftall[] = "\n        Recursively lift all components of :math:`x` from :math:`\\mathbb{Z}/n\\mathbb{Z}` to :math:`\\mathbb{Z}`,\n        from :math:`\\mathbb{Q}_p` to :math:`\\mathbb{Q}` (as :literal:`truncate`), and polmods to\n        polynomials. :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(liftall,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? liftall(x * (1 + O(3)) + Mod(2,3))\n            %1 = x + 2\n            ? liftall(x * Mod(y,y^2+1) + Mod(2,3)*Mod(z,z^2))\n            %2 = y*x + 2*z\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_785liftall(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("liftall (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_784liftall(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_784liftall(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("liftall", 0);

  /* "cypari/auto_gen.pxi":14056
 *             %2 = y*x + 2*z
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftall(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14056, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14057
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = liftall(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14058
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftall(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = liftall(__pyx_v__x);

  /* "cypari/auto_gen.pxi":14059
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftall(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def liftint(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14040
 *         return new_gen(_ret)
 * 
 *     def liftall(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.liftall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14061
 *         return new_gen(_ret)
 * 
 *     def liftint(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_787liftint(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_786liftint[] = "\n        Recursively lift all components of :math:`x` from :math:`\\mathbb{Z}/n\\mathbb{Z}` to :math:`\\mathbb{Z}` and\n        from :math:`\\mathbb{Q}_p` to :math:`\\mathbb{Q}` (as :literal:`truncate`).\n        :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(liftint,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? liftint(x * (1 + O(3)) + Mod(2,3))\n            %1 = x + 2\n            ? liftint(x * Mod(y,y^2+1) + Mod(2,3)*Mod(z,z^2))\n            %2 = Mod(y, y^2 + 1)*x + Mod(Mod(2*z, z^2), y^2 + 1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_787liftint(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("liftint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_786liftint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_786liftint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("liftint", 0);

  /* "cypari/auto_gen.pxi":14077
 *             %2 = Mod(y, y^2 + 1)*x + Mod(Mod(2*z, z^2), y^2 + 1)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftint(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14077, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14078
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = liftint(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14079
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftint(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = liftint(__pyx_v__x);

  /* "cypari/auto_gen.pxi":14080
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftint(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def liftpol(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14080, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14061
 *         return new_gen(_ret)
 * 
 *     def liftint(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` from :math:`\mathbb{Z}/n\mathbb{Z}` to :math:`\mathbb{Z}` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.liftint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14082
 *         return new_gen(_ret)
 * 
 *     def liftpol(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` which are polmods to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_789liftpol(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_788liftpol[] = "\n        Recursively lift all components of :math:`x` which are polmods to\n        polynomials. :literal:`t_FFELT` are not lifted, nor are List elements: you may\n        convert the latter to vectors first, or use :literal:`apply(liftpol,L)`. More\n        generally, components for which such lifts are meaningless (e.g. character\n        strings) are copied verbatim.\n        \n        ::\n        \n            ? liftpol(x * (1 + O(3)) + Mod(2,3))\n            %1 = (1 + O(3))*x + Mod(2, 3)\n            ? liftpol(x * Mod(y,y^2+1) + Mod(2,3)*Mod(z,z^2))\n            %2 = y*x + Mod(2, 3)*z\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_789liftpol(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("liftpol (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_788liftpol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_788liftpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("liftpol", 0);

  /* "cypari/auto_gen.pxi":14097
 *             %2 = y*x + Mod(2, 3)*z
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftpol(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14097, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14098
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = liftpol(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14099
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftpol(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = liftpol(__pyx_v__x);

  /* "cypari/auto_gen.pxi":14100
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = liftpol(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def limitnum(expr, long k=0, alpha=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14082
 *         return new_gen(_ret)
 * 
 *     def liftpol(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Recursively lift all components of :math:`x` which are polmods to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.liftpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14102
 *         return new_gen(_ret)
 * 
 *     def limitnum(expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lagrange-Zagier numerical extrapolation of :emphasis:`expr`, corresponding to a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_791limitnum(PyObject *__pyx_v_expr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_790limitnum[] = "\n        Lagrange-Zagier numerical extrapolation of :emphasis:`expr`, corresponding to a\n        sequence\n        :math:`u_n`, either given by a closure :literal:`n- > u(n)` or by a vector of values\n        I.e., assuming that :math:`u_n` tends to a finite limit :math:`\\ell`, try to determine\n        :math:`\\ell`. This routine is purely numerical and heuristic, thus may or may not\n        work on your examples; :math:`k` is ignored if :math:`u` is given by a vector,\n        and otherwise is a multiplier such that we extrapolate from :math:`u(kn)`.\n        \n        Assume that :math:`u_n` has an asymptotic expansion in :math:`n^{-\\alpha}` :\n        \n        .. MATH::\n        \n            u_n = \\ell + \\sum_{i >= 1} a_i n^{-i\\alpha}\n        \n        for some :math:`a_i`.\n        \n        ::\n        \n            ? limitnum(n -> n*sin(1/n))\n            %1 = 1.0000000000000000000000000000000000000\n            \n            ? limitnum(n -> (1+1/n)^n) - exp(1)\n            %2 = 0.E-37\n            \n            ? limitnum(n -> 2^(4*n+1)*(n!)^4 / (2*n)! /(2*n+1)! )\n            %3 = 3.1415926535897932384626433832795028842\n            ? Pi\n            %4 = 3.1415926535897932384626433832795028842\n        \n        If :math:`u_n` is given by a vector, it must be long enough for the extrapolation\n        to make sense: at least :math:`k` times the current :literal:`realprecision`. The\n        preferred format is thus a closure, although it becomes inconvenient\n        when :math:`u_n` cannot be directly computed in time polynomial in :math:`\\log n`,\n        for instance if it is defined as a sum or by induction. In that case,\n        passing a vector of values is the best option. It usually pays off to\n        interpolate :math:`u(kn)` for some :math:`k > 1`:\n        \n        ::\n        \n            ? limitnum(vector(10,n,(1+1/n)^n))\n             *** ^--------------------\n             *** limitnum: non-existent component in limitnum: in""dex < 20\n            \\\\ at this accuracy, we must have at least 20 values\n            ? limitnum(vector(20,n,(1+1/n)^n)) - exp(1)\n            %5 = -2.05... E-20\n            ? limitnum(vector(20,n, m=10*n;(1+1/m)^m)) - exp(1) \\\\ better accuracy\n            %6 = 0.E-37\n            \n            ? v = vector(20); s = 0;\n            ? for(i=1,#v, s += 1/i; v[i]= s - log(i));\n            ? limitnum(v) - Euler\n            %9 = -1.6... E-19\n            \n            ? V = vector(200); s = 0;\n            ? for(i=1,#V, s += 1/i; V[i]= s);\n            ? v = vector(#V \\ 10, i, V[10*i] - log(10*i));\n            ? limitnum(v) - Euler\n            %13 = 6.43... E-29\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_791limitnum(PyObject *__pyx_v_expr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  PyObject *__pyx_v_alpha = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("limitnum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_alpha,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "limitnum") < 0)) __PYX_ERR(10, 14102, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14102, __pyx_L3_error)
    } else {
      __pyx_v_k = ((long)0);
    }
    __pyx_v_alpha = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14102, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("limitnum", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14102, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.limitnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_790limitnum(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_expr), __pyx_v_k, __pyx_v_alpha, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_790limitnum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_expr, long __pyx_v_k, PyObject *__pyx_v_alpha, long __pyx_v_precision) {
  int __pyx_v__have_alpha;
  GEN __pyx_v__expr;
  GEN __pyx_v__alpha;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("limitnum", 0);
  __Pyx_INCREF(__pyx_v_alpha);

  /* "cypari/auto_gen.pxi":14163
 *             %13 = 6.43... E-29
 *         '''
 *         cdef bint _have_alpha = (alpha is not None)             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 */
  __pyx_t_1 = (__pyx_v_alpha != Py_None);
  __pyx_v__have_alpha = __pyx_t_1;

  /* "cypari/auto_gen.pxi":14164
 *         '''
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":14165
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:
 *             alpha = objtogen(alpha)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_alpha, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_alpha, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":14164
 *         '''
 *         cdef bint _have_alpha = (alpha is not None)
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             alpha = objtogen(alpha)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":14166
 *         if _have_alpha:
 *             alpha = objtogen(alpha)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 14166, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14167
 *             alpha = objtogen(alpha)
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_expr)->__pyx_base.g;
  __pyx_v__expr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":14168
 *         sig_on()
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL             # <<<<<<<<<<<<<<
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 */
  __pyx_v__alpha = NULL;

  /* "cypari/auto_gen.pxi":14169
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_alpha != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":14170
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_alpha)->__pyx_base.g;
    __pyx_v__alpha = __pyx_t_4;

    /* "cypari/auto_gen.pxi":14169
 *         cdef GEN _expr = (<Gen>expr).g
 *         cdef GEN _alpha = NULL
 *         if _have_alpha:             # <<<<<<<<<<<<<<
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":14171
 *         if _have_alpha:
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":14172
 *             _alpha = (<Gen>alpha).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = limitnum0(__pyx_v__expr, __pyx_v_k, __pyx_v__alpha, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":14173
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = limitnum0(_expr, k, _alpha, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def lindep(v, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14102
 *         return new_gen(_ret)
 * 
 *     def limitnum(expr, long k=0, alpha=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lagrange-Zagier numerical extrapolation of :emphasis:`expr`, corresponding to a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.limitnum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alpha);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14175
 *         return new_gen(_ret)
 * 
 *     def lindep(v, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a small non-trivial integral linear
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_793lindep(PyObject *__pyx_v_v, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_792lindep[] = "\n        finds a small non-trivial integral linear\n        combination between components of :math:`v`. If none can be found return an empty\n        vector.\n        \n        If :math:`v` is a vector with real/complex entries we use a floating point\n        (variable precision) LLL algorithm. If :math:`flag = 0` the accuracy is chosen\n        internally using a crude heuristic. If :math:`flag > 0` the computation is done with\n        an accuracy of :math:`flag` decimal digits. To get meaningful results in the latter\n        case, the parameter :math:`flag` should be smaller than the number of correct\n        decimal digits in the input.\n        \n        ::\n        \n            ? lindep([sqrt(2), sqrt(3), sqrt(2)+sqrt(3)])\n            %1 = [-1, -1, 1]~\n        \n        If :math:`v` is :math:`p`-adic, :math:`flag` is ignored and the algorithm LLL-reduces a\n        suitable (dual) lattice.\n        \n        ::\n        \n            ? lindep([1, 2 + 3 + 3^2 + 3^3 + 3^4 + O(3^5)])\n            %2 = [1, -2]~\n        \n        If :math:`v` is a matrix (or a vector of column vectors, or a vector of row\n        vectors), :math:`flag` is ignored and the function returns a non trivial kernel\n        vector if one exists, else an empty vector.\n        \n        ::\n        \n            ? lindep([1,2,3;4,5,6;7,8,9])\n            %3 = [1, -2, 1]~\n            ? lindep([[1,0], [2,0]])\n            %4 = [2, -1]~\n            ? lindep([[1,0], [0,1]])\n            %5 = []~\n        \n        If :math:`v` contains polynomials or power series over some base field, finds a\n        linear relation with coefficients in the field.\n        \n        ::\n        \n            ? lindep([x*y, x^2 + y, x^2*y + x*y^2, 1])\n            %4 = [y, y, -1, -y^2]~\n        \n        For better control, it is preferable to use :literal:`t_POL` rather\n        than :literal:`t_SER` in the input, otherwise one gets a linear combination which is\n        :math:`t`-adically small, ""but not necessarily :math:`0`. Indeed, power series are first\n        converted to the minimal absolute accuracy occurring among the entries of :math:`v`\n        (which can cause some coefficients to be ignored), then truncated to\n        polynomials:\n        \n        ::\n        \n            ? v = [t^2+O(t^4), 1+O(t^2)]; L=lindep(v)\n            %1 = [1, 0]~\n            ? v*L\n            %2 = t^2+O(t^4) \\\\ small but not 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_793lindep(PyObject *__pyx_v_v, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lindep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lindep") < 0)) __PYX_ERR(10, 14175, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14175, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lindep", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14175, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lindep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_792lindep(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_v), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_792lindep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v, long __pyx_v_flag) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lindep", 0);

  /* "cypari/auto_gen.pxi":14236
 *             %2 = t^2+O(t^4) \\ small but not 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = lindep0(_v, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14236, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14237
 *         '''
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = lindep0(_v, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14238
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = lindep0(_v, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = lindep0(__pyx_v__v, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":14239
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = lindep0(_v, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def listinsert(L, x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14175
 *         return new_gen(_ret)
 * 
 *     def lindep(v, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a small non-trivial integral linear
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lindep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14241
 *         return new_gen(_ret)
 * 
 *     def listinsert(L, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inserts the object :math:`x` at
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_795listinsert(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_794listinsert[] = "\n        Inserts the object :math:`x` at\n        position :math:`n` in :math:`L` (which must be of type :literal:`t_LIST`). This has\n        complexity :math:`O(\\#L - n + 1)`: all the\n        remaining elements of :emphasis:`list` (from position :math:`n+1` onwards) are shifted\n        to the right.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_795listinsert(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listinsert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("listinsert", 1, 2, 2, 1); __PYX_ERR(10, 14241, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listinsert") < 0)) __PYX_ERR(10, 14241, __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_x = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14241, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listinsert", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14241, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.listinsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_794listinsert(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_x, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_794listinsert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__L;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("listinsert", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":14249
 *         to the right.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":14250
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 14250, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14251
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listinsert(_L, _x, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14252
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = listinsert(_L, _x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14253
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listinsert(_L, _x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = listinsert(__pyx_v__L, __pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":14254
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listinsert(_L, _x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def listkill(L):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14241
 *         return new_gen(_ret)
 * 
 *     def listinsert(L, x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Inserts the object :math:`x` at
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.listinsert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14256
 *         return new_gen(_ret)
 * 
 *     def listkill(L):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, retained for backward compatibility. Just use :literal:`L = List()`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_797listkill(PyObject *__pyx_v_L, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_796listkill[] = "\n        Obsolete, retained for backward compatibility. Just use :literal:`L = List()`\n        instead of :literal:`listkill(L)`. In most cases, you won't even need that, e.g.\n        local variables are automatically cleared when a user function returns.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_797listkill(PyObject *__pyx_v_L, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listkill (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_796listkill(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_796listkill(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__L;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("listkill", 0);

  /* "cypari/auto_gen.pxi":14262
 *         local variables are automatically cleared when a user function returns.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14262, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14263
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14264
 *         from warnings import warn
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         listkill(_L)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 14264, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14265
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         listkill(_L)
 *         clear_stack()
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_4;

  /* "cypari/auto_gen.pxi":14266
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         listkill(_L)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  listkill(__pyx_v__L);

  /* "cypari/auto_gen.pxi":14267
 *         cdef GEN _L = (<Gen>L).g
 *         listkill(_L)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def listpop(list, long n=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":14256
 *         return new_gen(_ret)
 * 
 *     def listkill(L):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, retained for backward compatibility. Just use :literal:`L = List()`
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.listkill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14269
 *         clear_stack()
 * 
 *     def listpop(list, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the :math:`n`-th element of the list
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_799listpop(PyObject *__pyx_v_list, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_798listpop[] = "\n        Removes the :math:`n`-th element of the list\n        :emphasis:`list` (which must be of type :literal:`t_LIST`). If :math:`n` is omitted,\n        or greater than the list current length, removes the last element.\n        If the list is already empty, do nothing. This runs in time :math:`O(\\#L - n + 1)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_799listpop(PyObject *__pyx_v_list, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listpop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listpop") < 0)) __PYX_ERR(10, 14269, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14269, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listpop", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14269, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.listpop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_798listpop(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_list), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_798listpop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_list, long __pyx_v_n) {
  GEN __pyx_v__list;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  __Pyx_RefNannySetupContext("listpop", 0);

  /* "cypari/auto_gen.pxi":14276
 *         If the list is already empty, do nothing. This runs in time :math:`O(\#L - n + 1)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         listpop0(_list, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14276, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14277
 *         '''
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         listpop0(_list, n)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14278
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 *         listpop0(_list, n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  listpop0(__pyx_v__list, __pyx_v_n);

  /* "cypari/auto_gen.pxi":14279
 *         cdef GEN _list = (<Gen>list).g
 *         listpop0(_list, n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def listput(list, x, long n=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":14269
 *         clear_stack()
 * 
 *     def listpop(list, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the :math:`n`-th element of the list
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.listpop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14281
 *         clear_stack()
 * 
 *     def listput(list, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sets the :math:`n`-th element of the list
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_801listput(PyObject *__pyx_v_list, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_800listput[] = "\n        Sets the :math:`n`-th element of the list\n        :emphasis:`list` (which must be of type :literal:`t_LIST`) equal to :math:`x`. If :math:`n` is omitted,\n        or greater than the list length, appends :math:`x`. The function returns the\n        inserted element.\n        \n        ::\n        \n            ? L = List();\n            ? listput(L, 1)\n            %2 = 1\n            ? listput(L, 2)\n            %3 = 2\n            ? L\n            %4 = List([1, 2])\n        \n        You may put an element into an occupied cell (not changing the\n        list length), but it is easier to use the standard :literal:`list[n] = x`\n        construct.\n        \n        ::\n        \n            ? listput(L, 3, 1) \\\\ insert at position 1\n            %5 = 3\n            ? L\n            %6 = List([3, 2])\n            ? L[2] = 4 \\\\ simpler\n            %7 = List([3, 4])\n            ? L[10] = 1 \\\\ can't insert beyond the end of the list\n             *** at top-level: L[10]=1\n             *** ^------\n             *** non-existent component: index > 2\n            ? listput(L, 1, 10) \\\\ but listput can\n            %8 = 1\n            ? L\n            %9 = List([3, 2, 1])\n        \n        This function runs in time :math:`O(\\#L)` in the worst case (when the list must\n        be reallocated), but in time :math:`O(1)` on average: any number of successive\n        :literal:`listput`\302\240s run in time :math:`O(\\#L)`, where :math:`\\#L` denotes the list\n        :emphasis:`final` length.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_801listput(PyObject *__pyx_v_list, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listput (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_n,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listput") < 0)) __PYX_ERR(10, 14281, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14281, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listput", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14281, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.listput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_800listput(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_list), __pyx_v_x, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_800listput(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_list, PyObject *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__list;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("listput", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":14324
 *         :emphasis:`final` length.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":14325
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 14325, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14326
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listput0(_list, _x, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14327
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = listput0(_list, _x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14328
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listput0(_list, _x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = listput0(__pyx_v__list, __pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":14329
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = listput0(_list, _x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def listsort(L, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14281
 *         clear_stack()
 * 
 *     def listput(list, x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sets the :math:`n`-th element of the list
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.listput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14331
 *         return new_gen(_ret)
 * 
 *     def listsort(L, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the :literal:`t_LIST` :emphasis:`list` in place, with respect to the (somewhat
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_803listsort(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_802listsort[] = "\n        Sorts the :literal:`t_LIST` :emphasis:`list` in place, with respect to the (somewhat\n        arbitrary) universal comparison function :literal:`cmp`. In particular, the\n        ordering is the same as for sets and :literal:`setsearch` can be used on a sorted\n        list.\n        \n        ::\n        \n            ? L = List([1,2,4,1,3,-1]); listsort(L); L\n            %1 = List([-1, 1, 1, 2, 3, 4])\n            ? setsearch(L, 4)\n            %2 = 6\n            ? setsearch(L, -2)\n            %3 = 0\n        \n        This is faster than the :literal:`vecsort` command since the list\n        is sorted in place: no copy is made. No value returned.\n        \n        If :math:`flag` is non-zero, suppresses all repeated coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_803listsort(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("listsort (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "listsort") < 0)) __PYX_ERR(10, 14331, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14331, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("listsort", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14331, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.listsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_802listsort(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_802listsort(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_flag) {
  GEN __pyx_v__L;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  __Pyx_RefNannySetupContext("listsort", 0);

  /* "cypari/auto_gen.pxi":14352
 *         If :math:`flag` is non-zero, suppresses all repeated coefficients.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         listsort(_L, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14352, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14353
 *         '''
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         listsort(_L, flag)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14354
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         listsort(_L, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  listsort(__pyx_v__L, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":14355
 *         cdef GEN _L = (<Gen>L).g
 *         listsort(_L, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def lngamma(x, long precision=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":14331
 *         return new_gen(_ret)
 * 
 *     def listsort(L, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the :literal:`t_LIST` :emphasis:`list` in place, with respect to the (somewhat
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.listsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14357
 *         clear_stack()
 * 
 *     def lngamma(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the logarithm of the gamma function of :math:`x`. This
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_805lngamma(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_804lngamma[] = "\n        Principal branch of the logarithm of the gamma function of :math:`x`. This\n        function is analytic on the complex plane with non-positive integers\n        removed, and can have much larger arguments than :literal:`gamma` itself.\n        \n        For :math:`x` a power series such that :math:`x(0)` is not a pole of :literal:`gamma`,\n        compute the Taylor expansion. (PARI only knows about regular power series\n        and can't include logarithmic terms.)\n        \n        ::\n        \n            ? lngamma(1+x+O(x^2))\n            %1 = -0.57721566490153286060651209008240243104*x + O(x^2)\n            ? lngamma(x+O(x^2))\n             *** at top-level: lngamma(x+O(x^2))\n             *** ^-----------------\n             *** lngamma: domain error in lngamma: valuation != 0\n            ? lngamma(-1+x+O(x^2))\n             *** lngamma: Warning: normalizing a series with 0 leading term.\n             *** at top-level: lngamma(-1+x+O(x^2))\n             *** ^--------------------\n             *** lngamma: domain error in intformal: residue(series, pole) != 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_805lngamma(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lngamma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lngamma") < 0)) __PYX_ERR(10, 14357, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14357, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lngamma", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14357, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.lngamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_804lngamma(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_804lngamma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lngamma", 0);

  /* "cypari/auto_gen.pxi":14381
 *              *** lngamma: domain error in intformal: residue(series, pole) != 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14381, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14382
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glngamma(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14383
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glngamma(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":14384
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glngamma(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glngamma(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":14385
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glngamma(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def log(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14357
 *         clear_stack()
 * 
 *     def lngamma(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the logarithm of the gamma function of :math:`x`. This
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.lngamma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14387
 *         return new_gen(_ret)
 * 
 *     def log(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the natural logarithm of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_807log(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_806log[] = "\n        Principal branch of the natural logarithm of\n        :math:`x \\in \\mathbb{C}^*`, i.e.\302\240such that :math:`\\Im (\\log (x))\\in ]-\\pi,\\pi]`.\n        The branch cut lies\n        along the negative real axis, continuous with quadrant 2, i.e.\302\240such that\n        :math:`\\lim_{b\\to 0^+} \\log (a+bi) = \\log a` for :math:`a \\in\\mathbb{R}^*`. The result is complex\n        (with imaginary part equal to :math:`\\pi`) if :math:`x\\in \\mathbb{R}` and :math:`x < 0`. In general,\n        the algorithm uses the formula\n        \n        .. MATH::\n        \n            \\log (x) ~ (\\pi)/(2agm(1, 4/s)) - m \\log 2,\n        \n        if :math:`s = x 2^m` is large enough. (The result is exact to :math:`B` bits provided\n        :math:`s > 2^{B/2}`.) At low accuracies, the series expansion near :math:`1` is used.\n        \n        :math:`p`-adic arguments are also accepted for :math:`x`, with the convention that\n        :math:`\\log (p) = 0`. Hence in particular :math:`\\exp (\\log (x))/x` is not in general equal to\n        1 but to a :math:`(p-1)`-th root of unity (or :math:`\302\2611` if :math:`p = 2`) times a power of :math:`p`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_807log(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "log") < 0)) __PYX_ERR(10, 14387, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14387, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14387, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_806log(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_806log(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("log", 0);

  /* "cypari/auto_gen.pxi":14408
 *         1 but to a :math:`(p-1)`-th root of unity (or :math:`1` if :math:`p = 2`) times a power of :math:`p`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14408, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14409
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14410
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glog(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":14411
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glog(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":14412
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def log1p(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14387
 *         return new_gen(_ret)
 * 
 *     def log(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the natural logarithm of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.log", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14414
 *         return new_gen(_ret)
 * 
 *     def log1p(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\log (1+x)`, computed in a way that is also accurate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_809log1p(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_808log1p[] = "\n        Return :math:`\\log (1+x)`, computed in a way that is also accurate\n        when the real part of :math:`x` is near :math:`0`. This is the reciprocal function\n        of :literal:`expm1`:math:`(x) = \\exp (x)-1`.\n        \n        ::\n        \n            ? default(realprecision, 10000); x = Pi*1e-100;\n            ? (expm1(log1p(x)) - x) / x\n            %2 = -7.668242895059371866 E-10019\n            ? (log1p(expm1(x)) - x) / x\n            %3 = -7.668242895059371866 E-10019\n        \n        When :math:`x` is small, this function is both faster and more\n        accurate than :math:`\\log (1+x)`:\n        \n        ::\n        \n            ? \\p38\n            ? x = 1e-20;\n            ? localprec(100); c = log1p(x); \\\\ reference point\n            ? a = log1p(x); abs((a - c)/c)\n            %6 = 0.E-38\n            ? b = log(1+x); abs((b - c)/c) \\\\ slightly less accurate\n            %7 = 1.5930919111324522770 E-38\n            ? for (i=1,10^5,log1p(x))\n            time = 81 ms.\n            ? for (i=1,10^5,log(1+x))\n            time = 100 ms. \\\\ slower, too\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_809log1p(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("log1p (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "log1p") < 0)) __PYX_ERR(10, 14414, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14414, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("log1p", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14414, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.log1p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_808log1p(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_808log1p(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("log1p", 0);

  /* "cypari/auto_gen.pxi":14445
 *             time = 100 ms. \\ slower, too
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14445, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14446
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog1p(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14447
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = glog1p(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":14448
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog1p(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = glog1p(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":14449
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = glog1p(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mapdelete(M, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14414
 *         return new_gen(_ret)
 * 
 *     def log1p(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return :math:`\log (1+x)`, computed in a way that is also accurate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.log1p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14451
 *         return new_gen(_ret)
 * 
 *     def mapdelete(M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes :math:`x` from the domain of the map :math:`M`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_811mapdelete(PyObject *__pyx_v_M, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_810mapdelete[] = "\n        Removes :math:`x` from the domain of the map :math:`M`.\n        \n        ::\n        \n            ? M = Map([\"a\",1; \"b\",3; \"c\",7]);\n            ? mapdelete(M,\"b\");\n            ? Mat(M)\n            [\"a\" 1]\n            \n            [\"c\" 7]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_811mapdelete(PyObject *__pyx_v_M, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mapdelete (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_810mapdelete(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_810mapdelete(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_x) {
  GEN __pyx_v__M;
  GEN __pyx_v__x;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mapdelete", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":14464
 *             ["c" 7]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":14465
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 14465, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14466
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         mapdelete(_M, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14467
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         mapdelete(_M, _x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14468
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 *         mapdelete(_M, _x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  mapdelete(__pyx_v__M, __pyx_v__x);

  /* "cypari/auto_gen.pxi":14469
 *         cdef GEN _x = (<Gen>x).g
 *         mapdelete(_M, _x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def mapget(M, x):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":14451
 *         return new_gen(_ret)
 * 
 *     def mapdelete(M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes :math:`x` from the domain of the map :math:`M`.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mapdelete", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14471
 *         clear_stack()
 * 
 *     def mapget(M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the image of :math:`x` by the map :math:`M`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_813mapget(PyObject *__pyx_v_M, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_812mapget[] = "\n        Returns the image of :math:`x` by the map :math:`M`.\n        \n        ::\n        \n            ? M=Map([\"a\",23;\"b\",43]);\n            ? mapget(M,\"a\")\n            %2 = 23\n            ? mapget(M,\"b\")\n            %3 = 43\n        \n        Raises an exception when the key :math:`x` is not present in :math:`M`.\n        \n        ::\n        \n            ? mapget(M,\"c\")\n             *** at top-level: mapget(M,\"c\")\n             *** ^-------------\n             *** mapget: non-existent component in mapget: index not in map\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_813mapget(PyObject *__pyx_v_M, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mapget (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_812mapget(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_812mapget(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_x) {
  GEN __pyx_v__M;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mapget", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":14492
 *              *** mapget: non-existent component in mapget: index not in map
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":14493
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 14493, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14494
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = mapget(_M, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14495
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mapget(_M, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14496
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = mapget(_M, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mapget(__pyx_v__M, __pyx_v__x);

  /* "cypari/auto_gen.pxi":14497
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = mapget(_M, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mapput(M, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14497, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14471
 *         clear_stack()
 * 
 *     def mapget(M, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the image of :math:`x` by the map :math:`M`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mapget", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14499
 *         return new_gen(_ret)
 * 
 *     def mapput(M, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Associates :math:`x` to :math:`y` in the map :math:`M`. The value :math:`y` can be retrieved
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_815mapput(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_814mapput[] = "\n        Associates :math:`x` to :math:`y` in the map :math:`M`. The value :math:`y` can be retrieved\n        with :literal:`mapget`.\n        \n        ::\n        \n            ? M = Map();\n            ? mapput(M, \"foo\", 23);\n            ? mapput(M, 7718, \"bill\");\n            ? mapget(M, \"foo\")\n            %4 = 23\n            ? mapget(M, 7718)\n            %5 = \"bill\"\n            ? Vec(M) \\\\ keys\n            %6 = [7718, \"foo\"]\n            ? Mat(M)\n            %7 =\n            [ 7718 \"bill\"]\n            \n            [\"foo\" 23]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_815mapput(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mapput (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mapput", 1, 2, 2, 1); __PYX_ERR(10, 14499, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mapput") < 0)) __PYX_ERR(10, 14499, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mapput", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14499, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mapput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_814mapput(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_814mapput(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__M;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mapput", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":14521
 *             ["foo" 23]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":14522
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":14523
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 14523, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14524
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14525
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         mapput(_M, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14526
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         mapput(_M, _x, _y)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14527
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         mapput(_M, _x, _y)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  mapput(__pyx_v__M, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":14528
 *         cdef GEN _y = (<Gen>y).g
 *         mapput(_M, _x, _y)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def matadjoint(M, long flag=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":14499
 *         return new_gen(_ret)
 * 
 *     def mapput(M, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Associates :math:`x` to :math:`y` in the map :math:`M`. The value :math:`y` can be retrieved
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mapput", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14530
 *         clear_stack()
 * 
 *     def matadjoint(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         adjoint matrix of :math:`M`, i.e.a matrix :math:`N`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_817matadjoint(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_816matadjoint[] = "\n        adjoint matrix of :math:`M`, i.e.\302\240a matrix :math:`N`\n        of cofactors of :math:`M`, satisfying :math:`M*N = \\det (M)*\\mathrm{Id}`. :math:`M` must be a\n        (non-necessarily invertible) square matrix of dimension :math:`n`.\n        If :math:`flag` is 0 or omitted, we try to use Leverrier-Faddeev's algorithm,\n        which assumes that :math:`n!` invertible. If it fails or :math:`flag = 1`,\n        compute :math:`T = charpoly (M)` independently first and return\n        :math:`(-1)^{n-1} (T(x)-T(0))/x` evaluated at :math:`M`.\n        \n        ::\n        \n            ? a = [1,2,3;3,4,5;6,7,8] * Mod(1,4);\n            %2 =\n            [Mod(1, 4) Mod(2, 4) Mod(3, 4)]\n            \n            [Mod(3, 4) Mod(0, 4) Mod(1, 4)]\n            \n            [Mod(2, 4) Mod(3, 4) Mod(0, 4)]\n        \n        Both algorithms use :math:`O(n^4)` operations in the base ring, and are usually\n        slower than computing the characteristic polynomial or the inverse of :math:`M`\n        directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_817matadjoint(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matadjoint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matadjoint") < 0)) __PYX_ERR(10, 14530, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14530, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matadjoint", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14530, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matadjoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_816matadjoint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_816matadjoint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matadjoint", 0);

  /* "cypari/auto_gen.pxi":14554
 *         directly.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matadjoint0(_M, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14554, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14555
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matadjoint0(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14556
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matadjoint0(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matadjoint0(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":14557
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matadjoint0(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matalgtobasis(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14530
 *         clear_stack()
 * 
 *     def matadjoint(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         adjoint matrix of :math:`M`, i.e.a matrix :math:`N`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matadjoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14559
 *         return new_gen(_ret)
 * 
 *     def matalgtobasis(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_819matalgtobasis(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_818matalgtobasis[] = "\n        This function is deprecated, use :literal:`apply`.\n        \n        :math:`nf` being a number field in :literal:`nfinit` format, and :math:`x` a\n        (row or column) vector or matrix, apply :literal:`nfalgtobasis` to each entry\n        of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_819matalgtobasis(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matalgtobasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_818matalgtobasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_818matalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("matalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":14567
 *         of :math:`x`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14567, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14568
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14569
 *         from warnings import warn
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14570
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 14570, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14571
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matalgtobasis(_nf, _x)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":14572
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matalgtobasis(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":14573
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matalgtobasis(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matalgtobasis(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":14574
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matalgtobasis(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matbasistoalg(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14559
 *         return new_gen(_ret)
 * 
 *     def matalgtobasis(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14576
 *         return new_gen(_ret)
 * 
 *     def matbasistoalg(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_821matbasistoalg(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_820matbasistoalg[] = "\n        This function is deprecated, use :literal:`apply`.\n        \n        :math:`nf` being a number field in :literal:`nfinit` format, and :math:`x` a\n        (row or column) vector or matrix, apply :literal:`nfbasistoalg` to each entry\n        of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_821matbasistoalg(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matbasistoalg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_820matbasistoalg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_820matbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("matbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":14584
 *         of :math:`x`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14584, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14585
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14586
 *         from warnings import warn
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":14587
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 14587, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14588
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matbasistoalg(_nf, _x)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":14589
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matbasistoalg(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":14590
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matbasistoalg(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matbasistoalg(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":14591
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matbasistoalg(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matcompanion(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 14591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14576
 *         return new_gen(_ret)
 * 
 *     def matbasistoalg(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is deprecated, use :literal:`apply`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14593
 *         return new_gen(_ret)
 * 
 *     def matcompanion(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The left companion matrix to the non-zero polynomial :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_823matcompanion(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_822matcompanion[] = "\n        The left companion matrix to the non-zero polynomial :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_823matcompanion(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matcompanion (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_822matcompanion(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_822matcompanion(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matcompanion", 0);

  /* "cypari/auto_gen.pxi":14597
 *         The left companion matrix to the non-zero polynomial :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matcompanion(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14597, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14598
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matcompanion(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14599
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matcompanion(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matcompanion(__pyx_v__x);

  /* "cypari/auto_gen.pxi":14600
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matcompanion(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matconcat(v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14593
 *         return new_gen(_ret)
 * 
 *     def matcompanion(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The left companion matrix to the non-zero polynomial :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matcompanion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14602
 *         return new_gen(_ret)
 * 
 *     def matconcat(v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a :literal:`t_MAT` built from the entries of :math:`v`, which may
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_825matconcat(PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_824matconcat[] = "\n        Returns a :literal:`t_MAT` built from the entries of :math:`v`, which may\n        be a :literal:`t_VEC` (concatenate horizontally), a :literal:`t_COL` (concatenate\n        vertically), or a :literal:`t_MAT` (concatenate vertically each column, and\n        concatenate vertically the resulting matrices). The entries of :math:`v` are always\n        considered as matrices: they can themselves be :literal:`t_VEC` (seen as a row\n        matrix), a :literal:`t_COL` seen as a column matrix), a :literal:`t_MAT`, or a scalar (seen\n        as an :math:`1 x 1` matrix).\n        \n        ::\n        \n            ? A=[1,2;3,4]; B=[5,6]~; C=[7,8]; D=9;\n            ? matconcat([A, B]) \\\\ horizontal\n            %1 =\n            [1 2 5]\n            \n            [3 4 6]\n            ? matconcat([A, C]~) \\\\ vertical\n            %2 =\n            [1 2]\n            \n            [3 4]\n            \n            [7 8]\n            ? matconcat([A, B; C, D]) \\\\ block matrix\n            %3 =\n            [1 2 5]\n            \n            [3 4 6]\n            \n            [7 8 9]\n        \n        If the dimensions of the entries to concatenate do not match up, the above\n        rules are extended as follows:\n        \n        - each entry :math:`v_{i,j}` of :math:`v` has a natural length and height: :math:`1 x\n          1` for a scalar, :math:`1 x n` for a :literal:`t_VEC` of length :math:`n`, :math:`n x 1`\n          for a :literal:`t_COL`, :math:`m x n` for an :math:`m x n` :literal:`t_MAT`\n        \n        - let :math:`H_i` be the maximum over :math:`j` of the lengths of the :math:`v_{i,j}`,\n          let :math:`L_j` be the maximum over :math:`i` of the heights of the :math:`v_{i,j}`.\n          The dimensions of the :math:`(i,j)`-th block in the concatenated matrix are\n          :math:`H_i x L_j`.\n        \n        - a scalar :math:`s = v_{i,j}` is considered as :math:`s` times an identity matrix\n          of the block dimension :math:`\\min (H""_i,L_j)`\n        \n        - blocks are extended by 0 columns on the right and 0 rows at the\n          bottom, as needed.\n        \n        ::\n        \n            ? matconcat([1, [2,3]~, [4,5,6]~]) \\\\ horizontal\n            %4 =\n            [1 2 4]\n            \n            [0 3 5]\n            \n            [0 0 6]\n            ? matconcat([1, [2,3], [4,5,6]]~) \\\\ vertical\n            %5 =\n            [1 0 0]\n            \n            [2 3 0]\n            \n            [4 5 6]\n            ? matconcat([B, C; A, D]) \\\\ block matrix\n            %6 =\n            [5 0 7 8]\n            \n            [6 0 0 0]\n            \n            [1 2 9 0]\n            \n            [3 4 0 9]\n            ? U=[1,2;3,4]; V=[1,2,3;4,5,6;7,8,9];\n            ? matconcat(matdiagonal([U, V])) \\\\ block diagonal\n            %7 =\n            [1 2 0 0 0]\n            \n            [3 4 0 0 0]\n            \n            [0 0 1 2 3]\n            \n            [0 0 4 5 6]\n            \n            [0 0 7 8 9]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_825matconcat(PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matconcat (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_824matconcat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_824matconcat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matconcat", 0);

  /* "cypari/auto_gen.pxi":14691
 *             [0 0 7 8 9]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = matconcat(_v)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14691, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14692
 *         '''
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matconcat(_v)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14693
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = matconcat(_v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matconcat(__pyx_v__v);

  /* "cypari/auto_gen.pxi":14694
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = matconcat(_v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdet(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14602
 *         return new_gen(_ret)
 * 
 *     def matconcat(v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a :literal:`t_MAT` built from the entries of :math:`v`, which may
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matconcat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14696
 *         return new_gen(_ret)
 * 
 *     def matdet(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determinant of the square matrix :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_827matdet(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_826matdet[] = "\n        Determinant of the square matrix :math:`x`.\n        \n        If :math:`flag = 0`, uses an appropriate algorithm depending on the coefficients:\n        \n        - integer entries: modular method due to Dixon, Pernet and Stein.\n        \n        - real or :math:`p`-adic entries: classical Gaussian elimination using maximal\n          pivot.\n        \n        - intmod entries: classical Gaussian elimination using first non-zero\n          pivot.\n        \n        - other cases: Gauss-Bareiss.\n        \n        If :math:`flag = 1`, uses classical Gaussian elimination with appropriate pivoting\n        strategy (maximal pivot for real or :math:`p`-adic coefficients). This is usually\n        worse than the default.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_827matdet(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdet (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matdet") < 0)) __PYX_ERR(10, 14696, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14696, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matdet", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14696, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matdet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_826matdet(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_826matdet(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matdet", 0);

  /* "cypari/auto_gen.pxi":14716
 *         worse than the default.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = det0(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14716, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14717
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = det0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14718
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = det0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = det0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":14719
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = det0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdetint(B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14696
 *         return new_gen(_ret)
 * 
 *     def matdet(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determinant of the square matrix :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matdet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14721
 *         return new_gen(_ret)
 * 
 *     def matdetint(B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`B` be an :math:`m x n` matrix with integer coefficients. The
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_829matdetint(PyObject *__pyx_v_B, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_828matdetint[] = "\n        Let :math:`B` be an :math:`m x n` matrix with integer coefficients. The\n        :emphasis:`determinant` :math:`D` of the lattice generated by the columns of :math:`B` is\n        the square root of :math:`\\det (B^T B)` if :math:`B` has maximal rank :math:`m`, and :math:`0`\n        otherwise.\n        \n        This function uses the Gauss-Bareiss algorithm to compute a positive\n        :emphasis:`multiple` of :math:`D`. When :math:`B` is square, the function actually returns\n        :math:`D = \\|\\det B\\|`.\n        \n        This function is useful in conjunction with :literal:`mathnfmod`, which needs to\n        know such a multiple. If the rank is maximal and the matrix non-square,\n        you can obtain :math:`D` exactly using\n        \n        ::\n        \n             matdet( mathnfmod(B, matdetint(B)) )\n        \n        Note that as soon as one of the dimensions gets large (:math:`m` or :math:`n` is larger\n        than 20, say), it will often be much faster to use :literal:`mathnf(B, 1)` or\n        :literal:`mathnf(B, 4)` directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_829matdetint(PyObject *__pyx_v_B, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdetint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_828matdetint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_B));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_828matdetint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_B) {
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matdetint", 0);

  /* "cypari/auto_gen.pxi":14744
 *         :literal:`mathnf(B, 4)` directly.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = detint(_B)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14744, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14745
 *         '''
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = detint(_B)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14746
 *         sig_on()
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = detint(_B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = detint(__pyx_v__B);

  /* "cypari/auto_gen.pxi":14747
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = detint(_B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdetmod(x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14747, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14721
 *         return new_gen(_ret)
 * 
 *     def matdetint(B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`B` be an :math:`m x n` matrix with integer coefficients. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matdetint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14749
 *         return new_gen(_ret)
 * 
 *     def matdetmod(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` with :literal:`t_INT` entries and :math:`d` an arbitrary positive
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_831matdetmod(PyObject *__pyx_v_x, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_830matdetmod[] = "\n        Given a matrix :math:`x` with :literal:`t_INT` entries and :math:`d` an arbitrary positive\n        integer, return the determinant of :math:`x` modulo :math:`d`.\n        \n        ::\n        \n            ? A = [4,2,3; 4,5,6; 7,8,9]\n            \n            ? matdetmod(A,27)\n            %2 = 9\n        \n        Note that using the generic function :literal:`matdet` on a matrix with\n        :literal:`t_INTMOD` entries uses Gaussian reduction and will fail in general when\n        the modulus is not prime.\n        \n        ::\n        \n            ? matdet(A * Mod(1,27))\n             *** at top-level: matdet(A*Mod(1,27))\n             *** ^------------------\n             *** matdet: impossible inverse in Fl_inv: Mod(3, 27).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_831matdetmod(PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdetmod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_830matdetmod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_d));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_830matdetmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matdetmod", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":14772
 *              *** matdet: impossible inverse in Fl_inv: Mod(3, 27).
 *         '''
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":14773
 *         '''
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 14773, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14774
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matdetmod(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14775
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matdetmod(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_gen.pxi":14776
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matdetmod(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matdetmod(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_gen.pxi":14777
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matdetmod(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matdiagonal(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 14777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14749
 *         return new_gen(_ret)
 * 
 *     def matdetmod(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` with :literal:`t_INT` entries and :math:`d` an arbitrary positive
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matdetmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14779
 *         return new_gen(_ret)
 * 
 *     def matdiagonal(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector, creates the diagonal matrix
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_833matdiagonal(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_832matdiagonal[] = "\n        :math:`x` being a vector, creates the diagonal matrix\n        whose diagonal entries are those of :math:`x`.\n        \n        ::\n        \n            ? matdiagonal([1,2,3]);\n            %1 =\n            [1 0 0]\n            \n            [0 2 0]\n            \n            [0 0 3]\n        \n        Block diagonal matrices are easily created using\n        :literal:`matconcat`:\n        \n        ::\n        \n            ? U=[1,2;3,4]; V=[1,2,3;4,5,6;7,8,9];\n            ? matconcat(matdiagonal([U, V]))\n            %1 =\n            [1 2 0 0 0]\n            \n            [3 4 0 0 0]\n            \n            [0 0 1 2 3]\n            \n            [0 0 4 5 6]\n            \n            [0 0 7 8 9]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_833matdiagonal(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matdiagonal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_832matdiagonal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_832matdiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matdiagonal", 0);

  /* "cypari/auto_gen.pxi":14812
 *             [0 0 7 8 9]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = diagonal(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14812, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14813
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = diagonal(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14814
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = diagonal(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = diagonal(__pyx_v__x);

  /* "cypari/auto_gen.pxi":14815
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = diagonal(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mateigen(x, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14815, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14779
 *         return new_gen(_ret)
 * 
 *     def matdiagonal(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector, creates the diagonal matrix
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matdiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14817
 *         return new_gen(_ret)
 * 
 *     def mateigen(x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the (complex) eigenvectors of :math:`x` as columns of a matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_835mateigen(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_834mateigen[] = "\n        Returns the (complex) eigenvectors of :math:`x` as columns of a matrix.\n        If :math:`flag = 1`, return :math:`[L,H]`, where :math:`L` contains the\n        eigenvalues and :math:`H` the corresponding eigenvectors; multiple eigenvalues are\n        repeated according to the eigenspace dimension (which may be less\n        than the eigenvalue multiplicity in the characteristic polynomial).\n        \n        This function first computes the characteristic polynomial of :math:`x` and\n        approximates its complex roots :math:`(\\lambda_i)`, then tries to compute the\n        eigenspaces as kernels of the :math:`x - \\lambda_i`. This algorithm is\n        ill-conditioned and is likely to miss kernel vectors if some roots of the\n        characteristic polynomial are close, in particular if it has multiple roots.\n        \n        ::\n        \n            ? A = [13,2; 10,14]; mateigen(A)\n            %1 =\n            [-1/2 2/5]\n            \n            [ 1 1]\n            ? [L,H] = mateigen(A, 1);\n            ? L\n            %3 = [9, 18]\n            ? H\n            %4 =\n            [-1/2 2/5]\n            \n            [ 1 1]\n        \n        For symmetric matrices, use :literal:`qfjacobi` instead; for Hermitian matrices,\n        compute\n        \n        ::\n        \n             A = real(x);\n             B = imag(x);\n             y = matconcat([A, -B; B, A]);\n        \n        and apply :literal:`qfjacobi` to :math:`y`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_835mateigen(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mateigen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mateigen") < 0)) __PYX_ERR(10, 14817, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14817, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14817, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mateigen", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14817, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mateigen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_834mateigen(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_834mateigen(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mateigen", 0);

  /* "cypari/auto_gen.pxi":14858
 *         and apply :literal:`qfjacobi` to :math:`y`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14858, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14859
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mateigen(_x, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14860
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mateigen(_x, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":14861
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mateigen(_x, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mateigen(__pyx_v__x, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":14862
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mateigen(_x, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matfrobenius(M, long flag=0, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14817
 *         return new_gen(_ret)
 * 
 *     def mateigen(x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the (complex) eigenvectors of :math:`x` as columns of a matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mateigen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14864
 *         return new_gen(_ret)
 * 
 *     def matfrobenius(M, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Frobenius form of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_837matfrobenius(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_836matfrobenius[] = "\n        Returns the Frobenius form of\n        the square matrix :literal:`M`. If :math:`flag = 1`, returns only the elementary divisors as\n        a vector of polynomials in the variable :literal:`v`. If :math:`flag = 2`, returns a\n        two-components vector [F,B] where :literal:`F` is the Frobenius form and :literal:`B` is\n        the basis change so that :math:`M = B^{-1}FB`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_837matfrobenius(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matfrobenius (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matfrobenius") < 0)) __PYX_ERR(10, 14864, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14864, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matfrobenius", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14864, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_836matfrobenius(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_flag, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_836matfrobenius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("matfrobenius", 0);

  /* "cypari/auto_gen.pxi":14872
 *         the basis change so that :math:`M = B^{-1}FB`.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":14873
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":14874
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 14874, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":14873
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":14875
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 14875, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14876
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_5;

  /* "cypari/auto_gen.pxi":14877
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matfrobenius(__pyx_v__M, __pyx_v_flag, __pyx_v__v);

  /* "cypari/auto_gen.pxi":14878
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = matfrobenius(_M, flag, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathess(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 14878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14864
 *         return new_gen(_ret)
 * 
 *     def matfrobenius(M, long flag=0, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Frobenius form of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matfrobenius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14880
 *         return new_gen(_ret)
 * 
 *     def mathess(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a matrix similar to the square matrix :math:`x`, which is in upper Hessenberg
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_839mathess(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_838mathess[] = "\n        Returns a matrix similar to the square matrix :math:`x`, which is in upper Hessenberg\n        form (zero entries below the first subdiagonal).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_839mathess(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathess (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_838mathess(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_838mathess(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mathess", 0);

  /* "cypari/auto_gen.pxi":14885
 *         form (zero entries below the first subdiagonal).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hess(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 14885, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":14886
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hess(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":14887
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hess(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hess(__pyx_v__x);

  /* "cypari/auto_gen.pxi":14888
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hess(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathnf(M, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 14888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14880
 *         return new_gen(_ret)
 * 
 *     def mathess(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a matrix similar to the square matrix :math:`x`, which is in upper Hessenberg
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mathess", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":14890
 *         return new_gen(_ret)
 * 
 *     def mathnf(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`R` be a Euclidean ring, equal to :math:`\mathbb{Z}` or to :math:`K[X]` for some field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_841mathnf(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_840mathnf[] = "\n        Let :math:`R` be a Euclidean ring, equal to :math:`\\mathbb{Z}` or to :math:`K[X]` for some field\n        :math:`K`. If :math:`M` is a (not necessarily square) matrix with entries in :math:`R`, this\n        routine finds the :emphasis:`upper triangular` Hermite normal form of :math:`M`.\n        If the rank of :math:`M` is equal to its number of rows, this is a square\n        matrix. In general, the columns of the result form a basis of the :math:`R`-module\n        spanned by the columns of :math:`M`.\n        \n        The values of :math:`flag` are:\n        \n        - 0 (default): only return the Hermite normal form :math:`H`\n        \n        - 1 (complete output): return :math:`[H,U]`, where :math:`H` is the Hermite\n          normal form of :math:`M`, and :math:`U` is a transformation matrix such that :math:`MU = [0\\|H]`.\n          The matrix :math:`U` belongs to :math:`GL(R)`. When :math:`M` has a large kernel, the\n          entries of :math:`U` are in general huge.\n        \n        For these two values, we use a naive algorithm, which behaves well\n        in small dimension only. Larger values correspond to different algorithms,\n        are restricted to :emphasis:`integer` matrices, and all output the unimodular\n        matrix :math:`U`. From now on all matrices have integral entries.\n        \n        - :math:`flag = 4`, returns :math:`[H,U]` as in \"complete output\" above, using a\n          variant of LLL reduction along the way. The matrix :math:`U` is provably\n          small in the :math:`L_2` sense, and often close to optimal; but the\n          reduction is in general slow, although provably polynomial-time.\n        \n        If :math:`flag = 5`, uses Batut's algorithm and output :math:`[H,U,P]`, such that :math:`H` and\n        :math:`U` are as before and :math:`P` is a permutation of the rows such that :math:`P` applied\n        to :math:`MU` gives :math:`H`. This is in general faster than :math:`flag = 4` but the matri""x :math:`U`\n        is usually worse; it is heuristically smaller than with the default algorithm.\n        \n        When the matrix is dense and the dimension is large (bigger than 100, say),\n        :math:`flag = 4` will be fastest. When :math:`M` has maximal rank, then\n        \n        ::\n        \n             H = mathnfmod(M, matdetint(M))\n        \n        will be even faster. You can then recover :math:`U` as :math:`M^{-1}H`.\n        \n        ::\n        \n            ? M = matrix(3,4,i,j,random([-5,5]))\n            %1 =\n            [ 0 2 3 0]\n            \n            [-5 3 -5 -5]\n            \n            [ 4 3 -5 4]\n            \n            ? [H,U] = mathnf(M, 1);\n            ? U\n            %3 =\n            [-1 0 -1 0]\n            \n            [ 0 5 3 2]\n            \n            [ 0 3 1 1]\n            \n            [ 1 0 0 0]\n            \n            ? H\n            %5 =\n            [19 9 7]\n            \n            [ 0 9 1]\n            \n            [ 0 0 1]\n            \n            ? M*U\n            %6 =\n            [0 19 9 7]\n            \n            [0 0 9 1]\n            \n            [0 0 0 1]\n        \n        For convenience, :math:`M` is allowed to be a :literal:`t_VEC`, which is then\n        automatically converted to a :literal:`t_MAT`, as per the :literal:`Mat` function.\n        For instance to solve the generalized extended gcd problem, one may use\n        \n        ::\n        \n            ? v = [116085838, 181081878, 314252913,10346840];\n            ? [H,U] = mathnf(v, 1);\n            ? U\n            %2 =\n            [ 103 -603 15 -88]\n            \n            [-146 13 -1208 352]\n            \n            [ 58 220 678 -167]\n            \n            [-362 -144 381 -101]\n            ? v*U\n            %3 = [0, 0, 0, 1]\n        \n        This also allows to input a matrix as a :literal:`t_VEC` of\n        :literal:`t_COL`\302\240s of the same length (which :literal:`Mat` would concatenate to""\n        the :literal:`t_MAT` having those columns):\n        \n        ::\n        \n            ? v = [[1,0,4]~, [3,3,4]~, [0,-4,-5]~]; mathnf(v)\n            %1 =\n            [47 32 12]\n            \n            [ 0 1 0]\n            \n            [ 0 0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_841mathnf(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mathnf") < 0)) __PYX_ERR(10, 14890, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 14890, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mathnf", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 14890, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_840mathnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_840mathnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mathnf", 0);

  /* "cypari/auto_gen.pxi":15003
 *             [ 0 0 1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mathnf0(_M, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15003, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15004
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mathnf0(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15005
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mathnf0(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mathnf0(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":15006
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mathnf0(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathnfmod(x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":14890
 *         return new_gen(_ret)
 * 
 *     def mathnf(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`R` be a Euclidean ring, equal to :math:`\mathbb{Z}` or to :math:`K[X]` for some field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mathnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15008
 *         return new_gen(_ret)
 * 
 *     def mathnfmod(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a (not necessarily square) matrix of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_843mathnfmod(PyObject *__pyx_v_x, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_842mathnfmod[] = "\n        If :math:`x` is a (not necessarily square) matrix of\n        maximal rank with integer entries, and :math:`d` is a multiple of the (non-zero)\n        determinant of the lattice spanned by the columns of :math:`x`, finds the\n        :emphasis:`upper triangular` Hermite normal form of :math:`x`.\n        \n        If the rank of :math:`x` is equal to its number of rows, the result is a square\n        matrix. In general, the columns of the result form a basis of the lattice\n        spanned by the columns of :math:`x`. Even when :math:`d` is known, this is in general\n        slower than :literal:`mathnf` but uses much less memory.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_843mathnfmod(PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathnfmod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_842mathnfmod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_d));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_842mathnfmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathnfmod", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":15020
 *         slower than :literal:`mathnf` but uses much less memory.
 *         '''
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15021
 *         '''
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15021, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15022
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmod(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15023
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hnfmod(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15024
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmod(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hnfmod(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_gen.pxi":15025
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmod(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathnfmodid(x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15008
 *         return new_gen(_ret)
 * 
 *     def mathnfmod(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`x` is a (not necessarily square) matrix of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mathnfmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15027
 *         return new_gen(_ret)
 * 
 *     def mathnfmodid(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the (upper triangular)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_845mathnfmodid(PyObject *__pyx_v_x, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_844mathnfmodid[] = "\n        Outputs the (upper triangular)\n        Hermite normal form of :math:`x` concatenated with the diagonal\n        matrix with diagonal :math:`d`. Assumes that :math:`x` has integer entries.\n        Variant: if :math:`d` is an integer instead of a vector, concatenate :math:`d` times the\n        identity matrix.\n        \n        ::\n        \n            ? m=[0,7;-1,0;-1,-1]\n            %1 =\n            [ 0 7]\n            \n            [-1 0]\n            \n            [-1 -1]\n            ? mathnfmodid(m, [6,2,2])\n            %2 =\n            [2 1 1]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? mathnfmodid(m, 10)\n            %3 =\n            [10 7 3]\n            \n            [ 0 1 0]\n            \n            [ 0 0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_845mathnfmodid(PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathnfmodid (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_844mathnfmodid(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_d));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_844mathnfmodid(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathnfmodid", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":15059
 *             [ 0 0 1]
 *         '''
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15059, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15060
 *         '''
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15060, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15061
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmodid(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15062
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hnfmodid(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15063
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmodid(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hnfmodid(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_gen.pxi":15064
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = hnfmodid(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mathouseholder(Q, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15027
 *         return new_gen(_ret)
 * 
 *     def mathnfmodid(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the (upper triangular)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mathnfmodid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15066
 *         return new_gen(_ret)
 * 
 *     def mathouseholder(Q, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         applies a sequence :math:`Q` of Householder
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_847mathouseholder(PyObject *__pyx_v_Q, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_846mathouseholder[] = "\n        applies a sequence :math:`Q` of Householder\n        transforms, as returned by :literal:`matqr`:math:`(M,1)` to the vector or matrix :math:`v`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_847mathouseholder(PyObject *__pyx_v_Q, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mathouseholder (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_846mathouseholder(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Q), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_846mathouseholder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, PyObject *__pyx_v_v) {
  GEN __pyx_v__Q;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mathouseholder", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":15071
 *         transforms, as returned by :literal:`matqr`:math:`(M,1)` to the vector or matrix :math:`v`.
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15072
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15072, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15073
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mathouseholder(_Q, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15074
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mathouseholder(_Q, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15075
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mathouseholder(_Q, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mathouseholder(__pyx_v__Q, __pyx_v__v);

  /* "cypari/auto_gen.pxi":15076
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mathouseholder(_Q, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matimage(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15066
 *         return new_gen(_ret)
 * 
 *     def mathouseholder(Q, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         applies a sequence :math:`Q` of Householder
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mathouseholder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15078
 *         return new_gen(_ret)
 * 
 *     def matimage(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the image of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_849matimage(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_848matimage[] = "\n        Gives a basis for the image of the\n        matrix :math:`x` as columns of a matrix. A priori the matrix can have entries of\n        any type. If :math:`flag = 0`, use standard Gauss pivot. If :math:`flag = 1`, use\n        :literal:`matsupplement` (much slower: keep the default flag!).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_849matimage(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matimage (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matimage") < 0)) __PYX_ERR(10, 15078, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15078, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matimage", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15078, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matimage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_848matimage(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_848matimage(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matimage", 0);

  /* "cypari/auto_gen.pxi":15085
 *         :literal:`matsupplement` (much slower: keep the default flag!).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matimage0(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15085, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15086
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matimage0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15087
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matimage0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matimage0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":15088
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matimage0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matimagecompl(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15078
 *         return new_gen(_ret)
 * 
 *     def matimage(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the image of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matimage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15090
 *         return new_gen(_ret)
 * 
 *     def matimagecompl(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the column indices which
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_851matimagecompl(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_850matimagecompl[] = "\n        Gives the vector of the column indices which\n        are not extracted by the function :literal:`matimage`, as a permutation\n        (:literal:`t_VECSMALL`). Hence the number of\n        components of :literal:`matimagecompl(x)` plus the number of columns of\n        :literal:`matimage(x)` is equal to the number of columns of the matrix :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_851matimagecompl(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matimagecompl (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_850matimagecompl(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_850matimagecompl(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matimagecompl", 0);

  /* "cypari/auto_gen.pxi":15098
 *         :literal:`matimage(x)` is equal to the number of columns of the matrix :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = imagecompl(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15098, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15099
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = imagecompl(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15100
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = imagecompl(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = imagecompl(__pyx_v__x);

  /* "cypari/auto_gen.pxi":15101
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = imagecompl(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matindexrank(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15090
 *         return new_gen(_ret)
 * 
 *     def matimagecompl(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the column indices which
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matimagecompl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15103
 *         return new_gen(_ret)
 * 
 *     def matindexrank(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a matrix of rank :math:`r`, returns a vector with two
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_853matindexrank(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_852matindexrank[] = "\n        :math:`M` being a matrix of rank :math:`r`, returns a vector with two\n        :literal:`t_VECSMALL` components :math:`y` and :math:`z` of length :math:`r` giving a list of rows\n        and columns respectively (starting from 1) such that the extracted matrix\n        obtained from these two vectors using :math:`vecextract (M,y,z)` is\n        invertible. The vectors :math:`y` and :math:`z` are sorted in increasing order.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_853matindexrank(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matindexrank (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_852matindexrank(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_852matindexrank(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matindexrank", 0);

  /* "cypari/auto_gen.pxi":15111
 *         invertible. The vectors :math:`y` and :math:`z` are sorted in increasing order.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = indexrank(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15111, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15112
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = indexrank(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15113
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = indexrank(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = indexrank(__pyx_v__M);

  /* "cypari/auto_gen.pxi":15114
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = indexrank(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matintersect(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15103
 *         return new_gen(_ret)
 * 
 *     def matindexrank(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a matrix of rank :math:`r`, returns a vector with two
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matindexrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15116
 *         return new_gen(_ret)
 * 
 *     def matintersect(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two matrices with the same
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_855matintersect(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_854matintersect[] = "\n        :math:`x` and :math:`y` being two matrices with the same\n        number of rows each of whose columns are independent, finds a basis of the\n        :math:`\\mathbb{Q}`-vector space equal to the intersection of the spaces spanned by the\n        columns of :math:`x` and :math:`y` respectively. The faster function\n        :literal:`idealintersect` can be used to intersect fractional ideals (projective\n        :math:`\\mathbb{Z}_K` modules of rank :math:`1`); the slower but much more general function\n        :literal:`nfhnf` can be used to intersect general :math:`\\mathbb{Z}_K`-modules.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_855matintersect(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matintersect (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_854matintersect(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_854matintersect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matintersect", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":15126
 *         :literal:`nfhnf` can be used to intersect general :math:`\mathbb{Z}_K`-modules.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15127
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15127, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15128
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = intersect(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15129
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = intersect(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15130
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = intersect(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = intersect(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":15131
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = intersect(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matinverseimage(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15116
 *         return new_gen(_ret)
 * 
 *     def matintersect(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` and :math:`y` being two matrices with the same
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15133
 *         return new_gen(_ret)
 * 
 *     def matinverseimage(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_857matinverseimage(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_856matinverseimage[] = "\n        Given a matrix :math:`x` and\n        a column vector or matrix :math:`y`, returns a preimage :math:`z` of :math:`y` by :math:`x` if one\n        exists (i.e such that :math:`x z = y`), an empty vector or matrix otherwise. The\n        complete inverse image is :math:`z + Ker x`, where a basis of the kernel of\n        :math:`x` may be obtained by :literal:`matker`.\n        \n        ::\n        \n            ? M = [1,2;2,4];\n            ? matinverseimage(M, [1,2]~)\n            %2 = [1, 0]~\n            ? matinverseimage(M, [3,4]~)\n            %3 = []~ \\\\ no solution\n            ? matinverseimage(M, [1,3,6;2,6,12])\n            %4 =\n            [1 3 6]\n            \n            [0 0 0]\n            ? matinverseimage(M, [1,2;3,4])\n            %5 = [;] \\\\ no solution\n            ? K = matker(M)\n            %6 =\n            [-2]\n            \n            [1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_857matinverseimage(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matinverseimage (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_856matinverseimage(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_856matinverseimage(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matinverseimage", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":15161
 *             [1]
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15162
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15162, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15163
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = inverseimage(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15164
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = inverseimage(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15165
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = inverseimage(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = inverseimage(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":15166
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = inverseimage(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matinvmod(x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15133
 *         return new_gen(_ret)
 * 
 *     def matinverseimage(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a matrix :math:`x` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matinverseimage", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15168
 *         return new_gen(_ret)
 * 
 *     def matinvmod(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a left inverse of the matrix:math:`x` modulo:math:`d`. The matrix :math:`x` must
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_859matinvmod(PyObject *__pyx_v_x, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_858matinvmod[] = "\n        Computes a left inverse of the matrix\302\240:math:`x` modulo\302\240:math:`d`. The matrix :math:`x` must\n        have :literal:`t_INT` entries, and :math:`d` can be an arbitrary positive integer.\n        \n        ::\n        \n            ? A = [3,1,2;1,2,1;3,1,1];\n            ? U = matinvmod(A,6)\n            %2 =\n            [1 1 3]\n            \n            [2 3 5]\n            \n            [1 0 5]\n            \n            ? (U*A)%6\n            %3 =\n            [1 0 0]\n            \n            [0 1 0]\n            \n            [0 0 1]\n            ? matinvmod(A,5)\n             *** at top-level: matinvmod(A,5)\n             *** ^--------------\n             *** matinvmod: impossible inverse in gen_inv: 0.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_859matinvmod(PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matinvmod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_858matinvmod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_d));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_858matinvmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matinvmod", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":15196
 *              *** matinvmod: impossible inverse in gen_inv: 0.
 *         '''
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15197
 *         '''
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15197, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15198
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matinvmod(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15199
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matinvmod(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15200
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matinvmod(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matinvmod(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_gen.pxi":15201
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matinvmod(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matisdiagonal(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15168
 *         return new_gen(_ret)
 * 
 *     def matinvmod(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes a left inverse of the matrix:math:`x` modulo:math:`d`. The matrix :math:`x` must
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matinvmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15203
 *         return new_gen(_ret)
 * 
 *     def matisdiagonal(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_861matisdiagonal(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_860matisdiagonal[] = "\n        Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_861matisdiagonal(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matisdiagonal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_860matisdiagonal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_860matisdiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matisdiagonal", 0);

  /* "cypari/auto_gen.pxi":15207
 *         Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = isdiagonal(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15207, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15208
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = isdiagonal(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15209
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = isdiagonal(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isdiagonal(__pyx_v__x);

  /* "cypari/auto_gen.pxi":15210
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = isdiagonal(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":15211
 *         cdef int _ret = isdiagonal(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def matker(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15203
 *         return new_gen(_ret)
 * 
 *     def matisdiagonal(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a diagonal matrix, false (0) if not.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matisdiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15213
 *         return _ret
 * 
 *     def matker(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the kernel of the matrix :math:`x` as columns of a matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_863matker(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_862matker[] = "\n        Gives a basis for the kernel of the matrix :math:`x` as columns of a matrix.\n        The matrix can have entries of any type, provided they are compatible with\n        the generic arithmetic operations (:math:`+`, :math:`x` and :math:`/`).\n        \n        If :math:`x` is known to have integral entries, set :math:`flag = 1`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_863matker(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matker (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matker") < 0)) __PYX_ERR(10, 15213, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15213, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matker", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_862matker(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_862matker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matker", 0);

  /* "cypari/auto_gen.pxi":15221
 *         If :math:`x` is known to have integral entries, set :math:`flag = 1`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matker0(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15221, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15222
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matker0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15223
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matker0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matker0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":15224
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matker0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matkerint(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15213
 *         return _ret
 * 
 *     def matker(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives a basis for the kernel of the matrix :math:`x` as columns of a matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15226
 *         return new_gen(_ret)
 * 
 *     def matkerint(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives an LLL-reduced :math:`\mathbb{Z}`-basis
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_865matkerint(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_864matkerint[] = "\n        Gives an LLL-reduced :math:`\\mathbb{Z}`-basis\n        for the lattice equal to the kernel of the matrix :math:`x` with rational entries.\n        \n        :emphasis:`flag` is deprecated, kept for backward compatibility.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_865matkerint(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matkerint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matkerint") < 0)) __PYX_ERR(10, 15226, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15226, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matkerint", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15226, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matkerint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_864matkerint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_864matkerint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matkerint", 0);

  /* "cypari/auto_gen.pxi":15233
 *         :emphasis:`flag` is deprecated, kept for backward compatibility.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matkerint0(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15233, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15234
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matkerint0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15235
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matkerint0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matkerint0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":15236
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matkerint0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matmuldiagonal(x, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15226
 *         return new_gen(_ret)
 * 
 *     def matkerint(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives an LLL-reduced :math:`\mathbb{Z}`-basis
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matkerint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15238
 *         return new_gen(_ret)
 * 
 *     def matmuldiagonal(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrix :math:`x` by the diagonal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_867matmuldiagonal(PyObject *__pyx_v_x, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_866matmuldiagonal[] = "\n        Product of the matrix :math:`x` by the diagonal\n        matrix whose diagonal entries are those of the vector :math:`d`. Equivalent to,\n        but much faster than :math:`x*matdiagonal (d)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_867matmuldiagonal(PyObject *__pyx_v_x, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matmuldiagonal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_866matmuldiagonal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_d));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_866matmuldiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_d) {
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matmuldiagonal", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":15244
 *         but much faster than :math:`x*matdiagonal (d)`.
 *         '''
 *         d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15245
 *         '''
 *         d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15245, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15246
 *         d = objtogen(d)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matmuldiagonal(_x, _d)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15247
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matmuldiagonal(_x, _d)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
  __pyx_v__d = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15248
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matmuldiagonal(_x, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matmuldiagonal(__pyx_v__x, __pyx_v__d);

  /* "cypari/auto_gen.pxi":15249
 *         cdef GEN _d = (<Gen>d).g
 *         cdef GEN _ret = matmuldiagonal(_x, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matmultodiagonal(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15238
 *         return new_gen(_ret)
 * 
 *     def matmuldiagonal(x, d):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrix :math:`x` by the diagonal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matmuldiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15251
 *         return new_gen(_ret)
 * 
 *     def matmultodiagonal(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrices :math:`x` and :math:`y` assuming that the result is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_869matmultodiagonal(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_868matmultodiagonal[] = "\n        Product of the matrices :math:`x` and :math:`y` assuming that the result is a\n        diagonal matrix. Much faster than :math:`x*y` in that case. The result is\n        undefined if :math:`x*y` is not diagonal.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_869matmultodiagonal(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matmultodiagonal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_868matmultodiagonal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_868matmultodiagonal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matmultodiagonal", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":15257
 *         undefined if :math:`x*y` is not diagonal.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15258
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15258, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15259
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = matmultodiagonal(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15260
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matmultodiagonal(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15261
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = matmultodiagonal(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matmultodiagonal(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":15262
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = matmultodiagonal(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matpermanent(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15251
 *         return new_gen(_ret)
 * 
 *     def matmultodiagonal(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Product of the matrices :math:`x` and :math:`y` assuming that the result is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matmultodiagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15264
 *         return new_gen(_ret)
 * 
 *     def matpermanent(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Permanent of the square matrix :math:`x` using Ryser's formula in Gray code
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_871matpermanent(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_870matpermanent[] = "\n        Permanent of the square matrix :math:`x` using Ryser's formula in Gray code\n        order.\n        \n        ::\n        \n            ? n = 20; m = matrix(n,n,i,j, i!=j);\n            ? matpermanent(m)\n            %2 = 895014631192902121\n            ? n! * sum(i=0,n, (-1)^i/i!)\n            %3 = 895014631192902121\n        \n        This function runs in time :math:`O(2^n n)` for a matrix of size\n        :math:`n` and is not implemented for :math:`n` large.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_871matpermanent(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matpermanent (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_870matpermanent(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_870matpermanent(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matpermanent", 0);

  /* "cypari/auto_gen.pxi":15280
 *         :math:`n` and is not implemented for :math:`n` large.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matpermanent(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15280, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15281
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matpermanent(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15282
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matpermanent(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matpermanent(__pyx_v__x);

  /* "cypari/auto_gen.pxi":15283
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matpermanent(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matqr(M, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15264
 *         return new_gen(_ret)
 * 
 *     def matpermanent(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Permanent of the square matrix :math:`x` using Ryser's formula in Gray code
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matpermanent", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15285
 *         return new_gen(_ret)
 * 
 *     def matqr(M, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[Q,R]`, the QR-decomposition of the square invertible
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_873matqr(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_872matqr[] = "\n        Returns :math:`[Q,R]`, the QR-decomposition of the square invertible\n        matrix :math:`M` with real entries: :math:`Q` is orthogonal and :math:`R` upper triangular. If\n        :math:`flag = 1`, the orthogonal matrix is returned as a sequence of Householder\n        transforms: applying such a sequence is stabler and faster than\n        multiplication by the corresponding :math:`Q` matrix.\n        More precisely, if\n        \n        ::\n        \n             [Q,R] = matqr(M);\n             [q,r] = matqr(M, 1);\n        \n        then :math:`r = R` and :literal:`mathouseholder`:math:`(q, M)` is\n        (close to) :math:`R`; furthermore\n        \n        ::\n        \n             mathouseholder(q, matid(#M)) == Q~\n        \n        the inverse of :math:`Q`. This function raises an error if the\n        precision is too low or :math:`x` is singular.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_873matqr(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matqr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matqr") < 0)) __PYX_ERR(10, 15285, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15285, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15285, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matqr", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15285, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_872matqr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_872matqr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matqr", 0);

  /* "cypari/auto_gen.pxi":15309
 *         precision is too low or :math:`x` is singular.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15309, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15310
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = matqr(_M, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15311
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matqr(_M, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":15312
 *         cdef GEN _M = (<Gen>M).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = matqr(_M, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matqr(__pyx_v__M, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":15313
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = matqr(_M, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matrank(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15285
 *         return new_gen(_ret)
 * 
 *     def matqr(M, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[Q,R]`, the QR-decomposition of the square invertible
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15315
 *         return new_gen(_ret)
 * 
 *     def matrank(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Rank of the matrix :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_875matrank(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_874matrank[] = "\n        Rank of the matrix :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_875matrank(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matrank (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_874matrank(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_874matrank(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matrank", 0);

  /* "cypari/auto_gen.pxi":15319
 *         Rank of the matrix :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rank(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15319, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15320
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rank(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15321
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rank(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rank(__pyx_v__x);

  /* "cypari/auto_gen.pxi":15322
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rank(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":15323
 *         cdef long _ret = rank(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def matrixqz(A, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15315
 *         return new_gen(_ret)
 * 
 *     def matrank(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Rank of the matrix :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matrank", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15325
 *         return _ret
 * 
 *     def matrixqz(A, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A` being an :math:`m x n` matrix in :math:`M_{m,n}(\mathbb{Q})`, let
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_877matrixqz(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_876matrixqz[] = "\n        :math:`A` being an :math:`m x n` matrix in :math:`M_{m,n}(\\mathbb{Q})`, let\n        :math:`Im_\\mathbb{Q} A` (resp.\302\240:math:`Im_\\mathbb{Z} A`) the :math:`\\mathbb{Q}`-vector space\n        (resp.\302\240the :math:`\\mathbb{Z}`-module) spanned by the columns of :math:`A`. This function has\n        varying behavior depending on the sign of :math:`p`:\n        \n        If :math:`p >= 0`, :math:`A` is assumed to have maximal rank :math:`n <= m`. The function\n        returns a matrix :math:`B\\in M_{m,n}(\\mathbb{Z})`, with :math:`Im_\\mathbb{Q} B = Im_\\mathbb{Q} A`,\n        such that the GCD of all its :math:`n x n` minors is coprime to\n        :math:`p`; in particular, if :math:`p = 0` (default), this GCD is :math:`1`.\n        \n        ::\n        \n            ? minors(x) = vector(#x[,1], i, matdet(x[^i,]));\n            ? A = [3,1/7; 5,3/7; 7,5/7]; minors(A)\n            %1 = [4/7, 8/7, 4/7] \\\\ determinants of all 2x2 minors\n            ? B = matrixqz(A)\n            %2 =\n            [3 1]\n            \n            [5 2]\n            \n            [7 3]\n            ? minors(%)\n            %3 = [1, 2, 1] \\\\ B integral with coprime minors\n        \n        If :math:`p = -1`, returns the HNF basis of the lattice :math:`\\mathbb{Z}^n \\cap Im_\\mathbb{Z} A`.\n        \n        If :math:`p = -2`, returns the HNF basis of the lattice :math:`\\mathbb{Z}^n \\cap Im_\\mathbb{Q} A`.\n        \n        ::\n        \n            ? matrixqz(A,-1)\n            %4 =\n            [8 5]\n            \n            [4 3]\n            \n            [0 1]\n            \n            ? matrixqz(A,-2)\n            %5 =\n            [2 -1]\n            \n            [1 0]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_877matrixqz(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matrixqz (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matrixqz") < 0)) __PYX_ERR(10, 15325, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matrixqz", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15325, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matrixqz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_876matrixqz(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_876matrixqz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__A;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("matrixqz", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":15374
 *             [0 1]
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":15375
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":15376
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 15376, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":15375
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":15377
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 15377, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15378
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_4;

  /* "cypari/auto_gen.pxi":15379
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":15380
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":15381
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matrixqz0(_A, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":15380
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)
 */
  }

  /* "cypari/auto_gen.pxi":15382
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matrixqz0(__pyx_v__A, __pyx_v__p);

  /* "cypari/auto_gen.pxi":15383
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = matrixqz0(_A, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsize(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 15383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15325
 *         return _ret
 * 
 *     def matrixqz(A, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`A` being an :math:`m x n` matrix in :math:`M_{m,n}(\mathbb{Q})`, let
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matrixqz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15385
 *         return new_gen(_ret)
 * 
 *     def matsize(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector or matrix, returns a row vector
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_879matsize(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_878matsize[] = "\n        :math:`x` being a vector or matrix, returns a row vector\n        with two components, the first being the number of rows (1 for a row vector),\n        the second the number of columns (1 for a column vector).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_879matsize(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsize (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_878matsize(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_878matsize(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matsize", 0);

  /* "cypari/auto_gen.pxi":15391
 *         the second the number of columns (1 for a column vector).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matsize(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15391, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15392
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matsize(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15393
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matsize(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matsize(__pyx_v__x);

  /* "cypari/auto_gen.pxi":15394
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = matsize(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsnf(X, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15385
 *         return new_gen(_ret)
 * 
 *     def matsize(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a vector or matrix, returns a row vector
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15396
 *         return new_gen(_ret)
 * 
 *     def matsnf(X, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`X` is a (singular or non-singular) matrix outputs the vector of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_881matsnf(PyObject *__pyx_v_X, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_880matsnf[] = "\n        If :math:`X` is a (singular or non-singular) matrix outputs the vector of\n        elementary divisors of :math:`X`, i.e.\302\240the diagonal of the\n        Smith normal form of :math:`X`, normalized so that :math:`d_n \\| d_{n-1} \\|\n        ... \\| d_1`.\n        \n        The binary digits of :emphasis:`flag` mean:\n        \n        1 (complete output): if set, outputs :math:`[U,V,D]`, where :math:`U` and :math:`V` are two\n        unimodular matrices such that :math:`UXV` is the diagonal matrix :math:`D`. Otherwise\n        output only the diagonal of :math:`D`. If :math:`X` is not a square matrix, then :math:`D`\n        will be a square diagonal matrix padded with zeros on the left or the top.\n        \n        2 (generic input): if set, allows polynomial entries, in which case the\n        input matrix must be square. Otherwise, assume that :math:`X` has integer\n        coefficients with arbitrary shape.\n        \n        4 (cleanup): if set, cleans up the output. This means that elementary\n        divisors equal to :math:`1` will be deleted, i.e.\302\240outputs a shortened vector :math:`D'`\n        instead of :math:`D`. If complete output was required, returns :math:`[U',V',D']` so\n        that :math:`U'XV' = D'` holds. If this flag is set, :math:`X` is allowed to be of the\n        form `vector of elementary divisors' or :math:`[U,V,D]` as would normally be output with the cleanup flag\n        unset.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_881matsnf(PyObject *__pyx_v_X, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matsnf") < 0)) __PYX_ERR(10, 15396, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15396, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matsnf", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15396, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_880matsnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_X), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_880matsnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X, long __pyx_v_flag) {
  GEN __pyx_v__X;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matsnf", 0);

  /* "cypari/auto_gen.pxi":15421
 *         unset.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = matsnf0(_X, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15421, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15422
 *         '''
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matsnf0(_X, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15423
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = matsnf0(_X, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matsnf0(__pyx_v__X, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":15424
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _ret = matsnf0(_X, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsolve(M, B):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15396
 *         return new_gen(_ret)
 * 
 *     def matsnf(X, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`X` is a (singular or non-singular) matrix outputs the vector of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15426
 *         return new_gen(_ret)
 * 
 *     def matsolve(M, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a left-invertible matrix and :math:`B` a column vector
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_883matsolve(PyObject *__pyx_v_M, PyObject *__pyx_v_B); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_882matsolve[] = "\n        Let :math:`M` be a left-invertible matrix and :math:`B` a column vector\n        such that there exists a solution :math:`X` to the system of linear equations\n        :math:`MX = B`; return the (unique) solution :math:`X`. This has the same effect as, but\n        is faster, than :math:`M^{-1}*B`. Uses Dixon :math:`p`-adic lifting method if :math:`M` and\n        :math:`B` are integral and Gaussian elimination otherwise. When there is no\n        solution, the function returns an :math:`X` such that :math:`MX - B` is non-zero\n        although it has at least :math:`\\#M` zero entries:\n        \n        ::\n        \n            ? M = [1,2;3,4;5,6];\n            ? B = [4,6,8]~; X = matsolve(M, B)\n            %2 = [-2, 3]~\n            ? M*X == B\n            %3 = 1\n            ? B = [1,2,4]~; X = matsolve(M, [1,2,4]~)\n            %4 = [0, 1/2]~\n            ? M*X - B\n            %5 = [0, 0, -1]~\n        \n        Raises an exception if :math:`M` is not left-invertible, even if\n        there is a solution:\n        \n        ::\n        \n            ? M = [1,1;1,1]; matsolve(M, [1,1]~)\n             *** at top-level: matsolve(M,[1,1]~)\n             *** ^------------------\n             *** matsolve: impossible inverse in gauss: [1, 1; 1, 1].\n        \n        The function also works when :math:`B` is a matrix and we return\n        the unique matrix solution :math:`X` provided it exists.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_883matsolve(PyObject *__pyx_v_M, PyObject *__pyx_v_B) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsolve (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_882matsolve(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), ((PyObject *)__pyx_v_B));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_882matsolve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_B) {
  GEN __pyx_v__M;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matsolve", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":15461
 *         the unique matrix solution :math:`X` provided it exists.
 *         '''
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15462
 *         '''
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15462, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15463
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = gauss(_M, _B)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15464
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gauss(_M, _B)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15465
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = gauss(_M, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gauss(__pyx_v__M, __pyx_v__B);

  /* "cypari/auto_gen.pxi":15466
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = gauss(_M, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsolvemod(M, D, B, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15426
 *         return new_gen(_ret)
 * 
 *     def matsolve(M, B):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a left-invertible matrix and :math:`B` a column vector
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15468
 *         return new_gen(_ret)
 * 
 *     def matsolvemod(M, D, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being any integral matrix,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_885matsolvemod(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_884matsolvemod[] = "\n        :math:`M` being any integral matrix,\n        :math:`D` a column vector of non-negative integer moduli, and :math:`B` an integral\n        column vector, gives an integer solution to the system of congruences\n        :math:`\\sum_i m_{i,j}x_j = b_i (mod d_i)` if one exists, otherwise returns\n        zero. Shorthand notation: :math:`B` (resp.\302\240:math:`D`) can be given as a single integer,\n        in which case all the :math:`b_i` (resp.\302\240:math:`d_i`) above are taken to be equal to :math:`B`\n        (resp.\302\240:math:`D`).\n        \n        ::\n        \n            ? M = [1,2;3,4];\n            ? matsolvemod(M, [3,4]~, [1,2]~)\n            %2 = [10, 0]~\n            ? matsolvemod(M, 3, 1) \\\\ M X = [1,1]~ over F_3\n            %3 = [2, 1]~\n            ? matsolvemod(M, [3,0]~, [1,2]~) \\\\ x + 2y = 1 (mod 3), 3x + 4y = 2 (in Z)\n            %4 = [6, -4]~\n        \n        If :math:`flag = 1`, all solutions are returned in the form of a two-component row\n        vector :math:`[x,u]`, where :math:`x` is an integer solution to the system of\n        congruences and :math:`u` is a matrix whose columns give a basis of the homogeneous\n        system (so that all solutions can be obtained by adding :math:`x` to any linear\n        combination of columns of :math:`u`). If no solution exists, returns zero.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_885matsolvemod(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_v_B = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsolvemod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_B,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D)) != 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_B)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matsolvemod", 0, 2, 3, 1); __PYX_ERR(10, 15468, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matsolvemod") < 0)) __PYX_ERR(10, 15468, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_D = values[0];
    __pyx_v_B = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15468, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matsolvemod", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15468, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.matsolvemod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_884matsolvemod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_D, __pyx_v_B, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_884matsolvemod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_D, PyObject *__pyx_v_B, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__D;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("matsolvemod", 0);
  __Pyx_INCREF(__pyx_v_D);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":15494
 *         combination of columns of :math:`u`). If no solution exists, returns zero.
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15495
 *         '''
 *         D = objtogen(D)
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15496
 *         D = objtogen(D)
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15496, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15497
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15498
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15499
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15500
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = matsolvemod(__pyx_v__M, __pyx_v__D, __pyx_v__B, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":15501
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = matsolvemod(_M, _D, _B, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def matsupplement(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15468
 *         return new_gen(_ret)
 * 
 *     def matsolvemod(M, D, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being any integral matrix,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matsolvemod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15503
 *         return new_gen(_ret)
 * 
 *     def matsupplement(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Assuming that the columns of the matrix :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_887matsupplement(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_886matsupplement[] = "\n        Assuming that the columns of the matrix :math:`x`\n        are linearly independent (if they are not, an error message is issued), finds\n        a square invertible matrix whose first columns are the columns of :math:`x`,\n        i.e.\302\240supplement the columns of :math:`x` to a basis of the whole space.\n        \n        ::\n        \n            ? matsupplement([1;2])\n            %1 =\n            [1 0]\n            \n            [2 1]\n        \n        Raises an error if :math:`x` has 0 columns, since (due to a long standing design\n        bug), the dimension of the ambient space (the number of rows) is unknown in\n        this case:\n        \n        ::\n        \n            ? matsupplement(matrix(2,0))\n             *** at top-level: matsupplement(matrix\n             *** ^--------------------\n             *** matsupplement: sorry, suppl [empty matrix] is not yet implemented.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_887matsupplement(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matsupplement (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_886matsupplement(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_886matsupplement(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("matsupplement", 0);

  /* "cypari/auto_gen.pxi":15529
 *              *** matsupplement: sorry, suppl [empty matrix] is not yet implemented.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = suppl(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15529, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15530
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = suppl(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15531
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = suppl(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = suppl(__pyx_v__x);

  /* "cypari/auto_gen.pxi":15532
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = suppl(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mattranspose(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15503
 *         return new_gen(_ret)
 * 
 *     def matsupplement(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Assuming that the columns of the matrix :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.matsupplement", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15534
 *         return new_gen(_ret)
 * 
 *     def mattranspose(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transpose of :math:`x` (also :math:`x~`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_889mattranspose(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_888mattranspose[] = "\n        Transpose of :math:`x` (also :math:`x~`).\n        This has an effect only on vectors and matrices.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_889mattranspose(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mattranspose (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_888mattranspose(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_888mattranspose(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mattranspose", 0);

  /* "cypari/auto_gen.pxi":15539
 *         This has an effect only on vectors and matrices.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrans(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15539, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15540
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtrans(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15541
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrans(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtrans(__pyx_v__x);

  /* "cypari/auto_gen.pxi":15542
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrans(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def max(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15534
 *         return new_gen(_ret)
 * 
 *     def mattranspose(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transpose of :math:`x` (also :math:`x~`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mattranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15544
 *         return new_gen(_ret)
 * 
 *     def max(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_891max(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_890max[] = "\n        Creates the maximum of :math:`x` and :math:`y` when they can be compared.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_891max(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("max (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_890max(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_890max(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("max", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":15548
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15549
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15549, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15550
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmax(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15551
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmax(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15552
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmax(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmax(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":15553
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmax(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfEH(k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15544
 *         return new_gen(_ret)
 * 
 *     def max(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.max", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15555
 *         return new_gen(_ret)
 * 
 *     def mfEH(k):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being in :math:`1/2+\mathbb{Z}`, returns the Cohen-Eisenstein series :math:`H_k` of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_893mfEH(PyObject *__pyx_v_k, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_892mfEH[] = "\n        :math:`k` being in :math:`1/2+\\mathbb{Z}`, returns the Cohen-Eisenstein series :math:`H_k` of\n        weight :math:`k` on :math:`\\Gamma_0(4)`.\n        \n        ::\n        \n            ? H = mfEH(13/2); mfcoefs(H,4)\n            %1 = [691/32760, -1/252, 0, 0, -2017/252]\n        \n        The coefficients of :math:`H` are given by the Cohen-Hurwitz function\n        :math:`H(k-1/2,N)` and can be obtained for moderately large values of :math:`N` (the\n        algorithm uses :math:`~{O}(N)` time):\n        \n        ::\n        \n            ? mfcoef(H,10^5+1)\n            time = 55 ms.\n            %2 = -12514802881532791504208348\n            ? mfcoef(H,10^7+1)\n            time = 6,044 ms.\n            %3 = -1251433416009877455212672599325104476\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_893mfEH(PyObject *__pyx_v_k, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfEH (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_892mfEH(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_k));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_892mfEH(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_k) {
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfEH", 0);

  /* "cypari/auto_gen.pxi":15578
 *             %3 = -1251433416009877455212672599325104476
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = mfEH(_k)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15578, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15579
 *         '''
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfEH(_k)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15580
 *         sig_on()
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = mfEH(_k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfEH(__pyx_v__k);

  /* "cypari/auto_gen.pxi":15581
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = mfEH(_k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfTheta(psi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15555
 *         return new_gen(_ret)
 * 
 *     def mfEH(k):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k` being in :math:`1/2+\mathbb{Z}`, returns the Cohen-Eisenstein series :math:`H_k` of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfEH", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15583
 *         return new_gen(_ret)
 * 
 *     def mfTheta(psi):             # <<<<<<<<<<<<<<
 *         r'''
 *         The unary theta function corresponding to the primitive Dirichlet
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_895mfTheta(PyObject *__pyx_v_psi, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_894mfTheta[] = "\n        The unary theta function corresponding to the primitive Dirichlet\n        character :math:`\\psi`, hence of weight :math:`1/2` if :math:`\\psi` is even, of weight :math:`3/2`\n        if :math:`\\psi` is odd.\n        \n        ::\n        \n            ? Ser(mfcoefs(mfTheta(),30))\n            %1 = 1 + 2*x + 2*x^4 + 2*x^9 + 2*x^16 + 2*x^25 + O(x^31)\n            ? Ser(mfcoefs(mfTheta(8),30))\n            %2 = 2*x - 2*x^9 - 2*x^25 + O(x^31)\n            ? Ser(mfcoefs(mfTheta(-8),30))\n            %3 = 2*x + 6*x^9 - 10*x^25 + O(x^31)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_895mfTheta(PyObject *__pyx_v_psi, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfTheta (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_894mfTheta(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_psi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_894mfTheta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_psi) {
  GEN __pyx_v__psi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfTheta", 0);

  /* "cypari/auto_gen.pxi":15598
 *             %3 = 2*x + 6*x^9 - 10*x^25 + O(x^31)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _psi = (<Gen>psi).g
 *         cdef GEN _ret = mfTheta(_psi)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15598, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15599
 *         '''
 *         sig_on()
 *         cdef GEN _psi = (<Gen>psi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfTheta(_psi)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_psi)->__pyx_base.g;
  __pyx_v__psi = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15600
 *         sig_on()
 *         cdef GEN _psi = (<Gen>psi).g
 *         cdef GEN _ret = mfTheta(_psi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfTheta(__pyx_v__psi);

  /* "cypari/auto_gen.pxi":15601
 *         cdef GEN _psi = (<Gen>psi).g
 *         cdef GEN _ret = mfTheta(_psi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfatkin(mfatk, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15583
 *         return new_gen(_ret)
 * 
 *     def mfTheta(psi):             # <<<<<<<<<<<<<<
 *         r'''
 *         The unary theta function corresponding to the primitive Dirichlet
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfTheta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15603
 *         return new_gen(_ret)
 * 
 *     def mfatkin(mfatk, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :literal:`mfatk` output by :literal:`mfatk = mfatkininit(mf,Q)` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_897mfatkin(PyObject *__pyx_v_mfatk, PyObject *__pyx_v_F); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_896mfatkin[] = "\n        Given a :literal:`mfatk` output by :literal:`mfatk = mfatkininit(mf,Q)` and\n        a modular form :math:`F` belonging to the pace :literal:`mf`, returns the modular\n        form :math:`C*F\\|W_Q`, which has :literal:`polmod` coefficients in :math:`\\mathbb{Q} (F)`;\n        :literal:`mfatk[3]` gives the constant :math:`C`, and :literal:`mfatk[1]` gives\n        the modular form space to which :math:`F\\|W_Q` belongs (or is set to :math:`0` if\n        it is :literal:`mf`).\n        \n        ::\n        \n            ? mf = mfinit([35,2],0); vecF = mfbasis(mf); F = vecF[1];\n            ? mfcoefs(F, 4)\n            %2 = [0, 3, -1, 0, 3]\n            ? mfatk = mfatkininit(mf,7);\n            ? wF = mfatkin(mfatk, F); mfcoefs(wF, 4)\n            %4 = [0, 1, -1, -2, 7]\n            ? mfatk = mfatkininit(mf,35);\n            ? wF = mfatkin(mfatk, F); mfcoefs(wF, 4)\n            %6 = [0, -3, 1, 0, -3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_897mfatkin(PyObject *__pyx_v_mfatk, PyObject *__pyx_v_F) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfatkin (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_896mfatkin(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mfatk), ((PyObject *)__pyx_v_F));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_896mfatkin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mfatk, PyObject *__pyx_v_F) {
  GEN __pyx_v__mfatk;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfatkin", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":15624
 *             %6 = [0, -3, 1, 0, -3]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15625
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15625, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15626
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mfatk = (<Gen>mfatk).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfatkin(_mfatk, _F)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mfatk)->__pyx_base.g;
  __pyx_v__mfatk = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15627
 *         sig_on()
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfatkin(_mfatk, _F)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15628
 *         cdef GEN _mfatk = (<Gen>mfatk).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfatkin(_mfatk, _F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfatkin(__pyx_v__mfatk, __pyx_v__F);

  /* "cypari/auto_gen.pxi":15629
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfatkin(_mfatk, _F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfatkineigenvalues(mf, long Q, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15603
 *         return new_gen(_ret)
 * 
 *     def mfatkin(mfatk, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :literal:`mfatk` output by :literal:`mfatk = mfatkininit(mf,Q)` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfatkin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15631
 *         return new_gen(_ret)
 * 
 *     def mfatkineigenvalues(mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space :literal:`mf` of integral weight :math:`k` and a primitive
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_899mfatkineigenvalues(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_898mfatkineigenvalues[] = "\n        Given a modular form space :literal:`mf` of integral weight :math:`k` and a primitive\n        divisor :math:`Q` of the level :math:`N` of :literal:`mf`, outputs the Atkin-Lehner\n        eigenvalues of :math:`w_Q` on the new space, grouped by orbit. If :math:`\\chi` is a\n        (trivial or) quadratic character defined modulo :math:`N/Q`, the result is rounded\n        and the eigenvalues are :math:`\302\261 i^k`.\n        \n        ::\n        \n            ? mf = mfinit([35,2],0); mffields(mf)\n            %1 = [y, y^2 - y - 4] \\\\ two orbits, dimension 1 and 2\n            ? mfatkineigenvalues(mf,5)\n            %2 = [[1], [-1, -1]]\n            ? mf = mfinit([12,7,Mod(3,4)],0);\n            ? mfatkineigenvalues(mf,3)\n            %4 = [[I, -I, -I, I, I, -I]] \\\\ one orbit\n        \n        If you want the eigenvalues on a larger space than the new space,\n        e.g. the full space, you can directly call :literal:`[mfB,M,C] = mfatkininit` and\n        compute the eigenvalues as the roots of the characteristic polynomial of\n        :math:`M/C`, i.e. by dividing the roots of :literal:`charpoly(M)` by :math:`C`. Note that the\n        characteristic polynomial is computed exactly since :math:`M` has coefficients in\n        :math:`\\mathbb{Q} (\\chi)`, whereas :math:`C` may be given by a complex number. If the coefficients\n        of the characteristic polynomial are polmods modulo :math:`T` they must be embedded\n        to :math:`\\mathbb{C}` first using :literal:`subst(lift(), t, exp(2*I*Pi/n))`, when :math:`T` is\n        :literal:`poliscyclo(n)`; note that :math:`T = mf.mod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_899mfatkineigenvalues(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_Q;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfatkineigenvalues (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_precision,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_Q)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfatkineigenvalues") < 0)) __PYX_ERR(10, 15631, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Q = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_Q == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15631, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15631, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfatkineigenvalues", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15631, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfatkineigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_898mfatkineigenvalues(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_Q, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_898mfatkineigenvalues(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfatkineigenvalues", 0);

  /* "cypari/auto_gen.pxi":15659
 *         :literal:`poliscyclo(n)`; note that :math:`T = mf.mod`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15659, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15660
 *         '''
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15661
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":15662
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfatkineigenvalues(__pyx_v__mf, __pyx_v_Q, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":15663
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkineigenvalues(_mf, Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfatkininit(mf, long Q, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15631
 *         return new_gen(_ret)
 * 
 *     def mfatkineigenvalues(mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space :literal:`mf` of integral weight :math:`k` and a primitive
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfatkineigenvalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15665
 *         return new_gen(_ret)
 * 
 *     def mfatkininit(mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space with parameters :math:`N,k,\chi` and a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_901mfatkininit(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_900mfatkininit[] = "\n        Given a modular form space with parameters :math:`N,k,\\chi` and a\n        primitive divisor :math:`Q` of the level :math:`N`, initializes data necessary for\n        working with the Atkin-Lehner operator :math:`W_Q`, for now only the function\n        :literal:`mfatkin`. We write :math:`\\chi ~ \\chi_Q \\chi_{N/Q}` where\n        the two characters are primitive with (coprime) conductors dividing\n        :math:`Q` and :math:`N/Q` respectively. For :math:`F\\in M_k(\\Gamma_0(N),\\chi)`,\n        the form :math:`F \\| W_Q` still has level :math:`N` and weight :math:`k` but its\n        Nebentypus may no longer be :math:`\\chi`: it becomes :math:`\\overline{\\chi_Q} \\chi_{N/Q})`\n        if :math:`k` is integral and :math:`\\overline{\\chi_Q} \\chi_{N/Q})(4Q/.)` if not.\n        \n        The result is a technical 4-component vector :literal:`[mfB, CM, C, mf]`, where\n        \n        - :literal:`mfB` encodes the modular form space to which\n          :math:`F\\|W_Q` belongs when :math:`F \\in M_k(\\Gamma_0(N), \\chi)`: an :literal:`mfinit`\n          corresponding to a new Nebentypus or the integer :math:`0` when the character does\n          not change. This does not depend on :math:`F`.\n        \n        - :literal:`CM` is the matrix of :math:`W_Q` on the bases of :literal:`mf` and :literal:`mfB`\n          multiplied by a normalizing constant :math:`C(k,\\chi,Q)`. This matrix has polmod\n          coefficients in :math:`\\mathbb{Q} (\\chi)`.\n        \n        - :literal:`C` is the complex constant :math:`C(k,\\chi,Q)`. For :math:`k`\n          integral, let :math:`A(k,\\chi, Q) = Q^{\\varepsilon}/g(\\chi_Q)`, where\n          :math:`\\varepsilon = 0` for :math:`k` even and :math:`1/2` for :math:`k` odd and\n          where :math:`g(\\chi_Q)` is the Gauss sum attached to :math:`\\chi_Q`). (A similar, more\n          complicated, definition holds in half-integral weight depending on the parity\n          of :math:`k - 1/2`.) Then if :math:`M` denote""s the matrix of :math:`W_Q` on the bases\n          of :literal:`mf` and :literal:`mfB`, :math:`A.M` has coefficients in :math:`\\mathbb{Q} (\\chi)`.\n          If :math:`A` is rational, we let :math:`C = 1` and :math:`C = A` as a floating point complex\n          number otherwise, and finally :math:`MC := M.C`.\n        \n        ::\n        \n            ? mf=mfinit([32,4],0); [mfB,MC,C]=mfatkininit(mf,32); MC\n            %1 =\n            [5/16 11/2 55/8]\n            \n            [ 1/8 0 -5/4]\n            \n            [1/32 -1/4 11/16]\n            \n            ? C\n            %2 = 1\n            ? mf=mfinit([32,4,8],0); [mfB,MC,C]=mfatkininit(mf,32); MC\n            %3 =\n            [ 1/8 -7/4]\n            \n            [-1/16 -1/8]\n            ? C\n            %4 = 0.35355339059327376220042218105242451964\n            ? algdep(C,2) \\\\ C = 1/sqrt(8)\n            %5 = 8*x^2 - 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_901mfatkininit(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_Q;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfatkininit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_precision,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_Q)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfatkininit") < 0)) __PYX_ERR(10, 15665, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Q = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_Q == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15665, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15665, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfatkininit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15665, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfatkininit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_900mfatkininit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_Q, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_900mfatkininit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, long __pyx_v_Q, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfatkininit", 0);

  /* "cypari/auto_gen.pxi":15720
 *             %5 = 8*x^2 - 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15720, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15721
 *         '''
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15722
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":15723
 *         cdef GEN _mf = (<Gen>mf).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfatkininit(__pyx_v__mf, __pyx_v_Q, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":15724
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfatkininit(_mf, Q, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfbasis(NK, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15665
 *         return new_gen(_ret)
 * 
 *     def mfatkininit(mf, long Q, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a modular form space with parameters :math:`N,k,\chi` and a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfatkininit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15726
 *         return new_gen(_ret)
 * 
 *     def mfbasis(NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives a basis of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_903mfbasis(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_902mfbasis[] = "\n        If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives a basis of the\n        corresponding subspace of :math:`M_k(\\Gamma_0(N),\\chi)`. :math:`NK` can also be the\n        output of :literal:`mfinit`, in which case :literal:`space` can be omitted.\n        To obtain the eigenforms, use :literal:`mfeigenbasis`.\n        \n        If :literal:`space` is a full space :math:`M_k`, the output is the union of first, a\n        basis of the space of Eisenstein series, and second, a basis of the cuspidal\n        space.\n        \n        ::\n        \n            ? see(L) = apply(f->mfcoefs(f,3), L);\n            ? mf = mfinit([35,2],0);\n            ? see( mfbasis(mf) )\n            %2 = [[0, 3, -1, 0], [0, -1, 9, -8], [0, 0, -8, 10]]\n            ? see( mfeigenbasis(mf) )\n            %3 = [[0, 1, 0, 1], [Mod(0, z^2 - z - 4), Mod(1, z^2 - z - 4), \\\n             Mod(-z, z^2 - z - 4), Mod(z - 1, z^2 - z - 4)]]\n            ? mf = mfinit([35,2]);\n            ? see( mfbasis(mf) )\n            %5 = [[1/6, 1, 3, 4], [1/4, 1, 3, 4], [17/12, 1, 3, 4], \\\n             [0, 3, -1, 0], [0, -1, 9, -8], [0, 0, -8, 10]]\n            ? see( mfbasis([48,4],0) )\n            %6 = [[0, 3, 0, -3], [0, -3, 0, 27], [0, 2, 0, 30]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_903mfbasis(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfbasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfbasis") < 0)) __PYX_ERR(10, 15726, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15726, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfbasis", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15726, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_902mfbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), __pyx_v_space);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_902mfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfbasis", 0);

  /* "cypari/auto_gen.pxi":15753
 *             %6 = [[0, 3, 0, -3], [0, -3, 0, 27], [0, 2, 0, 30]]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfbasis(_NK, space)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15753, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15754
 *         '''
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfbasis(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15755
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfbasis(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfbasis(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_gen.pxi":15756
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfbasis(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfbd(F, long d):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15726
 *         return new_gen(_ret)
 * 
 *     def mfbasis(NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives a basis of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15758
 *         return new_gen(_ret)
 * 
 *     def mfbd(F, long d):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, return :math:`B(d)(F)`, where :math:`B(d)` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_905mfbd(PyObject *__pyx_v_F, PyObject *__pyx_arg_d); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_904mfbd[] = "\n        :math:`F` being a generalized modular form, return :math:`B(d)(F)`, where :math:`B(d)` is\n        the expanding operator :math:`\\tau:--->\302\240d\\tau`.\n        \n        ::\n        \n            ? D2=mfbd(mfDelta(),2); mfcoefs(D2, 6)\n            %1 = [0, 0, 1, 0, -24, 0, 252]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_905mfbd(PyObject *__pyx_v_F, PyObject *__pyx_arg_d) {
  long __pyx_v_d;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfbd (wrapper)", 0);
  assert(__pyx_arg_d); {
    __pyx_v_d = __Pyx_PyInt_As_long(__pyx_arg_d); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15758, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfbd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_904mfbd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), ((long)__pyx_v_d));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_904mfbd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_d) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfbd", 0);

  /* "cypari/auto_gen.pxi":15768
 *             %1 = [0, 0, 1, 0, -24, 0, 252]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfbd(_F, d)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15768, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15769
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfbd(_F, d)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15770
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfbd(_F, d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfbd(__pyx_v__F, __pyx_v_d);

  /* "cypari/auto_gen.pxi":15771
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfbd(_F, d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfbracket(F, G, long m=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15758
 *         return new_gen(_ret)
 * 
 *     def mfbd(F, long d):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, return :math:`B(d)(F)`, where :math:`B(d)` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfbd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15773
 *         return new_gen(_ret)
 * 
 *     def mfbracket(F, G, long m=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`m`-th Rankin-Cohen bracket of the generalized modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_907mfbracket(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_906mfbracket[] = "\n        Compute the :math:`m`-th Rankin-Cohen bracket of the generalized modular\n        forms :math:`F` and :math:`G`.\n        \n        ::\n        \n            ? E4 = mfEk(4); E6 = mfEk(6);\n            ? D1 = mfbracket(E4,E4,2); mfcoefs(D1,5)/4800\n            %2 = [0, 1, -24, 252, -1472, 4830]\n            ? D2 = mfbracket(E4,E6,1); mfcoefs(D2,10)/(-3456)\n            %3 = [0, 1, -24, 252, -1472, 4830]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_907mfbracket(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfbracket (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_m,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_G)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfbracket") < 0)) __PYX_ERR(10, 15773, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_G = values[0];
    if (values[1]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15773, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfbracket", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15773, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfbracket", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_906mfbracket(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_G, __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_906mfbracket(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_m) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfbracket", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_gen.pxi":15786
 *             %3 = [0, 1, -24, 252, -1472, 4830]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15787
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15787, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15788
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfbracket(_F, _G, m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15789
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfbracket(_F, _G, m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15790
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfbracket(_F, _G, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfbracket(__pyx_v__F, __pyx_v__G, __pyx_v_m);

  /* "cypari/auto_gen.pxi":15791
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfbracket(_F, _G, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcoef(F, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15791, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15773
 *         return new_gen(_ret)
 * 
 *     def mfbracket(F, G, long m=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`m`-th Rankin-Cohen bracket of the generalized modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfbracket", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15793
 *         return new_gen(_ret)
 * 
 *     def mfcoef(F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`n`-th Fourier coefficient of the generalized modular form :math:`F`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_909mfcoef(PyObject *__pyx_v_F, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_908mfcoef[] = "\n        Compute the :math:`n`-th Fourier coefficient of the generalized modular form :math:`F`.\n        Note that this is the :math:`n+1`-st component of the vector\n        :literal:`mfcoefs(F,n)` as well as the second component of :literal:`mfcoefs(F,1,n)`.\n        \n        ::\n        \n            ? mfcoef(mfDelta(),10)\n            %1 = -115920\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_909mfcoef(PyObject *__pyx_v_F, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcoef (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15793, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_908mfcoef(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_908mfcoef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfcoef", 0);

  /* "cypari/auto_gen.pxi":15804
 *             %1 = -115920
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoef(_F, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15804, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15805
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcoef(_F, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15806
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoef(_F, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcoef(__pyx_v__F, __pyx_v_n);

  /* "cypari/auto_gen.pxi":15807
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoef(_F, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcoefs(F, long n, long d=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15807, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15793
 *         return new_gen(_ret)
 * 
 *     def mfcoef(F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the :math:`n`-th Fourier coefficient of the generalized modular form :math:`F`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15809
 *         return new_gen(_ret)
 * 
 *     def mfcoefs(F, long n, long d=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the vector of Fourier coefficients :math:`[a[0],a[d],...,a[nd]]` of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_911mfcoefs(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_910mfcoefs[] = "\n        Compute the vector of Fourier coefficients :math:`[a[0],a[d],...,a[nd]]` of the\n        generalized modular form :math:`F`; :math:`d` must be positive and :math:`d = 1` by default.\n        \n        ::\n        \n            ? D = mfDelta();\n            ? mfcoefs(D,10)\n            %2 = [0, 1, -24, 252, -1472, 4830, -6048, -16744, 84480, -113643, -115920]\n            ? mfcoefs(D,5,2)\n            %3 = [0, -24, -1472, -6048, 84480, -115920]\n            ? mfcoef(D,10)\n            %4 = -115920\n        \n        This function also applies when :math:`F` is a modular form space as output by\n        :literal:`mfinit`; it then returns the matrix whose columns give the Fourier\n        expansions of the elements of :literal:`mfbasis`:math:`(F)`:\n        \n        ::\n        \n            ? mf = mfinit([1,12]);\n            ? mfcoefs(mf,5)\n            %2 =\n            [691/65520 0]\n            \n            [ 1 1]\n            \n            [ 2049 -24]\n            \n            [ 177148 252]\n            \n            [ 4196353 -1472]\n            \n            [ 48828126 4830]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_911mfcoefs(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_d;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcoefs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_d,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfcoefs") < 0)) __PYX_ERR(10, 15809, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15809, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_d = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15809, __pyx_L3_error)
    } else {
      __pyx_v_d = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfcoefs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15809, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcoefs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_910mfcoefs(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_n, __pyx_v_d);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_910mfcoefs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n, long __pyx_v_d) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfcoefs", 0);

  /* "cypari/auto_gen.pxi":15845
 *             [ 48828126 4830]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoefs(_F, n, d)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15845, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15846
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcoefs(_F, n, d)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15847
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoefs(_F, n, d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcoefs(__pyx_v__F, __pyx_v_n, __pyx_v_d);

  /* "cypari/auto_gen.pxi":15848
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfcoefs(_F, n, d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfconductor(mf, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15809
 *         return new_gen(_ret)
 * 
 *     def mfcoefs(F, long n, long d=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the vector of Fourier coefficients :math:`[a[0],a[d],...,a[nd]]` of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcoefs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15850
 *         return new_gen(_ret)
 * 
 *     def mfconductor(mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being output by :literal:`mfinit` for the cuspidal space and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_913mfconductor(PyObject *__pyx_v_mf, PyObject *__pyx_v_F); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_912mfconductor[] = "\n        :literal:`mf` being output by :literal:`mfinit` for the cuspidal space and\n        :math:`F` a modular form, gives the smallest level on which :math:`F` is defined.\n        \n        ::\n        \n            ? mf=mfinit([96,6],1); vF = mfbasis(mf); mfdim(mf)\n            %1 = 72\n            ? vector(10,i, mfconductor(mf, vF[i]))\n            %2 = [3, 6, 12, 24, 48, 96, 4, 8, 12, 16]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_913mfconductor(PyObject *__pyx_v_mf, PyObject *__pyx_v_F) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfconductor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_912mfconductor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), ((PyObject *)__pyx_v_F));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_912mfconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfconductor", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":15862
 *             %2 = [3, 6, 12, 24, 48, 96, 4, 8, 12, 16]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15863
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15863, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15864
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef long _ret = mfconductor(_mf, _F)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15865
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfconductor(_mf, _F)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15866
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef long _ret = mfconductor(_mf, _F)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfconductor(__pyx_v__mf, __pyx_v__F);

  /* "cypari/auto_gen.pxi":15867
 *         cdef GEN _F = (<Gen>F).g
 *         cdef long _ret = mfconductor(_mf, _F)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":15868
 *         cdef long _ret = mfconductor(_mf, _F)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfcosets(N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15850
 *         return new_gen(_ret)
 * 
 *     def mfconductor(mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being output by :literal:`mfinit` for the cuspidal space and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15870
 *         return _ret
 * 
 *     def mfcosets(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of right cosets of :math:`\Gamma_0(N) \\Gamma`, i.e., matrices
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_915mfcosets(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_914mfcosets[] = "\n        List of right cosets of :math:`\\Gamma_0(N) \\\\Gamma`, i.e., matrices\n        :math:`\\gamma_j \\in \\Gamma` such that :math:`\\Gamma = \\bigsqcup_j \\Gamma_0(N) \\gamma_j`.\n        The :math:`\\gamma_j` are chosen in the form :math:`[a,b;c,d]` with :math:`c \\| N`.\n        :math:`N` can be either a positive integer or a modular form space.\n        \n        ::\n        \n            ? mfcosets(4)\n            %1 = [[0, -1; 1, 0], [1, 0; 1, 1], [0, -1; 1, 2], [0, -1; 1, 3],\\\n             [1, 0; 2, 1], [1, 0; 4, 1]]\n        \n        :strong:`Warning.` in the present implementation, the trivial coset is\n        represented by :math:`[1,0;N,1]` and is the last in the list.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_915mfcosets(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcosets (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_914mfcosets(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_914mfcosets(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfcosets", 0);

  /* "cypari/auto_gen.pxi":15886
 *         represented by :math:`[1,0;N,1]` and is the last in the list.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcosets(_N)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15886, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15887
 *         '''
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcosets(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15888
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcosets(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcosets(__pyx_v__N);

  /* "cypari/auto_gen.pxi":15889
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcosets(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcuspisregular(NK, cusp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15870
 *         return _ret
 * 
 *     def mfcosets(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of right cosets of :math:`\Gamma_0(N) \\Gamma`, i.e., matrices
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcosets", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15891
 *         return new_gen(_ret)
 * 
 *     def mfcuspisregular(NK, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         In the space defined by :literal:`NK = [N,k,CHI]` or :literal:`NK = mf`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_917mfcuspisregular(PyObject *__pyx_v_NK, PyObject *__pyx_v_cusp); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_916mfcuspisregular[] = "\n        In the space defined by :literal:`NK = [N,k,CHI]` or :literal:`NK = mf`,\n        determine if :literal:`cusp` in canonical format (oo or denominator\n        dividing :math:`N`) is regular or not.\n        \n        ::\n        \n            ? mfcuspisregular([4,3,-4],1/2)\n            %1 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_917mfcuspisregular(PyObject *__pyx_v_NK, PyObject *__pyx_v_cusp) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcuspisregular (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_916mfcuspisregular(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), ((PyObject *)__pyx_v_cusp));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_916mfcuspisregular(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_cusp) {
  GEN __pyx_v__NK;
  GEN __pyx_v__cusp;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcuspisregular", 0);
  __Pyx_INCREF(__pyx_v_cusp);

  /* "cypari/auto_gen.pxi":15902
 *             %1 = 0
 *         '''
 *         cusp = objtogen(cusp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cusp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15902, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cusp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15903
 *         '''
 *         cusp = objtogen(cusp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15903, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15904
 *         cusp = objtogen(cusp)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15905
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _cusp = (<Gen>cusp).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cusp)->__pyx_base.g;
  __pyx_v__cusp = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15906
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfcuspisregular(__pyx_v__NK, __pyx_v__cusp);

  /* "cypari/auto_gen.pxi":15907
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":15908
 *         cdef long _ret = mfcuspisregular(_NK, _cusp)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfcusps(N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15891
 *         return new_gen(_ret)
 * 
 *     def mfcuspisregular(NK, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         In the space defined by :literal:`NK = [N,k,CHI]` or :literal:`NK = mf`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcuspisregular", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cusp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15910
 *         return _ret
 * 
 *     def mfcusps(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of cusps of :math:`\Gamma_0(N)` in the form :math:`a/b` with :math:`b \| N`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_919mfcusps(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_918mfcusps[] = "\n        List of cusps of :math:`\\Gamma_0(N)` in the form :math:`a/b` with :math:`b \\| N`.\n        :math:`N` can be either an integer of a modular form space.\n        \n        ::\n        \n            ? mfcusps(24)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_919mfcusps(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcusps (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_918mfcusps(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_918mfcusps(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfcusps", 0);

  /* "cypari/auto_gen.pxi":15920
 *             %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcusps(_N)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 15920, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15921
 *         '''
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcusps(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_2;

  /* "cypari/auto_gen.pxi":15922
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcusps(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcusps(__pyx_v__N);

  /* "cypari/auto_gen.pxi":15923
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfcusps(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcuspval(mf, F, cusp, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 15923, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15910
 *         return _ret
 * 
 *     def mfcusps(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         List of cusps of :math:`\Gamma_0(N)` in the form :math:`a/b` with :math:`b \| N`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcusps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15925
 *         return new_gen(_ret)
 * 
 *     def mfcuspval(mf, F, cusp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Valuation of modular form :math:`F` in the space :literal:`mf` at
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_921mfcuspval(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_920mfcuspval[] = "\n        Valuation of modular form :math:`F` in the space :literal:`mf` at\n        :literal:`cusp`, which can be either :math:`oo` or any rational number, and the\n        result is either a rational number or :math:`oo` if :math:`F` is zero. If :math:`\\mathbb{Q} (F)\n        != \\mathbb{Q} (\\chi)`, return the vector of valuations attached to the\n        :math:`[\\mathbb{Q} (F):\\mathbb{Q} (chi)]` complex embeddings of :math:`F`.\n        \n        ::\n        \n            ? T=mfTheta();mf=mfinit([12,1/2]);mfcusps(12)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/12]\n            ? apply(x->mfcuspval(mf,T,x),%1)\n            %2 = [0, 1/4, 0, 0, 1/4, 0]\n            ? mf=mfinit([12,6,12],1);F=mfbasis(mf)[5];\n            ? apply(x->mfcuspval(mf,F,x),%1)\n            %4 = [1/12, 1/6, 1/2, 2/3, 1/2, 2]\n            ? mf=mfinit([12,3,-4],1);F=mfbasis(mf)[1];\n            ? apply(x->mfcuspval(mf,F,x),%1)\n            %6 = [1/12, 1/6, 1/4, 2/3, 1/2, 1]\n            \n            ? mf = mfinit([625,2],0); [F] = mfeigenbasis(mf); mfparams(F)\n            %7 = [625, 2, 1, y^2 - y - 1] \\\\ [Q(F):Q(chi)] = poldegree(y^2-y-1)\n            ? mfcuspval(mf, F, 1/25)\n            %8 = [1, 2] \\\\ one conjugate has valuation 1, and the other is 2\n            ? mfcuspval(mf, F, 1/5)\n            %9 = [1/25, 1/25]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_921mfcuspval(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_cusp = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcuspval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_cusp,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F)) != 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_cusp)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfcuspval", 0, 2, 3, 1); __PYX_ERR(10, 15925, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfcuspval") < 0)) __PYX_ERR(10, 15925, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_F = values[0];
    __pyx_v_cusp = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15925, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfcuspval", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15925, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcuspval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_920mfcuspval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_F, __pyx_v_cusp, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_920mfcuspval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_cusp, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__cusp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mfcuspval", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_cusp);

  /* "cypari/auto_gen.pxi":15953
 *             %9 = [1/25, 1/25]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         cusp = objtogen(cusp)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15953, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15954
 *         '''
 *         F = objtogen(F)
 *         cusp = objtogen(cusp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cusp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cusp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15955
 *         F = objtogen(F)
 *         cusp = objtogen(cusp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15955, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15956
 *         cusp = objtogen(cusp)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15957
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15958
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cusp)->__pyx_base.g;
  __pyx_v__cusp = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15959
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":15960
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":15959
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 */
  }

  /* "cypari/auto_gen.pxi":15961
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfcuspval(__pyx_v__mf, __pyx_v__F, __pyx_v__cusp, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":15962
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfcuspval(_mf, _F, _cusp, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfcuspwidth(N, cusp):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15962, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15925
 *         return new_gen(_ret)
 * 
 *     def mfcuspval(mf, F, cusp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Valuation of modular form :math:`F` in the space :literal:`mf` at
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcuspval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_cusp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15964
 *         return new_gen(_ret)
 * 
 *     def mfcuspwidth(N, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         Width of :literal:`cusp` in :math:`\Gamma_0(N)`, :math:`N` being either an integer or a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_923mfcuspwidth(PyObject *__pyx_v_N, PyObject *__pyx_v_cusp); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_922mfcuspwidth[] = "\n        Width of :literal:`cusp` in :math:`\\Gamma_0(N)`, :math:`N` being either an integer or a\n        modular form space.\n        \n        ::\n        \n            ? mfcusps(12)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/12]\n            ? [mfcuspwidth(12,c) | c <- mfcusps(12)]\n            %2 = [12, 3, 4, 3, 1, 1]\n            ? mfcuspwidth(12, oo)\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_923mfcuspwidth(PyObject *__pyx_v_N, PyObject *__pyx_v_cusp) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfcuspwidth (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_922mfcuspwidth(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N), ((PyObject *)__pyx_v_cusp));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_922mfcuspwidth(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, PyObject *__pyx_v_cusp) {
  GEN __pyx_v__N;
  GEN __pyx_v__cusp;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfcuspwidth", 0);
  __Pyx_INCREF(__pyx_v_cusp);

  /* "cypari/auto_gen.pxi":15978
 *             %3 = 1
 *         '''
 *         cusp = objtogen(cusp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cusp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_cusp, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":15979
 *         '''
 *         cusp = objtogen(cusp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 15979, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":15980
 *         cusp = objtogen(cusp)
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15981
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _cusp = (<Gen>cusp).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cusp)->__pyx_base.g;
  __pyx_v__cusp = __pyx_t_3;

  /* "cypari/auto_gen.pxi":15982
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspwidth(_N, _cusp)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfcuspwidth(__pyx_v__N, __pyx_v__cusp);

  /* "cypari/auto_gen.pxi":15983
 *         cdef GEN _cusp = (<Gen>cusp).g
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":15984
 *         cdef long _ret = mfcuspwidth(_N, _cusp)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfderiv(F, long m=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15964
 *         return new_gen(_ret)
 * 
 *     def mfcuspwidth(N, cusp):             # <<<<<<<<<<<<<<
 *         r'''
 *         Width of :literal:`cusp` in :math:`\Gamma_0(N)`, :math:`N` being either an integer or a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfcuspwidth", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cusp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":15986
 *         return _ret
 * 
 *     def mfderiv(F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m`-th formal derivative of the power series corresponding to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_925mfderiv(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_924mfderiv[] = "\n        :math:`m`-th formal derivative of the power series corresponding to\n        the generalized modular form :math:`F`, with respect to the differential operator\n        :math:`qd/dq` (default :math:`m = 1`).\n        \n        ::\n        \n            ? D=mfDelta();\n            ? mfcoefs(D, 4)\n            %2 = [0, 1, -24, 252, -1472]\n            ? mfcoefs(mfderiv(D), 4)\n            %3 = [0, 1, -48, 756, -5888]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_925mfderiv(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfderiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfderiv") < 0)) __PYX_ERR(10, 15986, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 15986, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfderiv", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 15986, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfderiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_924mfderiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_924mfderiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_m) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfderiv", 0);

  /* "cypari/auto_gen.pxi":16000
 *             %3 = [0, 1, -48, 756, -5888]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderiv(_F, m)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16000, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16001
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfderiv(_F, m)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16002
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderiv(_F, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfderiv(__pyx_v__F, __pyx_v_m);

  /* "cypari/auto_gen.pxi":16003
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderiv(_F, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfderivE2(F, long m=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16003, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":15986
 *         return _ret
 * 
 *     def mfderiv(F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`m`-th formal derivative of the power series corresponding to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfderiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16005
 *         return new_gen(_ret)
 * 
 *     def mfderivE2(F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the Serre derivative :math:`(q.d/dq)F - kE_2F/12`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_927mfderivE2(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_926mfderivE2[] = "\n        Compute the Serre derivative :math:`(q.d/dq)F - kE_2F/12`\n        of the generalized modular form :math:`F`, which has weight :math:`k+2`;\n        if :math:`F` is a true modular form, then its Serre derivative is also modular.\n        If :math:`m > 1`, compute the :math:`m`-th iterate, of weight :math:`k + 2m`.\n        \n        ::\n        \n            ? mfcoefs(mfderivE2(mfEk(4)),5)*(-3)\n            %1 = [1, -504, -16632, -122976, -532728]\n            ? mfcoefs(mfEk(6),5)\n            %2 = [1, -504, -16632, -122976, -532728]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_927mfderivE2(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_m;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfderivE2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfderivE2") < 0)) __PYX_ERR(10, 16005, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_m = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16005, __pyx_L3_error)
    } else {
      __pyx_v_m = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfderivE2", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16005, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfderivE2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_926mfderivE2(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_926mfderivE2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_m) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfderivE2", 0);

  /* "cypari/auto_gen.pxi":16019
 *             %2 = [1, -504, -16632, -122976, -532728]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderivE2(_F, m)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16019, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16020
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfderivE2(_F, m)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16021
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderivE2(_F, m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfderivE2(__pyx_v__F, __pyx_v_m);

  /* "cypari/auto_gen.pxi":16022
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfderivE2(_F, m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfdim(NK, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16005
 *         return new_gen(_ret)
 * 
 *     def mfderivE2(F, long m=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the Serre derivative :math:`(q.d/dq)F - kE_2F/12`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfderivE2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16024
 *         return new_gen(_ret)
 * 
 *     def mfdim(NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives the dimension of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_929mfdim(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_928mfdim[] = "\n        If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives the dimension of the\n        corresponding subspace of :math:`M_k(\\Gamma_0(N),\\chi)`. :math:`NK` can also be the\n        output of :literal:`mfinit`, in which case space must be omitted.\n        \n        The subspace is described by the small integer :literal:`space`: :math:`0` for the\n        newspace :math:`S_k^{new}(\\Gamma_0(N),\\chi)`, :math:`1` for the cuspidal\n        space :math:`S_k`, :math:`2` for the oldspace :math:`S_k^{old}`, :math:`3` for the space of\n        Eisenstein series :math:`E_k` and :math:`4` for the full space :math:`M_k`.\n        \n        :strong:`Wildcards.`\n        As in :literal:`mfinit`, :emphasis:`CHI` may be the wildcard 0\n        (all Galois orbits of characters); in this case, the output is a vector of\n        :math:`[order, conrey, dim, dimdih]` corresponding\n        to the non-trivial spaces, where\n        \n        - :emphasis:`order` is the order of the character,\n        \n        - :emphasis:`conrey` its Conrey label from which the character may be recovered\n          via :literal:`znchar`:math:`(conrey)`,\n        \n        - :emphasis:`dim` the dimension of the corresponding space,\n        \n        - :emphasis:`dimdih` the dimension of the subspace of dihedral forms\n          corresponding to Hecke characters if :math:`k = 1` (this is not implemented for\n          the old space and set to :math:`-1` for the time being) and 0 otherwise.\n        \n        The spaces are sorted by increasing order of the character; the characters are\n        taken up to Galois conjugation and the Conrey number is the minimal one among\n        Galois conjugates. In weight :math:`1`, this is only implemented when\n        the space is 0 (newspace), 1 (cusp space), 2(old space) or 3(Eisenstein\n        series).\n        \n        :strong:`Wildcards for sets of characters.` :emphasis:`CHI` may be a set\n        of characters, and we return the set of :math:`""[dim,dimdih]`.\n        \n        :strong:`Wildcard for :math:`M_k(\\Gamma_1(N))`.`\n        Additionally, the wildcard :math:`CHI = -1` is available in which case we\n        output the total dimension of the corresponding\n        subspace of :math:`M_k(\\Gamma_1(N))`. In weight :math:`1`, this is not implemented\n        when the space is 4 (fullspace).\n        \n        ::\n        \n            ? mfdim([23,2], 0) \\\\ new space\n            %1 = 2\n            ? mfdim([96,6], 0)\n            %2 = 10\n            ? mfdim([10^9,4], 3) \\\\ Eisenstein space\n            %1 = 40000\n            ? mfdim([10^9+7,4], 3)\n            %2 = 2\n            ? mfdim([68,1,-1],0)\n            %3 = 3\n            ? mfdim([68,1,0],0)\n            %4 = [[2, Mod(67, 68), 1, 1], [4, Mod(47, 68), 1, 1]]\n            ? mfdim([124,1,0],0)\n            %5 = [[6, Mod(67, 124), 2, 0]]\n        \n        This last example shows that there exists a nondihedral form of weight 1\n        in level 124.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_929mfdim(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfdim (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfdim") < 0)) __PYX_ERR(10, 16024, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16024, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfdim", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16024, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_928mfdim(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), __pyx_v_space);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_928mfdim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfdim", 0);

  /* "cypari/auto_gen.pxi":16087
 *         in level 124.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfdim(_NK, space)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16087, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16088
 *         '''
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfdim(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16089
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfdim(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfdim(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_gen.pxi":16090
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfdim(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfdiv(F, G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16024
 *         return new_gen(_ret)
 * 
 *     def mfdim(NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI]` as in :literal:`mfinit`, gives the dimension of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16092
 *         return new_gen(_ret)
 * 
 *     def mfdiv(F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two generalized modular forms :math:`F` and :math:`G`, compute :math:`F/G` assuming
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_931mfdiv(PyObject *__pyx_v_F, PyObject *__pyx_v_G); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_930mfdiv[] = "\n        Given two generalized modular forms :math:`F` and :math:`G`, compute :math:`F/G` assuming\n        that the quotient will not have poles at infinity. If this is the\n        case, use :literal:`mfshift` before doing the division.\n        \n        ::\n        \n            ? D = mfDelta(); \\\\ Delta\n            ? H = mfpow(mfEk(4), 3);\n            ? J = mfdiv(H, D)\n             *** at top-level: J=mfdiv(H,mfdeltac\n             *** ^--------------------\n             *** mfdiv: domain error in mfdiv: ord(G) > ord(F)\n            ? J = mfdiv(H, mfshift(D,1));\n            ? mfcoefs(J, 4)\n            %4 = [1, 744, 196884, 21493760, 864299970]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_931mfdiv(PyObject *__pyx_v_F, PyObject *__pyx_v_G) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfdiv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_930mfdiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), ((PyObject *)__pyx_v_G));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_930mfdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfdiv", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_gen.pxi":16110
 *             %4 = [1, 744, 196884, 21493760, 864299970]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16111
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 16111, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16112
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfdiv(_F, _G)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16113
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfdiv(_F, _G)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16114
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfdiv(_F, _G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfdiv(__pyx_v__F, __pyx_v__G);

  /* "cypari/auto_gen.pxi":16115
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfdiv(_F, _G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfeigenbasis(mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16092
 *         return new_gen(_ret)
 * 
 *     def mfdiv(F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two generalized modular forms :math:`F` and :math:`G`, compute :math:`F/G` assuming
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16117
 *         return new_gen(_ret)
 * 
 *     def mfeigenbasis(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of the eigenforms for the space :literal:`mf`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_933mfeigenbasis(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_932mfeigenbasis[] = "\n        Vector of the eigenforms for the space :literal:`mf`.\n        The initial basis of forms computed by :literal:`mfinit` before splitting\n        is also available via :literal:`mfbasis`.\n        \n        ::\n        \n            ? mf = mfinit([26,2],0);\n            ? see(L) = for(i=1,#L,print(mfcoefs(L[i],6)));\n            ? see( mfeigenbasis(mf) )\n            [0, 1, -1, 1, 1, -3, -1]\n            [0, 1, 1, -3, 1, -1, -3]\n            ? see( mfbasis(mf) )\n            [0, 2, 0, -2, 2, -4, -4]\n            [0, -2, -4, 10, -2, 0, 8]\n        \n        The eigenforms are internally expressed as (algebraic) linear combinations of\n        :literal:`mfbasis(mf)` and it is very inefficient to compute many coefficients\n        of those forms individually: you should rather use :literal:`mfcoefs(mf)`\n        to expand the basis once and for all, then multiply by :literal:`mftobasis(mf,f)`\n        for the forms you're interested in:\n        \n        ::\n        \n            ? mf = mfinit([96,6],0); B = mfeigenbasis(mf); #B\n            %1 = 8;\n            ? vector(#B, i, mfcoefs(B[i],1000)); \\\\ expanded individually: slow\n            time = 7,881 ms.\n            ? M = mfcoefs(mf, 1000); \\\\ initialize once\n            time = 982 ms.\n            ? vector(#B, i, M * mftobasis(mf,B[i])); \\\\ then expand: much faster\n            time = 623 ms.\n        \n        When the eigenforms are defined over an extension field of :math:`\\mathbb{Q} (\\chi)` for a\n        non-rational character, their coefficients are hard to read and you may want\n        to lift them or to express them in an absolute number field. In the\n        construction below :math:`T` defines :math:`\\mathbb{Q} (f)` over :math:`\\mathbb{Q}`, :math:`a` is the image of the\n        generator :literal:`Mod`:math:`(t, t^2+t+1)` of :math:`\\mathbb{Q} (\\chi)` in :math:`\\mathbb{Q} (f)`\n        and :math:`y - ka` is the image of the root :math:`y` of :literal:`f.mod`:\n        \n      ""  ::\n        \n            ? mf = mfinit([31, 2, Mod(25,31)], 0); [f] = mfeigenbasis(mf);\n            ? f.mod\n            %2 = Mod(1, t^2 + t + 1)*y^2 + Mod(2*t + 2, t^2 + t + 1)\n            ? v = liftpol(mfcoefs(f,5))\n            %3 = [0, 1, (-t - 1)*y - 1, t*y + (t + 1), (2*t + 2)*y + 1, t]\n            ? [T,a,k] = rnfequation(mf.mod, f.mod, 1)\n            %4 = [y^4 + 2*y^2 + 4, Mod(-1/2*y^2 - 1, y^4 + 2*y^2 + 4), 0]\n            ? liftpol(substvec(v, [t,y], [a, y-k*a]))\n            %5 = [0, 1, 1/2*y^3 - 1, -1/2*y^3 - 1/2*y^2 - y, -y^3 + 1, -1/2*y^2 - 1]\n        \n        Beware that the meaning of :math:`y` has changed in the last line\n        is different: it now represents of root of :math:`T`, no longer of :literal:`f.mod`\n        (the notions coincide if :math:`k = 0` as here but it will not always be the case).\n        This can be avoided with an extra variable substitution, for instance\n        \n        ::\n        \n            ? [T,a,k] = rnfequation(mf.mod, subst(f.mod,'y,'x), 1)\n            %6 = [x^4 + 2*x^2 + 4, Mod(-1/2*x^2 - 1, x^4 + 2*x^2 + 4), 0]\n            ? liftpol(substvec(v, [t,y], [a, x-k*a]))\n            %7 = [0, 1, 1/2*x^3 - 1, -1/2*x^3 - 1/2*x^2 - x, -x^3 + 1, -1/2*x^2 - 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_933mfeigenbasis(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfeigenbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_932mfeigenbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_932mfeigenbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfeigenbasis", 0);

  /* "cypari/auto_gen.pxi":16182
 *             %7 = [0, 1, 1/2*x^3 - 1, -1/2*x^3 - 1/2*x^2 - x, -x^3 + 1, -1/2*x^2 - 1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfeigenbasis(_mf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16182, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16183
 *         '''
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfeigenbasis(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16184
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfeigenbasis(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfeigenbasis(__pyx_v__mf);

  /* "cypari/auto_gen.pxi":16185
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfeigenbasis(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfeigensearch(NK, AP=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16117
 *         return new_gen(_ret)
 * 
 *     def mfeigenbasis(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of the eigenforms for the space :literal:`mf`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfeigenbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16187
 *         return new_gen(_ret)
 * 
 *     def mfeigensearch(NK, AP=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Search for a normalized rational eigen cuspform with quadratic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_935mfeigensearch(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_934mfeigensearch[] = "\n        Search for a normalized rational eigen cuspform with quadratic\n        character given restrictions on a few initial coefficients. The meaning of\n        the parameters is as follows:\n        \n        - :literal:`NK` governs the limits of the search: it is of the form\n          :math:`[N,k]`: search for given level :math:`N`, weight :math:`k` and quadratic\n          character; note that the character :math:`(D/.)` is uniquely determined by :math:`(N,k)`.\n          The level :math:`N` can be replaced by a vector of allowed levels.\n        \n        - :literal:`AP` is the search criterion, which can be omitted: a list of\n          pairs :math:`[..., [p,a_p],...]`, where :math:`p` is a prime number and :math:`a_p` is\n          either a :literal:`t_INT` (the :math:`p`-th Fourier coefficient must match :math:`a_p` exactly)\n          or a :literal:`t_INTMOD` :literal:`Mod`:math:`(a,b)` (the :math:`p`-th coefficient must be congruent\n          to :math:`a` modulo :math:`b`).\n        \n        The result is a vector of newforms :math:`f` matching the search criteria, sorted\n        by increasing level then increasing :math:`\\|D\\|`.\n        \n        ::\n        \n            ? #mfeigensearch([[1..80],2], [[2,2],[3,-1]])\n            %1 = 1\n            ? #mfeigensearch([[1..80],2], [[2,2],[5,2]])\n            %2 = 1\n            ? v = mfeigensearch([[1..20],2], [[3,Mod(2,3)],[7,Mod(5,7)]]); #v\n            %3 = 1\n            ? F=v[1]; [mfparams(F)[1], mfcoefs(F,15)]\n            %4 = [11, [0, 1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_935mfeigensearch(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_AP = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfeigensearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_AP,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_AP);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfeigensearch") < 0)) __PYX_ERR(10, 16187, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_AP = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfeigensearch", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16187, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfeigensearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_934mfeigensearch(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), __pyx_v_AP);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_934mfeigensearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_AP) {
  int __pyx_v__have_AP;
  GEN __pyx_v__NK;
  GEN __pyx_v__AP;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfeigensearch", 0);
  __Pyx_INCREF(__pyx_v_AP);

  /* "cypari/auto_gen.pxi":16218
 *             %4 = [11, [0, 1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1]]
 *         '''
 *         cdef bint _have_AP = (AP is not None)             # <<<<<<<<<<<<<<
 *         if _have_AP:
 *             AP = objtogen(AP)
 */
  __pyx_t_1 = (__pyx_v_AP != Py_None);
  __pyx_v__have_AP = __pyx_t_1;

  /* "cypari/auto_gen.pxi":16219
 *         '''
 *         cdef bint _have_AP = (AP is not None)
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             AP = objtogen(AP)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_AP != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16220
 *         cdef bint _have_AP = (AP is not None)
 *         if _have_AP:
 *             AP = objtogen(AP)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_AP, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_AP, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":16219
 *         '''
 *         cdef bint _have_AP = (AP is not None)
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             AP = objtogen(AP)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":16221
 *         if _have_AP:
 *             AP = objtogen(AP)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 16221, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16222
 *             AP = objtogen(AP)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _AP = NULL
 *         if _have_AP:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_4;

  /* "cypari/auto_gen.pxi":16223
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL             # <<<<<<<<<<<<<<
 *         if _have_AP:
 *             _AP = (<Gen>AP).g
 */
  __pyx_v__AP = NULL;

  /* "cypari/auto_gen.pxi":16224
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 */
  __pyx_t_1 = (__pyx_v__have_AP != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16225
 *         cdef GEN _AP = NULL
 *         if _have_AP:
 *             _AP = (<Gen>AP).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_AP)->__pyx_base.g;
    __pyx_v__AP = __pyx_t_4;

    /* "cypari/auto_gen.pxi":16224
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _AP = NULL
 *         if _have_AP:             # <<<<<<<<<<<<<<
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 */
  }

  /* "cypari/auto_gen.pxi":16226
 *         if _have_AP:
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfeigensearch(__pyx_v__NK, __pyx_v__AP);

  /* "cypari/auto_gen.pxi":16227
 *             _AP = (<Gen>AP).g
 *         cdef GEN _ret = mfeigensearch(_NK, _AP)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfembed(f, v=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16187
 *         return new_gen(_ret)
 * 
 *     def mfeigensearch(NK, AP=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Search for a normalized rational eigen cuspform with quadratic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfeigensearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_AP);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16229
 *         return new_gen(_ret)
 * 
 *     def mfembed(f, v=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` be a generalized modular form with parameters :math:`[N,k,\chi,P]` (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_937mfembed(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_936mfembed[] = "\n        Let :math:`f` be a generalized modular form with parameters :math:`[N,k,\\chi,P]` (see\n        :literal:`mfparams`, we denote :math:`\\mathbb{Q} (\\chi)` the subfield of :math:`\\mathbb{C}` generated by the\n        values of :math:`\\chi` and :math:`\\mathbb{Q} (f)` the field of definition of :math:`f`. In this context\n        :math:`\\mathbb{Q} (\\chi)` has a single canonical complex embeding given by\n        :math:`s: Mod(t, polcyclo(n,t)) :--->\\exp (2i\\pi/n)` and the number field\n        :math:`\\mathbb{Q} (f)` has :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]` induced embeddings attached to the complex\n        roots of the polynomial :math:`s(P)`. If :math:`\\mathbb{Q} (f)` is stricly larger than :math:`\\mathbb{Q} (\\chi)`\n        we only allow an :math:`f` which is an eigenform, produced by :literal:`mfeigenbasis`.\n        \n        This function is meant to create embeddings of :math:`\\mathbb{Q} (f)` and/or apply them\n        to the object :math:`v`, typically a vector of Fourier coefficients of :math:`f`\n        from :literal:`mfcoefs`.\n        \n        - If :math:`v` is omitted and :math:`f` is a modular form as above, we return the\n          embedding of :math:`\\mathbb{Q} (\\chi)` if :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q} (f)` and a vector containing\n          :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]` embeddings of :math:`\\mathbb{Q} (f)` otherwise.\n        \n        - If :math:`v` is given, it must be a scalar in :math:`\\mathbb{Q} (f)`, or a vector/matrix of\n          such, we apply the embeddings coefficientwise and return either\n          a single result if :math:`\\mathbb{Q} (f) = \\mathbb{Q} (\\chi)` and a vector of :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]`\n          results otherwise.\n        \n        - Finally :math:`f` can be replaced by a single embedding produced by\n          :literal:`mfembed`:math:`(f)` (:math:`v` was omitted) and we apply that particular embedding\n          to :math:`v`.\n        ""\n        ::\n        \n            ? mf = mfinit([35,2,Mod(11,35)], 0);\n            ? [f] = mfbasis(mf);\n            ? f.mod \\\\ Q (chi) = Q (zeta_3)\n            %3 = t^2 + t + 1\n            ? v = mfcoefs(f,5); lift(v) \\\\ coefficients in Q (chi)\n            %4 = [0, 2, -2*t - 2, 2*t, 2*t, -2*t - 2]\n            ? mfembed(f, v) \\\\ single embedding\n            %5 = [0, 2, -1 - 1.7320...*I, -1 + 1.73205...*I, -1 + 1.7320...*I, ...]\n            \n            ? [F] = mfeigenbasis(mf);\n            ? mffields(mf)\n            %7 = [y^2 + Mod(-2*t, t^2 + t + 1)] \\\\ [Q (f):Q (chi)] = 2\n            ? V = liftpol( mfcoefs(F,5) );\n            %8 = [0, 1, y + (-t - 1), (t + 1)*y + t, (-2*t - 2)*y + t, -t - 1]\n            ? vall = mfembed(F, V); #vall\n            %9 = 2 \\\\ 2 embeddings, both applied to V\n            ? vall[1] \\\\ the first\n            %10 = [0, 1, -1.2071... - 2.0907...*I, 0.2071... - 0.3587...*I, ...]\n            ? vall[2] \\\\ and the second one\n            %11 = [0, 1, 0.2071... + 0.3587...*I, -1.2071... + 2.0907...*I, ...]\n            \n            ? vE = mfembed(F); #vE \\\\ same 2 embeddings\n            %12 = 2\n            ? mfembed(vE[1], V) \\\\ apply first embedding to V\n            %13 = [0, 1, -1.2071... - 2.0907...*I, 0.2071... - 0.3587...*I, ...]\n        \n        For convenience, we also allow a modular form space from :literal:`mfinit`\n        instead of :math:`f`, corresponding to the single embedding of :math:`\\mathbb{Q} (\\chi)`.\n        \n        ::\n        \n            ? [mfB,MC,C] = mfatkininit(mf,7); MC \\\\ coefs in Q (chi)\n            %13 =\n            [ Mod(2/7*t, t^2 + t + 1) Mod(-1/7*t - 2/7, t^2 + t + 1)]\n            \n            [Mod(-1/7*t - 2/7, t^2 + t + 1) Mod(2/7*t, t^2 + t + 1)]\n            \n            ? C \\\\ normalizing constant\n            %14 = 0.33863... - 0.16787*I\n            ? M = mfembed(mf, MC) / C \\\\ the true matrix for the action of w_7\n            [-0.6294... + 0.418""6...*I -0.3625... - 0.5450...*I]\n            \n            [-0.3625... - 0.5450...*I -0.6294... + 0.4186...*I]\n            \n            ? exponent(M*conj(M) - 1) \\\\ M * conj(M) is close to 1\n            %16 = -126\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_937mfembed(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfembed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfembed") < 0)) __PYX_ERR(10, 16229, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_v = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16229, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfembed", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16229, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_936mfembed(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_v, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_936mfembed(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_v, long __pyx_v_precision) {
  int __pyx_v__have_v;
  GEN __pyx_v__f;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfembed", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":16306
 *             %16 = -126
 *         '''
 *         cdef bint _have_v = (v is not None)             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             v = objtogen(v)
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_v__have_v = __pyx_t_1;

  /* "cypari/auto_gen.pxi":16307
 *         '''
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_v != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16308
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:
 *             v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16308, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":16307
 *         '''
 *         cdef bint _have_v = (v is not None)
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             v = objtogen(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":16309
 *         if _have_v:
 *             v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 16309, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16310
 *             v = objtogen(v)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = NULL
 *         if _have_v:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":16311
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL             # <<<<<<<<<<<<<<
 *         if _have_v:
 *             _v = (<Gen>v).g
 */
  __pyx_v__v = NULL;

  /* "cypari/auto_gen.pxi":16312
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_v != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16313
 *         cdef GEN _v = NULL
 *         if _have_v:
 *             _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfembed0(_f, _v, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":16312
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _v = NULL
 *         if _have_v:             # <<<<<<<<<<<<<<
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":16314
 *         if _have_v:
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfembed0(_f, _v, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":16315
 *             _v = (<Gen>v).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfembed0(_f, _v, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfembed0(__pyx_v__f, __pyx_v__v, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":16316
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mfembed0(_f, _v, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfeval(mf, F, vtau, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16229
 *         return new_gen(_ret)
 * 
 *     def mfembed(f, v=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` be a generalized modular form with parameters :math:`[N,k,\chi,P]` (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16318
 *         return new_gen(_ret)
 * 
 *     def mfeval(mf, F, vtau, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the numerical value of the modular form :math:`F`, belonging
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_939mfeval(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_938mfeval[] = "\n        Computes the numerical value of the modular form :math:`F`, belonging\n        to :emphasis:`mf`, at the complex number :literal:`vtau` or the vector :literal:`vtau`\n        of complex numbers in the completed upper-half plane. The result is given\n        with absolute error less than :math:`2^{-B}`, where :math:`B = realbitprecision`.\n        \n        If the field of definition :math:`\\mathbb{Q} (F)` is larger than :math:`\\mathbb{Q} (\\chi)` then :math:`F` may be\n        embedded into :math:`\\mathbb{C}` in :math:`d = [\\mathbb{Q} (F):\\mathbb{Q} (\\chi)]` ways, in which case a vector of\n        the :math:`d` results is returned.\n        \n        ::\n        \n            ? mf = mfinit([11,2],0); F = mfbasis(mf)[1]; mfparams(F)\n            %1 = [11, 2, 1, y] \\\\ Q(F) = Q(chi) = Q\n            ? mfeval(mf,F,I/2)\n            %2 = 0.039405471130100890402470386372028382117\n            ? mf = mfinit([35,2],0); F = mfeigenbasis(mf)[2]; mfparams(F)\n            %3 = [35, 2, 1, y^2 - y - 4] \\\\ [Q(F) : Q(chi)] = 2\n            ? mfeval(mf,F,I/2)\n            %4 = [0.045..., 0.0385...] \\\\ sigma_1(F) and sigma_2(F) at I/2\n            ? mf = mfinit([12,4],1); F = mfbasis(mf)[1];\n            ? mfeval(mf, F, 0.318+10^(-7)*I)\n            %6 = 3.379... E-21 + 6.531... E-21*I \\\\ instantaneous !\n        \n        In order to maximize the imaginary part of the argument,\n        the function computes :math:`(f \\| _k \\gamma)(\\gamma^{-1}.\\tau)` for a\n        suitable :math:`\\gamma` not necessarily in :math:`\\Gamma_0(N)` (in which case :math:`f \\|\n        \\gamma` is evaluated using :literal:`mfslashexpansion`).\n        \n        ::\n        \n            ? T = mfTheta(); mf = mfinit(T); mfeval(mf,T,[0,1/2,1,oo])\n            %1 = [1/2 - 1/2*I, 0, 1/2 - 1/2*I, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_939mfeval(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_vtau = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfeval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_vtau,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F)) != 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_vtau)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfeval", 0, 2, 3, 1); __PYX_ERR(10, 16318, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfeval") < 0)) __PYX_ERR(10, 16318, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_F = values[0];
    __pyx_v_vtau = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16318, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfeval", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16318, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_938mfeval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_F, __pyx_v_vtau, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_938mfeval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, PyObject *__pyx_v_vtau, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__vtau;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mfeval", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_vtau);

  /* "cypari/auto_gen.pxi":16353
 *             %1 = [1/2 - 1/2*I, 0, 1/2 - 1/2*I, 1]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         vtau = objtogen(vtau)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16354
 *         '''
 *         F = objtogen(F)
 *         vtau = objtogen(vtau)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_vtau, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vtau, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16355
 *         F = objtogen(F)
 *         vtau = objtogen(vtau)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 16355, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16356
 *         vtau = objtogen(vtau)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16357
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16358
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vtau)->__pyx_base.g;
  __pyx_v__vtau = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16359
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":16360
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":16359
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _vtau = (<Gen>vtau).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 */
  }

  /* "cypari/auto_gen.pxi":16361
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfeval(__pyx_v__mf, __pyx_v__F, __pyx_v__vtau, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":16362
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfeval(_mf, _F, _vtau, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffields(mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16318
 *         return new_gen(_ret)
 * 
 *     def mfeval(mf, F, vtau, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the numerical value of the modular form :math:`F`, belonging
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_vtau);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16364
 *         return new_gen(_ret)
 * 
 *     def mffields(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`mf` as output by :literal:`mfinit` with parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_941mffields(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_940mffields[] = "\n        Given :literal:`mf` as output by :literal:`mfinit` with parameters\n        :math:`(N,k,\\chi)`, returns the vector of polynomials defining each Galois orbit of\n        newforms over :math:`\\mathbb{Q} (\\chi)`.\n        \n        ::\n        \n            ? mf = mfinit([35,2],0); mffields(mf)\n            %1 = [y, y^2 - y - 4]\n        \n        Here the character is trivial so :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q})` and there\n        are 3 newforms: one is rational (corresponding to :math:`y`), the other two are\n        conjugate and defined over the quadratic field :math:`\\mathbb{Q}[y]/(y^2-y-4)`.\n        \n        ::\n        \n            ? [G,chi] = znchar(Mod(3,35));\n            ? zncharconductor(G,chi)\n            %2 = 35\n            ? charorder(G,chi)\n            %3 = 12\n            ? mf = mfinit([35, 2, [G,chi]],0); mffields(mf)\n            %4 = [y, y]\n        \n        Here the character is primitive of order 12 and the two newforms are\n        defined over :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q} (\\zeta_{12})`.\n        \n        ::\n        \n            ? mf = mfinit([35, 2, Mod(13,35)],0); mffields(mf)\n            %3 = [y^2 + Mod(5*t, t^2 + 1)]\n        \n        This time the character has order 4 and there are two conjugate\n        newforms over :math:`\\mathbb{Q} (\\chi) = Q(i)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_941mffields(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffields (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_940mffields(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_940mffields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mffields", 0);

  /* "cypari/auto_gen.pxi":16400
 *         newforms over :math:`\mathbb{Q} (\chi) = Q(i)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mffields(_mf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16400, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16401
 *         '''
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffields(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16402
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mffields(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffields(__pyx_v__mf);

  /* "cypari/auto_gen.pxi":16403
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mffields(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffromell(E):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16364
 *         return new_gen(_ret)
 * 
 *     def mffields(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`mf` as output by :literal:`mfinit` with parameters
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16405
 *         return new_gen(_ret)
 * 
 *     def mffromell(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over :math:`Q` given by an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_943mffromell(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_942mffromell[] = "\n        :math:`E` being an elliptic curve defined over :math:`Q` given by an\n        integral model in :literal:`ellinit` format, computes a 3-component vector\n        :literal:`[mf,F,v]`, where :math:`F` is the newform corresponding to :math:`E` by\n        modularity, :literal:`mf` is the newspace to which :math:`F` belongs, and\n        :literal:`v` gives the coefficients of :math:`F` on :literal:`mfbasis(mf)`.\n        \n        ::\n        \n            ? E = ellinit(\"26a1\");\n            ? [mf,F,co] = mffromell(E);\n            ? co\n            %2 = [3/4, 1/4]~\n            ? mfcoefs(F, 5)\n            %3 = [0, 1, -1, 1, 1, -3]\n            ? ellan(E, 5)\n            %4 = [1, -1, 1, 1, -3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_943mffromell(PyObject *__pyx_v_E, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffromell (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_942mffromell(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_942mffromell(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mffromell", 0);

  /* "cypari/auto_gen.pxi":16424
 *             %4 = [1, -1, 1, 1, -3]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = mffromell(_E)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16424, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16425
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffromell(_E)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16426
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = mffromell(_E)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffromell(__pyx_v__E);

  /* "cypari/auto_gen.pxi":16427
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = mffromell(_E)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffrometaquo(eta, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16405
 *         return new_gen(_ret)
 * 
 *     def mffromell(E):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`E` being an elliptic curve defined over :math:`Q` given by an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffromell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16429
 *         return new_gen(_ret)
 * 
 *     def mffrometaquo(eta, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Modular form corresponding to the eta quotient matrix :literal:`eta`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_945mffrometaquo(PyObject *__pyx_v_eta, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_944mffrometaquo[] = "\n        Modular form corresponding to the eta quotient matrix :literal:`eta`.\n        If the valuation :math:`v` at infinity is fractional, return :math:`0`. If the eta\n        quotient is not holomorphic but simply meromorphic, return :math:`0` if\n        :literal:`flag = 0`, return the eta quotient (divided by :math:`q` to the power :math:`-v` if\n        :math:`v < 0`, i.e., with valuation :math:`0`) if flag is set.\n        \n        ::\n        \n            ? mffrometaquo(Mat([1,1]),1)\n            %1 = 0\n            ? mfcoefs(mffrometaquo(Mat([1,24])),6)\n            %2 = [0, 1, -24, 252, -1472, 4830, -6048]\n            ? mfcoefs(mffrometaquo([1,1;23,1]),10)\n            %3 = [0, 1, -1, -1, 0, 0, 1, 0, 1, 0, 0]\n            ? F = mffrometaquo([1,2;2,-1]); mfparams(F)\n            %4 = [16,1/2,1,y]\n            ? mfcoefs(F,10)\n            %5 = [1, -2, 0, 0, 2, 0, 0, 0, 0, -2, 0]\n            ? mffrometaquo(Mat([1,-24]))\n            %6 = 0\n            ? f = mffrometaquo(Mat([1,-24]),1); mfcoefs(f,6)\n            %7 = [1, 24, 324, 3200, 25650, 176256, 1073720]\n        \n        For convenience, a :literal:`t_VEC` is also accepted instead of\n        a factorization matrix with a single row:\n        \n        ::\n        \n            ? f = mffrometaquo([1,24]); \\\\ also valid\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_945mffrometaquo(PyObject *__pyx_v_eta, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffrometaquo (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mffrometaquo") < 0)) __PYX_ERR(10, 16429, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16429, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mffrometaquo", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16429, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffrometaquo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_944mffrometaquo(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_eta), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_944mffrometaquo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_eta, long __pyx_v_flag) {
  GEN __pyx_v__eta;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mffrometaquo", 0);

  /* "cypari/auto_gen.pxi":16461
 *             ? f = mffrometaquo([1,24]); \\ also valid
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _eta = (<Gen>eta).g
 *         cdef GEN _ret = mffrometaquo(_eta, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16461, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16462
 *         '''
 *         sig_on()
 *         cdef GEN _eta = (<Gen>eta).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffrometaquo(_eta, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_eta)->__pyx_base.g;
  __pyx_v__eta = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16463
 *         sig_on()
 *         cdef GEN _eta = (<Gen>eta).g
 *         cdef GEN _ret = mffrometaquo(_eta, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffrometaquo(__pyx_v__eta, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":16464
 *         cdef GEN _eta = (<Gen>eta).g
 *         cdef GEN _ret = mffrometaquo(_eta, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffromlfun(L, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16429
 *         return new_gen(_ret)
 * 
 *     def mffrometaquo(eta, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Modular form corresponding to the eta quotient matrix :literal:`eta`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffrometaquo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16466
 *         return new_gen(_ret)
 * 
 *     def mffromlfun(L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`L` being an :math:`L`-function in any of the :literal:`lfun` formats representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_947mffromlfun(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_946mffromlfun[] = "\n        Let :math:`L` being an :math:`L`-function in any of the :literal:`lfun` formats representing\n        a self-dual modular form (for instance an eigenform). Return\n        :literal:`[NK,space,v]` when :literal:`mf = mfinit(NK,space)` is the modular\n        form space containing the form and :literal:`mftobasis(mf, v)` will represent it\n        on the space basis. If :math:`L` has rational coefficients, this will be enough\n        to recognize the modular form in :emphasis:`mf`:\n        \n        ::\n        \n            ? L = lfuncreate(x^2+1);\n            ? lfunan(L,10)\n            %2 = [1, 1, 0, 1, 2, 0, 0, 1, 1, 2]\n            ? [NK,space,v] = mffromlfun(L); NK\n            %4 = [4, 1, -4]\n            ? mf=mfinit(NK,space); w = mftobasis(mf,v)\n            %5 = [1.0000000000000000000000000000000000000]~\n            ? [f] = mfbasis(mf); mfcoefs(f,10) \\\\ includes a_0 !\n            %6 = [1/4, 1, 1, 0, 1, 2, 0, 0, 1, 1, 2]\n        \n        If :math:`L` has inexact complex coefficients, one can for instance\n        compute an eigenbasis for :emphasis:`mf` and check whether one of the attached\n        :math:`L`-function is reasonably close to :math:`L`. In the example, we cheat by\n        producing the :math:`L` function from an eigenform in a known space, but the\n        function does not use this information:\n        \n        ::\n        \n            ? mf = mfinit([32,6,Mod(5,32)],0);\n            ? [poldegree(K) | K<-mffields(mf)]\n            %2 = [19] \\\\ one orbit, [Q(F) : Q(chi)] = 19\n            ? L = lfunmf(mf)[1][1]; \\\\ one of the 19 L-functions attached to F\n            ? lfunan(L,3)\n            %4 = [1, 5.654... - 0.1812...*I, -7.876... - 19.02...*I]\n            ? [NK,space,v] = mffromlfun(L); NK\n            %5 = [32, 6, Mod(5, 32)]\n            ? vL = concat(lfunmf(mf)); \\\\ L functions for all cuspidal eigenforms\n            ? an = lfunan(L,10);\n            ? for (i = 1, #vL, if (normlp(lfunan(vL[i],10) - an, oo)"" < 1e-10, print(i)));\n            1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_947mffromlfun(PyObject *__pyx_v_L, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffromlfun (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mffromlfun") < 0)) __PYX_ERR(10, 16466, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16466, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mffromlfun", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16466, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffromlfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_946mffromlfun(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_L), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_946mffromlfun(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_L, long __pyx_v_precision) {
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mffromlfun", 0);

  /* "cypari/auto_gen.pxi":16508
 *             1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16508, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16509
 *         '''
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mffromlfun(_L, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16510
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffromlfun(_L, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":16511
 *         cdef GEN _L = (<Gen>L).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mffromlfun(_L, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffromlfun(__pyx_v__L, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":16512
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mffromlfun(_L, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mffromqf(Q, P=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16512, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16466
 *         return new_gen(_ret)
 * 
 *     def mffromlfun(L, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`L` being an :math:`L`-function in any of the :literal:`lfun` formats representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffromlfun", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16514
 *         return new_gen(_ret)
 * 
 *     def mffromqf(Q, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being an even integral positive definite quadratic form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_949mffromqf(PyObject *__pyx_v_Q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_948mffromqf[] = "\n        :math:`Q` being an even integral positive definite quadratic form\n        and :math:`P` a homogeneous spherical polynomial for :math:`Q`, computes\n        a 3-component vector :math:`[mf,F,v]`, where :math:`F` is the theta function\n        corresponding to :math:`(Q,P)`, :emphasis:`mf` is the corresponding space of modular\n        forms (from :literal:`mfinit`), and :math:`v` gives the coefficients of :math:`F` on\n        :literal:`mfbasis(mf)`.\n        \n        ::\n        \n            ? [mf,F,v] = mffromqf(2*matid(10)); v\n            %1 = [64/5, 4/5, 32/5]~\n            ? mfcoefs(F, 5)\n            %2 = [1, 20, 180, 960, 3380, 8424]\n            ? mfcoef(F, 10000) \\\\ number of ways of writing 10000 as sum of 10 squares\n            %3 = 128205250571893636\n            ? mfcoefs(F, 10000); \\\\ fast !\n            time = 220ms\n            ? [mf,F,v] = mffromqf([2,0;0,2],x^4-6*x^2*y^2+y^4);\n            ? mfcoefs(F,10)\n            %6 = [0, 4, -16, 0, 64, -56, 0, 0, -256, 324, 224]\n            ? mfcoef(F,100000) \\\\ instantaneous\n            %7 = 41304367104\n        \n        Odd dimensions are supported, corresponding to forms of half-integral weight:\n        \n        ::\n        \n            ? [mf,F,v] = mffromqf(2*matid(3));\n            ? mfisequal(F, mfpow(mfTheta(),3))\n            %2 = 1\n            ? mfcoefs(F, 32) \\\\ illustrate Legendre's 3-square theorem\n            %3 = [ 1,\n             6, 12, 8, 6, 24, 24, 0, 12,\n             30, 24, 24, 8, 24, 48, 0, 6,\n             48, 36, 24,24, 48, 24, 0, 24,\n             30, 72, 32, 0, 72, 48, 0, 12]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_949mffromqf(PyObject *__pyx_v_Q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mffromqf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mffromqf") < 0)) __PYX_ERR(10, 16514, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_P = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mffromqf", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16514, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffromqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_948mffromqf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Q), __pyx_v_P);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_948mffromqf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, PyObject *__pyx_v_P) {
  int __pyx_v__have_P;
  GEN __pyx_v__Q;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mffromqf", 0);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_gen.pxi":16553
 *              30, 72, 32, 0, 72, 48, 0, 12]
 *         '''
 *         cdef bint _have_P = (P is not None)             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             P = objtogen(P)
 */
  __pyx_t_1 = (__pyx_v_P != Py_None);
  __pyx_v__have_P = __pyx_t_1;

  /* "cypari/auto_gen.pxi":16554
 *         '''
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_P != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16555
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:
 *             P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16555, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":16554
 *         '''
 *         cdef bint _have_P = (P is not None)
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             P = objtogen(P)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":16556
 *         if _have_P:
 *             P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 16556, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16557
 *             P = objtogen(P)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = NULL
 *         if _have_P:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_4;

  /* "cypari/auto_gen.pxi":16558
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL             # <<<<<<<<<<<<<<
 *         if _have_P:
 *             _P = (<Gen>P).g
 */
  __pyx_v__P = NULL;

  /* "cypari/auto_gen.pxi":16559
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)
 */
  __pyx_t_1 = (__pyx_v__have_P != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16560
 *         cdef GEN _P = NULL
 *         if _have_P:
 *             _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mffromqf(_Q, _P)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
    __pyx_v__P = __pyx_t_4;

    /* "cypari/auto_gen.pxi":16559
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _P = NULL
 *         if _have_P:             # <<<<<<<<<<<<<<
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)
 */
  }

  /* "cypari/auto_gen.pxi":16561
 *         if _have_P:
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mffromqf(__pyx_v__Q, __pyx_v__P);

  /* "cypari/auto_gen.pxi":16562
 *             _P = (<Gen>P).g
 *         cdef GEN _ret = mffromqf(_Q, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfgaloistype(NK, F=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16514
 *         return new_gen(_ret)
 * 
 *     def mffromqf(Q, P=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`Q` being an even integral positive definite quadratic form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mffromqf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16564
 *         return new_gen(_ret)
 * 
 *     def mfgaloistype(NK, F=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being either :literal:`[N,1,CHI]` or an :literal:`mf` output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_951mfgaloistype(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_950mfgaloistype[] = "\n        :literal:`NK` being either :literal:`[N,1,CHI]` or an :literal:`mf` output by\n        :literal:`mfinit` in weight :math:`1`, gives the vector of types of Galois\n        representations attached to each cuspidal eigenform,\n        unless the modular form :literal:`F` is specified, in which case only for :literal:`F`\n        (note that it is not tested whether :literal:`F` belongs to the correct modular\n        form space, nor whether it is a cuspidal eigenform). Types :math:`A_4`, :math:`S_4`,\n        :math:`A_5` are represented by minus their cardinality :math:`-12`, :math:`-24`, or :math:`-60`,\n        and type :math:`D_n` is represented by its cardinality, the integer :math:`2n`:\n        \n        ::\n        \n            ? mfgaloistype([124,1, Mod(67,124)]) \\\\ A4\n            %1 = [-12]\n            ? mfgaloistype([148,1, Mod(105,148)]) \\\\ S4\n            %2 = [-24]\n            ? mfgaloistype([633,1, Mod(71,633)]) \\\\ D10, A5\n            %3 = [10, -60]\n            ? mfgaloistype([239,1, -239]) \\\\ D6, D10, D30\n            %4 = [6, 10, 30]\n            ? mfgaloistype([71,1, -71])\n            %5 = [14]\n            ? mf = mfinit([239,1, -239],0); F = mfeigenbasis(mf)[2];\n            ? mfgaloistype(mf, F)\n            %7 = 10\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_951mfgaloistype(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfgaloistype (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfgaloistype") < 0)) __PYX_ERR(10, 16564, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_F = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfgaloistype", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16564, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfgaloistype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_950mfgaloistype(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), __pyx_v_F);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_950mfgaloistype(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_F) {
  int __pyx_v__have_F;
  GEN __pyx_v__NK;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfgaloistype", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":16591
 *             %7 = 10
 *         '''
 *         cdef bint _have_F = (F is not None)             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             F = objtogen(F)
 */
  __pyx_t_1 = (__pyx_v_F != Py_None);
  __pyx_v__have_F = __pyx_t_1;

  /* "cypari/auto_gen.pxi":16592
 *         '''
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_F != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16593
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 *             F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":16592
 *         '''
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":16594
 *         if _have_F:
 *             F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 16594, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16595
 *             F = objtogen(F)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = NULL
 *         if _have_F:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_4;

  /* "cypari/auto_gen.pxi":16596
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             _F = (<Gen>F).g
 */
  __pyx_v__F = NULL;

  /* "cypari/auto_gen.pxi":16597
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 */
  __pyx_t_1 = (__pyx_v__have_F != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":16598
 *         cdef GEN _F = NULL
 *         if _have_F:
 *             _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
    __pyx_v__F = __pyx_t_4;

    /* "cypari/auto_gen.pxi":16597
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 */
  }

  /* "cypari/auto_gen.pxi":16599
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfgaloistype(__pyx_v__NK, __pyx_v__F);

  /* "cypari/auto_gen.pxi":16600
 *             _F = (<Gen>F).g
 *         cdef GEN _ret = mfgaloistype(_NK, _F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfhecke(mf, F, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 16600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16564
 *         return new_gen(_ret)
 * 
 *     def mfgaloistype(NK, F=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being either :literal:`[N,1,CHI]` or an :literal:`mf` output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfgaloistype", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16602
 *         return new_gen(_ret)
 * 
 *     def mfhecke(mf, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form in modular form space :emphasis:`mf`, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_953mfhecke(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_952mfhecke[] = "\n        :math:`F` being a modular form in modular form space :emphasis:`mf`, returns\n        :math:`T(n)F`, where :math:`T(n)` is the :math:`n`-th Hecke operator.\n        \n        :strong:`Warning.` If :math:`F` is of level :math:`M < N`, then :math:`T(n)F`\n        is in general not the same in :math:`M_k(\\Gamma_0(M),\\chi)` and in\n        :math:`M_k(\\Gamma_0(N),\\chi)`. We take :math:`T(n)` at the same level as the one used in\n        :literal:`mf`.\n        \n        ::\n        \n            ? mf = mfinit([26,2],0); F = mfbasis(mf)[1]; mftobasis(mf,F)\n            %1 = [1, 0]~\n            ? G2 = mfhecke(mf,F,2); mftobasis(mf,G2)\n            %2 = [0, 1]~\n            ? G5 = mfhecke(mf,F,5); mftobasis(mf,G5)\n            %3 = [-2, 1]~\n        \n        Modular forms of half-integral weight are supported, in\n        which case :math:`n` must be a perfect square, else :math:`T_n` will act as :math:`0` (the\n        operator :math:`T_p` for :math:`p \\| N` is not supported yet):\n        \n        ::\n        \n            ? F = mfpow(mfTheta(),3); mf = mfinit(F);\n            ? mfisequal(mfhecke(mf,F,9), mflinear([F],[4]))\n            %2 = 1\n        \n        (:math:`F` is an eigenvector of all :math:`T_{p^2}`, with eigenvalue :math:`p+1` for\n        odd :math:`p`.)\n        \n        :strong:`Warning.` When :math:`n` is a large composite, resp.\302\240the square of a large\n        composite in half-integral weight, it is in general more efficient to use\n        :literal:`mfheckemat` on the :literal:`mftobasis` coefficients:\n        \n        ::\n        \n            ? mfcoefs(mfhecke(mf,F,3^10), 10)\n            time = 917 ms.\n            %3 = [324, 1944, 3888, 2592, 1944, 7776, 7776, 0, 3888, 9720, 7776]\n            ? M = mfheckemat(mf,3^10) \\\\ instantaneous\n            %4 =\n            [324]\n            ? G = mflinear(mf, M*mftobasis(mf,F));\n            ? mfcoefs(G, 10) \\\\ instantaneous\n            %6 = [324, 1944, 3888, 2592, 1944,"" 7776, 7776, 0, 3888, 9720, 7776]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_953mfhecke(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfhecke (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_n,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mfhecke", 1, 2, 2, 1); __PYX_ERR(10, 16602, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfhecke") < 0)) __PYX_ERR(10, 16602, __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_F = values[0];
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16602, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfhecke", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16602, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_952mfhecke(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_F, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_952mfhecke(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_n) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfhecke", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":16650
 *             %6 = [324, 1944, 3888, 2592, 1944, 7776, 7776, 0, 3888, 9720, 7776]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16650, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16651
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 16651, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16652
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfhecke(_mf, _F, n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16653
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfhecke(_mf, _F, n)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16654
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfhecke(_mf, _F, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfhecke(__pyx_v__mf, __pyx_v__F, __pyx_v_n);

  /* "cypari/auto_gen.pxi":16655
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfhecke(_mf, _F, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfheckemat(mf, vecn):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16655, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16602
 *         return new_gen(_ret)
 * 
 *     def mfhecke(mf, F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form in modular form space :emphasis:`mf`, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16657
 *         return new_gen(_ret)
 * 
 *     def mfheckemat(mf, vecn):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :literal:`vecn` is an integer, matrix of the Hecke operator :math:`T(n)` on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_955mfheckemat(PyObject *__pyx_v_mf, PyObject *__pyx_v_vecn); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_954mfheckemat[] = "\n        If :literal:`vecn` is an integer, matrix of the Hecke operator :math:`T(n)` on the\n        basis formed by :literal:`mfbasis(mf)`. If it is a vector, vector of\n        such matrices, usually faster than calling each one individually.\n        \n        ::\n        \n            ? mf=mfinit([32,4],0); mfheckemat(mf,3)\n            %1 =\n            [0 44 0]\n            \n            [1 0 -10]\n            \n            [0 -2 0]\n            ? mfheckemat(mf,[5,7])\n            %2 = [[0, 0, 220; 0, -10, 0; 1, 0, 12], [0, 88, 0; 2, 0, -20; 0, -4, 0]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_955mfheckemat(PyObject *__pyx_v_mf, PyObject *__pyx_v_vecn) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfheckemat (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_954mfheckemat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), ((PyObject *)__pyx_v_vecn));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_954mfheckemat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_vecn) {
  GEN __pyx_v__mf;
  GEN __pyx_v__vecn;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfheckemat", 0);
  __Pyx_INCREF(__pyx_v_vecn);

  /* "cypari/auto_gen.pxi":16675
 *             %2 = [[0, 0, 220; 0, -10, 0; 1, 0, 12], [0, 88, 0; 2, 0, -20; 0, -4, 0]]
 *         '''
 *         vecn = objtogen(vecn)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_vecn, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16675, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_vecn, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16676
 *         '''
 *         vecn = objtogen(vecn)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _vecn = (<Gen>vecn).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 16676, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16677
 *         vecn = objtogen(vecn)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _vecn = (<Gen>vecn).g
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16678
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _vecn = (<Gen>vecn).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vecn)->__pyx_base.g;
  __pyx_v__vecn = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16679
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _vecn = (<Gen>vecn).g
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfheckemat(__pyx_v__mf, __pyx_v__vecn);

  /* "cypari/auto_gen.pxi":16680
 *         cdef GEN _vecn = (<Gen>vecn).g
 *         cdef GEN _ret = mfheckemat(_mf, _vecn)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfinit(NK, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16657
 *         return new_gen(_ret)
 * 
 *     def mfheckemat(mf, vecn):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :literal:`vecn` is an integer, matrix of the Hecke operator :math:`T(n)` on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfheckemat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vecn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16682
 *         return new_gen(_ret)
 * 
 *     def mfinit(NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Create the space of modular forms corresponding to the data contained in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_957mfinit(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_956mfinit[] = "\n        Create the space of modular forms corresponding to the data contained in\n        :literal:`NK` and :literal:`space`. :literal:`NK` is a vector which can be\n        either :math:`[N,k]` (:math:`N` level, :math:`k` weight) corresponding to a subspace of\n        :math:`M_k(\\Gamma_0(N))`, or :math:`[N,k,CHI]` (:emphasis:`CHI` a character)\n        corresponding to a subspace of :math:`M_k(\\Gamma_0(N),\\chi)`. Alternatively,\n        it can be a modular form :math:`F` or modular form space, in which case we use\n        :literal:`mfparams` to define the space parameters.\n        \n        The subspace is described by the small integer :literal:`space`: :math:`0` for the\n        newspace :math:`S_k^{new}(\\Gamma_0(N),\\chi)`, :math:`1` for the cuspidal\n        space :math:`S_k`, :math:`2` for the oldspace :math:`S_k^{old}`, :math:`3` for the space of\n        Eisenstein series :math:`E_k` and :math:`4` for the full space :math:`M_k`.\n        \n        :strong:`Wildcards.` For given level and weight, it is advantageous to\n        compute simultaneously spaces attached to different Galois orbits\n        of characters, especially in weight :math:`1`. The parameter :emphasis:`CHI` may be set\n        to 0 (wildcard), in which case we return a vector of all :literal:`mfinit` (s) of\n        non trivial spaces in :math:`S_k(\\Gamma_1(N))`, one for each Galois orbit\n        (see :literal:`znchargalois`). One may also set :emphasis:`CHI` to a vector of\n        characters and we return a vector of all mfinits of subspaces of\n        :math:`M_k(G_0(N),\\chi)` for :math:`\\chi` in the list, in the same order. In weight :math:`1`,\n        only :math:`S_1^{new}`, :math:`S_1` and :math:`E_1` support wildcards.\n        \n        The output is a technical structure :math:`S`, or a vector of structures if\n        :emphasis:`CHI` was a wildcard, which contains the following information:\n        :math:`[N,k,\\chi]` is given by :literal:`mfparams`:math:`(S)`, the ""space\n        dimension is :literal:`mfdim`:math:`(S)` and a :math:`\\mathbb{C}`-basis for the space is\n        :literal:`mfbasis`:math:`(S)`. The structure is entirely algebraic and does not depend\n        on the current :literal:`realbitprecision`.\n        \n        ::\n        \n            ? S = mfinit([36,2], 0); \\\\ new space\n            ? mfdim(S)\n            %2 = 1\n            ? mfparams\n            %3 = [36, 2, 1, y] \\\\ trivial character\n            ? f = mfbasis(S)[1]; mfcoefs(f,10)\n            %4 = [0, 1, 0, 0, 0, 0, 0, -4, 0, 0, 0]\n            \n            ? vS = mfinit([36,2,0],0); \\\\ with wildcard\n            ? #vS\n            %6 = 4 \\\\ 4 non trivial spaces (mod Galois action)\n            ? apply(mfdim,vS)\n            %7 = [1, 2, 1, 4]\n            ? mfdim([36,2,0], 0)\n            %8 = [[1, Mod(1, 36), 1, 0], [2, Mod(35, 36), 2, 0], [3, Mod(13, 36), 1, 0],\n             [6, Mod(11, 36), 4, 0]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_957mfinit(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfinit") < 0)) __PYX_ERR(10, 16682, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16682, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfinit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16682, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_956mfinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), __pyx_v_space);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_956mfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfinit", 0);

  /* "cypari/auto_gen.pxi":16733
 *              [6, Mod(11, 36), 4, 0]]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfinit(_NK, space)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16733, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16734
 *         '''
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfinit(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16735
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfinit(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfinit(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_gen.pxi":16736
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mfinit(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfisCM(F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16682
 *         return new_gen(_ret)
 * 
 *     def mfinit(NK, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         Create the space of modular forms corresponding to the data contained in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16738
 *         return new_gen(_ret)
 * 
 *     def mfisCM(F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tests whether the eigenform :math:`F` is a CM form. The answer
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_959mfisCM(PyObject *__pyx_v_F, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_958mfisCM[] = "\n        Tests whether the eigenform :math:`F` is a CM form. The answer\n        is :math:`0` if it is not, and if it is, either the unique negative discriminant\n        of the CM field, or the pair of two negative discriminants of CM fields,\n        this latter case occuring only in weight :math:`1` when the projective image is\n        :math:`D_2 = C_2 x C_2`, i.e., coded :math:`4` by :literal:`mfgaloistype`.\n        \n        ::\n        \n            ? F = mffromell(ellinit([0,1]))[2]; mfisCM(F)\n            %1 = -3\n            ? mf = mfinit([39,1,-39],0); F=mfeigenbasis(mf)[1]; mfisCM(F)\n            %2 = Vecsmall([-3, -39])\n            ? mfgaloistype(mf)\n            %3 = [4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_959mfisCM(PyObject *__pyx_v_F, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfisCM (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_958mfisCM(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_958mfisCM(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfisCM", 0);

  /* "cypari/auto_gen.pxi":16755
 *             %3 = [4]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfisCM(_F)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16755, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16756
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfisCM(_F)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16757
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfisCM(_F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfisCM(__pyx_v__F);

  /* "cypari/auto_gen.pxi":16758
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfisCM(_F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfisequal(F, G, long lim=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16738
 *         return new_gen(_ret)
 * 
 *     def mfisCM(F):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tests whether the eigenform :math:`F` is a CM form. The answer
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfisCM", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16760
 *         return new_gen(_ret)
 * 
 *     def mfisequal(F, G, long lim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Checks whether the modular forms :math:`F` and :math:`G` are equal. If :literal:`lim`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_961mfisequal(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_960mfisequal[] = "\n        Checks whether the modular forms :math:`F` and :math:`G` are equal. If :literal:`lim`\n        is nonzero, only check equality of the first :math:`lim+1` Fourier coefficients\n        and the function then also applies to generalized modular forms.\n        \n        ::\n        \n            ? D = mfDelta(); F = mfderiv(D);\n            ? G = mfmul(mfEk(2), D);\n            ? mfisequal(F, G)\n            %2 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_961mfisequal(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_G = 0;
  long __pyx_v_lim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfisequal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_G,&__pyx_n_s_lim,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_G)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lim);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfisequal") < 0)) __PYX_ERR(10, 16760, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_G = values[0];
    if (values[1]) {
      __pyx_v_lim = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_lim == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16760, __pyx_L3_error)
    } else {
      __pyx_v_lim = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfisequal", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16760, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfisequal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_960mfisequal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_G, __pyx_v_lim);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_960mfisequal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G, long __pyx_v_lim) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfisequal", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_gen.pxi":16773
 *             %2 = 1
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16774
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 16774, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16775
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef long _ret = mfisequal(_F, _G, lim)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16776
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfisequal(_F, _G, lim)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16777
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef long _ret = mfisequal(_F, _G, lim)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfisequal(__pyx_v__F, __pyx_v__G, __pyx_v_lim);

  /* "cypari/auto_gen.pxi":16778
 *         cdef GEN _G = (<Gen>G).g
 *         cdef long _ret = mfisequal(_F, _G, lim)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":16779
 *         cdef long _ret = mfisequal(_F, _G, lim)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfkohnenbasis(mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16760
 *         return new_gen(_ret)
 * 
 *     def mfisequal(F, G, long lim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Checks whether the modular forms :math:`F` and :math:`G` are equal. If :literal:`lim`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfisequal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16781
 *         return _ret
 * 
 *     def mfkohnenbasis(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_963mfkohnenbasis(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_962mfkohnenbasis[] = "\n        :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2`\n        with level :math:`N` and character :math:`\\chi`, gives a\n        basis :math:`B` of the Kohnen :math:`+`-space of :literal:`mf` as a matrix whose columns are\n        the coefficients of :math:`B` on the basis of :literal:`mf`. The conductor of either\n        :math:`\\chi` or :math:`\\chi.(-4/.)` must divide :math:`N/4`.\n        \n        ::\n        \n            ? mf = mfinit([36,5/2],1); K = mfkohnenbasis(mf); K~\n            %1 =\n            [-1 0 0 2 0 0]\n            \n            [ 0 0 0 0 1 0]\n            ? (mfcoefs(mf,20) * K)~\n            %4 =\n            [0 -1 0 0 2 0 0 0 0 0 0 0 0 -6 0 0 8 0 0 0 0]\n            \n            [0 0 0 0 0 1 0 0 -2 0 0 0 0 0 0 0 0 1 0 0 2]\n            \n            ? mf = mfinit([40,3/2,8],1); mfkohnenbasis(mf)\n             *** at top-level: mfkohnenbasis(mf)\n             *** ^-----------------\n             *** mfkohnenbasis: incorrect type in mfkohnenbasis [incorrect CHI] (t_VEC).\n        \n        In the final example both :math:`\\chi = (8/.)` and :math:`\\chi.(-4/.)`\n        have conductor :math:`8`, which does not divide N/4 = 10.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_963mfkohnenbasis(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfkohnenbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_962mfkohnenbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_962mfkohnenbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfkohnenbasis", 0);

  /* "cypari/auto_gen.pxi":16810
 *         have conductor :math:`8`, which does not divide N/4 = 10.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbasis(_mf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16810, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16811
 *         '''
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfkohnenbasis(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16812
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbasis(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfkohnenbasis(__pyx_v__mf);

  /* "cypari/auto_gen.pxi":16813
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbasis(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfkohnenbijection(mf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16781
 *         return _ret
 * 
 *     def mfkohnenbasis(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfkohnenbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16815
 *         return new_gen(_ret)
 * 
 *     def mfkohnenbijection(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight, returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_965mfkohnenbijection(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_964mfkohnenbijection[] = "\n        :literal:`mf` being a cuspidal space of half-integral weight, returns\n        :literal:`[mf2,M,K,shi]`, where :math:`M` is a matrix giving a Hecke-module\n        isomorphism from the cuspidal space :literal:`mf2` giving\n        :math:`S_{2k-1}(\\Gamma_0(N),\\chi^2)` to the\n        Kohnen :math:`+`-space :math:`S_k^+(\\Gamma_0(4N),\\chi)`, :literal:`K` represents a basis :math:`B`\n        of the Kohnen :math:`+`-space as a matrix whose columns are the coefficients of :math:`B`\n        on the basis of :literal:`mf`, and :literal:`shi` gives the linear combination of\n        Shimura lifts giving :math:`M^{-1}`.\n        \n        ::\n        \n            ? mf=mfinit([60,5/2],1); [mf2,M,K,shi]=mfkohnenbijection(mf); M\n            %1 =\n            [ -5/14 -1/14 1/2 3/2]\n            \n            [ 37/84 -1/84 1/2 1/2]\n            \n            [-17/84 5/84 -3/2 -9/2]\n            \n            [ 0 0 -1/2 -1/2]\n            \n            ? shi\n            %2 = Vecsmall([1, 5])\n        \n        This last command shows that the map giving the bijection is the sum of the\n        Shimura lift with :math:`D = 1` and the one with :math:`D = 5`.\n        \n        Since it gives a bijection of Hecke modules, this matrix can be used to\n        transport modular form data from the easily computed space of level :math:`N`\n        and weight :math:`2k-1` to the more difficult space of level :math:`4N` and weight\n        :math:`k`: matrices of Hecke operators, new space, splitting into eigenspaces and\n        eigenforms. Examples:\n        \n        ::\n        \n            ? K^(-1)*mfheckemat(mf,121)*K /* matrix of T_11^2 on K. Slowish. */\n            time = 1,280 ms.\n            %1 =\n            [ 48 24 24 24]\n            \n            [ 0 32 0 -20]\n            \n            [-48 -72 -40 -72]\n            \n            [ 0 0 0 52]\n            ? M*mfheckemat(mf2,11)*M^(-1) /* instantaneous via T_11 on S_{2k-1} */\n            time = 0 ms.\n      ""      %2 =\n            [ 48 24 24 24]\n            \n            [ 0 32 0 -20]\n            \n            [-48 -72 -40 -72]\n            \n            [ 0 0 0 52]\n            ? mf20=mfinit(mf2,0); [mftobasis(mf2,b) | b<-mfbasis(mf20)]\n            %3 = [[0, 0, 1, 0]~, [0, 0, 0, 1]~]\n            ? F1=M*[0,0,1,0]~\n            %4 = [1/2, 1/2, -3/2, -1/2]~\n            ? F2=M*[0,0,0,1]~\n            %5 = [3/2, 1/2, -9/2, -1/2]\n            ? K*F1\n            %6 = [1, 0, 0, 1, 1, 0, 0, 1, -3, 0, 0, -3, 0, 0]~\n            ? K*F2\n            %7 = [3, 0, 0, 3, 1, 0, 0, 1, -9, 0, 0, -3, 0, 0]~\n        \n        This gives a basis of the new space of :math:`S_{5/2}^+(\\Gamma_0(60))` expressed\n        on the initial basis of :math:`S_{5/2}(\\Gamma_0(60))`. If we want the eigenforms, we\n        write instead:\n        \n        ::\n        \n            ? BE=mfeigenbasis(mf20);[E1,E2]=apply(x->K*M*mftobasis(mf2,x),BE)\n            %1 = [[1, 0, 0, 1, 0, 0, 0, 0, -3, 0, 0, 0, 0, 0]~,\\\n             [0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, -3, 0, 0]~\n            ? EI1 = mflinear(mf, E1); EI2=mflinear(mf, E2);\n        \n        These are the two eigenfunctions in the space :literal:`mf`, the first (resp.,\n        second) will have Shimura image a multiple of :math:`BE[1]` (resp., :math:`BE[2]`).\n        The function :literal:`mfkohneneigenbasis` does this directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_965mfkohnenbijection(PyObject *__pyx_v_mf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfkohnenbijection (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_964mfkohnenbijection(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_964mfkohnenbijection(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfkohnenbijection", 0);

  /* "cypari/auto_gen.pxi":16898
 *         The function :literal:`mfkohneneigenbasis` does this directly.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbijection(_mf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 16898, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16899
 *         '''
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfkohnenbijection(_mf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":16900
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbijection(_mf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfkohnenbijection(__pyx_v__mf);

  /* "cypari/auto_gen.pxi":16901
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfkohnenbijection(_mf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfkohneneigenbasis(mf, bij):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 16901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16815
 *         return new_gen(_ret)
 * 
 *     def mfkohnenbijection(mf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight, returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfkohnenbijection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16903
 *         return new_gen(_ret)
 * 
 *     def mfkohneneigenbasis(mf, bij):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_967mfkohneneigenbasis(PyObject *__pyx_v_mf, PyObject *__pyx_v_bij); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_966mfkohneneigenbasis[] = "\n        :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2` and\n        :literal:`bij` being the output of :literal:`mfkohnenbijection(mf)`, outputs a\n        :math:`3`-component vector :literal:`[mf0,BNEW,BEIGEN]`, where :literal:`BNEW` and\n        :literal:`BEIGEN` are two matrices whose columns are the coefficients\n        of a basis of the Kohnen new space and of the eigenforms on the basis of\n        :literal:`mf` respectively, and :literal:`mf0` is the corresponding new space of\n        integral weight :math:`2k-1`.\n        \n        ::\n        \n            ? mf=mfinit([44,5/2],1);bij=mfkohnenbijection(mf);\n            ? [mf0,BN,BE]=mfkohneneigenbasis(mf,bij);\n            ? BN~\n            %2 =\n            [2 0 0 -2 2 0 -8]\n            \n            [2 0 0 4 14 0 -32]\n            \n            ? BE~\n            %3 = [Mod(1, y^2 - 3) Mod(0, y^2 - 3) Mod(0, y^2 - 3) Mod(y - 1, y^2 - 3)\\\n             Mod(2*y + 1, y^2 - 3) Mod(0, y^2 - 3) Mod(-4*y - 4, y^2 - 3)]\n            ? lift(mfcoefs(mf,20)*BE[,1])\n            %4 = [0, 1, 0, 0, y - 1, 2*y + 1, 0, 0, 0, -4*y - 4, 0, 0,\\\n             -5*y + 3, 0, 0, 0, -6, 0, 0, 0, 7*y + 9]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_967mfkohneneigenbasis(PyObject *__pyx_v_mf, PyObject *__pyx_v_bij) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfkohneneigenbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_966mfkohneneigenbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), ((PyObject *)__pyx_v_bij));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_966mfkohneneigenbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_bij) {
  GEN __pyx_v__mf;
  GEN __pyx_v__bij;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfkohneneigenbasis", 0);
  __Pyx_INCREF(__pyx_v_bij);

  /* "cypari/auto_gen.pxi":16930
 *              -5*y + 3, 0, 0, 0, -6, 0, 0, 0, 7*y + 9]~
 *         '''
 *         bij = objtogen(bij)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bij, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_bij, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16931
 *         '''
 *         bij = objtogen(bij)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _bij = (<Gen>bij).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 16931, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16932
 *         bij = objtogen(bij)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bij = (<Gen>bij).g
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16933
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _bij = (<Gen>bij).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bij)->__pyx_base.g;
  __pyx_v__bij = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16934
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _bij = (<Gen>bij).g
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfkohneneigenbasis(__pyx_v__mf, __pyx_v__bij);

  /* "cypari/auto_gen.pxi":16935
 *         cdef GEN _bij = (<Gen>bij).g
 *         cdef GEN _ret = mfkohneneigenbasis(_mf, _bij)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mflinear(vF, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16903
 *         return new_gen(_ret)
 * 
 *     def mfkohneneigenbasis(mf, bij):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being a cuspidal space of half-integral weight :math:`k >= 3/2` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfkohneneigenbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bij);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16937
 *         return new_gen(_ret)
 * 
 *     def mflinear(vF, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`vF` being a vector of generalized modular forms and :literal:`v`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_969mflinear(PyObject *__pyx_v_vF, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_968mflinear[] = "\n        :literal:`vF` being a vector of generalized modular forms and :literal:`v`\n        a vector of coefficients of same length, compute the linear\n        combination of the entries of :literal:`vF` with coefficients :literal:`v`.\n        :strong:`Note.` Use this in particular to subtract two forms :math:`F` and :math:`G`\n        (with :math:`vF = [F,G]` and :math:`v = [1,-1]`), or to multiply an form by\n        a scalar :math:`\\lambda` (with :math:`vF = [F]` and :math:`v = [\\lambda]`).\n        \n        ::\n        \n            ? D = mfDelta(); G = mflinear([D],[-3]);\n            ? mfcoefs(G,4)\n            %2 = [0, -3, 72, -756, 4416]\n        \n        For user convenience, we allow\n        \n        - a modular form space :literal:`mf` as a :literal:`vF` argument, which is\n          understood as :literal:`mfbasis(mf)`;\n        \n        - in this case, we also allow a modular form :math:`f` as :math:`v`, which\n          is understood as :literal:`mftobasis`:math:`(mf, f)`.\n        \n        ::\n        \n            ? T = mfpow(mfTheta(),7); F = mfShimura(T,-3); \\\\ Shimura lift for D=-3\n            ? mfcoefs(F,8)\n            %2 = [-5/9, 280, 9240, 68320, 295960, 875280, 2254560, 4706240, 9471000]\n            ? mf = mfinit(F); G = mflinear(mf,F);\n            ? mfcoefs(G,8)\n            %4 = [-5/9, 280, 9240, 68320, 295960, 875280, 2254560, 4706240, 9471000]\n        \n        This last construction allows to replace a general modular\n        form by a simpler linear combination of basis functions, which is often\n        more efficient:\n        \n        ::\n        \n            ? T10=mfpow(mfTheta(),10); mfcoef(T10, 10^4) \\\\ direct evaluation\n            time = 399 ms.\n            %5 = 128205250571893636\n            ? mf=mfinit(T10); F=mflinear(mf,T10); \\\\ instantaneous\n            ? mfcoef(F, 10^4) \\\\ after linearization\n            time = 67 ms.\n            %7 = 128205250571893636\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_969mflinear(PyObject *__pyx_v_vF, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mflinear (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_968mflinear(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_vF), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_968mflinear(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_vF, PyObject *__pyx_v_v) {
  GEN __pyx_v__vF;
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mflinear", 0);
  __Pyx_INCREF(__pyx_v_v);

  /* "cypari/auto_gen.pxi":16983
 *             %7 = 128205250571893636
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _vF = (<Gen>vF).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":16984
 *         '''
 *         v = objtogen(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _vF = (<Gen>vF).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 16984, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":16985
 *         v = objtogen(v)
 *         sig_on()
 *         cdef GEN _vF = (<Gen>vF).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mflinear(_vF, _v)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_vF)->__pyx_base.g;
  __pyx_v__vF = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16986
 *         sig_on()
 *         cdef GEN _vF = (<Gen>vF).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mflinear(_vF, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_gen.pxi":16987
 *         cdef GEN _vF = (<Gen>vF).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mflinear(_vF, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mflinear(__pyx_v__vF, __pyx_v__v);

  /* "cypari/auto_gen.pxi":16988
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = mflinear(_vF, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfmanin(FS, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 16988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16937
 *         return new_gen(_ret)
 * 
 *     def mflinear(vF, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`vF` being a vector of generalized modular forms and :literal:`v`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mflinear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":16990
 *         return new_gen(_ret)
 * 
 *     def mfmanin(FS, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the modular symbol :math:`FS` associated to an eigenform :math:`F` by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_971mfmanin(PyObject *__pyx_v_FS, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_970mfmanin[] = "\n        Given the modular symbol :math:`FS` associated to an eigenform :math:`F` by\n        :literal:`mfsymbol(mf,F)`, computes the even and odd special polynomials as well\n        as the even and odd periods :math:`\\omega^+` and :math:`\\omega^-` as a vector\n        :math:`[[P^+,P^-],[\\omega^+,\\omega^-,r]]`, where\n        :math:`r = \\Im (\\omega^+\\overline{\\omega^-})/ < F,F >`. If :math:`F` has several embeddings\n        into :math:`\\mathbb{C}`, give the vector of results corresponding to each embedding.\n        \n        ::\n        \n            ? D=mfDelta(); mf=mfinit(D); DS=mfsymbol(mf,D);\n            ? [pols,oms]=mfmanin(DS); pols\n            %2 = [[4*x^9 - 25*x^7 + 42*x^5 - 25*x^3 + 4*x],\\\n             [-36*x^10 + 691*x^8 - 2073*x^6 + 2073*x^4 - 691*x^2 + 36]]\n            ? oms\n            %3 = [0.018538552324740326472516069364750571812,\\\n             -0.00033105361053212432521308691198949874026*I, 4096/691]\n            ? mf=mfinit([11,2],0); F=mfeigenbasis(mf)[1]; FS=mfsymbol(mf,F);\n            ? [pols,oms]=mfmanin(FS);pols\n            %5 = [[0, 0, 0, 1, 1, 0, 0, -1, -1, 0, 0, 0],\\\n             [2, 0, 10, 5, -5, -10, -10, -5, 5, 10, 0, -2]]\n            ? oms[3]\n            %6 = 24/5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_971mfmanin(PyObject *__pyx_v_FS, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfmanin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfmanin") < 0)) __PYX_ERR(10, 16990, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 16990, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfmanin", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 16990, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfmanin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_970mfmanin(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_FS), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_970mfmanin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_FS, long __pyx_v_precision) {
  GEN __pyx_v__FS;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mfmanin", 0);

  /* "cypari/auto_gen.pxi":17015
 *             %6 = 24/5
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17015, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17016
 *         '''
 *         sig_on()
 *         cdef GEN _FS = (<Gen>FS).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_FS)->__pyx_base.g;
  __pyx_v__FS = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17017
 *         sig_on()
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)
 */
  __pyx_t_3 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":17018
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfmanin(_FS, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":17017
 *         sig_on()
 *         cdef GEN _FS = (<Gen>FS).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)
 */
  }

  /* "cypari/auto_gen.pxi":17019
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfmanin(__pyx_v__FS, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":17020
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfmanin(_FS, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfmul(F, G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 17020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":16990
 *         return new_gen(_ret)
 * 
 *     def mfmanin(FS, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given the modular symbol :math:`FS` associated to an eigenform :math:`F` by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfmanin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17022
 *         return new_gen(_ret)
 * 
 *     def mfmul(F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiply the two generalized modular forms :math:`F` and :math:`G`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_973mfmul(PyObject *__pyx_v_F, PyObject *__pyx_v_G); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_972mfmul[] = "\n        Multiply the two generalized modular forms :math:`F` and :math:`G`.\n        \n        ::\n        \n            ? E4 = mfEk(4); G = mfmul(mfmul(E4,E4),E4);\n            ? mfcoefs(G, 4)\n            %2 = [1, 720, 179280, 16954560, 396974160]\n            ? mfcoefs(mfpow(E4,3), 4)\n            %3 = [1, 720, 179280, 16954560, 396974160]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_973mfmul(PyObject *__pyx_v_F, PyObject *__pyx_v_G) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfmul (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_972mfmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), ((PyObject *)__pyx_v_G));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_972mfmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_G) {
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfmul", 0);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_gen.pxi":17034
 *             %3 = [1, 720, 179280, 16954560, 396974160]
 *         '''
 *         G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17034, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17035
 *         '''
 *         G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17035, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17036
 *         G = objtogen(G)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfmul(_F, _G)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17037
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfmul(_F, _G)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17038
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfmul(_F, _G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfmul(__pyx_v__F, __pyx_v__G);

  /* "cypari/auto_gen.pxi":17039
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = mfmul(_F, _G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfnumcusps(N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17039, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17022
 *         return new_gen(_ret)
 * 
 *     def mfmul(F, G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiply the two generalized modular forms :math:`F` and :math:`G`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17041
 *         return new_gen(_ret)
 * 
 *     def mfnumcusps(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of cusps of :math:`\Gamma_0(N)`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_975mfnumcusps(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_974mfnumcusps[] = "\n        Number of cusps of :math:`\\Gamma_0(N)`\n        \n        ::\n        \n            ? mfnumcusps(24)\n            %1 = 8\n            ? mfcusps(24)\n            %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_975mfnumcusps(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfnumcusps (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_974mfnumcusps(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_974mfnumcusps(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfnumcusps", 0);

  /* "cypari/auto_gen.pxi":17052
 *             %1 = [0, 1/2, 1/3, 1/4, 1/6, 1/8, 1/12, 1/24]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfnumcusps(_N)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17052, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17053
 *         '''
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfnumcusps(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17054
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfnumcusps(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfnumcusps(__pyx_v__N);

  /* "cypari/auto_gen.pxi":17055
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = mfnumcusps(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfparams(F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17055, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17041
 *         return new_gen(_ret)
 * 
 *     def mfnumcusps(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of cusps of :math:`\Gamma_0(N)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfnumcusps", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17057
 *         return new_gen(_ret)
 * 
 *     def mfparams(F):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form space, returns :literal:`[N,k,CHI,space]`, level,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_977mfparams(PyObject *__pyx_v_F, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_976mfparams[] = "\n        If :math:`F` is a modular form space, returns :literal:`[N,k,CHI,space]`, level,\n        weight, character, and space code. If :math:`F` is a generalized modular form,\n        returns :literal:`[N,k,CHI,P]`, where :math:`P` is the (polynomial giving the) field of\n        definition of :math:`F`: in that case the level :math:`N` may be a multiple of the\n        level of :math:`F` and the polynomial :math:`P` may define a larger field than :math:`\\mathbb{Q} (F)`.\n        If you want the true level of :math:`F` from this result, use\n        :literal:`mfconductor(mfinit(F),F)`. The polynomial :math:`P` defines an extension of\n        :math:`\\mathbb{Q} (\\chi) = \\mathbb{Q}[t]/(\\Phi (t))` for the cyclotomic polynomial of order\n        :math:`f(\\chi)`; it has coefficients in that number field (polmods in :math:`t`).\n        \n        In contrast with :literal:`mfparams(f)[4]` which always gives the polynomial\n        :math:`P` defining the relative extension :math:`\\mathbb{Q} (f)/\\mathbb{Q} (\\chi)`, the member function\n        :literal:`:math:`f`.mod` returns the polynomial used to define :math:`\\mathbb{Q} (f)` over :math:`\\mathbb{Q}`\n        (either a cyclotomic polynomial or a polynomial with cyclotomic\n        coefficients).\n        \n        ::\n        \n            ? E1 = mfeisenstein(4,-3,-4); E2 = mfeisenstein(3,5,-7); E3 = mfmul(E1,E2);\n            ? apply(mfparams, [E1,E2,E3])\n            %2 = [[12, 4, 12, y], [35, 3, -35, y], [420, 7, -420, y]]\n            \n            ? mf = mfinit([36,2,Mod(13,36)],0); [f] = mfeigenbasis(mf); mfparams(mf)\n            %3 = [36, 2, Mod(13, 36), 0]\n            ? mfparams(f)\n            %4 = [36, 2, Mod(13, 36), y]\n            ? f.mod\n            %5 = t^2 + t + 1\n            \n            ? mf = mfinit([36,4,Mod(13,36)],0); [f] = mfeigenbasis(mf);\n            ? mfparams(f)\n            %7 = [36, 4, Mod(13, 36), y^3 + Mod(2*t - 2, t^2 + t + 1)*y^2\n             + Mod(-4*t + 6, t^2+t+1)*y"" + Mod(10*t - 1, t^2+t+1)]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_977mfparams(PyObject *__pyx_v_F, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfparams (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_976mfparams(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_976mfparams(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfparams", 0);

  /* "cypari/auto_gen.pxi":17093
 *              + Mod(-4*t + 6, t^2+t+1)*y + Mod(10*t - 1, t^2+t+1)]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfparams(_F)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17093, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17094
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfparams(_F)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17095
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfparams(_F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfparams(__pyx_v__F);

  /* "cypari/auto_gen.pxi":17096
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfparams(_F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfperiodpol(mf, f, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17096, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17057
 *         return new_gen(_ret)
 * 
 *     def mfparams(F):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`F` is a modular form space, returns :literal:`[N,k,CHI,space]`, level,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfparams", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17098
 *         return new_gen(_ret)
 * 
 *     def mfperiodpol(mf, f, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Period polynomial of the cuspidal part of the form :math:`f`, in other words
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_979mfperiodpol(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_978mfperiodpol[] = "\n        Period polynomial of the cuspidal part of the form :math:`f`, in other words\n        :math:`\\int_0^{i oo }(X-\\tau)^{k-2}f(\\tau)d\\tau`. If :literal:`flag` is :math:`0`, ordinary\n        period polynomial. If it is :math:`1` or :math:`-1`, even or odd part of that polynomial.\n        :math:`f` can also be the modular symbol output by :literal:`mfsymbol` (mf,f).\n        \n        ::\n        \n            ? D = mfDelta(); mf = mfinit(D,0);\n            ? PP = mfperiodpol(mf, D, -1); PP/=polcoeff(PP, 1); bestappr(PP)\n            %1 = x^9 - 25/4*x^7 + 21/2*x^5 - 25/4*x^3 + x\n            ? PM = mfperiodpol(mf, D, 1); PM/=polcoeff(PM, 0); bestappr(PM)\n            %2 = -x^10 + 691/36*x^8 - 691/12*x^6 + 691/12*x^4 - 691/36*x^2 + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_979mfperiodpol(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfperiodpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfperiodpol") < 0)) __PYX_ERR(10, 17098, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17098, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17098, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfperiodpol", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17098, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfperiodpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_978mfperiodpol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_f, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_978mfperiodpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__mf;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mfperiodpol", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_gen.pxi":17113
 *             %2 = -x^10 + 691/36*x^8 - 691/12*x^6 + 691/12*x^4 - 691/36*x^2 + 1
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17114
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17114, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17115
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17116
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17117
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":17118
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":17117
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 */
  }

  /* "cypari/auto_gen.pxi":17119
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfperiodpol(__pyx_v__mf, __pyx_v__f, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":17120
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfperiodpol(_mf, _f, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfpetersson(fs, gs=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17098
 *         return new_gen(_ret)
 * 
 *     def mfperiodpol(mf, f, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Period polynomial of the cuspidal part of the form :math:`f`, in other words
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfperiodpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17122
 *         return new_gen(_ret)
 * 
 *     def mfpetersson(fs, gs=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Petersson scalar product of the modular forms :math:`f` and :math:`g` belonging to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_981mfpetersson(PyObject *__pyx_v_fs, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_980mfpetersson[] = "\n        Petersson scalar product of the modular forms :math:`f` and :math:`g` belonging to\n        the same modular form space :literal:`mf`, given by the corresponding\n        \"modular symbols\" :literal:`fs` and :literal:`gs` output by :literal:`mfsymbol`\n        (also in weight :math:`1` and half-integral weight, where symbols do not exist).\n        If :literal:`gs` is omitted it is understood to be equal to :literal:`fs`.\n        The scalar product is normalized by the factor :math:`1/[\\Gamma:\\Gamma_0(N)]`.\n        Note that :math:`f` and :math:`g` can both be noncuspidal, in which case the program\n        returns an error if the product is divergent.\n        If the fields of definition :math:`\\mathbb{Q} (f)` and :math:`\\mathbb{Q} (g)` are equal to :math:`\\mathbb{Q} (\\chi)`\n        the result is a scalar. If :math:`[\\mathbb{Q} (f):\\mathbb{Q} (\\chi)] = d > 1` and\n        :math:`[\\mathbb{Q} (g):\\mathbb{Q} (\\chi)] = e > 1` the result is a :math:`d x e` matrix corresponding\n        to all the embeddings of :math:`f` and :math:`g`. In the intermediate cases :math:`d = 1` or\n        :math:`e = 1` the result is a row or column vector.\n        \n        ::\n        \n            ? D=mfDelta(); mf=mfinit(D); DS=mfsymbol(mf,D); mfpetersson(DS)\n            %1 = 1.0353620568043209223478168122251645932 E-6\n            ? mf=mfinit([11,6],0);B=mfeigenbasis(mf);BS=vector(#B,i,mfsymbol(mf,B[i]));\n            ? mfpetersson(BS[1])\n            %3 = 1.6190120685220988139111708455305245466 E-5\n            ? mfpetersson(BS[1],BS[2])\n            %4 = [-3.826479006582967148 E-42 - 2.801547395385577002 E-41*I,\\\n             1.6661127341163336125 E-41 + 1.1734725972345985061 E-41*I,\\\n             0.E-42 - 6.352626992842664490 E-41*I]~\n            ? mfpetersson(BS[2])\n            %5 =\n            [ 2.7576133733... E-5 2.0... E-42 6.3... E-43 ]\n            \n            [ -4.1... E-42 6.77837030070... E-5 3.3...E-42 ]\n            \n            [ -6"".32...E-43 3.6... E-42 2.27268958069... E-5]\n            \n            ? mf=mfinit([23,2],0); F=mfeigenbasis(mf)[1]; FS=mfsymbol(mf,F);\n            ? mfpetersson(FS)\n            %5 =\n            [0.0039488965740025031688548076498662860143 -3.56 ... E-40]\n            \n            [ -3.5... E-40 0.0056442542987647835101583821368582485396]\n        \n        Noncuspidal example:\n        \n        ::\n        \n            ? E1=mfeisenstein(5,1,-3);E2=mfeisenstein(5,-3,1);\n            ? mf=mfinit([12,5,-3]); cusps=mfcusps(12);\n            ? apply(x->mfcuspval(mf,E1,x),cusps)\n            %3 = [0, 0, 1, 0, 1, 1]\n            ? apply(x->mfcuspval(mf,E2,x),cusps)\n            %4 = [1/3, 1/3, 0, 1/3, 0, 0]\n            ? E1S=mfsymbol(mf,E1);E2S=mfsymbol(mf,E2);\n            ? mfpetersson(E1S,E2S)\n            %6 = -1.884821671646... E-5 - 1.9... E-43*I\n        \n        Weight 1 and 1/2-integral weight example:\n        \n        ::\n        \n            ? mf=mfinit([23,1,-23],1);F=mfbasis(mf)[1];FS=mfsymbol(mf,F);\n            ? mfpetersson(mf,FS)\n            %2 = 0.035149946790370230814006345508484787443\n            ? mf=mfinit([4,9/2],1);F=mfbasis(mf)[1];FS=mfsymbol(mf,F);\n            ? mfpetersson(FS)\n            %4 = 0.00015577084407139192774373662467908966030\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_981mfpetersson(PyObject *__pyx_v_fs, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_gs = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfpetersson (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gs,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gs);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfpetersson") < 0)) __PYX_ERR(10, 17122, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_gs = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfpetersson", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17122, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfpetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_980mfpetersson(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_fs), __pyx_v_gs);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_980mfpetersson(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fs, PyObject *__pyx_v_gs) {
  int __pyx_v__have_gs;
  GEN __pyx_v__fs;
  GEN __pyx_v__gs;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfpetersson", 0);
  __Pyx_INCREF(__pyx_v_gs);

  /* "cypari/auto_gen.pxi":17189
 *             %4 = 0.00015577084407139192774373662467908966030
 *         '''
 *         cdef bint _have_gs = (gs is not None)             # <<<<<<<<<<<<<<
 *         if _have_gs:
 *             gs = objtogen(gs)
 */
  __pyx_t_1 = (__pyx_v_gs != Py_None);
  __pyx_v__have_gs = __pyx_t_1;

  /* "cypari/auto_gen.pxi":17190
 *         '''
 *         cdef bint _have_gs = (gs is not None)
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             gs = objtogen(gs)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_gs != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17191
 *         cdef bint _have_gs = (gs is not None)
 *         if _have_gs:
 *             gs = objtogen(gs)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_gs, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_gs, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":17190
 *         '''
 *         cdef bint _have_gs = (gs is not None)
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             gs = objtogen(gs)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":17192
 *         if _have_gs:
 *             gs = objtogen(gs)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 17192, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17193
 *             gs = objtogen(gs)
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g             # <<<<<<<<<<<<<<
 *         cdef GEN _gs = NULL
 *         if _have_gs:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fs)->__pyx_base.g;
  __pyx_v__fs = __pyx_t_4;

  /* "cypari/auto_gen.pxi":17194
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL             # <<<<<<<<<<<<<<
 *         if _have_gs:
 *             _gs = (<Gen>gs).g
 */
  __pyx_v__gs = NULL;

  /* "cypari/auto_gen.pxi":17195
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 */
  __pyx_t_1 = (__pyx_v__have_gs != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17196
 *         cdef GEN _gs = NULL
 *         if _have_gs:
 *             _gs = (<Gen>gs).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_gs)->__pyx_base.g;
    __pyx_v__gs = __pyx_t_4;

    /* "cypari/auto_gen.pxi":17195
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _gs = NULL
 *         if _have_gs:             # <<<<<<<<<<<<<<
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 */
  }

  /* "cypari/auto_gen.pxi":17197
 *         if _have_gs:
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfpetersson(__pyx_v__fs, __pyx_v__gs);

  /* "cypari/auto_gen.pxi":17198
 *             _gs = (<Gen>gs).g
 *         cdef GEN _ret = mfpetersson(_fs, _gs)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfpow(F, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17122
 *         return new_gen(_ret)
 * 
 *     def mfpetersson(fs, gs=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Petersson scalar product of the modular forms :math:`f` and :math:`g` belonging to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfpetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17200
 *         return new_gen(_ret)
 * 
 *     def mfpow(F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute :math:`F^n`, where :math:`n` is an integer and :math:`F` is a generalized modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_983mfpow(PyObject *__pyx_v_F, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_982mfpow[] = "\n        Compute :math:`F^n`, where :math:`n` is an integer and :math:`F` is a generalized modular\n        form:\n        \n        ::\n        \n            ? G = mfpow(mfEk(4), 3); \\\\ E4^3\n            ? mfcoefs(G, 4)\n            %2 = [1, 720, 179280, 16954560, 396974160]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_983mfpow(PyObject *__pyx_v_F, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfpow (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17200, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_982mfpow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_982mfpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfpow", 0);

  /* "cypari/auto_gen.pxi":17211
 *             %2 = [1, 720, 179280, 16954560, 396974160]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfpow(_F, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17211, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17212
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfpow(_F, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17213
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfpow(_F, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfpow(__pyx_v__F, __pyx_v_n);

  /* "cypari/auto_gen.pxi":17214
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfpow(_F, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfsearch(NK, V, long space=4):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17214, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17200
 *         return new_gen(_ret)
 * 
 *     def mfpow(F, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute :math:`F^n`, where :math:`n` is an integer and :math:`F` is a generalized modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17216
 *         return new_gen(_ret)
 * 
 *     def mfsearch(NK, V, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being of the form :literal:`[N,k]` with :math:`k` possibly half-integral,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_985mfsearch(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_984mfsearch[] = "\n        :literal:`NK` being of the form :literal:`[N,k]` with :math:`k` possibly half-integral,\n        search for a modular form with rational coefficients, of weight :math:`k` and\n        level :math:`N`, whose initial coefficients :math:`a(0)`,... are equal to :math:`V`;\n        :literal:`space` specifies the modular form spaces in which to search, in\n        :literal:`mfinit` or :literal:`mfdim` notation. The output is a list of matching forms\n        with that given level and weight. Note that the character is of the form\n        :math:`(D/.)`, where :math:`D` is a (positive or negative) fundamental discriminant\n        dividing :math:`N`. The forms are sorted by increasing :math:`\\|D\\|`.\n        \n        The parameter :math:`N` can be replaced by a vector of allowed levels, in which\n        case the list of forms is sorted by increasing level, then increasing :math:`\\|D\\|`.\n        If a form is found at level :math:`N`, any multiple of :math:`N` with the same :math:`D` is not\n        considered. Some useful possibilities are\n        \n        - :literal:`[:math:`N_1`..:math:`N_2`]`: all levels between :math:`N_1` and :math:`N_2`,\n          endpoints included;\n        \n        - :literal:`:math:`F` * [:math:`N_1`..:math:`N_2`]`: same but levels divisible by :math:`F`;\n        \n        - :literal:`divisors`:math:`(N_0)`: all levels dividing :math:`N_0`.\n        \n        Note that this is different from :literal:`mfeigensearch`, which only searches\n        for rational eigenforms.\n        \n        ::\n        \n            ? F = mfsearch([[1..40], 2], [0,1,2,3,4], 1); #F\n            %1 = 3\n            ? [ mfparams(f) | f <- F ]\n            %2 = [[38, 2, 1, y], [40, 2, 8, y], [40, 2, 40, y]]\n            ? mfcoefs(F[1],10)\n            %3 = [0, 1, 2, 3, 4, -5, -8, 1, -7, -5, 7]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_985mfsearch(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_V = 0;
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_V,&__pyx_n_s_space,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_V)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsearch") < 0)) __PYX_ERR(10, 17216, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_V = values[0];
    if (values[1]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17216, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)4);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsearch", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17216, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_984mfsearch(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), __pyx_v_V, __pyx_v_space);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_984mfsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, PyObject *__pyx_v_V, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__V;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfsearch", 0);
  __Pyx_INCREF(__pyx_v_V);

  /* "cypari/auto_gen.pxi":17251
 *             %3 = [0, 1, 2, 3, 4, -5, -8, 1, -7, -5, 7]
 *         '''
 *         V = objtogen(V)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_V, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17251, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_V, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17252
 *         '''
 *         V = objtogen(V)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _V = (<Gen>V).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17252, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17253
 *         V = objtogen(V)
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = mfsearch(_NK, _V, space)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17254
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsearch(_NK, _V, space)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17255
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = mfsearch(_NK, _V, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsearch(__pyx_v__NK, __pyx_v__V, __pyx_v_space);

  /* "cypari/auto_gen.pxi":17256
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = mfsearch(_NK, _V, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfshift(F, long s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17256, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17216
 *         return new_gen(_ret)
 * 
 *     def mfsearch(NK, V, long space=4):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`NK` being of the form :literal:`[N,k]` with :math:`k` possibly half-integral,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17258
 *         return new_gen(_ret)
 * 
 *     def mfshift(F, long s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Divide the generalized modular form :math:`F` by :math:`q^s`, omitting the remainder
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_987mfshift(PyObject *__pyx_v_F, PyObject *__pyx_arg_s); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_986mfshift[] = "\n        Divide the generalized modular form :math:`F` by :math:`q^s`, omitting the remainder\n        if there is one. One can have :math:`s < 0`.\n        \n        ::\n        \n            ? D=mfDelta(); mfcoefs(mfshift(D,1), 4)\n            %1 = [1, -24, 252, -1472, 4830]\n            ? mfcoefs(mfshift(D,2), 4)\n            %2 = [-24, 252, -1472, 4830, -6048]\n            ? mfcoefs(mfshift(D,-1), 4)\n            %3 = [0, 0, 1, -24, 252]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_987mfshift(PyObject *__pyx_v_F, PyObject *__pyx_arg_s) {
  long __pyx_v_s;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfshift (wrapper)", 0);
  assert(__pyx_arg_s); {
    __pyx_v_s = __Pyx_PyInt_As_long(__pyx_arg_s); if (unlikely((__pyx_v_s == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17258, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfshift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_986mfshift(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), ((long)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_986mfshift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_s) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfshift", 0);

  /* "cypari/auto_gen.pxi":17272
 *             %3 = [0, 0, 1, -24, 252]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshift(_F, s)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17272, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17273
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfshift(_F, s)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17274
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshift(_F, s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfshift(__pyx_v__F, __pyx_v_s);

  /* "cypari/auto_gen.pxi":17275
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshift(_F, s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfshimura(mf, F, long D=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17258
 *         return new_gen(_ret)
 * 
 *     def mfshift(F, long s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Divide the generalized modular form :math:`F` by :math:`q^s`, omitting the remainder
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfshift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17277
 *         return new_gen(_ret)
 * 
 *     def mfshimura(mf, F, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form of half-integral weight :math:`k >= 3/2` and :math:`D` a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_989mfshimura(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_988mfshimura[] = "\n        :math:`F` being a modular form of half-integral weight :math:`k >= 3/2` and :math:`D` a\n        (not necessarily fundamental) discriminant of suitable sign, returns the\n        Shimura lift :math:`G` of weight :math:`2k-1` corresponding to :math:`D`. The sign of :math:`D`\n        should be equal to :math:`(-1)^{k-1/2}\\epsilon`, where :math:`\\epsilon = 1` if :math:`\\chi` is\n        defined modulo :math:`N/4`, :math:`\\epsilon = -1` if :math:`(-4/.)\\chi` is defined modulo\n        :math:`N/4` (and error otherwise). This function returns :math:`[mf2,G,v]`\n        where :emphasis:`mf2` is a modular form space containing :math:`G` and :math:`v` expresses :math:`G`\n        in terms of :literal:`mfbasis`:math:`(mf2)`; so that :math:`G` is\n        :literal:`mflinear`:math:`(mf2,v)`. By extension, we allow :math:`D` to be a positive\n        squarefree integer, but in that case if :math:`(-1)^{k-1/2}\\epsilon.D` is not a\n        discriminant, the Kohnen :math:`+`-space will in general not be sent to\n        level :math:`N/4` but only :math:`N/2`.\n        \n        ::\n        \n            ? F = mfpow(mfTheta(), 7); mf = mfinit(F);\n            ? [mf2, G, v] = mfshimura(mf, F, -3); mfcoefs(G,5)\n            %2 = [-5/9, 280, 9240, 68320, 295960, 875280]\n            ? mfparams(G)\n            %3 = [1, 6, 1, y]\n            ? mfparams(mf2)\n            %4 = [2, 6, 1, 4] \\\\ it may happen that G has lower level than expected\n            ? v\n            %5 = [280, 0]~\n            ? mfcoefs(mf2, 5)\n            %6 =\n            [-1/504 -1/504]\n            \n            [ 1 0]\n            \n            [ 33 1]\n            \n            [ 244 0]\n            \n            [ 1057 33]\n            \n            [ 3126 0]\n            ? mf = mfinit([60,5/2],1); F = mflinear(mf,mfkohnenbasis(mf)[,1]);\n            ? mfparams(mfshimura(mf,F,1)[2])\n            %8 = [15, 4, 1, y]\n            ? mfparams(mfshimura(mf,F,6)[2])\n            %9 = [30, 4, 1, y]""\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_989mfshimura(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_D;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfshimura (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_D,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfshimura") < 0)) __PYX_ERR(10, 17277, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_F = values[0];
    if (values[1]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17277, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfshimura", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17277, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfshimura", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_988mfshimura(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_F, __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_988mfshimura(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_D) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mfshimura", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":17322
 *             %9 = [30, 4, 1, y]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17323
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17323, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17324
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshimura(_mf, _F, D)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17325
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfshimura(_mf, _F, D)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17326
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshimura(_mf, _F, D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfshimura(__pyx_v__mf, __pyx_v__F, __pyx_v_D);

  /* "cypari/auto_gen.pxi":17327
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mfshimura(_mf, _F, D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfspace(mf, f=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17277
 *         return new_gen(_ret)
 * 
 *     def mfshimura(mf, F, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a modular form of half-integral weight :math:`k >= 3/2` and :math:`D` a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfshimura", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17329
 *         return new_gen(_ret)
 * 
 *     def mfspace(mf, f=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Identify the modular space :emphasis:`mf`, resp.the modular form :math:`f` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_991mfspace(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_990mfspace[] = "\n        Identify the modular space :emphasis:`mf`, resp.\302\240the modular form :math:`f` in\n        :emphasis:`mf` if present, as the flag given to :literal:`mfinit`.\n        Returns 0 (newspace), 1 (cuspidal space), 2 (old space),\n        3 (Eisenstein space) or 4 (full space).\n        \n        ::\n        \n            ? mf = mfinit([1,12],1); mfspace(mf)\n            %1 = 1\n            ? mfspace(mf, mfDelta())\n            %2 = 0 \\\\ new space\n        \n        This function returns :math:`-1` when the form :math:`f` is modular\n        but does not belong to the space.\n        \n        ::\n        \n            ? mf = mfinit([1,2]; mfspace(mf, mfEk(2))\n            %3 = -1\n        \n        When :math:`f` is not modular and is for instance only quasi-modular, the\n        function returns nonsense:\n        \n        ::\n        \n            ? M6 = mfinit([1,6]);\n            ? dE4 = mfderiv(mfEk(4)); \\\\ not modular !\n            ? mfspace(M6,dE4) \\\\ asserts (wrongly) that E4' belongs to new space\n            %3 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_991mfspace(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfspace (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfspace") < 0)) __PYX_ERR(10, 17329, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfspace", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17329, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_990mfspace(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_f);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_990mfspace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_f) {
  int __pyx_v__have_f;
  GEN __pyx_v__mf;
  GEN __pyx_v__f;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfspace", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_gen.pxi":17361
 *             %3 = 0
 *         '''
 *         cdef bint _have_f = (f is not None)             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             f = objtogen(f)
 */
  __pyx_t_1 = (__pyx_v_f != Py_None);
  __pyx_v__have_f = __pyx_t_1;

  /* "cypari/auto_gen.pxi":17362
 *         '''
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_f != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17363
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:
 *             f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":17362
 *         '''
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":17364
 *         if _have_f:
 *             f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 17364, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17365
 *             f = objtogen(f)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = NULL
 *         if _have_f:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":17366
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             _f = (<Gen>f).g
 */
  __pyx_v__f = NULL;

  /* "cypari/auto_gen.pxi":17367
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)
 */
  __pyx_t_1 = (__pyx_v__have_f != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17368
 *         cdef GEN _f = NULL
 *         if _have_f:
 *             _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfspace(_mf, _f)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
    __pyx_v__f = __pyx_t_4;

    /* "cypari/auto_gen.pxi":17367
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)
 */
  }

  /* "cypari/auto_gen.pxi":17369
 *         if _have_f:
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfspace(__pyx_v__mf, __pyx_v__f);

  /* "cypari/auto_gen.pxi":17370
 *             _f = (<Gen>f).g
 *         cdef long _ret = mfspace(_mf, _f)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":17371
 *         cdef long _ret = mfspace(_mf, _f)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfsplit(mf, long dimlim=0, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17329
 *         return new_gen(_ret)
 * 
 *     def mfspace(mf, f=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Identify the modular space :emphasis:`mf`, resp.the modular form :math:`f` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfspace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17373
 *         return _ret
 * 
 *     def mfsplit(mf, long dimlim=0, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` from :literal:`mfinit` with integral weight containing the new space
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_993mfsplit(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_992mfsplit[] = "\n        :literal:`mf` from :literal:`mfinit` with integral weight containing the new space\n        (either the new space itself or the cuspidal space or the full space), and\n        preferably the newspace itself for efficiency, split the space into Galois\n        orbits of eigenforms of the newspace, satisfying various restrictions.\n        \n        The functions returns :math:`[vF, vK]`, where :math:`vF` gives (Galois orbit of)\n        eigenforms and :math:`vK` is a list of polynomials defining each Galois orbit.\n        The eigenforms are given in :literal:`mftobasis` format, i.e. as a matrix\n        whose columns give the forms with respect to :literal:`mfbasis(mf)`.\n        \n        If :literal:`dimlim` is set, only the Galois orbits of dimension :math:`<= dimlim`\n        are computed (i.e. the rational eigenforms if :math:`dimlim = 1` and the\n        character is real). This can considerably speed up the function when a Galois\n        orbit is defined over a large field.\n        \n        :literal:`flag` speeds up computations when the dimension is large: if :math:`flag = d > 0`,\n        when the dimension of the eigenspace is :math:`> d`, only the Galois polynomial is\n        computed.\n        \n        Note that the function :literal:`mfeigenbasis` returns all eigenforms in an\n        easier to use format (as modular forms which can be input as is in other\n        functions); :literal:`mfsplit` is only useful when you can restrict\n        to orbits of small dimensions, e.g. rational eigenforms.\n        \n        ::\n        \n            ? mf=mfinit([11,2],0); f=mfeigenbasis(mf)[1]; mfcoefs(f,16)\n            %1 = [0, 1, -2, -1, ...]\n            ? mf=mfinit([23,2],0); f=mfeigenbasis(mf)[1]; mfcoefs(f,16)\n            %2 = [Mod(0, z^2 - z - 1), Mod(1, z^2 - z - 1), Mod(-z, z^2 - z - 1), ...]\n            ? mf=mfinit([179,2],0); apply(poldegree, mffields(mf))\n            %3 = [1, 3, 11]\n            ? mf=mfinit([719,2],0);\n           "" ? [vF,vK] = mfsplit(mf, 5); \\\\ fast when restricting to small orbits\n            time = 192 ms.\n            ? #vF \\\\ a single orbit\n            %5 = 1\n            ? poldegree(vK[1]) \\\\ of dimension 5\n            %6 = 5\n            ? [vF,vK] = mfsplit(mf); \\\\ general case is slow\n            time = 2,104 ms.\n            ? apply(poldegree,vK)\n            %8 = [5, 10, 45] \\\\ because degree 45 is large...\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_993mfsplit(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_dimlim;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dimlim,&__pyx_n_s_flag,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimlim);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsplit") < 0)) __PYX_ERR(10, 17373, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_dimlim = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_dimlim == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17373, __pyx_L3_error)
    } else {
      __pyx_v_dimlim = ((long)0);
    }
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17373, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsplit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17373, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_992mfsplit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_dimlim, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_992mfsplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, long __pyx_v_dimlim, long __pyx_v_flag) {
  GEN __pyx_v__mf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfsplit", 0);

  /* "cypari/auto_gen.pxi":17419
 *             %8 = [5, 10, 45] \\ because degree 45 is large...
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17419, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17420
 *         '''
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17421
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsplit(__pyx_v__mf, __pyx_v_dimlim, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":17422
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _ret = mfsplit(_mf, dimlim, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfsturm(NK):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17373
 *         return _ret
 * 
 *     def mfsplit(mf, long dimlim=0, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` from :literal:`mfinit` with integral weight containing the new space
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17424
 *         return new_gen(_ret)
 * 
 *     def mfsturm(NK):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Sturm bound for modular forms on :math:`\Gamma_0(N)` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_995mfsturm(PyObject *__pyx_v_NK, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_994mfsturm[] = "\n        Gives the Sturm bound for modular forms on :math:`\\Gamma_0(N)` and\n        weight :math:`k`, i.e., an upper bound for the order of the zero at infinity of\n        a nonzero form. :literal:`NK` is either\n        \n        - a pair :math:`[N,k]`,\n        \n        - or the output of :literal:`mfinit` in which case the exact upper bound\n          is returned.\n        \n        ::\n        \n            ? NK = [96,6]; mfsturm(NK)\n            %1 = 97\n            ? mf=mfinit(NK,1); mfsturm(mf)\n            %2 = 76\n            ? mfdim(NK,0) \\\\ new space\n            %3 = 72\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_995mfsturm(PyObject *__pyx_v_NK, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsturm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_994mfsturm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_994mfsturm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK) {
  GEN __pyx_v__NK;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mfsturm", 0);

  /* "cypari/auto_gen.pxi":17444
 *             %3 = 72
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef long _ret = mfsturm(_NK)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17444, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17445
 *         '''
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = mfsturm(_NK)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17446
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef long _ret = mfsturm(_NK)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = mfsturm(__pyx_v__NK);

  /* "cypari/auto_gen.pxi":17447
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef long _ret = mfsturm(_NK)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":17448
 *         cdef long _ret = mfsturm(_NK)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mfsymbol(mf, f=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17448, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17424
 *         return new_gen(_ret)
 * 
 *     def mfsturm(NK):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the Sturm bound for modular forms on :math:`\Gamma_0(N)` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17450
 *         return _ret
 * 
 *     def mfsymbol(mf, f=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for working with all period polynomials of the modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_997mfsymbol(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_996mfsymbol[] = "\n        Initialize data for working with all period polynomials of the modular\n        form :math:`f`: this is essential for efficiency for functions such as\n        :literal:`mfsymboleval`, :literal:`mfmanin`, and :literal:`mfpetersson`. An :literal:`mfsymbol`\n        contains an :literal:`mf` structure and can always be used whenever an :literal:`mf`\n        would be needed.\n        \n        ::\n        \n            ? mf=mfinit([23,2],0);F=mfeigenbasis(mf)[1];\n            ? FS=mfsymbol(mf,F);\n            ? mfsymboleval(FS,[0,oo])\n            %3 = [8.762565143790690142 E-39 + 0.0877907874...*I,\n             -5.617375463602574564 E-39 + 0.0716801031...*I]\n            ? mfpetersson(FS)\n            %4 =\n            [0.0039488965740025031688548076498662860143 1.2789721111175127425 E-40]\n            \n            [1.2630501762985554269 E-40 0.0056442542987647835101583821368582485396]\n        \n        By abuse of language, initialize data for working with :literal:`mfpetersson` in\n        weight :math:`1` and half-integral weight (where no symbol exist); the :literal:`mf`\n        argument may be an :literal:`mfsymbol` attached to a form on the space,\n        which avoids recomputing data independent of the form.\n        \n        ::\n        \n            ? mf=mfinit([12,9/2],1); F=mfbasis(mf);\n            ? fs=mfsymbol(mf,F[1]);\n            time = 476 ms\n            ? mfpetersson(fs)\n            %2 = 1.9722437519492014682047692073275406145 E-5\n            ? f2s = mfsymbol(mf,F[2]);\n            time = 484 ms.\n            ? mfpetersson(f2s)\n            %4 = 1.2142222531326333658647877864573002476 E-5\n            ? gs = mfsymbol(fs,F[2]); \\\\ re-use existing symbol, a little faster\n            time = 430 ms.\n            ? mfpetersson(gs) == %4 \\\\ same value\n            %6 = 1\n        \n        For simplicity, we also allow :literal:`mfsymbol(f)` instead of\n        :literal:`mfsymbol(mfinit(f), f)`:\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_997mfsymbol(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsymbol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsymbol") < 0)) __PYX_ERR(10, 17450, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_f = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17450, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsymbol", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17450, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsymbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_996mfsymbol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_f, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_996mfsymbol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_f, long __pyx_v_precision) {
  int __pyx_v__have_f;
  GEN __pyx_v__mf;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfsymbol", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_gen.pxi":17495
 *         :literal:`mfsymbol(mfinit(f), f)`:
 *         '''
 *         cdef bint _have_f = (f is not None)             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             f = objtogen(f)
 */
  __pyx_t_1 = (__pyx_v_f != Py_None);
  __pyx_v__have_f = __pyx_t_1;

  /* "cypari/auto_gen.pxi":17496
 *         '''
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_f != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17497
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:
 *             f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":17496
 *         '''
 *         cdef bint _have_f = (f is not None)
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             f = objtogen(f)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":17498
 *         if _have_f:
 *             f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 17498, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17499
 *             f = objtogen(f)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = NULL
 *         if _have_f:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":17500
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL             # <<<<<<<<<<<<<<
 *         if _have_f:
 *             _f = (<Gen>f).g
 */
  __pyx_v__f = NULL;

  /* "cypari/auto_gen.pxi":17501
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         if not precision:
 */
  __pyx_t_1 = (__pyx_v__have_f != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17502
 *         cdef GEN _f = NULL
 *         if _have_f:
 *             _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
    __pyx_v__f = __pyx_t_4;

    /* "cypari/auto_gen.pxi":17501
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _f = NULL
 *         if _have_f:             # <<<<<<<<<<<<<<
 *             _f = (<Gen>f).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":17503
 *         if _have_f:
 *             _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 */
  __pyx_t_1 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17504
 *             _f = (<Gen>f).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":17503
 *         if _have_f:
 *             _f = (<Gen>f).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 */
  }

  /* "cypari/auto_gen.pxi":17505
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsymbol(__pyx_v__mf, __pyx_v__f, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":17506
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymbol(_mf, _f, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mfsymboleval(fs, path, ga=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17450
 *         return _ret
 * 
 *     def mfsymbol(mf, f=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize data for working with all period polynomials of the modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsymbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17508
 *         return new_gen(_ret)
 * 
 *     def mfsymboleval(fs, path, ga=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluation of the modular symbol :math:`fs` (corresponding to the modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_999mfsymboleval(PyObject *__pyx_v_fs, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_998mfsymboleval[] = "\n        Evaluation of the modular symbol :math:`fs` (corresponding to the modular\n        form :math:`f`) output by :literal:`mfsymbol` on the given path :literal:`path`, where\n        :literal:`path` is either a vector :math:`[s_1,s_2]` or an integral matrix :math:`[a,b;c,d]`\n        representing the path :math:`[a/c,b/d]`. In both cases :math:`s_1` or :math:`s_2` (or :math:`a/c` or\n        :math:`b/d`) can also be elements of the upper half-plane.\n        To avoid possibly lengthy :literal:`mfsymbol` computations, the program also\n        accepts :math:`fs` of the form :literal:`[mf,F]`, but in that case :math:`s_1` and :math:`s_2`\n        are limited to :literal:`oo` and elements of the upper half-plane.\n        The result is the polynomial equal to\n        :math:`\\int_{s_1}^{s_2}(X-\\tau)^{k-2}F(\\tau)d\\tau`, the integral being\n        computed along a geodesic joining :math:`s_1` and :math:`s_2`. If :literal:`ga` in :math:`GL_2^+(\\mathbb{Q})`\n        is given, replace :math:`F` by :math:`F\\|_{k}\\gamma`. Note that if the integral diverges,\n        the result will be a rational function.\n        If the field of definition :math:`\\mathbb{Q} (f)` is larger than :math:`\\mathbb{Q} (\\chi)` then :math:`f` can be\n        embedded into :math:`\\mathbb{C}` in :math:`d = [\\mathbb{Q} (f):\\mathbb{Q} (\\chi)]` ways, in which case a vector of\n        the :math:`d` results is returned.\n        \n        ::\n        \n            ? mf=mfinit([35,2],1);f=mfbasis(mf)[1];fs=mfsymbol(mf,f);\n            ? mfsymboleval(fs,[0,oo])\n            %1 = 0.31404011074188471664161704390256378537*I\n            ? mfsymboleval(fs,[1,3;2,5])\n            %2 = -0.1429696291... - 0.2619975641...*I\n            ? mfsymboleval(fs,[I,2*I])\n            %3 = 0.00088969563028739893631700037491116258378*I\n            ? E2=mfEk(2);E22=mflinear([E2,mfbd(E2,2)],[1,-2]);mf=mfinit(E22);\n            ? E2S = mfsymbol(mf,E22);\n            ? mfsymboleval(E2S,[0,1])\n            %6"" = (-1.00000...*x^2 + 1.00000...*x - 0.50000...)/(x^2 - x)\n        \n        The rational function which is given in case the integral diverges is\n        easy to interpret. For instance:\n        \n        ::\n        \n            ? E4=mfEk(4);mf=mfinit(E4);ES=mfsymbol(mf,E4);\n            ? mfsymboleval(ES,[I,oo])\n            %2 = 1/3*x^3 - 0.928067...*I*x^2 - 0.833333...*x + 0.234978...*I\n            ? mfsymboleval(ES,[0,I])\n            %3 = (-0.234978...*I*x^3 - 0.833333...*x^2 + 0.928067...*I*x + 0.333333...)/x\n        \n        :literal:`mfsymboleval(ES,[a,oo])` is the limit as :math:`T\\to oo` of\n        \n        .. MATH::\n        \n            \\int_a^{iT}(X-\\tau)^{k-2}F(\\tau)d\\tau + a(0)(X-iT)^{k-1}/(k-1) ,\n        \n        where :math:`a(0)` is the :math:`0`th coefficient of :math:`F` at infinity. Similarly,\n        :literal:`mfsymboleval(ES,[0,a])` is the limit as :math:`T\\to oo` of\n        \n        .. MATH::\n        \n            \\int_{i/T}^a(X-\\tau)^{k-2}F(\\tau)d\\tau+b(0)(1+iTX)^{k-1}/(k-1) ,\n        \n        where :math:`b(0)` is the :math:`0`th coefficient of :math:`F\\|_{k} S` at infinity.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_999mfsymboleval(PyObject *__pyx_v_fs, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_ga = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mfsymboleval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_path,&__pyx_n_s_ga,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_path)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ga);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mfsymboleval") < 0)) __PYX_ERR(10, 17508, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_path = values[0];
    __pyx_v_ga = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17508, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mfsymboleval", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17508, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsymboleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_998mfsymboleval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_fs), __pyx_v_path, __pyx_v_ga, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_998mfsymboleval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fs, PyObject *__pyx_v_path, PyObject *__pyx_v_ga, long __pyx_v_precision) {
  int __pyx_v__have_ga;
  GEN __pyx_v__fs;
  GEN __pyx_v__path;
  GEN __pyx_v__ga;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mfsymboleval", 0);
  __Pyx_INCREF(__pyx_v_path);
  __Pyx_INCREF(__pyx_v_ga);

  /* "cypari/auto_gen.pxi":17567
 *         where :math:`b(0)` is the :math:`0`th coefficient of :math:`F\|_{k} S` at infinity.
 *         '''
 *         path = objtogen(path)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_path, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17568
 *         '''
 *         path = objtogen(path)
 *         cdef bint _have_ga = (ga is not None)             # <<<<<<<<<<<<<<
 *         if _have_ga:
 *             ga = objtogen(ga)
 */
  __pyx_t_2 = (__pyx_v_ga != Py_None);
  __pyx_v__have_ga = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17569
 *         path = objtogen(path)
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             ga = objtogen(ga)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_ga != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":17570
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:
 *             ga = objtogen(ga)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ga, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_ga, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":17569
 *         path = objtogen(path)
 *         cdef bint _have_ga = (ga is not None)
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             ga = objtogen(ga)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":17571
 *         if _have_ga:
 *             ga = objtogen(ga)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _path = (<Gen>path).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 17571, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17572
 *             ga = objtogen(ga)
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g             # <<<<<<<<<<<<<<
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fs)->__pyx_base.g;
  __pyx_v__fs = __pyx_t_4;

  /* "cypari/auto_gen.pxi":17573
 *         sig_on()
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _path = (<Gen>path).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ga = NULL
 *         if _have_ga:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_path)->__pyx_base.g;
  __pyx_v__path = __pyx_t_4;

  /* "cypari/auto_gen.pxi":17574
 *         cdef GEN _fs = (<Gen>fs).g
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL             # <<<<<<<<<<<<<<
 *         if _have_ga:
 *             _ga = (<Gen>ga).g
 */
  __pyx_v__ga = NULL;

  /* "cypari/auto_gen.pxi":17575
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             _ga = (<Gen>ga).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_ga != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":17576
 *         cdef GEN _ga = NULL
 *         if _have_ga:
 *             _ga = (<Gen>ga).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ga)->__pyx_base.g;
    __pyx_v__ga = __pyx_t_4;

    /* "cypari/auto_gen.pxi":17575
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ga = NULL
 *         if _have_ga:             # <<<<<<<<<<<<<<
 *             _ga = (<Gen>ga).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":17577
 *         if _have_ga:
 *             _ga = (<Gen>ga).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":17578
 *             _ga = (<Gen>ga).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":17577
 *         if _have_ga:
 *             _ga = (<Gen>ga).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 */
  }

  /* "cypari/auto_gen.pxi":17579
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mfsymboleval(__pyx_v__fs, __pyx_v__path, __pyx_v__ga, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":17580
 *             precision = default_bitprec()
 *         cdef GEN _ret = mfsymboleval(_fs, _path, _ga, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftaylor(F, long n, long flreal=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17508
 *         return new_gen(_ret)
 * 
 *     def mfsymboleval(fs, path, ga=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluation of the modular symbol :math:`fs` (corresponding to the modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mfsymboleval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_ga);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17582
 *         return new_gen(_ret)
 * 
 *     def mftaylor(F, long n, long flreal=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a form in :math:`M_k(SL_2(\mathbb{Z}))`, computes the first :math:`n+1`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1001mftaylor(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1000mftaylor[] = "\n        :math:`F` being a form in :math:`M_k(SL_2(\\mathbb{Z}))`, computes the first :math:`n+1`\n        canonical Taylor expansion of :math:`F` around :math:`\\tau = I`. If :literal:`flreal = 0`,\n        computes only an algebraic equivalence class. If :literal:`flreal` is set,\n        compute :math:`p_n` such that for :math:`\\tau` close enough to :math:`I` we have\n        \n        .. MATH::\n        \n            f(\\tau) = (2I/(\\tau+I))^k\\sum_{n >= 0}p_n((\\tau-I)/(\\tau+I))^n .\n        \n        ::\n        \n            ? D=mfDelta();\n            ? mftaylor(D,8)\n            %2 = [1/1728, 0, -1/20736, 0, 1/165888, 0, 1/497664, 0, -11/3981312]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1001mftaylor(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  long __pyx_v_flreal;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftaylor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_flreal,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flreal);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftaylor") < 0)) __PYX_ERR(10, 17582, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17582, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_flreal = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flreal == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17582, __pyx_L3_error)
    } else {
      __pyx_v_flreal = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17582, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftaylor", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17582, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftaylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1000mftaylor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_n, __pyx_v_flreal, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1000mftaylor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_n, long __pyx_v_flreal, long __pyx_v_precision) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mftaylor", 0);

  /* "cypari/auto_gen.pxi":17599
 *             %2 = [1/1728, 0, -1/20736, 0, 1/165888, 0, 1/497664, 0, -11/3981312]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17599, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17600
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17601
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":17602
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftaylor(__pyx_v__F, __pyx_v_n, __pyx_v_flreal, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":17603
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = mftaylor(_F, n, flreal, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftobasis(mf, F, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17603, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17582
 *         return new_gen(_ret)
 * 
 *     def mftaylor(F, long n, long flreal=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a form in :math:`M_k(SL_2(\mathbb{Z}))`, computes the first :math:`n+1`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftaylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17605
 *         return new_gen(_ret)
 * 
 *     def mftobasis(mf, F, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of the form :math:`F` on the basis given by :literal:`mfbasis(mf)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1003mftobasis(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1002mftobasis[] = "\n        Coefficients of the form :math:`F` on the basis given by :literal:`mfbasis(mf)`.\n        A :math:`q`-expansion or vector of coefficients\n        can also be given instead of :math:`F`, but in this case an error message may occur\n        if the expansion is too short. An error message is also given if :math:`F` does not\n        belong to the modular form space. If :literal:`flag` is set, instead of\n        error messages the output is an affine space of solutions if a :math:`q`-expansion\n        or vector of coefficients is given, or the empty column otherwise.\n        \n        ::\n        \n            ? mf = mfinit([26,2],0); mfdim(mf)\n            %1 = 2\n            ? F = mflinear(mf,[a,b]); mftobasis(mf,F)\n            %2 = [a, b]~\n        \n        A :math:`q`-expansion or vector of coefficients can also be given instead of :math:`F`.\n        \n        ::\n        \n            ? Th = 1 + 2*sum(n=1, 8, q^(n^2), O(q^80));\n            ? mf = mfinit([4,5,Mod(3,4)]);\n            ? mftobasis(mf, Th^10)\n            %3 = [64/5, 4/5, 32/5]~\n        \n        If :math:`F` does not belong to the corresponding space, the result is incorrect\n        and simply matches the coefficients of :math:`F` up to some bound, and\n        the function may either return an empty column or an error message.\n        If :literal:`flag` is set, there are no error messages, and the result is\n        an empty column if :math:`F` is a modular form; if :math:`F` is supplied via a series\n        or vector of coefficients which does not contain enough information to force\n        a unique (potential) solution, the function returns :math:`[v,K]` where :math:`v` is a\n        solution and :math:`K` is a matrix of maximal rank describing the affine space of\n        potential solutions :math:`v + K.x`.\n        \n        ::\n        \n            ? mf = mfinit([4,12],1);\n            ? mftobasis(mf, q-24*q^2+O(q^3), 1)\n            %2 = [[43/64, -63/8, 800, 21/64]~, [1"", 0; 24, 0; 2048, 768; -1, 0]]\n            ? mftobasis(mf, [0,1,-24,252], 1)\n            %3 = [[1, 0, 1472, 0]~, [0; 0; 768; 0]]\n            ? mftobasis(mf, [0,1,-24,252,-1472], 1)\n            %4 = [1, 0, 0, 0]~ \\\\ now uniquely determined\n            ? mftobasis(mf, [0,1,-24,252,-1472,0], 1)\n            %5 = [1, 0, 0, 0]~ \\\\ wrong result: no such form exists\n            ? mfcoefs(mflinear(mf,%), 5) \\\\ double check\n            %6 = [0, 1, -24, 252, -1472, 4830]\n            ? mftobasis(mf, [0,1,-24,252,-1472,0])\n             *** at top-level: mftobasis(mf,[0,1,\n             *** ^--------------------\n             *** mftobasis: domain error in mftobasis: form does not belong to space\n            ? mftobasis(mf, mfEk(10))\n             *** at top-level: mftobasis(mf,mfEk(\n             *** ^--------------------\n             *** mftobasis: domain error in mftobasis: form does not belong to space\n            ? mftobasis(mf, mfEk(10), 1)\n            %7 = []~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1003mftobasis(PyObject *__pyx_v_mf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftobasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_flag,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_F)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftobasis") < 0)) __PYX_ERR(10, 17605, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_F = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17605, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftobasis", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17605, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1002mftobasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), __pyx_v_F, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1002mftobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F, long __pyx_v_flag) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftobasis", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":17665
 *             %7 = []~
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17666
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17666, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17667
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17668
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17669
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftobasis(__pyx_v__mf, __pyx_v__F, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":17670
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftobasis(_mf, _F, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftonew(mf, F):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17605
 *         return new_gen(_ret)
 * 
 *     def mftobasis(mf, F, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of the form :math:`F` on the basis given by :literal:`mfbasis(mf)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17672
 *         return new_gen(_ret)
 * 
 *     def mftonew(mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being being a full or cuspidal space with parameters :math:`[N,k,\chi]`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1005mftonew(PyObject *__pyx_v_mf, PyObject *__pyx_v_F); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1004mftonew[] = "\n        :literal:`mf` being being a full or cuspidal space with parameters :math:`[N,k,\\chi]`\n        and :math:`F` a cusp form in that space, returns a vector of 3-component vectors\n        :math:`[M,d,G]`, where :math:`f(\\chi) \\| M \\| N`, :math:`d \\| N/M`, and :math:`G` is a form\n        in :math:`S_k^{new}(\\Gamma_0(M),\\chi)` such that :math:`F` is equal to the sum of\n        the :math:`B(d)(G)` over all these 3-component vectors.\n        \n        ::\n        \n            ? mf = mfinit([96,6],1); F = mfbasis(mf)[60]; s = mftonew(mf,F); #s\n            %1 = 1\n            ? [M,d,G] = s[1]; [M,d]\n            %2 = [48, 2]\n            ? mfcoefs(F,10)\n            %3 = [0, 0, -160, 0, 0, 0, 0, 0, 0, 0, -14400]\n            ? mfcoefs(G,10)\n            %4 = [0, 0, -160, 0, 0, 0, 0, 0, 0, 0, -14400]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1005mftonew(PyObject *__pyx_v_mf, PyObject *__pyx_v_F) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftonew (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1004mftonew(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mf), ((PyObject *)__pyx_v_F));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1004mftonew(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mf, PyObject *__pyx_v_F) {
  GEN __pyx_v__mf;
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftonew", 0);
  __Pyx_INCREF(__pyx_v_F);

  /* "cypari/auto_gen.pxi":17691
 *             %4 = [0, 0, -160, 0, 0, 0, 0, 0, 0, 0, -14400]
 *         '''
 *         F = objtogen(F)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17692
 *         '''
 *         F = objtogen(F)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17692, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17693
 *         F = objtogen(F)
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftonew(_mf, _F)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mf)->__pyx_base.g;
  __pyx_v__mf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17694
 *         sig_on()
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftonew(_mf, _F)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17695
 *         cdef GEN _mf = (<Gen>mf).g
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftonew(_mf, _F)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftonew(__pyx_v__mf, __pyx_v__F);

  /* "cypari/auto_gen.pxi":17696
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _ret = mftonew(_mf, _F)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftraceform(NK, long space=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17672
 *         return new_gen(_ret)
 * 
 *     def mftonew(mf, F):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`mf` being being a full or cuspidal space with parameters :math:`[N,k,\chi]`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftonew", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17698
 *         return new_gen(_ret)
 * 
 *     def mftraceform(NK, long space=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI,.]` as in :literal:`mfinit` with :math:`k` integral, gives the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1007mftraceform(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1006mftraceform[] = "\n        If :math:`NK = [N,k,CHI,.]` as in :literal:`mfinit` with :math:`k` integral, gives the\n        trace form in the corresponding subspace of :math:`S_k(\\Gamma_0(N),\\chi)`.\n        The supported values for :literal:`space` are 0: the newspace (default),\n        1: the full cuspidal space.\n        \n        ::\n        \n            ? F = mftraceform([23,2]); mfcoefs(F,16)\n            %1 = [0, 2, -1, 0, -1, -2, -5, 2, 0, 4, 6, -6, 5, 6, 4, -10, -3]\n            ? F = mftraceform([23,1,-23]); mfcoefs(F,16)\n            %2 = [0, 1, -1, -1, 0, 0, 1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1007mftraceform(PyObject *__pyx_v_NK, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_space;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftraceform (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_space,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mftraceform") < 0)) __PYX_ERR(10, 17698, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_space = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_space == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17698, __pyx_L3_error)
    } else {
      __pyx_v_space = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mftraceform", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17698, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftraceform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1006mftraceform(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_NK), __pyx_v_space);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1006mftraceform(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_NK, long __pyx_v_space) {
  GEN __pyx_v__NK;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mftraceform", 0);

  /* "cypari/auto_gen.pxi":17712
 *             %2 = [0, 1, -1, -1, 0, 0, 1, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mftraceform(_NK, space)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17712, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17713
 *         '''
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftraceform(_NK, space)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_NK)->__pyx_base.g;
  __pyx_v__NK = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17714
 *         sig_on()
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mftraceform(_NK, space)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftraceform(__pyx_v__NK, __pyx_v_space);

  /* "cypari/auto_gen.pxi":17715
 *         cdef GEN _NK = (<Gen>NK).g
 *         cdef GEN _ret = mftraceform(_NK, space)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mftwist(F, D):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17698
 *         return new_gen(_ret)
 * 
 *     def mftraceform(NK, long space=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :math:`NK = [N,k,CHI,.]` as in :literal:`mfinit` with :math:`k` integral, gives the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftraceform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17717
 *         return new_gen(_ret)
 * 
 *     def mftwist(F, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, returns the twist of :math:`F` by the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1009mftwist(PyObject *__pyx_v_F, PyObject *__pyx_v_D); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1008mftwist[] = "\n        :math:`F` being a generalized modular form, returns the twist of :math:`F` by the\n        integer :math:`D`, i.e., the form :math:`G` such that\n        :literal:`mfcoef(G,n) = `:math:`(D/n)`:literal:`mfcoef(F,n)`, where :math:`(D/n)` is the Kronecker\n        symbol.\n        \n        ::\n        \n            ? mf = mfinit([11,2],0); F = mfbasis(mf)[1]; mfcoefs(F, 5)\n            %1 = [0, 1, -2, -1, 2, 1]\n            ? G = mftwist(F,-3); mfcoefs(G, 5)\n            %2 = [0, 1, 2, 0, 2, -1]\n            ? mf2 = mfinit([99,2],0); mftobasis(mf2, G)\n            %3 = [1/3, 0, 1/3, 0]~\n        \n        Note that twisting multiplies the level by :math:`D^2`. In\n        particular it is not an involution:\n        \n        ::\n        \n            ? H = mftwist(G,-3); mfcoefs(H, 5)\n            %4 = [0, 1, -2, 0, 2, 1]\n            ? mfparams(G)\n            %5 = [99, 2, 1, y]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1009mftwist(PyObject *__pyx_v_F, PyObject *__pyx_v_D) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mftwist (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1008mftwist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), ((PyObject *)__pyx_v_D));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1008mftwist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_D) {
  GEN __pyx_v__F;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mftwist", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":17743
 *             %5 = [99, 2, 1, y]
 *         '''
 *         D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17743, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17744
 *         '''
 *         D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17744, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17745
 *         D = objtogen(D)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = mftwist(_F, _D)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17746
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mftwist(_F, _D)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17747
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = mftwist(_F, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mftwist(__pyx_v__F, __pyx_v__D);

  /* "cypari/auto_gen.pxi":17748
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = mftwist(_F, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def min(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17748, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17717
 *         return new_gen(_ret)
 * 
 *     def mftwist(F, D):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`F` being a generalized modular form, returns the twist of :math:`F` by the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mftwist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17750
 *         return new_gen(_ret)
 * 
 *     def min(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1011min(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1010min[] = "\n        Creates the maximum of :math:`x` and :math:`y` when they can be compared.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1011min(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("min (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1010min(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1010min(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("min", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":17754
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17754, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":17755
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 17755, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17756
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmin(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17757
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmin(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":17758
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmin(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmin(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":17759
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = gmin(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def minpoly(A, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 17759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17750
 *         return new_gen(_ret)
 * 
 *     def min(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the maximum of :math:`x` and :math:`y` when they can be compared.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.min", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17761
 *         return new_gen(_ret)
 * 
 *     def minpoly(A, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         minimal polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1013minpoly(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1012minpoly[] = "\n        minimal polynomial\n        of :math:`A` with respect to the variable :math:`v`., i.e. the monic polynomial :math:`P`\n        of minimal degree (in the variable :math:`v`) such that :math:`P(A) = 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1013minpoly(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("minpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "minpoly") < 0)) __PYX_ERR(10, 17761, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("minpoly", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17761, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.minpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1012minpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1012minpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("minpoly", 0);

  /* "cypari/auto_gen.pxi":17767
 *         of minimal degree (in the variable :math:`v`) such that :math:`P(A) = 0`.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":17768
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":17769
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 17769, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":17768
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":17770
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = minpoly(_A, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 17770, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17771
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = minpoly(_A, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_5;

  /* "cypari/auto_gen.pxi":17772
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = minpoly(_A, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = minpoly(__pyx_v__A, __pyx_v__v);

  /* "cypari/auto_gen.pxi":17773
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = minpoly(_A, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def modreverse(z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 17773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17761
 *         return new_gen(_ret)
 * 
 *     def minpoly(A, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         minimal polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.minpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17775
 *         return new_gen(_ret)
 * 
 *     def modreverse(z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`z = Mod(A, T)` be a polmod, and :math:`Q` be its minimal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1015modreverse(PyObject *__pyx_v_z, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1014modreverse[] = "\n        Let :math:`z = Mod(A, T)` be a polmod, and :math:`Q` be its minimal\n        polynomial, which must satisfy :math:`deg(Q) = deg(T)`.\n        Returns a \"reverse polmod\" :literal:`Mod(B, Q)`, which is a root of :math:`T`.\n        \n        This is quite useful when one changes the generating element in algebraic\n        extensions:\n        \n        ::\n        \n            ? u = Mod(x, x^3 - x -1); v = u^5;\n            ? w = modreverse(v)\n            %2 = Mod(x^2 - 4*x + 1, x^3 - 5*x^2 + 4*x - 1)\n        \n        which means that :math:`x^3 - 5x^2 + 4x -1` is another defining polynomial for the\n        cubic field\n        \n        .. MATH::\n        \n            \\mathbb{Q} (u) = \\mathbb{Q}[x]/(x^3 - x - 1) = \\mathbb{Q}[x]/(x^3 - 5x^2 + 4x - 1) = \\mathbb{Q} (v),\n        \n        and that :math:`u \\to v^2 - 4v + 1` gives an explicit isomorphism. From this, it is\n        easy to convert elements between the :math:`A(u)\\in \\mathbb{Q} (u)` and :math:`B(v)\\in \\mathbb{Q} (v)`\n        representations:\n        \n        ::\n        \n            ? A = u^2 + 2*u + 3; subst(lift(A), 'x, w)\n            %3 = Mod(x^2 - 3*x + 3, x^3 - 5*x^2 + 4*x - 1)\n            ? B = v^2 + v + 1; subst(lift(B), 'x, v)\n            %4 = Mod(26*x^2 + 31*x + 26, x^3 - x - 1)\n        \n        If the minimal polynomial of :math:`z` has lower degree than expected, the routine\n        fails\n        \n        ::\n        \n            ? u = Mod(-x^3 + 9*x, x^4 - 10*x^2 + 1)\n            ? modreverse(u)\n             *** modreverse: domain error in modreverse: deg(minpoly(z)) < 4\n             *** Break loop: type 'break' to go back to GP prompt\n            break> Vec( dbg_err() ) \\\\ ask for more info\n            [\"e_DOMAIN\", \"modreverse\", \"deg(minpoly(z))\", \"<\", 4,\n             Mod(-x^3 + 9*x, x^4 - 10*x^2 + 1)]\n            break> minpoly(u)\n            x^2 - 8\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1015modreverse(PyObject *__pyx_v_z, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("modreverse (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1014modreverse(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_z));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1014modreverse(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_z) {
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("modreverse", 0);

  /* "cypari/auto_gen.pxi":17823
 *             x^2 - 8
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = modreverse(_z)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17823, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17824
 *         '''
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = modreverse(_z)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17825
 *         sig_on()
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = modreverse(_z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = modreverse(__pyx_v__z);

  /* "cypari/auto_gen.pxi":17826
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = modreverse(_z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def moebius(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17775
 *         return new_gen(_ret)
 * 
 *     def modreverse(z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`z = Mod(A, T)` be a polmod, and :math:`Q` be its minimal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.modreverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17828
 *         return new_gen(_ret)
 * 
 *     def moebius(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Moebius :math:`\mu`-function of :math:`\|x\|`; :math:`x` must be a non-zero integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1017moebius(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1016moebius[] = "\n        Moebius :math:`\\mu`-function of :math:`\\|x\\|`; :math:`x` must be a non-zero integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1017moebius(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("moebius (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1016moebius(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1016moebius(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("moebius", 0);

  /* "cypari/auto_gen.pxi":17832
 *         Moebius :math:`\mu`-function of :math:`\|x\|`; :math:`x` must be a non-zero integer.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = moebius(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17832, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17833
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = moebius(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17834
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = moebius(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = moebius(__pyx_v__x);

  /* "cypari/auto_gen.pxi":17835
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = moebius(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":17836
 *         cdef long _ret = moebius(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def msatkinlehner(M, long Q, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17836, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17828
 *         return new_gen(_ret)
 * 
 *     def moebius(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Moebius :math:`\mu`-function of :math:`\|x\|`; :math:`x` must be a non-zero integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.moebius", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17838
 *         return _ret
 * 
 *     def msatkinlehner(M, long Q, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a full modular symbol space of level :math:`N`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1019msatkinlehner(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1018msatkinlehner[] = "\n        Let :math:`M` be a full modular symbol space of level :math:`N`,\n        as given by :literal:`msinit`, let :math:`Q \\| N`, :math:`(Q,N/Q) = 1`,\n        and let :math:`H` be a subspace stable under the Atkin-Lehner involution :math:`w_Q`.\n        Return the matrix of :math:`w_Q` acting on :math:`H` (:math:`M` if omitted).\n        \n        ::\n        \n            ? M = msinit(36,2); \\\\ M_2(Gamma_0(36))\n            ? w = msatkinlehner(M,4); w^2 == 1\n            %2 = 1\n            ? #w \\\\ involution acts on a 13-dimensional space\n            %3 = 13\n            ? M = msinit(36,2, -1); \\\\ M_2(Gamma_0(36))^-\n            ? w = msatkinlehner(M,4); w^2 == 1\n            %5 = 1\n            ? #w\n            %6 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1019msatkinlehner(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_Q;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msatkinlehner (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_H,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_Q)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msatkinlehner") < 0)) __PYX_ERR(10, 17838, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Q = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_Q == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17838, __pyx_L3_error)
    __pyx_v_H = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msatkinlehner", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17838, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.msatkinlehner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1018msatkinlehner(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_Q, __pyx_v_H);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1018msatkinlehner(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_Q, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("msatkinlehner", 0);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":17858
 *             %6 = 4
 *         '''
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_1 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_1;

  /* "cypari/auto_gen.pxi":17859
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17860
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":17859
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":17861
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 17861, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17862
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":17863
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":17864
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":17865
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_gen.pxi":17864
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 */
  }

  /* "cypari/auto_gen.pxi":17866
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msatkinlehner(__pyx_v__M, __pyx_v_Q, __pyx_v__H);

  /* "cypari/auto_gen.pxi":17867
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msatkinlehner(_M, Q, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mscuspidal(M, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 17867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17838
 *         return _ret
 * 
 *     def msatkinlehner(M, long Q, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` be a full modular symbol space of level :math:`N`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msatkinlehner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17869
 *         return new_gen(_ret)
 * 
 *     def mscuspidal(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1021mscuspidal(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1020mscuspidal[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return its cuspidal part :math:`S`. If :math:`flag = 1`, return\n        :math:`[S,E]` its decomposition into cuspidal and Eisenstein parts.\n        \n        A subspace is given by a structure allowing quick projection and\n        restriction of linear operators; its first component is\n        a matrix with integer coefficients whose columns form a :math:`\\mathbb{Q}`-basis of\n        the subspace.\n        \n        ::\n        \n            ? M = msinit(2,8, 1); \\\\ M_8(Gamma_0(2))^+\n            ? [S,E] = mscuspidal(M, 1);\n            ? E[1] \\\\ 2-dimensional\n            %3 =\n            [0 -10]\n            \n            [0 -15]\n            \n            [0 -3]\n            \n            [1 0]\n            \n            ? S[1] \\\\ 1-dimensional\n            %4 =\n            [ 3]\n            \n            [30]\n            \n            [ 6]\n            \n            [-8]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1021mscuspidal(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mscuspidal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mscuspidal") < 0)) __PYX_ERR(10, 17869, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 17869, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mscuspidal", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17869, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mscuspidal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1020mscuspidal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1020mscuspidal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mscuspidal", 0);

  /* "cypari/auto_gen.pxi":17904
 *             [-8]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mscuspidal(_M, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17904, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17905
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mscuspidal(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17906
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mscuspidal(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mscuspidal(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":17907
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mscuspidal(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msdim(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17869
 *         return new_gen(_ret)
 * 
 *     def mscuspidal(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mscuspidal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17909
 *         return new_gen(_ret)
 * 
 *     def msdim(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space or subspace, for instance
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1023msdim(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1022msdim[] = "\n        :math:`M` being a full modular symbol space or subspace, for instance\n        as given by :literal:`msinit` or :literal:`mscuspidal`, return\n        its dimension as a :math:`\\mathbb{Q}`-vector space.\n        \n        ::\n        \n            ? M = msinit(11,4); msdim(M)\n            %1 = 6\n            ? M = msinit(11,4,1); msdim(M)\n            %2 = 4 \\\\ dimension of the '+' part\n            ? [S,E] = mscuspidal(M,1);\n            ? [msdim(S), msdim(E)]\n            %4 = [2, 2]\n        \n        Note that :literal:`mfdim([N,k])` is going to be much faster if\n        you only need the dimension of the space and not really to work with it.\n        This function is only useful to quickly check the dimension of an existing\n        space.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1023msdim(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msdim (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1022msdim(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1022msdim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("msdim", 0);

  /* "cypari/auto_gen.pxi":17930
 *         space.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msdim(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17930, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17931
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msdim(_M)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17932
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msdim(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msdim(__pyx_v__M);

  /* "cypari/auto_gen.pxi":17933
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msdim(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":17934
 *         cdef long _ret = msdim(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mseisenstein(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17909
 *         return new_gen(_ret)
 * 
 *     def msdim(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space or subspace, for instance
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msdim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17936
 *         return _ret
 * 
 *     def mseisenstein(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1025mseisenstein(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1024mseisenstein[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return its Eisenstein subspace.\n        A subspace is given by a structure allowing quick projection and\n        restriction of linear operators; its first component is\n        a matrix with integer coefficients whose columns form a :math:`\\mathbb{Q}`-basis of\n        the subspace.\n        This is the same basis as given by the second component of\n        :literal:`mscuspidal`:math:`(M, 1)`.\n        \n        ::\n        \n            ? M = msinit(2,8, 1); \\\\ M_8(Gamma_0(2))^+\n            ? E = mseisenstein(M);\n            ? E[1] \\\\ 2-dimensional\n            %3 =\n            [0 -10]\n            \n            [0 -15]\n            \n            [0 -3]\n            \n            [1 0]\n            \n            ? E == mscuspidal(M,1)[2]\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1025mseisenstein(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mseisenstein (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1024mseisenstein(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1024mseisenstein(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mseisenstein", 0);

  /* "cypari/auto_gen.pxi":17964
 *             %4 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mseisenstein(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 17964, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":17965
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mseisenstein(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":17966
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mseisenstein(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mseisenstein(__pyx_v__M);

  /* "cypari/auto_gen.pxi":17967
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mseisenstein(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mseval(M, s, p=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 17967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17936
 *         return _ret
 * 
 *     def mseisenstein(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mseisenstein", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":17969
 *         return new_gen(_ret)
 * 
 *     def mseval(M, s, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1 (\mathbb{Q}))`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1027mseval(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1026mseval[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1 (\\mathbb{Q}))`.\n        Let :math:`M` be a full modular symbol space, as given by :literal:`msinit`,\n        let :math:`s` be a modular symbol from :math:`M`, i.e. an element\n        of :math:`\\text{Hom}_G(\\Delta, V)`, and let :math:`p = [a,b] \\in \\Delta` be a path between\n        two elements in :math:`\\mathbb{P}^1(\\mathbb{Q})`, return :math:`s(p)\\in V`. The path extremities :math:`a` and\n        :math:`b` may be given as :literal:`t_INT`, :literal:`t_FRAC` or :math:`oo = (1:0)`; it\n        is also possible to describe the path by a :math:`2 x 2` integral matrix\n        whose columns give the two cusps. The symbol :math:`s` is either\n        \n        - a :literal:`t_COL` coding a modular symbol in terms of\n          the fixed basis of :math:`\\text{Hom}_G(\\Delta,V)` chosen in :math:`M`; if :math:`M` was\n          initialized with a non-zero :emphasis:`sign` (:math:`+` or :math:`-`), then either the\n          basis for the full symbol space or the :math:`\302\261`-part can be used (the dimension\n          being used to distinguish the two).\n        \n        - a :literal:`t_MAT` whose columns encode modular symbols as above. This is\n          much faster than evaluating individual symbols on the same path :math:`p`\n          independently.\n        \n        - a :literal:`t_VEC` :math:`(v_i)` of elements of :math:`V`, where the :math:`v_i = s(g_i)` give\n          the image of the generators :math:`g_i` of :math:`\\Delta`, see :literal:`mspathgens`.\n          We assume that :math:`s` is a proper symbol, i.e.\302\240that the :math:`v_i` satisfy\n          the :literal:`mspathgens` relations.\n        \n        If :math:`p` is omitted, convert a single symbol :math:`s` to the second form: a vector\n        of the :math:`s(g_i)`. A :literal:`t_MAT` is converted to a vector of such.\n        \n        ::\n        \n            ? M = msinit(2,8,1); \\\\ M_8(Gamma_0(2))^+\n            ? g = mspa""thgens(M)[1]\n            %2 = [[+oo, 0], [0, 1]]\n            ? N = msnew(M)[1]; #N \\\\ Q-basis of new subspace, dimension 1\n            %3 = 1\n            ? s = N[,1] \\\\ t_COL representation\n            %4 = [-3, 6, -8]~\n            ? S = mseval(M, s) \\\\ t_VEC representation\n            %5 = [64*x^6-272*x^4+136*x^2-8, 384*x^5+960*x^4+192*x^3-672*x^2-432*x-72]\n            ? mseval(M,s, g[1])\n            %6 = 64*x^6 - 272*x^4 + 136*x^2 - 8\n            ? mseval(M,S, g[1])\n            %7 = 64*x^6 - 272*x^4 + 136*x^2 - 8\n        \n        Note that the symbol should have values in\n        :math:`V = \\mathbb{Q}[x,y]_{k-2}`, we return the de-homogenized values corresponding to :math:`y\n        = 1` instead.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1027mseval(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mseval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_p,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_s)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mseval") < 0)) __PYX_ERR(10, 17969, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mseval", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 17969, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1026mseval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_s, __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1026mseval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_s, PyObject *__pyx_v_p) {
  int __pyx_v__have_p;
  GEN __pyx_v__M;
  GEN __pyx_v__s;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mseval", 0);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":18018
 *         = 1` instead.
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18019
 *         '''
 *         s = objtogen(s)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_2 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18020
 *         s = objtogen(s)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":18021
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18021, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":18020
 *         s = objtogen(s)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":18022
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 18022, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18023
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18024
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18025
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":18026
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)
 */
  __pyx_t_2 = (__pyx_v__have_p != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":18027
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mseval(_M, _s, _p)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":18026
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)
 */
  }

  /* "cypari/auto_gen.pxi":18028
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mseval(__pyx_v__M, __pyx_v__s, __pyx_v__p);

  /* "cypari/auto_gen.pxi":18029
 *             _p = (<Gen>p).g
 *         cdef GEN _ret = mseval(_M, _s, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msfromcusp(M, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":17969
 *         return new_gen(_ret)
 * 
 *     def mseval(M, s, p=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1 (\mathbb{Q}))`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18031
 *         return new_gen(_ret)
 * 
 *     def msfromcusp(M, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the modular symbol attached to the cusp
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1029msfromcusp(PyObject *__pyx_v_M, PyObject *__pyx_v_c); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1028msfromcusp[] = "\n        Returns the modular symbol attached to the cusp\n        :math:`c`, where :math:`M` is a modular symbol space of level :math:`N`, attached to\n        :math:`G = \\Gamma_0(N)`. The cusp :math:`c` in :math:`\\mathbb{P}^1(\\mathbb{Q})/G` is given either as :literal:`oo`\n        (:math:`= (1:0)`) or as a rational number :math:`a/b` (:math:`= (a:b)`). The attached symbol maps\n        the path :math:`[b] - [a] \\in Div^0 (\\mathbb{P}^1(\\mathbb{Q}))` to :math:`E_c(b) - E_c(a)`, where\n        :math:`E_c(r)` is :math:`0` when :math:`r != c` and :math:`X^{k-2} \\| \\gamma_r` otherwise, where\n        :math:`\\gamma_r.r = (1:0)`. These symbols span the Eisenstein subspace\n        of :math:`M`.\n        \n        ::\n        \n            ? M = msinit(2,8); \\\\ M_8(Gamma_0(2))\n            ? E = mseisenstein(M);\n            ? E[1] \\\\ two-dimensional\n            %3 =\n            [0 -10]\n            \n            [0 -15]\n            \n            [0 -3]\n            \n            [1 0]\n            \n            ? s = msfromcusp(M,oo)\n            %4 = [0, 0, 0, 1]~\n            ? mseval(M, s)\n            %5 = [1, 0]\n            ? s = msfromcusp(M,1)\n            %6 = [-5/16, -15/32, -3/32, 0]~\n            ? mseval(M,s)\n            %7 = [-x^6, -6*x^5 - 15*x^4 - 20*x^3 - 15*x^2 - 6*x - 1]\n        \n        In case :math:`M` was initialized with a non-zero :emphasis:`sign`, the symbol is given\n        in terms of the fixed basis of the whole symbol space, not the :math:`+` or :math:`-`\n        part (to which it need not belong).\n        \n        ::\n        \n            ? M = msinit(2,8, 1); \\\\ M_8(Gamma_0(2))^+\n            ? E = mseisenstein(M);\n            ? E[1] \\\\ still two-dimensional, in a smaller space\n            %3 =\n            [ 0 -10]\n            \n            [ 0 3]\n            \n            [-1 0]\n            \n            ? s = msfromcusp(M,oo) \\\\ in terms of the basis for M_8(Gamma_0(2)) !\n            %4 = [0, 0, 0, 1]""~\n            ? mseval(M, s) \\\\ same symbol as before\n            %5 = [1, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1029msfromcusp(PyObject *__pyx_v_M, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msfromcusp (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1028msfromcusp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), ((PyObject *)__pyx_v_c));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1028msfromcusp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_c) {
  GEN __pyx_v__M;
  GEN __pyx_v__c;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msfromcusp", 0);
  __Pyx_INCREF(__pyx_v_c);

  /* "cypari/auto_gen.pxi":18086
 *             %5 = [1, 0]
 *         '''
 *         c = objtogen(c)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18087
 *         '''
 *         c = objtogen(c)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _c = (<Gen>c).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 18087, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18088
 *         c = objtogen(c)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = msfromcusp(_M, _c)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18089
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _c = (<Gen>c).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msfromcusp(_M, _c)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c)->__pyx_base.g;
  __pyx_v__c = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18090
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = msfromcusp(_M, _c)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msfromcusp(__pyx_v__M, __pyx_v__c);

  /* "cypari/auto_gen.pxi":18091
 *         cdef GEN _c = (<Gen>c).g
 *         cdef GEN _ret = msfromcusp(_M, _c)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msfromell(E, long sign=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18031
 *         return new_gen(_ret)
 * 
 *     def msfromcusp(M, c):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the modular symbol attached to the cusp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msfromcusp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18093
 *         return new_gen(_ret)
 * 
 *     def msfromell(E, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve of conductor :math:`N`. For :math:`\varepsilon =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1031msfromell(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1030msfromell[] = "\n        Let :math:`E/\\mathbb{Q}` be an elliptic curve of conductor :math:`N`. For :math:`\\varepsilon =\n        \302\2611`, we define the (cuspidal, new) modular symbol :math:`x^\\varepsilon` in\n        :math:`H^1_c(X_0(N),\\mathbb{Q})^\\varepsilon` attached to\n        :math:`E`. For all primes :math:`p` not dividing :math:`N` we have\n        :math:`T_p(x^\\varepsilon) = a_p x^\\varepsilon`, where :math:`a_p = p+1-\\#E(\\mathbb{F}_p)`.\n        \n        Let :math:`\\Omega^ += E.omega[1]` be the real period of :math:`E`\n        (integration of the N\303\251ron differential :math:`dx/(2y+a_1x+a3)` on the connected\n        component of :math:`E(\\mathbb{R})`, i.e.\302\240the generator of :math:`H_1(E,\\mathbb{Z})^+`) normalized by\n        :math:`\\Omega^+ > 0`. Let :math:`i\\Omega^-` the integral on a generator of :math:`H_1(E,\\mathbb{Z})^-` with\n        :math:`\\Omega^- \\in \\mathbb{R}_{ > 0}`. If :math:`c_ oo` is the number of connected components of\n        :math:`E(\\mathbb{R})`, :math:`\\Omega^-` is equal to :math:`(-2/c_ oo ) x imag(E.omega[2])`.\n        The complex modular symbol is defined by\n        \n        .. MATH::\n        \n            F: \\delta \\to 2i\\pi \\int_{\\delta} f(z) dz\n        \n        The modular symbols :math:`x^\\varepsilon` are normalized so that\n        :math:`F = x^+ \\Omega^+ + x^- i\\Omega^-`. In particular, we have\n        \n        .. MATH::\n        \n            x^+([0]-[ oo ]) = L(E,1) / \\Omega^+,\n        \n        which defines :math:`x^{\302\261}` unless :math:`L(E,1) = 0`. Furthermore, for all fundamental\n        discriminants :math:`D` such that :math:`\\varepsilon.D > 0`, we also have\n        \n        .. MATH::\n        \n            \\sum_{0 <= a < \\|D\\|} (D\\|a) x^\\varepsilon ([a/\\|D\\|]-[ oo ])\n            = L(E,(D\\|.),1) / \\Omega^{\\varepsilon},\n        \n        where :math:`(D\\|.)` is the Kronecker symbol. The period :math:`\\Omega^-` is also\n        :math:`2/c_ oo x` the real perio""d of the twist\n        :math:`E^{(-4)} = elltwist(E,-4)`.\n        \n        This function returns the pair :math:`[M, x]`, where :math:`M` is\n        :literal:`msinit`:math:`(N,2)` and :math:`x` is :math:`x^{sign}` as above when :math:`sign =\n        \302\2611`, and :math:`x = [x^+,x^-, L_E]` when :emphasis:`sign` is :math:`0`, where :math:`L_E`\n        is a matrix giving the canonical :math:`\\mathbb{Z}`-lattice attached to :math:`E` in the sense\n        of :literal:`mslattice` applied to :math:`\\mathbb{Q} x^+ + \\mathbb{Q} x^-`. Explicitly, it\n        is generated by :math:`(x^{+},x^{-})` when :math:`E(\\mathbb{R})` has two connected components\n        and by :math:`(x^{+} - x^{-},2x^-)` otherwise.\n        \n        The modular symbols :math:`x^\302\261` are given as a :literal:`t_COL` (in terms\n        of the fixed basis of :math:`\\text{Hom}_G(\\Delta,\\mathbb{Q})` chosen in :math:`M`).\n        \n        ::\n        \n            ? E=ellinit([0,-1,1,-10,-20]); \\\\ X_0(11)\n            ? [M,xp]= msfromell(E,1);\n            ? xp\n            %3 = [1/5, -1/2, -1/2]~\n            ? [M,x]= msfromell(E);\n            ? x \\\\ x^+, x^- and L_E\n            %5 = [[1/5, -1/2, -1/2]~, [0, 1/2, -1/2]~, [1/5, 0; -1, 1; 0, -1]]\n            ? p = 23; (mshecke(M,p) - ellap(E,p))*x[1]\n            %6 = [0, 0, 0]~ \\\\ true at all primes, including p = 11; same for x[2]\n            ? (mshecke(M,p) - ellap(E,p))*x[3] == 0\n            %7 = 1\n        \n        Instead of a single curve :math:`E`, one may use instead a vector\n        of :emphasis:`isogenous` curves. The function then returns :math:`M` and the\n        vector of attached modular symbols.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1031msfromell(PyObject *__pyx_v_E, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_sign;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msfromell (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sign,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sign);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msfromell") < 0)) __PYX_ERR(10, 18093, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_sign = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_sign == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18093, __pyx_L3_error)
    } else {
      __pyx_v_sign = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msfromell", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18093, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.msfromell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1030msfromell(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_E), __pyx_v_sign);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1030msfromell(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_E, long __pyx_v_sign) {
  GEN __pyx_v__E;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("msfromell", 0);

  /* "cypari/auto_gen.pxi":18161
 *         vector of attached modular symbols.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = msfromell(_E, sign)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18161, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18162
 *         '''
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msfromell(_E, sign)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_E)->__pyx_base.g;
  __pyx_v__E = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18163
 *         sig_on()
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = msfromell(_E, sign)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msfromell(__pyx_v__E, __pyx_v_sign);

  /* "cypari/auto_gen.pxi":18164
 *         cdef GEN _E = (<Gen>E).g
 *         cdef GEN _ret = msfromell(_E, sign)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msfromhecke(M, v, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18093
 *         return new_gen(_ret)
 * 
 *     def msfromell(E, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`E/\mathbb{Q}` be an elliptic curve of conductor :math:`N`. For :math:`\varepsilon =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msfromell", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18166
 *         return new_gen(_ret)
 * 
 *     def msfromhecke(M, v, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a msinit :math:`M` and a vector :math:`v` of pairs :math:`[p, P]` (where :math:`p` is prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1033msfromhecke(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1032msfromhecke[] = "\n        Given a msinit :math:`M` and a vector :math:`v` of pairs :math:`[p, P]` (where :math:`p` is prime\n        and :math:`P` is a polynomial with integer coefficients), return a basis of all\n        modular symbols such that :math:`P(T_p)(s) = 0`. If :math:`H` is present, it must\n        be a Hecke-stable subspace and we restrict to :math:`s \\in H`. When :math:`T_p` has\n        a rational eigenvalue and :math:`P(x) = x-a_p` has degree :math:`1`, we also accept the\n        integer :math:`a_p` instead of :math:`P`.\n        \n        ::\n        \n            ? E = ellinit([0,-1,1,-10,-20]) \\\\11a1\n            ? ellap(E,2)\n            %2 = -2\n            ? ellap(E,3)\n            %3 = -1\n            ? M = msinit(11,2);\n            ? S = msfromhecke(M, [[2,-2],[3,-1]])\n            %5 =\n            [ 1 1]\n            \n            [-5 0]\n            \n            [ 0 -5]\n            ? mshecke(M, 2, S)\n            %6 =\n            [-2 0]\n            \n            [ 0 -2]\n            \n            ? M = msinit(23,4);\n            ? S = msfromhecke(M, [[5, x^4-14*x^3-244*x^2+4832*x-19904]]);\n            ? factor( charpoly(mshecke(M,5,S)) )\n            %9 =\n            [x^4 - 14*x^3 - 244*x^2 + 4832*x - 19904 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1033msfromhecke(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msfromhecke (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_H,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_v)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msfromhecke") < 0)) __PYX_ERR(10, 18166, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
    __pyx_v_H = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msfromhecke", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.msfromhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1032msfromhecke(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_v, __pyx_v_H);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1032msfromhecke(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_v, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__v;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("msfromhecke", 0);
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":18202
 *             [x^4 - 14*x^3 - 244*x^2 + 4832*x - 19904 2]
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18203
 *         '''
 *         v = objtogen(v)
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_2 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18204
 *         v = objtogen(v)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":18205
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":18204
 *         v = objtogen(v)
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":18206
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 18206, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18207
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18208
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18209
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":18210
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 */
  __pyx_t_2 = (__pyx_v__have_H != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":18211
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_gen.pxi":18210
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 */
  }

  /* "cypari/auto_gen.pxi":18212
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msfromhecke(__pyx_v__M, __pyx_v__v, __pyx_v__H);

  /* "cypari/auto_gen.pxi":18213
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msfromhecke(_M, _v, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msgetlevel(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18166
 *         return new_gen(_ret)
 * 
 *     def msfromhecke(M, v, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a msinit :math:`M` and a vector :math:`v` of pairs :math:`[p, P]` (where :math:`p` is prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msfromhecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18215
 *         return new_gen(_ret)
 * 
 *     def msgetlevel(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1035msgetlevel(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1034msgetlevel[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return\n        its level :math:`N`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1035msgetlevel(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msgetlevel (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1034msgetlevel(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1034msgetlevel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("msgetlevel", 0);

  /* "cypari/auto_gen.pxi":18220
 *         its level :math:`N`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetlevel(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18220, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18221
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msgetlevel(_M)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18222
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetlevel(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msgetlevel(__pyx_v__M);

  /* "cypari/auto_gen.pxi":18223
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetlevel(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":18224
 *         cdef long _ret = msgetlevel(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def msgetsign(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18215
 *         return new_gen(_ret)
 * 
 *     def msgetlevel(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msgetlevel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18226
 *         return _ret
 * 
 *     def msgetsign(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1037msgetsign(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1036msgetsign[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return\n        its sign: :math:`\302\2611` or 0 (unset).\n        \n        ::\n        \n            ? M = msinit(11,4, 1);\n            ? msgetsign(M)\n            %2 = 1\n            ? M = msinit(11,4);\n            ? msgetsign(M)\n            %4 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1037msgetsign(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msgetsign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1036msgetsign(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1036msgetsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("msgetsign", 0);

  /* "cypari/auto_gen.pxi":18240
 *             %4 = 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetsign(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18240, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18241
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msgetsign(_M)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18242
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetsign(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msgetsign(__pyx_v__M);

  /* "cypari/auto_gen.pxi":18243
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetsign(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":18244
 *         cdef long _ret = msgetsign(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def msgetweight(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18226
 *         return _ret
 * 
 *     def msgetsign(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msgetsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18246
 *         return _ret
 * 
 *     def msgetweight(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1039msgetweight(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1038msgetweight[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return\n        its weight :math:`k`.\n        \n        ::\n        \n            ? M = msinit(11,4);\n            ? msgetweight(M)\n            %2 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1039msgetweight(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msgetweight (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1038msgetweight(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1038msgetweight(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("msgetweight", 0);

  /* "cypari/auto_gen.pxi":18257
 *             %2 = 4
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetweight(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18257, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18258
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = msgetweight(_M)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18259
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetweight(_M)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = msgetweight(__pyx_v__M);

  /* "cypari/auto_gen.pxi":18260
 *         cdef GEN _M = (<Gen>M).g
 *         cdef long _ret = msgetweight(_M)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":18261
 *         cdef long _ret = msgetweight(_M)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def mshecke(M, long p, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18246
 *         return _ret
 * 
 *     def msgetweight(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msgetweight", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18263
 *         return _ret
 * 
 *     def mshecke(M, long p, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1041mshecke(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1040mshecke[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        :math:`p` being a prime number, and :math:`H` being a Hecke-stable subspace (:math:`M` if\n        omitted) return the matrix of :math:`T_p` acting on :math:`H`\n        (:math:`U_p` if :math:`p` divides :math:`N`). Result is undefined if :math:`H` is not stable\n        by :math:`T_p` (resp.\302\240:math:`U_p`).\n        \n        ::\n        \n            ? M = msinit(11,2); \\\\ M_2(Gamma_0(11))\n            ? T2 = mshecke(M,2)\n            %2 =\n            [3 0 0]\n            \n            [1 -2 0]\n            \n            [1 0 -2]\n            ? M = msinit(11,2, 1); \\\\ M_2(Gamma_0(11))^+\n            ? T2 = mshecke(M,2)\n            %4 =\n            [ 3 0]\n            \n            [-1 -2]\n            \n            ? N = msnew(M)[1] \\\\ Q-basis of new cuspidal subspace\n            %5 =\n            [-2]\n            \n            [-5]\n            \n            ? p = 1009; mshecke(M, p, N) \\\\ action of T_1009 on N\n            %6 =\n            [-10]\n            ? ellap(ellinit(\"11a1\"), p)\n            %7 = -10\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1041mshecke(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_p;
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mshecke (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_H,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mshecke") < 0)) __PYX_ERR(10, 18263, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18263, __pyx_L3_error)
    __pyx_v_H = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mshecke", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18263, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mshecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1040mshecke(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_p, __pyx_v_H);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1040mshecke(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_p, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mshecke", 0);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":18300
 *             %7 = -10
 *         '''
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_1 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_1;

  /* "cypari/auto_gen.pxi":18301
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18302
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":18301
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":18303
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 18303, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18304
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18305
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":18306
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18307
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mshecke(_M, p, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_gen.pxi":18306
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)
 */
  }

  /* "cypari/auto_gen.pxi":18308
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mshecke(__pyx_v__M, __pyx_v_p, __pyx_v__H);

  /* "cypari/auto_gen.pxi":18309
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mshecke(_M, p, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msinit(G, V, long sign=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18263
 *         return _ret
 * 
 *     def mshecke(M, long p, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mshecke", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18311
 *         return new_gen(_ret)
 * 
 *     def msinit(G, V, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`G` a finite index subgroup of :math:`SL(2,\mathbb{Z})`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1043msinit(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1042msinit[] = "\n        Given :math:`G` a finite index subgroup of :math:`SL(2,\\mathbb{Z})`\n        and a finite dimensional representation :math:`V` of :math:`GL(2,\\mathbb{Q})`, creates a\n        space of modular symbols, the :math:`G`-module :math:`\\text{Hom}_G(Div^0(\\mathbb{P}^1\n        (\\mathbb{Q})), V)`. This is canonically isomorphic to :math:`H^1_c(X(G), V)`, and allows to\n        compute modular forms for :math:`G`. If :emphasis:`sign` is present and non-zero, it\n        must be :math:`\302\2611` and we consider the subspace defined by :math:`Ker (\\sigma -\n        sign)`, where :math:`\\sigma` is induced by :literal:`[-1,0;0,1]`. Currently the\n        only supported groups are the :math:`\\Gamma_0(N)`, coded by the integer :math:`N > 0`.\n        The only supported representation is :math:`V_k = \\mathbb{Q}[X,Y]_{k-2}`, coded by the\n        integer :math:`k >= 2`.\n        \n        ::\n        \n            ? M = msinit(11,2); msdim(M) \\\\ Gamma0(11), weight 2\n            %1 = 3\n            ? mshecke(M,2) \\\\ T_2 acting on M\n            %2 =\n            [3 1 1]\n            \n            [0 -2 0]\n            \n            [0 0 -2]\n            ? msstar(M) \\\\ * involution\n            %3 =\n            [1 0 0]\n            \n            [0 0 1]\n            \n            [0 1 0]\n            \n            ? Mp = msinit(11,2, 1); msdim(Mp) \\\\ + part\n            %4 = 2\n            ? mshecke(Mp,2) \\\\ T_2 action on M^+\n            %5 =\n            [3 2]\n            \n            [0 -2]\n            ? msstar(Mp)\n            %6 =\n            [1 0]\n            \n            [0 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1043msinit(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_V = 0;
  long __pyx_v_sign;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_V,&__pyx_n_s_sign,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_V)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sign);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msinit") < 0)) __PYX_ERR(10, 18311, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_V = values[0];
    if (values[1]) {
      __pyx_v_sign = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_sign == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18311, __pyx_L3_error)
    } else {
      __pyx_v_sign = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18311, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.msinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1042msinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_V, __pyx_v_sign);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1042msinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_V, long __pyx_v_sign) {
  GEN __pyx_v__G;
  GEN __pyx_v__V;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msinit", 0);
  __Pyx_INCREF(__pyx_v_V);

  /* "cypari/auto_gen.pxi":18356
 *             [0 1]
 *         '''
 *         V = objtogen(V)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_V, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_V, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18357
 *         '''
 *         V = objtogen(V)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 18357, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18358
 *         V = objtogen(V)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = msinit(_G, _V, sign)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18359
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msinit(_G, _V, sign)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18360
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = msinit(_G, _V, sign)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msinit(__pyx_v__G, __pyx_v__V, __pyx_v_sign);

  /* "cypari/auto_gen.pxi":18361
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = msinit(_G, _V, sign)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msissymbol(M, s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18311
 *         return new_gen(_ret)
 * 
 *     def msinit(G, V, long sign=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`G` a finite index subgroup of :math:`SL(2,\mathbb{Z})`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18363
 *         return new_gen(_ret)
 * 
 *     def msissymbol(M, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1045msissymbol(PyObject *__pyx_v_M, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1044msissymbol[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        check whether :math:`s` is a modular symbol attached to :math:`M`. If :math:`A` is a matrix,\n        check whether its columns represent modular symbols and return a :math:`0-1`\n        vector.\n        \n        ::\n        \n            ? M = msinit(7,8, 1); \\\\ M_8(Gamma_0(7))^+\n            ? A = msnew(M)[1];\n            ? s = A[,1];\n            ? msissymbol(M, s)\n            %4 = 1\n            ? msissymbol(M, A)\n            %5 = [1, 1, 1]\n            ? S = mseval(M,s);\n            ? msissymbol(M, S)\n            %7 = 1\n            ? [g,R] = mspathgens(M); g\n            %8 = [[+oo, 0], [0, 1/2], [1/2, 1]]\n            ? #R \\\\ 3 relations among the generators g_i\n            %9 = 3\n            ? T = S; T[3]++; \\\\ randomly perturb S(g_3)\n            ? msissymbol(M, T)\n            %11 = 0 \\\\ no longer satisfies the relations\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1045msissymbol(PyObject *__pyx_v_M, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msissymbol (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1044msissymbol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1044msissymbol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_s) {
  GEN __pyx_v__M;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msissymbol", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_gen.pxi":18390
 *             %11 = 0 \\ no longer satisfies the relations
 *         '''
 *         s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18391
 *         '''
 *         s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 18391, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18392
 *         s = objtogen(s)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = msissymbol(_M, _s)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18393
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msissymbol(_M, _s)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18394
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = msissymbol(_M, _s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msissymbol(__pyx_v__M, __pyx_v__s);

  /* "cypari/auto_gen.pxi":18395
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = msissymbol(_M, _s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mslattice(M, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18395, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18363
 *         return new_gen(_ret)
 * 
 *     def msissymbol(M, s):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msissymbol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18397
 *         return new_gen(_ret)
 * 
 *     def mslattice(M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))` and :math:`V_k = \mathbb{Q}[x,y]_{k-2}`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1047mslattice(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1046mslattice[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1(\\mathbb{Q}))` and :math:`V_k = \\mathbb{Q}[x,y]_{k-2}`.\n        Let :math:`M` be a full modular symbol space, as given by :literal:`msinit`\n        and let :math:`H` be a subspace, e.g. as given by :literal:`mscuspidal`.\n        This function returns a canonical :math:`\\mathbb{Z}`\n        structure on :math:`H` defined as follows.\n        Consider the map :math:`c: M = \\text{Hom}_{\\Gamma_0(N)}(\\Delta, V_k) \\to\n        H^1(\\Gamma_0(N), V_k)` given by\n        :math:`\\phi :--->class (\\gamma \\to \\phi ({0, \\gamma^{-1} 0}))`.\n        Let :math:`L_k = \\mathbb{Z}[x,y]_{k-2}` be the natural :math:`\\mathbb{Z}`-structure of :math:`V_k`. The result of\n        :literal:`mslattice` is a :math:`\\mathbb{Z}`-basis of the inverse image by :math:`c` of\n        :math:`H^1(\\Gamma_0(N), L_k)` in the space of modular symbols generated by :math:`H`.\n        \n        For user convenience, :math:`H` can be defined by a matrix representing the\n        :math:`\\mathbb{Q}`-basis of :math:`H` (in terms of the canonical :math:`\\mathbb{Q}`-basis of :math:`M` fixed by\n        :literal:`msinit` and used to represent modular symbols).\n        \n        If omitted, :math:`H` is the cuspidal part of :math:`M` as given by :literal:`mscuspidal`.\n        The Eisenstein part :math:`\\text{Hom}_{\\Gamma_0(N)}(Div(\\mathbb{P}^1(\\mathbb{Q})), V_k)` is in\n        the kernel of :math:`c`, so the result has no meaning for the Eisenstein part\n        :literal:`H`.\n        \n        ::\n        \n            ? M=msinit(11,2);\n            ? [S,E] = mscuspidal(M,1); S[1] \\\\ a primitive Q-basis of S\n            %2 =\n            [ 1 1]\n            [-5 0]\n            [ 0 -5]\n            ? mslattice(M,S)\n            %3 =\n            [-1/5 -1/5]\n            [ 1 0]\n            [ 0 1]\n            ? mslattice(M,E)\n            %4 =\n            [1]\n            [0]\n            [0]\n            ? M=msinit(5,4);\n           "" ? S=mscuspidal(M); S[1]\n            %6 =\n            [ 7 20]\n            [ 3 3]\n            [-10 -23]\n            [-30 -30]\n            ? mslattice(M,S)\n            %7 =\n            [-1/10 -11/130]\n            [ 0 -1/130]\n            [ 1/10 6/65]\n            [ 0 1/13]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1047mslattice(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mslattice (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_H,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mslattice") < 0)) __PYX_ERR(10, 18397, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_H = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mslattice", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18397, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mslattice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1046mslattice(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_H);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1046mslattice(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mslattice", 0);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":18452
 *             [ 0 1/13]
 *         '''
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_1 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_1;

  /* "cypari/auto_gen.pxi":18453
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18454
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18454, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":18453
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":18455
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 18455, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18456
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18457
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":18458
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18459
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mslattice(_M, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_gen.pxi":18458
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)
 */
  }

  /* "cypari/auto_gen.pxi":18460
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mslattice(__pyx_v__M, __pyx_v__H);

  /* "cypari/auto_gen.pxi":18461
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mslattice(_M, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msnew(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18397
 *         return new_gen(_ret)
 * 
 *     def mslattice(M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))` and :math:`V_k = \mathbb{Q}[x,y]_{k-2}`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mslattice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18463
 *         return new_gen(_ret)
 * 
 *     def msnew(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1049msnew(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1048msnew[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return the :emphasis:`new` part of its cuspidal subspace. A subspace is given by\n        a structure allowing quick projection and restriction of linear operators;\n        its first component is a matrix with integer coefficients whose columns form\n        a :math:`\\mathbb{Q}`-basis of the subspace.\n        \n        ::\n        \n            ? M = msinit(11,8, 1); \\\\ M_8(Gamma_0(11))^+\n            ? N = msnew(M);\n            ? #N[1] \\\\ 6-dimensional\n            %3 = 6\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1049msnew(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msnew (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1048msnew(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1048msnew(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("msnew", 0);

  /* "cypari/auto_gen.pxi":18478
 *             %3 = 6
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = msnew(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18478, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18479
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msnew(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18480
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = msnew(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msnew(__pyx_v__M);

  /* "cypari/auto_gen.pxi":18481
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = msnew(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msomseval(Mp, PHI, path):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18463
 *         return new_gen(_ret)
 * 
 *     def msnew(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msnew", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18483
 *         return new_gen(_ret)
 * 
 *     def msomseval(Mp, PHI, path):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the vectors of moments of the :math:`p`-adic distribution attached
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1051msomseval(PyObject *__pyx_v_Mp, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1050msomseval[] = "\n        Return the vectors of moments of the :math:`p`-adic distribution attached\n        to the path :literal:`path` by the overconvergent modular symbol :literal:`PHI`.\n        \n        ::\n        \n            ? M = msinit(3,6,1);\n            ? Mp= mspadicinit(M,5,10);\n            ? phi = [5,-3,-1]~;\n            ? msissymbol(M,phi)\n            %4 = 1\n            ? PHI = mstooms(Mp,phi);\n            ? ME = msomseval(Mp,PHI,[oo, 0]);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1051msomseval(PyObject *__pyx_v_Mp, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_PHI = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msomseval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_PHI,&__pyx_n_s_path,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_PHI)) != 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_path)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("msomseval", 1, 2, 2, 1); __PYX_ERR(10, 18483, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msomseval") < 0)) __PYX_ERR(10, 18483, __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_PHI = values[0];
    __pyx_v_path = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msomseval", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18483, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.msomseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1050msomseval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Mp), __pyx_v_PHI, __pyx_v_path);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1050msomseval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Mp, PyObject *__pyx_v_PHI, PyObject *__pyx_v_path) {
  GEN __pyx_v__Mp;
  GEN __pyx_v__PHI;
  GEN __pyx_v__path;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("msomseval", 0);
  __Pyx_INCREF(__pyx_v_PHI);
  __Pyx_INCREF(__pyx_v_path);

  /* "cypari/auto_gen.pxi":18498
 *             ? ME = msomseval(Mp,PHI,[oo, 0]);
 *         '''
 *         PHI = objtogen(PHI)             # <<<<<<<<<<<<<<
 *         path = objtogen(path)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_PHI, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18498, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_PHI, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18499
 *         '''
 *         PHI = objtogen(PHI)
 *         path = objtogen(path)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_path, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18500
 *         PHI = objtogen(PHI)
 *         path = objtogen(path)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 18500, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18501
 *         path = objtogen(path)
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _path = (<Gen>path).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Mp)->__pyx_base.g;
  __pyx_v__Mp = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18502
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g             # <<<<<<<<<<<<<<
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_PHI)->__pyx_base.g;
  __pyx_v__PHI = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18503
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _path = (<Gen>path).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_path)->__pyx_base.g;
  __pyx_v__path = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18504
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msomseval(__pyx_v__Mp, __pyx_v__PHI, __pyx_v__path);

  /* "cypari/auto_gen.pxi":18505
 *         cdef GEN _path = (<Gen>path).g
 *         cdef GEN _ret = msomseval(_Mp, _PHI, _path)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicL(mu, s=None, long r=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18483
 *         return new_gen(_ret)
 * 
 *     def msomseval(Mp, PHI, path):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the vectors of moments of the :math:`p`-adic distribution attached
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msomseval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_PHI);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18507
 *         return new_gen(_ret)
 * 
 *     def mspadicL(mu, s=None, long r=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1053mspadicL(PyObject *__pyx_v_mu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1052mspadicL[] = "\n        Returns the value (or :math:`r`-th derivative)\n        on a character :math:`\\chi^s` of :math:`\\mathbb{Z}_p^*` of the :math:`p`-adic :math:`L`-function\n        attached to :literal:`mu`.\n        \n        Let :math:`\\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol\n        attached to a modular symbol :math:`\\phi` for :math:`\\Gamma_0(N)` (eigenvector for\n        :math:`T_N(p)` for the eigenvalue :math:`a_p`). Then :math:`L_p(\\Phi,\\chi^s) = L_p(\\mu,s)` is the\n        :math:`p`-adic :math:`L` function defined by\n        \n        .. MATH::\n        \n            L_p(\\Phi,\\chi^s) = \\int_{\\mathbb{Z}_p^*} \\chi^s(z) d\\mu (z)\n        \n        where :math:`\\mu` is the distribution on :math:`\\mathbb{Z}_p^*` defined by the restriction of\n        :math:`\\Phi ([ oo ]-[0])` to :math:`\\mathbb{Z}_p^*`. The :math:`r`-th derivative is taken in\n        direction :math:`<\\chi>`:\n        \n        .. MATH::\n        \n            L_p^{(r)}(\\Phi,\\chi^s) = \\int_{\\mathbb{Z}_p^*} \\chi^s(z) (\\log z)^r d\\mu (z).\n        \n        In the argument list,\n        \n        - :literal:`mu` is as returned by :literal:`mspadicmoments` (distributions\n          attached to :math:`\\Phi` by restriction to discs :math:`a + p^\\nu\\mathbb{Z}_p`, :math:`(a,p) = 1`).\n        \n        - :math:`s = [s_1,s_2]` with :math:`s_1 \\in \\mathbb{Z} \\subset \\mathbb{Z}_p` and :math:`s_2 mod p-1` or\n          :math:`s_2 mod 2` for :math:`p = 2`, encoding the :math:`p`-adic character :math:`\\chi^s := <\n          \\chi >^{s_1} \\tau^{s_2}`; here :math:`\\chi` is the cyclotomic character from\n          :math:`Gal(\\mathbb{Q}_p(\\mu_{p^ oo })/\\mathbb{Q}_p)` to :math:`\\mathbb{Z}_p^*`, and :math:`\\tau` is the\n          Teichm\303\274ller character (for :math:`p > 2` and the character of order 2 on\n          :math:`(\\mathbb{Z}/4\\mathbb{Z})^*` if :math:`p = 2`); for convenience, the character :math:`[s,s]` can also be\n          represented"" by the integer :math:`s`.\n        \n        When :math:`a_p` is a :math:`p`-adic unit, :math:`L_p` takes its values in :math:`\\mathbb{Q}_p`.\n        When :math:`a_p` is not a unit, it takes its values in the\n        two-dimensional :math:`\\mathbb{Q}_p`-vector space :math:`D_{cris}(M(\\phi))` where :math:`M(\\phi)` is\n        the \"motive\" attached to :math:`\\phi`, and we return the two :math:`p`-adic components\n        with respect to some fixed :math:`\\mathbb{Q}_p`-basis.\n        \n        ::\n        \n            ? M = msinit(3,6,1); phi=[5, -3, -1]~;\n            ? msissymbol(M,phi)\n            %2 = 1\n            ? Mp = mspadicinit(M, 5, 4);\n            ? mu = mspadicmoments(Mp, phi); \\\\ no twist\n            \\\\ End of initializations\n            \n            ? mspadicL(mu,0) \\\\ L_p(chi^0)\n            %5 = 5 + 2*5^2 + 2*5^3 + 2*5^4 + ...\n            ? mspadicL(mu,1) \\\\ L_p(chi), zero for parity reasons\n            %6 = [O(5^13)]~\n            ? mspadicL(mu,2) \\\\ L_p(chi^2)\n            %7 = 3 + 4*5 + 4*5^2 + 3*5^5 + ...\n            ? mspadicL(mu,[0,2]) \\\\ L_p(tau^2)\n            %8 = 3 + 5 + 2*5^2 + 2*5^3 + ...\n            ? mspadicL(mu, [1,0]) \\\\ L_p(<chi>)\n            %9 = 3*5 + 2*5^2 + 5^3 + 2*5^7 + 5^8 + 5^10 + 2*5^11 + O(5^13)\n            ? mspadicL(mu,0,1) \\\\ L_p'(chi^0)\n            %10 = 2*5 + 4*5^2 + 3*5^3 + ...\n            ? mspadicL(mu, 2, 1) \\\\ L_p'(chi^2)\n            %11 = 4*5 + 3*5^2 + 5^3 + 5^4 + ...\n        \n        Now several quadratic twists: :literal:`mstooms` is indicated.\n        \n        ::\n        \n            ? PHI = mstooms(Mp,phi);\n            ? mu = mspadicmoments(Mp, PHI, 12); \\\\ twist by 12\n            ? mspadicL(mu)\n            %14 = 5 + 5^2 + 5^3 + 2*5^4 + ...\n            ? mu = mspadicmoments(Mp, PHI, 8); \\\\ twist by 8\n            ? mspadicL(mu)\n            %16 = 2 + 3*5 + 3*5^2 + 2*5^4 + ...\n            ? mu = mspadicmoments(Mp, PHI, -3); \\\\ twist by -3 < 0\n        ""    ? mspadicL(mu)\n            %18 = O(5^13) \\\\ always 0, phi is in the + part and D < 0\n        \n        One can locate interesting symbols of level :math:`N` and weight :math:`k` with\n        :literal:`msnew` and :literal:`mssplit`. Note that instead of a symbol, one can\n        input a 1-dimensional Hecke-subspace from :literal:`mssplit`: the function will\n        automatically use the underlying basis vector.\n        \n        ::\n        \n            ? M=msinit(5,4,1); \\\\ M_4(Gamma_0(5))^+\n            ? L = mssplit(M, msnew(M)); \\\\ list of irreducible Hecke-subspaces\n            ? phi = L[1]; \\\\ one Galois orbit of newforms\n            ? #phi[1] \\\\... this one is rational\n            %4 = 1\n            ? Mp = mspadicinit(M, 3, 4);\n            ? mu = mspadicmoments(Mp, phi);\n            ? mspadicL(mu)\n            %7 = 1 + 3 + 3^3 + 3^4 + 2*3^5 + 3^6 + O(3^9)\n            \n            ? M = msinit(11,8, 1); \\\\ M_8(Gamma_0(11))^+\n            ? Mp = mspadicinit(M, 3, 4);\n            ? L = mssplit(M, msnew(M));\n            ? phi = L[1]; #phi[1] \\\\ ... this one is two-dimensional\n            %11 = 2\n            ? mu = mspadicmoments(Mp, phi);\n             *** at top-level: mu=mspadicmoments(Mp,ph\n             *** ^--------------------\n             *** mspadicmoments: incorrect type in mstooms [dim_Q (eigenspace) > 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1053mspadicL(PyObject *__pyx_v_mu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicL (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_r,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicL") < 0)) __PYX_ERR(10, 18507, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_r = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18507, __pyx_L3_error)
    } else {
      __pyx_v_r = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicL", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18507, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1052mspadicL(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mu), __pyx_v_s, __pyx_v_r);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1052mspadicL(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mu, PyObject *__pyx_v_s, long __pyx_v_r) {
  int __pyx_v__have_s;
  GEN __pyx_v__mu;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mspadicL", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_gen.pxi":18615
 *              *** mspadicmoments: incorrect type in mstooms [dim_Q (eigenspace) > 1]
 *         '''
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_1 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_1;

  /* "cypari/auto_gen.pxi":18616
 *         '''
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_s != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18617
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18617, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":18616
 *         '''
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":18618
 *         if _have_s:
 *             s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 18618, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18619
 *             s = objtogen(s)
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mu)->__pyx_base.g;
  __pyx_v__mu = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18620
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_gen.pxi":18621
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 */
  __pyx_t_1 = (__pyx_v__have_s != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18622
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_gen.pxi":18621
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 */
  }

  /* "cypari/auto_gen.pxi":18623
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicL(__pyx_v__mu, __pyx_v__s, __pyx_v_r);

  /* "cypari/auto_gen.pxi":18624
 *             _s = (<Gen>s).g
 *         cdef GEN _ret = mspadicL(_mu, _s, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicinit(M, long p, long n, long flag=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18507
 *         return new_gen(_ret)
 * 
 *     def mspadicL(mu, s=None, long r=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the value (or :math:`r`-th derivative)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicL", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18626
 *         return new_gen(_ret)
 * 
 *     def mspadicinit(M, long p, long n, long flag=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, and :math:`p`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1055mspadicinit(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1054mspadicinit[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`, and :math:`p`\n        a prime, initialize technical data needed to compute with overconvergent\n        modular symbols, modulo :math:`p^n`. If :math:`flag` is unset, allow\n        all symbols; else initialize only for a restricted range of symbols\n        depending on :math:`flag`: if :math:`flag = 0` restrict to ordinary symbols, else\n        restrict to symbols :math:`\\phi` such that :math:`T_p(\\phi) = a_p \\phi`,\n        with :math:`v_p(a_p) >= flag`, which is faster as :math:`flag` increases.\n        (The fastest initialization is obtained for :math:`flag = 0` where we only allow\n        ordinary symbols.) For supersingular eigensymbols, such that :math:`p \\| a_p`, we\n        must further assume that :math:`p` does not divide the level.\n        \n        ::\n        \n            ? E = ellinit(\"11a1\");\n            ? [M,phi] = msfromell(E,1);\n            ? ellap(E,3)\n            %3 = -1\n            ? Mp = mspadicinit(M, 3, 10, 0); \\\\ commit to ordinary symbols\n            ? PHI = mstooms(Mp,phi);\n        \n        If we restrict the range of allowed symbols with :emphasis:`flag` (for faster\n        initialization), exceptions will occur if :math:`v_p(a_p)` violates this bound:\n        \n        ::\n        \n            ? E = ellinit(\"15a1\");\n            ? [M,phi] = msfromell(E,1);\n            ? ellap(E,7)\n            %3 = 0\n            ? Mp = mspadicinit(M,7,5,0); \\\\ restrict to ordinary symbols\n            ? PHI = mstooms(Mp,phi)\n            *** at top-level: PHI=mstooms(Mp,phi)\n            *** ^---------------\n            *** mstooms: incorrect type in mstooms [v_p(ap) > mspadicinit flag] (t_VEC).\n            ? Mp = mspadicinit(M,7,5); \\\\ no restriction\n            ? PHI = mstooms(Mp,phi);\n        \n        This function uses :math:`O(N^2(n+k)^2p)` memory, where :math:`N` is the\n        level of :math:`M`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1055mspadicinit(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_p;
  long __pyx_v_n;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_n,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("mspadicinit", 0, 2, 3, 1); __PYX_ERR(10, 18626, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicinit") < 0)) __PYX_ERR(10, 18626, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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 = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18626, __pyx_L3_error)
    __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18626, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18626, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicinit", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18626, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1054mspadicinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_p, __pyx_v_n, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1054mspadicinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_p, long __pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mspadicinit", 0);

  /* "cypari/auto_gen.pxi":18668
 *         level of :math:`M`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18668, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18669
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18670
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicinit(__pyx_v__M, __pyx_v_p, __pyx_v_n, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":18671
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspadicinit(_M, p, n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicmoments(Mp, PHI, long D=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18626
 *         return new_gen(_ret)
 * 
 *     def mspadicinit(M, long p, long n, long flag=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`, and :math:`p`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18673
 *         return new_gen(_ret)
 * 
 *     def mspadicmoments(Mp, PHI, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, an overconvergent
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1057mspadicmoments(PyObject *__pyx_v_Mp, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1056mspadicmoments[] = "\n        Given :literal:`Mp` from :literal:`mspadicinit`, an overconvergent\n        eigensymbol :literal:`PHI` from :literal:`mstooms` and a fundamental discriminant\n        :math:`D` coprime to :math:`p`,\n        let :math:`PHI^D` denote the twisted symbol. This function computes\n        the distribution :math:`\\mu = PHI^D([0] - oo ]) \\| \\mathbb{Z}_p^*` restricted\n        to :math:`\\mathbb{Z}_p^*`. More precisely, it returns\n        the moments of the :math:`p-1` distributions :math:`PHI^D([0]-[ oo ])\n        | (a + p\\mathbb{Z}_p)`, :math:`0 < a < p`.\n        We also allow :literal:`PHI` to be given as a classical\n        symbol, which is then lifted to an overconvergent symbol by :literal:`mstooms`;\n        but this is wasteful if more than one twist is later needed.\n        \n        The returned data :math:`\\mu` (:math:`p`-adic distributions attached to :literal:`PHI`)\n        can then be used in :literal:`mspadicL` or :literal:`mspadicseries`.\n        This precomputation allows to quickly compute derivatives of different\n        orders or values at different characters.\n        \n        ::\n        \n            ? M = msinit(3,6, 1);\n            ? phi = [5,-3,-1]~;\n            ? msissymbol(M, phi)\n            %3 = 1\n            ? p = 5; mshecke(M,p) * phi \\\\ eigenvector of T_5, a_5 = 6\n            %4 = [30, -18, -6]~\n            ? Mp = mspadicinit(M, p, 10, 0); \\\\ restrict to ordinary symbols, mod p^10\n            ? PHI = mstooms(Mp, phi);\n            ? mu = mspadicmoments(Mp, PHI);\n            ? mspadicL(mu)\n            %8 = 5 + 2*5^2 + 2*5^3 + ...\n            ? mu = mspadicmoments(Mp, PHI, 12); \\\\ twist by 12\n            ? mspadicL(mu)\n            %10 = 5 + 5^2 + 5^3 + 2*5^4 + ...\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1057mspadicmoments(PyObject *__pyx_v_Mp, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_PHI = 0;
  long __pyx_v_D;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicmoments (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_PHI,&__pyx_n_s_D,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_PHI)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicmoments") < 0)) __PYX_ERR(10, 18673, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_PHI = values[0];
    if (values[1]) {
      __pyx_v_D = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_D == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18673, __pyx_L3_error)
    } else {
      __pyx_v_D = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicmoments", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18673, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicmoments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1056mspadicmoments(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Mp), __pyx_v_PHI, __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1056mspadicmoments(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Mp, PyObject *__pyx_v_PHI, long __pyx_v_D) {
  GEN __pyx_v__Mp;
  GEN __pyx_v__PHI;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspadicmoments", 0);
  __Pyx_INCREF(__pyx_v_PHI);

  /* "cypari/auto_gen.pxi":18709
 *             %10 = 5 + 5^2 + 5^3 + 2*5^4 + ...
 *         '''
 *         PHI = objtogen(PHI)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_PHI, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_PHI, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18710
 *         '''
 *         PHI = objtogen(PHI)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 18710, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18711
 *         PHI = objtogen(PHI)
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Mp)->__pyx_base.g;
  __pyx_v__Mp = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18712
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_PHI)->__pyx_base.g;
  __pyx_v__PHI = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18713
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicmoments(__pyx_v__Mp, __pyx_v__PHI, __pyx_v_D);

  /* "cypari/auto_gen.pxi":18714
 *         cdef GEN _PHI = (<Gen>PHI).g
 *         cdef GEN _ret = mspadicmoments(_Mp, _PHI, D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspadicseries(mu, long i=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18673
 *         return new_gen(_ret)
 * 
 *     def mspadicmoments(Mp, PHI, long D=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, an overconvergent
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicmoments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_PHI);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18716
 *         return new_gen(_ret)
 * 
 *     def mspadicseries(mu, long i=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1059mspadicseries(PyObject *__pyx_v_mu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1058mspadicseries[] = "\n        Let :math:`\\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol\n        attached to a modular symbol :math:`\\phi` for :math:`\\Gamma_0(N)` (eigenvector for\n        :math:`T_N(p)` for the eigenvalue :math:`a_p`).\n        If :math:`\\mu` is the distribution on :math:`\\mathbb{Z}_p^*` defined by the restriction of\n        :math:`\\Phi ([ oo ]-[0])` to :math:`\\mathbb{Z}_p^*`, let\n        \n        .. MATH::\n        \n            ^{L}_p(\\mu,\\tau^{i})(x)\n            = \\int_{\\mathbb{Z}_p^*} \\tau^i(t) (1+x)^{\\log_p(t)/\\log_p(u)}d\\mu (t)\n        \n        Here, :math:`\\tau` is the Teichm\303\274ller character and :math:`u` is a specific\n        multiplicative generator of :math:`1+2p\\mathbb{Z}_p`. (Namely :math:`1+p` if :math:`p > 2` or :math:`5`\n        if :math:`p = 2`.) To explain\n        the formula, let :math:`G_ oo := Gal(\\mathbb{Q} (\\mu_{p^{ oo }})/ \\mathbb{Q})`,\n        let :math:`\\chi:G_ oo \\to \\mathbb{Z}_p^*` be the cyclotomic character (isomorphism)\n        and :math:`\\gamma` the element of :math:`G_ oo` such that :math:`\\chi (\\gamma) = u`;\n        then\n        :math:`\\chi (\\gamma)^{\\log_p(t)/\\log_p(u)} = <\302\240t >`.\n        \n        The :math:`p`-padic precision of individual terms is maximal given the precision of\n        the overconvergent symbol :math:`\\mu`.\n        \n        ::\n        \n            ? [M,phi] = msfromell(ellinit(\"17a1\"),1);\n            ? Mp = mspadicinit(M, 5,7);\n            ? mu = mspadicmoments(Mp, phi,1); \\\\ overconvergent symbol\n            ? mspadicseries(mu)\n            %4 = (4 + 3*5 + 4*5^2 + 2*5^3 + 2*5^4 + 5^5 + 4*5^6 + 3*5^7 + O(5^9)) \\\n             + (3 + 3*5 + 5^2 + 5^3 + 2*5^4 + 5^6 + O(5^7))*x \\\n             + (2 + 3*5 + 5^2 + 4*5^3 + 2*5^4 + O(5^5))*x^2 \\\n             + (3 + 4*5 + 4*5^2 + O(5^3))*x^3 \\\n             + (3 + O(5))*x^4 + O(x^5)\n        \n        An example with non-zero Teichm\303\274ller:\n        \n        ::\n        ""\n            ? [M,phi] = msfromell(ellinit(\"11a1\"),1);\n            ? Mp = mspadicinit(M, 3,10);\n            ? mu = mspadicmoments(Mp, phi,1);\n            ? mspadicseries(mu, 2)\n            %4 = (2 + 3 + 3^2 + 2*3^3 + 2*3^5 + 3^6 + 3^7 + 3^10 + 3^11 + O(3^12)) \\\n             + (1 + 3 + 2*3^2 + 3^3 + 3^5 + 2*3^6 + 2*3^8 + O(3^9))*x \\\n             + (1 + 2*3 + 3^4 + 2*3^5 + O(3^6))*x^2 \\\n             + (3 + O(3^2))*x^3 + O(x^4)\n        \n        Supersingular example (not checked)\n        \n        ::\n        \n            ? E = ellinit(\"17a1\"); ellap(E,3)\n            %1 = 0\n            ? [M,phi] = msfromell(E,1);\n            ? Mp = mspadicinit(M, 3,7);\n            ? mu = mspadicmoments(Mp, phi,1);\n            ? mspadicseries(mu)\n            %5 = [(2*3^-1 + 1 + 3 + 3^2 + 3^3 + 3^4 + 3^5 + 3^6 + O(3^7)) \\\n             + (2 + 3^3 + O(3^5))*x \\\n             + (1 + 2*3 + O(3^2))*x^2 + O(x^3),\\\n             (3^-1 + 1 + 3 + 3^2 + 3^3 + 3^4 + 3^5 + 3^6 + O(3^7)) \\\n             + (1 + 2*3 + 2*3^2 + 3^3 + 2*3^4 + O(3^5))*x \\\n             + (3^-2 + 3^-1 + O(3^2))*x^2 + O(3^-2)*x^3 + O(x^4)]\n        \n        Example with a twist:\n        \n        ::\n        \n            ? E = ellinit(\"11a1\");\n            ? [M,phi] = msfromell(E,1);\n            ? Mp = mspadicinit(M, 3,10);\n            ? mu = mspadicmoments(Mp, phi,5); \\\\ twist by 5\n            ? L = mspadicseries(mu)\n            %5 = (2*3^2 + 2*3^4 + 3^5 + 3^6 + 2*3^7 + 2*3^10 + O(3^12)) \\\n             + (2*3^2 + 2*3^6 + 3^7 + 3^8 + O(3^9))*x \\\n             + (3^3 + O(3^6))*x^2 + O(3^2)*x^3 + O(x^4)\n            ? mspadicL(mu)\n            %6 = [2*3^2 + 2*3^4 + 3^5 + 3^6 + 2*3^7 + 2*3^10 + O(3^12)]~\n            ? ellpadicL(E,3,10,,5)\n            %7 = 2 + 2*3^2 + 3^3 + 2*3^4 + 2*3^5 + 3^6 + 2*3^7 + O(3^10)\n            ? mspadicseries(mu,1) \\\\ must be 0\n            %8 = O(3^12) + O(3^9)*x + O(3^6)*x^2 + O(3^2)*x^3 + O(x^4)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1059mspadicseries(PyObject *__pyx_v_mu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_i;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspadicseries (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_i,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspadicseries") < 0)) __PYX_ERR(10, 18716, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_i = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_i == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18716, __pyx_L3_error)
    } else {
      __pyx_v_i = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspadicseries", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18716, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1058mspadicseries(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_mu), __pyx_v_i);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1058mspadicseries(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_mu, long __pyx_v_i) {
  GEN __pyx_v__mu;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mspadicseries", 0);

  /* "cypari/auto_gen.pxi":18802
 *             %8 = O(3^12) + O(3^9)*x + O(3^6)*x^2 + O(3^2)*x^3 + O(x^4)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _ret = mspadicseries(_mu, i)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18802, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18803
 *         '''
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspadicseries(_mu, i)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_mu)->__pyx_base.g;
  __pyx_v__mu = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18804
 *         sig_on()
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _ret = mspadicseries(_mu, i)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspadicseries(__pyx_v__mu, __pyx_v_i);

  /* "cypari/auto_gen.pxi":18805
 *         cdef GEN _mu = (<Gen>mu).g
 *         cdef GEN _ret = mspadicseries(_mu, i)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspathgens(M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18716
 *         return new_gen(_ret)
 * 
 *     def mspadicseries(mu, long i=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Phi` be the :math:`p`-adic distribution-valued overconvergent symbol
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspadicseries", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18807
 *         return new_gen(_ret)
 * 
 *     def mspathgens(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1061mspathgens(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1060mspathgens[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1(\\mathbb{Q}))`.\n        Let :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return a set of :math:`\\mathbb{Z}[G]`-generators for :math:`\\Delta`. The output\n        is :math:`[g,R]`, where :math:`g` is a minimal system of generators and :math:`R`\n        the vector of :math:`\\mathbb{Z}[G]`-relations between the given generators. A\n        relation is coded by a vector of pairs :math:`[a_i,i]` with :math:`a_i\\in \\mathbb{Z}[G]`\n        and :math:`i` the index of a generator, so that :math:`\\sum_i a_i g[i] = 0`.\n        \n        An element :math:`[v]-[u]` in :math:`\\Delta` is coded by the \"path\" :math:`[u,v]`,\n        where :literal:`oo` denotes the point at infinity :math:`(1:0)` on the projective\n        line.\n        An element of :math:`\\mathbb{Z}[G]` is either an integer :math:`n` (:math:`= n [id_2]`) or a\n        \"factorization matrix\": the first column contains distinct elements :math:`g_i`\n        of :math:`G` and the second integers :math:`n_i` and the matrix codes :math:`\\sum n_i [g_i]`:\n        \n        ::\n        \n            ? M = msinit(11,8); \\\\ M_8(Gamma_0(11))\n            ? [g,R] = mspathgens(M);\n            ? g\n            %3 = [[+oo, 0], [0, 1/3], [1/3, 1/2]] \\\\ 3 paths\n            ? #R \\\\ a single relation\n            %4 = 1\n            ? r = R[1]; #r \\\\ ...involving all 3 generators\n            %5 = 3\n            ? r[1]\n            %6 = [[1, 1; [1, 1; 0, 1], -1], 1]\n            ? r[2]\n            %7 = [[1, 1; [7, -2; 11, -3], -1], 2]\n            ? r[3]\n            %8 = [[1, 1; [8, -3; 11, -4], -1], 3]\n        \n        The given relation is of the form :math:`\\sum_i (1-\\gamma_i) g_i = 0`, with\n        :math:`\\gamma_i\\in \\Gamma_0(11)`. There will always be a single relation involving\n        all generators (corresponding to a round trip along all cusps), then\n        relations involving a single generator"" (corresponding to :math:`2` and :math:`3`-torsion\n        elements in the group:\n        \n        ::\n        \n            ? M = msinit(2,8); \\\\ M_8(Gamma_0(2))\n            ? [g,R] = mspathgens(M);\n            ? g\n            %3 = [[+oo, 0], [0, 1]]\n        \n        Note that the output depends only on the group :math:`G`, not on the\n        representation :math:`V`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1061mspathgens(PyObject *__pyx_v_M, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspathgens (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1060mspathgens(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1060mspathgens(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mspathgens", 0);

  /* "cypari/auto_gen.pxi":18857
 *         representation :math:`V`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspathgens(_M)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 18857, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18858
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspathgens(_M)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":18859
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspathgens(_M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspathgens(__pyx_v__M);

  /* "cypari/auto_gen.pxi":18860
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspathgens(_M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspathlog(M, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 18860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18807
 *         return new_gen(_ret)
 * 
 *     def mspathgens(M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspathgens", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18862
 *         return new_gen(_ret)
 * 
 *     def mspathlog(M, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1063mspathlog(PyObject *__pyx_v_M, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1062mspathlog[] = "\n        Let :math:`\\Delta := Div^0(\\mathbb{P}^1(\\mathbb{Q}))`.\n        Let :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        encoding fixed :math:`\\mathbb{Z}[G]`-generators :math:`(g_i)` of :math:`\\Delta` (see :literal:`mspathgens`).\n        A path :math:`p = [a,b]` between two elements in :math:`\\mathbb{P}^1(\\mathbb{Q})` corresponds to\n        :math:`[b]-[a]\\in \\Delta`. The path extremities :math:`a` and :math:`b` may be given as\n        :literal:`t_INT`, :literal:`t_FRAC` or :math:`oo = (1:0)`. Finally, we also allow\n        to input a path as a :math:`2 x 2` integer matrix, whose first\n        and second column give :math:`a` and :math:`b` respectively, with the convention\n        :math:`[x,y]~ = (x:y)` in :math:`\\mathbb{P}^1(\\mathbb{Q})`.\n        \n        Returns :math:`(p_i)` in :math:`\\mathbb{Z}[G]` such that :math:`p = \\sum_i p_i g_i`.\n        \n        ::\n        \n            ? M = msinit(2,8); \\\\ M_8(Gamma_0(2))\n            ? [g,R] = mspathgens(M);\n            ? g\n            %3 = [[+oo, 0], [0, 1]]\n            ? p = mspathlog(M, [1/2,2/3]);\n            ? p[1]\n            %5 =\n            [[1, 0; 2, 1] 1]\n            \n            ? p[2]\n            %6 =\n            [[1, 0; 0, 1] 1]\n            \n            [[3, -1; 4, -1] 1]\n            ? mspathlog(M, [1,2;2,3]) == p \\\\ give path via a 2x2 matrix\n            %7 = 1\n        \n        Note that the output depends only on the group :math:`G`, not on the\n        representation :math:`V`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1063mspathlog(PyObject *__pyx_v_M, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspathlog (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1062mspathlog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1062mspathlog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_p) {
  GEN __pyx_v__M;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mspathlog", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":18898
 *         representation :math:`V`.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":18899
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 18899, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18900
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = mspathlog(_M, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18901
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspathlog(_M, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":18902
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = mspathlog(_M, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspathlog(__pyx_v__M, __pyx_v__p);

  /* "cypari/auto_gen.pxi":18903
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = mspathlog(_M, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspetersson(M, F=None, G=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 18903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18862
 *         return new_gen(_ret)
 * 
 *     def mspathlog(M, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`\Delta := Div^0(\mathbb{P}^1(\mathbb{Q}))`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspathlog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18905
 *         return new_gen(_ret)
 * 
 *     def mspetersson(M, F=None, G=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space for :math:`\Gamma = \Gamma_0(N)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1065mspetersson(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1064mspetersson[] = "\n        :math:`M` being a full modular symbol space for :math:`\\Gamma = \\Gamma_0(N)`,\n        as given by :literal:`msinit`,\n        calculate the intersection product :math:`{F, G}` of modular symbols :math:`F` and :math:`G`\n        on :math:`M = \\text{Hom}_{\\Gamma}(\\Delta, V_k)` extended to an hermitian bilinear\n        form on :math:`M \\otimes \\mathbb{C}` whose radical is the Eisenstein subspace of :math:`M`.\n        \n        Suppose that :math:`f_1` and :math:`f_2` are two parabolic forms. Let :math:`F_1`\n        and :math:`F_2` be the attached modular symbols\n        \n        .. MATH::\n        \n            F_i(\\delta) = \\int_{\\delta} f_i(z).(z X + Y)^{k-2} dz\n        \n        and let :math:`F^{\\mathbb{R}}_1`, :math:`F^{\\mathbb{R}}_2` be the attached real modular symbols\n        \n        .. MATH::\n        \n            F^{\\mathbb{R}}_i(\\delta) = \\int_{\\delta}\n            \\Re (f_i(z).(z X + Y)^{k-2} dz)\n        \n        Then we have\n        \n        .. MATH::\n        \n            \\{ F^{\\mathbb{R}}_1, F^{\\mathbb{R}}_2 } = -2 (2i)^{k-2}.\n            \\Im ( < f_1,f_2 > _{Petersson})\n        \n        and\n        \n        .. MATH::\n        \n            { F_1, \\bar{F_2} } = (2i)^{k-2} < f_1,f_2 > _{Petersson}\n        \n        In weight 2, the intersection product :math:`{F, G}` has integer values on the\n        :math:`\\mathbb{Z}`-structure on :math:`M` given by :literal:`mslattice` and defines a Riemann form on\n        :math:`H^1_{par}(\\Gamma,\\mathbb{R})`.\n        \n        For user convenience, we allow :math:`F` and :math:`G` to be matrices and return the\n        attached Gram matrix. If :math:`F` is omitted: treat it as the full modular space\n        attached to :math:`M`; if :math:`G` is omitted, take it equal to :math:`F`.\n        \n        ::\n        \n            ? M = msinit(37,2);\n            ? C = mscuspidal(M)[1];\n            ? mspetersson(M, C)\n            %3 =\n            [ 0 -17 -8 -17]""\n            [17 0 -8 -25]\n            [ 8 8 0 -17]\n            [17 25 17 0]\n            ? mspetersson(M, mslattice(M,C))\n            %4 =\n            [0 -1 0 -1]\n            [1 0 0 -1]\n            [0 0 0 -1]\n            [1 1 1 0]\n            ? E = ellinit(\"33a1\");\n            ? [M,xpm] = msfromell(E); [xp,xm,L] = xpm;\n            ? mspetersson(M, mslattice(M,L))\n            %7 =\n            [0 -3]\n            [3 0]\n            ? ellmoddegree(E)\n            %8 = [3, -126]\n        \n        The coefficient :math:`3` in the matrix is the degree of the\n        modular parametrization.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1065mspetersson(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_F = 0;
  PyObject *__pyx_v_G = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspetersson (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_F,&__pyx_n_s_G,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_F);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_G);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspetersson") < 0)) __PYX_ERR(10, 18905, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_F = values[0];
    __pyx_v_G = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspetersson", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18905, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1064mspetersson(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_F, __pyx_v_G);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1064mspetersson(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_F, PyObject *__pyx_v_G) {
  int __pyx_v__have_F;
  int __pyx_v__have_G;
  GEN __pyx_v__M;
  GEN __pyx_v__F;
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mspetersson", 0);
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_INCREF(__pyx_v_G);

  /* "cypari/auto_gen.pxi":18976
 *         modular parametrization.
 *         '''
 *         cdef bint _have_F = (F is not None)             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             F = objtogen(F)
 */
  __pyx_t_1 = (__pyx_v_F != Py_None);
  __pyx_v__have_F = __pyx_t_1;

  /* "cypari/auto_gen.pxi":18977
 *         '''
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 */
  __pyx_t_1 = (__pyx_v__have_F != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18978
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:
 *             F = objtogen(F)             # <<<<<<<<<<<<<<
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_F, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18978, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_F, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":18977
 *         '''
 *         cdef bint _have_F = (F is not None)
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 */
  }

  /* "cypari/auto_gen.pxi":18979
 *         if _have_F:
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)             # <<<<<<<<<<<<<<
 *         if _have_G:
 *             G = objtogen(G)
 */
  __pyx_t_1 = (__pyx_v_G != Py_None);
  __pyx_v__have_G = __pyx_t_1;

  /* "cypari/auto_gen.pxi":18980
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             G = objtogen(G)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_G != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18981
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:
 *             G = objtogen(G)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_G, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18981, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_G, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":18980
 *             F = objtogen(F)
 *         cdef bint _have_G = (G is not None)
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             G = objtogen(G)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":18982
 *         if _have_G:
 *             G = objtogen(G)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 18982, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":18983
 *             G = objtogen(G)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _F = NULL
 *         if _have_F:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":18984
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL             # <<<<<<<<<<<<<<
 *         if _have_F:
 *             _F = (<Gen>F).g
 */
  __pyx_v__F = NULL;

  /* "cypari/auto_gen.pxi":18985
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 */
  __pyx_t_1 = (__pyx_v__have_F != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18986
 *         cdef GEN _F = NULL
 *         if _have_F:
 *             _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _G = NULL
 *         if _have_G:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
    __pyx_v__F = __pyx_t_4;

    /* "cypari/auto_gen.pxi":18985
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _F = NULL
 *         if _have_F:             # <<<<<<<<<<<<<<
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 */
  }

  /* "cypari/auto_gen.pxi":18987
 *         if _have_F:
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL             # <<<<<<<<<<<<<<
 *         if _have_G:
 *             _G = (<Gen>G).g
 */
  __pyx_v__G = NULL;

  /* "cypari/auto_gen.pxi":18988
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 */
  __pyx_t_1 = (__pyx_v__have_G != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":18989
 *         cdef GEN _G = NULL
 *         if _have_G:
 *             _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
    __pyx_v__G = __pyx_t_4;

    /* "cypari/auto_gen.pxi":18988
 *             _F = (<Gen>F).g
 *         cdef GEN _G = NULL
 *         if _have_G:             # <<<<<<<<<<<<<<
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 */
  }

  /* "cypari/auto_gen.pxi":18990
 *         if _have_G:
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspetersson(__pyx_v__M, __pyx_v__F, __pyx_v__G);

  /* "cypari/auto_gen.pxi":18991
 *             _G = (<Gen>G).g
 *         cdef GEN _ret = mspetersson(_M, _F, _G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mspolygon(M, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 18991, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18905
 *         return new_gen(_ret)
 * 
 *     def mspetersson(M, F=None, G=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space for :math:`\Gamma = \Gamma_0(N)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspetersson", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_G);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":18993
 *         return new_gen(_ret)
 * 
 *     def mspolygon(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an integer :math:`N > 1`, return an hyperbolic polygon (Farey symbol)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1067mspolygon(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1066mspolygon[] = "\n        Given an integer :math:`N > 1`, return an hyperbolic polygon (Farey symbol)\n        attached to the group :math:`\\Gamma_0(N)`. More precisely,\n        \n        - its vertices are an ordered list in :math:`\\mathbb{P}^{1}(\\mathbb{Q})`, forming a system of\n          representatives of cusps,\n        \n        - its edges are hyperbolic arcs joining two consecutive vertices,\n        \n        - given a path :math:`(a,b)` between two elements of :math:`\\mathbb{P}^{1}(\\mathbb{Q})`, let\n          :math:`\\overline{(a,b)} = (b,a)` be the opposite path. There is an involution :math:`e\n          \\to e^*` on the edges, where :math:`e^*` is :math:`\\Gamma_0(N)` equivalent to\n          :math:`\\overline{e}`, i.e. there exist :math:`\\gamma_e \\in \\Gamma_0(N)` such that :math:`e =\n          \\gamma_e \\overline{e^*}`.\n        \n        The polygon is given by\n        \n        - the list :math:`E` of its consecutive edges as matrices in :math:`M_2(\\mathbb{Z})`;\n        \n        - the permutation :math:`A` attached to the involution, such that\n          :literal:`A[i]` is the index of :math:`e^*` in :math:`E` if :math:`e = E[i]` is the :math:`i`-th edge;\n        \n        - the list :math:`G` of pairing matrices between :math:`e` and\n          :math:`\\overline{e^*}`, i.e. the matrices :math:`\\gamma_e\\in \\Gamma_0(N)` such that :math:`e =\n          \\gamma_e \\overline{e^*}`. If :math:`e = E[i]`, then :math:`\\gamma_e = G[i]`.\n          Remark that :math:`\\gamma_{e^*} = \\gamma_e^{-1}` if :math:`e != e^*`; modulo these\n          trivial relations, the pairing matrices form a system of independant\n          generators of :math:`\\Gamma_0(N)/{1,-1}`. Note that :math:`\\gamma_e` is elliptic if and only if\n          :math:`e^ *= e`.\n        \n        The above data yields a fundamental domain for :math:`\\Gamma_0(N)` acting\n        on Poincar\303\251's half-plane: take the convex hull of the polygon defined by\n        \n        - the edges"" in :math:`E` such that :math:`e != e^*` or :math:`e^ *= e`, where the pairing\n          matrix :math:`\\gamma_e` has order :math:`2`;\n        \n        - the edges :math:`(r,t)` and :math:`(t,s)` where the edge :math:`e = (r,s) \\in E` is such\n          that :math:`e = e^*` and :math:`\\gamma_e` has order :math:`3` and the triangle :math:`(r,t,s)`\n          is the image of :math:`(0,\\exp (2i\\pi/3), oo )` by some element of :math:`PSL_2(\\mathbb{Q})`\n          formed around the edge.\n        \n        Binary digits of flag mean:\n        \n        1: return a normalized hyperbolic polygon if set, else a polygon with\n        unimodular edges (matrices of determinant :math:`1`). A polygon is normalized\n        in the sense of compact orientable surfaces if the distance :math:`d(a,a^*)` between\n        an edge :math:`a` and its image by the involution :math:`a^*` is less than 2, with\n        equality if and only if :math:`a` is :emphasis:`linked` with another edge :math:`b`\n        (:math:`a`, :math:`b`, :math:`a^*` et :math:`b^*` appear consecutively in :math:`E` up to cyclic\n        permutation). In particular, the vertices of all edges such that that\n        :math:`d(a,a^*) != 1` (distance is 0 or 2) are all equivalent to :math:`0` modulo\n        :math:`\\Gamma_0(N)`. The external vertices of :math:`a a^*` such that :math:`d(a,a^*) = 1` are\n        also equivalent to :math:`0`; the internal vertices :math:`a\\cap a^*` (a single point),\n        together with :math:`0`, form a system of representatives of the cusps of\n        :math:`\\Gamma_0(N)\\\\mathbb{P}^{1}(\\mathbb{Q})`. This is useful to compute the homology group\n        :math:`H_1(X_0(N),\\mathbb{Z})` as it gives a symplectic basis for the intersection pairing.\n        In this case, the number of parabolic matrices (trace 2) in the system of\n        generators :math:`G` is :math:`2(t-1)`, where :math:`t` is the number of non equivalent cusps\n        for :math:`\\Gamma_0(N)`.\n        ""\n        2: add graphical representations (in LaTeX form) for the hyperbolic polygon\n        in Poincar\303\251's half-space and the involution :math:`a\\to a^*` of the Farey symbol.\n        The corresponding character strings can be written to file and included in a\n        LaTeX document provided the preamble contains\n        :literal:`\\\\usepackage{ tikz}`.\n        \n        ::\n        \n            ? [V,A,G] = mspolygon(3);\n            ? V\n            %2 = [[-1, 1; -1, 0], [1, 0; 0, 1], [0, 1; -1, 1]]\n            ? A\n            %3 = Vecsmall([2, 1, 3])\n            ? G\n            %4 = [[-1, -1; 0, -1], [1, -1; 0, 1], [1, -1; 3, -2]]\n            ? [V,A,G, D1,D2] = mspolygon(11,2); \\\\ D1 and D2 contains pictures\n            ? {write(\"F.tex\",\n             \"\\\\documentclass{article}\\\\usepackage{tikz}\\\\begin{document}\"\n             D1, \"\\n\",\n             D2,\n             \"\\\\end{document}\");}\n            \n            ? [V1,A1] = mspolygon(6,1); \\\\ normalized\n            ? V1\n            %8 = [[-1, 1; -1, 0], [1, 0; 0, 1], [0, 1; -1, 3],\n             [1, -2; 3, -5], [-2, 1; -5, 2], [1, -1; 2, -1]]\n            ? A1\n            %9 = Vecsmall([2, 1, 4, 3, 6, 5])\n            \n            ? [V0,A0] = mspolygon(6); \\\\ not normalized V[3]^* = V[6], d(V[3],V[6]) = 3\n            ? A0\n            %11 = Vecsmall([2, 1, 6, 5, 4, 3])\n            \n            ? [V,A] = mspolygon(14, 1);\n            ? A\n            %13 = Vecsmall([2, 1, 4, 3, 6, 5, 9, 10, 7, 8])\n        \n        One can see from this last example that the (normalized) polygon has the form\n        \n        .. MATH::\n        \n            (a_1, a_1^*, a_2, a_2^*, a_3, a_3^*, a_4, a_5, a_4^*, a_5^*),\n        \n        that :math:`X_0(14)` is of genus 1 (in general the genus is the number of blocks\n        of the form :math:`aba^*b^*`), has no elliptic points (:math:`A` has no fixed point)\n        and 4 cusps (number of blocks of the form :math:`aa^*` plus"" 1). The vertices\n        of edges :math:`a_4` and :math:`a_5` all project to :math:`0` in :math:`X_0(14)`: the paths :math:`a_4`\n        and :math:`a_5` project as loops in :math:`X_0(14)` and give a symplectic basis of the\n        homology :math:`H_1(X_0(14),\\mathbb{Z})`.\n        \n        ::\n        \n            ? [V,A] = mspolygon(15);\n            ? apply(matdet, V) \\\\ all unimodular\n            %2 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]\n            ? [V,A] = mspolygon(15,1);\n            ? apply(matdet, V) \\\\ normalized polygon but no longer unimodular edges\n            %4 = [1, 1, 1, 1, 2, 2, 47, 11, 47, 11]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1067mspolygon(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mspolygon (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mspolygon") < 0)) __PYX_ERR(10, 18993, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 18993, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mspolygon", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 18993, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspolygon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1066mspolygon(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1066mspolygon(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, long __pyx_v_flag) {
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("mspolygon", 0);

  /* "cypari/auto_gen.pxi":19113
 *             %4 = [1, 1, 1, 1, 2, 2, 47, 11, 47, 11]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspolygon(_M, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 19113, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19114
 *         '''
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mspolygon(_M, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_2;

  /* "cypari/auto_gen.pxi":19115
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspolygon(_M, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mspolygon(__pyx_v__M, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":19116
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = mspolygon(_M, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msqexpansion(M, projH, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 19116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":18993
 *         return new_gen(_ret)
 * 
 *     def mspolygon(M, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an integer :math:`N > 1`, return an hyperbolic polygon (Farey symbol)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mspolygon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19118
 *         return new_gen(_ret)
 * 
 *     def msqexpansion(M, projH, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1069msqexpansion(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1068msqexpansion[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        and :emphasis:`projH` being a projector on a Hecke-simple subspace (as given\n        by :literal:`mssplit`), return the Fourier coefficients :math:`a_n`, :math:`n <= B` of the\n        corresponding normalized newform. If :math:`B` is omitted, use\n        :literal:`seriesprecision`.\n        \n        This function uses a naive :math:`O(B^2 d^3)`\n        algorithm, where :math:`d = O(kN)` is the dimension of :math:`M_k(\\Gamma_0(N))`.\n        \n        ::\n        \n            ? M = msinit(11,2, 1); \\\\ M_2(Gamma_0(11))^+\n            ? L = mssplit(M, msnew(M));\n            ? msqexpansion(M,L[1], 20)\n            %3 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1, -4, -2, 4, 0, 2]\n            ? ellan(ellinit(\"11a1\"), 20)\n            %4 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1, -4, -2, 4, 0, 2]\n        \n        The shortcut :literal:`msqexpansion(M, s, B)` is available for\n        a symbol :math:`s`, provided it is a Hecke eigenvector:\n        \n        ::\n        \n            ? E = ellinit(\"11a1\");\n            ? [M,S] = msfromell(E); [sp,sm] = S;\n            ? msqexpansion(M,sp,10) \\\\ in the + eigenspace\n            %3 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n            ? msqexpansion(M,sm,10) \\\\ in the - eigenspace\n            %4 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n            ? ellan(E, 10)\n            %5 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1069msqexpansion(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_projH = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msqexpansion (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_projH,&__pyx_n_s_serprec,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_projH)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msqexpansion") < 0)) __PYX_ERR(10, 19118, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_projH = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 19118, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msqexpansion", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19118, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.msqexpansion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1068msqexpansion(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_projH, __pyx_v_serprec);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1068msqexpansion(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_projH, long __pyx_v_serprec) {
  GEN __pyx_v__M;
  GEN __pyx_v__projH;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("msqexpansion", 0);
  __Pyx_INCREF(__pyx_v_projH);

  /* "cypari/auto_gen.pxi":19152
 *             %5 = [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]
 *         '''
 *         projH = objtogen(projH)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_projH, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_projH, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19153
 *         '''
 *         projH = objtogen(projH)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19153, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19154
 *         projH = objtogen(projH)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19155
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_projH)->__pyx_base.g;
  __pyx_v__projH = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19156
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 */
  __pyx_t_4 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":19157
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":19156
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _projH = (<Gen>projH).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 */
  }

  /* "cypari/auto_gen.pxi":19158
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msqexpansion(__pyx_v__M, __pyx_v__projH, __pyx_v_serprec);

  /* "cypari/auto_gen.pxi":19159
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = msqexpansion(_M, _projH, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mssplit(M, H=None, long dimlim=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19118
 *         return new_gen(_ret)
 * 
 *     def msqexpansion(M, projH, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msqexpansion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_projH);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19161
 *         return new_gen(_ret)
 * 
 *     def mssplit(M, H=None, long dimlim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` denote a full modular symbol space, as given by :literal:`msinit`:math:`(N,k,1)`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1071mssplit(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1070mssplit[] = "\n        Let :math:`M` denote a full modular symbol space, as given by :literal:`msinit`:math:`(N,k,1)`\n        or :math:`msinit (N,k,-1)` and let :math:`H` be a Hecke-stable subspace of\n        :literal:`msnew`:math:`(M)` (the full new subspace if :math:`H` is omitted). This function\n        splits :math:`H` into Hecke-simple subspaces. If :literal:`dimlim` is present and\n        positive, restrict to subspaces of dimension :math:`<= dimlim`. A subspace\n        is given by a structure allowing quick projection and restriction of linear\n        operators; its first component is a matrix with integer coefficients whose\n        columns form a :math:`\\mathbb{Q}`-basis of the subspace.\n        \n        ::\n        \n            ? M = msinit(11,8, 1); \\\\ M_8(Gamma_0(11))^+\n            ? L = mssplit(M); \\\\ split msnew(M)\n            ? #L\n            %3 = 2\n            ? f = msqexpansion(M,L[1],5); f[1].mod\n            %4 = x^2 + 8*x - 44\n            ? lift(f)\n            %5 = [1, x, -6*x - 27, -8*x - 84, 20*x - 155]\n            ? g = msqexpansion(M,L[2],5); g[1].mod\n            %6 = x^4 - 558*x^2 + 140*x + 51744\n        \n        To a Hecke-simple subspace corresponds an orbit of\n        (normalized) newforms, defined over a number field. In the above example,\n        we printed the polynomials defining the said fields, as well as the first\n        5 Fourier coefficients (at the infinite cusp) of one such form.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1071mssplit(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_H = 0;
  long __pyx_v_dimlim;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mssplit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_H,&__pyx_n_s_dimlim,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dimlim);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mssplit") < 0)) __PYX_ERR(10, 19161, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_H = values[0];
    if (values[1]) {
      __pyx_v_dimlim = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_dimlim == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 19161, __pyx_L3_error)
    } else {
      __pyx_v_dimlim = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("mssplit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.mssplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1070mssplit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_H, __pyx_v_dimlim);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1070mssplit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_H, long __pyx_v_dimlim) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("mssplit", 0);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":19190
 *         5 Fourier coefficients (at the infinite cusp) of one such form.
 *         '''
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_1 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_1;

  /* "cypari/auto_gen.pxi":19191
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":19192
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":19191
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":19193
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19193, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19194
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19195
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":19196
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":19197
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_gen.pxi":19196
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 */
  }

  /* "cypari/auto_gen.pxi":19198
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mssplit(__pyx_v__M, __pyx_v__H, __pyx_v_dimlim);

  /* "cypari/auto_gen.pxi":19199
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = mssplit(_M, _H, dimlim)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def msstar(M, H=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19161
 *         return new_gen(_ret)
 * 
 *     def mssplit(M, H=None, long dimlim=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`M` denote a full modular symbol space, as given by :literal:`msinit`:math:`(N,k,1)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mssplit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19201
 *         return new_gen(_ret)
 * 
 *     def msstar(M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1073msstar(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1072msstar[] = "\n        :math:`M` being a full modular symbol space, as given by :literal:`msinit`,\n        return the matrix of the :literal:`*` involution, induced by complex conjugation,\n        acting on the (stable) subspace :math:`H` (:math:`M` if omitted).\n        \n        ::\n        \n            ? M = msinit(11,2); \\\\ M_2(Gamma_0(11))\n            ? w = msstar(M);\n            ? w^2 == 1\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1073msstar(PyObject *__pyx_v_M, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("msstar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_H,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_H);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "msstar") < 0)) __PYX_ERR(10, 19201, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_H = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("msstar", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19201, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.msstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1072msstar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_M), __pyx_v_H);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1072msstar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_M, PyObject *__pyx_v_H) {
  int __pyx_v__have_H;
  GEN __pyx_v__M;
  GEN __pyx_v__H;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("msstar", 0);
  __Pyx_INCREF(__pyx_v_H);

  /* "cypari/auto_gen.pxi":19214
 *             %3 = 1
 *         '''
 *         cdef bint _have_H = (H is not None)             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             H = objtogen(H)
 */
  __pyx_t_1 = (__pyx_v_H != Py_None);
  __pyx_v__have_H = __pyx_t_1;

  /* "cypari/auto_gen.pxi":19215
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":19216
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:
 *             H = objtogen(H)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":19215
 *         '''
 *         cdef bint _have_H = (H is not None)
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             H = objtogen(H)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":19217
 *         if _have_H:
 *             H = objtogen(H)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19217, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19218
 *             H = objtogen(H)
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = NULL
 *         if _have_H:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19219
 *         sig_on()
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL             # <<<<<<<<<<<<<<
 *         if _have_H:
 *             _H = (<Gen>H).g
 */
  __pyx_v__H = NULL;

  /* "cypari/auto_gen.pxi":19220
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)
 */
  __pyx_t_1 = (__pyx_v__have_H != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":19221
 *         cdef GEN _H = NULL
 *         if _have_H:
 *             _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = msstar(_M, _H)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
    __pyx_v__H = __pyx_t_4;

    /* "cypari/auto_gen.pxi":19220
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _H = NULL
 *         if _have_H:             # <<<<<<<<<<<<<<
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)
 */
  }

  /* "cypari/auto_gen.pxi":19222
 *         if _have_H:
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = msstar(__pyx_v__M, __pyx_v__H);

  /* "cypari/auto_gen.pxi":19223
 *             _H = (<Gen>H).g
 *         cdef GEN _ret = msstar(_M, _H)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def mstooms(Mp, phi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19201
 *         return new_gen(_ret)
 * 
 *     def msstar(M, H=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`M` being a full modular symbol space, as given by :literal:`msinit`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.msstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19225
 *         return new_gen(_ret)
 * 
 *     def mstooms(Mp, phi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, lift the (classical) eigen symbol
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1075mstooms(PyObject *__pyx_v_Mp, PyObject *__pyx_v_phi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1074mstooms[] = "\n        Given :literal:`Mp` from :literal:`mspadicinit`, lift the (classical) eigen symbol\n        :literal:`phi` to a :math:`p`-adic distribution-valued overconvergent symbol in the\n        sense of Pollack and Stevens. More precisely, let :math:`\\phi` belong to the space\n        :math:`W` of modular symbols of level :math:`N`, :math:`v_p(N) <= 1`, and weight :math:`k` which is\n        an eigenvector for the Hecke operator :math:`T_N(p)` for a non-zero eigenvalue\n        :math:`a_p` and let :math:`N_0 = lcm(N,p)`.\n        \n        Under the action of :math:`T_{N_0}(p)`, :math:`\\phi` generates a subspace :math:`W_\\phi` of\n        dimension :math:`1` (if :math:`p \\| N`) or :math:`2` (if :math:`p` does not divide :math:`N`) in the\n        space of modular symbols of level :math:`N_0`.\n        \n        Let :math:`V_p = [p,0;0,1]` and :math:`C_p = [a_p,p^{k-1};-1,0]`.\n        When :math:`p` does not divide :math:`N` and :math:`a_p` is divisible by :math:`p`, :literal:`mstooms`\n        returns the lift :math:`\\Phi` of :math:`(\\phi,\\phi\\|_k V_p)` such that\n        \n        .. MATH::\n        \n            T_{N_0}(p) \\Phi = C_p \\Phi\n        \n        When :math:`p` does not divide :math:`N` and :math:`a_p` is not divisible by :math:`p`, :literal:`mstooms`\n        returns the lift :math:`\\Phi` of :math:`\\phi - \\alpha^{-1} \\phi\\|_k V_p`\n        which is an eigenvector of :math:`T_{N_0}(p)` for the unit eigenvalue\n        where :math:`\\alpha^2 - a_p \\alpha + p^{k-1} = 0`.\n        \n        The resulting overconvergent eigensymbol can then be used in\n        :literal:`mspadicmoments`, then :literal:`mspadicL` or :literal:`mspadicseries`.\n        \n        ::\n        \n            ? M = msinit(3,6, 1); p = 5;\n            ? Tp = mshecke(M, p); factor(charpoly(Tp))\n            %2 =\n            [x - 3126 2]\n            \n            [ x - 6 1]\n            ? phi = matker(Tp - 6)[,1] \\\\ generator of p-Eigenspace, a_p = 6\n            ""%3 = [5, -3, -1]~\n            ? Mp = mspadicinit(M, p, 10, 0); \\\\ restrict to ordinary symbols, mod p^10\n            ? PHI = mstooms(Mp, phi);\n            ? mu = mspadicmoments(Mp, PHI);\n            ? mspadicL(mu)\n            %7 = 5 + 2*5^2 + 2*5^3 + ...\n        \n        A non ordinary symbol.\n        \n        ::\n        \n            ? M = msinit(4,6,1); p = 3;\n            ? Tp = mshecke(M, p); factor(charpoly(Tp))\n            %2 =\n            [x - 244 3]\n            \n            [ x + 12 1]\n            ? phi = matker(Tp + 12)[,1] \\\\ a_p = -12 is divisible by p = 3\n            %3 = [-1/32, -1/4, -1/32, 1]~\n            ? msissymbol(M,phi)\n            %4 = 1\n            ? Mp = mspadicinit(M,3,5,0);\n            ? PHI = mstooms(Mp,phi);\n             *** at top-level: PHI=mstooms(Mp,phi)\n             *** ^---------------\n             *** mstooms: incorrect type in mstooms [v_p(ap) > mspadicinit flag] (t_VEC).\n            ? Mp = mspadicinit(M,3,5,1);\n            ? PHI = mstooms(Mp,phi);\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1075mstooms(PyObject *__pyx_v_Mp, PyObject *__pyx_v_phi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mstooms (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1074mstooms(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Mp), ((PyObject *)__pyx_v_phi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1074mstooms(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Mp, PyObject *__pyx_v_phi) {
  GEN __pyx_v__Mp;
  GEN __pyx_v__phi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("mstooms", 0);
  __Pyx_INCREF(__pyx_v_phi);

  /* "cypari/auto_gen.pxi":19292
 *             ? PHI = mstooms(Mp,phi);
 *         '''
 *         phi = objtogen(phi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_phi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_phi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19293
 *         '''
 *         phi = objtogen(phi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _phi = (<Gen>phi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19293, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19294
 *         phi = objtogen(phi)
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _phi = (<Gen>phi).g
 *         cdef GEN _ret = mstooms(_Mp, _phi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Mp)->__pyx_base.g;
  __pyx_v__Mp = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19295
 *         sig_on()
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _phi = (<Gen>phi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = mstooms(_Mp, _phi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_phi)->__pyx_base.g;
  __pyx_v__phi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19296
 *         cdef GEN _Mp = (<Gen>Mp).g
 *         cdef GEN _phi = (<Gen>phi).g
 *         cdef GEN _ret = mstooms(_Mp, _phi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = mstooms(__pyx_v__Mp, __pyx_v__phi);

  /* "cypari/auto_gen.pxi":19297
 *         cdef GEN _phi = (<Gen>phi).g
 *         cdef GEN _ret = mstooms(_Mp, _phi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def newtonpoly(x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19225
 *         return new_gen(_ret)
 * 
 *     def mstooms(Mp, phi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :literal:`Mp` from :literal:`mspadicinit`, lift the (classical) eigen symbol
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.mstooms", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_phi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19299
 *         return new_gen(_ret)
 * 
 *     def newtonpoly(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the slopes of the Newton
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1077newtonpoly(PyObject *__pyx_v_x, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1076newtonpoly[] = "\n        Gives the vector of the slopes of the Newton\n        polygon of the polynomial :math:`x` with respect to the prime number :math:`p`. The :math:`n`\n        components of the vector are in decreasing order, where :math:`n` is equal to the\n        degree of :math:`x`. Vertical slopes occur iff the constant coefficient of :math:`x` is\n        zero and are denoted by :literal:`+oo`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1077newtonpoly(PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("newtonpoly (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1076newtonpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1076newtonpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("newtonpoly", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":19307
 *         zero and are denoted by :literal:`+oo`.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19308
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19308, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19309
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = newtonpoly(_x, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19310
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = newtonpoly(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19311
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = newtonpoly(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = newtonpoly(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_gen.pxi":19312
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = newtonpoly(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nextprime(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19299
 *         return new_gen(_ret)
 * 
 *     def newtonpoly(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the vector of the slopes of the Newton
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.newtonpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19314
 *         return new_gen(_ret)
 * 
 *     def nextprime(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the smallest pseudoprime (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1079nextprime(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1078nextprime[] = "\n        Finds the smallest pseudoprime (see\n        :literal:`ispseudoprime`) greater than or equal to :math:`x`. :math:`x` can be of any real\n        type. Note that if :math:`x` is a pseudoprime, this function returns :math:`x` and not\n        the smallest pseudoprime strictly larger than :math:`x`. To rigorously prove that\n        the result is prime, use :literal:`isprime`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1079nextprime(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nextprime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1078nextprime(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1078nextprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nextprime", 0);

  /* "cypari/auto_gen.pxi":19322
 *         the result is prime, use :literal:`isprime`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nextprime(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 19322, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19323
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nextprime(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":19324
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nextprime(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nextprime(__pyx_v__x);

  /* "cypari/auto_gen.pxi":19325
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nextprime(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfalgtobasis(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 19325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19314
 *         return new_gen(_ret)
 * 
 *     def nextprime(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the smallest pseudoprime (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nextprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19327
 *         return new_gen(_ret)
 * 
 *     def nfalgtobasis(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :math:`nf`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1081nfalgtobasis(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1080nfalgtobasis[] = "\n        Given an algebraic number :math:`x` in the number field :math:`nf`,\n        transforms it to a column vector on the integral basis :literal:`:emphasis:`nf`.zk`.\n        \n        ::\n        \n            ? nf = nfinit(y^2 + 4);\n            ? nf.zk\n            %2 = [1, 1/2*y]\n            ? nfalgtobasis(nf, [1,1]~)\n            %3 = [1, 1]~\n            ? nfalgtobasis(nf, y)\n            %4 = [0, 2]~\n            ? nfalgtobasis(nf, Mod(y, y^2+4))\n            %5 = [0, 2]~\n        \n        This is the inverse function of :literal:`nfbasistoalg`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1081nfalgtobasis(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfalgtobasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1080nfalgtobasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1080nfalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":19346
 *         This is the inverse function of :literal:`nfbasistoalg`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19347
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19347, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19348
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtobasis(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19349
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = algtobasis(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19350
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtobasis(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = algtobasis(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":19351
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = algtobasis(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfbasis(T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19327
 *         return new_gen(_ret)
 * 
 *     def nfalgtobasis(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :math:`nf`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19353
 *         return new_gen(_ret)
 * 
 *     def nfbasis(T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`T(X)` be an irreducible polynomial with integral coefficients. This
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1083nfbasis(PyObject *__pyx_v_T, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1082nfbasis[] = "\n        Let :math:`T(X)` be an irreducible polynomial with integral coefficients. This\n        function returns an integral basis of the number field defined by :math:`T`,\n        that is a :math:`\\mathbb{Z}`-basis of its maximal order. The basis elements are given as\n        elements in :math:`\\mathbb{Q}[X]/(T)`:\n        \n        ::\n        \n            ? nfbasis(x^2 + 1)\n            %1 = [1, x]\n        \n        This function uses a modified version of the round 4 algorithm,\n        due to David Ford, Sebastian Pauli and Xavier Roblot.\n        \n        :strong:`Local basis, orders maximal at certain primes.`\n        \n        Obtaining the maximal order is hard: it requires factoring the discriminant\n        :math:`D` of :math:`T`. Obtaining an order which is maximal at a finite explicit set of\n        primes is easy, but it may then be a strict suborder of the maximal order. To\n        specify that we are interested in a given set of places only, we can replace\n        the argument :math:`T` by an argument :math:`[T,listP]`, where :emphasis:`listP` encodes\n        the primes we are interested in: it must be a factorization matrix, a vector\n        of integers or a single integer.\n        \n        - Vector: we assume that it contains distinct :emphasis:`prime` numbers.\n        \n        - Matrix: we assume that it is a two-column matrix of a\n          (partial) factorization of :math:`D`; namely the first column contains\n          distinct :emphasis:`primes` and the second one the valuation of :math:`D` at each of\n          these primes.\n        \n        - Integer :math:`B`: this is replaced by the vector of primes up to :math:`B`. Note\n          that the function will use at least :math:`O(B)` time: a small value, about\n          :math:`10^5`, should be enough for most applications. Values larger than :math:`2^{32}`\n          are not supported.\n        \n        In all these cases, the primes may or may not divide the discrimina""nt :math:`D`\n        of :math:`T`. The function then returns a :math:`\\mathbb{Z}`-basis of an order whose index is\n        not divisible by any of these prime numbers. The result is actually a global\n        integral basis if all prime divisors of the :emphasis:`field` discriminant are\n        included! Note that :literal:`nfinit` has built-in support for such\n        a check:\n        \n        ::\n        \n            ? K = nfinit([T, listP]);\n            ? nfcertify(K) \\\\ we computed an actual maximal order\n            %2 = [];\n        \n        The first line initializes a number field structure\n        incorporating :literal:`nfbasis([T, listP]` in place of a proven integral basis.\n        The second line certifies that the resulting structure is correct. This\n        allows to create an :literal:`nf` structure attached to the number field :math:`K =\n        \\mathbb{Q}[X]/(T)`, when the discriminant of :math:`T` cannot be factored completely,\n        whereas the prime divisors of :math:`\\mathrm{disc} K` are known.\n        \n        Of course, if :emphasis:`listP` contains a single prime number :math:`p`,\n        the function returns a local integral basis for :math:`\\mathbb{Z}_p[X]/(T)`:\n        \n        ::\n        \n            ? nfbasis(x^2+x-1001)\n            %1 = [1, 1/3*x - 1/3]\n            ? nfbasis( [x^2+x-1001, [2]] )\n            %2 = [1, x]\n        \n        :strong:`The Buchmann-Lenstra algorithm.`\n        \n        We now complicate the picture: it is in fact allowed to include\n        :emphasis:`composite` numbers instead of primes\n        in :literal:`listP` (Vector or Matrix case), provided they are pairwise coprime.\n        The result will still be a correct integral basis :emphasis:`if`\n        the field discriminant factors completely over the actual primes in the list.\n        Adding a composite :math:`C` such that :math:`C^2` :emphasis:`divides` :math:`D` may help because\n        when we consider :math:`C` ""as a prime and run the algorithm, two good things can\n        happen: either we\n        succeed in proving that no prime dividing :math:`C` can divide the index\n        (without actually needing to find those primes), or the computation\n        exhibits a non-trivial zero divisor, thereby factoring :math:`C` and\n        we go on with the refined factorization. (Note that including a :math:`C`\n        such that :math:`C^2` does not divide :math:`D` is useless.) If neither happen, then the\n        computed basis need not generate the maximal order. Here is an example:\n        \n        ::\n        \n            ? B = 10^5;\n            ? P = factor(poldisc(T), B)[,1]; \\\\ primes <= B dividing D + cofactor\n            ? basis = nfbasis([T, listP])\n            ? disc = nfdisc([T, listP])\n        \n        We obtain the maximal order and its discriminant if the\n        field discriminant factors\n        completely over the primes less than :math:`B` (together with the primes\n        contained in the :literal:`addprimes` table). This can be tested as follows:\n        \n        ::\n        \n             check = factor(disc, B);\n             lastp = check[-1..-1,1];\n             if (lastp > B && !setsearch(addprimes(), lastp),\n             warning(\"nf may be incorrect!\"))\n        \n        This is a sufficient but not a necessary condition, hence the warning,\n        instead of an error. N.B. :literal:`lastp` is the last entry\n        in the first column of the :literal:`check` matrix, i.e. the largest prime\n        dividing :literal:`nf.disc` if :math:`<= B` or if it belongs to the prime table.\n        \n        The function :literal:`nfcertify` speeds up and automates the above process:\n        \n        ::\n        \n            ? B = 10^5;\n            ? nf = nfinit([T, B]);\n            ? nfcertify(nf)\n            %3 = [] \\\\ nf is unconditionally correct\n            ? basis = nf.zk;\n            ? disc = nf.disc;\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1083nfbasis(PyObject *__pyx_v_T, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1082nfbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1082nfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfbasis", 0);

  /* "cypari/auto_gen.pxi":19472
 *             ? disc = nf.disc;
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfbasis_gp(_T)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 19472, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19473
 *         '''
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfbasis_gp(_T)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_2;

  /* "cypari/auto_gen.pxi":19474
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfbasis_gp(_T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfbasis_gp(__pyx_v__T);

  /* "cypari/auto_gen.pxi":19475
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfbasis_gp(_T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfbasistoalg(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 19475, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19353
 *         return new_gen(_ret)
 * 
 *     def nfbasis(T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`T(X)` be an irreducible polynomial with integral coefficients. This
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19477
 *         return new_gen(_ret)
 * 
 *     def nfbasistoalg(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :emphasis:`nf`, transforms it
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1085nfbasistoalg(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1084nfbasistoalg[] = "\n        Given an algebraic number :math:`x` in the number field :emphasis:`nf`, transforms it\n        into :literal:`t_POLMOD` form.\n        \n        ::\n        \n            ? nf = nfinit(y^2 + 4);\n            ? nf.zk\n            %2 = [1, 1/2*y]\n            ? nfbasistoalg(nf, [1,1]~)\n            %3 = Mod(1/2*y + 1, y^2 + 4)\n            ? nfbasistoalg(nf, y)\n            %4 = Mod(y, y^2 + 4)\n            ? nfbasistoalg(nf, Mod(y, y^2+4))\n            %5 = Mod(y, y^2 + 4)\n        \n        This is the inverse function of :literal:`nfalgtobasis`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1085nfbasistoalg(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfbasistoalg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1084nfbasistoalg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1084nfbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":19496
 *         This is the inverse function of :literal:`nfalgtobasis`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19497
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19497, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19498
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = basistoalg(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19499
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = basistoalg(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19500
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = basistoalg(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = basistoalg(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":19501
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = basistoalg(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfcertify(nf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19477
 *         return new_gen(_ret)
 * 
 *     def nfbasistoalg(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an algebraic number :math:`x` in the number field :emphasis:`nf`, transforms it
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19503
 *         return new_gen(_ret)
 * 
 *     def nfcertify(nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1087nfcertify(PyObject *__pyx_v_nf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1086nfcertify[] = "\n        :math:`nf` being as output by\n        :literal:`nfinit`, checks whether the integer basis is known unconditionally.\n        This is in particular useful when the argument to :literal:`nfinit` was of the\n        form :math:`[T, listP]`, specifying a finite list of primes when\n        :math:`p`-maximality had to be proven, or a list of coprime integers to which\n        Buchmann-Lenstra algorithm was to be applied.\n        \n        The function returns a vector of coprime composite integers. If this vector\n        is empty, then :literal:`nf.zk` and :literal:`nf.disc` are correct. Otherwise, the\n        result is dubious. In order to obtain a certified result, one must completely\n        factor each of the given integers, then :literal:`addprime` each of their prime\n        factors, then check whether :literal:`nfdisc(nf.pol)` is equal to :literal:`nf.disc`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1087nfcertify(PyObject *__pyx_v_nf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfcertify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1086nfcertify(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1086nfcertify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfcertify", 0);

  /* "cypari/auto_gen.pxi":19518
 *         factors, then check whether :literal:`nfdisc(nf.pol)` is equal to :literal:`nf.disc`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = nfcertify(_nf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 19518, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19519
 *         '''
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfcertify(_nf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":19520
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = nfcertify(_nf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfcertify(__pyx_v__nf);

  /* "cypari/auto_gen.pxi":19521
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = nfcertify(_nf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfcompositum(nf, P, Q, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 19521, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19503
 *         return new_gen(_ret)
 * 
 *     def nfcertify(nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfcertify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19523
 *         return new_gen(_ret)
 * 
 *     def nfcompositum(nf, P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field structure attached to the field :math:`K`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1089nfcompositum(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1088nfcompositum[] = "\n        Let :emphasis:`nf` be a number field structure attached to the field :math:`K`\n        and let :math:`P` and :math:`Q`\n        be squarefree polynomials in :math:`K[X]` in the same variable. Outputs\n        the simple factors of the \303\251tale :math:`K`-algebra :math:`A = K[X, Y] / (P(X), Q(Y))`.\n        The factors are given by a list of polynomials :math:`R` in :math:`K[X]`, attached to\n        the number field :math:`K[X]/ (R)`, and sorted by increasing degree (with respect\n        to lexicographic ordering for factors of equal degrees). Returns an error if\n        one of the polynomials is not squarefree.\n        \n        Note that it is more efficient to reduce to the case where :math:`P` and :math:`Q` are\n        irreducible first. The routine will not perform this for you, since it may be\n        expensive, and the inputs are irreducible in most applications anyway. In\n        this case, there will be a single factor :math:`R` if and only if the number\n        fields defined by :math:`P` and :math:`Q` are linearly disjoint (their intersection is\n        :math:`K`).\n        \n        The binary digits of :math:`flag` mean\n        \n        1: outputs a vector of 4-component vectors :math:`[R,a,b,k]`, where :math:`R`\n        ranges through the list of all possible compositums as above, and :math:`a`\n        (resp. :math:`b`) expresses the root of :math:`P` (resp. :math:`Q`) as an element of\n        :math:`K[X]/(R)`. Finally, :math:`k` is a small integer such that :math:`b + ka = X` modulo\n        :math:`R`.\n        \n        2: assume that :math:`P` and :math:`Q` define number fields that are linearly disjoint:\n        both polynomials are irreducible and the corresponding number fields\n        have no common subfield besides :math:`K`. This allows to save a costly\n        factorization over :math:`K`. In this case return the single simple factor\n        instead of a vector with one element.\n        \n        A compositum i""s often defined by a complicated polynomial, which it is\n        advisable to reduce before further work. Here is an example involving\n        the field :math:`K(\\zeta_5, 5^{1/10})`, :math:`K = \\mathbb{Q} (\\sqrt{5})`:\n        \n        ::\n        \n            ? K = nfinit(y^2-5);\n            ? L = nfcompositum(K, x^5 - y, polcyclo(5), 1); \\\\ list of [R,a,b,k]\n            ? [R, a] = L[1]; \\\\ pick the single factor, extract R,a (ignore b,k)\n            ? lift(R) \\\\ defines the compositum\n            %4 = x^10 + (-5/2*y + 5/2)*x^9 + (-5*y + 20)*x^8 + (-20*y + 30)*x^7 + \\\n            (-45/2*y + 145/2)*x^6 + (-71/2*y + 121/2)*x^5 + (-20*y + 60)*x^4 + \\\n            (-25*y + 5)*x^3 + 45*x^2 + (-5*y + 15)*x + (-2*y + 6)\n            ? a^5 - y \\\\ a fifth root of y\n            %5 = 0\n            ? [T, X] = rnfpolredbest(K, R, 1);\n            ? lift(T) \\\\ simpler defining polynomial for K[x]/(R)\n            %7 = x^10 + (-11/2*y + 25/2)\n            ? liftall(X) \\\\  root of R in K[x]/(T(x))\n            %8 = (3/4*y + 7/4)*x^7 + (-1/2*y - 1)*x^5 + 1/2*x^2 + (1/4*y - 1/4)\n            ? a = subst(a.pol, 'x, X); \\\\ a in the new coordinates\n            ? liftall(a)\n            %10 = (-3/4*y - 7/4)*x^7 - 1/2*x^2\n            ? a^5 - y\n            %11 = 0\n        \n        The main variables of :math:`P` and :math:`Q` must be the same and have higher priority\n        than that of :emphasis:`nf` (see\302\240:literal:`varhigher` and\302\240:literal:`varlower`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1089nfcompositum(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_v_Q = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfcompositum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_P,&__pyx_n_s_Q,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfcompositum", 0, 2, 3, 1); __PYX_ERR(10, 19523, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfcompositum") < 0)) __PYX_ERR(10, 19523, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_Q = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 19523, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfcompositum", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19523, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1088nfcompositum(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_P, __pyx_v_Q, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1088nfcompositum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfcompositum", 0);
  __Pyx_INCREF(__pyx_v_P);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_gen.pxi":19584
 *         than that of :emphasis:`nf` (see:literal:`varhigher` and:literal:`varlower`).
 *         '''
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19585
 *         '''
 *         P = objtogen(P)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19586
 *         P = objtogen(P)
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19586, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19587
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19588
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19589
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19590
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfcompositum(__pyx_v__nf, __pyx_v__P, __pyx_v__Q, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":19591
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = nfcompositum(_nf, _P, _Q, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfdetint(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19523
 *         return new_gen(_ret)
 * 
 *     def nfcompositum(nf, P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a number field structure attached to the field :math:`K`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19593
 *         return new_gen(_ret)
 * 
 *     def nfdetint(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`x`, computes a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1091nfdetint(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1090nfdetint[] = "\n        Given a pseudo-matrix :math:`x`, computes a\n        non-zero ideal contained in (i.e.\302\240multiple of) the determinant of :math:`x`. This\n        is particularly useful in conjunction with :literal:`nfhnfmod`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1091nfdetint(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfdetint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1090nfdetint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1090nfdetint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfdetint", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":19599
 *         is particularly useful in conjunction with :literal:`nfhnfmod`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19600
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19600, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19601
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfdetint(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19602
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdetint(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19603
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfdetint(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdetint(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":19604
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfdetint(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfdisc(T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19593
 *         return new_gen(_ret)
 * 
 *     def nfdetint(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`x`, computes a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfdetint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19606
 *         return new_gen(_ret)
 * 
 *     def nfdisc(T):             # <<<<<<<<<<<<<<
 *         r'''
 *         field discriminant of the number field defined by the integral,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1093nfdisc(PyObject *__pyx_v_T, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1092nfdisc[] = "\n        field discriminant of the number field defined by the integral,\n        preferably monic, irreducible polynomial :math:`T(X)`. Returns the discriminant of\n        the number field :math:`\\mathbb{Q}[X]/(T)`, using the Round :math:`4` algorithm.\n        \n        :strong:`Local discriminants, valuations at certain primes.`\n        \n        As in :literal:`nfbasis`, the argument :math:`T` can be replaced by :math:`[T,listP]`,\n        where :literal:`listP` is as in :literal:`nfbasis`: a vector of\n        pairwise coprime integers (usually distinct primes), a factorization matrix,\n        or a single integer. In that case, the function returns the discriminant of\n        an order whose basis is given by :literal:`nfbasis(T,listP)`, which need not be\n        the maximal order, and whose valuation at a prime entry in :literal:`listP` is the\n        same as the valuation of the field discriminant.\n        \n        In particular, if :literal:`listP` is :math:`[p]` for a prime :math:`p`, we can\n        return the :math:`p`-adic discriminant of the maximal order of :math:`\\mathbb{Z}_p[X]/(T)`,\n        as a power of :math:`p`, as follows:\n        \n        ::\n        \n            ? padicdisc(T,p) = p^valuation(nfdisc([T,[p]]), p);\n            ? nfdisc(x^2 + 6)\n            %2 = -24\n            ? padicdisc(x^2 + 6, 2)\n            %3 = 8\n            ? padicdisc(x^2 + 6, 3)\n            %4 = 3\n        \n        The following function computes the discriminant of the\n        maximal order under the assumption that :math:`P` is a vector of prime numbers\n        containing (at least) all prime divisors of the field discriminant:\n        \n        ::\n        \n            globaldisc(T, P) =\n            { my (D = nfdisc([T, P]));\n             sign(D) * factorback(P, [valuation(D,p) | p <-P]);\n            }\n            ? globaldisc(x^2 + 6, [2, 3, 5])\n            %1 = -24\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1093nfdisc(PyObject *__pyx_v_T, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfdisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1092nfdisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1092nfdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfdisc", 0);

  /* "cypari/auto_gen.pxi":19649
 *             %1 = -24
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfdisc(_T)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 19649, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19650
 *         '''
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdisc(_T)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_2;

  /* "cypari/auto_gen.pxi":19651
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfdisc(_T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdisc(__pyx_v__T);

  /* "cypari/auto_gen.pxi":19652
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nfdisc(_T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltadd(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 19652, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19606
 *         return new_gen(_ret)
 * 
 *     def nfdisc(T):             # <<<<<<<<<<<<<<
 *         r'''
 *         field discriminant of the number field defined by the integral,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19654
 *         return new_gen(_ret)
 * 
 *     def nfeltadd(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1095nfeltadd(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1094nfeltadd[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes their sum :math:`x+y` in the number field :math:`nf`.\n        \n        ::\n        \n            ? nf = nfinit(1+x^2);\n            ? nfeltadd(nf, 1, x) \\\\ 1 + I\n            %2 = [1, 1]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1095nfeltadd(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltadd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltadd", 1, 2, 2, 1); __PYX_ERR(10, 19654, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltadd") < 0)) __PYX_ERR(10, 19654, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltadd", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19654, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1094nfeltadd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1094nfeltadd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltadd", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":19665
 *             %2 = [1, 1]~
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19665, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19666
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19667
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19667, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19668
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19669
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfadd(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19670
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfadd(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19671
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfadd(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfadd(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":19672
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfadd(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdiv(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19654
 *         return new_gen(_ret)
 * 
 *     def nfeltadd(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltadd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19674
 *         return new_gen(_ret)
 * 
 *     def nfeltdiv(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1097nfeltdiv(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1096nfeltdiv[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes their quotient :math:`x/y` in the number field :math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1097nfeltdiv(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdiv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdiv", 1, 2, 2, 1); __PYX_ERR(10, 19674, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdiv") < 0)) __PYX_ERR(10, 19674, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdiv", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19674, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1096nfeltdiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1096nfeltdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltdiv", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":19679
 *         :emphasis:`nf`, computes their quotient :math:`x/y` in the number field :math:`nf`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19680
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19680, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19681
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19681, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19682
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19683
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19684
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19685
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdiv(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":19686
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiv(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdiveuc(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19674
 *         return new_gen(_ret)
 * 
 *     def nfeltdiv(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19688
 *         return new_gen(_ret)
 * 
 *     def nfeltdiveuc(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1099nfeltdiveuc(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1098nfeltdiveuc[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes an algebraic integer :math:`q` in the number field :math:`nf`\n        such that the components of :math:`x-qy` are reasonably small. In fact, this is\n        functionally identical to :literal:`round(nfdiv(:emphasis:`nf`,x,y))`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1099nfeltdiveuc(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdiveuc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdiveuc", 1, 2, 2, 1); __PYX_ERR(10, 19688, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdiveuc") < 0)) __PYX_ERR(10, 19688, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdiveuc", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19688, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdiveuc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1098nfeltdiveuc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1098nfeltdiveuc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltdiveuc", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":19695
 *         functionally identical to :literal:`round(nfdiv(:emphasis:`nf`,x,y))`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19696
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19696, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19697
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19697, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19698
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19699
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19700
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19701
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdiveuc(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":19702
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdiveuc(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdivmodpr(nf, x, y, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19688
 *         return new_gen(_ret)
 * 
 *     def nfeltdiveuc(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdiveuc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19704
 *         return new_gen(_ret)
 * 
 *     def nfeltdivmodpr(nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1101nfeltdivmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1100nfeltdivmodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given two elements :math:`x`\n        and :math:`y` in :emphasis:`nf` and :emphasis:`pr` a prime ideal in :literal:`modpr` format (see\n        :literal:`nfmodprinit`), computes their quotient :math:`x / y` modulo the prime ideal\n        :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1101nfeltdivmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdivmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivmodpr", 1, 3, 3, 1); __PYX_ERR(10, 19704, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivmodpr", 1, 3, 3, 2); __PYX_ERR(10, 19704, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdivmodpr") < 0)) __PYX_ERR(10, 19704, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdivmodpr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19704, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdivmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1100nfeltdivmodpr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1100nfeltdivmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltdivmodpr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":19713
 *         :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19713, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19714
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19715
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19716
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19717
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19718
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19718, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19719
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19720
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19721
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19722
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19723
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdivmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":19724
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfdivmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltdivrem(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19704
 *         return new_gen(_ret)
 * 
 *     def nfeltdivmodpr(nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdivmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19726
 *         return new_gen(_ret)
 * 
 *     def nfeltdivrem(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1103nfeltdivrem(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1102nfeltdivrem[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, gives a two-element row vector :math:`[q,r]` such that :math:`x = qy+r`, :math:`q` is\n        an algebraic integer in :math:`nf`, and the components of :math:`r` are\n        reasonably small.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1103nfeltdivrem(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltdivrem (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltdivrem", 1, 2, 2, 1); __PYX_ERR(10, 19726, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltdivrem") < 0)) __PYX_ERR(10, 19726, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltdivrem", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19726, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdivrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1102nfeltdivrem(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1102nfeltdivrem(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltdivrem", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":19733
 *         reasonably small.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19734
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19735
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19735, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19736
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19737
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19738
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19739
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfdivrem(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":19740
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfdivrem(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltembed(nf, x, pl=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19726
 *         return new_gen(_ret)
 * 
 *     def nfeltdivrem(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltdivrem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19742
 *         return new_gen(_ret)
 * 
 *     def nfeltembed(nf, x, pl=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1105nfeltembed(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1104nfeltembed[] = "\n        Given an element :math:`x` in the number field :emphasis:`nf`, return\n        the (real or) complex embeddings of :math:`x` specified by optional argument\n        :emphasis:`pl`, at the current :literal:`realprecision`:\n        \n        - :emphasis:`pl` omitted: return the vector of embeddings at all :math:`r_1+r_2`\n          places;\n        \n        - :emphasis:`pl` an integer between :math:`1` and :math:`r_1+r_2`: return the\n          :math:`i`-th embedding of :math:`x`, attached to the :math:`i`-th root of :literal:`nf.pol`,\n          i.e. :literal:`nf.roots:math:`[i]``;\n        \n        - :emphasis:`pl` a vector or :literal:`t_VECSMALL`: return the vector of embeddings; the :math:`i`-th\n          entry gives the embedding at the place attached to the :math:`pl[i]`-th real\n          root of :literal:`nf.pol`.\n        \n        ::\n        \n            ? nf = nfinit('y^3 - 2);\n            ? nf.sign\n            %2 = [1, 1]\n            ? nfeltembed(nf, 'y)\n            %3 = [1.25992[...], -0.62996[...] + 1.09112[...]*I]]\n            ? nfeltembed(nf, 'y, 1)\n            %4 = 1.25992[...]\n            ? nfeltembed(nf, 'y, 3) \\\\ there are only 2 arch. places\n             *** at top-level: nfeltembed(nf,'y,3)\n             *** ^-----------------\n             *** nfeltembed: domain error in nfeltembed: index > 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1105nfeltembed(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pl = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltembed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_pl,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltembed") < 0)) __PYX_ERR(10, 19742, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_pl = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 19742, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltembed", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19742, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1104nfeltembed(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_pl, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1104nfeltembed(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl, long __pyx_v_precision) {
  int __pyx_v__have_pl;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltembed", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":19773
 *              *** nfeltembed: domain error in nfeltembed: index > 2
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19774
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_gen.pxi":19775
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":19776
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":19775
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":19777
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19777, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19778
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19779
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19780
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_gen.pxi":19781
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":19782
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":19781
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":19783
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":19784
 *             _pl = (<Gen>pl).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfeltembed(__pyx_v__nf, __pyx_v__x, __pyx_v__pl, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":19785
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfeltembed(_nf, _x, _pl, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltmod(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19742
 *         return new_gen(_ret)
 * 
 *     def nfeltembed(nf, x, pl=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltembed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19787
 *         return new_gen(_ret)
 * 
 *     def nfeltmod(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1107nfeltmod(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1106nfeltmod[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes an element :math:`r` of :math:`nf` of the form :math:`r = x-qy` with\n        :math:`q` and algebraic integer, and such that :math:`r` is small. This is functionally\n        identical to\n        \n        .. MATH::\n        \n            x - nfmul(nf,round(nfdiv(nf,x,y)),y).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1107nfeltmod(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmod", 1, 2, 2, 1); __PYX_ERR(10, 19787, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltmod") < 0)) __PYX_ERR(10, 19787, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltmod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19787, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1106nfeltmod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1106nfeltmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltmod", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":19798
 *             x - nfmul(nf,round(nfdiv(nf,x,y)),y).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19799
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19800
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19800, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19801
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19802
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmod(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19803
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmod(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19804
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmod(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmod(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":19805
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmod(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltmul(nf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19787
 *         return new_gen(_ret)
 * 
 *     def nfeltmod(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19807
 *         return new_gen(_ret)
 * 
 *     def nfeltmul(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1109nfeltmul(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1108nfeltmul[] = "\n        Given two elements :math:`x` and :math:`y` in\n        :emphasis:`nf`, computes their product :math:`x*y` in the number field :math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1109nfeltmul(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmul", 1, 2, 2, 1); __PYX_ERR(10, 19807, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltmul") < 0)) __PYX_ERR(10, 19807, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19807, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1108nfeltmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1108nfeltmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltmul", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":19812
 *         :emphasis:`nf`, computes their product :math:`x*y` in the number field :math:`nf`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19813
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19813, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19814
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19814, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19815
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19816
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmul(_nf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19817
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmul(_nf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19818
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmul(_nf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmul(__pyx_v__nf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":19819
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = nfmul(_nf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltmulmodpr(nf, x, y, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19807
 *         return new_gen(_ret)
 * 
 *     def nfeltmul(nf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given two elements :math:`x` and :math:`y` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19821
 *         return new_gen(_ret)
 * 
 *     def nfeltmulmodpr(nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1111nfeltmulmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1110nfeltmulmodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given two elements :math:`x` and\n        :math:`y` in :emphasis:`nf` and :emphasis:`pr` a prime ideal in :literal:`modpr` format (see\n        :literal:`nfmodprinit`), computes their product :math:`x*y` modulo the prime ideal\n        :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1111nfeltmulmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltmulmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmulmodpr", 1, 3, 3, 1); __PYX_ERR(10, 19821, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltmulmodpr", 1, 3, 3, 2); __PYX_ERR(10, 19821, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltmulmodpr") < 0)) __PYX_ERR(10, 19821, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltmulmodpr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19821, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltmulmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1110nfeltmulmodpr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_y, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1110nfeltmulmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltmulmodpr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":19830
 *         :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19830, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19831
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19832
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19833
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19834
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19834, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19835
 *         y = objtogen(y)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19835, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19836
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19837
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19838
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19839
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19840
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmulmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__y, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":19841
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmulmodpr(_nf, _x, _y, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltnorm(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19821
 *         return new_gen(_ret)
 * 
 *     def nfeltmulmodpr(nf, x, y, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltmulmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19843
 *         return new_gen(_ret)
 * 
 *     def nfeltnorm(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute norm of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1113nfeltnorm(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1112nfeltnorm[] = "\n        Returns the absolute norm of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1113nfeltnorm(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltnorm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1112nfeltnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1112nfeltnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltnorm", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":19847
 *         Returns the absolute norm of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19848
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19848, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19849
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfnorm(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19850
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfnorm(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19851
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfnorm(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfnorm(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":19852
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfnorm(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltpow(nf, x, k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19843
 *         return new_gen(_ret)
 * 
 *     def nfeltnorm(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute norm of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19854
 *         return new_gen(_ret)
 * 
 *     def nfeltpow(nf, x, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`nf`, and a positive or negative integer :math:`k`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1115nfeltpow(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1114nfeltpow[] = "\n        Given an element :math:`x` in :emphasis:`nf`, and a positive or negative integer :math:`k`,\n        computes :math:`x^k` in the number field :math:`nf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1115nfeltpow(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltpow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_k,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpow", 1, 2, 2, 1); __PYX_ERR(10, 19854, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltpow") < 0)) __PYX_ERR(10, 19854, __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_x = values[0];
    __pyx_v_k = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltpow", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19854, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1114nfeltpow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_k);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1114nfeltpow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltpow", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_gen.pxi":19859
 *         computes :math:`x^k` in the number field :math:`nf`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         k = objtogen(k)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19859, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19860
 *         '''
 *         x = objtogen(x)
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19860, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19861
 *         x = objtogen(x)
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19861, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19862
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19863
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = nfpow(_nf, _x, _k)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19864
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfpow(_nf, _x, _k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19865
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = nfpow(_nf, _x, _k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfpow(__pyx_v__nf, __pyx_v__x, __pyx_v__k);

  /* "cypari/auto_gen.pxi":19866
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = nfpow(_nf, _x, _k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltpowmodpr(nf, x, k, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19854
 *         return new_gen(_ret)
 * 
 *     def nfeltpow(nf, x, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in :emphasis:`nf`, and a positive or negative integer :math:`k`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltpow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19868
 *         return new_gen(_ret)
 * 
 *     def nfeltpowmodpr(nf, x, k, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1117nfeltpowmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1116nfeltpowmodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given an element :math:`x` in :emphasis:`nf`, an integer :math:`k` and a prime ideal\n        :emphasis:`pr` in :literal:`modpr` format\n        (see :literal:`nfmodprinit`), computes :math:`x^k` modulo the prime ideal :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1117nfeltpowmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltpowmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_k,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpowmodpr", 1, 3, 3, 1); __PYX_ERR(10, 19868, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltpowmodpr", 1, 3, 3, 2); __PYX_ERR(10, 19868, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltpowmodpr") < 0)) __PYX_ERR(10, 19868, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_x = values[0];
    __pyx_v_k = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltpowmodpr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19868, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltpowmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1116nfeltpowmodpr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_k, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1116nfeltpowmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_k, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__k;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltpowmodpr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_k);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":19876
 *         (see :literal:`nfmodprinit`), computes :math:`x^k` modulo the prime ideal :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19876, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19877
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         k = objtogen(k)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__62, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19878
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         k = objtogen(k)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19878, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19879
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19880
 *         x = objtogen(x)
 *         k = objtogen(k)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19881
 *         k = objtogen(k)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19881, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19882
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19883
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19884
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19885
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19886
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfpowmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__k, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":19887
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfpowmodpr(_nf, _x, _k, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltreduce(nf, a, id):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19868
 *         return new_gen(_ret)
 * 
 *     def nfeltpowmodpr(nf, x, k, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltpowmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19889
 *         return new_gen(_ret)
 * 
 *     def nfeltreduce(nf, a, id):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an ideal :emphasis:`id` in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1119nfeltreduce(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1118nfeltreduce[] = "\n        Given an ideal :emphasis:`id` in\n        Hermite normal form and an element :math:`a` of the number field :math:`nf`,\n        finds an element :math:`r` in :math:`nf` such that :math:`a-r` belongs to the ideal\n        and :math:`r` is small.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1119nfeltreduce(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltreduce (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_id,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_a)) != 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_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltreduce", 1, 2, 2, 1); __PYX_ERR(10, 19889, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltreduce") < 0)) __PYX_ERR(10, 19889, __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_a = values[0];
    __pyx_v_id = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltreduce", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19889, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltreduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1118nfeltreduce(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_a, __pyx_v_id);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1118nfeltreduce(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_id) {
  GEN __pyx_v__nf;
  GEN __pyx_v__a;
  GEN __pyx_v__id;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfeltreduce", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_id);

  /* "cypari/auto_gen.pxi":19896
 *         and :math:`r` is small.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         id = objtogen(id)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19897
 *         '''
 *         a = objtogen(a)
 *         id = objtogen(id)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_id, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_id, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19898
 *         a = objtogen(a)
 *         id = objtogen(id)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19898, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19899
 *         id = objtogen(id)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _id = (<Gen>id).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19900
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _id = (<Gen>id).g
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19901
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _id = (<Gen>id).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_id)->__pyx_base.g;
  __pyx_v__id = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19902
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _id = (<Gen>id).g
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfreduce(__pyx_v__nf, __pyx_v__a, __pyx_v__id);

  /* "cypari/auto_gen.pxi":19903
 *         cdef GEN _id = (<Gen>id).g
 *         cdef GEN _ret = nfreduce(_nf, _a, _id)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltreducemodpr(nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19889
 *         return new_gen(_ret)
 * 
 *     def nfeltreduce(nf, a, id):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an ideal :emphasis:`id` in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltreduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_id);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19905
 *         return new_gen(_ret)
 * 
 *     def nfeltreducemodpr(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1121nfeltreducemodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1120nfeltreducemodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Given an element :math:`x` of the number field :math:`nf` and a prime ideal\n        :emphasis:`pr` in :literal:`modpr` format compute a canonical representative for the\n        class of :math:`x` modulo :emphasis:`pr`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1121nfeltreducemodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltreducemodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_pr,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltreducemodpr", 1, 2, 2, 1); __PYX_ERR(10, 19905, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltreducemodpr") < 0)) __PYX_ERR(10, 19905, __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_x = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltreducemodpr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19905, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltreducemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1120nfeltreducemodpr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1120nfeltreducemodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltreducemodpr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":19913
 *         class of :math:`x` modulo :emphasis:`pr`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19913, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19914
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__63, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19915
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19916
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":19917
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19917, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19918
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19919
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19920
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19921
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfreducemodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":19922
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfreducemodpr(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfeltsign(nf, x, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 19922, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19905
 *         return new_gen(_ret)
 * 
 *     def nfeltreducemodpr(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltreducemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19924
 *         return new_gen(_ret)
 * 
 *     def nfeltsign(nf, x, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, returns the signs of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1123nfeltsign(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1122nfeltsign[] = "\n        Given an element :math:`x` in the number field :emphasis:`nf`, returns the signs of\n        the real embeddings of :math:`x` specified by optional argument :emphasis:`pl`:\n        \n        - :emphasis:`pl` omitted: return the vector of signs at all :math:`r_1` real places;\n        \n        - :emphasis:`pl` an integer between :math:`1` and :math:`r_1`: return the sign of the\n          :math:`i`-th embedding of :math:`x`, attached to the :math:`i`-th real root of :literal:`nf.pol`,\n          i.e. :literal:`nf.roots:math:`[i]``;\n        \n        - :emphasis:`pl` a vector or :literal:`t_VECSMALL`: return the vector of signs; the :math:`i`-th\n          entry gives the sign at the real place attached to the :math:`pl[i]`-th real\n          root of :literal:`nf.pol`.\n        \n        ::\n        \n            ? nf = nfinit(polsubcyclo(11,5,'y)); \\\\ Q(cos(2 pi/11))\n            ? nf.sign\n            %2 = [5, 0]\n            ? x = Mod('y, nf.pol);\n            ? nfeltsign(nf, x)\n            %4 = [-1, -1, -1, 1, 1]\n            ? nfeltsign(nf, x, 1)\n            %5 = -1\n            ? nfeltsign(nf, x, [1..4])\n            %6 = [-1, -1, -1, 1]\n            ? nfeltsign(nf, x, 6) \\\\ there are only 5 real embeddings\n             *** at top-level: nfeltsign(nf,x,6)\n             *** ^-----------------\n             *** nfeltsign: domain error in nfeltsign: index > 5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1123nfeltsign(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltsign (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_pl,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltsign") < 0)) __PYX_ERR(10, 19924, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_pl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltsign", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 19924, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1122nfeltsign(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_pl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1122nfeltsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfeltsign", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":19956
 *              *** nfeltsign: domain error in nfeltsign: index > 5
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19957
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_gen.pxi":19958
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":19959
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":19958
 *         x = objtogen(x)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":19960
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 19960, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19961
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19962
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":19963
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_gen.pxi":19964
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":19965
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":19964
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 */
  }

  /* "cypari/auto_gen.pxi":19966
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfeltsign(__pyx_v__nf, __pyx_v__x, __pyx_v__pl);

  /* "cypari/auto_gen.pxi":19967
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfeltsign(_nf, _x, _pl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfelttrace(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19967, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19924
 *         return new_gen(_ret)
 * 
 *     def nfeltsign(nf, x, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an element :math:`x` in the number field :emphasis:`nf`, returns the signs of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfeltsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19969
 *         return new_gen(_ret)
 * 
 *     def nfelttrace(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute trace of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1125nfelttrace(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1124nfelttrace[] = "\n        Returns the absolute trace of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1125nfelttrace(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfelttrace (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1124nfelttrace(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1124nfelttrace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfelttrace", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":19973
 *         Returns the absolute trace of :math:`x`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":19974
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 19974, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":19975
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nftrace(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19976
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nftrace(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":19977
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nftrace(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nftrace(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":19978
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nftrace(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nffactor(nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 19978, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19969
 *         return new_gen(_ret)
 * 
 *     def nfelttrace(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute trace of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfelttrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":19980
 *         return new_gen(_ret)
 * 
 *     def nffactor(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factorization of the univariate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1127nffactor(PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1126nffactor[] = "\n        Factorization of the univariate\n        polynomial :math:`T` over the number field :math:`nf` given by :literal:`nfinit`; :math:`T`\n        has coefficients in :math:`nf` (i.e.\302\240either scalar, polmod, polynomial or\n        column vector). The factors are sorted by increasing degree.\n        \n        The main variable of :math:`nf` must be of :emphasis:`lower`\n        priority than that of :math:`T`, see ``priority`` (in the PARI manual). However if\n        the polynomial defining the number field occurs explicitly in the\n        coefficients of :math:`T` as modulus of a :literal:`t_POLMOD` or as a :literal:`t_POL`\n        coefficient, its main variable must be :emphasis:`the same` as the main variable\n        of :math:`T`. For example,\n        \n        ::\n        \n            ? nf = nfinit(y^2 + 1);\n            ? nffactor(nf, x^2 + y); \\\\ OK\n            ? nffactor(nf, x^2 + Mod(y, y^2+1)); \\\\  OK\n            ? nffactor(nf, x^2 + Mod(z, z^2+1)); \\\\  WRONG\n        \n        It is possible to input a defining polynomial for :emphasis:`nf`\n        instead, but this is in general less efficient since parts of an :literal:`nf`\n        structure will then be computed internally. This is useful in two\n        situations: when you do not need the :literal:`nf` elsewhere, or when you cannot\n        initialize an :literal:`nf` due to integer factorization difficulties when\n        attempting to compute the field discriminant and maximal order. In all\n        cases, the function runs in polynomial time using Belabas's variant\n        of van Hoeij's algorithm, which copes with hundreds of modular factors.\n        \n        :strong:`Caveat.` :literal:`nfinit([T, listP])` allows to compute in polynomial\n        time a conditional :emphasis:`nf` structure, which sets :literal:`nf.zk` to an order\n        which is not guaranteed to be maximal at all primes. Always either use\n        :literal:`nfcertify` first (which may not run in po""lynomial time) or make sure\n        to input :literal:`nf.pol` instead of the conditional :emphasis:`nf`: :literal:`nffactor` is\n        able to recover in polynomial time in this case, instead of potentially\n        missing a factor.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1127nffactor(PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nffactor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1126nffactor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_T));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1126nffactor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nffactor", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_gen.pxi":20018
 *         missing a factor.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20019
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20019, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20020
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nffactor(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20021
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nffactor(_nf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20022
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nffactor(_nf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nffactor(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_gen.pxi":20023
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = nffactor(_nf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nffactorback(nf, f, e=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20023, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":19980
 *         return new_gen(_ret)
 * 
 *     def nffactor(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factorization of the univariate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nffactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20025
 *         return new_gen(_ret)
 * 
 *     def nffactorback(nf, f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the :emphasis:`nf` element corresponding to a factorization.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1129nffactorback(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1128nffactorback[] = "\n        Gives back the :emphasis:`nf` element corresponding to a factorization.\n        The integer :math:`1` corresponds to the empty factorization.\n        \n        If :math:`e` is present, :math:`e` and :math:`f` must be vectors of the same length (:math:`e` being\n        integral), and the corresponding factorization is the product of the\n        :math:`f[i]^{e[i]}`.\n        \n        If not, and :math:`f` is vector, it is understood as in the preceding case with :math:`e`\n        a vector of 1s: we return the product of the :math:`f[i]`. Finally, :math:`f` can be a\n        regular factorization matrix.\n        \n        ::\n        \n            ? nf = nfinit(y^2+1);\n            ? nffactorback(nf, [3, y+1, [1,2]~], [1, 2, 3])\n            %2 = [12, -66]~\n            ? 3 * (I+1)^2 * (1+2*I)^3\n            %3 = 12 - 66*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1129nffactorback(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  PyObject *__pyx_v_e = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nffactorback (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_e,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nffactorback") < 0)) __PYX_ERR(10, 20025, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    __pyx_v_e = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nffactorback", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20025, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nffactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1128nffactorback(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_f, __pyx_v_e);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1128nffactorback(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_f, PyObject *__pyx_v_e) {
  int __pyx_v__have_e;
  GEN __pyx_v__nf;
  GEN __pyx_v__f;
  GEN __pyx_v__e;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nffactorback", 0);
  __Pyx_INCREF(__pyx_v_f);
  __Pyx_INCREF(__pyx_v_e);

  /* "cypari/auto_gen.pxi":20046
 *             %3 = 12 - 66*I
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20047
 *         '''
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             e = objtogen(e)
 */
  __pyx_t_2 = (__pyx_v_e != Py_None);
  __pyx_v__have_e = __pyx_t_2;

  /* "cypari/auto_gen.pxi":20048
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":20049
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:
 *             e = objtogen(e)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_e, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_e, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":20048
 *         f = objtogen(f)
 *         cdef bint _have_e = (e is not None)
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             e = objtogen(e)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":20050
 *         if _have_e:
 *             e = objtogen(e)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20050, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20051
 *             e = objtogen(e)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20052
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _e = NULL
 *         if _have_e:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20053
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL             # <<<<<<<<<<<<<<
 *         if _have_e:
 *             _e = (<Gen>e).g
 */
  __pyx_v__e = NULL;

  /* "cypari/auto_gen.pxi":20054
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 */
  __pyx_t_2 = (__pyx_v__have_e != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":20055
 *         cdef GEN _e = NULL
 *         if _have_e:
 *             _e = (<Gen>e).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_e)->__pyx_base.g;
    __pyx_v__e = __pyx_t_4;

    /* "cypari/auto_gen.pxi":20054
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _e = NULL
 *         if _have_e:             # <<<<<<<<<<<<<<
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 */
  }

  /* "cypari/auto_gen.pxi":20056
 *         if _have_e:
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nffactorback(__pyx_v__nf, __pyx_v__f, __pyx_v__e);

  /* "cypari/auto_gen.pxi":20057
 *             _e = (<Gen>e).g
 *         cdef GEN _ret = nffactorback(_nf, _f, _e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nffactormod(nf, Q, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20025
 *         return new_gen(_ret)
 * 
 *     def nffactorback(nf, f, e=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives back the :emphasis:`nf` element corresponding to a factorization.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nffactorback", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20059
 *         return new_gen(_ret)
 * 
 *     def nffactormod(nf, Q, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This routine is obsolete, use :literal:`nfmodpr` and :literal:`factormod`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1131nffactormod(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1130nffactormod[] = "\n        This routine is obsolete, use :literal:`nfmodpr` and :literal:`factormod`.\n        \n        Factors the univariate polynomial :math:`Q` modulo the prime ideal :emphasis:`pr` in\n        the number field :math:`nf`. The coefficients of :math:`Q` belong to the number\n        field (scalar, polmod, polynomial, even column vector) and the main variable\n        of :math:`nf` must be of lower priority than that of :math:`Q` (see\n        ``priority`` (in the PARI manual)). The prime ideal :emphasis:`pr` is either in\n        :literal:`idealprimedec` or (preferred) :literal:`modprinit` format. The coefficients\n        of the polynomial factors are lifted to elements of :emphasis:`nf`:\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K, 3)[1];\n            ? nffactormod(K, x^2 + y*x + 18*y+1, P)\n            %3 =\n            [x + (2*y + 1) 1]\n            \n            [x + (2*y + 2) 1]\n            ? P = nfmodprinit(K, P); \\\\ convert to nfmodprinit format\n            ? nffactormod(K, x^2 + y*x + 18*y+1)\n            %5 =\n            [x + (2*y + 1) 1]\n            \n            [x + (2*y + 2) 1]\n        \n        Same result, of course, here about 10\\% faster due to the\n        precomputation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1131nffactormod(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nffactormod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_pr,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_Q)) != 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_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nffactormod", 1, 2, 2, 1); __PYX_ERR(10, 20059, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nffactormod") < 0)) __PYX_ERR(10, 20059, __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_Q = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nffactormod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20059, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nffactormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1130nffactormod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_Q, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1130nffactormod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_Q, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__Q;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nffactormod", 0);
  __Pyx_INCREF(__pyx_v_Q);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":20090
 *         precomputation.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)
 *         Q = objtogen(Q)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20090, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20091
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__64, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20092
 *         from warnings import warn
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20092, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20093
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)
 *         Q = objtogen(Q)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20094
 *         Q = objtogen(Q)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20094, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20095
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20096
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20097
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20098
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nffactormod(__pyx_v__nf, __pyx_v__Q, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":20099
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nffactormod(_nf, _Q, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfgaloisapply(nf, aut, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20059
 *         return new_gen(_ret)
 * 
 *     def nffactormod(nf, Q, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This routine is obsolete, use :literal:`nfmodpr` and :literal:`factormod`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nffactormod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20101
 *         return new_gen(_ret)
 * 
 *     def nfgaloisapply(nf, aut, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`nf` be a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1133nfgaloisapply(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1132nfgaloisapply[] = "\n        Let :math:`nf` be a\n        number field as output by :literal:`nfinit`, and let :emphasis:`aut` be a Galois\n        automorphism of :math:`nf` expressed by its image on the field generator\n        (such automorphisms can be found using :literal:`nfgaloisconj`). The function\n        computes the action of the automorphism :emphasis:`aut` on the object :math:`x` in the\n        number field; :math:`x` can be a number field element, or an ideal (possibly\n        extended). Because of possible confusion with elements and ideals, other\n        vector or matrix arguments are forbidden.\n        \n        ::\n        \n             ? nf = nfinit(x^2+1);\n             ? L = nfgaloisconj(nf)\n             %2 = [-x, x]~\n             ? aut = L[1]; /* the non-trivial automorphism */\n             ? nfgaloisapply(nf, aut, x)\n             %4 = Mod(-x, x^2 + 1)\n             ? P = idealprimedec(nf,5); /* prime ideals above 5 */\n             ? nfgaloisapply(nf, aut, P[2]) == P[1]\n             %6 = 0 \\\\ !!!!\n             ? idealval(nf, nfgaloisapply(nf, aut, P[2]), P[1])\n             %7 = 1\n        \n        The surprising failure of the equality test (:literal:`\\%7`) is\n        due to the fact that although the corresponding prime ideals are equal, their\n        representations are not. (A prime ideal is specified by a uniformizer, and\n        there is no guarantee that applying automorphisms yields the same elements\n        as a direct :literal:`idealprimedec` call.)\n        \n        The automorphism can also be given as a column vector, representing the\n        image of :literal:`Mod(x, nf.pol)` as an algebraic number. This last\n        representation is more efficient and should be preferred if a given\n        automorphism must be used in many such calls.\n        \n        ::\n        \n             ? nf = nfinit(x^3 - 37*x^2 + 74*x - 37);\n             ? aut = nfgaloisconj(nf)[2]; \\\\  an automorphism in basistoalg form\n             %2 = -""31/11*x^2 + 1109/11*x - 925/11\n             ? AUT = nfalgtobasis(nf, aut); \\\\  same in algtobasis form\n             %3 = [16, -6, 5]~\n             ? v = [1, 2, 3]~; nfgaloisapply(nf, aut, v) == nfgaloisapply(nf, AUT, v)\n             %4 = 1 \\\\  same result...\n             ? for (i=1,10^5, nfgaloisapply(nf, aut, v))\n             time = 463 ms.\n             ? for (i=1,10^5, nfgaloisapply(nf, AUT, v))\n             time = 343 ms. \\\\  but the latter is faster\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1133nfgaloisapply(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_aut = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfgaloisapply (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_aut,&__pyx_n_s_x,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_aut)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgaloisapply", 1, 2, 2, 1); __PYX_ERR(10, 20101, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfgaloisapply") < 0)) __PYX_ERR(10, 20101, __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_aut = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfgaloisapply", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20101, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1132nfgaloisapply(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_aut, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1132nfgaloisapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_aut, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__aut;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfgaloisapply", 0);
  __Pyx_INCREF(__pyx_v_aut);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":20151
 *              time = 343 ms. \\  but the latter is faster
 *         '''
 *         aut = objtogen(aut)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_aut, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20151, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_aut, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20152
 *         '''
 *         aut = objtogen(aut)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20153
 *         aut = objtogen(aut)
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _aut = (<Gen>aut).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20153, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20154
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20155
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _aut = (<Gen>aut).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_aut)->__pyx_base.g;
  __pyx_v__aut = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20156
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20157
 *         cdef GEN _aut = (<Gen>aut).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisapply(__pyx_v__nf, __pyx_v__aut, __pyx_v__x);

  /* "cypari/auto_gen.pxi":20158
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = galoisapply(_nf, _aut, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfgaloisconj(nf, long flag=0, d=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20101
 *         return new_gen(_ret)
 * 
 *     def nfgaloisapply(nf, aut, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`nf` be a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfgaloisapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_aut);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20160
 *         return new_gen(_ret)
 * 
 *     def nfgaloisconj(nf, long flag=0, d=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being a number field as output by :literal:`nfinit`, computes the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1135nfgaloisconj(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1134nfgaloisconj[] = "\n        :math:`nf` being a number field as output by :literal:`nfinit`, computes the\n        conjugates of a root :math:`r` of the non-constant polynomial :math:`x = nf[1]`\n        expressed as polynomials in :math:`r`. This also makes sense when the number field\n        is not Galois since some conjugates may lie in the field.\n        :math:`nf` can simply be a polynomial.\n        \n        If no flags or :math:`flag = 0`, use a combination of flag :math:`4` and :math:`1` and the result\n        is always complete. There is no point whatsoever in using the other flags.\n        \n        If :math:`flag = 1`, use :literal:`nfroots`: a little slow, but guaranteed to work in\n        polynomial time.\n        \n        If :math:`flag = 4`, use :literal:`galoisinit`: very fast, but only applies to (most)\n        Galois fields. If the field is Galois with weakly super-solvable Galois\n        group (see :literal:`galoisinit`), return the complete list of automorphisms, else\n        only the identity element. If present, :math:`d` is assumed to be a multiple of the\n        least common denominator of the conjugates expressed as polynomial in a root\n        of :emphasis:`pol`.\n        \n        This routine can only compute :math:`\\mathbb{Q}`-automorphisms, but it may be used to get\n        :math:`K`-automorphism for any base field :math:`K` as follows:\n        \n        ::\n        \n            rnfgaloisconj(nfK, R) = \\\\ K-automorphisms of L = K[X] / (R)\n            {\n             my(polabs, N,al,S, ala,k, vR);\n             R *= Mod(1, nfK.pol); \\\\ convert coeffs to polmod elts of K\n             vR = variable(R);\n             al = Mod(variable(nfK.pol),nfK.pol);\n             [polabs,ala,k] = rnfequation(nfK, R, 1);\n             Rt = if(k==0,R,subst(R,vR,vR-al*k));\n             N = nfgaloisconj(polabs) % Rt; \\\\ Q-automorphisms of L\n             S = select(s->subst(Rt, vR, Mod(s,Rt)) == 0, N);\n             if (k==0, S, apply(s->subst(s,vR,vR""+k*al)-k*al,S));\n            }\n            K = nfinit(y^2 + 7);\n            rnfgaloisconj(K, x^4 - y*x^3 - 3*x^2 + y*x + 1) \\\\ K-automorphisms of L\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1135nfgaloisconj(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_d = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfgaloisconj (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_d,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfgaloisconj") < 0)) __PYX_ERR(10, 20160, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20160, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_d = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20160, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfgaloisconj", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20160, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfgaloisconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1134nfgaloisconj(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_flag, __pyx_v_d, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1134nfgaloisconj(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, long __pyx_v_flag, PyObject *__pyx_v_d, long __pyx_v_precision) {
  int __pyx_v__have_d;
  GEN __pyx_v__nf;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfgaloisconj", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":20201
 *             rnfgaloisconj(K, x^4 - y*x^3 - 3*x^2 + y*x + 1) \\ K-automorphisms of L
 *         '''
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_1 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_1;

  /* "cypari/auto_gen.pxi":20202
 *         '''
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_d != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":20203
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20203, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":20202
 *         '''
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":20204
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20204, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20205
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20206
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_gen.pxi":20207
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_d != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":20208
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_gen.pxi":20207
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":20209
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":20210
 *             _d = (<Gen>d).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = galoisconj0(__pyx_v__nf, __pyx_v_flag, __pyx_v__d, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":20211
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = galoisconj0(_nf, flag, _d, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfgrunwaldwang(nf, Lpr, Ld, pl, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20160
 *         return new_gen(_ret)
 * 
 *     def nfgaloisconj(nf, long flag=0, d=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`nf` being a number field as output by :literal:`nfinit`, computes the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfgaloisconj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20213
 *         return new_gen(_ret)
 * 
 *     def nfgrunwaldwang(nf, Lpr, Ld, pl, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :emphasis:`nf` a number field in :emphasis:`nf` or :emphasis:`bnf` format,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1137nfgrunwaldwang(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1136nfgrunwaldwang[] = "\n        Given :emphasis:`nf` a number field in :emphasis:`nf` or :emphasis:`bnf` format,\n        a :literal:`t_VEC` :emphasis:`Lpr` of primes of :emphasis:`nf` and a :literal:`t_VEC` :emphasis:`Ld` of\n        positive integers of the same length, a :literal:`t_VECSMALL` :emphasis:`pl` of length\n        :math:`r_1` the number of real places of :emphasis:`nf`, computes a polynomial with\n        coefficients in :emphasis:`nf` defining a cyclic extension of :emphasis:`nf` of\n        minimal degree satisfying certain local conditions:\n        \n        - at the prime\302\240:math:`Lpr[i]`, the extension has local degree a multiple\n          of\302\240:math:`Ld[i]`;\n        \n        - at the :math:`i`-th real place of :emphasis:`nf`, it is complex if :math:`pl[i] = -1`\n          (no condition if :math:`pl[i] = 0`).\n        \n        The extension has degree the LCM of the local degrees. Currently, the degree\n        is restricted to be a prime power for the search, and to be prime for the\n        construction because of the :literal:`rnfkummer` restrictions.\n        \n        When :emphasis:`nf` is :math:`\\mathbb{Q}`, prime integers are accepted instead of :literal:`prid`\n        structures. However, their primality is not checked and the behavior is\n        undefined if you provide a composite number.\n        \n        :strong:`Warning.` If the number field :emphasis:`nf` does not contain the :math:`n`-th\n        roots of unity where :math:`n` is the degree of the extension to be computed,\n        triggers the computation of the :emphasis:`bnf` of :math:`nf(\\zeta_n)`, which may be\n        costly.\n        \n        ::\n        \n            ? nf = nfinit(y^2-5);\n            ? pr = idealprimedec(nf,13)[1];\n            ? pol = nfgrunwaldwang(nf, [pr], [2], [0,-1], 'x)\n            %3 = x^2 + Mod(3/2*y + 13/2, y^2 - 5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1137nfgrunwaldwang(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Lpr = 0;
  PyObject *__pyx_v_Ld = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfgrunwaldwang (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Lpr,&__pyx_n_s_Ld,&__pyx_n_s_pl,&__pyx_n_s_v,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_Lpr)) != 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_Ld)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgrunwaldwang", 0, 3, 4, 1); __PYX_ERR(10, 20213, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfgrunwaldwang", 0, 3, 4, 2); __PYX_ERR(10, 20213, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfgrunwaldwang") < 0)) __PYX_ERR(10, 20213, __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_Lpr = values[0];
    __pyx_v_Ld = values[1];
    __pyx_v_pl = values[2];
    __pyx_v_v = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfgrunwaldwang", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20213, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfgrunwaldwang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1136nfgrunwaldwang(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_Lpr, __pyx_v_Ld, __pyx_v_pl, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1136nfgrunwaldwang(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_Lpr, PyObject *__pyx_v_Ld, PyObject *__pyx_v_pl, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__nf;
  GEN __pyx_v__Lpr;
  GEN __pyx_v__Ld;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("nfgrunwaldwang", 0);
  __Pyx_INCREF(__pyx_v_Lpr);
  __Pyx_INCREF(__pyx_v_Ld);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":20248
 *             %3 = x^2 + Mod(3/2*y + 13/2, y^2 - 5)
 *         '''
 *         Lpr = objtogen(Lpr)             # <<<<<<<<<<<<<<
 *         Ld = objtogen(Ld)
 *         pl = objtogen(pl)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Lpr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Lpr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20249
 *         '''
 *         Lpr = objtogen(Lpr)
 *         Ld = objtogen(Ld)             # <<<<<<<<<<<<<<
 *         pl = objtogen(pl)
 *         cdef long _v = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Ld, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20249, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Ld, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20250
 *         Lpr = objtogen(Lpr)
 *         Ld = objtogen(Ld)
 *         pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20251
 *         Ld = objtogen(Ld)
 *         pl = objtogen(pl)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":20252
 *         pl = objtogen(pl)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":20253
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 20253, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":20252
 *         pl = objtogen(pl)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":20254
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 20254, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20255
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 *         cdef GEN _Ld = (<Gen>Ld).g
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_6;

  /* "cypari/auto_gen.pxi":20256
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Lpr = (<Gen>Lpr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Ld = (<Gen>Ld).g
 *         cdef GEN _pl = (<Gen>pl).g
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Lpr)->__pyx_base.g;
  __pyx_v__Lpr = __pyx_t_6;

  /* "cypari/auto_gen.pxi":20257
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 *         cdef GEN _Ld = (<Gen>Ld).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Ld)->__pyx_base.g;
  __pyx_v__Ld = __pyx_t_6;

  /* "cypari/auto_gen.pxi":20258
 *         cdef GEN _Lpr = (<Gen>Lpr).g
 *         cdef GEN _Ld = (<Gen>Ld).g
 *         cdef GEN _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
  __pyx_v__pl = __pyx_t_6;

  /* "cypari/auto_gen.pxi":20259
 *         cdef GEN _Ld = (<Gen>Ld).g
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfgrunwaldwang(__pyx_v__nf, __pyx_v__Lpr, __pyx_v__Ld, __pyx_v__pl, __pyx_v__v);

  /* "cypari/auto_gen.pxi":20260
 *         cdef GEN _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfgrunwaldwang(_nf, _Lpr, _Ld, _pl, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfhilbert(nf, a, b, pr=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20213
 *         return new_gen(_ret)
 * 
 *     def nfgrunwaldwang(nf, Lpr, Ld, pl, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :emphasis:`nf` a number field in :emphasis:`nf` or :emphasis:`bnf` format,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfgrunwaldwang", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Lpr);
  __Pyx_XDECREF(__pyx_v_Ld);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20262
 *         return new_gen(_ret)
 * 
 *     def nfhilbert(nf, a, b, pr=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`pr` is omitted,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1139nfhilbert(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1138nfhilbert[] = "\n        If :emphasis:`pr` is omitted,\n        compute the global quadratic Hilbert symbol :math:`(a,b)` in :math:`nf`, that\n        is :math:`1` if :math:`x^2 - a y^2 - b z^2` has a non trivial solution :math:`(x,y,z)` in\n        :math:`nf`, and :math:`-1` otherwise. Otherwise compute the local symbol modulo\n        the prime ideal :emphasis:`pr`, as output by :literal:`idealprimedec`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1139nfhilbert(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfhilbert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_pr,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfhilbert", 0, 2, 3, 1); __PYX_ERR(10, 20262, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfhilbert") < 0)) __PYX_ERR(10, 20262, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_a = values[0];
    __pyx_v_b = values[1];
    __pyx_v_pr = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfhilbert", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20262, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1138nfhilbert(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_a, __pyx_v_b, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1138nfhilbert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_pr) {
  int __pyx_v__have_pr;
  GEN __pyx_v__nf;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__pr;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfhilbert", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":20270
 *         the prime ideal :emphasis:`pr`, as output by :literal:`idealprimedec`.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20271
 *         '''
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20272
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             pr = objtogen(pr)
 */
  __pyx_t_2 = (__pyx_v_pr != Py_None);
  __pyx_v__have_pr = __pyx_t_2;

  /* "cypari/auto_gen.pxi":20273
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":20274
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 *             pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":20273
 *         b = objtogen(b)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":20275
 *         if _have_pr:
 *             pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20275, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20276
 *             pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20277
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20278
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20279
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 */
  __pyx_v__pr = NULL;

  /* "cypari/auto_gen.pxi":20280
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":20281
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 *             _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
    __pyx_v__pr = __pyx_t_4;

    /* "cypari/auto_gen.pxi":20280
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 */
  }

  /* "cypari/auto_gen.pxi":20282
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = nfhilbert0(__pyx_v__nf, __pyx_v__a, __pyx_v__b, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":20283
 *             _pr = (<Gen>pr).g
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":20284
 *         cdef long _ret = nfhilbert0(_nf, _a, _b, _pr)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def nfhnf(nf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20262
 *         return new_gen(_ret)
 * 
 *     def nfhilbert(nf, a, b, pr=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         If :emphasis:`pr` is omitted,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20286
 *         return _ret
 * 
 *     def nfhnf(nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`, finds a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1141nfhnf(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1140nfhnf[] = "\n        Given a pseudo-matrix :math:`(A,I)`, finds a\n        pseudo-basis :math:`(B,J)` in Hermite normal form of the module it generates.\n        If :math:`flag` is non-zero, also return the transformation matrix :math:`U` such that\n        :math:`AU = [0\\|B]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1141nfhnf(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfhnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfhnf") < 0)) __PYX_ERR(10, 20286, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20286, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfhnf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20286, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1140nfhnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1140nfhnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfhnf", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":20293
 *         :math:`AU = [0\|B]`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20294
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20294, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20295
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20296
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20297
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfhnf0(__pyx_v__nf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":20298
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfhnf0(_nf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfhnfmod(nf, x, detx):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20286
 *         return _ret
 * 
 *     def nfhnf(nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`, finds a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20300
 *         return new_gen(_ret)
 * 
 *     def nfhnfmod(nf, x, detx):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1143nfhnfmod(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1142nfhnfmod[] = "\n        Given a pseudo-matrix :math:`(A,I)`\n        and an ideal :emphasis:`detx` which is contained in (read integral multiple of) the\n        determinant of :math:`(A,I)`, finds a pseudo-basis in Hermite normal form\n        of the module generated by :math:`(A,I)`. This avoids coefficient explosion.\n        :emphasis:`detx` can be computed using the function :literal:`nfdetint`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1143nfhnfmod(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_detx = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfhnfmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_detx,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfhnfmod", 1, 2, 2, 1); __PYX_ERR(10, 20300, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfhnfmod") < 0)) __PYX_ERR(10, 20300, __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_x = values[0];
    __pyx_v_detx = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfhnfmod", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20300, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfhnfmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1142nfhnfmod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_detx);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1142nfhnfmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_detx) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__detx;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfhnfmod", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_detx);

  /* "cypari/auto_gen.pxi":20308
 *         :emphasis:`detx` can be computed using the function :literal:`nfdetint`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         detx = objtogen(detx)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20308, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20309
 *         '''
 *         x = objtogen(x)
 *         detx = objtogen(detx)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_detx, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_detx, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20310
 *         x = objtogen(x)
 *         detx = objtogen(detx)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20310, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20311
 *         detx = objtogen(detx)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _detx = (<Gen>detx).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20312
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _detx = (<Gen>detx).g
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20313
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _detx = (<Gen>detx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_detx)->__pyx_base.g;
  __pyx_v__detx = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20314
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _detx = (<Gen>detx).g
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfhnfmod(__pyx_v__nf, __pyx_v__x, __pyx_v__detx);

  /* "cypari/auto_gen.pxi":20315
 *         cdef GEN _detx = (<Gen>detx).g
 *         cdef GEN _ret = nfhnfmod(_nf, _x, _detx)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfinit(pol, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20300
 *         return new_gen(_ret)
 * 
 *     def nfhnfmod(nf, x, detx):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`(A,I)`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfhnfmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_detx);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20317
 *         return new_gen(_ret)
 * 
 *     def nfinit(pol, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a non-constant,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1145nfinit(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1144nfinit[] = "\n        :emphasis:`pol` being a non-constant,\n        preferably monic, irreducible polynomial in :math:`\\mathbb{Z}[X]`, initializes a\n        :emphasis:`number field` structure (:literal:`nf`) attached to the field :math:`K` defined\n        by :emphasis:`pol`. As such, it's a technical object passed as the first argument\n        to most :literal:`nf`:emphasis:`xxx` functions, but it contains some information which\n        may be directly useful. Access to this information via :emphasis:`member\n        functions` is preferred since the specific data organization given below\n        may change in the future. Currently, :literal:`nf` is a row vector with 9\n        components:\n        \n        :math:`nf[1]` contains the polynomial :emphasis:`pol` (:literal:`:emphasis:`nf`.pol`).\n        \n        :math:`nf[2]` contains :math:`[r1,r2]` (:literal:`:emphasis:`nf`.sign`, :literal:`:emphasis:`nf`.r1`,\n        :literal:`:emphasis:`nf`.r2`), the number of real and complex places of :math:`K`.\n        \n        :math:`nf[3]` contains the discriminant :math:`d(K)` (:literal:`:emphasis:`nf`.disc`) of :math:`K`.\n        \n        :math:`nf[4]` contains the index of :math:`nf[1]` (:literal:`:emphasis:`nf`.index`),\n        i.e.\302\240:math:`[\\mathbb{Z}_K : \\mathbb{Z}[\\theta]]`, where :math:`\\theta` is any root of :math:`nf[1]`.\n        \n        :math:`nf[5]` is a vector containing 7 matrices :math:`M`, :math:`G`, :emphasis:`roundG`, :math:`T`,\n        :math:`MD`, :math:`TI`, :math:`MDI` useful for certain computations in the number field :math:`K`.\n        \n        \302\240\302\240:strong:`*` :math:`M` is the :math:`(r1+r2) x n` matrix whose columns represent\n        the numerical values of the conjugates of the elements of the integral\n        basis.\n        \n        \302\240\302\240:strong:`*` :math:`G` is an :math:`n x n` matrix such that :math:`T2 = ^t G G`,\n        where :math:`T2` is the quadratic form :math:`T_2(x) = \\sum \\|\\sigma (x)""\\|^2`, :math:`\\sigma`\n        running over the embeddings of :math:`K` into :math:`\\mathbb{C}`.\n        \n        \302\240\302\240:strong:`*` :emphasis:`roundG` is a rescaled copy of :math:`G`, rounded to nearest\n        integers.\n        \n        \302\240\302\240:strong:`*` :math:`T` is the :math:`n x n` matrix whose coefficients are\n        :math:`Tr(\\omega_i\\omega_j)` where the :math:`\\omega_i` are the elements of the\n        integral basis. Note also that :math:`\\det (T)` is equal to the discriminant of the\n        field :math:`K`. Also, when understood as an ideal, the matrix :math:`T^{-1}`\n        generates the codifferent ideal.\n        \n        \302\240\302\240:strong:`*` The columns of :math:`MD` (:literal:`:emphasis:`nf`.diff`) express a :math:`\\mathbb{Z}`-basis\n        of the different of :math:`K` on the integral basis.\n        \n        \302\240\302\240:strong:`*` :math:`TI` is equal to the primitive part of :math:`T^{-1}`, which has integral\n        coefficients.\n        \n        \302\240\302\240:strong:`*` Finally, :math:`MDI` is a two-element representation (for faster\n        ideal product) of :math:`d(K)` times the codifferent ideal\n        (:literal:`:emphasis:`nf`.disc:math:`*`:emphasis:`nf`.codiff`, which is an integral ideal). :math:`MDI`\n        is only used in :literal:`idealinv`.\n        \n        :math:`nf[6]` is the vector containing the :math:`r1+r2` roots\n        (:literal:`:emphasis:`nf`.roots`) of :math:`nf[1]` corresponding to the :math:`r1+r2`\n        embeddings of the number field into :math:`\\mathbb{C}` (the first :math:`r1` components are real,\n        the next :math:`r2` have positive imaginary part).\n        \n        :math:`nf[7]` is an integral basis for :math:`\\mathbb{Z}_K` (:literal:`:emphasis:`nf`.zk`) expressed\n        on the powers of\302\240:math:`\\theta`. Its first element is guaranteed to be :math:`1`. This\n        basis is LLL-reduced with respect to :math:`T_2` (strictly speaking,"" it is a\n        permutation of such a basis, due to the condition that the first element be\n        :math:`1`).\n        \n        :math:`nf[8]` is the :math:`n x n` integral matrix expressing the power\n        basis in terms of the integral basis, and finally\n        \n        :math:`nf[9]` is the :math:`n x n^2` matrix giving the multiplication table\n        of the integral basis.\n        \n        If a non monic polynomial is input, :literal:`nfinit` will transform it into a\n        monic one, then reduce it (see :math:`flag = 3`). It is allowed, though not very\n        useful given the existence of :literal:`nfnewprec`, to input a :emphasis:`nf` or a\n        :emphasis:`bnf` instead of a polynomial. It is also allowed to\n        input a :emphasis:`rnf`, in which case an :literal:`nf` structure attached to the\n        absolute defining polynomial :literal:`polabs` is returned (:emphasis:`flag` is then ignored).\n        \n        ::\n        \n            ? nf = nfinit(x^3 - 12); \\\\ initialize number field Q[X] / (X^3 - 12)\n            ? nf.pol \\\\ defining polynomial\n            %2 = x^3 - 12\n            ? nf.disc \\\\ field discriminant\n            %3 = -972\n            ? nf.index \\\\ index of power basis order in maximal order\n            %4 = 2\n            ? nf.zk \\\\ integer basis, lifted to Q[X]\n            %5 = [1, x, 1/2*x^2]\n            ? nf.sign \\\\ signature\n            %6 = [1, 1]\n            ? factor(abs(nf.disc )) \\\\ determines ramified primes\n            %7 =\n            [2 2]\n            \n            [3 5]\n            ? idealfactor(nf, 2)\n            %8 =\n            [[2, [0, 0, -1]~, 3, 1, [0, 1, 0]~] 3] \\\\  p_2^3\n        \n        :strong:`Huge discriminants, helping nfdisc.`\n        \n        In case :emphasis:`pol` has a huge discriminant which is difficult to factor,\n        it is hard to compute from scratch the maximal order. The special input\n        format :math:`[pol, B]` is also accepted where "":emphasis:`pol` is a polynomial as\n        above and :math:`B` has one of the following forms\n        \n        - an integer basis, as would be computed by :literal:`nfbasis`: a vector of\n          polynomials with first element :math:`1`. This is useful if the maximal order is\n          known in advance.\n        \n        - an argument :literal:`listP` which specifies a list of primes (see\n          :literal:`nfbasis`). Instead of the maximal order, :literal:`nfinit` then computes an\n          order which is maximal at these particular primes as well as the primes\n          contained in the private prime table (see :literal:`addprimes`). The result is\n          unconditionaly correct when the discriminant :literal:`nf.disc` factors\n          completely over this set of primes. The function :literal:`nfcertify` automates\n          this:\n        \n        ::\n        \n            ? pol = polcompositum(x^5 - 101, polcyclo(7))[1];\n            ? nf = nfinit( [pol, 10^3] );\n            ? nfcertify(nf)\n            %3 = []\n        \n        A priori, :literal:`nf.zk` defines an order which is only known\n        to be maximal at all primes :math:`<= 10^3` (no prime :math:`<= 10^3` divides\n        :literal:`nf.index`). The certification step proves the correctness of the\n        computation. Had it failed, that particular :literal:`nf` structure could\n        not have been trusted and may have caused routines using it to fail randomly.\n        One particular function that remains trustworthy in all cases is\n        :literal:`idealprimedec` when applied to a prime included in the above list\n        of primes or, more generally, a prime not dividing any entry in\n        :literal:`nfcertify` output.\n        \n        If :math:`flag = 2`: :emphasis:`pol` is changed into another polynomial :math:`P` defining the same\n        number field, which is as simple as can easily be found using the\n        :literal:`polredbest` algorithm, and all the subsequent"" computations are done\n        using this new polynomial. In particular, the first component of the result\n        is the modified polynomial.\n        \n        If :math:`flag = 3`, apply :literal:`polredbest` as in case 2, but outputs\n        :math:`[nf,Mod (a,P)]`, where :math:`nf` is as before and\n        :math:`Mod (a,P) = Mod (x,pol)` gives the change of\n        variables. This is implicit when :emphasis:`pol` is not monic: first a linear change\n        of variables is performed, to get a monic polynomial, then :literal:`polredbest`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1145nfinit(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfinit") < 0)) __PYX_ERR(10, 20317, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20317, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20317, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfinit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20317, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1144nfinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol), __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1144nfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfinit", 0);

  /* "cypari/auto_gen.pxi":20464
 *         of variables is performed, to get a monic polynomial, then :literal:`polredbest`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 20464, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20465
 *         '''
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_2;

  /* "cypari/auto_gen.pxi":20466
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":20467
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfinit0(__pyx_v__pol, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":20468
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfinit0(_pol, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfisideal(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 20468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20317
 *         return new_gen(_ret)
 * 
 *     def nfinit(pol, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a non-constant,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20470
 *         return new_gen(_ret)
 * 
 *     def nfisideal(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1147nfisideal(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1146nfisideal[] = "\n        Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1147nfisideal(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfisideal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1146nfisideal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1146nfisideal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfisideal", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":20474
 *         Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20475
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20475, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20476
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = isideal(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20477
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = isideal(_nf, _x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20478
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = isideal(_nf, _x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isideal(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":20479
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = isideal(_nf, _x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":20480
 *         cdef long _ret = isideal(_nf, _x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def nfisincl(f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20470
 *         return new_gen(_ret)
 * 
 *     def nfisideal(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`x` is an ideal in the number field :math:`nf`, 0 otherwise.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfisideal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20482
 *         return _ret
 * 
 *     def nfisincl(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` and :math:`g` define number fields, where :math:`f` and :math:`g` are irreducible
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1149nfisincl(PyObject *__pyx_v_f, PyObject *__pyx_v_g); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1148nfisincl[] = "\n        Let :math:`f` and :math:`g` define number fields, where :math:`f` and :math:`g` are irreducible\n        polynomials in :math:`\\mathbb{Q}[X]` and :emphasis:`nf` structures as output by :literal:`nfinit`.\n        Tests whether the number field :math:`f` is conjugate to a subfield of the field\n        :math:`g`. If they are not, the output is the integer 0. If they are, the output is\n        a vector of polynomials, each polynomial :math:`a` representing an embedding\n        i.e.\302\240being such that :math:`g \\| f o a`. If either :math:`f` or :math:`g` is not\n        irreducible, the result is undefined.\n        \n        ::\n        \n            ? T = x^6 + 3*x^4 - 6*x^3 + 3*x^2 + 18*x + 10;\n            ? U = x^3 + 3*x^2 + 3*x - 2\n            \n            ? v = nfisincl(U, T);\n            %2 = [24/179*x^5-27/179*x^4+80/179*x^3-234/179*x^2+380/179*x+94/179]\n            \n            ? subst(U, x, Mod(v[1],T))\n            %3 = Mod(0, x^6 + 3*x^4 - 6*x^3 + 3*x^2 + 18*x + 10)\n            ? #nfisincl(x^2+1, T) \\\\ two embeddings\n            %4 = 2\n            \n            \\\\ same result with nf structures\n            ? nfisincl(U, L = nfinit(T)) == v\n            %5 = 1\n            ? nfisincl(K = nfinit(U), T) == v\n            %6 = 1\n            ? nfisincl(K, L) == v\n            %7 = 1\n            \n            \\\\ comparative bench: an nf is a little faster, esp. for the subfield\n            ? B = 10^3;\n            ? for (i=1, B, nfisincl(U,T))\n            time = 712 ms.\n            \n            ? for (i=1, B, nfisincl(K,T))\n            time = 485 ms.\n            \n            ? for (i=1, B, nfisincl(U,L))\n            time = 704 ms.\n            \n            ? for (i=1, B, nfisincl(K,L))\n            time = 465 ms.\n        \n        Using an :emphasis:`nf` structure for the potential subfield is\n        faster if the structure is already available. On the other hand, the gain in\n        :literal:`nfisincl` is usually n""ot sufficient to make it worthwhile to initialize\n        only for that purpose.\n        \n        ::\n        \n            ? for (i=1, B, nfinit(U))\n            time = 308 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1149nfisincl(PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfisincl (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1148nfisincl(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_g));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1148nfisincl(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfisincl", 0);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_gen.pxi":20537
 *             time = 308 ms.
 *         '''
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20538
 *         '''
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20538, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20539
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisincl(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20540
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfisincl(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20541
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisincl(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfisincl(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_gen.pxi":20542
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisincl(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfisisom(f, g):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20482
 *         return _ret
 * 
 *     def nfisincl(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`f` and :math:`g` define number fields, where :math:`f` and :math:`g` are irreducible
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfisincl", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20544
 *         return new_gen(_ret)
 * 
 *     def nfisisom(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :literal:`nfisincl`, but tests for isomorphism. More efficient if
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1151nfisisom(PyObject *__pyx_v_f, PyObject *__pyx_v_g); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1150nfisisom[] = "\n        As :literal:`nfisincl`, but tests for isomorphism. More efficient if\n        :math:`f` or :math:`g` is a number field structure.\n        \n        ::\n        \n            ? f = x^6 + 30*x^5 + 495*x^4 + 1870*x^3 + 16317*x^2 - 22560*x + 59648;\n            ? g = x^6 + 42*x^5 + 999*x^4 + 8966*x^3 + 36117*x^2 + 21768*x + 159332;\n            ? h = x^6 + 30*x^5 + 351*x^4 + 2240*x^3 + 10311*x^2 + 35466*x + 58321;\n            \n            ? #nfisisom(f,g) \\\\ two isomorphisms\n            %3 = 2\n            ? nfisisom(f,h) \\\\ not isomorphic\n            %4 = 0\n            \\\\ comparative bench\n            ? K = nfinit(f); L = nfinit(g); B = 10^3;\n            ? for (i=1, B, nfisisom(f,g))\n            time = 6,124 ms.\n            ? for (i=1, B, nfisisom(K,g))\n            time = 3,356 ms.\n            ? for (i=1, B, nfisisom(f,L))\n            time = 3,204 ms.\n            ? for (i=1, B, nfisisom(K,L))\n            time = 3,173 ms.\n        \n        The function is usually very fast when the fields are non-isomorphic,\n        whenever the fields can be distinguished via a simple invariant such as\n        degree, signature or discriminant. It may be slower when the fields\n        share all invariants, but still faster than computing actual isomorphisms:\n        \n        ::\n        \n            \\\\ usually very fast when the answer is 'no':\n            ? for (i=1, B, nfisisom(f,h))\n            time = 32 ms.\n            \n            \\\\ but not always\n            ? u = x^6 + 12*x^5 + 6*x^4 - 377*x^3 - 714*x^2 + 5304*x + 15379\n            ? v = x^6 + 12*x^5 + 60*x^4 + 166*x^3 + 708*x^2 + 6600*x + 23353\n            ? nfisisom(u,v)\n            %13 = 0\n            ? polsturm(u) == polsturm(v)\n            %14 = 1\n            ? nfdisc(u) == nfdisc(v)\n            %15 = 1\n            ? for(i=1,B, nfisisom(u,v))\n            time = 1,821 ms.\n            ? K = nfinit(u); L = nfinit(v);\n            ? for(i=1,B, nfisisom(K,v))\n           "" time = 232 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1151nfisisom(PyObject *__pyx_v_f, PyObject *__pyx_v_g) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfisisom (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1150nfisisom(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_g));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1150nfisisom(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_g) {
  GEN __pyx_v__f;
  GEN __pyx_v__g;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfisisom", 0);
  __Pyx_INCREF(__pyx_v_g);

  /* "cypari/auto_gen.pxi":20596
 *             time = 232 ms.
 *         '''
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20596, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20597
 *         '''
 *         g = objtogen(g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20597, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20598
 *         g = objtogen(g)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisisom(_f, _g)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20599
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfisisom(_f, _g)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20600
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisisom(_f, _g)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfisisom(__pyx_v__f, __pyx_v__g);

  /* "cypari/auto_gen.pxi":20601
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _ret = nfisisom(_f, _g)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfislocalpower(nf, pr, a, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20544
 *         return new_gen(_ret)
 * 
 *     def nfisisom(f, g):             # <<<<<<<<<<<<<<
 *         r'''
 *         As :literal:`nfisincl`, but tests for isomorphism. More efficient if
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfisisom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20603
 *         return new_gen(_ret)
 * 
 *     def nfislocalpower(nf, pr, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`K`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1153nfislocalpower(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1152nfislocalpower[] = "\n        Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`K`,\n        let :math:`a \\in K` and let :emphasis:`pr` be a :emphasis:`prid` structure attached to a\n        maximal ideal :math:`v`. Return :math:`1` if :math:`a` is an :math:`n`-th power in the completed\n        local field :math:`K_v`, and :math:`0` otherwise.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K,2)[1]; \\\\ the ramified prime above 2\n            ? nfislocalpower(K,P,-1, 2) \\\\ -1 is a square\n            %3 = 1\n            ? nfislocalpower(K,P,-1, 4) \\\\ ... but not a 4-th power\n            %4 = 0\n            ? nfislocalpower(K,P,2, 2) \\\\ 2 is not a square\n            %5 = 0\n            \n            ? Q = idealprimedec(K,5)[1]; \\\\ a prime above 5\n            ? nfislocalpower(K,Q, [0, 32]~, 30) \\\\ 32*I is locally a 30-th power\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1153nfislocalpower(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfislocalpower (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pr,&__pyx_n_s_a,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfislocalpower", 1, 3, 3, 1); __PYX_ERR(10, 20603, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfislocalpower", 1, 3, 3, 2); __PYX_ERR(10, 20603, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfislocalpower") < 0)) __PYX_ERR(10, 20603, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_pr = values[0];
    __pyx_v_a = values[1];
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfislocalpower", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20603, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfislocalpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1152nfislocalpower(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pr, __pyx_v_a, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1152nfislocalpower(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr, PyObject *__pyx_v_a, PyObject *__pyx_v_n) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__a;
  GEN __pyx_v__n;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfislocalpower", 0);
  __Pyx_INCREF(__pyx_v_pr);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_n);

  /* "cypari/auto_gen.pxi":20625
 *             %7 = 1
 *         '''
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         n = objtogen(n)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20626
 *         '''
 *         pr = objtogen(pr)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         n = objtogen(n)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20627
 *         pr = objtogen(pr)
 *         a = objtogen(a)
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20628
 *         a = objtogen(a)
 *         n = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20628, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20629
 *         n = objtogen(n)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20630
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20631
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20632
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20633
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = nfislocalpower(__pyx_v__nf, __pyx_v__pr, __pyx_v__a, __pyx_v__n);

  /* "cypari/auto_gen.pxi":20634
 *         cdef GEN _n = (<Gen>n).g
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":20635
 *         cdef long _ret = nfislocalpower(_nf, _pr, _a, _n)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def nfkermodpr(nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20635, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20603
 *         return new_gen(_ret)
 * 
 *     def nfislocalpower(nf, pr, a, n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`nf` be a :emphasis:`nf` structure attached to a number field :math:`K`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfislocalpower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20637
 *         return _ret
 * 
 *     def nfkermodpr(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1155nfkermodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1154nfkermodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Kernel of the matrix :math:`a` in :math:`\\mathbb{Z}_K/pr`, where :emphasis:`pr` is in\n        :strong:`modpr` format (see :literal:`nfmodprinit`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1155nfkermodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfkermodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_pr,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfkermodpr", 1, 2, 2, 1); __PYX_ERR(10, 20637, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfkermodpr") < 0)) __PYX_ERR(10, 20637, __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_x = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfkermodpr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20637, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfkermodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1154nfkermodpr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1154nfkermodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfkermodpr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":20644
 *         :strong:`modpr` format (see :literal:`nfmodprinit`).
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20644, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20645
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__65, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20646
 *         from warnings import warn
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20647
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20648
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20648, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20649
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20650
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20651
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20652
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfkermodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":20653
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfkermodpr(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfmodpr(nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20637
 *         return _ret
 * 
 *     def nfkermodpr(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfkermodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20655
 *         return new_gen(_ret)
 * 
 *     def nfmodpr(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Map :math:`x` to a :literal:`t_FFELT` in the residue field modulo :emphasis:`pr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1157nfmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1156nfmodpr[] = "\n        Map :math:`x` to a :literal:`t_FFELT` in the residue field modulo :emphasis:`pr`.\n        The argument :emphasis:`pr` is either a maximal ideal in :literal:`idealprimedec`\n        format or, preferably, a :emphasis:`modpr` structure from :literal:`nfmodprinit`. The\n        function :literal:`nfmodprlift` allows to lift back to :math:`\\mathbb{Z}_K`.\n        \n        Note that the function applies to number field elements and not to\n        vector / matrices / polynomials of such. Use :literal:`apply` to convert\n        recursive structures.\n        \n        ::\n        \n            ? K = nfinit(y^3-250);\n            ? P = idealprimedec(K, 5)[2];\n            ? modP = nfmodprinit(K,P);\n            ? K.zk\n            %4 = [1, 1/5*y, 1/25*y^2]\n            ? apply(t->nfmodpr(K,t,modP), K.zk)\n            %5 = [1, y, 2*y + 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1157nfmodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfmodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_pr,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfmodpr", 1, 2, 2, 1); __PYX_ERR(10, 20655, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfmodpr") < 0)) __PYX_ERR(10, 20655, __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_x = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfmodpr", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20655, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1156nfmodpr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1156nfmodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfmodpr", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":20676
 *             %5 = [1, y, 2*y + 1]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20676, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20677
 *         '''
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20678
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20678, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20679
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20680
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20681
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20682
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmodpr(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":20683
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodpr(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfmodprinit(nf, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20683, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20655
 *         return new_gen(_ret)
 * 
 *     def nfmodpr(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Map :math:`x` to a :literal:`t_FFELT` in the residue field modulo :emphasis:`pr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfmodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20685
 *         return new_gen(_ret)
 * 
 *     def nfmodprinit(nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the prime ideal :emphasis:`pr` into :literal:`modpr` format necessary
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1159nfmodprinit(PyObject *__pyx_v_nf, PyObject *__pyx_v_pr); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1158nfmodprinit[] = "\n        Transforms the prime ideal :emphasis:`pr` into :literal:`modpr` format necessary\n        for all operations modulo :emphasis:`pr` in the number field :emphasis:`nf`.\n        The functions :literal:`nfmodpr` and :literal:`nfmodprlift` allow to project\n        to and lift from the residue field.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1159nfmodprinit(PyObject *__pyx_v_nf, PyObject *__pyx_v_pr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfmodprinit (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1158nfmodprinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_pr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1158nfmodprinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfmodprinit", 0);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":20692
 *         to and lift from the residue field.
 *         '''
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20693
 *         '''
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20693, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20694
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20695
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20696
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmodprinit(__pyx_v__nf, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":20697
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprinit(_nf, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfmodprlift(nf, x, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20685
 *         return new_gen(_ret)
 * 
 *     def nfmodprinit(nf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the prime ideal :emphasis:`pr` into :literal:`modpr` format necessary
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfmodprinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20699
 *         return new_gen(_ret)
 * 
 *     def nfmodprlift(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lift the :literal:`t_FFELT` :math:`x` (from :literal:`nfmodpr`) in the residue field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1161nfmodprlift(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1160nfmodprlift[] = "\n        Lift the :literal:`t_FFELT` :math:`x` (from :literal:`nfmodpr`) in the residue field\n        modulo :emphasis:`pr` to the ring of integers. Vectors and matrices are also\n        supported. For polynomials, use :literal:`apply` and the present function.\n        \n        The argument :emphasis:`pr` is either a maximal ideal in :literal:`idealprimedec`\n        format or, preferably, a :emphasis:`modpr` structure from :literal:`nfmodprinit`.\n        There are no compatibility checks to try and decide whether :math:`x` is attached\n        the same residue field as defined by :emphasis:`pr`: the result is undefined\n        if not.\n        \n        The function :literal:`nfmodpr` allows to reduce to the residue field.\n        \n        ::\n        \n            ? K = nfinit(y^3-250);\n            ? P = idealprimedec(K, 5)[2];\n            ? modP = nfmodprinit(K,P);\n            ? K.zk\n            %4 = [1, 1/5*y, 1/25*y^2]\n            ? apply(t->nfmodpr(K,t,modP), K.zk)\n            %5 = [1, y, 2*y + 1]\n            ? nfmodprlift(K, %, modP)\n            %6 = [1, 1/5*y, 2/5*y + 1]\n            ? nfeltval(K, %[3] - K.zk[3], P)\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1161nfmodprlift(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_pr = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfmodprlift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_pr,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfmodprlift", 1, 2, 2, 1); __PYX_ERR(10, 20699, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfmodprlift") < 0)) __PYX_ERR(10, 20699, __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_x = values[0];
    __pyx_v_pr = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfmodprlift", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20699, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfmodprlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1160nfmodprlift(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_pr);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1160nfmodprlift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, PyObject *__pyx_v_pr) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfmodprlift", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":20727
 *             %7 = 1
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20728
 *         '''
 *         x = objtogen(x)
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20729
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20729, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20730
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20731
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20732
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20733
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfmodprlift(__pyx_v__nf, __pyx_v__x, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":20734
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = nfmodprlift(_nf, _x, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfnewprec(nf, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20734, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20699
 *         return new_gen(_ret)
 * 
 *     def nfmodprlift(nf, x, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Lift the :literal:`t_FFELT` :math:`x` (from :literal:`nfmodpr`) in the residue field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfmodprlift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20736
 *         return new_gen(_ret)
 * 
 *     def nfnewprec(nf, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the number field :math:`nf`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1163nfnewprec(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1162nfnewprec[] = "\n        Transforms the number field :math:`nf`\n        into the corresponding data using current (usually larger) precision. This\n        function works as expected if :emphasis:`nf` is in fact a :emphasis:`bnf` or a :emphasis:`bnr`\n        (update structure to current precision) but may be quite slow: many\n        generators of principal ideals have to be computed; note that in this latter\n        case, the :emphasis:`bnf` must contain fundamental units.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1163nfnewprec(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfnewprec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfnewprec") < 0)) __PYX_ERR(10, 20736, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20736, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfnewprec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20736, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfnewprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1162nfnewprec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1162nfnewprec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, long __pyx_v_precision) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfnewprec", 0);

  /* "cypari/auto_gen.pxi":20745
 *         case, the :emphasis:`bnf` must contain fundamental units.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 20745, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20746
 *         '''
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfnewprec(_nf, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":20747
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfnewprec(_nf, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":20748
 *         cdef GEN _nf = (<Gen>nf).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfnewprec(_nf, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfnewprec(__pyx_v__nf, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":20749
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = nfnewprec(_nf, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfpolsturm(nf, T, pl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 20749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20736
 *         return new_gen(_ret)
 * 
 *     def nfnewprec(nf, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Transforms the number field :math:`nf`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfnewprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20751
 *         return new_gen(_ret)
 * 
 *     def nfpolsturm(nf, T, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with coefficients in the number field :emphasis:`nf`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1165nfpolsturm(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1164nfpolsturm[] = "\n        Given a polynomial :math:`T` with coefficients in the number field :emphasis:`nf`,\n        returns the number of real roots of the :math:`s(T)` where :math:`s` runs through\n        the real embeddings of the field specified by optional argument :emphasis:`pl`:\n        \n        - :emphasis:`pl` omitted: all :math:`r_1` real places;\n        \n        - :emphasis:`pl` an integer between :math:`1` and :math:`r_1`: the embedding attached to\n          the :math:`i`-th real root of :literal:`nf.pol`, i.e. :literal:`nf.roots:math:`[i]``;\n        \n        - :emphasis:`pl` a vector or :literal:`t_VECSMALL`: the embeddings\n          attached to the :math:`pl[i]`-th real roots of :literal:`nf.pol`.\n        \n        ::\n        \n            ? nf = nfinit('y^2 - 2);\n            ? nf.sign\n            %2 = [2, 0]\n            ? nf.roots\n            %3 = [-1.414..., 1.414...]\n            ? T = x^2 + 'y;\n            ? nfpolsturm(nf, T, 1) \\\\ subst(T,y,sqrt(2)) has two real roots\n            %5 = 2\n            ? nfpolsturm(nf, T, 2) \\\\ subst(T,y,-sqrt(2)) has no real root\n            %6 = 0\n            ? nfpolsturm(nf, T) \\\\ all embeddings together\n            %7 = [2, 0]\n            ? nfpolsturm(nf, T, [2,1]) \\\\ second then first embedding\n            %8 = [0, 2]\n            ? nfpolsturm(nf, x^3) \\\\ number of distinct roots !\n            %9 = [1, 1]\n            ? nfpolsturm(nf, x, 6) \\\\ there are only 2 real embeddings !\n             *** at top-level: nfpolsturm(nf,x,6)\n             *** ^-----------------\n             *** nfpolsturm: domain error in nfpolsturm: index > 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1165nfpolsturm(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_pl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfpolsturm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_pl,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pl);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfpolsturm") < 0)) __PYX_ERR(10, 20751, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    __pyx_v_pl = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfpolsturm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20751, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfpolsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1164nfpolsturm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_T, __pyx_v_pl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1164nfpolsturm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_pl) {
  int __pyx_v__have_pl;
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__pl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfpolsturm", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_pl);

  /* "cypari/auto_gen.pxi":20788
 *              *** nfpolsturm: domain error in nfpolsturm: index > 2
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20789
 *         '''
 *         T = objtogen(T)
 *         cdef bint _have_pl = (pl is not None)             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             pl = objtogen(pl)
 */
  __pyx_t_2 = (__pyx_v_pl != Py_None);
  __pyx_v__have_pl = __pyx_t_2;

  /* "cypari/auto_gen.pxi":20790
 *         T = objtogen(T)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":20791
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:
 *             pl = objtogen(pl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20791, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":20790
 *         T = objtogen(T)
 *         cdef bint _have_pl = (pl is not None)
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             pl = objtogen(pl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":20792
 *         if _have_pl:
 *             pl = objtogen(pl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20792, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20793
 *             pl = objtogen(pl)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20794
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20795
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL             # <<<<<<<<<<<<<<
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 */
  __pyx_v__pl = NULL;

  /* "cypari/auto_gen.pxi":20796
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 */
  __pyx_t_2 = (__pyx_v__have_pl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":20797
 *         cdef GEN _pl = NULL
 *         if _have_pl:
 *             _pl = (<Gen>pl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pl)->__pyx_base.g;
    __pyx_v__pl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":20796
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _pl = NULL
 *         if _have_pl:             # <<<<<<<<<<<<<<
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 */
  }

  /* "cypari/auto_gen.pxi":20798
 *         if _have_pl:
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfpolsturm(__pyx_v__nf, __pyx_v__T, __pyx_v__pl);

  /* "cypari/auto_gen.pxi":20799
 *             _pl = (<Gen>pl).g
 *         cdef GEN _ret = nfpolsturm(_nf, _T, _pl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfroots(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20751
 *         return new_gen(_ret)
 * 
 *     def nfpolsturm(nf, T, pl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with coefficients in the number field :emphasis:`nf`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfpolsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_pl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20801
 *         return new_gen(_ret)
 * 
 *     def nfroots(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Roots of the polynomial :math:`x` in the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1167nfroots(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1166nfroots[] = "\n        Roots of the polynomial :math:`x` in the\n        number field :math:`nf` given by :literal:`nfinit` without multiplicity (in :math:`\\mathbb{Q}`\n        if :math:`nf` is omitted). :math:`x` has coefficients in the number field (scalar,\n        polmod, polynomial, column vector). The main variable of :math:`nf` must be\n        of lower priority than that of :math:`x` (see ``priority`` (in the PARI manual)). However if the\n        coefficients of the number field occur explicitly (as polmods) as\n        coefficients of :math:`x`, the variable of these polmods :emphasis:`must` be the same as\n        the main variable of :math:`t` (see :literal:`nffactor`).\n        \n        It is possible to input a defining polynomial for :emphasis:`nf`\n        instead, but this is in general less efficient since parts of an :literal:`nf`\n        structure will then be computed internally. This is useful in two\n        situations: when you do not need the :literal:`nf` elsewhere, or when you cannot\n        initialize an :literal:`nf` due to integer factorization difficulties when\n        attempting to compute the field discriminant and maximal order.\n        \n        :strong:`Caveat.` :literal:`nfinit([T, listP])` allows to compute in polynomial\n        time a conditional :emphasis:`nf` structure, which sets :literal:`nf.zk` to an order\n        which is not guaranteed to be maximal at all primes. Always either use\n        :literal:`nfcertify` first (which may not run in polynomial time) or make sure\n        to input :literal:`nf.pol` instead of the conditional :emphasis:`nf`: :literal:`nfroots` is\n        able to recover in polynomial time in this case, instead of potentially\n        missing a factor.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1167nfroots(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfroots (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1166nfroots(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1166nfroots(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfroots", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":20827
 *         missing a factor.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20828
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20828, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20829
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfroots(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20830
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfroots(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20831
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfroots(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfroots(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":20832
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfroots(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfrootsof1(nf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20801
 *         return new_gen(_ret)
 * 
 *     def nfroots(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Roots of the polynomial :math:`x` in the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20834
 *         return new_gen(_ret)
 * 
 *     def nfrootsof1(nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a two-component vector :math:`[w,z]` where :math:`w` is the number of roots of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1169nfrootsof1(PyObject *__pyx_v_nf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1168nfrootsof1[] = "\n        Returns a two-component vector :math:`[w,z]` where :math:`w` is the number of roots of\n        unity in the number field :emphasis:`nf`, and :math:`z` is a primitive :math:`w`-th root\n        of unity.\n        \n        ::\n        \n            ? K = nfinit(polcyclo(11));\n            ? nfrootsof1(K)\n            %2 = [22, [0, 0, 0, 0, 0, -1, 0, 0, 0, 0]~]\n            ? z = nfbasistoalg(K, %[2]) \\\\ in algebraic form\n            %3 = Mod(-x^5, x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1)\n            ? [lift(z^11), lift(z^2)] \\\\ proves that the order of z is 22\n            %4 = [-1, -x^9 - x^8 - x^7 - x^6 - x^5 - x^4 - x^3 - x^2 - x - 1]\n        \n        This function guesses the number :math:`w` as the gcd of the :math:`\\#k(v)^*` for\n        unramified :math:`v` above odd primes, then computes the roots in :emphasis:`nf`\n        of the :math:`w`-th cyclotomic polynomial: the algorithm is polynomial time with\n        respect to the field degree and the bitsize of the multiplication table in\n        :emphasis:`nf` (both of them polynomially bounded in terms of the size of the\n        discriminant). Fields of degree up to :math:`100` or so should require less than\n        one minute.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1169nfrootsof1(PyObject *__pyx_v_nf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfrootsof1 (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1168nfrootsof1(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1168nfrootsof1(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf) {
  GEN __pyx_v__nf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfrootsof1", 0);

  /* "cypari/auto_gen.pxi":20858
 *         one minute.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = rootsof1(_nf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 20858, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20859
 *         '''
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rootsof1(_nf)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":20860
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = rootsof1(_nf)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rootsof1(__pyx_v__nf);

  /* "cypari/auto_gen.pxi":20861
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _ret = rootsof1(_nf)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsnf(nf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 20861, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20834
 *         return new_gen(_ret)
 * 
 *     def nfrootsof1(nf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a two-component vector :math:`[w,z]` where :math:`w` is the number of roots of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfrootsof1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20863
 *         return new_gen(_ret)
 * 
 *     def nfsnf(nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a torsion :math:`\mathbb{Z}_K`-module :math:`x` attached to the square integral
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1171nfsnf(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1170nfsnf[] = "\n        Given a torsion :math:`\\mathbb{Z}_K`-module :math:`x` attached to the square integral\n        invertible pseudo-matrix :math:`(A,I,J)`, returns an ideal list\n        :math:`D = [d_1,...,d_n]` which is the Smith normal form of :math:`x`. In other\n        words, :math:`x` is isomorphic to :math:`\\mathbb{Z}_K/d_1\\oplus...\\oplus\\mathbb{Z}_K/d_n` and :math:`d_i`\n        divides :math:`d_{i-1}` for :math:`i >= 2`. If :math:`flag` is non-zero return :math:`[D,U,V]`, where\n        :math:`UAV` is the identity.\n        \n        See ``ZKmodules`` (in the PARI manual) for the definition of integral pseudo-matrix;\n        briefly, it is input as a 3-component row vector :math:`[A,I,J]` where\n        :math:`I = [b_1,...,b_n]` and :math:`J = [a_1,...,a_n]` are two ideal lists,\n        and :math:`A` is a square :math:`n x n` matrix with columns :math:`(A_1,...,A_n)`,\n        seen as elements in :math:`K^n` (with canonical basis :math:`(e_1,...,e_n)`).\n        This data defines the :math:`\\mathbb{Z}_K` module :math:`x` given by\n        \n        .. MATH::\n        \n            (b_1e_1\\oplus...\\oplus b_ne_n) / (a_1A_1\\oplus...\\oplus a_nA_n)\n            ,\n        \n        The integrality condition is :math:`a_{i,j} \\in b_i a_j^{-1}` for all :math:`i,j`. If it\n        is not satisfied, then the :math:`d_i` will not be integral. Note that every\n        finitely generated torsion module is isomorphic to a module of this form and\n        even with :math:`b_i = Z_K` for all :math:`i`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1171nfsnf(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsnf (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsnf") < 0)) __PYX_ERR(10, 20863, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20863, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsnf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20863, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1170nfsnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1170nfsnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("nfsnf", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":20889
 *         even with :math:`b_i = Z_K` for all :math:`i`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20889, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":20890
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 20890, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20891
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20892
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":20893
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsnf0(__pyx_v__nf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":20894
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = nfsnf0(_nf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsolvemodpr(nf, a, b, P):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20863
 *         return new_gen(_ret)
 * 
 *     def nfsnf(nf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a torsion :math:`\mathbb{Z}_K`-module :math:`x` attached to the square integral
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20896
 *         return new_gen(_ret)
 * 
 *     def nfsolvemodpr(nf, a, b, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1173nfsolvemodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1172nfsolvemodpr[] = "\n        This function is obsolete, use :literal:`nfmodpr`.\n        \n        Let :math:`P` be a prime ideal in :strong:`modpr` format (see :literal:`nfmodprinit`),\n        let :math:`a` be a matrix, invertible over the residue field, and let :math:`b` be\n        a column vector or matrix. This function returns a solution of :math:`a.x =\n        b`; the coefficients of :math:`x` are lifted to :emphasis:`nf` elements.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? P = idealprimedec(K, 3)[1];\n            ? P = nfmodprinit(K, P);\n            ? a = [y+1, y; y, 0]; b = [1, y]~\n            ? nfsolvemodpr(K, a,b, P)\n            %5 = [1, 2]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1173nfsolvemodpr(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_P = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsolvemodpr (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_P,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 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_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfsolvemodpr", 1, 3, 3, 1); __PYX_ERR(10, 20896, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_P)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfsolvemodpr", 1, 3, 3, 2); __PYX_ERR(10, 20896, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsolvemodpr") < 0)) __PYX_ERR(10, 20896, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_a = values[0];
    __pyx_v_b = values[1];
    __pyx_v_P = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsolvemodpr", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20896, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsolvemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1172nfsolvemodpr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_a, __pyx_v_b, __pyx_v_P);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1172nfsolvemodpr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_P) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__a;
  GEN __pyx_v__b;
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfsolvemodpr", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_P);

  /* "cypari/auto_gen.pxi":20914
 *             %5 = [1, 2]~
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         a = objtogen(a)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20914, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 20914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20915
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         b = objtogen(b)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__66, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20916
 *         from warnings import warn
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         b = objtogen(b)
 *         P = objtogen(P)
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20917
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)
 *         a = objtogen(a)
 *         b = objtogen(b)             # <<<<<<<<<<<<<<
 *         P = objtogen(P)
 *         sig_on()
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20918
 *         a = objtogen(a)
 *         b = objtogen(b)
 *         P = objtogen(P)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_P, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20918, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_P, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":20919
 *         b = objtogen(b)
 *         P = objtogen(P)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20919, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20920
 *         P = objtogen(P)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20921
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20922
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
  __pyx_v__b = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20923
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20924
 *         cdef GEN _b = (<Gen>b).g
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsolvemodpr(__pyx_v__nf, __pyx_v__a, __pyx_v__b, __pyx_v__P);

  /* "cypari/auto_gen.pxi":20925
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _ret = nfsolvemodpr(_nf, _a, _b, _P)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsplitting(P, d=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20896
 *         return new_gen(_ret)
 * 
 *     def nfsolvemodpr(nf, a, b, P):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`nfmodpr`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsolvemodpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_P);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20927
 *         return new_gen(_ret)
 * 
 *     def nfsplitting(P, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Defining polynomial over:math:`\mathbb{Q}` for the splitting field of :emphasis:`P`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1175nfsplitting(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1174nfsplitting[] = "\n        Defining polynomial over\302\240:math:`\\mathbb{Q}` for the splitting field of :emphasis:`P`,\n        that is the smallest field over which :math:`P` is totally split. If :math:`P`\n        can also be given by a\302\240:literal:`nf` structure, which is more efficient.\n        If :math:`d` is given, it must be a multiple of the splitting field degree.\n        Note that if :math:`P` is reducible the splitting field degree can be smaller\n        than the degree of :math:`P`.\n        \n        ::\n        \n            ? K = nfinit(x^3-2);\n            ? nfsplitting(K)\n            %2 = x^6 + 108\n            ? nfsplitting(x^8-2)\n            %3 = x^16 + 272*x^8 + 64\n            ? S = nfsplitting(x^6-8) // reducible\n            %4 = x^4+2*x^2+4\n            ? lift(nfroots(subst(S,x,a),x^6-8))\n            %5 = [-a,a,-1/2*a^3-a,-1/2*a^3,1/2*a^3,1/2*a^3+a]\n        \n        Specifying the degree of the splitting field can make the computation faster.\n        \n        ::\n        \n            ? nfsplitting(x^17-123);\n            time = 3,607 ms.\n            ? poldegree(%)\n            %2 = 272\n            ? nfsplitting(x^17-123,272);\n            time = 150 ms.\n            ? nfsplitting(x^17-123,273);\n             *** nfsplitting: Warning: ignoring incorrect degree bound 273\n            time = 3,611 ms.\n        \n        The complexity of the algorithm is polynomial in the degree :math:`d` of the\n        splitting field and the bitsize of :math:`T`; if :math:`d` is large the result will\n        likely be unusable, e.g. :literal:`nfinit` will not be an option:\n        \n        ::\n        \n            ? nfsplitting(x^6-x-1)\n            [... degree 720 polynomial deleted ...]\n            time = 11,020 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1175nfsplitting(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsplitting (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsplitting") < 0)) __PYX_ERR(10, 20927, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_d = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsplitting", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20927, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsplitting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1174nfsplitting(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_P), __pyx_v_d);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1174nfsplitting(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, PyObject *__pyx_v_d) {
  int __pyx_v__have_d;
  GEN __pyx_v__P;
  GEN __pyx_v__d;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("nfsplitting", 0);
  __Pyx_INCREF(__pyx_v_d);

  /* "cypari/auto_gen.pxi":20972
 *             time = 11,020 ms.
 *         '''
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_1 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_1;

  /* "cypari/auto_gen.pxi":20973
 *         '''
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_d != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":20974
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20974, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":20973
 *         '''
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":20975
 *         if _have_d:
 *             d = objtogen(d)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 20975, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20976
 *             d = objtogen(d)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_gen.pxi":20977
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_gen.pxi":20978
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)
 */
  __pyx_t_1 = (__pyx_v__have_d != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":20979
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsplitting(_P, _d)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_gen.pxi":20978
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)
 */
  }

  /* "cypari/auto_gen.pxi":20980
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsplitting(__pyx_v__P, __pyx_v__d);

  /* "cypari/auto_gen.pxi":20981
 *             _d = (<Gen>d).g
 *         cdef GEN _ret = nfsplitting(_P, _d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def nfsubfields(pol, long d=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 20981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20927
 *         return new_gen(_ret)
 * 
 *     def nfsplitting(P, d=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Defining polynomial over:math:`\mathbb{Q}` for the splitting field of :emphasis:`P`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsplitting", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20983
 *         return new_gen(_ret)
 * 
 *     def nfsubfields(pol, long d=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds all subfields of degree
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1177nfsubfields(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1176nfsubfields[] = "\n        Finds all subfields of degree\n        :math:`d` of the number field defined by the (monic, integral) polynomial\n        :emphasis:`pol` (all subfields if :math:`d` is null or omitted). The result is a vector\n        of subfields, each being given by :math:`[g,h]`, where :math:`g` is an absolute equation\n        and :math:`h` expresses one of the roots of :math:`g` in terms of the root :math:`x` of the\n        polynomial defining :math:`nf`. This routine uses J.\302\240Kl\303\274ners's algorithm\n        in the general case, and B.\302\240Allombert's :literal:`galoissubfields` when :emphasis:`nf`\n        is Galois (with weakly supersolvable Galois group).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1177nfsubfields(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_d;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfsubfields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfsubfields") < 0)) __PYX_ERR(10, 20983, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_d = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 20983, __pyx_L3_error)
    } else {
      __pyx_v_d = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfsubfields", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 20983, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1176nfsubfields(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol), __pyx_v_d);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1176nfsubfields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, long __pyx_v_d) {
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfsubfields", 0);

  /* "cypari/auto_gen.pxi":20994
 *         is Galois (with weakly supersolvable Galois group).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = nfsubfields(_pol, d)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 20994, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":20995
 *         '''
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nfsubfields(_pol, d)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_2;

  /* "cypari/auto_gen.pxi":20996
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = nfsubfields(_pol, d)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nfsubfields(__pyx_v__pol, __pyx_v_d);

  /* "cypari/auto_gen.pxi":20997
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = nfsubfields(_pol, d)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def norm(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 20997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20983
 *         return new_gen(_ret)
 * 
 *     def nfsubfields(pol, long d=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds all subfields of degree
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.nfsubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":20999
 *         return new_gen(_ret)
 * 
 *     def norm(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Algebraic norm of :math:`x`, i.e.the product of :math:`x` with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1179norm(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1178norm[] = "\n        Algebraic norm of :math:`x`, i.e.\302\240the product of :math:`x` with\n        its conjugate (no square roots are taken), or conjugates for polmods. For\n        vectors and matrices, the norm is taken componentwise and hence is not the\n        :math:`L^2`-norm (see :literal:`norml2`). Note that the norm of an element of\n        :math:`\\mathbb{R}` is its square, so as to be compatible with the complex norm.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1179norm(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1178norm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1178norm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("norm", 0);

  /* "cypari/auto_gen.pxi":21007
 *         :math:`\mathbb{R}` is its square, so as to be compatible with the complex norm.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorm(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21007, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21008
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gnorm(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21009
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorm(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gnorm(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21010
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorm(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def norml2(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21010, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":20999
 *         return new_gen(_ret)
 * 
 *     def norm(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Algebraic norm of :math:`x`, i.e.the product of :math:`x` with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.norm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21012
 *         return new_gen(_ret)
 * 
 *     def norml2(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of the :math:`L^2`-norm of :math:`x`. More precisely,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1181norml2(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1180norml2[] = "\n        Square of the :math:`L^2`-norm of :math:`x`. More precisely,\n        if :math:`x` is a scalar, :math:`norml2 (x)` is defined to be the square\n        of the complex modulus of :math:`x` (real :literal:`t_QUAD`\302\240s are not supported).\n        If :math:`x` is a polynomial, a (row or column) vector or a matrix, :literal:`norml2(:math:`x`)` is\n        defined recursively as :math:`\\sum_i norml2 (x_i)`, where :math:`(x_i)` run through\n        the components of :math:`x`. In particular, this yields the usual :math:`\\sum \\|x_i\\|^2`\n        (resp.\302\240:math:`\\sum \\|x_{i,j}\\|^2`) if :math:`x` is a polynomial or vector (resp.\302\240matrix) with\n        complex components.\n        \n        ::\n        \n            ? norml2( [ 1, 2, 3 ] ) \\\\ vector\n            %1 = 14\n            ? norml2( [ 1, 2; 3, 4] ) \\\\ matrix\n            %2 = 30\n            ? norml2( 2*I + x )\n            %3 = 5\n            ? norml2( [ [1,2], [3,4], 5, 6 ] ) \\\\ recursively defined\n            %4 = 91\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1181norml2(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("norml2 (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1180norml2(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1180norml2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("norml2", 0);

  /* "cypari/auto_gen.pxi":21034
 *             %4 = 91
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorml2(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21034, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21035
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gnorml2(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21036
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorml2(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gnorml2(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21037
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gnorml2(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def normlp(x, p=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21012
 *         return new_gen(_ret)
 * 
 *     def norml2(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of the :math:`L^2`-norm of :math:`x`. More precisely,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.norml2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21039
 *         return new_gen(_ret)
 * 
 *     def normlp(x, p=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`L^p`-norm of :math:`x`; sup norm if :math:`p` is omitted or :literal:`+oo`. More precisely,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1183normlp(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1182normlp[] = "\n        :math:`L^p`-norm of :math:`x`; sup norm if :math:`p` is omitted or :literal:`+oo`. More precisely,\n        if :math:`x` is a scalar, :literal:`normlp`:math:`(x, p)` is defined to be :literal:`abs`:math:`(x)`.\n        If :math:`x` is a polynomial, a (row or column) vector or a matrix:\n        \n        - if :math:`p` is omitted or :literal:`+oo`, then :literal:`normlp(:math:`x`)` is defined\n          recursively as :math:`\\max_i normlp (x_i))`, where :math:`(x_i)` run through the\n          components of\302\240:math:`x`. In particular, this yields the usual sup norm if :math:`x` is a\n          polynomial or vector with complex components.\n        \n        - otherwise, :literal:`normlp(:math:`x`, :math:`p`)` is defined recursively as :math:`(\\sum_i\n          normlp^p(x_i,p))^{1/p}`. In particular, this yields the usual :math:`(\\sum\n          \\|x_i\\|^p)^{1/p}` if :math:`x` is a polynomial or vector with complex components.\n        \n        ::\n        \n            ? v = [1,-2,3]; normlp(v) \\\\ vector\n            %1 = 3\n            ? normlp(v, +oo) \\\\ same, more explicit\n            %2 = 3\n            ? M = [1,-2;-3,4]; normlp(M) \\\\ matrix\n            %3 = 4\n            ? T = (1+I) + I*x^2; normlp(T)\n            %4 = 1.4142135623730950488016887242096980786\n            ? normlp([[1,2], [3,4], 5, 6]) \\\\ recursively defined\n            %5 = 6\n            \n            ? normlp(v, 1)\n            %6 = 6\n            ? normlp(M, 1)\n            %7 = 10\n            ? normlp(T, 1)\n            %8 = 2.4142135623730950488016887242096980786\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1183normlp(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("normlp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "normlp") < 0)) __PYX_ERR(10, 21039, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_p = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21039, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("normlp", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21039, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.normlp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1182normlp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_p, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1182normlp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision) {
  int __pyx_v__have_p;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("normlp", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":21074
 *             %8 = 2.4142135623730950488016887242096980786
 *         '''
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_1 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_1;

  /* "cypari/auto_gen.pxi":21075
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":21076
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":21075
 *         '''
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21077
 *         if _have_p:
 *             p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 21077, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21078
 *             p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":21079
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":21080
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_p != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":21081
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gnormlp(_x, _p, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_4;

    /* "cypari/auto_gen.pxi":21080
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":21082
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gnormlp(_x, _p, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":21083
 *             _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gnormlp(_x, _p, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gnormlp(__pyx_v__x, __pyx_v__p, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":21084
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gnormlp(_x, _p, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def numbpart(n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21039
 *         return new_gen(_ret)
 * 
 *     def normlp(x, p=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`L^p`-norm of :math:`x`; sup norm if :math:`p` is omitted or :literal:`+oo`. More precisely,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.normlp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21086
 *         return new_gen(_ret)
 * 
 *     def numbpart(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the number of unrestricted partitions of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1185numbpart(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1184numbpart[] = "\n        Gives the number of unrestricted partitions of\n        :math:`n`, usually called :math:`p(n)` in the literature; in other words the number of\n        nonnegative integer solutions to :math:`a+2b+3c+.. .= n`. :math:`n` must be of type\n        integer and :math:`n < 10^{15}` (with trivial values :math:`p(n) = 0` for :math:`n < 0` and\n        :math:`p(0) = 1`). The algorithm uses the Hardy-Ramanujan-Rademacher formula.\n        To explicitly enumerate them, see :literal:`partitions`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1185numbpart(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numbpart (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1184numbpart(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1184numbpart(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("numbpart", 0);

  /* "cypari/auto_gen.pxi":21095
 *         To explicitly enumerate them, see :literal:`partitions`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = numbpart(_n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21095, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21096
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = numbpart(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21097
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = numbpart(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = numbpart(__pyx_v__n);

  /* "cypari/auto_gen.pxi":21098
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = numbpart(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def numdiv(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21098, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21086
 *         return new_gen(_ret)
 * 
 *     def numbpart(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the number of unrestricted partitions of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.numbpart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21100
 *         return new_gen(_ret)
 * 
 *     def numdiv(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1187numdiv(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1186numdiv[] = "\n        Number of divisors of :math:`\\|x\\|`. :math:`x` must be of type integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1187numdiv(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numdiv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1186numdiv(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1186numdiv(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("numdiv", 0);

  /* "cypari/auto_gen.pxi":21104
 *         Number of divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = numdiv(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21104, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21105
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = numdiv(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21106
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = numdiv(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = numdiv(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21107
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = numdiv(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def numerator(f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21100
 *         return new_gen(_ret)
 * 
 *     def numdiv(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.numdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21109
 *         return new_gen(_ret)
 * 
 *     def numerator(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Numerator of :math:`f`. This is defined as :literal:`f * denominator(f,D)`, see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1189numerator(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1188numerator[] = "\n        Numerator of :math:`f`. This is defined as :literal:`f * denominator(f,D)`, see\n        :literal:`denominator` for details. The optional argument :math:`D` allows to control\n        over which ring we compute the denominator:\n        \n        - :math:`1`: we only consider the underlying :math:`\\mathbb{Q}`-structure and the\n          denominator is a (positive) rational integer\n        \n        - a simple variable, say :literal:`'x`: all entries as rational functions\n          in :math:`K(x)` and the denominator is a polynomial in :math:`x`.\n        \n        ::\n        \n            ? f = x + 1/y + 1/2;\n            ? numerator(f) \\\\ a t_POL in x\n            %2 = x + ((y + 2)/(2*y))\n            ? numerator(f, 1) \\\\ Q-denominator is 2\n            %3 = x + ((y + 2)/y)\n            ? numerator(f, y) \\\\ as a rational function in y\n            %5 = 2*y*x + (y + 2)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1189numerator(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("numerator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "numerator") < 0)) __PYX_ERR(10, 21109, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("numerator", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21109, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.numerator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1188numerator(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1188numerator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("numerator", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":21131
 *             %5 = 2*y*x + (y + 2)
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":21132
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":21133
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":21132
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21134
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 21134, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21135
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":21136
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":21137
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":21138
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = numerator(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":21137
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)
 */
  }

  /* "cypari/auto_gen.pxi":21139
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = numerator(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_gen.pxi":21140
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = numerator(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def omega(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21140, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21109
 *         return new_gen(_ret)
 * 
 *     def numerator(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Numerator of :math:`f`. This is defined as :literal:`f * denominator(f,D)`, see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.numerator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21142
 *         return new_gen(_ret)
 * 
 *     def omega(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct prime divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1191omega(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1190omega[] = "\n        Number of distinct prime divisors of :math:`\\|x\\|`. :math:`x` must be of type integer.\n        \n        ::\n        \n            ? factor(392)\n            %1 =\n            [2 3]\n            \n            [7 2]\n            \n            ? omega(392)\n            %2 = 2; \\\\ without multiplicity\n            ? bigomega(392)\n            %3 = 5; \\\\ = 3+2, with multiplicity\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1191omega(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("omega (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1190omega(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1190omega(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("omega", 0);

  /* "cypari/auto_gen.pxi":21159
 *             %3 = 5; \\ = 3+2, with multiplicity
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = omega(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21159, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21160
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = omega(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21161
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = omega(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = omega(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21162
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = omega(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":21163
 *         cdef long _ret = omega(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def padicappr(pol, a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21163, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21142
 *         return new_gen(_ret)
 * 
 *     def omega(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct prime divisors of :math:`\|x\|`. :math:`x` must be of type integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.omega", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21165
 *         return _ret
 * 
 *     def padicappr(pol, a):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol` congruent to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1193padicappr(PyObject *__pyx_v_pol, PyObject *__pyx_v_a); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1192padicappr[] = "\n        Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol` congruent to the\n        :math:`p`-adic number :math:`a` modulo :math:`p`, and with the same :math:`p`-adic precision as :math:`a`.\n        The number :math:`a` can be an ordinary :math:`p`-adic number (type :literal:`t_PADIC`, i.e.\302\240an\n        element of :math:`\\mathbb{Z}_p`) or can be an integral element of a finite\n        :emphasis:`unramified` extension :math:`\\mathbb{Q}_p[X]/(T)` of :math:`\\mathbb{Q}_p`, given as a :literal:`t_POLMOD`\n        :literal:`Mod`:math:`(A,T)` at least one of whose coefficients is a :literal:`t_PADIC` and :math:`T`\n        irreducible modulo :math:`p`. In this case, the result is the vector of roots\n        belonging to the same extension of :math:`\\mathbb{Q}_p` as :math:`a`. The polynomial :emphasis:`pol`\n        should have exact coefficients; if not, its coefficients are first rounded\n        to :math:`\\mathbb{Q}` or :math:`\\mathbb{Q}[X]/(T)` and this is the polynomial whose roots we consider.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1193padicappr(PyObject *__pyx_v_pol, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padicappr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1192padicappr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol), ((PyObject *)__pyx_v_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1192padicappr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_a) {
  GEN __pyx_v__pol;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("padicappr", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":21178
 *         to :math:`\mathbb{Q}` or :math:`\mathbb{Q}[X]/(T)` and this is the polynomial whose roots we consider.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21179
 *         '''
 *         a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21179, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21180
 *         a = objtogen(a)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = padicappr(_pol, _a)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21181
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = padicappr(_pol, _a)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21182
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = padicappr(_pol, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = padicappr(__pyx_v__pol, __pyx_v__a);

  /* "cypari/auto_gen.pxi":21183
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = padicappr(_pol, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def padicfields(p, N, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21165
 *         return _ret
 * 
 *     def padicappr(pol, a):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol` congruent to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.padicappr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21185
 *         return new_gen(_ret)
 * 
 *     def padicfields(p, N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials generating all the extensions of degree
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1195padicfields(PyObject *__pyx_v_p, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1194padicfields[] = "\n        Returns a vector of polynomials generating all the extensions of degree\n        :math:`N` of the field :math:`\\mathbb{Q}_p` of :math:`p`-adic rational numbers; :math:`N` is\n        allowed to be a 2-component vector :math:`[n,d]`, in which case we return the\n        extensions of degree :math:`n` and discriminant :math:`p^d`.\n        \n        The list is minimal in the sense that two different polynomials generate\n        non-isomorphic extensions; in particular, the number of polynomials is the\n        number of classes of non-isomorphic extensions. If :math:`P` is a polynomial in this\n        list, :math:`\\alpha` is any root of :math:`P` and :math:`K = \\mathbb{Q}_p(\\alpha)`, then :math:`\\alpha`\n        is the sum of a uniformizer and a (lift of a) generator of the residue field\n        of :math:`K`; in particular, the powers of :math:`\\alpha` generate the ring of :math:`p`-adic\n        integers of :math:`K`.\n        \n        If :math:`flag = 1`, replace each polynomial :math:`P` by a vector :math:`[P, e, f, d, c]`\n        where :math:`e` is the ramification index, :math:`f` the residual degree, :math:`d` the\n        valuation of the discriminant, and :math:`c` the number of conjugate fields.\n        If :math:`flag = 2`, only return the :emphasis:`number` of extensions in a fixed\n        algebraic closure (Krasner's formula), which is much faster.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1195padicfields(PyObject *__pyx_v_p, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padicfields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_flag,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_N)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "padicfields") < 0)) __PYX_ERR(10, 21185, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_N = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21185, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("padicfields", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21185, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.padicfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1194padicfields(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_p), __pyx_v_N, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1194padicfields(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_p, PyObject *__pyx_v_N, long __pyx_v_flag) {
  GEN __pyx_v__p;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("padicfields", 0);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_gen.pxi":21206
 *         algebraic closure (Krasner's formula), which is much faster.
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21207
 *         '''
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21207, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21208
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = padicfields0(_p, _N, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21209
 *         sig_on()
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = padicfields0(_p, _N, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21210
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = padicfields0(_p, _N, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = padicfields0(__pyx_v__p, __pyx_v__N, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21211
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = padicfields0(_p, _N, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def padicprec(x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21185
 *         return new_gen(_ret)
 * 
 *     def padicfields(p, N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials generating all the extensions of degree
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.padicfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21213
 *         return new_gen(_ret)
 * 
 *     def padicprec(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute :math:`p`-adic precision of the object :math:`x`; this is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1197padicprec(PyObject *__pyx_v_x, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1196padicprec[] = "\n        Returns the absolute :math:`p`-adic precision of the object :math:`x`; this is the\n        minimum precision of the components of :math:`x`. The result is :literal:`+oo` if :math:`x`\n        is an exact object (as a :math:`p`-adic):\n        \n        ::\n        \n            ? padicprec((1 + O(2^5)) * x + (2 + O(2^4)), 2)\n            %1 = 4\n            ? padicprec(x + 2, 2)\n            %2 = +oo\n            ? padicprec(2 + x + O(x^2), 2)\n            %3 = +oo\n        \n        The function raises an exception if it encounters\n        an object incompatible with :math:`p`-adic computations:\n        \n        ::\n        \n            ? padicprec(O(3), 2)\n             *** at top-level: padicprec(O(3),2)\n             *** ^-----------------\n             *** padicprec: inconsistent moduli in padicprec: 3 != 2\n            \n            ? padicprec(1.0, 2)\n             *** at top-level: padicprec(1.0,2)\n             *** ^----------------\n             *** padicprec: incorrect type in padicprec (t_REAL).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1197padicprec(PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padicprec (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1196padicprec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1196padicprec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("padicprec", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":21243
 *              *** padicprec: incorrect type in padicprec (t_REAL).
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21243, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21244
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21244, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21245
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gppadicprec(_x, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21246
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gppadicprec(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21247
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gppadicprec(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gppadicprec(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_gen.pxi":21248
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gppadicprec(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def parapply(f, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21248, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21213
 *         return new_gen(_ret)
 * 
 *     def padicprec(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute :math:`p`-adic precision of the object :math:`x`; this is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.padicprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21250
 *         return new_gen(_ret)
 * 
 *     def parapply(f, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of :literal:`f` on the elements of :literal:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1199parapply(PyObject *__pyx_v_f, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1198parapply[] = "\n        Parallel evaluation of :literal:`f` on the elements of :literal:`x`.\n        The function :literal:`f` must not access global variables or variables\n        declared with local(), and must be free of side effects.\n        \n        ::\n        \n            parapply(factor,[2^256 + 1, 2^193 - 1])\n        \n        factors :math:`2^{256} + 1` and :math:`2^{193} - 1` in parallel.\n        \n        ::\n        \n            {\n             my(E = ellinit([1,3]), V = vector(12,i,randomprime(2^200)));\n             parapply(p->ellcard(E,p), V)\n            }\n        \n        computes the order of :math:`E(\\mathbb{F}_p)` for :math:`12` random primes of :math:`200` bits.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1199parapply(PyObject *__pyx_v_f, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parapply (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1198parapply(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1198parapply(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_x) {
  GEN __pyx_v__f;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("parapply", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":21271
 *         computes the order of :math:`E(\mathbb{F}_p)` for :math:`12` random primes of :math:`200` bits.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21272
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21272, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21273
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = parapply(_f, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21274
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = parapply(_f, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21275
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = parapply(_f, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = parapply(__pyx_v__f, __pyx_v__x);

  /* "cypari/auto_gen.pxi":21276
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = parapply(_f, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def pareval(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21250
 *         return new_gen(_ret)
 * 
 *     def parapply(f, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of :literal:`f` on the elements of :literal:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.parapply", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21278
 *         return new_gen(_ret)
 * 
 *     def pareval(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of the elements of :literal:`x`, where :literal:`x` is a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1201pareval(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1200pareval[] = "\n        Parallel evaluation of the elements of :literal:`x`, where :literal:`x` is a\n        vector of closures. The closures must be of arity :math:`0`, must not access\n        global variables or variables declared with :literal:`local` and must be\n        free of side effects.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1201pareval(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pareval (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1200pareval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1200pareval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("pareval", 0);

  /* "cypari/auto_gen.pxi":21285
 *         free of side effects.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pareval(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21285, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21286
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pareval(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21287
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pareval(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pareval(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21288
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pareval(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def parselect(f, A, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21278
 *         return new_gen(_ret)
 * 
 *     def pareval(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Parallel evaluation of the elements of :literal:`x`, where :literal:`x` is a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.pareval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21290
 *         return new_gen(_ret)
 * 
 *     def parselect(f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Selects elements of :math:`A` according to the selection function :math:`f`, done in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1203parselect(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1202parselect[] = "\n        Selects elements of :math:`A` according to the selection function :math:`f`, done in\n        parallel. If :emphasis:`flag` is :math:`1`, return the indices of those elements (indirect\n        selection) The function :literal:`f` must not access global variables or\n        variables declared with local(), and must be free of side effects.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1203parselect(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("parselect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_flag,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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "parselect") < 0)) __PYX_ERR(10, 21290, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21290, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("parselect", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21290, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.parselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1202parselect(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_A, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1202parselect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("parselect", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_gen.pxi":21297
 *         variables declared with local(), and must be free of side effects.
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21297, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21298
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21298, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21299
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = parselect(_f, _A, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21300
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = parselect(_f, _A, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21301
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = parselect(_f, _A, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = parselect(__pyx_v__f, __pyx_v__A, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21302
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = parselect(_f, _A, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def permorder(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21290
 *         return new_gen(_ret)
 * 
 *     def parselect(f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Selects elements of :math:`A` according to the selection function :math:`f`, done in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.parselect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21304
 *         return new_gen(_ret)
 * 
 *     def permorder(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its order.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1205permorder(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1204permorder[] = "\n        Given a permutation :math:`x` on :math:`n` elements, return its order.\n        \n        ::\n        \n            ? p = Vecsmall([3,1,4,2,5]);\n            ? p^2\n            %2 = Vecsmall([4,3,2,1,5])\n            ? p^4\n            %3 = Vecsmall([1,2,3,4,5])\n            ? permorder(p)\n            %4 = 4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1205permorder(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permorder (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1204permorder(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1204permorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("permorder", 0);

  /* "cypari/auto_gen.pxi":21318
 *             %4 = 4
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permorder(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21318, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21319
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = permorder(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21320
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permorder(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = permorder(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21321
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permorder(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":21322
 *         cdef long _ret = permorder(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def permsign(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21304
 *         return new_gen(_ret)
 * 
 *     def permorder(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its order.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.permorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21324
 *         return _ret
 * 
 *     def permsign(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its signature.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1207permsign(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1206permsign[] = "\n        Given a permutation :math:`x` on :math:`n` elements, return its signature.\n        \n        ::\n        \n            ? p = Vecsmall([3,1,4,2,5]);\n            ? permsign(p)\n            %2 = -1\n            ? permsign(p^2)\n            %3 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1207permsign(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permsign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1206permsign(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1206permsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("permsign", 0);

  /* "cypari/auto_gen.pxi":21336
 *             %3 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permsign(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21336, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21337
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = permsign(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21338
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permsign(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = permsign(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21339
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = permsign(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":21340
 *         cdef long _ret = permsign(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def permtonum(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21324
 *         return _ret
 * 
 *     def permsign(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, return its signature.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.permsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21342
 *         return _ret
 * 
 *     def permtonum(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, gives the number :math:`k` such that
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1209permtonum(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1208permtonum[] = "\n        Given a permutation :math:`x` on :math:`n` elements, gives the number :math:`k` such that\n        :math:`x = numtoperm(n,k)`, i.e.\302\240inverse function of :literal:`numtoperm`.\n        The numbering used is the standard lexicographic ordering, starting at :math:`0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1209permtonum(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("permtonum (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1208permtonum(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1208permtonum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("permtonum", 0);

  /* "cypari/auto_gen.pxi":21348
 *         The numbering used is the standard lexicographic ordering, starting at :math:`0`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = permtonum(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21348, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21349
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = permtonum(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21350
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = permtonum(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = permtonum(__pyx_v__x);

  /* "cypari/auto_gen.pxi":21351
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = permtonum(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plotdraw(w, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21342
 *         return _ret
 * 
 *     def permtonum(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a permutation :math:`x` on :math:`n` elements, gives the number :math:`k` such that
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.permtonum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21353
 *         return new_gen(_ret)
 * 
 *     def plotdraw(w, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Physically draw the rectwindow :math:`w`. More generally,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1211plotdraw(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1210plotdraw[] = "\n        Physically draw the rectwindow :math:`w`. More generally,\n        :math:`w` can be of the form :math:`[w_1,x_1,y_1,w_2,x_2,y_2,...]` (number of\n        components must be divisible by :math:`3`; the windows :math:`w_1`, :math:`w_2`, etc.\302\240are\n        physically placed with their upper left corner at physical position\n        :math:`(x_1,y_1)`, :math:`(x_2,y_2)`,...respectively, and are then drawn together.\n        Overlapping regions will thus be drawn twice, and the windows are considered\n        transparent. Then display the whole drawing in a window on your screen.\n        If :math:`flag != 0`, :math:`x_1`, :math:`y_1` etc. express fractions of the size of the\n        current output device\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1211plotdraw(PyObject *__pyx_v_w, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotdraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotdraw") < 0)) __PYX_ERR(10, 21353, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21353, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotdraw", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21353, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.plotdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1210plotdraw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_w), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1210plotdraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_w, long __pyx_v_flag) {
  GEN __pyx_v__w;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  __Pyx_RefNannySetupContext("plotdraw", 0);

  /* "cypari/auto_gen.pxi":21365
 *         current output device
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         plotdraw(_w, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21365, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21366
 *         '''
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         plotdraw(_w, flag)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21367
 *         sig_on()
 *         cdef GEN _w = (<Gen>w).g
 *         plotdraw(_w, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  plotdraw(__pyx_v__w, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21368
 *         cdef GEN _w = (<Gen>w).g
 *         plotdraw(_w, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def plotexport(fmt, list, long flag=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":21353
 *         return new_gen(_ret)
 * 
 *     def plotdraw(w, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Physically draw the rectwindow :math:`w`. More generally,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.plotdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21370
 *         clear_stack()
 * 
 *     def plotexport(fmt, list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw list of rectwindows as in :literal:`plotdraw(list,flag)`, returning
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1213plotexport(PyObject *__pyx_v_fmt, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1212plotexport[] = "\n        Draw list of rectwindows as in :literal:`plotdraw(list,flag)`, returning\n        the resulting picture as a character string which can then be written to\n        a file. The format :literal:`fmt` is either :literal:`\"ps\"` (PostScript output)\n        or :literal:`\"svg\"` (Scalable Vector Graphics).\n        \n        ::\n        \n             ? plotinit(0, 100, 100);\n             ? plotbox(0, 50, 50);\n             ? plotcolor(0, 2);\n             ? plotbox(0, 30, 30);\n             ? plotdraw(0); \\\\ watch result on screen\n             ? s = plotexport(\"svg, 0);\n             ? write(\"graph.svg\", s); \\\\ dump result to file\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1213plotexport(PyObject *__pyx_v_fmt, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_list = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plotexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_list,&__pyx_n_s_flag,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_list)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plotexport") < 0)) __PYX_ERR(10, 21370, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_list = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21370, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plotexport", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21370, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.plotexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1212plotexport(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_fmt), __pyx_v_list, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1212plotexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fmt, PyObject *__pyx_v_list, long __pyx_v_flag) {
  GEN __pyx_v__fmt;
  GEN __pyx_v__list;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plotexport", 0);
  __Pyx_INCREF(__pyx_v_list);

  /* "cypari/auto_gen.pxi":21387
 *              ? write("graph.svg", s); \\ dump result to file
 *         '''
 *         list = objtogen(list)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_list, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_list, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21388
 *         '''
 *         list = objtogen(list)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21388, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21389
 *         list = objtogen(list)
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fmt)->__pyx_base.g;
  __pyx_v__fmt = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21390
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21391
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plotexport(__pyx_v__fmt, __pyx_v__list, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21392
 *         cdef GEN _list = (<Gen>list).g
 *         cdef GEN _ret = plotexport(_fmt, _list, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plothraw(X, Y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21370
 *         clear_stack()
 * 
 *     def plotexport(fmt, list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Draw list of rectwindows as in :literal:`plotdraw(list,flag)`, returning
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.plotexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_list);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21394
 *         return new_gen(_ret)
 * 
 *     def plothraw(X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1215plothraw(PyObject *__pyx_v_X, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1214plothraw[] = "\n        Given :math:`X` and :math:`Y` two vectors of equal length, plots (in\n        high precision) the points whose :math:`(x,y)`-coordinates are given in\n        :math:`X` and :math:`Y`. Automatic positioning and scaling is done, but\n        with the same scaling factor on :math:`x` and :math:`y`. If :math:`flag` is 1, join points,\n        other non-0 flags toggle display options and should be combinations of bits\n        :math:`2^k`, :math:`k >= 3` as in :literal:`ploth`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1215plothraw(PyObject *__pyx_v_X, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plothraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Y,&__pyx_n_s_flag,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_Y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plothraw") < 0)) __PYX_ERR(10, 21394, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Y = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21394, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plothraw", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21394, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.plothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1214plothraw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_X), __pyx_v_Y, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1214plothraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag) {
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plothraw", 0);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_gen.pxi":21403
 *         :math:`2^k`, :math:`k >= 3` as in :literal:`ploth`.
 *         '''
 *         Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21404
 *         '''
 *         Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21404, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21405
 *         Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothraw(_X, _Y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21406
 *         sig_on()
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plothraw(_X, _Y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
  __pyx_v__Y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21407
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothraw(_X, _Y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plothraw(__pyx_v__X, __pyx_v__Y, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21408
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothraw(_X, _Y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def plothrawexport(fmt, X, Y, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21394
 *         return new_gen(_ret)
 * 
 *     def plothraw(X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.plothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21410
 *         return new_gen(_ret)
 * 
 *     def plothrawexport(fmt, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in high precision)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1217plothrawexport(PyObject *__pyx_v_fmt, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1216plothrawexport[] = "\n        Given :math:`X` and :math:`Y` two vectors of equal length, plots (in high precision)\n        the points whose :math:`(x,y)`-coordinates are given in :math:`X` and :math:`Y`, returning the\n        resulting picture as a character string which can then be written to a file.\n        The format :literal:`fmt` is either :literal:`\"ps\"` (PostScript output) or :literal:`\"svg\"`\n        (Scalable Vector Graphics).\n        \n        Automatic positioning and scaling is done, but with the same scaling factor\n        on :math:`x` and :math:`y`. If :math:`flag` is 1, join points, other non-0 flags toggle display\n        options and should be combinations of bits :math:`2^k`, :math:`k >= 3` as in\n        :literal:`ploth`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1217plothrawexport(PyObject *__pyx_v_fmt, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_Y = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("plothrawexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_Y,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("plothrawexport", 0, 2, 3, 1); __PYX_ERR(10, 21410, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plothrawexport") < 0)) __PYX_ERR(10, 21410, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_X = values[0];
    __pyx_v_Y = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21410, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("plothrawexport", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21410, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.plothrawexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1216plothrawexport(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_fmt), __pyx_v_X, __pyx_v_Y, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1216plothrawexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_fmt, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, long __pyx_v_flag) {
  GEN __pyx_v__fmt;
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("plothrawexport", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_gen.pxi":21423
 *         :literal:`ploth`.
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         Y = objtogen(Y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21424
 *         '''
 *         X = objtogen(X)
 *         Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21425
 *         X = objtogen(X)
 *         Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21425, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21426
 *         Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fmt)->__pyx_base.g;
  __pyx_v__fmt = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21427
 *         sig_on()
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21428
 *         cdef GEN _fmt = (<Gen>fmt).g
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
  __pyx_v__Y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21429
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = plothrawexport(__pyx_v__fmt, __pyx_v__X, __pyx_v__Y, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21430
 *         cdef GEN _Y = (<Gen>Y).g
 *         cdef GEN _ret = plothrawexport(_fmt, _X, _Y, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polclass(D, long inv=0, x=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21410
 *         return new_gen(_ret)
 * 
 *     def plothrawexport(fmt, X, Y, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`X` and :math:`Y` two vectors of equal length, plots (in high precision)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.plothrawexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21432
 *         return new_gen(_ret)
 * 
 *     def polclass(D, long inv=0, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a polynomial in :math:`\mathbb{Z}[x]` generating the Hilbert class field for the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1219polclass(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1218polclass[] = "\n        Return a polynomial in :math:`\\mathbb{Z}[x]` generating the Hilbert class field for the\n        imaginary quadratic discriminant :math:`D`. If :math:`inv` is 0 (the default),\n        use the modular :math:`j`-function and return the classical Hilbert polynomial,\n        otherwise use a class invariant. The following invariants correspond to\n        the different values of :math:`inv`, where :math:`f` denotes Weber's function\n        :literal:`weber`, and :math:`w_{p,q}` the double eta quotient given by\n        :math:`w_{p,q} = (\\eta (x/p) \\eta (x/q) )/(\\eta (x) \\eta (x/{pq}) )`\n        \n        The invariants :math:`w_{p,q}` are not allowed unless they satisfy the following\n        technical conditions ensuring they do generate the Hilbert class\n        field and not a strict subfield:\n        \n        - if :math:`p != q`, we need them both non-inert, prime to the conductor of\n          :math:`\\mathbb{Z}[\\sqrt{D}]`. Let :math:`P, Q` be prime ideals above :math:`p` and :math:`q`; if both are\n          unramified, we further require that :math:`P^{\302\261 1} Q^{\302\261 1}` be all distinct in\n          the class group of :math:`\\mathbb{Z}[\\sqrt{D}]`; if both are ramified, we require that :math:`PQ\n          != 1` in the class group.\n        \n        - if :math:`p = q`, we want it split and prime to the conductor and\n          the prime ideal above it must have order :math:`!= 1, 2, 4` in the class group.\n        \n        Invariants are allowed under the additional conditions on :math:`D`\n        listed below.\n        \n        - 0 : :math:`j`\n        \n        - 1 : :math:`f`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 2 : :math:`f^2`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 3 : :math:`f^3`, :math:`D = 1 mod 8`;\n        \n        - 4 : :math:`f^4`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 5 : :math:`\\gamma_2 = j^{1/3}`, :math:`D = 1,2 mod 3`;""\n        \n        - 6 : :math:`w_{2,3}`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 8 : :math:`f^8`, :math:`D = 1 mod 8` and :math:`D = 1,2 mod 3`;\n        \n        - 9 : :math:`w_{3,3}`, :math:`D = 1 mod 2` and :math:`D = 1,2 mod 3`;\n        \n        - 10: :math:`w_{2,5}`, :math:`D != 60 mod 80` and :math:`D = 1,2 mod 3`;\n        \n        - 14: :math:`w_{2,7}`, :math:`D = 1 mod 8`;\n        \n        - 15: :math:`w_{3,5}`, :math:`D = 1,2 mod 3`;\n        \n        - 21: :math:`w_{3,7}`, :math:`D = 1 mod 2` and :math:`21` does not divide :math:`D`\n        \n        - 23: :math:`w_{2,3}^2`, :math:`D = 1,2 mod 3`;\n        \n        - 24: :math:`w_{2,5}^2`, :math:`D = 1,2 mod 3`;\n        \n        - 26: :math:`w_{2,13}`, :math:`D != 156 mod 208`;\n        \n        - 27: :math:`w_{2,7}^2`, :math:`D != 28 mod 112`;\n        \n        - 28: :math:`w_{3,3}^2`, :math:`D = 1,2 mod 3`;\n        \n        - 35: :math:`w_{5,7}`, :math:`D = 1,2 mod 3`;\n        \n        - 39: :math:`w_{3,13}`, :math:`D = 1 mod 2` and :math:`D = 1,2 mod 3`;\n        \n        The algorithm for computing the polynomial does not use the floating point\n        approach, which would evaluate a precise modular function in a precise\n        complex argument. Instead, it relies on a faster Chinese remainder based\n        approach modulo small primes, in which the class invariant is only defined\n        algebraically by the modular polynomial relating the modular function to :math:`j`.\n        So in fact, any of the several roots of the modular polynomial may actually\n        be the class invariant, and more precise assertions cannot be made.\n        \n        For instance, while :literal:`polclass(D)` returns the minimal polynomial of\n        :math:`j(\\tau)` with :math:`\\tau` (any) quadratic integer for the discriminant :math:`D`,\n        the polynomial returned by :literal:`polclass(D, 5)` can be the minimal polynomial\n        of any of :math:`\\gamma_2"" (\\tau)`, :math:`\\zeta_3 \\gamma_2 (\\tau)` or\n        :math:`\\zeta_3^2 \\gamma_2 (\\tau)`, the three roots of the modular polynomial\n        :math:`j = \\gamma_2^3`, in which :math:`j` has been specialised to :math:`j (\\tau)`.\n        \n        The modular polynomial is given by\n        :math:`j = ((f^{24}-16)^3 )/(f^{24})` for Weber's function :math:`f`.\n        \n        For the double eta quotients of level :math:`N = p q`, all functions are covered\n        such that the modular curve :math:`X_0^+ (N)`, the function field of which is\n        generated by the functions invariant under :math:`\\Gamma^0 (N)` and the\n        Fricke-Atkin-Lehner involution, is of genus :math:`0` with function field\n        generated by (a power of) the double eta quotient :math:`w`.\n        This ensures that the full Hilbert class field (and not a proper subfield)\n        is generated by class invariants from these double eta quotients.\n        Then the modular polynomial is of degree :math:`2` in :math:`j`, and\n        of degree :math:`\\psi (N) = (p+1)(q+1)` in :math:`w`.\n        \n        ::\n        \n            ? polclass(-163)\n            %1 = x + 262537412640768000\n            ? polclass(-51, , 'z)\n            %2 = z^2 + 5541101568*z + 6262062317568\n            ? polclass(-151,1)\n            x^7 - x^6 + x^5 + 3*x^3 - x^2 + 3*x + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1219polclass(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_inv;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polclass (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_inv,&__pyx_n_s_x,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inv);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polclass") < 0)) __PYX_ERR(10, 21432, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_inv = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_inv == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21432, __pyx_L3_error)
    } else {
      __pyx_v_inv = ((long)0);
    }
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polclass", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21432, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polclass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1218polclass(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_inv, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1218polclass(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_inv, PyObject *__pyx_v_x) {
  long __pyx_v__x;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("polclass", 0);

  /* "cypari/auto_gen.pxi":21535
 *             x^7 - x^6 + x^5 + 3*x^3 - x^2 + 3*x + 1
 *         '''
 *         cdef long _x = -1             # <<<<<<<<<<<<<<
 *         if x is not None:
 *             _x = get_var(x)
 */
  __pyx_v__x = -1L;

  /* "cypari/auto_gen.pxi":21536
 *         '''
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_x != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":21537
 *         cdef long _x = -1
 *         if x is not None:
 *             _x = get_var(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_x); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 21537, __pyx_L1_error)
    __pyx_v__x = __pyx_t_3;

    /* "cypari/auto_gen.pxi":21536
 *         '''
 *         cdef long _x = -1
 *         if x is not None:             # <<<<<<<<<<<<<<
 *             _x = get_var(x)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21538
 *         if x is not None:
 *             _x = get_var(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = polclass(_D, inv, _x)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 21538, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21539
 *             _x = get_var(x)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polclass(_D, inv, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_5;

  /* "cypari/auto_gen.pxi":21540
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = polclass(_D, inv, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polclass(__pyx_v__D, __pyx_v_inv, __pyx_v__x);

  /* "cypari/auto_gen.pxi":21541
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = polclass(_D, inv, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcoef(x, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 21541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21432
 *         return new_gen(_ret)
 * 
 *     def polclass(D, long inv=0, x=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a polynomial in :math:`\mathbb{Z}[x]` generating the Hilbert class field for the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polclass", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21543
 *         return new_gen(_ret)
 * 
 *     def polcoef(x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficient of degree :math:`n` of the polynomial :math:`x`, with respect to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1221polcoef(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1220polcoef[] = "\n        Coefficient of degree :math:`n` of the polynomial :math:`x`, with respect to the\n        main variable if :math:`v` is omitted, with respect to :math:`v` otherwise. If :math:`n`\n        is greater than the degree, the result is zero.\n        \n        Naturally applies to scalars (polynomial of degree :math:`0`), as well as to\n        rational functions whose denominator is a monomial. It also applies to power\n        series: if :math:`n` is less than the valuation, the result is zero. If it is\n        greater than the largest significant degree, then an error message is issued.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1221polcoef(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcoef (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polcoef") < 0)) __PYX_ERR(10, 21543, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21543, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polcoef", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21543, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1220polcoef(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1220polcoef(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("polcoef", 0);

  /* "cypari/auto_gen.pxi":21554
 *         greater than the largest significant degree, then an error message is issued.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":21555
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":21556
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 21556, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":21555
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21557
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoef(_x, n, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 21557, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21558
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcoef(_x, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":21559
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoef(_x, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcoef(__pyx_v__x, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_gen.pxi":21560
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoef(_x, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcoeff(x, long n, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 21560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21543
 *         return new_gen(_ret)
 * 
 *     def polcoef(x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficient of degree :math:`n` of the polynomial :math:`x`, with respect to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polcoef", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21562
 *         return new_gen(_ret)
 * 
 *     def polcoeff(x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for polcoef.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1223polcoeff(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1222polcoeff[] = "\n        Deprecated alias for polcoef.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1223polcoeff(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcoeff (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polcoeff") < 0)) __PYX_ERR(10, 21562, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21562, __pyx_L3_error)
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polcoeff", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21562, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polcoeff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1222polcoeff(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1222polcoeff(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_v) {
  PyObject *__pyx_v_warn = NULL;
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  long __pyx_t_5;
  int __pyx_t_6;
  GEN __pyx_t_7;
  __Pyx_RefNannySetupContext("polcoeff", 0);

  /* "cypari/auto_gen.pxi":21566
 *         Deprecated alias for polcoef.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)
 *         cdef long _v = -1
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21566, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21566, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":21567
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__67, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":21568
 *         from warnings import warn
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":21569
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v_v != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":21570
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_5 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_5 == ((long)-2L))) __PYX_ERR(10, 21570, __pyx_L1_error)
    __pyx_v__v = __pyx_t_5;

    /* "cypari/auto_gen.pxi":21569
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21571
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoeff0(_x, n, _v)
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(10, 21571, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21572
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcoeff0(_x, n, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_7 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_7;

  /* "cypari/auto_gen.pxi":21573
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoeff0(_x, n, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcoeff0(__pyx_v__x, __pyx_v_n, __pyx_v__v);

  /* "cypari/auto_gen.pxi":21574
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polcoeff0(_x, n, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcompositum(P, Q, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 21574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21562
 *         return new_gen(_ret)
 * 
 *     def polcoeff(x, long n, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Deprecated alias for polcoef.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polcoeff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21576
 *         return new_gen(_ret)
 * 
 *     def polcompositum(P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`P` and :math:`Q`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1225polcompositum(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1224polcompositum[] = "\n        :math:`P` and :math:`Q`\n        being squarefree polynomials in :math:`\\mathbb{Z}[X]` in the same variable, outputs\n        the simple factors of the \303\251tale :math:`\\mathbb{Q}`-algebra :math:`A = \\mathbb{Q} (X, Y) / (P(X), Q(Y))`.\n        The factors are given by a list of polynomials :math:`R` in :math:`\\mathbb{Z}[X]`, attached to\n        the number field :math:`\\mathbb{Q} (X)/ (R)`, and sorted by increasing degree (with respect\n        to lexicographic ordering for factors of equal degrees). Returns an error if\n        one of the polynomials is not squarefree.\n        \n        Note that it is more efficient to reduce to the case where :math:`P` and :math:`Q` are\n        irreducible first. The routine will not perform this for you, since it may be\n        expensive, and the inputs are irreducible in most applications anyway. In\n        this case, there will be a single factor :math:`R` if and only if the number\n        fields defined by :math:`P` and :math:`Q` are linearly disjoint (their intersection is\n        :math:`\\mathbb{Q}`).\n        \n        Assuming :math:`P` is irreducible (of smaller degree than :math:`Q` for efficiency), it\n        is in general much faster to proceed as follows\n        \n        ::\n        \n            nf = nfinit(P); L = nffactor(nf, Q)[,1];\n            vector(#L, i, rnfequation(nf, L[i]))\n        \n        to obtain the same result. If you are only interested in the degrees of the\n        simple factors, the :literal:`rnfequation` instruction can be replaced by a\n        trivial :literal:`poldegree(P) * poldegree(L[i])`.\n        \n        The binary digits of :math:`flag` mean\n        \n        1: outputs a vector of 4-component vectors :math:`[R,a,b,k]`, where :math:`R`\n        ranges through the list of all possible compositums as above, and :math:`a`\n        (resp. :math:`b`) expresses the root of :math:`P` (resp. :math:`Q`) as an element of\n        :math:`\\mathbb{Q} (X)/(R)`. Fina""lly, :math:`k` is a small integer such that :math:`b + ka = X` modulo\n        :math:`R`.\n        \n        2: assume that :math:`P` and :math:`Q` define number fields which are linearly disjoint:\n        both polynomials are irreducible and the corresponding number fields\n        have no common subfield besides :math:`\\mathbb{Q}`. This allows to save a costly\n        factorization over :math:`\\mathbb{Q}`. In this case return the single simple factor\n        instead of a vector with one element.\n        \n        A compositum is often defined by a complicated polynomial, which it is\n        advisable to reduce before further work. Here is an example involving\n        the field :math:`\\mathbb{Q} (\\zeta_5, 5^{1/5})`:\n        \n        ::\n        \n            ? L = polcompositum(x^5 - 5, polcyclo(5), 1); \\\\ list of [R,a,b,k]\n            ? [R, a] = L[1]; \\\\ pick the single factor, extract R,a (ignore b,k)\n            ? R \\\\ defines the compositum\n            %3 = x^20 + 5*x^19 + 15*x^18 + 35*x^17 + 70*x^16 + 141*x^15 + 260*x^14\\\n            + 355*x^13 + 95*x^12 - 1460*x^11 - 3279*x^10 - 3660*x^9 - 2005*x^8 \\\n            + 705*x^7 + 9210*x^6 + 13506*x^5 + 7145*x^4 - 2740*x^3 + 1040*x^2 \\\n            - 320*x + 256\n            ? a^5 - 5 \\\\ a fifth root of 5\n            %4 = 0\n            ? [T, X] = polredbest(R, 1);\n            ? T \\\\ simpler defining polynomial for Q[x]/(R)\n            %6 = x^20 + 25*x^10 + 5\n            ? X \\\\  root of R in Q[y]/(T(y))\n            %7 = Mod(-1/11*x^15 - 1/11*x^14 + 1/22*x^10 - 47/22*x^5 - 29/11*x^4 + 7/22,\\\n            x^20 + 25*x^10 + 5)\n            ? a = subst(a.pol, 'x, X) \\\\ a in the new coordinates\n            %8 = Mod(1/11*x^14 + 29/11*x^4, x^20 + 25*x^10 + 5)\n            ? a^5 - 5\n            %9 = 0\n        \n        In the above example, :math:`x^5-5` and the :math:`5`-th cyclotomic\n        polynomial are irreducible over :math:`\\mathbb{Q}`; they have coprime degrees so\n      ""  define linearly disjoint extensions and we could have started by\n        \n        ::\n        \n            ? [R,a] = polcompositum(x^5 - 5, polcyclo(5), 3); \\\\ [R,a,b,k]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1225polcompositum(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Q = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcompositum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Q,&__pyx_n_s_flag,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_Q)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polcompositum") < 0)) __PYX_ERR(10, 21576, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Q = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21576, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polcompositum", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21576, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1224polcompositum(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_P), __pyx_v_Q, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1224polcompositum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, PyObject *__pyx_v_Q, long __pyx_v_flag) {
  GEN __pyx_v__P;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polcompositum", 0);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_gen.pxi":21653
 *             ? [R,a] = polcompositum(x^5 - 5, polcyclo(5), 3); \\ [R,a,b,k]
 *         '''
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21654
 *         '''
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21654, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21655
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21656
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21657
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcompositum0(__pyx_v__P, __pyx_v__Q, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21658
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = polcompositum0(_P, _Q, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polcyclofactors(f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21576
 *         return new_gen(_ret)
 * 
 *     def polcompositum(P, Q, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`P` and :math:`Q`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polcompositum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21660
 *         return new_gen(_ret)
 * 
 *     def polcyclofactors(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials, whose product is the product of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1227polcyclofactors(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1226polcyclofactors[] = "\n        Returns a vector of polynomials, whose product is the product of\n        distinct cyclotomic polynomials dividing :math:`f`.\n        \n        ::\n        \n            ? f = x^10+5*x^8-x^7+8*x^6-4*x^5+8*x^4-3*x^3+7*x^2+3;\n            ? v = polcyclofactors(f)\n            %2 = [x^2 + 1, x^2 + x + 1, x^4 - x^3 + x^2 - x + 1]\n            ? apply(poliscycloprod, v)\n            %3 = [1, 1, 1]\n            ? apply(poliscyclo, v)\n            %4 = [4, 3, 10]\n        \n        In general, the polynomials are products of cyclotomic\n        polynomials and not themselves irreducible:\n        \n        ::\n        \n            ? g = x^8+2*x^7+6*x^6+9*x^5+12*x^4+11*x^3+10*x^2+6*x+3;\n            ? polcyclofactors(g)\n            %2 = [x^6 + 2*x^5 + 3*x^4 + 3*x^3 + 3*x^2 + 2*x + 1]\n            ? factor(%[1])\n            %3 =\n            [ x^2 + x + 1 1]\n            \n            [x^4 + x^3 + x^2 + x + 1 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1227polcyclofactors(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polcyclofactors (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1226polcyclofactors(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1226polcyclofactors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f) {
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polcyclofactors", 0);

  /* "cypari/auto_gen.pxi":21689
 *             [x^4 + x^3 + x^2 + x + 1 1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polcyclofactors(_f)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21689, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21690
 *         '''
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polcyclofactors(_f)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21691
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polcyclofactors(_f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polcyclofactors(__pyx_v__f);

  /* "cypari/auto_gen.pxi":21692
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polcyclofactors(_f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldegree(x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21660
 *         return new_gen(_ret)
 * 
 *     def polcyclofactors(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a vector of polynomials, whose product is the product of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polcyclofactors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21694
 *         return new_gen(_ret)
 * 
 *     def poldegree(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Degree of the polynomial :math:`x` in the main variable if :math:`v` is omitted, in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1229poldegree(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1228poldegree[] = "\n        Degree of the polynomial :math:`x` in the main variable if :math:`v` is omitted, in\n        the variable :math:`v` otherwise.\n        \n        The degree of :math:`0` is :literal:`-oo`. The degree of a non-zero scalar is :math:`0`.\n        Finally, when :math:`x` is a non-zero polynomial or rational function, returns the\n        ordinary degree of :math:`x`. Raise an error otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1229poldegree(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldegree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poldegree") < 0)) __PYX_ERR(10, 21694, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poldegree", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21694, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.poldegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1228poldegree(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1228poldegree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("poldegree", 0);

  /* "cypari/auto_gen.pxi":21703
 *         ordinary degree of :math:`x`. Raise an error otherwise.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":21704
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":21705
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 21705, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":21704
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21706
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gppoldegree(_x, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 21706, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21707
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gppoldegree(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":21708
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gppoldegree(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gppoldegree(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":21709
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gppoldegree(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldisc(pol, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 21709, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21694
 *         return new_gen(_ret)
 * 
 *     def poldegree(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Degree of the polynomial :math:`x` in the main variable if :math:`v` is omitted, in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.poldegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21711
 *         return new_gen(_ret)
 * 
 *     def poldisc(pol, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1231poldisc(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1230poldisc[] = "\n        Discriminant of the polynomial\n        :emphasis:`pol` in the main variable if :math:`v` is omitted, in :math:`v` otherwise. Uses a\n        modular algorithm over :math:`\\mathbb{Z}` or :math:`\\mathbb{Q}`, and the subresultant algorithm\n        otherwise.\n        \n        ::\n        \n            ? T = x^4 + 2*x+1;\n            ? poldisc(T)\n            %2 = -176\n            ? poldisc(T^2)\n            %3 = 0\n        \n        For convenience, the function also applies to types :literal:`t_QUAD` and\n        :literal:`t_QFI`/:literal:`t_QFR`:\n        \n        ::\n        \n            ? z = 3*quadgen(8) + 4;\n            ? poldisc(z)\n            %2 = 8\n            ? q = Qfb(1,2,3);\n            ? poldisc(q)\n            %4 = -8\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1231poldisc(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldisc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poldisc") < 0)) __PYX_ERR(10, 21711, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poldisc", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21711, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.poldisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1230poldisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1230poldisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("poldisc", 0);

  /* "cypari/auto_gen.pxi":21738
 *             %4 = -8
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":21739
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":21740
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 21740, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":21739
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21741
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = poldisc0(_pol, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 21741, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21742
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = poldisc0(_pol, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_5;

  /* "cypari/auto_gen.pxi":21743
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = poldisc0(_pol, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = poldisc0(__pyx_v__pol, __pyx_v__v);

  /* "cypari/auto_gen.pxi":21744
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = poldisc0(_pol, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldiscfactors(T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 21744, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21711
 *         return new_gen(_ret)
 * 
 *     def poldisc(pol, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.poldisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21746
 *         return new_gen(_ret)
 * 
 *     def poldiscfactors(T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with integer coefficients, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1233poldiscfactors(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1232poldiscfactors[] = "\n        Given a polynomial :math:`T` with integer coefficients, return\n        :math:`[D, faD]` where :math:`D` is the discriminant of :math:`T` and\n        :emphasis:`faD` is a cheap partial factorization of :math:`\\|D\\|`: entries in its first\n        column are coprime and not perfect powers but need not be primes.\n        The factors are obtained by a combination of trial division, testing for\n        perfect powers, factorizations in coprimes, and computing Euclidean\n        remainder sequences for :math:`(T,T')` modulo composite factors :math:`d` of :math:`D`\n        (which is likely to produce :math:`0`-divisors in :math:`\\mathbb{Z}/d\\mathbb{Z}`).\n        If :emphasis:`flag` is :math:`1`, finish the factorization using :literal:`factorint`.\n        \n        ::\n        \n            ? T = x^3 - 6021021*x^2 + 12072210077769*x - 8092423140177664432;\n            ? [D,faD] = poldiscfactors(T); print(faD); D\n            [3, 3; 7, 2; 373, 2; 500009, 2; 24639061, 2]\n            %2 = -27937108625866859018515540967767467\n            \n            ? T = x^3 + 9*x^2 + 27*x - 125014250689643346789780229390526092263790263725;\n            ? [D,faD] = poldiscfactors(T); print(faD)\n            [2, 6; 3, 3; 125007125141751093502187, 4]\n            ? [D,faD] = poldiscfactors(T, 1); print(faD)\n            [2, 6; 3, 3; 500009, 12; 1000003, 4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1233poldiscfactors(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldiscfactors (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poldiscfactors") < 0)) __PYX_ERR(10, 21746, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21746, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poldiscfactors", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21746, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.poldiscfactors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1232poldiscfactors(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1232poldiscfactors(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("poldiscfactors", 0);

  /* "cypari/auto_gen.pxi":21771
 *             [2, 6; 3, 3; 500009, 12; 1000003, 4]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = poldiscfactors(_T, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21771, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21772
 *         '''
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = poldiscfactors(_T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21773
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = poldiscfactors(_T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = poldiscfactors(__pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":21774
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = poldiscfactors(_T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poldiscreduced(f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21746
 *         return new_gen(_ret)
 * 
 *     def poldiscfactors(T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial :math:`T` with integer coefficients, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.poldiscfactors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21776
 *         return new_gen(_ret)
 * 
 *     def poldiscreduced(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduced discriminant vector of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1235poldiscreduced(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1234poldiscreduced[] = "\n        Reduced discriminant vector of the\n        (integral, monic) polynomial :math:`f`. This is the vector of elementary divisors\n        of :math:`\\mathbb{Z}[\\alpha]/f'(\\alpha)\\mathbb{Z}[\\alpha]`, where :math:`\\alpha` is a root of the\n        polynomial :math:`f`. The components of the result are all positive, and their\n        product is equal to the absolute value of the discriminant of\302\240:math:`f`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1235poldiscreduced(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldiscreduced (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1234poldiscreduced(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1234poldiscreduced(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f) {
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("poldiscreduced", 0);

  /* "cypari/auto_gen.pxi":21784
 *         product is equal to the absolute value of the discriminant of:math:`f`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = reduceddiscsmith(_f)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21784, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21785
 *         '''
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = reduceddiscsmith(_f)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21786
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = reduceddiscsmith(_f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = reduceddiscsmith(__pyx_v__f);

  /* "cypari/auto_gen.pxi":21787
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = reduceddiscsmith(_f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polgalois(T, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21776
 *         return new_gen(_ret)
 * 
 *     def poldiscreduced(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduced discriminant vector of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.poldiscreduced", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21789
 *         return new_gen(_ret)
 * 
 *     def polgalois(T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Galois group of the non-constant
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1237polgalois(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1236polgalois[] = "\n        Galois group of the non-constant\n        polynomial :math:`T\\in\\mathbb{Q}[X]`. In the present version :strong:`2.11.3`, :math:`T` must be irreducible\n        and the degree :math:`d` of :math:`T` must be less than or equal to 7. If the\n        :literal:`galdata` package has been installed, degrees 8, 9, 10 and 11 are also\n        implemented. By definition, if :math:`K = \\mathbb{Q}[x]/(T)`, this computes the action of\n        the Galois group of the Galois closure of :math:`K` on the :math:`d` distinct roots of\n        :math:`T`, up to conjugacy (corresponding to different root orderings).\n        \n        The output is a 4-component vector :math:`[n,s,k,name]` with the\n        following meaning: :math:`n` is the cardinality of the group, :math:`s` is its signature\n        (:math:`s = 1` if the group is a subgroup of the alternating group :math:`A_d`, :math:`s = -1`\n        otherwise) and name is a character string containing name of the transitive\n        group according to the GAP 4 transitive groups library by Alexander Hulpke.\n        \n        :math:`k` is more arbitrary and the choice made up to version\302\2402.2.3 of PARI is rather\n        unfortunate: for :math:`d > 7`, :math:`k` is the numbering of the group among all\n        transitive subgroups of :math:`S_d`, as given in \"The transitive groups of degree up\n        to eleven\", G.\302\240Butler and J.\302\240McKay, :emphasis:`Communications in Algebra`, vol.\302\24011,\n        1983,\n        pp.\302\240863--911 (group :math:`k` is denoted :math:`T_k` there). And for :math:`d <= 7`, it was ad\n        hoc, so as to ensure that a given triple would denote a unique group.\n        Specifically, for polynomials of degree :math:`d <= 7`, the groups are coded as\n        follows, using standard notations\n        \n        In degree 1: :math:`S_1 = [1,1,1]`.\n        \n        In degree 2: :math:`S_2 = [2,-1,1]`.\n        \n        In degree 3: :math:`A_3 = C_3 = [3,1,1]`, :math:""`S_3 = [6,-1,1]`.\n        \n        In degree 4: :math:`C_4 = [4,-1,1]`, :math:`V_4 = [4,1,1]`, :math:`D_4 = [8,-1,1]`, :math:`A_4 = [12,1,1]`,\n        :math:`S_4 = [24,-1,1]`.\n        \n        In degree 5: :math:`C_5 = [5,1,1]`, :math:`D_5 = [10,1,1]`, :math:`M_{20} = [20,-1,1]`,\n        :math:`A_5 = [60,1,1]`, :math:`S_5 = [120,-1,1]`.\n        \n        In degree 6: :math:`C_6 = [6,-1,1]`, :math:`S_3 = [6,-1,2]`, :math:`D_6 = [12,-1,1]`, :math:`A_4 = [12,1,1]`,\n        :math:`G_{18} = [18,-1,1]`, :math:`S_4^ -= [24,-1,1]`, :math:`A_4 x C_2 = [24,-1,2]`,\n        :math:`S_4^ += [24,1,1]`, :math:`G_{36}^ -= [36,-1,1]`, :math:`G_{36}^ += [36,1,1]`,\n        :math:`S_4 x C_2 = [48,-1,1]`, :math:`A_5 = PSL_2(5) = [60,1,1]`, :math:`G_{72} = [72,-1,1]`,\n        :math:`S_5 = PGL_2(5) = [120,-1,1]`, :math:`A_6 = [360,1,1]`, :math:`S_6 = [720,-1,1]`.\n        \n        In degree 7: :math:`C_7 = [7,1,1]`, :math:`D_7 = [14,-1,1]`, :math:`M_{21} = [21,1,1]`,\n        :math:`M_{42} = [42,-1,1]`, :math:`PSL_2(7) = PSL_3(2) = [168,1,1]`, :math:`A_7 = [2520,1,1]`,\n        :math:`S_7 = [5040,-1,1]`.\n        \n        This is deprecated and obsolete, but for reasons of backward compatibility,\n        we cannot change this behavior yet. So you can use the default\n        :literal:`new_galois_format` to switch to a consistent naming scheme, namely :math:`k` is\n        always the standard numbering of the group among all transitive subgroups of\n        :math:`S_n`. If this default is in effect, the above groups will be coded as:\n        \n        In degree 1: :math:`S_1 = [1,1,1]`.\n        \n        In degree 2: :math:`S_2 = [2,-1,1]`.\n        \n        In degree 3: :math:`A_3 = C_3 = [3,1,1]`, :math:`S_3 = [6,-1,2]`.\n        \n        In degree 4: :math:`C_4 = [4,-1,1]`, :math:`V_4 = [4,1,2]`, :math:`D_4 = [8,-1,3]`, :math:`A_4 = [12,1,4]`,\n        :math:`S_4 = [24,-1,5]`.\n        \n        In degree 5: :math:`C_5 = [5,1,1]`, :math:`D_5 = [10,1,2]`, :math:`M_{20} ="" [20,-1,3]`,\n        :math:`A_5 = [60,1,4]`, :math:`S_5 = [120,-1,5]`.\n        \n        In degree 6: :math:`C_6 = [6,-1,1]`, :math:`S_3 = [6,-1,2]`, :math:`D_6 = [12,-1,3]`, :math:`A_4 = [12,1,4]`,\n        :math:`G_{18} = [18,-1,5]`, :math:`A_4 x C_2 = [24,-1,6]`, :math:`S_4^ += [24,1,7]`,\n        :math:`S_4^ -= [24,-1,8]`, :math:`G_{36}^ -= [36,-1,9]`, :math:`G_{36}^ += [36,1,10]`,\n        :math:`S_4 x C_2 = [48,-1,11]`, :math:`A_5 = PSL_2(5) = [60,1,12]`, :math:`G_{72} = [72,-1,13]`,\n        :math:`S_5 = PGL_2(5) = [120,-1,14]`, :math:`A_6 = [360,1,15]`, :math:`S_6 = [720,-1,16]`.\n        \n        In degree 7: :math:`C_7 = [7,1,1]`, :math:`D_7 = [14,-1,2]`, :math:`M_{21} = [21,1,3]`,\n        :math:`M_{42} = [42,-1,4]`, :math:`PSL_2(7) = PSL_3(2) = [168,1,5]`, :math:`A_7 = [2520,1,6]`,\n        :math:`S_7 = [5040,-1,7]`.\n        \n        :strong:`Warning.` The method used is that of resolvent polynomials and is\n        sensitive to the current precision. The precision is updated internally but,\n        in very rare cases, a wrong result may be returned if the initial precision\n        was not sufficient.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1237polgalois(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polgalois (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polgalois") < 0)) __PYX_ERR(10, 21789, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21789, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polgalois", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21789, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1236polgalois(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1236polgalois(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_precision) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polgalois", 0);

  /* "cypari/auto_gen.pxi":21870
 *         was not sufficient.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21870, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21871
 *         '''
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polgalois(_T, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21872
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polgalois(_T, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":21873
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polgalois(_T, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polgalois(__pyx_v__T, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":21874
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = polgalois(_T, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polgraeffe(f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21874, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21789
 *         return new_gen(_ret)
 * 
 *     def polgalois(T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Galois group of the non-constant
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polgalois", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21876
 *         return new_gen(_ret)
 * 
 *     def polgraeffe(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Graeffe transform :math:`g` of :math:`f`, such that :math:`g(x^2) = f(x)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1239polgraeffe(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1238polgraeffe[] = "\n        Returns the Graeffe transform :math:`g` of :math:`f`, such that :math:`g(x^2) = f(x)\n        f(-x)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1239polgraeffe(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polgraeffe (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1238polgraeffe(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1238polgraeffe(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f) {
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polgraeffe", 0);

  /* "cypari/auto_gen.pxi":21881
 *         f(-x)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polgraeffe(_f)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21881, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21882
 *         '''
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polgraeffe(_f)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21883
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polgraeffe(_f)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polgraeffe(__pyx_v__f);

  /* "cypari/auto_gen.pxi":21884
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = polgraeffe(_f)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polhensellift(A, B, p, long e):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21876
 *         return new_gen(_ret)
 * 
 *     def polgraeffe(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Graeffe transform :math:`g` of :math:`f`, such that :math:`g(x^2) = f(x)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polgraeffe", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21886
 *         return new_gen(_ret)
 * 
 *     def polhensellift(A, B, p, long e):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime :math:`p`, an integral polynomial :math:`A` whose leading coefficient
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1241polhensellift(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1240polhensellift[] = "\n        Given a prime :math:`p`, an integral polynomial :math:`A` whose leading coefficient\n        is a :math:`p`-unit, a vector :math:`B` of integral polynomials that are monic and\n        pairwise relatively prime modulo :math:`p`, and whose product is congruent to\n        :math:`A/lc(A)` modulo :math:`p`, lift the elements of :math:`B` to polynomials whose\n        product is congruent to :math:`A` modulo :math:`p^e`.\n        \n        More generally, if :math:`T` is an integral polynomial irreducible mod :math:`p`, and\n        :math:`B` is a factorization of :math:`A` over the finite field :math:`\\mathbb{F}_p[t]/(T)`, you can\n        lift it to :math:`\\mathbb{Z}_p[t]/(T, p^e)` by replacing the :math:`p` argument with :math:`[p,T]`:\n        \n        ::\n        \n            ? { T = t^3 - 2; p = 7; A = x^2 + t + 1;\n             B = [x + (3*t^2 + t + 1), x + (4*t^2 + 6*t + 6)];\n             r = polhensellift(A, B, [p, T], 6) }\n            %1 = [x + (20191*t^2 + 50604*t + 75783), x + (97458*t^2 + 67045*t + 41866)]\n            ? liftall( r[1] * r[2] * Mod(Mod(1,p^6),T) )\n            %2 = x^2 + (t + 1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1241polhensellift(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_p = 0;
  long __pyx_v_e;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polhensellift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_p,&__pyx_n_s_e,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 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_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polhensellift", 1, 3, 3, 1); __PYX_ERR(10, 21886, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_e)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polhensellift", 1, 3, 3, 2); __PYX_ERR(10, 21886, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polhensellift") < 0)) __PYX_ERR(10, 21886, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_B = values[0];
    __pyx_v_p = values[1];
    __pyx_v_e = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_e == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21886, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polhensellift", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21886, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polhensellift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1240polhensellift(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_B, __pyx_v_p, __pyx_v_e);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1240polhensellift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_p, long __pyx_v_e) {
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polhensellift", 0);
  __Pyx_INCREF(__pyx_v_B);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":21907
 *             %2 = x^2 + (t + 1)
 *         '''
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21908
 *         '''
 *         B = objtogen(B)
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":21909
 *         B = objtogen(B)
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 21909, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21910
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21911
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21912
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":21913
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polhensellift(__pyx_v__A, __pyx_v__B, __pyx_v__p, __pyx_v_e);

  /* "cypari/auto_gen.pxi":21914
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = polhensellift(_A, _B, _p, e)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poliscyclo(f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 21914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21886
 *         return new_gen(_ret)
 * 
 *     def polhensellift(A, B, p, long e):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a prime :math:`p`, an integral polynomial :math:`A` whose leading coefficient
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polhensellift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21916
 *         return new_gen(_ret)
 * 
 *     def poliscyclo(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 0 if :math:`f` is not a cyclotomic polynomial, and :math:`n > 0` if :math:`f =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1243poliscyclo(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1242poliscyclo[] = "\n        Returns 0 if :math:`f` is not a cyclotomic polynomial, and :math:`n > 0` if :math:`f =\n        \\Phi_n`, the :math:`n`-th cyclotomic polynomial.\n        \n        ::\n        \n            ? poliscyclo(x^4-x^2+1)\n            %1 = 12\n            ? polcyclo(12)\n            %2 = x^4 - x^2 + 1\n            ? poliscyclo(x^4-x^2-1)\n            %3 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1243poliscyclo(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poliscyclo (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1242poliscyclo(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1242poliscyclo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f) {
  GEN __pyx_v__f;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("poliscyclo", 0);

  /* "cypari/auto_gen.pxi":21930
 *             %3 = 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscyclo(_f)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21930, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21931
 *         '''
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = poliscyclo(_f)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21932
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscyclo(_f)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = poliscyclo(__pyx_v__f);

  /* "cypari/auto_gen.pxi":21933
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscyclo(_f)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":21934
 *         cdef long _ret = poliscyclo(_f)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def poliscycloprod(f):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21916
 *         return new_gen(_ret)
 * 
 *     def poliscyclo(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 0 if :math:`f` is not a cyclotomic polynomial, and :math:`n > 0` if :math:`f =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.poliscyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21936
 *         return _ret
 * 
 *     def poliscycloprod(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`f` is a product of cyclotomic polynomial, and :math:`0`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1245poliscycloprod(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1244poliscycloprod[] = "\n        Returns 1 if :math:`f` is a product of cyclotomic polynomial, and :math:`0`\n        otherwise.\n        \n        ::\n        \n            ? f = x^6+x^5-x^3+x+1;\n            ? poliscycloprod(f)\n            %2 = 1\n            ? factor(f)\n            %3 =\n            [ x^2 + x + 1 1]\n            \n            [x^4 - x^2 + 1 1]\n            ? [ poliscyclo(T) | T <- %[,1] ]\n            %4 = [3, 12]\n            ? polcyclo(3) * polcyclo(12)\n            %5 = x^6 + x^5 - x^3 + x + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1245poliscycloprod(PyObject *__pyx_v_f, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poliscycloprod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1244poliscycloprod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1244poliscycloprod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f) {
  GEN __pyx_v__f;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("poliscycloprod", 0);

  /* "cypari/auto_gen.pxi":21956
 *             %5 = x^6 + x^5 - x^3 + x + 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscycloprod(_f)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21956, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21957
 *         '''
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = poliscycloprod(_f)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21958
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscycloprod(_f)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = poliscycloprod(__pyx_v__f);

  /* "cypari/auto_gen.pxi":21959
 *         cdef GEN _f = (<Gen>f).g
 *         cdef long _ret = poliscycloprod(_f)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":21960
 *         cdef long _ret = poliscycloprod(_f)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def polisirreducible(pol):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21936
 *         return _ret
 * 
 *     def poliscycloprod(f):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns 1 if :math:`f` is a product of cyclotomic polynomial, and :math:`0`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.poliscycloprod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21962
 *         return _ret
 * 
 *     def polisirreducible(pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a polynomial (univariate in the present version :strong:`2.11.3`),
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1247polisirreducible(PyObject *__pyx_v_pol, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1246polisirreducible[] = "\n        :emphasis:`pol` being a polynomial (univariate in the present version :strong:`2.11.3`),\n        returns 1 if :emphasis:`pol` is non-constant and irreducible, 0 otherwise.\n        Irreducibility is checked over the smallest base field over which :emphasis:`pol`\n        seems to be defined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1247polisirreducible(PyObject *__pyx_v_pol, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polisirreducible (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1246polisirreducible(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1246polisirreducible(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol) {
  GEN __pyx_v__pol;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polisirreducible", 0);

  /* "cypari/auto_gen.pxi":21969
 *         seems to be defined.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef long _ret = isirreducible(_pol)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21969, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21970
 *         '''
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = isirreducible(_pol)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21971
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef long _ret = isirreducible(_pol)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = isirreducible(__pyx_v__pol);

  /* "cypari/auto_gen.pxi":21972
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef long _ret = isirreducible(_pol)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":21973
 *         cdef long _ret = isirreducible(_pol)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def pollead(x, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21962
 *         return _ret
 * 
 *     def polisirreducible(pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`pol` being a polynomial (univariate in the present version :strong:`2.11.3`),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polisirreducible", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21975
 *         return _ret
 * 
 *     def pollead(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Leading coefficient of the polynomial or power series :math:`x`. This is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1249pollead(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1248pollead[] = "\n        Leading coefficient of the polynomial or power series :math:`x`. This is\n        computed with respect to the main variable of :math:`x` if :math:`v` is omitted, with\n        respect to the variable :math:`v` otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1249pollead(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pollead (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pollead") < 0)) __PYX_ERR(10, 21975, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pollead", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21975, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.pollead", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1248pollead(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1248pollead(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("pollead", 0);

  /* "cypari/auto_gen.pxi":21981
 *         respect to the variable :math:`v` otherwise.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":21982
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":21983
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 21983, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":21982
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":21984
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pollead(_x, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 21984, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21985
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = pollead(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":21986
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pollead(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = pollead(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":21987
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = pollead(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrecip(pol):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 21987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21975
 *         return _ret
 * 
 *     def pollead(x, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Leading coefficient of the polynomial or power series :math:`x`. This is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.pollead", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21989
 *         return new_gen(_ret)
 * 
 *     def polrecip(pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reciprocal polynomial of :emphasis:`pol`, i.e.the coefficients are in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1251polrecip(PyObject *__pyx_v_pol, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1250polrecip[] = "\n        Reciprocal polynomial of :emphasis:`pol`, i.e.\302\240the coefficients are in\n        reverse order. :emphasis:`pol` must be a polynomial.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1251polrecip(PyObject *__pyx_v_pol, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrecip (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1250polrecip(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1250polrecip(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol) {
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polrecip", 0);

  /* "cypari/auto_gen.pxi":21994
 *         reverse order. :emphasis:`pol` must be a polynomial.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = polrecip(_pol)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 21994, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":21995
 *         '''
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrecip(_pol)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_2;

  /* "cypari/auto_gen.pxi":21996
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = polrecip(_pol)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrecip(__pyx_v__pol);

  /* "cypari/auto_gen.pxi":21997
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = polrecip(_pol)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polred(T, long flag=0, _arg2=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 21997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21989
 *         return new_gen(_ret)
 * 
 *     def polrecip(pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reciprocal polynomial of :emphasis:`pol`, i.e.the coefficients are in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrecip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":21999
 *         return new_gen(_ret)
 * 
 *     def polred(T, long flag=0, _arg2=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is :emphasis:`deprecated`, use :literal:`polredbest` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1253polred(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1252polred[] = "\n        This function is :emphasis:`deprecated`, use :literal:`polredbest` instead.\n        Finds polynomials with reasonably small coefficients defining subfields of\n        the number field defined by :math:`T`. One of the polynomials always defines :math:`\\mathbb{Q}`\n        (hence has degree :math:`1`), and another always defines the same number field\n        as :math:`T` if :math:`T` is irreducible.\n        \n        All :math:`T` accepted by :literal:`nfinit` are also allowed here;\n        in particular, the format :literal:`[T, listP]` is recommended, e.g. with\n        :math:`listP = 10^5` or a vector containing all ramified primes. Otherwise,\n        the maximal order of :math:`\\mathbb{Q}[x]/(T)` must be computed.\n        \n        The following binary digits of :math:`flag` are significant:\n        \n        1: Possibly use a suborder of the maximal order. The\n        primes dividing the index of the order chosen are larger than\n        :literal:`primelimit` or divide integers stored in the :literal:`addprimes` table.\n        This flag is :emphasis:`deprecated`, the :literal:`[T, listP]` format is more\n        flexible.\n        \n        2: gives also elements. The result is a two-column matrix, the first column\n        giving primitive elements defining these subfields, the second giving the\n        corresponding minimal polynomials.\n        \n        ::\n        \n            ? M = polred(x^4 + 8, 2)\n            %1 =\n            [ 1 x - 1]\n            \n            [ 1/2*x^2 + 1 x^2 - 2*x + 3]\n            \n            [-1/2*x^2 + 1 x^2 - 2*x + 3]\n            \n            [ 1/2*x^2 x^2 + 2]\n            \n            [ 1/4*x^3 x^4 + 2]\n            ? minpoly(Mod(M[2,1], x^4+8))\n            %2 = x^2 + 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1253polred(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v__arg2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_arg2,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arg2);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polred") < 0)) __PYX_ERR(10, 21999, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 21999, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v__arg2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polred", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 21999, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1252polred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_flag, __pyx_v__arg2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1252polred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag, PyObject *__pyx_v__arg2) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have__arg2;
  GEN __pyx_v__T;
  GEN __pyx_v___arg2;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polred", 0);
  __Pyx_INCREF(__pyx_v__arg2);

  /* "cypari/auto_gen.pxi":22040
 *             %2 = x^2 + 2
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg2 is not None:
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22040, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22041
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         if _arg2 is not None:
 *             from warnings import warn
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__68, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22042
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg2 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 */
  __pyx_t_3 = (__pyx_v__arg2 != Py_None);
  __pyx_t_4 = (__pyx_t_3 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":22043
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg2 is not None:
 *             from warnings import warn             # <<<<<<<<<<<<<<
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have__arg2 = (_arg2 is not None)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_warn);
    __Pyx_GIVEREF(__pyx_n_s_warn);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn);
    __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22043, __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_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_warn, __pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":22044
 *         if _arg2 is not None:
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__69, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22044, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":22042
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)
 *         if _arg2 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 */
  }

  /* "cypari/auto_gen.pxi":22045
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have__arg2 = (_arg2 is not None)             # <<<<<<<<<<<<<<
 *         if _have__arg2:
 *             _arg2 = objtogen(_arg2)
 */
  __pyx_t_4 = (__pyx_v__arg2 != Py_None);
  __pyx_v__have__arg2 = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22046
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             _arg2 = objtogen(_arg2)
 *         sig_on()
 */
  __pyx_t_4 = (__pyx_v__have__arg2 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":22047
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:
 *             _arg2 = objtogen(_arg2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v__arg2, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v__arg2, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":22046
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             _arg2 = objtogen(_arg2)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22048
 *         if _have__arg2:
 *             _arg2 = objtogen(_arg2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg2 = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 22048, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22049
 *             _arg2 = objtogen(_arg2)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_6;

  /* "cypari/auto_gen.pxi":22050
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg2 = NULL             # <<<<<<<<<<<<<<
 *         if _have__arg2:
 *             __arg2 = (<Gen>_arg2).g
 */
  __pyx_v___arg2 = NULL;

  /* "cypari/auto_gen.pxi":22051
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             __arg2 = (<Gen>_arg2).g
 *         cdef GEN _ret = polred0(_T, flag, __arg2)
 */
  __pyx_t_4 = (__pyx_v__have__arg2 != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":22052
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:
 *             __arg2 = (<Gen>_arg2).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polred0(_T, flag, __arg2)
 *         return new_gen(_ret)
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v__arg2)->__pyx_base.g;
    __pyx_v___arg2 = __pyx_t_6;

    /* "cypari/auto_gen.pxi":22051
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             __arg2 = (<Gen>_arg2).g
 *         cdef GEN _ret = polred0(_T, flag, __arg2)
 */
  }

  /* "cypari/auto_gen.pxi":22053
 *         if _have__arg2:
 *             __arg2 = (<Gen>_arg2).g
 *         cdef GEN _ret = polred0(_T, flag, __arg2)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polred0(__pyx_v__T, __pyx_v_flag, __pyx_v___arg2);

  /* "cypari/auto_gen.pxi":22054
 *             __arg2 = (<Gen>_arg2).g
 *         cdef GEN _ret = polred0(_T, flag, __arg2)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polredabs(T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22054, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":21999
 *         return new_gen(_ret)
 * 
 *     def polred(T, long flag=0, _arg2=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is :emphasis:`deprecated`, use :literal:`polredbest` instead.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v__arg2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22056
 *         return new_gen(_ret)
 * 
 *     def polredabs(T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a canonical defining polynomial :math:`P` for the number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1255polredabs(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1254polredabs[] = "\n        Returns a canonical defining polynomial :math:`P` for the number field\n        :math:`\\mathbb{Q}[X]/(T)` defined by :math:`T`, such that the sum of the squares of the modulus\n        of the roots (i.e.\302\240the :math:`T_2`-norm) is minimal. Different :math:`T` defining\n        isomorphic number fields will yield the same :math:`P`. All :math:`T` accepted by\n        :literal:`nfinit` are also allowed here, e.g. non-monic polynomials, or pairs\n        :literal:`[T, listP]` specifying that a non-maximal order may be used. For\n        convenience, any number field structure (:emphasis:`nf`, :emphasis:`bnf`,...) can also\n        be used instead of :math:`T`.\n        \n        ::\n        \n            ? polredabs(x^2 + 16)\n            %1 = x^2 + 1\n            ? K = bnfinit(x^2 + 16); polredabs(K)\n            %2 = x^2 + 1\n        \n        :strong:`Warning 1.` Using a :literal:`t_POL` :math:`T` requires computing\n        and fully factoring the discriminant :math:`d_K` of the maximal order which may be\n        very hard. You can use the format :literal:`[T, listP]`, where :literal:`listP`\n        encodes a list of known coprime divisors of :math:`\\mathrm{disc} (T)` (see :literal:`\077\077nfbasis`),\n        to help the routine, thereby replacing this part of the algorithm by a\n        polynomial time computation But this may only compute a suborder of the\n        maximal order, when the divisors are not squarefree or do not include all\n        primes dividing :math:`d_K`. The routine attempts to certify the result\n        independently of this order computation as per :literal:`nfcertify`: we try to\n        prove that the computed order is maximal. If the certification fails,\n        the routine then fully factors the integers returned by :literal:`nfcertify`.\n        You can use :literal:`polredbest` or :literal:`polredabs(,16)` to avoid this\n        factorization step; in both cases, the result is no longer canonical.\n        \n    ""    :strong:`Warning 2.` Apart from the factorization of the discriminant of\n        :math:`T`, this routine runs in polynomial time for a :emphasis:`fixed` degree.\n        But the complexity is exponential in the degree: this routine\n        may be exceedingly slow when the number field has many subfields, hence a\n        lot of elements of small :math:`T_2`-norm. If you do not need a canonical\n        polynomial, the function :literal:`polredbest` is in general much faster (it runs\n        in polynomial time), and tends to return polynomials with smaller\n        discriminants.\n        \n        The binary digits of :math:`flag` mean\n        \n        1: outputs a two-component row vector :math:`[P,a]`, where :math:`P` is the default\n        output and :literal:`Mod(a, P)` is a root of the original :math:`T`.\n        \n        4: gives :emphasis:`all` polynomials of minimal :math:`T_2` norm; of the two polynomials\n        :math:`P(x)` and :math:`\302\261 P(-x)`, only one is given.\n        \n        16: Possibly use a suborder of the maximal order, :emphasis:`without` attempting to\n        certify the result as in Warning 1: we always return a polynomial and never\n        :math:`0`. The result is a priori not canonical.\n        \n        ::\n        \n            ? T = x^16 - 136*x^14 + 6476*x^12 - 141912*x^10 + 1513334*x^8 \\\n             - 7453176*x^6 + 13950764*x^4 - 5596840*x^2 + 46225\n            ? T1 = polredabs(T); T2 = polredbest(T);\n            ? [ norml2(polroots(T1)), norml2(polroots(T2)) ]\n            %3 = [88.0000000, 120.000000]\n            ? [ sizedigit(poldisc(T1)), sizedigit(poldisc(T2)) ]\n            %4 = [75, 67]\n        \n        The precise definition of the output of :literal:`polredabs` is as follows.\n        \n        - Consider the finite list of characteristic polynomials of primitive\n          elements of\302\240:math:`K` that are in\302\240:math:`\\mathbb{Z}_K` and minimal for the\302\240:math:`T_2` norm;\n       ""   now remove from the list the polynomials whose discriminant do not have\n          minimal absolute value. Note that this condition is restricted to the\n          original list of polynomials with minimal :math:`T_2` norm and does not imply that\n          the defining polynomial for the field with smallest discriminant belongs to\n          the list !\n        \n        - To a polynomial :math:`P(x) = x^n +...+ a_n \\in \\mathbb{R}[x]` we attach\n          the sequence :math:`S(P)` given by :math:`\\|a_1\\|, a_1,..., \\|a_n\\|, a_n`.\n          Order the polynomials :math:`P` by the lexicographic order on the coefficient\n          vectors :math:`S(P)`. Then the output of :literal:`polredabs` is the smallest\n          polynomial in the above list for that order. In other words, the monic\n          polynomial which is lexicographically smallest with respect to the absolute\n          values of coefficients, favouring negative coefficients to break ties, i.e.\n          choosing :math:`x^3-2` rather than :math:`x^3+2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1255polredabs(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polredabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polredabs") < 0)) __PYX_ERR(10, 22056, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22056, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polredabs", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22056, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1254polredabs(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1254polredabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polredabs", 0);

  /* "cypari/auto_gen.pxi":22138
 *           choosing :math:`x^3-2` rather than :math:`x^3+2`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredabs0(_T, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22138, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22139
 *         '''
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polredabs0(_T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22140
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredabs0(_T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polredabs0(__pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":22141
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredabs0(_T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polredbest(T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22056
 *         return new_gen(_ret)
 * 
 *     def polredabs(T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a canonical defining polynomial :math:`P` for the number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22143
 *         return new_gen(_ret)
 * 
 *     def polredbest(T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds a polynomial with reasonably
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1257polredbest(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1256polredbest[] = "\n        Finds a polynomial with reasonably\n        small coefficients defining the same number field as :math:`T`.\n        All :math:`T` accepted by :literal:`nfinit` are also allowed here (e.g. non-monic\n        polynomials, :literal:`nf`, :literal:`bnf`, :literal:`[T,Z_K_basis]`). Contrary to\n        :literal:`polredabs`, this routine runs in polynomial time, but it offers no\n        guarantee as to the minimality of its result.\n        \n        This routine computes an LLL-reduced basis for an order in :math:`\\mathbb{Q}[X]/(T)`, then\n        examines small linear combinations of the basis vectors, computing their\n        characteristic polynomials. It returns the :emphasis:`separable` polynomial :math:`P` of\n        smallest discriminant, the one with lexicographically smallest\n        :literal:`abs(Vec(P))` in case of ties. This is a good candidate for subsequent\n        number field computations since it guarantees that the denominators of\n        algebraic integers, when expressed in the power basis, are reasonably small.\n        With no claim of minimality, though.\n        \n        It can happen that iterating this functions yields better and better\n        polynomials, until it stabilizes:\n        \n        ::\n        \n            ? \\p5\n            ? P = X^12+8*X^8-50*X^6+16*X^4-3069*X^2+625;\n            ? poldisc(P)*1.\n            %2 = 1.2622 E55\n            ? P = polredbest(P);\n            ? poldisc(P)*1.\n            %4 = 2.9012 E51\n            ? P = polredbest(P);\n            ? poldisc(P)*1.\n            %6 = 8.8704 E44\n        \n        In this example, the initial polynomial :math:`P` is the one\n        returned by :literal:`polredabs`, and the last one is stable.\n        \n        If :math:`flag = 1`: outputs a two-component row vector :math:`[P,a]`, where :math:`P` is the\n        default output and :literal:`Mod(a, P)` is a root of the original :math:`T`.\n        \n        ::\n        \n            ? [P,a] = polred""best(x^4 + 8, 1)\n            %1 = [x^4 + 2, Mod(x^3, x^4 + 2)]\n            ? charpoly(a)\n            %2 = x^4 + 8\n        \n        In particular, the map :math:`\\mathbb{Q}[x]/(T) \\to \\mathbb{Q}[x]/(P)`,\n        :math:`x:--->Mod(a,P)` defines an isomorphism of number fields, which can\n        be computed as\n        \n        ::\n        \n             subst(lift(Q), 'x, a)\n        \n        if :math:`Q` is a :literal:`t_POLMOD` modulo :math:`T`; :literal:`b = modreverse(a)`\n        returns a :literal:`t_POLMOD` giving the inverse of the above map (which should be\n        useless since :math:`\\mathbb{Q}[x]/(P)` is a priori a better representation for the number\n        field and its elements).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1257polredbest(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polredbest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polredbest") < 0)) __PYX_ERR(10, 22143, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22143, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polredbest", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22143, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1256polredbest(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1256polredbest(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polredbest", 0);

  /* "cypari/auto_gen.pxi":22203
 *         field and its elements).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredbest(_T, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22203, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22204
 *         '''
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polredbest(_T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22205
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredbest(_T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polredbest(__pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":22206
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = polredbest(_T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polredord(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22206, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22143
 *         return new_gen(_ret)
 * 
 *     def polredbest(T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds a polynomial with reasonably
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22208
 *         return new_gen(_ret)
 * 
 *     def polredord(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use polredbest.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1259polredord(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1258polredord[] = "\n        This function is obsolete, use polredbest.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1259polredord(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polredord (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1258polredord(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1258polredord(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polredord", 0);

  /* "cypari/auto_gen.pxi":22212
 *         This function is obsolete, use polredbest.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22212, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22213
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__70, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22214
 *         from warnings import warn
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polredord(_x)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22214, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22215
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polredord(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22216
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polredord(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polredord(__pyx_v__x);

  /* "cypari/auto_gen.pxi":22217
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polredord(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polresultant(x, y, v=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22208
 *         return new_gen(_ret)
 * 
 *     def polredord(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use polredbest.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polredord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22219
 *         return new_gen(_ret)
 * 
 *     def polresultant(x, y, v=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Resultant of the two
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1261polresultant(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1260polresultant[] = "\n        Resultant of the two\n        polynomials :math:`x` and :math:`y` with exact entries, with respect to the main\n        variables of :math:`x` and :math:`y` if :math:`v` is omitted, with respect to the variable :math:`v`\n        otherwise. The algorithm assumes the base ring is a domain. If you also need\n        the :math:`u` and :math:`v` such that :math:`x*u + y*v = Res(x,y)`, use the\n        :literal:`polresultantext` function.\n        \n        If :math:`flag = 0` (default), uses the algorithm best suited to the inputs,\n        either the subresultant algorithm (Lazard/Ducos variant, generic case),\n        a modular algorithm (inputs in :math:`\\mathbb{Q}[X]`) or Sylvester's matrix (inexact\n        inputs).\n        \n        If :math:`flag = 1`, uses the determinant of Sylvester's matrix instead; this should\n        always be slower than the default.\n        \n        If :math:`x` or :math:`y` are multivariate with a huge :emphasis:`polynomial` content, it\n        is advisable to remove it before calling this function. Compare:\n        \n        ::\n        \n            ? a = polcyclo(7) * ((t+1)/(t+2))^100;\n            ? b = polcyclo(11)* ((t+2)/(t+3))^100);\n            ? polresultant(a,b);\n            time = 3,833 ms.\n            ? ca = content(a); cb = content(b); \\\n             polresultant(a/ca,b/cb)*ca^poldegree(b)*cb*poldegree(a); \\\\ instantaneous\n        \n        The function only removes rational denominators and does\n        not compute automatically the content because it is generically small and\n        potentially :emphasis:`very` expensive (e.g. in multivariate contexts).\n        The choice is yours, depending on your application.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1261polresultant(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_v = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polresultant (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_v,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polresultant") < 0)) __PYX_ERR(10, 22219, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
    __pyx_v_v = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22219, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polresultant", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22219, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polresultant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1260polresultant(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_v, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1260polresultant(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_v, long __pyx_v_flag) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polresultant", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":22253
 *         The choice is yours, depending on your application.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":22254
 *         '''
 *         y = objtogen(y)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":22255
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":22256
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 22256, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22255
 *         y = objtogen(y)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22257
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 22257, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22258
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_6;

  /* "cypari/auto_gen.pxi":22259
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_6;

  /* "cypari/auto_gen.pxi":22260
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polresultant0(__pyx_v__x, __pyx_v__y, __pyx_v__v, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":22261
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = polresultant0(_x, _y, _v, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polresultantext(A, B, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22219
 *         return new_gen(_ret)
 * 
 *     def polresultant(x, y, v=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Resultant of the two
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polresultant", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22263
 *         return new_gen(_ret)
 * 
 *     def polresultantext(A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds polynomials :math:`U` and :math:`V` such that :math:`A*U + B*V = R`, where :math:`R` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1263polresultantext(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1262polresultantext[] = "\n        Finds polynomials :math:`U` and :math:`V` such that :math:`A*U + B*V = R`, where :math:`R` is\n        the resultant of :math:`U` and :math:`V` with respect to the main variables of :math:`A` and\n        :math:`B` if :math:`v` is omitted, and with respect to :math:`v` otherwise. Returns the row\n        vector :math:`[U,V,R]`. The algorithm used (subresultant) assumes that the base\n        ring is a domain.\n        \n        ::\n        \n            ? A = x*y; B = (x+y)^2;\n            ? [U,V,R] = polresultantext(A, B)\n            %2 = [-y*x - 2*y^2, y^2, y^4]\n            ? A*U + B*V\n            %3 = y^4\n            ? [U,V,R] = polresultantext(A, B, y)\n            %4 = [-2*x^2 - y*x, x^2, x^4]\n            ? A*U+B*V\n            %5 = x^4\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1263polresultantext(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polresultantext (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_B)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polresultantext") < 0)) __PYX_ERR(10, 22263, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polresultantext", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22263, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polresultantext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1262polresultantext(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_B, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1262polresultantext(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__A;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polresultantext", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":22283
 *             %5 = x^4
 *         '''
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":22284
 *         '''
 *         B = objtogen(B)
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":22285
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_v != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":22286
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 22286, __pyx_L1_error)
    __pyx_v__v = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22285
 *         B = objtogen(B)
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22287
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 22287, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22288
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_6;

  /* "cypari/auto_gen.pxi":22289
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_6;

  /* "cypari/auto_gen.pxi":22290
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polresultantext0(__pyx_v__A, __pyx_v__B, __pyx_v__v);

  /* "cypari/auto_gen.pxi":22291
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = polresultantext0(_A, _B, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polroots(T, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22263
 *         return new_gen(_ret)
 * 
 *     def polresultantext(A, B, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds polynomials :math:`U` and :math:`V` such that :math:`A*U + B*V = R`, where :math:`R` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polresultantext", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22293
 *         return new_gen(_ret)
 * 
 *     def polroots(T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complex roots of the polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1265polroots(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1264polroots[] = "\n        Complex roots of the polynomial\n        :math:`T`, given as a column vector where each root is repeated according to\n        its multiplicity. The precision is given as for transcendental functions: in\n        GP it is kept in the variable :literal:`realprecision` and is transparent to the\n        user, but it must be explicitly given as a second argument in library mode.\n        \n        The algorithm used is a modification of Sch\303\266nhage's\n        root-finding algorithm, due to and originally implemented by Gourdon.\n        It is guaranteed to converge; if furthermore :math:`T` has rational coefficients,\n        roots are guaranteed to the required relative accuracy.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1265polroots(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polroots (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polroots") < 0)) __PYX_ERR(10, 22293, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22293, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polroots", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22293, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1264polroots(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1264polroots(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, long __pyx_v_precision) {
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polroots", 0);

  /* "cypari/auto_gen.pxi":22306
 *         roots are guaranteed to the required relative accuracy.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22306, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22307
 *         '''
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = roots(_T, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22308
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = roots(_T, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":22309
 *         cdef GEN _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = roots(_T, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = roots(__pyx_v__T, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":22310
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = roots(_T, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsbound(T, tau=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22293
 *         return new_gen(_ret)
 * 
 *     def polroots(T, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Complex roots of the polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22312
 *         return new_gen(_ret)
 * 
 *     def polrootsbound(T, tau=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a sharp upper bound :math:`B` for the modulus of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1267polrootsbound(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1266polrootsbound[] = "\n        Return a sharp upper bound :math:`B` for the modulus of\n        the largest complex root of the polynomial :math:`T` with complex coefficients\n        with relative error :math:`\\tau`. More precisely, we have :math:`\\|z\\| <= B` for all roots\n        and there exist one root such that :math:`\\|z_0\\| >= B \\exp (-2\\tau)`. Much faster\n        than either polroots or polrootsreal.\n        \n        ::\n        \n            ? T=poltchebi(500);\n            ? vecmax(abs(polroots(T)))\n            time = 5,706 ms.\n            %2 = 0.99999506520185816611184481744870013191\n            ? vecmax(abs(polrootsreal(T)))\n            time = 1,972 ms.\n            %3 = 0.99999506520185816611184481744870013191\n            ? polrootsbound(T)\n            time = 217 ms.\n            %4 = 1.0098792554165905155\n            ? polrootsbound(T, log(2)/2) \\\\ allow a factor 2, much faster\n            time = 51 ms.\n            %5 = 1.4065759938190154354\n            ? polrootsbound(T, 1e-4)\n            time = 504 ms.\n            %6 = 1.0000920717983847741\n            ? polrootsbound(T, 1e-6)\n            time = 810 ms.\n            %7 = 0.9999960628901692905\n            ? polrootsbound(T, 1e-10)\n            time = 1,351 ms.\n            %8 = 0.9999950652993869760\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1267polrootsbound(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tau = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsbound (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tau,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tau);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsbound") < 0)) __PYX_ERR(10, 22312, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tau = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsbound", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22312, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsbound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1266polrootsbound(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_tau);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1266polrootsbound(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_tau) {
  int __pyx_v__have_tau;
  GEN __pyx_v__T;
  GEN __pyx_v__tau;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polrootsbound", 0);
  __Pyx_INCREF(__pyx_v_tau);

  /* "cypari/auto_gen.pxi":22345
 *             %8 = 0.9999950652993869760
 *         '''
 *         cdef bint _have_tau = (tau is not None)             # <<<<<<<<<<<<<<
 *         if _have_tau:
 *             tau = objtogen(tau)
 */
  __pyx_t_1 = (__pyx_v_tau != Py_None);
  __pyx_v__have_tau = __pyx_t_1;

  /* "cypari/auto_gen.pxi":22346
 *         '''
 *         cdef bint _have_tau = (tau is not None)
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             tau = objtogen(tau)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_tau != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22347
 *         cdef bint _have_tau = (tau is not None)
 *         if _have_tau:
 *             tau = objtogen(tau)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tau, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_tau, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22346
 *         '''
 *         cdef bint _have_tau = (tau is not None)
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             tau = objtogen(tau)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22348
 *         if _have_tau:
 *             tau = objtogen(tau)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22348, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22349
 *             tau = objtogen(tau)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tau = NULL
 *         if _have_tau:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22350
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL             # <<<<<<<<<<<<<<
 *         if _have_tau:
 *             _tau = (<Gen>tau).g
 */
  __pyx_v__tau = NULL;

  /* "cypari/auto_gen.pxi":22351
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 */
  __pyx_t_1 = (__pyx_v__have_tau != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22352
 *         cdef GEN _tau = NULL
 *         if _have_tau:
 *             _tau = (<Gen>tau).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tau)->__pyx_base.g;
    __pyx_v__tau = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22351
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _tau = NULL
 *         if _have_tau:             # <<<<<<<<<<<<<<
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 */
  }

  /* "cypari/auto_gen.pxi":22353
 *         if _have_tau:
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrootsbound(__pyx_v__T, __pyx_v__tau);

  /* "cypari/auto_gen.pxi":22354
 *             _tau = (<Gen>tau).g
 *         cdef GEN _ret = polrootsbound(_T, _tau)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsff(x, p=None, a=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22312
 *         return new_gen(_ret)
 * 
 *     def polrootsbound(T, tau=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return a sharp upper bound :math:`B` for the modulus of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsbound", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tau);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22356
 *         return new_gen(_ret)
 * 
 *     def polrootsff(x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1269polrootsff(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1268polrootsff[] = "\n        Obsolete, kept for backward compatibility: use factormod.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1269polrootsff(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsff (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_a,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsff") < 0)) __PYX_ERR(10, 22356, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_p = values[0];
    __pyx_v_a = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsff", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22356, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1268polrootsff(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_p, __pyx_v_a);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1268polrootsff(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, PyObject *__pyx_v_a) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_p;
  int __pyx_v__have_a;
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("polrootsff", 0);
  __Pyx_INCREF(__pyx_v_p);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":22360
 *         Obsolete, kept for backward compatibility: use factormod.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22360, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22361
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__71, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22362
 *         from warnings import warn
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             p = objtogen(p)
 */
  __pyx_t_3 = (__pyx_v_p != Py_None);
  __pyx_v__have_p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":22363
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":22364
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 *             p = objtogen(p)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22363
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 */
  }

  /* "cypari/auto_gen.pxi":22365
 *         if _have_p:
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_3 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":22366
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":22367
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22366
 *             p = objtogen(p)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22368
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 22368, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22369
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = NULL
 *         if _have_p:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":22370
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL             # <<<<<<<<<<<<<<
 *         if _have_p:
 *             _p = (<Gen>p).g
 */
  __pyx_v__p = NULL;

  /* "cypari/auto_gen.pxi":22371
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_3 = (__pyx_v__have_p != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":22372
 *         cdef GEN _p = NULL
 *         if _have_p:
 *             _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
    __pyx_v__p = __pyx_t_5;

    /* "cypari/auto_gen.pxi":22371
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = NULL
 *         if _have_p:             # <<<<<<<<<<<<<<
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 */
  }

  /* "cypari/auto_gen.pxi":22373
 *         if _have_p:
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_gen.pxi":22374
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 */
  __pyx_t_3 = (__pyx_v__have_a != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":22375
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_5;

    /* "cypari/auto_gen.pxi":22374
 *             _p = (<Gen>p).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 */
  }

  /* "cypari/auto_gen.pxi":22376
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrootsff(__pyx_v__x, __pyx_v__p, __pyx_v__a);

  /* "cypari/auto_gen.pxi":22377
 *             _a = (<Gen>a).g
 *         cdef GEN _ret = polrootsff(_x, _p, _a)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsmod(f, D=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22356
 *         return new_gen(_ret)
 * 
 *     def polrootsff(x, p=None, a=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Obsolete, kept for backward compatibility: use factormod.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22379
 *         return new_gen(_ret)
 * 
 *     def polrootsmod(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of roots of the polynomial :math:`f` over the finite field defined
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1271polrootsmod(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1270polrootsmod[] = "\n        Vector of roots of the polynomial :math:`f` over the finite field defined\n        by the domain :math:`D` as follows:\n        \n        - :math:`D = p` a prime: factor over :math:`\\mathbb{F}_p`;\n        \n        - :math:`D = [T,p]` for a prime :math:`p` and :math:`T` an irreducible polynomial over\n          :math:`\\mathbb{F}_p`: factor over :math:`\\mathbb{F}_p[x]/(T)`;\n        \n        - :math:`D` a :literal:`t_FFELT`: factor over the attached field;\n        \n        - :math:`D` omitted: factor over the field of definition of :math:`f`, which\n          must be a finite field.\n        \n        Multiple roots are :emphasis:`not` repeated.\n        \n        ::\n        \n            ? polrootsmod(x^2-1,2)\n            %1 = [Mod(1, 2)]~\n            ? polrootsmod(x^2+1,3)\n            %2 = []~\n            ? polrootsmod(x^2+1, [3,y^2+1])\n            %3 = [Mod(Mod(1, 3)*y, Mod(1, 3)*y^2 + Mod(1, 3)),\n             Mod(Mod(2, 3)*y, Mod(1, 3)*y^2 + Mod(1, 3))]~\n            ? polrootsmod(x^2 + Mod(1,3))\n            %4 = []~\n            ? liftall( polrootsmod(x^2 + Mod(Mod(1,3),y^2+1)) )\n            %5 = [y, 2*y]~\n            ? t = ffgen(y^2+Mod(1,3)); polrootsmod(x^2 + t^0)\n            %6 = [y, 2*y]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1271polrootsmod(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_D = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsmod (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_D);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsmod") < 0)) __PYX_ERR(10, 22379, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsmod", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1270polrootsmod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_D);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1270polrootsmod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_D) {
  int __pyx_v__have_D;
  GEN __pyx_v__f;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polrootsmod", 0);
  __Pyx_INCREF(__pyx_v_D);

  /* "cypari/auto_gen.pxi":22412
 *             %6 = [y, 2*y]~
 *         '''
 *         cdef bint _have_D = (D is not None)             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             D = objtogen(D)
 */
  __pyx_t_1 = (__pyx_v_D != Py_None);
  __pyx_v__have_D = __pyx_t_1;

  /* "cypari/auto_gen.pxi":22413
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22414
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:
 *             D = objtogen(D)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_D, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_D, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22413
 *         '''
 *         cdef bint _have_D = (D is not None)
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             D = objtogen(D)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22415
 *         if _have_D:
 *             D = objtogen(D)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22415, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22416
 *             D = objtogen(D)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _D = NULL
 *         if _have_D:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22417
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL             # <<<<<<<<<<<<<<
 *         if _have_D:
 *             _D = (<Gen>D).g
 */
  __pyx_v__D = NULL;

  /* "cypari/auto_gen.pxi":22418
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)
 */
  __pyx_t_1 = (__pyx_v__have_D != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22419
 *         cdef GEN _D = NULL
 *         if _have_D:
 *             _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polrootsmod(_f, _D)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
    __pyx_v__D = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22418
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _D = NULL
 *         if _have_D:             # <<<<<<<<<<<<<<
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)
 */
  }

  /* "cypari/auto_gen.pxi":22420
 *         if _have_D:
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polrootsmod(__pyx_v__f, __pyx_v__D);

  /* "cypari/auto_gen.pxi":22421
 *             _D = (<Gen>D).g
 *         cdef GEN _ret = polrootsmod(_f, _D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootspadic(x, p, long r):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22379
 *         return new_gen(_ret)
 * 
 *     def polrootsmod(f, D=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of roots of the polynomial :math:`f` over the finite field defined
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsmod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22423
 *         return new_gen(_ret)
 * 
 *     def polrootspadic(x, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol`, given to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1273polrootspadic(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1272polrootspadic[] = "\n        Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol`, given to\n        :math:`p`-adic precision :math:`r`; the integer :math:`p` is assumed to be a prime.\n        Multiple roots are\n        :emphasis:`not` repeated. Note that this is not the same as the roots in\n        :math:`\\mathbb{Z}/p^r\\mathbb{Z}`, rather it gives approximations in :math:`\\mathbb{Z}/p^r\\mathbb{Z}` of the true roots\n        living in :math:`\\mathbb{Q}_p`.\n        \n        ::\n        \n            ? polrootspadic(x^3 - x^2 + 64, 2, 5)\n            %1 = [2^3 + O(2^5), 2^3 + 2^4 + O(2^5), 1 + O(2^5)]~\n        \n        If :emphasis:`pol` has inexact :literal:`t_PADIC` coefficients, this is not always\n        well-defined; in this case, the polynomial is first made integral by dividing\n        out the :math:`p`-adic content, then lifted\n        to :math:`\\mathbb{Z}` using :literal:`truncate` coefficientwise. Hence the roots given are\n        approximations of the roots of an exact polynomial which is :math:`p`-adically\n        close to the input. To avoid pitfalls, we advise to only factor polynomials\n        with exact rational coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1273polrootspadic(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootspadic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_r,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_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("polrootspadic", 1, 2, 2, 1); __PYX_ERR(10, 22423, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootspadic") < 0)) __PYX_ERR(10, 22423, __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_p = values[0];
    __pyx_v_r = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22423, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootspadic", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22423, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootspadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1272polrootspadic(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_p, __pyx_v_r);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1272polrootspadic(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_r) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polrootspadic", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":22445
 *         with exact rational coefficients.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":22446
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 22446, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22447
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = rootpadic(_x, _p, r)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":22448
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rootpadic(_x, _p, r)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":22449
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = rootpadic(_x, _p, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rootpadic(__pyx_v__x, __pyx_v__p, __pyx_v_r);

  /* "cypari/auto_gen.pxi":22450
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = rootpadic(_x, _p, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polrootsreal(T, ab=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22423
 *         return new_gen(_ret)
 * 
 *     def polrootspadic(x, p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         Vector of :math:`p`-adic roots of the polynomial :emphasis:`pol`, given to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootspadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22452
 *         return new_gen(_ret)
 * 
 *     def polrootsreal(T, ab=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real roots of the polynomial :math:`T` with real coefficients, multiple
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1275polrootsreal(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1274polrootsreal[] = "\n        Real roots of the polynomial :math:`T` with real coefficients, multiple\n        roots being included according to their multiplicity. If the polynomial\n        does not have rational coefficients, it is first rescaled and rounded.\n        The roots are given to a relative accuracy of :literal:`realprecision`.\n        If argument :emphasis:`ab` is\n        present, it must be a vector :math:`[a,b]` with two components (of type\n        :literal:`t_INT`, :literal:`t_FRAC` or :literal:`t_INFINITY`) and we restrict to roots belonging\n        to that closed interval.\n        \n        ::\n        \n            ? \\p9\n            ? polrootsreal(x^2-2)\n            %1 = [-1.41421356, 1.41421356]~\n            ? polrootsreal(x^2-2, [1,+oo])\n            %2 = [1.41421356]~\n            ? polrootsreal(x^2-2, [2,3])\n            %3 = []~\n            ? polrootsreal((x-1)*(x-2), [2,3])\n            %4 = [2.00000000]~\n        \n        The algorithm used is a modification of Uspensky's method (relying on\n        Descartes's rule of sign), following Rouillier and Zimmerman's article\n        \"Efficient isolation of a polynomial real roots\"\n        (:literal:`http://hal.inria.fr/inria-00072518/`). Barring bugs, it is guaranteed\n        to converge and to give the roots to the required accuracy.\n        \n        :strong:`Remark.` If the polynomial :math:`T` is of the\n        form :math:`Q(x^h)` for some :math:`h >= 2` and :emphasis:`ab` is omitted, the routine will\n        apply the algorithm to :math:`Q` (restricting to non-negative roots when :math:`h` is\n        even), then take :math:`h`-th roots. On the other hand, if you want to specify\n        :emphasis:`ab`, you should apply the routine to :math:`Q` yourself and a suitable\n        interval :math:`[a',b']` using approximate :math:`h`-th roots adapted to your problem:\n        the function will not perform this change of variables if :emphasis:`ab` is present.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1275polrootsreal(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ab = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polrootsreal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ab,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ab);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polrootsreal") < 0)) __PYX_ERR(10, 22452, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_ab = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22452, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polrootsreal", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22452, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1274polrootsreal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_ab, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1274polrootsreal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_ab, long __pyx_v_precision) {
  int __pyx_v__have_ab;
  GEN __pyx_v__T;
  GEN __pyx_v__ab;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("polrootsreal", 0);
  __Pyx_INCREF(__pyx_v_ab);

  /* "cypari/auto_gen.pxi":22489
 *         the function will not perform this change of variables if :emphasis:`ab` is present.
 *         '''
 *         cdef bint _have_ab = (ab is not None)             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             ab = objtogen(ab)
 */
  __pyx_t_1 = (__pyx_v_ab != Py_None);
  __pyx_v__have_ab = __pyx_t_1;

  /* "cypari/auto_gen.pxi":22490
 *         '''
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_ab != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22491
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 *             ab = objtogen(ab)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ab, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_ab, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22490
 *         '''
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22492
 *         if _have_ab:
 *             ab = objtogen(ab)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22492, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22493
 *             ab = objtogen(ab)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22494
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 */
  __pyx_v__ab = NULL;

  /* "cypari/auto_gen.pxi":22495
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_ab != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22496
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 *             _ab = (<Gen>ab).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = realroots(_T, _ab, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ab)->__pyx_base.g;
    __pyx_v__ab = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22495
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":22497
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = realroots(_T, _ab, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":22498
 *             _ab = (<Gen>ab).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = realroots(_T, _ab, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = realroots(__pyx_v__T, __pyx_v__ab, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":22499
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = realroots(_T, _ab, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polsturm(T, ab=None, _arg2=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22499, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22452
 *         return new_gen(_ret)
 * 
 *     def polrootsreal(T, ab=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real roots of the polynomial :math:`T` with real coefficients, multiple
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polrootsreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ab);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22501
 *         return new_gen(_ret)
 * 
 *     def polsturm(T, ab=None, _arg2=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct real roots of the real polynomial :emphasis:`T`. If
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1277polsturm(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1276polsturm[] = "\n        Number of distinct real roots of the real polynomial :emphasis:`T`. If\n        the argument :emphasis:`ab` is present, it must be a vector :math:`[a,b]` with\n        two real components (of type :literal:`t_INT`, :literal:`t_REAL`, :literal:`t_FRAC`\n        or :literal:`t_INFINITY`) and we count roots belonging to that closed interval.\n        \n        If possible, you should stick to exact inputs, that is avoid :literal:`t_REAL`\302\240s in\n        :math:`T` and the bounds :math:`a,b`: the result is then guaranteed and we use a fast\n        algorithm (Uspensky's method, relying on Descartes's rule of sign, see\n        :literal:`polrootsreal`). Otherwise, the polynomial is rescaled and rounded first\n        and the result may be wrong due to that initial error. If only :math:`a` or :math:`b` is\n        inexact, on the other hand, the interval is first thickened using rational\n        endpoints and the result remains guaranteed unless there exist a root\n        :emphasis:`very` close to a non-rational endpoint (which may be missed or unduly\n        included).\n        \n        ::\n        \n            ? T = (x-1)*(x-2)*(x-3);\n            ? polsturm(T)\n            %2 = 3\n            ? polsturm(T, [-oo,2])\n            %3 = 2\n            ? polsturm(T, [1/2,+oo])\n            %4 = 3\n            ? polsturm(T, [1, Pi]) \\\\ Pi inexact: not recommended !\n            %5 = 3\n            ? polsturm(T*1., [0, 4]) \\\\ T*1. inexact: not recommended !\n            %6 = 3\n            ? polsturm(T^2, [0, 4]) \\\\ not squarefree: roots are not repeated!\n            %7 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1277polsturm(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ab = 0;
  PyObject *__pyx_v__arg2 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsturm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ab,&__pyx_n_s_arg2,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ab);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arg2);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polsturm") < 0)) __PYX_ERR(10, 22501, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_ab = values[0];
    __pyx_v__arg2 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polsturm", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22501, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1276polsturm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_ab, __pyx_v__arg2);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1276polsturm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_ab, PyObject *__pyx_v__arg2) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_ab;
  int __pyx_v__have__arg2;
  GEN __pyx_v__T;
  GEN __pyx_v__ab;
  GEN __pyx_v___arg2;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("polsturm", 0);
  __Pyx_INCREF(__pyx_v_ab);
  __Pyx_INCREF(__pyx_v__arg2);

  /* "cypari/auto_gen.pxi":22534
 *             %7 = 3
 *         '''
 *         if _arg2 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 */
  __pyx_t_1 = (__pyx_v__arg2 != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":22535
 *         '''
 *         if _arg2 is not None:
 *             from warnings import warn             # <<<<<<<<<<<<<<
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have_ab = (ab is not None)
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_n_s_warn);
    __Pyx_GIVEREF(__pyx_n_s_warn);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_warn);
    __pyx_t_4 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 22535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22535, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_warn = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/auto_gen.pxi":22536
 *         if _arg2 is not None:
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__72, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 22536, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/auto_gen.pxi":22534
 *             %7 = 3
 *         '''
 *         if _arg2 is not None:             # <<<<<<<<<<<<<<
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 */
  }

  /* "cypari/auto_gen.pxi":22537
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have_ab = (ab is not None)             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             ab = objtogen(ab)
 */
  __pyx_t_2 = (__pyx_v_ab != Py_None);
  __pyx_v__have_ab = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22538
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         cdef bint _have__arg2 = (_arg2 is not None)
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":22539
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 *             ab = objtogen(ab)             # <<<<<<<<<<<<<<
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ab, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 22539, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_ab, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cypari/auto_gen.pxi":22538
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             ab = objtogen(ab)
 *         cdef bint _have__arg2 = (_arg2 is not None)
 */
  }

  /* "cypari/auto_gen.pxi":22540
 *         if _have_ab:
 *             ab = objtogen(ab)
 *         cdef bint _have__arg2 = (_arg2 is not None)             # <<<<<<<<<<<<<<
 *         if _have__arg2:
 *             _arg2 = objtogen(_arg2)
 */
  __pyx_t_2 = (__pyx_v__arg2 != Py_None);
  __pyx_v__have__arg2 = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22541
 *             ab = objtogen(ab)
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             _arg2 = objtogen(_arg2)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have__arg2 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":22542
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:
 *             _arg2 = objtogen(_arg2)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v__arg2, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 22542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v__arg2, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "cypari/auto_gen.pxi":22541
 *             ab = objtogen(ab)
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             _arg2 = objtogen(_arg2)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22543
 *         if _have__arg2:
 *             _arg2 = objtogen(_arg2)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 22543, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22544
 *             _arg2 = objtogen(_arg2)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_6;

  /* "cypari/auto_gen.pxi":22545
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL             # <<<<<<<<<<<<<<
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 */
  __pyx_v__ab = NULL;

  /* "cypari/auto_gen.pxi":22546
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg2 = NULL
 */
  __pyx_t_2 = (__pyx_v__have_ab != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":22547
 *         cdef GEN _ab = NULL
 *         if _have_ab:
 *             _ab = (<Gen>ab).g             # <<<<<<<<<<<<<<
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_ab)->__pyx_base.g;
    __pyx_v__ab = __pyx_t_6;

    /* "cypari/auto_gen.pxi":22546
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ab = NULL
 *         if _have_ab:             # <<<<<<<<<<<<<<
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg2 = NULL
 */
  }

  /* "cypari/auto_gen.pxi":22548
 *         if _have_ab:
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg2 = NULL             # <<<<<<<<<<<<<<
 *         if _have__arg2:
 *             __arg2 = (<Gen>_arg2).g
 */
  __pyx_v___arg2 = NULL;

  /* "cypari/auto_gen.pxi":22549
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             __arg2 = (<Gen>_arg2).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg2)
 */
  __pyx_t_2 = (__pyx_v__have__arg2 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":22550
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:
 *             __arg2 = (<Gen>_arg2).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = sturmpart(_T, _ab, __arg2)
 *         clear_stack()
 */
    __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v__arg2)->__pyx_base.g;
    __pyx_v___arg2 = __pyx_t_6;

    /* "cypari/auto_gen.pxi":22549
 *             _ab = (<Gen>ab).g
 *         cdef GEN __arg2 = NULL
 *         if _have__arg2:             # <<<<<<<<<<<<<<
 *             __arg2 = (<Gen>_arg2).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg2)
 */
  }

  /* "cypari/auto_gen.pxi":22551
 *         if _have__arg2:
 *             __arg2 = (<Gen>_arg2).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg2)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = sturmpart(__pyx_v__T, __pyx_v__ab, __pyx_v___arg2);

  /* "cypari/auto_gen.pxi":22552
 *             __arg2 = (<Gen>_arg2).g
 *         cdef long _ret = sturmpart(_T, _ab, __arg2)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":22553
 *         cdef long _ret = sturmpart(_T, _ab, __arg2)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def polsylvestermatrix(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 22553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22501
 *         return new_gen(_ret)
 * 
 *     def polsturm(T, ab=None, _arg2=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Number of distinct real roots of the real polynomial :emphasis:`T`. If
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polsturm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_ab);
  __Pyx_XDECREF(__pyx_v__arg2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22555
 *         return _ret
 * 
 *     def polsylvestermatrix(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Forms the Sylvester matrix
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1279polsylvestermatrix(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1278polsylvestermatrix[] = "\n        Forms the Sylvester matrix\n        corresponding to the two polynomials :math:`x` and :math:`y`, where the coefficients of\n        the polynomials are put in the columns of the matrix (which is the natural\n        direction for solving equations afterwards). The use of this matrix can be\n        essential when dealing with polynomials with inexact entries, since\n        polynomial Euclidean division doesn't make much sense in this case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1279polsylvestermatrix(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsylvestermatrix (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1278polsylvestermatrix(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1278polsylvestermatrix(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("polsylvestermatrix", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":22564
 *         polynomial Euclidean division doesn't make much sense in this case.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":22565
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 22565, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22566
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = sylvestermatrix(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":22567
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sylvestermatrix(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":22568
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = sylvestermatrix(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sylvestermatrix(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":22569
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = sylvestermatrix(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def polsym(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22569, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22555
 *         return _ret
 * 
 *     def polsylvestermatrix(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Forms the Sylvester matrix
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polsylvestermatrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22571
 *         return new_gen(_ret)
 * 
 *     def polsym(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the column vector of the symmetric powers of the roots of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1281polsym(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1280polsym[] = "\n        Creates the column vector of the symmetric powers of the roots of the\n        polynomial :math:`x` up to power :math:`n`, using Newton's formula.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1281polsym(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polsym (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22571, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.polsym", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1280polsym(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1280polsym(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polsym", 0);

  /* "cypari/auto_gen.pxi":22576
 *         polynomial :math:`x` up to power :math:`n`, using Newton's formula.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polsym(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22576, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22577
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = polsym(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22578
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polsym(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = polsym(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":22579
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = polsym(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def poltschirnhaus(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22571
 *         return new_gen(_ret)
 * 
 *     def polsym(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the column vector of the symmetric powers of the roots of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.polsym", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22581
 *         return new_gen(_ret)
 * 
 *     def poltschirnhaus(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Applies a random Tschirnhausen
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1283poltschirnhaus(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1282poltschirnhaus[] = "\n        Applies a random Tschirnhausen\n        transformation to the polynomial :math:`x`, which is assumed to be non-constant\n        and separable, so as to obtain a new equation for the \303\251tale algebra\n        defined by :math:`x`. This is for instance useful when computing resolvents,\n        hence is used by the :literal:`polgalois` function.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1283poltschirnhaus(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poltschirnhaus (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1282poltschirnhaus(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1282poltschirnhaus(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("poltschirnhaus", 0);

  /* "cypari/auto_gen.pxi":22589
 *         hence is used by the :literal:`polgalois` function.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = tschirnhaus(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22589, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22590
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = tschirnhaus(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22591
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = tschirnhaus(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = tschirnhaus(__pyx_v__x);

  /* "cypari/auto_gen.pxi":22592
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = tschirnhaus(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def powers(x, long n, x0=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22581
 *         return new_gen(_ret)
 * 
 *     def poltschirnhaus(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Applies a random Tschirnhausen
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.poltschirnhaus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22594
 *         return new_gen(_ret)
 * 
 *     def powers(x, long n, x0=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         For non-negative :math:`n`, return the vector with :math:`n+1` components
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1285powers(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1284powers[] = "\n        For non-negative :math:`n`, return the vector with :math:`n+1` components\n        :math:`[1,x,...,x^n]` if :literal:`x0` is omitted, and :math:`[x_0, x_0*x, ..., x_0*x^n]`\n        otherwise.\n        \n        ::\n        \n            ? powers(Mod(3,17), 4)\n            %1 = [Mod(1, 17), Mod(3, 17), Mod(9, 17), Mod(10, 17), Mod(13, 17)]\n            ? powers(Mat([1,2;3,4]), 3)\n            %2 = [[1, 0; 0, 1], [1, 2; 3, 4], [7, 10; 15, 22], [37, 54; 81, 118]]\n            ? powers(3, 5, 2)\n            %3 = [2, 6, 18, 54, 162, 486]\n        \n        When :math:`n < 0`, the function returns the empty vector :literal:`[]`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1285powers(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_x0 = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("powers (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_x0,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x0);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "powers") < 0)) __PYX_ERR(10, 22594, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22594, __pyx_L3_error)
    __pyx_v_x0 = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("powers", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22594, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.powers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1284powers(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n, __pyx_v_x0);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1284powers(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n, PyObject *__pyx_v_x0) {
  int __pyx_v__have_x0;
  GEN __pyx_v__x;
  GEN __pyx_v__x0;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("powers", 0);
  __Pyx_INCREF(__pyx_v_x0);

  /* "cypari/auto_gen.pxi":22611
 *         When :math:`n < 0`, the function returns the empty vector :literal:`[]`.
 *         '''
 *         cdef bint _have_x0 = (x0 is not None)             # <<<<<<<<<<<<<<
 *         if _have_x0:
 *             x0 = objtogen(x0)
 */
  __pyx_t_1 = (__pyx_v_x0 != Py_None);
  __pyx_v__have_x0 = __pyx_t_1;

  /* "cypari/auto_gen.pxi":22612
 *         '''
 *         cdef bint _have_x0 = (x0 is not None)
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             x0 = objtogen(x0)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_x0 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22613
 *         cdef bint _have_x0 = (x0 is not None)
 *         if _have_x0:
 *             x0 = objtogen(x0)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x0, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22612
 *         '''
 *         cdef bint _have_x0 = (x0 is not None)
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             x0 = objtogen(x0)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22614
 *         if _have_x0:
 *             x0 = objtogen(x0)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22614, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22615
 *             x0 = objtogen(x0)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x0 = NULL
 *         if _have_x0:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22616
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL             # <<<<<<<<<<<<<<
 *         if _have_x0:
 *             _x0 = (<Gen>x0).g
 */
  __pyx_v__x0 = NULL;

  /* "cypari/auto_gen.pxi":22617
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 */
  __pyx_t_1 = (__pyx_v__have_x0 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22618
 *         cdef GEN _x0 = NULL
 *         if _have_x0:
 *             _x0 = (<Gen>x0).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x0)->__pyx_base.g;
    __pyx_v__x0 = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22617
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _x0 = NULL
 *         if _have_x0:             # <<<<<<<<<<<<<<
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 */
  }

  /* "cypari/auto_gen.pxi":22619
 *         if _have_x0:
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpowers0(__pyx_v__x, __pyx_v_n, __pyx_v__x0);

  /* "cypari/auto_gen.pxi":22620
 *             _x0 = (<Gen>x0).g
 *         cdef GEN _ret = gpowers0(_x, n, _x0)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def precision(x, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22594
 *         return new_gen(_ret)
 * 
 *     def powers(x, long n, x0=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         For non-negative :math:`n`, return the vector with :math:`n+1` components
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.powers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22622
 *         return new_gen(_ret)
 * 
 *     def precision(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1287precision(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1286precision[] = "\n        The function behaves differently according to whether :math:`n` is\n        present and positive or not. If :math:`n` is missing, the function returns the\n        floating point precision in decimal digits of the PARI object :math:`x`. If :math:`x`\n        has no floating point component, the function returns :literal:`+oo`.\n        \n        ::\n        \n            ? precision(exp(1e-100))\n            %1 = 154 \\\\ 154 significant decimal digits\n            ? precision(2 + x)\n            %2 = +oo \\\\ exact object\n            ? precision(0.5 + O(x))\n            %3 = 38 \\\\ floating point accuracy, NOT series precision\n            ? precision( [ exp(1e-100), 0.5 ] )\n            %4 = 38 \\\\ minimal accuracy among components\n        \n        If :math:`n` is present, the function creates a new object equal to :math:`x` with a new\n        floating point precision :math:`n`: :math:`n` is the number of desired significant\n        :emphasis:`decimal` digits. If :math:`n` is smaller than the precision of a :literal:`t_REAL`\n        component of :math:`x`, it is truncated, otherwise it is extended with zeros.\n        For non-floating point types, no change.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1287precision(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("precision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "precision") < 0)) __PYX_ERR(10, 22622, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22622, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("precision", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22622, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1286precision(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1286precision(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("precision", 0);

  /* "cypari/auto_gen.pxi":22646
 *         For non-floating point types, no change.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precision0(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22646, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22647
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = precision0(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22648
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precision0(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = precision0(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":22649
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precision0(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def precprime(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22622
 *         return new_gen(_ret)
 * 
 *     def precision(x, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The function behaves differently according to whether :math:`n` is
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22651
 *         return new_gen(_ret)
 * 
 *     def precprime(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the largest pseudoprime (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1289precprime(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1288precprime[] = "\n        Finds the largest pseudoprime (see\n        :literal:`ispseudoprime`) less than or equal to :math:`x`. :math:`x` can be of any real type.\n        Returns 0 if :math:`x <= 1`. Note that if :math:`x` is a prime, this function returns :math:`x`\n        and not the largest prime strictly smaller than :math:`x`. To rigorously prove that\n        the result is prime, use :literal:`isprime`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1289precprime(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("precprime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1288precprime(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1288precprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("precprime", 0);

  /* "cypari/auto_gen.pxi":22659
 *         the result is prime, use :literal:`isprime`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precprime(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22659, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22660
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = precprime(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22661
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precprime(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = precprime(__pyx_v__x);

  /* "cypari/auto_gen.pxi":22662
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = precprime(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primecert(N, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22651
 *         return new_gen(_ret)
 * 
 *     def precprime(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Finds the largest pseudoprime (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.precprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22664
 *         return new_gen(_ret)
 * 
 *     def primecert(N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If N is a prime, return a PARI Primality Certificate for the prime :math:`N`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1291primecert(PyObject *__pyx_v_N, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1290primecert[] = "\n        If N is a prime, return a PARI Primality Certificate for the prime :math:`N`,\n        as described below. Otherwise, return 0. A Primality Certificate\n        :math:`c` can be checked using :literal:`primecertisvalid`:math:`(c)`.\n        \n        If :math:`flag = 0` (default), return an ECPP certificate (Atkin-Morain)\n        \n        A PARI ECPP Primality Certificate for the prime :math:`N` is either a prime\n        integer :math:`N < 2^{64}` or a vector :literal:`C` of length :math:`\\ell` whose :math:`i`th\n        component :literal:`C[i]` is a vector of length :math:`5` containing :math:`N_i`, :math:`t_i`,\n        :math:`s_i`, :math:`a_i`, :math:`P_i` (in that order) where :math:`N_1 = N`. It is said to be valid\n        if for each :math:`i = 1,..., \\ell`, all of the following conditions are\n        satisfied\n        \n        - :math:`N_i` is a positive integer\n        \n        - :math:`t_i` is an integer such that :math:`t_i < 4N_i^2`\n        \n        - :math:`s_i` is a positive integer which divides :math:`m_i` where\n          :math:`m_i = N_i + 1 - t_i`\n        \n        - If we set :math:`q_i = (m_i)/(s_i)`, then\n        \n        \302\240\302\240:strong:`*` :math:`q_i > (N_i^{1/4}+1)^2`\n        \n        \302\240\302\240:strong:`*` :math:`q_i = N_{i+1}` if :math:`1 <= i < l`\n        \n        \302\240\302\240:strong:`*` :math:`q_\\ell <= 2^{64}` is prime\n        \n        - :math:`a_i` is an integer\n        \n        \302\240\302\240:strong:`*` :literal:`P[i]` is a vector of length :math:`2` representing the affine\n        point :math:`P_i = (x_i, y_i)` on the elliptic curve :math:`E: y^2 = x^3 + a_ix + b_i`\n        modulo :math:`N_i` where :math:`b_i = y_i^2 - x_i^3 - a_ix_i` satisfying the following:\n        \n        \302\240\302\240:strong:`*` :math:`m_i P_i = oo`\n        \n        \302\240\302\240:strong:`*` :math:`s_i P_i != oo`\n        \n        :strong:`Theorem.` If :math:`N` is an integer and there exist posi""tive integers\n        :math:`m, q` and a point :math:`P` on the elliptic curve :math:`E: y^2 = x^3 + ax + b` defined\n        modulo :math:`N` such that :math:`q > (N^{1/4} + 1)^2`, :math:`q` is a prime divisor of :math:`m`,\n        :math:`mP = oo` and :math:`(m)/(q)P != oo`, then :math:`N` is prime.\n        \n        Using the above theorem, the data in the vector :literal:`C` can be used to\n        certify the primality of :math:`N` assuming :math:`q_\\ell` is prime.\n        \n        ::\n        \n            ? primecert(10^35 + 69)\n            %1 = [[100000000000000000000000000000000069, 5468679110354\n            52074, 2963504668391148, 0, [60737979324046450274283740674\n            208692, 24368673584839493121227731392450025]], [3374383076\n            4501150277, -11610830419, 734208843, 0, [26740412374402652\n            72 4, 6367191119818901665]], [45959444779, 299597, 2331, 0\n            , [18022351516, 9326882 51]]]\n            ? primecert(nextprime(2^64))\n            %2 = [[18446744073709551629, -8423788454, 160388, 1, [1059\n            8342506117936052, 2225259013356795550]]]\n            ? primecert(6)\n            %3 = 0\n            ? primecert(41)\n            %4 = 41\n        \n        If :math:`flag = 1` (very slow), return an :math:`N-1` certificate (Pocklington Lehmer)\n        \n        A PARI :math:`N-1` Primality Certificate for the prime :math:`N` is either a prime\n        integer :math:`N < 2^{64}` or a pair :math:`[N, C]`, where :math:`C` is a vector with :math:`\\ell`\n        elements which are either a single integer :math:`p_i < 2^{64}` or a\n        triple :math:`[p_i,a_i,C_i]` with :math:`p_i > 2^{64}` satisfying the following\n        properties:\n        \n        - :math:`p_i` is a prime divisor of :math:`N - 1`;\n        \n        - :math:`a_i` is an integer such that :math:`a_i^{N-1} = 1 (mod N)` and\n          :math:`a_i^{(N-1)/p_i} - 1` is coprime with :math:`N`;\n        \n        - :math:`C_i` is an :math:`N-1` ""Primality Certificate for :math:`p_i`\n        \n        - The product :math:`F` of the :math:`p_i^{v_{p_i}(N-1)}` is strictly larger than\n          :math:`N^{1/3}`. Provided that all :math:`p_i` are indeed primes, this implies that any\n          divisor of :math:`N` is congruent to :math:`1` modulo :math:`F`.\n        \n        - The Billhart, Lehmer, Selfridge criterion is satisfied: when we write\n          :math:`N = 1 + c_1 F + c_2 F^2` in base :math:`F` the polynomial :math:`1 + c_1 X + c_2 X^2`\n          is irreducible over :math:`\\mathbb{Z}`, i.e. :math:`c_1^2 - 4c_2` is not a square. This\n          implies that :math:`N` is prime.\n        \n        This algorithm requires factoring partially :math:`p-1` for various prime integers\n        :math:`p` with an unfactored parted :math:`<= p^{2/3}` and this may be exceedingly\n        slow compared to the default.\n        \n        The algorithm fails if one of the pseudo-prime factors is not prime, which is\n        exceedingly unlikely and well worth a bug report. Note that if you monitor\n        the algorithm at a high enough debug level, you may see warnings about\n        untested integers being declared primes. This is normal: we ask for partial\n        factorizations (sufficient to prove primality if the unfactored part is not\n        too large), and :literal:`factor` warns us that the cofactor hasn't been tested.\n        It may or may not be tested later, and may or may not be prime. This does\n        not affect the validity of the whole Primality Certificate.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1291primecert(PyObject *__pyx_v_N, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primecert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "primecert") < 0)) __PYX_ERR(10, 22664, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22664, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("primecert", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22664, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.primecert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1290primecert(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1290primecert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N, long __pyx_v_flag) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("primecert", 0);

  /* "cypari/auto_gen.pxi":22766
 *         not affect the validity of the whole Primality Certificate.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = primecert(_N, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22766, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22767
 *         '''
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primecert(_N, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22768
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = primecert(_N, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primecert(__pyx_v__N, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":22769
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = primecert(_N, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primecertexport(cert, long format=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22664
 *         return new_gen(_ret)
 * 
 *     def primecert(N, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         If N is a prime, return a PARI Primality Certificate for the prime :math:`N`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.primecert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22771
 *         return new_gen(_ret)
 * 
 *     def primecertexport(cert, long format=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a string suitable for print/write to display a primality certificate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1293primecertexport(PyObject *__pyx_v_cert, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1292primecertexport[] = "\n        Returns a string suitable for print/write to display a primality certificate\n        from :literal:`primecert`, the format of which depends on the value of :literal:`format`:\n        \n        - 0 (default): Human-readable format.\n        \n        - 1: Primo format 4.\n        \n        - 2: MAGMA format.\n        \n        Currently, only ECPP Primality Certificates are supported.\n        \n        ::\n        \n            ? cert = primecert(10^35+69);\n            ? s = primecertexport(cert); \\\\ Human-readable\n            ? print(s)\n            [1]\n             N = 100000000000000000000000000000000069\n             t = 546867911035452074\n             s = 2963504668391148\n            a4 = 0\n            D = -3\n            m = 99999999999999999453132088964547996\n            q = 33743830764501150277\n            E = [0, 1]\n            P = [21567861682493263464353543707814204,\n            49167839501923147849639425291163552]\n            [2]\n             N = 33743830764501150277\n             t = -11610830419\n             s = 734208843\n            a4 = 0\n            D = -3\n            m = 33743830776111980697\n            q = 45959444779\n            E = [0, 25895956964997806805]\n            P = [29257172487394218479, 3678591960085668324]\n            \n            \\\\ Primo format\n            ? s = primecertexport(cert,1); write(\"cert.out\", s);\n            \n            \\\\ Magma format, write to file\n            ? s = primecertexport(cert,2); write(\"cert.m\", s);\n            \n            ? cert = primecert(10^35+69, 1); \\\\ N-1 certificate\n             *** at top-level: primecertexport(cert)\n             *** ^---------------------\n             *** primecertexport: sorry, N-1 certificate is not yet implemented.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1293primecertexport(PyObject *__pyx_v_cert, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_format;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primecertexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_format,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "primecertexport") < 0)) __PYX_ERR(10, 22771, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_format = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_format == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22771, __pyx_L3_error)
    } else {
      __pyx_v_format = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("primecertexport", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22771, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.primecertexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1292primecertexport(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cert), __pyx_v_format);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1292primecertexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cert, long __pyx_v_format) {
  GEN __pyx_v__cert;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("primecertexport", 0);

  /* "cypari/auto_gen.pxi":22822
 *              *** primecertexport: sorry, N-1 certificate is not yet implemented.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef GEN _ret = primecertexport(_cert, format)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22822, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22823
 *         '''
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primecertexport(_cert, format)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cert)->__pyx_base.g;
  __pyx_v__cert = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22824
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef GEN _ret = primecertexport(_cert, format)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primecertexport(__pyx_v__cert, __pyx_v_format);

  /* "cypari/auto_gen.pxi":22825
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef GEN _ret = primecertexport(_cert, format)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primecertisvalid(cert):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22771
 *         return new_gen(_ret)
 * 
 *     def primecertexport(cert, long format=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a string suitable for print/write to display a primality certificate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.primecertexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22827
 *         return new_gen(_ret)
 * 
 *     def primecertisvalid(cert):             # <<<<<<<<<<<<<<
 *         r'''
 *         Verifies if cert is a valid PARI ECPP Primality certificate, as described
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1295primecertisvalid(PyObject *__pyx_v_cert, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1294primecertisvalid[] = "\n        Verifies if cert is a valid PARI ECPP Primality certificate, as described\n        in :literal:`\077\077primecert`.\n        \n        ::\n        \n            ? cert = primecert(10^35 + 69)\n            %1 = [[100000000000000000000000000000000069, 5468679110354\n            52074, 2963504668391148, 0, [60737979324046450274283740674\n            208692, 24368673584839493121227731392450025]], [3374383076\n            4501150277, -11610830419, 734208843, 0, [26740412374402652\n            72 4, 6367191119818901665]], [45959444779, 299597, 2331, 0\n            , [18022351516, 9326882 51]]]\n            ? primecertisvalid(cert)\n            %2 = 1\n            \n            ? cert[1][1]++; \\\\ random perturbation\n            ? primecertisvalid(cert)\n            %4 = 0 \\\\ no longer valid\n            ? primecertisvalid(primecert(6))\n            %5 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1295primecertisvalid(PyObject *__pyx_v_cert, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primecertisvalid (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1294primecertisvalid(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_cert));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1294primecertisvalid(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_cert) {
  GEN __pyx_v__cert;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("primecertisvalid", 0);

  /* "cypari/auto_gen.pxi":22850
 *             %5 = 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef long _ret = primecertisvalid(_cert)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22850, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22851
 *         '''
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = primecertisvalid(_cert)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cert)->__pyx_base.g;
  __pyx_v__cert = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22852
 *         sig_on()
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef long _ret = primecertisvalid(_cert)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = primecertisvalid(__pyx_v__cert);

  /* "cypari/auto_gen.pxi":22853
 *         cdef GEN _cert = (<Gen>cert).g
 *         cdef long _ret = primecertisvalid(_cert)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":22854
 *         cdef long _ret = primecertisvalid(_cert)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def primepi(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22854, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22827
 *         return new_gen(_ret)
 * 
 *     def primecertisvalid(cert):             # <<<<<<<<<<<<<<
 *         r'''
 *         Verifies if cert is a valid PARI ECPP Primality certificate, as described
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.primecertisvalid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22856
 *         return _ret
 * 
 *     def primepi(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The prime counting function. Returns the number of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1297primepi(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1296primepi[] = "\n        The prime counting function. Returns the number of\n        primes :math:`p`, :math:`p <= x`.\n        \n        ::\n        \n            ? primepi(10)\n            %1 = 4;\n            ? primes(5)\n            %2 = [2, 3, 5, 7, 11]\n            ? primepi(10^11)\n            %3 = 4118054813\n        \n        Uses checkpointing and a naive :math:`O(x)` algorithm;\n        make sure to start gp with :literal:`primelimit` at least :math:`\\sqrt{x}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1297primepi(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primepi (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1296primepi(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1296primepi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("primepi", 0);

  /* "cypari/auto_gen.pxi":22873
 *         make sure to start gp with :literal:`primelimit` at least :math:`\sqrt{x}`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = primepi(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22873, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22874
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primepi(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22875
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = primepi(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primepi(__pyx_v__x);

  /* "cypari/auto_gen.pxi":22876
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = primepi(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def primes(n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22856
 *         return _ret
 * 
 *     def primepi(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         The prime counting function. Returns the number of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.primepi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22878
 *         return new_gen(_ret)
 * 
 *     def primes(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the first :math:`n` prime numbers.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1299primes(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1298primes[] = "\n        Creates a row vector whose components are the first :math:`n` prime numbers.\n        (Returns the empty vector for :math:`n <= 0`.) A :literal:`t_VEC` :math:`n = [a,b]` is also\n        allowed, in which case the primes in :math:`[a,b]` are returned\n        \n        ::\n        \n            ? primes(10) \\\\ the first 10 primes\n            %1 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n            ? primes([0,29]) \\\\ the primes up to 29\n            %2 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n            ? primes([15,30])\n            %3 = [17, 19, 23, 29]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1299primes(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("primes (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1298primes(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1298primes(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("primes", 0);

  /* "cypari/auto_gen.pxi":22893
 *             %3 = [17, 19, 23, 29]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = primes0(_n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22893, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22894
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primes0(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22895
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = primes0(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primes0(__pyx_v__n);

  /* "cypari/auto_gen.pxi":22896
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = primes0(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def prodeulerrat(F, s=None, long a=2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22878
 *         return new_gen(_ret)
 * 
 *     def primes(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates a row vector whose components are the first :math:`n` prime numbers.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.primes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22898
 *         return new_gen(_ret)
 * 
 *     def prodeulerrat(F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1301prodeulerrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1300prodeulerrat[] = "\n        :math:`\\prod_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.\n        \n        ::\n        \n            ? prodeulerrat(1+1/q^3,1)\n            %1 = 1.1815649490102569125693997341604542605\n            ? zeta(3)/zeta(6)\n            %2 = 1.1815649490102569125693997341604542606\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1301prodeulerrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_a;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prodeulerrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prodeulerrat") < 0)) __PYX_ERR(10, 22898, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_a = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22898, __pyx_L3_error)
    } else {
      __pyx_v_a = ((long)2);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22898, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prodeulerrat", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22898, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.prodeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1300prodeulerrat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_s, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1300prodeulerrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision) {
  int __pyx_v__have_s;
  GEN __pyx_v__F;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("prodeulerrat", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_gen.pxi":22909
 *             %2 = 1.1815649490102569125693997341604542606
 *         '''
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_1 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_1;

  /* "cypari/auto_gen.pxi":22910
 *         '''
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_s != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22911
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22910
 *         '''
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22912
 *         if _have_s:
 *             s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22912, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22913
 *             s = objtogen(s)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22914
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_gen.pxi":22915
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_s != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22916
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22915
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":22917
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":22918
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = prodeulerrat(__pyx_v__F, __pyx_v__s, __pyx_v_a, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":22919
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def prodnumrat(F, long a, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22919, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22898
 *         return new_gen(_ret)
 * 
 *     def prodeulerrat(F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.prodeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22921
 *         return new_gen(_ret)
 * 
 *     def prodnumrat(F, long a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{n >= a}F(n)`, where :math:`F-1` is a rational function of degree less
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1303prodnumrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1302prodnumrat[] = "\n        :math:`\\prod_{n >= a}F(n)`, where :math:`F-1` is a rational function of degree less\n        than or equal to :math:`-2`.\n        \n        ::\n        \n            ? prodnumrat(1+1/x^2,1)\n            %1 = 3.6760779103749777206956974920282606665\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1303prodnumrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_a;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("prodnumrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_precision,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_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prodnumrat") < 0)) __PYX_ERR(10, 22921, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_a = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22921, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22921, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("prodnumrat", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22921, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.prodnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1302prodnumrat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1302prodnumrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, long __pyx_v_a, long __pyx_v_precision) {
  GEN __pyx_v__F;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("prodnumrat", 0);

  /* "cypari/auto_gen.pxi":22931
 *             %1 = 3.6760779103749777206956974920282606665
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22931, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22932
 *         '''
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodnumrat(_F, a, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22933
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = prodnumrat(_F, a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":22934
 *         cdef GEN _F = (<Gen>F).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodnumrat(_F, a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = prodnumrat(__pyx_v__F, __pyx_v_a, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":22935
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = prodnumrat(_F, a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def psdraw(list, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22921
 *         return new_gen(_ret)
 * 
 *     def prodnumrat(F, long a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\prod_{n >= a}F(n)`, where :math:`F-1` is a rational function of degree less
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.prodnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22937
 *         return new_gen(_ret)
 * 
 *     def psdraw(list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plotexport and write the result to file.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1305psdraw(PyObject *__pyx_v_list, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1304psdraw[] = "\n        This function is obsolete, use plotexport and write the result to file.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1305psdraw(PyObject *__pyx_v_list, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("psdraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "psdraw") < 0)) __PYX_ERR(10, 22937, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22937, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("psdraw", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22937, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.psdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1304psdraw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_list), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1304psdraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_list, long __pyx_v_flag) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__list;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("psdraw", 0);

  /* "cypari/auto_gen.pxi":22941
 *         This function is obsolete, use plotexport and write the result to file.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22941, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22942
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__73, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22943
 *         from warnings import warn
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _list = (<Gen>list).g
 *         psdraw(_list, flag)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22943, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22944
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g             # <<<<<<<<<<<<<<
 *         psdraw(_list, flag)
 *         clear_stack()
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_list)->__pyx_base.g;
  __pyx_v__list = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22945
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 *         psdraw(_list, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  psdraw(__pyx_v__list, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":22946
 *         cdef GEN _list = (<Gen>list).g
 *         psdraw(_list, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def psi(x, long precision=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":22937
 *         return new_gen(_ret)
 * 
 *     def psdraw(list, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plotexport and write the result to file.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.psdraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22948
 *         clear_stack()
 * 
 *     def psi(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The :math:`\psi`-function of :math:`x`, i.e.the logarithmic derivative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1307psi(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1306psi[] = "\n        The :math:`\\psi`-function of :math:`x`, i.e.\302\240the logarithmic derivative\n        :math:`\\Gamma'(x)/\\Gamma (x)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1307psi(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("psi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "psi") < 0)) __PYX_ERR(10, 22948, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22948, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("psi", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22948, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.psi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1306psi(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1306psi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("psi", 0);

  /* "cypari/auto_gen.pxi":22953
 *         :math:`\Gamma'(x)/\Gamma (x)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 22953, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22954
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gpsi(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":22955
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpsi(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":22956
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gpsi(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpsi(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":22957
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gpsi(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def psplothraw(listx, listy, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 22957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22948
 *         clear_stack()
 * 
 *     def psi(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         The :math:`\psi`-function of :math:`x`, i.e.the logarithmic derivative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.psi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22959
 *         return new_gen(_ret)
 * 
 *     def psplothraw(listx, listy, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plothrawexport and write the result to file.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1309psplothraw(PyObject *__pyx_v_listx, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1308psplothraw[] = "\n        This function is obsolete, use plothrawexport and write the result to file.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1309psplothraw(PyObject *__pyx_v_listx, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_listy = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("psplothraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_listy,&__pyx_n_s_flag,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_listy)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "psplothraw") < 0)) __PYX_ERR(10, 22959, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_listy = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 22959, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("psplothraw", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22959, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.psplothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1308psplothraw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_listx), __pyx_v_listy, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1308psplothraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_listx, PyObject *__pyx_v_listy, long __pyx_v_flag) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__listx;
  GEN __pyx_v__listy;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("psplothraw", 0);
  __Pyx_INCREF(__pyx_v_listy);

  /* "cypari/auto_gen.pxi":22963
 *         This function is obsolete, use plothrawexport and write the result to file.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)
 *         listy = objtogen(listy)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22963, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 22963, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22964
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         listy = objtogen(listy)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__74, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22965
 *         from warnings import warn
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)
 *         listy = objtogen(listy)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _listx = (<Gen>listx).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_listy, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_listy, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":22966
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)
 *         listy = objtogen(listy)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _listx = (<Gen>listx).g
 *         cdef GEN _listy = (<Gen>listy).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22966, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22967
 *         listy = objtogen(listy)
 *         sig_on()
 *         cdef GEN _listx = (<Gen>listx).g             # <<<<<<<<<<<<<<
 *         cdef GEN _listy = (<Gen>listy).g
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_listx)->__pyx_base.g;
  __pyx_v__listx = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22968
 *         sig_on()
 *         cdef GEN _listx = (<Gen>listx).g
 *         cdef GEN _listy = (<Gen>listy).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_listy)->__pyx_base.g;
  __pyx_v__listy = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22969
 *         cdef GEN _listx = (<Gen>listx).g
 *         cdef GEN _listy = (<Gen>listy).g
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = psplothraw(__pyx_v__listx, __pyx_v__listy, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":22970
 *         cdef GEN _listy = (<Gen>listy).g
 *         cdef GEN _ret = psplothraw(_listx, _listy, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfauto(G, fl=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22970, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22959
 *         return new_gen(_ret)
 * 
 *     def psplothraw(listx, listy, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use plothrawexport and write the result to file.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.psplothraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_listy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":22972
 *         return new_gen(_ret)
 * 
 *     def qfauto(G, fl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1311qfauto(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1310qfauto[] = "\n        :math:`G` being a square and symmetric matrix with integer entries representing a\n        positive definite quadratic form, outputs the automorphism group of the\n        associate lattice.\n        Since this requires computing the minimal vectors, the computations can\n        become very lengthy as the dimension grows. :math:`G` can also be given by an\n        :literal:`qfisominit` structure.\n        See :literal:`qfisominit` for the meaning of :emphasis:`fl`.\n        \n        The output is a two-components vector :math:`[o,g]` where :math:`o` is the group order\n        and :math:`g` is the list of generators (as a vector). For each generator :math:`H`,\n        the equality :math:`G = {^t}H G H` holds.\n        \n        The interface of this function is experimental and will likely change in the\n        future.\n        \n        This function implements an algorithm of Plesken and Souvignier, following\n        Souvignier's implementation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1311qfauto(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fl = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfauto (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fl,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfauto") < 0)) __PYX_ERR(10, 22972, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_fl = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfauto", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 22972, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfauto", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1310qfauto(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_fl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1310qfauto(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_fl) {
  int __pyx_v__have_fl;
  GEN __pyx_v__G;
  GEN __pyx_v__fl;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfauto", 0);
  __Pyx_INCREF(__pyx_v_fl);

  /* "cypari/auto_gen.pxi":22992
 *         Souvignier's implementation.
 *         '''
 *         cdef bint _have_fl = (fl is not None)             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             fl = objtogen(fl)
 */
  __pyx_t_1 = (__pyx_v_fl != Py_None);
  __pyx_v__have_fl = __pyx_t_1;

  /* "cypari/auto_gen.pxi":22993
 *         '''
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_fl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22994
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 *             fl = objtogen(fl)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fl, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 22994, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_fl, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":22993
 *         '''
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":22995
 *         if _have_fl:
 *             fl = objtogen(fl)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 22995, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":22996
 *             fl = objtogen(fl)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_gen.pxi":22997
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 */
  __pyx_v__fl = NULL;

  /* "cypari/auto_gen.pxi":22998
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)
 */
  __pyx_t_1 = (__pyx_v__have_fl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":22999
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 *             _fl = (<Gen>fl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfauto0(_G, _fl)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fl)->__pyx_base.g;
    __pyx_v__fl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":22998
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)
 */
  }

  /* "cypari/auto_gen.pxi":23000
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfauto0(__pyx_v__G, __pyx_v__fl);

  /* "cypari/auto_gen.pxi":23001
 *             _fl = (<Gen>fl).g
 *         cdef GEN _ret = qfauto0(_G, _fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfautoexport(qfa, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":22972
 *         return new_gen(_ret)
 * 
 *     def qfauto(G, fl=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfauto", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fl);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23003
 *         return new_gen(_ret)
 * 
 *     def qfautoexport(qfa, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`qfa` being an automorphism group as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1313qfautoexport(PyObject *__pyx_v_qfa, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1312qfautoexport[] = "\n        :emphasis:`qfa` being an automorphism group as output by\n        :literal:`qfauto`, export the underlying matrix group as a string suitable\n        for (no flags or :math:`flag = 0`) GAP or (:math:`flag = 1`) Magma. The following example\n        computes the size of the matrix group using GAP:\n        \n        ::\n        \n            ? G = qfauto([2,1;1,2])\n            %1 = [12, [[-1, 0; 0, -1], [0, -1; 1, 1], [1, 1; 0, -1]]]\n            ? s = qfautoexport(G)\n            %2 = \"Group([[-1, 0], [0, -1]], [[0, -1], [1, 1]], [[1, 1], [0, -1]])\"\n            ? extern(\"echo \\\"Order(\"s\");\\\" | gap -q\")\n            %3 = 12\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1313qfautoexport(PyObject *__pyx_v_qfa, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfautoexport (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfautoexport") < 0)) __PYX_ERR(10, 23003, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23003, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfautoexport", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23003, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfautoexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1312qfautoexport(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_qfa), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1312qfautoexport(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_qfa, long __pyx_v_flag) {
  GEN __pyx_v__qfa;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfautoexport", 0);

  /* "cypari/auto_gen.pxi":23019
 *             %3 = 12
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _qfa = (<Gen>qfa).g
 *         cdef GEN _ret = qfautoexport(_qfa, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23019, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23020
 *         '''
 *         sig_on()
 *         cdef GEN _qfa = (<Gen>qfa).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfautoexport(_qfa, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_qfa)->__pyx_base.g;
  __pyx_v__qfa = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23021
 *         sig_on()
 *         cdef GEN _qfa = (<Gen>qfa).g
 *         cdef GEN _ret = qfautoexport(_qfa, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfautoexport(__pyx_v__qfa, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":23022
 *         cdef GEN _qfa = (<Gen>qfa).g
 *         cdef GEN _ret = qfautoexport(_qfa, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbclassno(D, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23003
 *         return new_gen(_ret)
 * 
 *     def qfautoexport(qfa, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`qfa` being an automorphism group as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfautoexport", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23024
 *         return new_gen(_ret)
 * 
 *     def qfbclassno(D, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ordinary class number of the quadratic order of discriminant :math:`D`, for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1315qfbclassno(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1314qfbclassno[] = "\n        Ordinary class number of the quadratic order of discriminant :math:`D`, for\n        \"small\" values of :math:`D`.\n        \n        - if :math:`D > 0` or :math:`flag = 1`, use a :math:`O(\\|D\\|^{1/2})`\n          algorithm (compute :math:`L(1,\\chi_D)` with the approximate functional equation).\n          This is slower than :literal:`quadclassunit` as soon as :math:`\\|D\\| ~ 10^2` or\n          so and is not meant to be used for large :math:`D`.\n        \n        - if :math:`D < 0` and :math:`flag = 0` (or omitted), use a :math:`O(\\|D\\|^{1/4})`\n          algorithm (Shanks's baby-step/giant-step method). It should\n          be faster than :literal:`quadclassunit` for small values of :math:`D`, say\n          :math:`\\|D\\| < 10^{18}`.\n        \n        :strong:`Important warning.` In the latter case, this function only\n        implements part of Shanks's method (which allows to speed it up\n        considerably). It gives unconditionnally correct results for\n        :math:`\\|D\\| < 2.10^{10}`, but may give incorrect results for larger values\n        if the class\n        group has many cyclic factors. We thus recommend to double-check results\n        using the function :literal:`quadclassunit`, which is about 2 to 3 times slower in\n        the range :math:`\\|D\\| \\in [10^{10}, 10^{18}]`, assuming GRH. We currently have no\n        counter-examples but they should exist: we would appreciate a bug report if\n        you find one.\n        \n        :strong:`Warning.` Contrary to what its name implies, this routine does not\n        compute the number of classes of binary primitive forms of discriminant :math:`D`,\n        which is equal to the :emphasis:`narrow` class number. The two notions are the same\n        when :math:`D < 0` or the fundamental unit :math:`\\varepsilon` has negative norm; when :math:`D\n        > 0` and :math:`N\\varepsilon > 0`, the number of classes of forms is twice the\n        ordinary class number. This is a pr""oblem which we cannot fix for backward\n        compatibility reasons. Use the following routine if you are only interested\n        in the number of classes of forms:\n        \n        ::\n        \n            QFBclassno(D) =\n            qfbclassno(D) * if (D < 0 || norm(quadunit(D)) < 0, 1, 2)\n        \n        Here are a few examples:\n        \n        ::\n        \n            ? qfbclassno(400000028) \\\\ D > 0: slow\n            time = 3,140 ms.\n            %1 = 1\n            ? quadclassunit(400000028).no\n            time = 20 ms. \\\\{ much faster, assume GRH}\n            %2 = 1\n            ? qfbclassno(-400000028) \\\\ D < 0: fast enough\n            time = 0 ms.\n            %3 = 7253\n            ? quadclassunit(-400000028).no\n            time = 0 ms.\n            %4 = 7253\n        \n        See also :literal:`qfbhclassno`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1315qfbclassno(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbclassno (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbclassno") < 0)) __PYX_ERR(10, 23024, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23024, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbclassno", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23024, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1314qfbclassno(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1314qfbclassno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_flag) {
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfbclassno", 0);

  /* "cypari/auto_gen.pxi":23083
 *         See also :literal:`qfbhclassno`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = qfbclassno0(_D, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23083, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23084
 *         '''
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbclassno0(_D, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23085
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = qfbclassno0(_D, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbclassno0(__pyx_v__D, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":23086
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = qfbclassno0(_D, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbcompraw(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23024
 *         return new_gen(_ret)
 * 
 *     def qfbclassno(D, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Ordinary class number of the quadratic order of discriminant :math:`D`, for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23088
 *         return new_gen(_ret)
 * 
 *     def qfbcompraw(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the binary quadratic forms :math:`x` and :math:`y`, without
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1317qfbcompraw(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1316qfbcompraw[] = "\n        composition of the binary quadratic forms :math:`x` and :math:`y`, without\n        reduction of the result. This is useful e.g.\302\240to compute a generating\n        element of an ideal. The result is undefined if :math:`x` and :math:`y` do not have the\n        same discriminant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1317qfbcompraw(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbcompraw (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1316qfbcompraw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1316qfbcompraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbcompraw", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":23095
 *         same discriminant.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23096
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 23096, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23097
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = qfbcompraw(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23098
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbcompraw(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23099
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = qfbcompraw(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbcompraw(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":23100
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = qfbcompraw(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbhclassno(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23088
 *         return new_gen(_ret)
 * 
 *     def qfbcompraw(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the binary quadratic forms :math:`x` and :math:`y`, without
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbcompraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23102
 *         return new_gen(_ret)
 * 
 *     def qfbhclassno(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz class number of :math:`x`, when
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1319qfbhclassno(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1318qfbhclassno[] = "\n        Hurwitz class number of :math:`x`, when\n        :math:`x` is non-negative and congruent to 0 or 3 modulo 4, and :math:`0` for other\n        values. For :math:`x > 5.10^5`, we assume the GRH, and use :literal:`quadclassunit`\n        with default parameters.\n        \n        ::\n        \n            ? qfbhclassno(1) \\\\ not 0 or 3 mod 4\n            %1 = 0\n            ? qfbhclassno(3)\n            %2 = 1/3\n            ? qfbhclassno(4)\n            %3 = 1/2\n            ? qfbhclassno(23)\n            %4 = 3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1319qfbhclassno(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbhclassno (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1318qfbhclassno(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1318qfbhclassno(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfbhclassno", 0);

  /* "cypari/auto_gen.pxi":23120
 *             %4 = 3
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hclassno(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23120, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23121
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = hclassno(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23122
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hclassno(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = hclassno(__pyx_v__x);

  /* "cypari/auto_gen.pxi":23123
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = hclassno(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbil(x, y, q=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23123, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23102
 *         return new_gen(_ret)
 * 
 *     def qfbhclassno(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz class number of :math:`x`, when
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbhclassno", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23125
 *         return new_gen(_ret)
 * 
 *     def qfbil(x, y, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1321qfbil(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1320qfbil[] = "\n        This function is obsolete, use :literal:`qfeval`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1321qfbil(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbil (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_q,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbil") < 0)) __PYX_ERR(10, 23125, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
    __pyx_v_q = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbil", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23125, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1320qfbil(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1320qfbil(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_q) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_q;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("qfbil", 0);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_gen.pxi":23129
 *         This function is obsolete, use :literal:`qfeval`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)
 *         y = objtogen(y)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23129, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23129, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":23130
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__75, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":23131
 *         from warnings import warn
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":23132
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             q = objtogen(q)
 */
  __pyx_t_3 = (__pyx_v_q != Py_None);
  __pyx_v__have_q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23133
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":23134
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 *             q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23133
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23135
 *         if _have_q:
 *             q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 23135, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23136
 *             q = objtogen(q)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":23137
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _q = NULL
 *         if _have_q:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_5;

  /* "cypari/auto_gen.pxi":23138
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             _q = (<Gen>q).g
 */
  __pyx_v__q = NULL;

  /* "cypari/auto_gen.pxi":23139
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":23140
 *         cdef GEN _q = NULL
 *         if _have_q:
 *             _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
    __pyx_v__q = __pyx_t_5;

    /* "cypari/auto_gen.pxi":23139
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 */
  }

  /* "cypari/auto_gen.pxi":23141
 *         if _have_q:
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbil(__pyx_v__x, __pyx_v__y, __pyx_v__q);

  /* "cypari/auto_gen.pxi":23142
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfbil(_x, _y, _q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbnucomp(x, y, L):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23125
 *         return new_gen(_ret)
 * 
 *     def qfbil(x, y, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbil", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23144
 *         return new_gen(_ret)
 * 
 *     def qfbnucomp(x, y, L):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the primitive positive
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1323qfbnucomp(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1322qfbnucomp[] = "\n        composition of the primitive positive\n        definite binary quadratic forms :math:`x` and :math:`y` (type :literal:`t_QFI`) using the NUCOMP\n        and NUDUPL algorithms of Shanks, \303\240 la Atkin. :math:`L` is any positive\n        constant, but for optimal speed, one should take :math:`L = \\|D/4\\|^{1/4}`, i.e.\n        :literal:`sqrtnint(abs(D) >> 2,4)`, where :math:`D` is the common discriminant of :math:`x` and\n        :math:`y`. When :math:`x` and :math:`y` do not have the same discriminant, the result is\n        undefined.\n        \n        The current implementation is slower than the generic routine for small :math:`D`,\n        and becomes faster when :math:`D` has about :math:`45` bits.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1323qfbnucomp(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbnucomp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_L,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_y)) != 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_L)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("qfbnucomp", 1, 2, 2, 1); __PYX_ERR(10, 23144, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbnucomp") < 0)) __PYX_ERR(10, 23144, __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_y = values[0];
    __pyx_v_L = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbnucomp", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23144, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbnucomp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1322qfbnucomp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_L);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1322qfbnucomp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_L) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbnucomp", 0);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_gen.pxi":23157
 *         and becomes faster when :math:`D` has about :math:`45` bits.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         L = objtogen(L)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23158
 *         '''
 *         y = objtogen(y)
 *         L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23159
 *         y = objtogen(y)
 *         L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 23159, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23160
 *         L = objtogen(L)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23161
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ret = nucomp(_x, _y, _L)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23162
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nucomp(_x, _y, _L)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
  __pyx_v__L = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23163
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ret = nucomp(_x, _y, _L)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nucomp(__pyx_v__x, __pyx_v__y, __pyx_v__L);

  /* "cypari/auto_gen.pxi":23164
 *         cdef GEN _L = (<Gen>L).g
 *         cdef GEN _ret = nucomp(_x, _y, _L)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbnupow(x, n, L=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23164, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23144
 *         return new_gen(_ret)
 * 
 *     def qfbnucomp(x, y, L):             # <<<<<<<<<<<<<<
 *         r'''
 *         composition of the primitive positive
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbnucomp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23166
 *         return new_gen(_ret)
 * 
 *     def qfbnupow(x, n, L=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the primitive positive definite
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1325qfbnupow(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1324qfbnupow[] = "\n        :math:`n`-th power of the primitive positive definite\n        binary quadratic form :math:`x` using Shanks's NUCOMP and NUDUPL algorithms;\n        if set, :math:`L` should be equal to :literal:`sqrtnint(abs(D) >> 2,4)`, where :math:`D < 0` is\n        the discriminant of :math:`x`.\n        \n        The current implementation is slower than the generic routine for small\n        discriminant :math:`D`, and becomes faster for :math:`D ~ 2^{45}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1325qfbnupow(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbnupow (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_L,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbnupow") < 0)) __PYX_ERR(10, 23166, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = values[0];
    __pyx_v_L = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbnupow", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23166, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbnupow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1324qfbnupow(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_n, __pyx_v_L);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1324qfbnupow(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_n, PyObject *__pyx_v_L) {
  int __pyx_v__have_L;
  GEN __pyx_v__x;
  GEN __pyx_v__n;
  GEN __pyx_v__L;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfbnupow", 0);
  __Pyx_INCREF(__pyx_v_n);
  __Pyx_INCREF(__pyx_v_L);

  /* "cypari/auto_gen.pxi":23176
 *         discriminant :math:`D`, and becomes faster for :math:`D ~ 2^{45}`.
 *         '''
 *         n = objtogen(n)             # <<<<<<<<<<<<<<
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_n, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23177
 *         '''
 *         n = objtogen(n)
 *         cdef bint _have_L = (L is not None)             # <<<<<<<<<<<<<<
 *         if _have_L:
 *             L = objtogen(L)
 */
  __pyx_t_2 = (__pyx_v_L != Py_None);
  __pyx_v__have_L = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23178
 *         n = objtogen(n)
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             L = objtogen(L)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_L != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23179
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:
 *             L = objtogen(L)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_L, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_L, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":23178
 *         n = objtogen(n)
 *         cdef bint _have_L = (L is not None)
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             L = objtogen(L)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23180
 *         if _have_L:
 *             L = objtogen(L)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23180, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23181
 *             L = objtogen(L)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23182
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _L = NULL
 *         if _have_L:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23183
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL             # <<<<<<<<<<<<<<
 *         if _have_L:
 *             _L = (<Gen>L).g
 */
  __pyx_v__L = NULL;

  /* "cypari/auto_gen.pxi":23184
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)
 */
  __pyx_t_2 = (__pyx_v__have_L != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23185
 *         cdef GEN _L = NULL
 *         if _have_L:
 *             _L = (<Gen>L).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = nupow(_x, _n, _L)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_L)->__pyx_base.g;
    __pyx_v__L = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23184
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _L = NULL
 *         if _have_L:             # <<<<<<<<<<<<<<
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)
 */
  }

  /* "cypari/auto_gen.pxi":23186
 *         if _have_L:
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = nupow(__pyx_v__x, __pyx_v__n, __pyx_v__L);

  /* "cypari/auto_gen.pxi":23187
 *             _L = (<Gen>L).g
 *         cdef GEN _ret = nupow(_x, _n, _L)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbpowraw(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23166
 *         return new_gen(_ret)
 * 
 *     def qfbnupow(x, n, L=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the primitive positive definite
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbnupow", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_n);
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23189
 *         return new_gen(_ret)
 * 
 *     def qfbpowraw(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the binary quadratic form
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1327qfbpowraw(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1326qfbpowraw[] = "\n        :math:`n`-th power of the binary quadratic form\n        :math:`x`, computed without doing any reduction (i.e.\302\240using :literal:`qfbcompraw`).\n        Here :math:`n` must be non-negative and :math:`n < 2^{31}`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1327qfbpowraw(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbpowraw (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23189, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbpowraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1326qfbpowraw(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1326qfbpowraw(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfbpowraw", 0);

  /* "cypari/auto_gen.pxi":23195
 *         Here :math:`n` must be non-negative and :math:`n < 2^{31}`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfbpowraw(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23195, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23196
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbpowraw(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23197
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfbpowraw(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbpowraw(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":23198
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfbpowraw(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbprimeform(x, p, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23189
 *         return new_gen(_ret)
 * 
 *     def qfbpowraw(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`n`-th power of the binary quadratic form
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbpowraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23200
 *         return new_gen(_ret)
 * 
 *     def qfbprimeform(x, p, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Prime binary quadratic form of discriminant
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1329qfbprimeform(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1328qfbprimeform[] = "\n        Prime binary quadratic form of discriminant\n        :math:`x` whose first coefficient is :math:`p`, where :math:`\\|p\\|` is a prime number.\n        By abuse of notation,\n        :math:`p = \302\261 1` is also valid and returns the unit form. Returns an\n        error if :math:`x` is not a quadratic residue mod :math:`p`, or if :math:`x < 0` and :math:`p < 0`.\n        (Negative definite :literal:`t_QFI` are not implemented.) In the case where :math:`x > 0`,\n        the \"distance\" component of the form is set equal to zero according to the\n        current precision.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1329qfbprimeform(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbprimeform (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_precision,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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbprimeform") < 0)) __PYX_ERR(10, 23200, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23200, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbprimeform", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23200, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbprimeform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1328qfbprimeform(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_p, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1328qfbprimeform(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbprimeform", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":23211
 *         current precision.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23211, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23212
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 23212, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23213
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23214
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = primeform(_x, _p, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23215
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = primeform(_x, _p, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":23216
 *         cdef GEN _p = (<Gen>p).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = primeform(_x, _p, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = primeform(__pyx_v__x, __pyx_v__p, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":23217
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = primeform(_x, _p, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbred(x, long flag=0, d=None, isd=None, sd=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23200
 *         return new_gen(_ret)
 * 
 *     def qfbprimeform(x, p, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Prime binary quadratic form of discriminant
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbprimeform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23219
 *         return new_gen(_ret)
 * 
 *     def qfbred(x, long flag=0, d=None, isd=None, sd=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduces the binary quadratic form :math:`x` (updating Shanks's distance function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1331qfbred(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1330qfbred[] = "\n        Reduces the binary quadratic form :math:`x` (updating Shanks's distance function\n        if :math:`x` is indefinite). The binary digits of :math:`flag` are toggles meaning\n        \n        \302\240\302\2401: perform a single reduction step\n        \n        \302\240\302\2402: don't update Shanks's distance\n        \n        The arguments :math:`d`, :emphasis:`isd`, :emphasis:`sd`, if present, supply the values of the\n        discriminant, :math:`floor{\\sqrt{d}}`, and :math:`\\sqrt{d}` respectively\n        (no checking is done of these facts). If :math:`d < 0` these values are useless,\n        and all references to Shanks's distance are irrelevant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1331qfbred(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_isd = 0;
  PyObject *__pyx_v_sd = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_d,&__pyx_n_s_isd,&__pyx_n_s_sd,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_isd);
          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_sd);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbred") < 0)) __PYX_ERR(10, 23219, __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);
        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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23219, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_d = values[1];
    __pyx_v_isd = values[2];
    __pyx_v_sd = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbred", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23219, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1330qfbred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag, __pyx_v_d, __pyx_v_isd, __pyx_v_sd);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1330qfbred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag, PyObject *__pyx_v_d, PyObject *__pyx_v_isd, PyObject *__pyx_v_sd) {
  int __pyx_v__have_d;
  int __pyx_v__have_isd;
  int __pyx_v__have_sd;
  GEN __pyx_v__x;
  GEN __pyx_v__d;
  GEN __pyx_v__isd;
  GEN __pyx_v__sd;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfbred", 0);
  __Pyx_INCREF(__pyx_v_d);
  __Pyx_INCREF(__pyx_v_isd);
  __Pyx_INCREF(__pyx_v_sd);

  /* "cypari/auto_gen.pxi":23233
 *         and all references to Shanks's distance are irrelevant.
 *         '''
 *         cdef bint _have_d = (d is not None)             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             d = objtogen(d)
 */
  __pyx_t_1 = (__pyx_v_d != Py_None);
  __pyx_v__have_d = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23234
 *         '''
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 */
  __pyx_t_1 = (__pyx_v__have_d != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23235
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:
 *             d = objtogen(d)             # <<<<<<<<<<<<<<
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_d, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23234
 *         '''
 *         cdef bint _have_d = (d is not None)
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 */
  }

  /* "cypari/auto_gen.pxi":23236
 *         if _have_d:
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)             # <<<<<<<<<<<<<<
 *         if _have_isd:
 *             isd = objtogen(isd)
 */
  __pyx_t_1 = (__pyx_v_isd != Py_None);
  __pyx_v__have_isd = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23237
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 */
  __pyx_t_1 = (__pyx_v__have_isd != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23238
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:
 *             isd = objtogen(isd)             # <<<<<<<<<<<<<<
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_isd, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_isd, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23237
 *             d = objtogen(d)
 *         cdef bint _have_isd = (isd is not None)
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 */
  }

  /* "cypari/auto_gen.pxi":23239
 *         if _have_isd:
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)             # <<<<<<<<<<<<<<
 *         if _have_sd:
 *             sd = objtogen(sd)
 */
  __pyx_t_1 = (__pyx_v_sd != Py_None);
  __pyx_v__have_sd = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23240
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             sd = objtogen(sd)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_sd != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23241
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:
 *             sd = objtogen(sd)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sd, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23241, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_sd, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23240
 *             isd = objtogen(isd)
 *         cdef bint _have_sd = (sd is not None)
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             sd = objtogen(sd)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23242
 *         if _have_sd:
 *             sd = objtogen(sd)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23242, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23243
 *             sd = objtogen(sd)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _d = NULL
 *         if _have_d:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23244
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL             # <<<<<<<<<<<<<<
 *         if _have_d:
 *             _d = (<Gen>d).g
 */
  __pyx_v__d = NULL;

  /* "cypari/auto_gen.pxi":23245
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 */
  __pyx_t_1 = (__pyx_v__have_d != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23246
 *         cdef GEN _d = NULL
 *         if _have_d:
 *             _d = (<Gen>d).g             # <<<<<<<<<<<<<<
 *         cdef GEN _isd = NULL
 *         if _have_isd:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_d)->__pyx_base.g;
    __pyx_v__d = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23245
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _d = NULL
 *         if _have_d:             # <<<<<<<<<<<<<<
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 */
  }

  /* "cypari/auto_gen.pxi":23247
 *         if _have_d:
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL             # <<<<<<<<<<<<<<
 *         if _have_isd:
 *             _isd = (<Gen>isd).g
 */
  __pyx_v__isd = NULL;

  /* "cypari/auto_gen.pxi":23248
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 */
  __pyx_t_1 = (__pyx_v__have_isd != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23249
 *         cdef GEN _isd = NULL
 *         if _have_isd:
 *             _isd = (<Gen>isd).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sd = NULL
 *         if _have_sd:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_isd)->__pyx_base.g;
    __pyx_v__isd = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23248
 *             _d = (<Gen>d).g
 *         cdef GEN _isd = NULL
 *         if _have_isd:             # <<<<<<<<<<<<<<
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 */
  }

  /* "cypari/auto_gen.pxi":23250
 *         if _have_isd:
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL             # <<<<<<<<<<<<<<
 *         if _have_sd:
 *             _sd = (<Gen>sd).g
 */
  __pyx_v__sd = NULL;

  /* "cypari/auto_gen.pxi":23251
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 */
  __pyx_t_1 = (__pyx_v__have_sd != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23252
 *         cdef GEN _sd = NULL
 *         if _have_sd:
 *             _sd = (<Gen>sd).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sd)->__pyx_base.g;
    __pyx_v__sd = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23251
 *             _isd = (<Gen>isd).g
 *         cdef GEN _sd = NULL
 *         if _have_sd:             # <<<<<<<<<<<<<<
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 */
  }

  /* "cypari/auto_gen.pxi":23253
 *         if _have_sd:
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbred0(__pyx_v__x, __pyx_v_flag, __pyx_v__d, __pyx_v__isd, __pyx_v__sd);

  /* "cypari/auto_gen.pxi":23254
 *             _sd = (<Gen>sd).g
 *         cdef GEN _ret = qfbred0(_x, flag, _d, _isd, _sd)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbredsl2(x, data=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23219
 *         return new_gen(_ret)
 * 
 *     def qfbred(x, long flag=0, d=None, isd=None, sd=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduces the binary quadratic form :math:`x` (updating Shanks's distance function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_isd);
  __Pyx_XDECREF(__pyx_v_sd);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23256
 *         return new_gen(_ret)
 * 
 *     def qfbredsl2(x, data=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduction of the (real or imaginary) binary quadratic form :math:`x`, return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1333qfbredsl2(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1332qfbredsl2[] = "\n        Reduction of the (real or imaginary) binary quadratic form :math:`x`, return\n        :math:`[y,g]` where :math:`y` is reduced and :math:`g` in :math:`SL(2,\\mathbb{Z})` is such that\n        :math:`g.x = y`; :emphasis:`data`, if\n        present, must be equal to :math:`[D, sqrtint (D)]`, where :math:`D > 0` is the\n        discriminant of :math:`x`. In case :math:`x` is a :literal:`t_QFR`, the distance component is\n        unaffected.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1333qfbredsl2(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbredsl2 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_data,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfbredsl2") < 0)) __PYX_ERR(10, 23256, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_data = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfbredsl2", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23256, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbredsl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1332qfbredsl2(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_data);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1332qfbredsl2(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_data) {
  int __pyx_v__have_data;
  GEN __pyx_v__x;
  GEN __pyx_v__data;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfbredsl2", 0);
  __Pyx_INCREF(__pyx_v_data);

  /* "cypari/auto_gen.pxi":23265
 *         unaffected.
 *         '''
 *         cdef bint _have_data = (data is not None)             # <<<<<<<<<<<<<<
 *         if _have_data:
 *             data = objtogen(data)
 */
  __pyx_t_1 = (__pyx_v_data != Py_None);
  __pyx_v__have_data = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23266
 *         '''
 *         cdef bint _have_data = (data is not None)
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             data = objtogen(data)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_data != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23267
 *         cdef bint _have_data = (data is not None)
 *         if _have_data:
 *             data = objtogen(data)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_data, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_data, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23266
 *         '''
 *         cdef bint _have_data = (data is not None)
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             data = objtogen(data)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23268
 *         if _have_data:
 *             data = objtogen(data)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23268, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23269
 *             data = objtogen(data)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _data = NULL
 *         if _have_data:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23270
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL             # <<<<<<<<<<<<<<
 *         if _have_data:
 *             _data = (<Gen>data).g
 */
  __pyx_v__data = NULL;

  /* "cypari/auto_gen.pxi":23271
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 */
  __pyx_t_1 = (__pyx_v__have_data != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23272
 *         cdef GEN _data = NULL
 *         if _have_data:
 *             _data = (<Gen>data).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_data)->__pyx_base.g;
    __pyx_v__data = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23271
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _data = NULL
 *         if _have_data:             # <<<<<<<<<<<<<<
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 */
  }

  /* "cypari/auto_gen.pxi":23273
 *         if _have_data:
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbredsl2(__pyx_v__x, __pyx_v__data);

  /* "cypari/auto_gen.pxi":23274
 *             _data = (<Gen>data).g
 *         cdef GEN _ret = qfbredsl2(_x, _data)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfbsolve(Q, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23274, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23256
 *         return new_gen(_ret)
 * 
 *     def qfbredsl2(x, data=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reduction of the (real or imaginary) binary quadratic form :math:`x`, return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbredsl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23276
 *         return new_gen(_ret)
 * 
 *     def qfbsolve(Q, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Solve the equation :math:`Q(x,y) = p` over the integers,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1335qfbsolve(PyObject *__pyx_v_Q, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1334qfbsolve[] = "\n        Solve the equation :math:`Q(x,y) = p` over the integers,\n        where :math:`Q` is a binary quadratic form and :math:`p` a prime number.\n        \n        Return :math:`[x,y]` as a two-components vector, or zero if there is no solution.\n        Note that this function returns only one solution and not all the solutions.\n        \n        Let :math:`D = \\mathrm{disc} Q`. The algorithm used runs in probabilistic polynomial time\n        in :math:`p` (through the computation of a square root of :math:`D` modulo :math:`p`); it is\n        polynomial time in :math:`D` if :math:`Q` is imaginary, but exponential time if :math:`Q` is\n        real (through the computation of a full cycle of reduced forms). In the\n        latter case, note that :literal:`bnfisprincipal` provides a solution in heuristic\n        subexponential time in :math:`D` assuming the GRH.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1335qfbsolve(PyObject *__pyx_v_Q, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfbsolve (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1334qfbsolve(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_Q), ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1334qfbsolve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_Q, PyObject *__pyx_v_p) {
  GEN __pyx_v__Q;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfbsolve", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":23291
 *         subexponential time in :math:`D` assuming the GRH.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23292
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 23292, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23293
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = qfbsolve(_Q, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23294
 *         sig_on()
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfbsolve(_Q, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23295
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = qfbsolve(_Q, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfbsolve(__pyx_v__Q, __pyx_v__p);

  /* "cypari/auto_gen.pxi":23296
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = qfbsolve(_Q, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfeval(q, x, y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23276
 *         return new_gen(_ret)
 * 
 *     def qfbsolve(Q, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Solve the equation :math:`Q(x,y) = p` over the integers,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfbsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23298
 *         return new_gen(_ret)
 * 
 *     def qfeval(q, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluate the quadratic form :math:`q` (given by a symmetric matrix)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1337qfeval(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1336qfeval[] = "\n        Evaluate the quadratic form :math:`q` (given by a symmetric matrix)\n        at the vector :math:`x`; if :math:`y` is present, evaluate the polar form at :math:`(x,y)`;\n        if :math:`q` omitted, use the standard Euclidean scalar product, corresponding to\n        the identity matrix.\n        \n        Roughly equivalent to :literal:`x~ * q * y`, but a little faster and\n        more convenient (does not distinguish between column and row vectors):\n        \n        ::\n        \n            ? x = [1,2,3]~; y = [-1,3,1]~; q = [1,2,3;2,2,-1;3,-1,9];\n            ? qfeval(q,x,y)\n            %2 = 23\n            ? for(i=1,10^6, qfeval(q,x,y))\n            time = 661ms\n            ? for(i=1,10^6, x~*q*y)\n            time = 697ms\n        \n        The speedup is noticeable for the quadratic form,\n        compared to :literal:`x~ * q * x`, since we save almost half the\n        operations:\n        \n        ::\n        \n            ? for(i=1,10^6, qfeval(q,x))\n            time = 487ms\n        \n        The special case :math:`q = Id` is handled faster if we\n        omit :math:`q` altogether:\n        \n        ::\n        \n            ? qfeval(,x,y)\n            %6 = 8\n            ? q = matid(#x);\n            ? for(i=1,10^6, qfeval(q,x,y))\n            time = 529 ms.\n            ? for(i=1,10^6, qfeval(,x,y))\n            time = 228 ms.\n            ? for(i=1,10^6, x~*y)\n            time = 274 ms.\n        \n        We also allow :literal:`t_MAT`\302\240s of compatible dimensions for :math:`x`,\n        and return :literal:`x~ * q * x` in this case as well:\n        \n        ::\n        \n            ? M = [1,2,3;4,5,6;7,8,9]; qfeval(,M) \\\\ Gram matrix\n            %5 =\n            [66 78 90]\n            \n            [78 93 108]\n            \n            [90 108 126]\n            \n            ? q = [1,2,3;2,2,-1;3,-1,9];\n            ? for(i=1,10^6, qfeval(q,M))\n            time = 2,008 ms.\n            ? for(i=1,10^6, M~*q*M)\n     ""       time = 2,368 ms.\n            \n            ? for(i=1,10^6, qfeval(,M))\n            time = 1,053 ms.\n            ? for(i=1,10^6, M~*M)\n            time = 1,171 ms.\n        \n        If :math:`q` is a :literal:`t_QFI` or :literal:`t_QFR`, it is implicitly converted to the\n        attached symmetric :literal:`t_MAT`. This is done more\n        efficiently than by direct conversion, since we avoid introducing a\n        denominator :math:`2` and rational arithmetic:\n        \n        ::\n        \n            ? q = Qfb(2,3,4); x = [2,3];\n            ? qfeval(q, x)\n            %2 = 62\n            ? Q = Mat(q)\n            %3 =\n             [ 2 3/2]\n            \n             [3/2 4]\n            ? qfeval(Q, x)\n            %4 = 62\n            ? for (i=1, 10^6, qfeval(q,x))\n            time = 758 ms.\n            ? for (i=1, 10^6, qfeval(Q,x))\n            time = 1,110 ms.\n        \n        Finally, when :math:`x` is a :literal:`t_MAT` with :emphasis:`integral` coefficients, we allow\n        a :literal:`t_QFI` or :literal:`t_QFR` for :math:`q` and return the binary\n        quadratic form :math:`q o M`. Again, the conversion to :literal:`t_MAT` is less\n        efficient in this case:\n        \n        ::\n        \n            ? q = Qfb(2,3,4); Q = Mat(q); x = [1,2;3,4];\n            ? qfeval(q, x)\n            %2 = Qfb(47, 134, 96)\n            ? qfeval(Q,x)\n            %3 =\n            [47 67]\n            \n            [67 96]\n            ? for (i=1, 10^6, qfeval(q,x))\n            time = 701 ms.\n            ? for (i=1, 10^6, qfeval(Q,x))\n            time = 1,639 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1337qfeval(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfeval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfeval") < 0)) __PYX_ERR(10, 23298, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfeval", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23298, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1336qfeval(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_q), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1336qfeval(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  int __pyx_v__have_y;
  GEN __pyx_v__q;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfeval", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":23408
 *             time = 1,639 ms.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23409
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             y = objtogen(y)
 */
  __pyx_t_2 = (__pyx_v_y != Py_None);
  __pyx_v__have_y = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23410
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23411
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:
 *             y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":23410
 *         x = objtogen(x)
 *         cdef bint _have_y = (y is not None)
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             y = objtogen(y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23412
 *         if _have_y:
 *             y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23412, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23413
 *             y = objtogen(y)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23414
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = NULL
 *         if _have_y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23415
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL             # <<<<<<<<<<<<<<
 *         if _have_y:
 *             _y = (<Gen>y).g
 */
  __pyx_v__y = NULL;

  /* "cypari/auto_gen.pxi":23416
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 */
  __pyx_t_2 = (__pyx_v__have_y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23417
 *         cdef GEN _y = NULL
 *         if _have_y:
 *             _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
    __pyx_v__y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23416
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = NULL
 *         if _have_y:             # <<<<<<<<<<<<<<
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 */
  }

  /* "cypari/auto_gen.pxi":23418
 *         if _have_y:
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfeval0(__pyx_v__q, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":23419
 *             _y = (<Gen>y).g
 *         cdef GEN _ret = qfeval0(_q, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfgaussred(q):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23298
 *         return new_gen(_ret)
 * 
 *     def qfeval(q, x, y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Evaluate the quadratic form :math:`q` (given by a symmetric matrix)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfeval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23421
 *         return new_gen(_ret)
 * 
 *     def qfgaussred(q):             # <<<<<<<<<<<<<<
 *         r'''
 *         decomposition into squares of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1339qfgaussred(PyObject *__pyx_v_q, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1338qfgaussred[] = "\n        decomposition into squares of the\n        quadratic form represented by the symmetric matrix :math:`q`. The result is a\n        matrix whose diagonal entries are the coefficients of the squares, and the\n        off-diagonal entries on each line represent the bilinear forms. More\n        precisely, if :math:`(a_{ij})` denotes the output, one has\n        \n        .. MATH::\n        \n            q(x) = \\sum_i a_{ii} (x_i + \\sum_{j != i} a_{ij} x_j)^2\n        \n        ::\n        \n            ? qfgaussred([0,1;1,0])\n            %1 =\n            [1/2 1]\n            \n            [-1 -1/2]\n        \n        This means that :math:`2xy = (1/2)(x+y)^2 - (1/2)(x-y)^2`.\n        Singular matrices are supported, in which case some diagonal coefficients\n        will vanish:\n        \n        ::\n        \n            ? qfgaussred([1,1;1,1])\n            %1 =\n            [1 1]\n            \n            [1 0]\n        \n        This means that :math:`x^2 + 2xy + y^2 = (x+y)^2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1339qfgaussred(PyObject *__pyx_v_q, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfgaussred (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1338qfgaussred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_q));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1338qfgaussred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q) {
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfgaussred", 0);

  /* "cypari/auto_gen.pxi":23455
 *         This means that :math:`x^2 + 2xy + y^2 = (x+y)^2`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = qfgaussred(_q)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23455, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23456
 *         '''
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfgaussred(_q)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23457
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = qfgaussred(_q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfgaussred(__pyx_v__q);

  /* "cypari/auto_gen.pxi":23458
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _ret = qfgaussred(_q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfisom(G, H, fl=None, grp=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23421
 *         return new_gen(_ret)
 * 
 *     def qfgaussred(q):             # <<<<<<<<<<<<<<
 *         r'''
 *         decomposition into squares of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfgaussred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23460
 *         return new_gen(_ret)
 * 
 *     def qfisom(G, H, fl=None, grp=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G`, :math:`H` being square and symmetric matrices with integer entries representing
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1341qfisom(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1340qfisom[] = "\n        :math:`G`, :math:`H` being square and symmetric matrices with integer entries representing\n        positive definite quadratic forms, return an invertible matrix :math:`S` such that\n        :math:`G = {^t}S H S`. This defines a isomorphism between the corresponding lattices.\n        Since this requires computing the minimal vectors, the computations can\n        become very lengthy as the dimension grows.\n        See :literal:`qfisominit` for the meaning of :emphasis:`fl`.\n        If :emphasis:`grp` is given it must be the automorphism group of :math:`H`. It will be used\n        to speed up the computation.\n        \n        :math:`G` can also be given by an :literal:`qfisominit` structure which is preferable if\n        several forms :math:`H` need to be compared to :math:`G`.\n        \n        This function implements an algorithm of Plesken and Souvignier, following\n        Souvignier's implementation.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1341qfisom(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_H = 0;
  PyObject *__pyx_v_fl = 0;
  PyObject *__pyx_v_grp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfisom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_H,&__pyx_n_s_fl,&__pyx_n_s_grp,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((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  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_H)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_grp);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfisom") < 0)) __PYX_ERR(10, 23460, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_H = values[0];
    __pyx_v_fl = values[1];
    __pyx_v_grp = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfisom", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23460, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfisom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1340qfisom(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_H, __pyx_v_fl, __pyx_v_grp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1340qfisom(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_H, PyObject *__pyx_v_fl, PyObject *__pyx_v_grp) {
  int __pyx_v__have_fl;
  int __pyx_v__have_grp;
  GEN __pyx_v__G;
  GEN __pyx_v__H;
  GEN __pyx_v__fl;
  GEN __pyx_v__grp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfisom", 0);
  __Pyx_INCREF(__pyx_v_H);
  __Pyx_INCREF(__pyx_v_fl);
  __Pyx_INCREF(__pyx_v_grp);

  /* "cypari/auto_gen.pxi":23477
 *         Souvignier's implementation.
 *         '''
 *         H = objtogen(H)             # <<<<<<<<<<<<<<
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_H, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_H, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23478
 *         '''
 *         H = objtogen(H)
 *         cdef bint _have_fl = (fl is not None)             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             fl = objtogen(fl)
 */
  __pyx_t_2 = (__pyx_v_fl != Py_None);
  __pyx_v__have_fl = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23479
 *         H = objtogen(H)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23480
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 *             fl = objtogen(fl)             # <<<<<<<<<<<<<<
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fl, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fl, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":23479
 *         H = objtogen(H)
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 */
  }

  /* "cypari/auto_gen.pxi":23481
 *         if _have_fl:
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)             # <<<<<<<<<<<<<<
 *         if _have_grp:
 *             grp = objtogen(grp)
 */
  __pyx_t_2 = (__pyx_v_grp != Py_None);
  __pyx_v__have_grp = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23482
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             grp = objtogen(grp)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_grp != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23483
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:
 *             grp = objtogen(grp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_grp, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23483, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_grp, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":23482
 *             fl = objtogen(fl)
 *         cdef bint _have_grp = (grp is not None)
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             grp = objtogen(grp)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23484
 *         if _have_grp:
 *             grp = objtogen(grp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _H = (<Gen>H).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23484, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23485
 *             grp = objtogen(grp)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23486
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _H = (<Gen>H).g             # <<<<<<<<<<<<<<
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_H)->__pyx_base.g;
  __pyx_v__H = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23487
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 */
  __pyx_v__fl = NULL;

  /* "cypari/auto_gen.pxi":23488
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 */
  __pyx_t_2 = (__pyx_v__have_fl != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23489
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 *             _fl = (<Gen>fl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _grp = NULL
 *         if _have_grp:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fl)->__pyx_base.g;
    __pyx_v__fl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23488
 *         cdef GEN _H = (<Gen>H).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 */
  }

  /* "cypari/auto_gen.pxi":23490
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL             # <<<<<<<<<<<<<<
 *         if _have_grp:
 *             _grp = (<Gen>grp).g
 */
  __pyx_v__grp = NULL;

  /* "cypari/auto_gen.pxi":23491
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 */
  __pyx_t_2 = (__pyx_v__have_grp != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":23492
 *         cdef GEN _grp = NULL
 *         if _have_grp:
 *             _grp = (<Gen>grp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_grp)->__pyx_base.g;
    __pyx_v__grp = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23491
 *             _fl = (<Gen>fl).g
 *         cdef GEN _grp = NULL
 *         if _have_grp:             # <<<<<<<<<<<<<<
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 */
  }

  /* "cypari/auto_gen.pxi":23493
 *         if _have_grp:
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfisom0(__pyx_v__G, __pyx_v__H, __pyx_v__fl, __pyx_v__grp);

  /* "cypari/auto_gen.pxi":23494
 *             _grp = (<Gen>grp).g
 *         cdef GEN _ret = qfisom0(_G, _H, _fl, _grp)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfisominit(G, fl=None, m=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23460
 *         return new_gen(_ret)
 * 
 *     def qfisom(G, H, fl=None, grp=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G`, :math:`H` being square and symmetric matrices with integer entries representing
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfisom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_H);
  __Pyx_XDECREF(__pyx_v_fl);
  __Pyx_XDECREF(__pyx_v_grp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23496
 *         return new_gen(_ret)
 * 
 *     def qfisominit(G, fl=None, m=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1343qfisominit(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1342qfisominit[] = "\n        :math:`G` being a square and symmetric matrix with integer entries representing a\n        positive definite quadratic form, return an :literal:`isom` structure allowing to\n        compute isomorphisms between :math:`G` and other quadratic forms faster.\n        \n        The interface of this function is experimental and will likely change in future\n        release.\n        \n        If present, the optional parameter :emphasis:`fl` must be a :literal:`t_VEC` with two\n        components. It allows to specify the invariants used, which can make the\n        computation faster or slower. The components are\n        \n        - :literal:`fl[1]` Depth of scalar product combination to use.\n        \n        - :literal:`fl[2]` Maximum level of Bacher polynomials to use.\n        \n        If present, :math:`m` must be the set of vectors of norm up to the maximal of the\n        diagonal entry of :math:`G`, either as a matrix or as given by :literal:`qfminim`.\n        Otherwise this function computes the minimal vectors so it become very\n        lengthy as the dimension of :math:`G` grows.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1343qfisominit(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fl = 0;
  PyObject *__pyx_v_m = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfisominit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fl,&__pyx_n_s_m,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfisominit") < 0)) __PYX_ERR(10, 23496, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_fl = values[0];
    __pyx_v_m = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfisominit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23496, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfisominit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1342qfisominit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_fl, __pyx_v_m);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1342qfisominit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_fl, PyObject *__pyx_v_m) {
  int __pyx_v__have_fl;
  int __pyx_v__have_m;
  GEN __pyx_v__G;
  GEN __pyx_v__fl;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfisominit", 0);
  __Pyx_INCREF(__pyx_v_fl);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_gen.pxi":23518
 *         lengthy as the dimension of :math:`G` grows.
 *         '''
 *         cdef bint _have_fl = (fl is not None)             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             fl = objtogen(fl)
 */
  __pyx_t_1 = (__pyx_v_fl != Py_None);
  __pyx_v__have_fl = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23519
 *         '''
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 */
  __pyx_t_1 = (__pyx_v__have_fl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23520
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:
 *             fl = objtogen(fl)             # <<<<<<<<<<<<<<
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fl, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_fl, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23519
 *         '''
 *         cdef bint _have_fl = (fl is not None)
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 */
  }

  /* "cypari/auto_gen.pxi":23521
 *         if _have_fl:
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             m = objtogen(m)
 */
  __pyx_t_1 = (__pyx_v_m != Py_None);
  __pyx_v__have_m = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23522
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_m != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23523
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 *             m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23523, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23522
 *             fl = objtogen(fl)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23524
 *         if _have_m:
 *             m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23524, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23525
 *             m = objtogen(m)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23526
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL             # <<<<<<<<<<<<<<
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 */
  __pyx_v__fl = NULL;

  /* "cypari/auto_gen.pxi":23527
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 */
  __pyx_t_1 = (__pyx_v__have_fl != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23528
 *         cdef GEN _fl = NULL
 *         if _have_fl:
 *             _fl = (<Gen>fl).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = NULL
 *         if _have_m:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_fl)->__pyx_base.g;
    __pyx_v__fl = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23527
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _fl = NULL
 *         if _have_fl:             # <<<<<<<<<<<<<<
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 */
  }

  /* "cypari/auto_gen.pxi":23529
 *         if _have_fl:
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             _m = (<Gen>m).g
 */
  __pyx_v__m = NULL;

  /* "cypari/auto_gen.pxi":23530
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 */
  __pyx_t_1 = (__pyx_v__have_m != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23531
 *         cdef GEN _m = NULL
 *         if _have_m:
 *             _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
    __pyx_v__m = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23530
 *             _fl = (<Gen>fl).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 */
  }

  /* "cypari/auto_gen.pxi":23532
 *         if _have_m:
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfisominit0(__pyx_v__G, __pyx_v__fl, __pyx_v__m);

  /* "cypari/auto_gen.pxi":23533
 *             _m = (<Gen>m).g
 *         cdef GEN _ret = qfisominit0(_G, _fl, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfjacobi(A, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23496
 *         return new_gen(_ret)
 * 
 *     def qfisominit(G, fl=None, m=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with integer entries representing a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfisominit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_fl);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23535
 *         return new_gen(_ret)
 * 
 *     def qfjacobi(A, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply Jacobi's eigenvalue algorithm to the real symmetric matrix :math:`A`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1345qfjacobi(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1344qfjacobi[] = "\n        Apply Jacobi's eigenvalue algorithm to the real symmetric matrix :math:`A`.\n        This returns :math:`[L, V]`, where\n        \n        - :math:`L` is the vector of (real) eigenvalues of :math:`A`, sorted in increasing\n          order,\n        \n        - :math:`V` is the corresponding orthogonal matrix of eigenvectors of :math:`A`.\n        \n        ::\n        \n            ? \\p19\n            ? A = [1,2;2,1]; mateigen(A)\n            %1 =\n            [-1 1]\n            \n            [ 1 1]\n            ? [L, H] = qfjacobi(A);\n            ? L\n            %3 = [-1.000000000000000000, 3.000000000000000000]~\n            ? H\n            %4 =\n            [ 0.7071067811865475245 0.7071067811865475244]\n            \n            [-0.7071067811865475244 0.7071067811865475245]\n            ? norml2( (A-L[1])*H[,1] ) \\\\ approximate eigenvector\n            %5 = 9.403954806578300064 E-38\n            ? norml2(H*H~ - 1)\n            %6 = 2.350988701644575016 E-38 \\\\ close to orthogonal\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1345qfjacobi(PyObject *__pyx_v_A, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfjacobi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfjacobi") < 0)) __PYX_ERR(10, 23535, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23535, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfjacobi", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23535, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfjacobi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1344qfjacobi(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_A), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1344qfjacobi(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_A, long __pyx_v_precision) {
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfjacobi", 0);

  /* "cypari/auto_gen.pxi":23566
 *             %6 = 2.350988701644575016 E-38 \\ close to orthogonal
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23566, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23567
 *         '''
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jacobi(_A, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23568
 *         sig_on()
 *         cdef GEN _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = jacobi(_A, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":23569
 *         cdef GEN _A = (<Gen>A).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jacobi(_A, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = jacobi(__pyx_v__A, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":23570
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = jacobi(_A, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qflll(x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23535
 *         return new_gen(_ret)
 * 
 *     def qfjacobi(A, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Apply Jacobi's eigenvalue algorithm to the real symmetric matrix :math:`A`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfjacobi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23572
 *         return new_gen(_ret)
 * 
 *     def qflll(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL algorithm applied to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1347qflll(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1346qflll[] = "\n        LLL algorithm applied to the\n        :emphasis:`columns` of the matrix :math:`x`. The columns of :math:`x` may be linearly\n        dependent. The result is a unimodular transformation matrix :math:`T` such that :math:`x\n        .T` is an LLL-reduced basis of the lattice generated by the column\n        vectors of :math:`x`. Note that if :math:`x` is not of maximal rank :math:`T` will not be\n        square. The LLL parameters are :math:`(0.51,0.99)`, meaning that the Gram-Schmidt\n        coefficients for the final basis satisfy :math:`\\|\\mu_{i,j}\\| <= 0.51`, and the\n        Lov\303\241sz's constant is :math:`0.99`.\n        \n        If :math:`flag = 0` (default), assume that :math:`x` has either exact (integral or\n        rational) or real floating point entries. The matrix is rescaled, converted\n        to integers and the behavior is then as in :math:`flag = 1`.\n        \n        If :math:`flag = 1`, assume that :math:`x` is integral. Computations involving Gram-Schmidt\n        vectors are approximate, with precision varying as needed (Lehmer's trick,\n        as generalized by Schnorr). Adapted from Nguyen and Stehl\303\251's algorithm\n        and Stehl\303\251's code (:literal:`fplll-1.3`).\n        \n        If :math:`flag = 2`, :math:`x` should be an integer matrix whose columns are linearly\n        independent. Returns a partially reduced basis for :math:`x`, using an unpublished\n        algorithm by Peter Montgomery: a basis is said to be :emphasis:`partially reduced`\n        if :math:`\\|v_i \302\261 v_j\\| >= \\|v_i\\|` for any two distinct basis vectors :math:`v_i,\n        v_j`.\n        \n        This is faster than :math:`flag = 1`, esp. when one row is huge compared\n        to the other rows (knapsack-style), and should quickly produce relatively\n        short vectors. The resulting basis is :emphasis:`not` LLL-reduced in general.\n        If LLL reduction is eventually desired, avoid this partial reduction:\n        apply""ing LLL to the partially reduced matrix is significantly :emphasis:`slower`\n        than starting from a knapsack-type lattice.\n        \n        If :math:`flag = 4`, as :math:`flag = 1`, returning a vector :math:`[K, T]` of matrices: the\n        columns of :math:`K` represent a basis of the integer kernel of :math:`x`\n        (not LLL-reduced in general) and :math:`T` is the transformation\n        matrix such that :math:`x.T` is an LLL-reduced :math:`\\mathbb{Z}`-basis of the image\n        of the matrix :math:`x`.\n        \n        If :math:`flag = 5`, case as case :math:`4`, but :math:`x` may have polynomial coefficients.\n        \n        If :math:`flag = 8`, same as case :math:`0`, but :math:`x` may have polynomial coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1347qflll(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qflll (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qflll") < 0)) __PYX_ERR(10, 23572, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23572, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qflll", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23572, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qflll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1346qflll(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1346qflll(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qflll", 0);

  /* "cypari/auto_gen.pxi":23615
 *         If :math:`flag = 8`, same as case :math:`0`, but :math:`x` may have polynomial coefficients.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qflll0(_x, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23615, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23616
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qflll0(_x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23617
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qflll0(_x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qflll0(__pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":23618
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qflll0(_x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qflllgram(G, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23572
 *         return new_gen(_ret)
 * 
 *     def qflll(x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         LLL algorithm applied to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qflll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23620
 *         return new_gen(_ret)
 * 
 *     def qflllgram(G, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`qflll`, except that the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1349qflllgram(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1348qflllgram[] = "\n        Same as :literal:`qflll`, except that the\n        matrix :math:`G = x~ * x` is the Gram matrix of some lattice vectors :math:`x`,\n        and not the coordinates of the vectors themselves. In particular, :math:`G` must\n        now be a square symmetric real matrix, corresponding to a positive\n        quadratic form (not necessarily definite: :math:`x` needs not have maximal rank).\n        The result is a unimodular\n        transformation matrix :math:`T` such that :math:`x.T` is an LLL-reduced basis of\n        the lattice generated by the column vectors of :math:`x`. See :literal:`qflll` for\n        further details about the LLL implementation.\n        \n        If :math:`flag = 0` (default), assume that :math:`G` has either exact (integral or\n        rational) or real floating point entries. The matrix is rescaled, converted\n        to integers and the behavior is then as in :math:`flag = 1`.\n        \n        If :math:`flag = 1`, assume that :math:`G` is integral. Computations involving Gram-Schmidt\n        vectors are approximate, with precision varying as needed (Lehmer's trick,\n        as generalized by Schnorr). Adapted from Nguyen and Stehl\303\251's algorithm\n        and Stehl\303\251's code (:literal:`fplll-1.3`).\n        \n        :math:`flag = 4`: :math:`G` has integer entries, gives the kernel and reduced image of :math:`x`.\n        \n        :math:`flag = 5`: same as :math:`4`, but :math:`G` may have polynomial coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1349qflllgram(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qflllgram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qflllgram") < 0)) __PYX_ERR(10, 23620, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23620, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qflllgram", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23620, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1348qflllgram(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1348qflllgram(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, long __pyx_v_flag) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qflllgram", 0);

  /* "cypari/auto_gen.pxi":23645
 *         :math:`flag = 5`: same as :math:`4`, but :math:`G` may have polynomial coefficients.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qflllgram0(_G, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23645, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23646
 *         '''
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qflllgram0(_G, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23647
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qflllgram0(_G, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qflllgram0(__pyx_v__G, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":23648
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qflllgram0(_G, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfminim(x, b=None, m=None, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23648, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23620
 *         return new_gen(_ret)
 * 
 *     def qflllgram(G, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Same as :literal:`qflll`, except that the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23650
 *         return new_gen(_ret)
 * 
 *     def qfminim(x, b=None, m=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a square and symmetric matrix representing a positive definite
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1351qfminim(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1350qfminim[] = "\n        :math:`x` being a square and symmetric matrix representing a positive definite\n        quadratic form, this function deals with the vectors of :math:`x` whose norm is\n        less than or equal to :math:`b`, enumerated using the Fincke-Pohst algorithm,\n        storing at most :math:`m` vectors (no limit if :math:`m` is omitted). The function\n        searches for the minimal non-zero vectors if :math:`b` is omitted. The behavior is\n        undefined if :math:`x` is not positive definite (a \"precision too low\" error is\n        most likely, although more precise error messages are possible). The precise\n        behavior depends on :math:`flag`.\n        \n        If :math:`flag = 0` (default), returns at most :math:`2m` vectors. The result is a\n        three-component vector, the first component being the number of vectors\n        enumerated (which may be larger than :math:`2m`), the second being the maximum\n        norm found, and the last vector\n        is a matrix whose columns are found vectors, only one being given for each\n        pair :math:`\302\261 v` (at most :math:`m` such pairs, unless :math:`m` was omitted). The vectors\n        are returned in no particular order.\n        \n        If :math:`flag = 1`, ignores :math:`m` and returns :math:`[N,v]`, where :math:`v` is a non-zero vector\n        of length :math:`N <= b`, or :math:`[]` if no non-zero vector has length :math:`<= b`.\n        If no explicit :math:`b` is provided, return a vector of smallish norm\n        (smallest vector in an LLL-reduced basis).\n        \n        In these two cases, :math:`x` must have :emphasis:`integral` entries. The\n        implementation uses low precision floating point computations for maximal\n        speed, which gives incorrect result when :math:`x` has large entries. (The\n        condition is checked in the code and the routine raises an error if\n        large rounding errors occur.) A more robust, but much slower,\n        implementation ""is chosen if the following flag is used:\n        \n        If :math:`flag = 2`, :math:`x` can have non integral real entries. In this case, if :math:`b`\n        is omitted, the \"minimal\" vectors only have approximately the same norm.\n        If :math:`b` is omitted, :math:`m` is an upper bound for the number of vectors that\n        will be stored and returned, but all minimal vectors are nevertheless\n        enumerated. If :math:`m` is omitted, all vectors found are stored and returned;\n        note that this may be a huge vector!\n        \n        ::\n        \n            ? x = matid(2);\n            ? qfminim(x) \\\\ 4 minimal vectors of norm 1: \302\261[0,1], \302\261[1,0]\n            %2 = [4, 1, [0, 1; 1, 0]]\n            ? { x =\n            [4, 2, 0, 0, 0,-2, 0, 0, 0, 0, 0, 0, 1,-1, 0, 0, 0, 1, 0,-1, 0, 0, 0,-2;\n             2, 4,-2,-2, 0,-2, 0, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 0,-1, 0, 1,-1,-1;\n             0,-2, 4, 0,-2, 0, 0, 0, 0, 0, 0, 0,-1, 1, 0, 0, 1, 0, 0, 1,-1,-1, 0, 0;\n             0,-2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 1,-1, 0, 0, 0, 1,-1, 0, 1,-1, 1, 0;\n             0, 0,-2, 0, 4, 0, 0, 0, 1,-1, 0, 0, 1, 0, 0, 0,-2, 0, 0,-1, 1, 1, 0, 0;\n            -2, -2,0, 0, 0, 4,-2, 0,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,-1, 1, 1;\n             0, 0, 0, 0, 0,-2, 4,-2, 0, 0, 0, 0, 0, 1, 0, 0, 0,-1, 0, 0, 0, 1,-1, 0;\n             0, 0, 0, 0, 0, 0,-2, 4, 0, 0, 0, 0,-1, 0, 0, 0, 0, 0,-1,-1,-1, 0, 1, 0;\n             0, 0, 0, 0, 1,-1, 0, 0, 4, 0,-2, 0, 1, 1, 0,-1, 0, 1, 0, 0, 0, 0, 0, 0;\n             0, 0, 0, 0,-1, 0, 0, 0, 0, 4, 0, 0, 1, 1,-1, 1, 0, 0, 0, 1, 0, 0, 1, 0;\n             0, 0, 0, 0, 0, 0, 0, 0,-2, 0, 4,-2, 0,-1, 0, 0, 0,-1, 0,-1, 0, 0, 0, 0;\n             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,-2, 4,-1, 1, 0, 0,-1, 1, 0, 1, 1, 1,-1, 0;\n             1, 0,-1, 1, 1, 0, 0,-1, 1, 1, 0,-1, 4, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1,-1;\n            -1,-1, 1,-1, 0, 0, 1, 0, 1, 1,-1, 1, 0, 4, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1;\n             0, 0, 0, 0, 0, 0, 0, 0, 0,-""1, 0, 0, 0, 1, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0;\n             0, 0, 0, 0, 0, 0, 0, 0,-1, 1, 0, 0, 1, 1, 0, 4, 0, 0, 0, 0, 1, 1, 0, 0;\n             0, 0, 1, 0,-2, 0, 0, 0, 0, 0, 0,-1, 0, 0, 0, 0, 4, 1, 1, 1, 0, 0, 1, 1;\n             1, 0, 0, 1, 0, 0,-1, 0, 1, 0,-1, 1, 1, 0, 0, 0, 1, 4, 0, 1, 1, 0, 1, 0;\n             0, 0, 0,-1, 0, 1, 0,-1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 4, 0, 1, 1, 0, 1;\n            -1, -1,1, 0,-1, 1, 0,-1, 0, 1,-1, 1, 0, 1, 0, 0, 1, 1, 0, 4, 0, 0, 1, 1;\n             0, 0,-1, 1, 1, 0, 0,-1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 4, 1, 0, 1;\n             0, 1,-1,-1, 1,-1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 4, 0, 1;\n             0,-1, 0, 1, 0, 1,-1, 1, 0, 1, 0,-1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 4, 1;\n            -2,-1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,-1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 4]; }\n            ? qfminim(x,,0) \\\\ the Leech lattice has 196560 minimal vectors of norm 4\n            time = 648 ms.\n            %4 = [196560, 4, [;]]\n            ? qfminim(x,,0,2); \\\\ safe algorithm. Slower and unnecessary here.\n            time = 18,161 ms.\n            %5 = [196560, 4.000061035156250000, [;]]\n        \n        In the last example, we store 0 vectors to limit memory use. All minimal\n        vectors are nevertheless enumerated. Provided :literal:`parisize` is about 50MB,\n        :literal:`qfminim(x)` succeeds in 2.5 seconds.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1351qfminim(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_m = 0;
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfminim (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,&__pyx_n_s_m,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfminim") < 0)) __PYX_ERR(10, 23650, __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);
        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;
      }
    }
    __pyx_v_b = values[0];
    __pyx_v_m = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23650, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[3]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23650, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfminim", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23650, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfminim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1350qfminim(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_b, __pyx_v_m, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1350qfminim(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_b, PyObject *__pyx_v_m, long __pyx_v_flag, long __pyx_v_precision) {
  int __pyx_v__have_b;
  int __pyx_v__have_m;
  GEN __pyx_v__x;
  GEN __pyx_v__b;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("qfminim", 0);
  __Pyx_INCREF(__pyx_v_b);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_gen.pxi":23729
 *         :literal:`qfminim(x)` succeeds in 2.5 seconds.
 *         '''
 *         cdef bint _have_b = (b is not None)             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             b = objtogen(b)
 */
  __pyx_t_1 = (__pyx_v_b != Py_None);
  __pyx_v__have_b = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23730
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23731
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:
 *             b = objtogen(b)             # <<<<<<<<<<<<<<
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23731, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_b, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23730
 *         '''
 *         cdef bint _have_b = (b is not None)
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 */
  }

  /* "cypari/auto_gen.pxi":23732
 *         if _have_b:
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             m = objtogen(m)
 */
  __pyx_t_1 = (__pyx_v_m != Py_None);
  __pyx_v__have_m = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23733
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_m != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23734
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:
 *             m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23733
 *             b = objtogen(b)
 *         cdef bint _have_m = (m is not None)
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             m = objtogen(m)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23735
 *         if _have_m:
 *             m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23735, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23736
 *             m = objtogen(m)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _b = NULL
 *         if _have_b:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23737
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL             # <<<<<<<<<<<<<<
 *         if _have_b:
 *             _b = (<Gen>b).g
 */
  __pyx_v__b = NULL;

  /* "cypari/auto_gen.pxi":23738
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 */
  __pyx_t_1 = (__pyx_v__have_b != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23739
 *         cdef GEN _b = NULL
 *         if _have_b:
 *             _b = (<Gen>b).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = NULL
 *         if _have_m:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_b)->__pyx_base.g;
    __pyx_v__b = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23738
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _b = NULL
 *         if _have_b:             # <<<<<<<<<<<<<<
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 */
  }

  /* "cypari/auto_gen.pxi":23740
 *         if _have_b:
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL             # <<<<<<<<<<<<<<
 *         if _have_m:
 *             _m = (<Gen>m).g
 */
  __pyx_v__m = NULL;

  /* "cypari/auto_gen.pxi":23741
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_m != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23742
 *         cdef GEN _m = NULL
 *         if _have_m:
 *             _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
    __pyx_v__m = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23741
 *             _b = (<Gen>b).g
 *         cdef GEN _m = NULL
 *         if _have_m:             # <<<<<<<<<<<<<<
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":23743
 *         if _have_m:
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":23744
 *             _m = (<Gen>m).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfminim0(__pyx_v__x, __pyx_v__b, __pyx_v__m, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":23745
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = qfminim0(_x, _b, _m, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfnorm(x, q=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23650
 *         return new_gen(_ret)
 * 
 *     def qfminim(x, b=None, m=None, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` being a square and symmetric matrix representing a positive definite
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfminim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23747
 *         return new_gen(_ret)
 * 
 *     def qfnorm(x, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1353qfnorm(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1352qfnorm[] = "\n        This function is obsolete, use :literal:`qfeval`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1353qfnorm(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_q,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfnorm") < 0)) __PYX_ERR(10, 23747, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_q = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfnorm", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23747, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1352qfnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1352qfnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_q) {
  PyObject *__pyx_v_warn = NULL;
  int __pyx_v__have_q;
  GEN __pyx_v__x;
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  __Pyx_RefNannySetupContext("qfnorm", 0);
  __Pyx_INCREF(__pyx_v_q);

  /* "cypari/auto_gen.pxi":23751
 *         This function is obsolete, use :literal:`qfeval`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)
 *         cdef bint _have_q = (q is not None)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23751, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":23752
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__76, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":23753
 *         from warnings import warn
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)
 *         cdef bint _have_q = (q is not None)             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             q = objtogen(q)
 */
  __pyx_t_3 = (__pyx_v_q != Py_None);
  __pyx_v__have_q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23754
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":23755
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 *             q = objtogen(q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_q, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_q, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23754
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             q = objtogen(q)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23756
 *         if _have_q:
 *             q = objtogen(q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 23756, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23757
 *             q = objtogen(q)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _q = NULL
 *         if _have_q:
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_5;

  /* "cypari/auto_gen.pxi":23758
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL             # <<<<<<<<<<<<<<
 *         if _have_q:
 *             _q = (<Gen>q).g
 */
  __pyx_v__q = NULL;

  /* "cypari/auto_gen.pxi":23759
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)
 */
  __pyx_t_3 = (__pyx_v__have_q != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":23760
 *         cdef GEN _q = NULL
 *         if _have_q:
 *             _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfnorm(_x, _q)
 *         return new_gen(_ret)
 */
    __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
    __pyx_v__q = __pyx_t_5;

    /* "cypari/auto_gen.pxi":23759
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _q = NULL
 *         if _have_q:             # <<<<<<<<<<<<<<
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)
 */
  }

  /* "cypari/auto_gen.pxi":23761
 *         if _have_q:
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfnorm(__pyx_v__x, __pyx_v__q);

  /* "cypari/auto_gen.pxi":23762
 *             _q = (<Gen>q).g
 *         cdef GEN _ret = qfnorm(_x, _q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qforbits(G, V):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23747
 *         return new_gen(_ret)
 * 
 *     def qfnorm(x, q=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete, use :literal:`qfeval`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23764
 *         return new_gen(_ret)
 * 
 *     def qforbits(G, V):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the orbits of :math:`V` under the action of the group
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1355qforbits(PyObject *__pyx_v_G, PyObject *__pyx_v_V); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1354qforbits[] = "\n        Return the orbits of :math:`V` under the action of the group\n        of linear transformation generated by the set :math:`G`.\n        It is assumed that :math:`G` contains minus identity, and only one vector\n        in :math:`{v, -v}` should be given.\n        If :math:`G` does not stabilize :math:`V`, the function return :math:`0`.\n        \n        In the example below, we compute representatives and lengths of the orbits of\n        the vectors of norm :math:`<= 3` under the automorphisms of the lattice :math:`A_1^6`.\n        \n        ::\n        \n            ? Q=matid(6); G=qfauto(Q); V=qfminim(Q,3);\n            ? apply(x->[x[1],#x],qforbits(G,V))\n            %2 = [[[0,0,0,0,0,1]~,6],[[0,0,0,0,1,-1]~,30],[[0,0,0,1,-1,-1]~,80]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1355qforbits(PyObject *__pyx_v_G, PyObject *__pyx_v_V) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qforbits (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1354qforbits(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), ((PyObject *)__pyx_v_V));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1354qforbits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_V) {
  GEN __pyx_v__G;
  GEN __pyx_v__V;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qforbits", 0);
  __Pyx_INCREF(__pyx_v_V);

  /* "cypari/auto_gen.pxi":23781
 *             %2 = [[[0,0,0,0,0,1]~,6],[[0,0,0,0,1,-1]~,30],[[0,0,0,1,-1,-1]~,80]]
 *         '''
 *         V = objtogen(V)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_V, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_V, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23782
 *         '''
 *         V = objtogen(V)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 23782, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23783
 *         V = objtogen(V)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = qforbits(_G, _V)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23784
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qforbits(_G, _V)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_V)->__pyx_base.g;
  __pyx_v__V = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23785
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = qforbits(_G, _V)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qforbits(__pyx_v__G, __pyx_v__V);

  /* "cypari/auto_gen.pxi":23786
 *         cdef GEN _V = (<Gen>V).g
 *         cdef GEN _ret = qforbits(_G, _V)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfparam(G, sol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23764
 *         return new_gen(_ret)
 * 
 *     def qforbits(G, V):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the orbits of :math:`V` under the action of the group
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qforbits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_V);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23788
 *         return new_gen(_ret)
 * 
 *     def qfparam(G, sol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of binary quadratic forms that parametrize the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1357qfparam(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1356qfparam[] = "\n        Coefficients of binary quadratic forms that parametrize the\n        solutions of the ternary quadratic form :math:`G`, using the particular\n        solution\302\240:emphasis:`sol`.\n        :emphasis:`flag` is optional and can be 1, 2, or 3, in which case the :emphasis:`flag`-th form is\n        reduced. The default is :emphasis:`flag` = 0 (no reduction).\n        \n        ::\n        \n            ? G = [1,0,0;0,1,0;0,0,-34];\n            ? M = qfparam(G, qfsolve(G))\n            %2 =\n            [ 3 -10 -3]\n            \n            [-5 -6 5]\n            \n            [ 1 0 1]\n        \n        Indeed, the solutions can be parametrized as\n        \n        .. MATH::\n        \n            (3x^2 - 10xy - 3y^2)^2 + (-5x^2 - 6xy + 5y^2)^2 -34(x^2 + y^2)^2 = 0.\n        \n        ::\n        \n            ? v = y^2 * M*[1,x/y,(x/y)^2]~\n            %3 = [3*x^2 - 10*y*x - 3*y^2, -5*x^2 - 6*y*x + 5*y^2, -x^2 - y^2]~\n            ? v~*G*v\n            %4 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1357qfparam(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfparam (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sol,&__pyx_n_s_flag,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_sol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfparam") < 0)) __PYX_ERR(10, 23788, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_sol = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23788, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfparam", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23788, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1356qfparam(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_sol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1356qfparam(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_sol, long __pyx_v_flag) {
  GEN __pyx_v__G;
  GEN __pyx_v__sol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfparam", 0);
  __Pyx_INCREF(__pyx_v_sol);

  /* "cypari/auto_gen.pxi":23820
 *             %4 = 0
 *         '''
 *         sol = objtogen(sol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_sol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23821
 *         '''
 *         sol = objtogen(sol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _sol = (<Gen>sol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 23821, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23822
 *         sol = objtogen(sol)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sol = (<Gen>sol).g
 *         cdef GEN _ret = qfparam(_G, _sol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23823
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _sol = (<Gen>sol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfparam(_G, _sol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sol)->__pyx_base.g;
  __pyx_v__sol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23824
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _sol = (<Gen>sol).g
 *         cdef GEN _ret = qfparam(_G, _sol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfparam(__pyx_v__G, __pyx_v__sol, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":23825
 *         cdef GEN _sol = (<Gen>sol).g
 *         cdef GEN _ret = qfparam(_G, _sol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfperfection(G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23825, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23788
 *         return new_gen(_ret)
 * 
 *     def qfparam(G, sol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Coefficients of binary quadratic forms that parametrize the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfparam", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23827
 *         return new_gen(_ret)
 * 
 *     def qfperfection(G):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1359qfperfection(PyObject *__pyx_v_G, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1358qfperfection[] = "\n        :math:`G` being a square and symmetric matrix with\n        integer entries representing a positive definite quadratic form, outputs the\n        perfection rank of the form. That is, gives the rank of the family of the :math:`s`\n        symmetric matrices :math:`v_iv_i^t`, where :math:`s` is half the number of minimal\n        vectors and the :math:`v_i` (:math:`1 <= i <= s`) are the minimal vectors.\n        \n        Since this requires computing the minimal vectors, the computations can\n        become very lengthy as the dimension of :math:`x` grows.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1359qfperfection(PyObject *__pyx_v_G, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfperfection (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1358qfperfection(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1358qfperfection(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfperfection", 0);

  /* "cypari/auto_gen.pxi":23838
 *         become very lengthy as the dimension of :math:`x` grows.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = perf(_G)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23838, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23839
 *         '''
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = perf(_G)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23840
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = perf(_G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = perf(__pyx_v__G);

  /* "cypari/auto_gen.pxi":23841
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = perf(_G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfrep(q, B, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23841, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23827
 *         return new_gen(_ret)
 * 
 *     def qfperfection(G):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`G` being a square and symmetric matrix with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfperfection", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23843
 *         return new_gen(_ret)
 * 
 *     def qfrep(q, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`q` being a square and symmetric matrix with integer entries representing a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1361qfrep(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1360qfrep[] = "\n        :math:`q` being a square and symmetric matrix with integer entries representing a\n        positive definite quadratic form, count the vectors representing successive\n        integers.\n        \n        - If :math:`flag = 0`, count all vectors. Outputs the vector whose :math:`i`-th\n          entry, :math:`1 <= i <= B` is half the number of vectors :math:`v` such that :math:`q(v) = i`.\n        \n        - If :math:`flag = 1`, count vectors of even norm. Outputs the vector\n          whose :math:`i`-th entry, :math:`1 <= i <= B` is half the number of vectors such\n          that :math:`q(v) = 2i`.\n        \n        ::\n        \n            ? q = [2, 1; 1, 3];\n            ? qfrep(q, 5)\n            %2 = Vecsmall([0, 1, 2, 0, 0]) \\\\ 1 vector of norm 2, 2 of norm 3, etc.\n            ? qfrep(q, 5, 1)\n            %3 = Vecsmall([1, 0, 0, 1, 0]) \\\\ 1 vector of norm 2, 0 of norm 4, etc.\n        \n        This routine uses a naive algorithm based on :literal:`qfminim`, and\n        will fail if any entry becomes larger than :math:`2^{31}` (or :math:`2^{63}`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1361qfrep(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfrep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_flag,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_B)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfrep") < 0)) __PYX_ERR(10, 23843, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23843, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfrep", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23843, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfrep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1360qfrep(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_q), __pyx_v_B, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1360qfrep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, PyObject *__pyx_v_B, long __pyx_v_flag) {
  GEN __pyx_v__q;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("qfrep", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":23867
 *         will fail if any entry becomes larger than :math:`2^{31}` (or :math:`2^{63}`).
 *         '''
 *         B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23867, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":23868
 *         '''
 *         B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _B = (<Gen>B).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 23868, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23869
 *         B = objtogen(B)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = qfrep0(_q, _B, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23870
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfrep0(_q, _B, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
  __pyx_v__B = __pyx_t_3;

  /* "cypari/auto_gen.pxi":23871
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = qfrep0(_q, _B, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfrep0(__pyx_v__q, __pyx_v__B, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":23872
 *         cdef GEN _B = (<Gen>B).g
 *         cdef GEN _ret = qfrep0(_q, _B, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfsign(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 23872, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23843
 *         return new_gen(_ret)
 * 
 *     def qfrep(q, B, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`q` being a square and symmetric matrix with integer entries representing a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfrep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23874
 *         return new_gen(_ret)
 * 
 *     def qfsign(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[p,m]` the signature of the quadratic form represented by the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1363qfsign(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1362qfsign[] = "\n        Returns :math:`[p,m]` the signature of the quadratic form represented by the\n        symmetric matrix :math:`x`. Namely, :math:`p` (resp.\302\240:math:`m`) is the number of positive\n        (resp.\302\240negative) eigenvalues of :math:`x`. The result is computed using Gaussian\n        reduction.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1363qfsign(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfsign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1362qfsign(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1362qfsign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfsign", 0);

  /* "cypari/auto_gen.pxi":23881
 *         reduction.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfsign(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23881, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23882
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfsign(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23883
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfsign(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfsign(__pyx_v__x);

  /* "cypari/auto_gen.pxi":23884
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = qfsign(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def qfsolve(G):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23874
 *         return new_gen(_ret)
 * 
 *     def qfsign(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns :math:`[p,m]` the signature of the quadratic form represented by the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfsign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23886
 *         return new_gen(_ret)
 * 
 *     def qfsolve(G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a square symmetric matrix :math:`G` of dimension :math:`n >= 1`, solve over
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1365qfsolve(PyObject *__pyx_v_G, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1364qfsolve[] = "\n        Given a square symmetric matrix :math:`G` of dimension :math:`n >= 1`, solve over\n        :math:`\\mathbb{Q}` the quadratic equation :math:`X^tGX = 0`. The matrix :math:`G` must have rational\n        coefficients. The solution might be a single non-zero vector (vectorv) or a\n        matrix (whose columns generate a totally isotropic subspace).\n        \n        If no solution exists, returns an integer, that can be a prime :math:`p` such that\n        there is no local solution at :math:`p`, or :math:`-1` if there is no real solution,\n        or :math:`-2` if :math:`n = 2` and :math:`-\\det G` is positive but not a square (which implies\n        there is a real solution, but no local solution at some :math:`p` dividing :math:`\\det G`).\n        \n        ::\n        \n            ? G = [1,0,0;0,1,0;0,0,-34];\n            ? qfsolve(G)\n            %1 = [-3, -5, 1]~\n            ? qfsolve([1,0; 0,2])\n            %2 = -1 \\\\ no real solution\n            ? qfsolve([1,0,0;0,3,0; 0,0,-2])\n            %3 = 3 \\\\ no solution in Q_3\n            ? qfsolve([1,0; 0,-2])\n            %4 = -2 \\\\ no solution, n = 2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1365qfsolve(PyObject *__pyx_v_G, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfsolve (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1364qfsolve(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1364qfsolve(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G) {
  GEN __pyx_v__G;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("qfsolve", 0);

  /* "cypari/auto_gen.pxi":23910
 *             %4 = -2 \\ no solution, n = 2
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qfsolve(_G)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23910, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23911
 *         '''
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = qfsolve(_G)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23912
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qfsolve(_G)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = qfsolve(__pyx_v__G);

  /* "cypari/auto_gen.pxi":23913
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _ret = qfsolve(_G)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadclassunit(D, long flag=0, tech=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23913, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23886
 *         return new_gen(_ret)
 * 
 *     def qfsolve(G):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a square symmetric matrix :math:`G` of dimension :math:`n >= 1`, solve over
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.qfsolve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23915
 *         return new_gen(_ret)
 * 
 *     def quadclassunit(D, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Buchmann-McCurley's sub-exponential algorithm for computing the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1367quadclassunit(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1366quadclassunit[] = "\n        Buchmann-McCurley's sub-exponential algorithm for computing the\n        class group of a quadratic order of discriminant :math:`D`.\n        \n        This function should be used instead of :literal:`qfbclassno` or :literal:`quadregula`\n        when :math:`D < -10^{25}`, :math:`D > 10^{10}`, or when the :emphasis:`structure` is wanted. It\n        is a special case of :literal:`bnfinit`, which is slower, but more robust.\n        \n        The result is a vector :math:`v` whose components should be accessed using member\n        functions:\n        \n        - :literal:`:math:`v`.no`: the class number\n        \n        - :literal:`:math:`v`.cyc`: a vector giving the structure of the class group as a\n          product of cyclic groups;\n        \n        - :literal:`:math:`v`.gen`: a vector giving generators of those cyclic groups (as\n          binary quadratic forms).\n        \n        - :literal:`:math:`v`.reg`: the regulator, computed to an accuracy which is the\n          maximum of an internal accuracy determined by the program and the current\n          default (note that once the regulator is known to a small accuracy it is\n          trivial to compute it to very high accuracy, see the tutorial).\n        \n        The :math:`flag` is obsolete and should be left alone. In older versions,\n        it supposedly computed the narrow class group when :math:`D > 0`, but this did not\n        work at all; use the general function :literal:`bnfnarrow`.\n        \n        Optional parameter :emphasis:`tech` is a row vector of the form :math:`[c_1, c_2]`,\n        where :math:`c_1 <= c_2` are non-negative real numbers which control the execution\n        time and the stack size, see ``GRHbnf`` (in the PARI manual). The parameter is used as a\n        threshold to balance the relation finding phase against the final linear\n        algebra. Increasing the default :math:`c_1` means that relations are easier\n        to find, but more relations are neede""d and the linear algebra will be\n        harder. The default value for :math:`c_1` is :math:`0` and means that it is taken equal\n        to :math:`c_2`. The parameter :math:`c_2` is mostly obsolete and should not be changed,\n        but we still document it for completeness: we compute a tentative class\n        group by generators and relations using a factorbase of prime ideals\n        :math:`<= c_1 (\\log \\|D\\|)^2`, then prove that ideals of norm\n        :math:`<= c_2 (\\log \\|D\\|)^2` do\n        not generate a larger group. By default an optimal :math:`c_2` is chosen, so that\n        the result is provably correct under the GRH --- a famous result of Bach\n        states that :math:`c_2 = 6` is fine, but it is possible to improve on this\n        algorithmically. You may provide a smaller :math:`c_2`, it will be ignored\n        (we use the provably correct\n        one); you may provide a larger :math:`c_2` than the default value, which results\n        in longer computing times for equally correct outputs (under GRH).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1367quadclassunit(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_tech = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadclassunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_tech,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tech);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadclassunit") < 0)) __PYX_ERR(10, 23915, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23915, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_tech = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 23915, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadclassunit", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23915, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadclassunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1366quadclassunit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_flag, __pyx_v_tech, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1366quadclassunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_flag, PyObject *__pyx_v_tech, long __pyx_v_precision) {
  int __pyx_v__have_tech;
  GEN __pyx_v__D;
  GEN __pyx_v__tech;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("quadclassunit", 0);
  __Pyx_INCREF(__pyx_v_tech);

  /* "cypari/auto_gen.pxi":23964
 *         in longer computing times for equally correct outputs (under GRH).
 *         '''
 *         cdef bint _have_tech = (tech is not None)             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             tech = objtogen(tech)
 */
  __pyx_t_1 = (__pyx_v_tech != Py_None);
  __pyx_v__have_tech = __pyx_t_1;

  /* "cypari/auto_gen.pxi":23965
 *         '''
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_tech != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23966
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:
 *             tech = objtogen(tech)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tech, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_tech, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":23965
 *         '''
 *         cdef bint _have_tech = (tech is not None)
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             tech = objtogen(tech)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":23967
 *         if _have_tech:
 *             tech = objtogen(tech)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 23967, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23968
 *             tech = objtogen(tech)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_4;

  /* "cypari/auto_gen.pxi":23969
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL             # <<<<<<<<<<<<<<
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 */
  __pyx_v__tech = NULL;

  /* "cypari/auto_gen.pxi":23970
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_tech != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":23971
 *         cdef GEN _tech = NULL
 *         if _have_tech:
 *             _tech = (<Gen>tech).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tech)->__pyx_base.g;
    __pyx_v__tech = __pyx_t_4;

    /* "cypari/auto_gen.pxi":23970
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _tech = NULL
 *         if _have_tech:             # <<<<<<<<<<<<<<
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":23972
 *         if _have_tech:
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":23973
 *             _tech = (<Gen>tech).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadclassunit0(__pyx_v__D, __pyx_v_flag, __pyx_v__tech, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":23974
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadclassunit0(_D, flag, _tech, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quaddisc(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 23974, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23915
 *         return new_gen(_ret)
 * 
 *     def quadclassunit(D, long flag=0, tech=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Buchmann-McCurley's sub-exponential algorithm for computing the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadclassunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tech);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23976
 *         return new_gen(_ret)
 * 
 *     def quaddisc(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the tale algebra :math:`\mathbb{Q} (\sqrt{x})`, where :math:`x\in\mathbb{Q}^*`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1369quaddisc(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1368quaddisc[] = "\n        Discriminant of the \303\251tale algebra :math:`\\mathbb{Q} (\\sqrt{x})`, where :math:`x\\in\\mathbb{Q}^*`.\n        This is the same as :literal:`coredisc`:math:`(d)` where :math:`d` is the integer square-free\n        part of :math:`x`, so x = :math:`d f^2` with :math:`f\\in \\mathbb{Q}^*` and :math:`d\\in\\mathbb{Z}`.\n        This returns :math:`0` for :math:`x = 0`, :math:`1` for :math:`x` square and the discriminant of the\n        quadratic field :math:`\\mathbb{Q} (\\sqrt{x})` otherwise.\n        \n        ::\n        \n            ? quaddisc(7)\n            %1 = 28\n            ? quaddisc(-7)\n            %2 = -7\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1369quaddisc(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quaddisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1368quaddisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1368quaddisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("quaddisc", 0);

  /* "cypari/auto_gen.pxi":23991
 *             %2 = -7
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = quaddisc(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 23991, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":23992
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quaddisc(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":23993
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = quaddisc(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quaddisc(__pyx_v__x);

  /* "cypari/auto_gen.pxi":23994
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = quaddisc(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadgen(D, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 23994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23976
 *         return new_gen(_ret)
 * 
 *     def quaddisc(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Discriminant of the tale algebra :math:`\mathbb{Q} (\sqrt{x})`, where :math:`x\in\mathbb{Q}^*`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quaddisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":23996
 *         return new_gen(_ret)
 * 
 *     def quadgen(D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the quadratic number :math:`\omega = (a+\sqrt{D})/2` where
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1371quadgen(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1370quadgen[] = "\n        Creates the quadratic number :math:`\\omega = (a+\\sqrt{D})/2` where\n        :math:`a = 0` if :math:`D = 0 mod 4`,\n        :math:`a = 1` if :math:`D = 1 mod 4`, so that :math:`(1,\\omega)` is an integral basis for the\n        quadratic order of discriminant :math:`D`. :math:`D` must be an integer congruent to 0 or\n        1 modulo 4, which is not a square.\n        If :emphasis:`v` is given, the variable name is used to display :math:`g` else 'w' is used.\n        \n        ::\n        \n            ? w = quadgen(5, 'w); w^2 - w - 1\n            %1 = 0\n            ? w = quadgen(0, 'w)\n             *** at top-level: w=quadgen(0)\n             *** ^----------\n             *** quadgen: domain error in quadpoly: issquare(disc) = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1371quadgen(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadgen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadgen") < 0)) __PYX_ERR(10, 23996, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadgen", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 23996, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1370quadgen(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1370quadgen(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("quadgen", 0);

  /* "cypari/auto_gen.pxi":24014
 *              *** quadgen: domain error in quadpoly: issquare(disc) = 1
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":24015
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":24016
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 24016, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":24015
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":24017
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadgen0(_D, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 24017, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24018
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadgen0(_D, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_5;

  /* "cypari/auto_gen.pxi":24019
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadgen0(_D, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadgen0(__pyx_v__D, __pyx_v__v);

  /* "cypari/auto_gen.pxi":24020
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadgen0(_D, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadhilbert(D, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 24020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":23996
 *         return new_gen(_ret)
 * 
 *     def quadgen(D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the quadratic number :math:`\omega = (a+\sqrt{D})/2` where
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadgen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24022
 *         return new_gen(_ret)
 * 
 *     def quadhilbert(D, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation defining the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1373quadhilbert(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1372quadhilbert[] = "\n        Relative equation defining the\n        Hilbert class field of the quadratic field of discriminant :math:`D`.\n        \n        If :math:`D < 0`, uses complex multiplication (Schertz's variant).\n        \n        If :math:`D > 0` Stark units are used and (in rare cases) a\n        vector of extensions may be returned whose compositum is the requested class\n        field. See :literal:`bnrstark` for details.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1373quadhilbert(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadhilbert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadhilbert") < 0)) __PYX_ERR(10, 24022, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24022, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadhilbert", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24022, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1372quadhilbert(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1372quadhilbert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, long __pyx_v_precision) {
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("quadhilbert", 0);

  /* "cypari/auto_gen.pxi":24033
 *         field. See :literal:`bnrstark` for details.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 24033, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24034
 *         '''
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadhilbert(_D, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24035
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadhilbert(_D, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":24036
 *         cdef GEN _D = (<Gen>D).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadhilbert(_D, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadhilbert(__pyx_v__D, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":24037
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadhilbert(_D, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadpoly(D, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 24037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24022
 *         return new_gen(_ret)
 * 
 *     def quadhilbert(D, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation defining the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadhilbert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24039
 *         return new_gen(_ret)
 * 
 *     def quadpoly(D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the "canonical" quadratic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1375quadpoly(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1374quadpoly[] = "\n        Creates the \"canonical\" quadratic\n        polynomial (in the variable :math:`v`) corresponding to the discriminant :math:`D`,\n        i.e.\302\240the minimal polynomial of :math:`quadgen (D)`. :math:`D` must be an integer\n        congruent to 0 or 1 modulo 4, which is not a square.\n        \n        ::\n        \n            ? quadpoly(5,'y)\n            %1 = y^2 - y - 1\n            ? quadpoly(0,'y)\n             *** at top-level: quadpoly(0,'y)\n             *** ^--------------\n             *** quadpoly: domain error in quadpoly: issquare(disc) = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1375quadpoly(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadpoly") < 0)) __PYX_ERR(10, 24039, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadpoly", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24039, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1374quadpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1374quadpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("quadpoly", 0);

  /* "cypari/auto_gen.pxi":24055
 *              *** quadpoly: domain error in quadpoly: issquare(disc) = 1
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":24056
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":24057
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 24057, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":24056
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":24058
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadpoly0(_D, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 24058, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24059
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadpoly0(_D, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_5;

  /* "cypari/auto_gen.pxi":24060
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadpoly0(_D, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadpoly0(__pyx_v__D, __pyx_v__v);

  /* "cypari/auto_gen.pxi":24061
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadpoly0(_D, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadray(D, f, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 24061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24039
 *         return new_gen(_ret)
 * 
 *     def quadpoly(D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Creates the "canonical" quadratic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24063
 *         return new_gen(_ret)
 * 
 *     def quadray(D, f, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation for the ray
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1377quadray(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1376quadray[] = "\n        Relative equation for the ray\n        class field of conductor :math:`f` for the quadratic field of discriminant :math:`D`\n        using analytic methods. A :literal:`bnf` for :math:`x^2 - D` is also accepted in place\n        of :math:`D`.\n        \n        For :math:`D < 0`, uses the :math:`\\sigma` function and Schertz's method.\n        \n        For :math:`D > 0`, uses Stark's conjecture, and a vector of relative equations may be\n        returned. See :literal:`bnrstark` for more details.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1377quadray(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_f = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadray (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_precision,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_f)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadray") < 0)) __PYX_ERR(10, 24063, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_f = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24063, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadray", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24063, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1376quadray(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_f, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1376quadray(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_f, long __pyx_v_precision) {
  GEN __pyx_v__D;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("quadray", 0);
  __Pyx_INCREF(__pyx_v_f);

  /* "cypari/auto_gen.pxi":24075
 *         returned. See :literal:`bnrstark` for more details.
 *         '''
 *         f = objtogen(f)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_f, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24075, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_f, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24076
 *         '''
 *         f = objtogen(f)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24076, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24077
 *         f = objtogen(f)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24078
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadray(_D, _f, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24079
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _f = (<Gen>f).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadray(_D, _f, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":24080
 *         cdef GEN _f = (<Gen>f).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadray(_D, _f, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadray(__pyx_v__D, __pyx_v__f, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":24081
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadray(_D, _f, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadregulator(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24063
 *         return new_gen(_ret)
 * 
 *     def quadray(D, f, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative equation for the ray
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24083
 *         return new_gen(_ret)
 * 
 *     def quadregulator(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Regulator of the quadratic field of positive discriminant :math:`x`. Returns
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1379quadregulator(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1378quadregulator[] = "\n        Regulator of the quadratic field of positive discriminant :math:`x`. Returns\n        an error if :math:`x` is not a discriminant (fundamental or not) or if :math:`x` is a\n        square. See also :literal:`quadclassunit` if :math:`x` is large.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1379quadregulator(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadregulator (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadregulator") < 0)) __PYX_ERR(10, 24083, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24083, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadregulator", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24083, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1378quadregulator(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1378quadregulator(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("quadregulator", 0);

  /* "cypari/auto_gen.pxi":24089
 *         square. See also :literal:`quadclassunit` if :math:`x` is large.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 24089, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24090
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadregulator(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24091
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadregulator(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":24092
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadregulator(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadregulator(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":24093
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = quadregulator(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def quadunit(D, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 24093, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24083
 *         return new_gen(_ret)
 * 
 *     def quadregulator(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Regulator of the quadratic field of positive discriminant :math:`x`. Returns
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadregulator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24095
 *         return new_gen(_ret)
 * 
 *     def quadunit(D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fundamental unit :math:`u` of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1381quadunit(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1380quadunit[] = "\n        Fundamental unit :math:`u` of the\n        real quadratic field :math:`\\mathbb{Q} (\\sqrt D)` where :math:`D` is the positive discriminant\n        of the field. If :math:`D` is not a fundamental discriminant, this probably gives\n        the fundamental unit of the corresponding order. :math:`D` must be an integer\n        congruent to 0 or 1 modulo 4, which is not a square; the result is a\n        quadratic number (see ``quadgen`` (in the PARI manual)).\n        If :emphasis:`v` is given, the variable name is used to display :math:`u`\n        else 'w' is used.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1381quadunit(PyObject *__pyx_v_D, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quadunit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quadunit") < 0)) __PYX_ERR(10, 24095, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("quadunit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24095, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1380quadunit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1380quadunit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("quadunit", 0);

  /* "cypari/auto_gen.pxi":24106
 *         else 'w' is used.
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":24107
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":24108
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 24108, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":24107
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":24109
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadunit0(_D, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 24109, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24110
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = quadunit0(_D, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_5;

  /* "cypari/auto_gen.pxi":24111
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadunit0(_D, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = quadunit0(__pyx_v__D, __pyx_v__v);

  /* "cypari/auto_gen.pxi":24112
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = quadunit0(_D, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def ramanujantau(n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 24112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24095
 *         return new_gen(_ret)
 * 
 *     def quadunit(D, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Fundamental unit :math:`u` of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.quadunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24114
 *         return new_gen(_ret)
 * 
 *     def ramanujantau(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of Ramanujan's tau function at an individual :math:`n`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1383ramanujantau(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1382ramanujantau[] = "\n        Compute the value of Ramanujan's tau function at an individual :math:`n`,\n        assuming the truth of the GRH (to compute quickly class numbers of imaginary\n        quadratic fields using :literal:`quadclassunit`).\n        Algorithm in :math:`~{O}(n^{1/2})` using :math:`O(\\log n)` space. If all values up\n        to :math:`N` are required, then\n        \n        .. MATH::\n        \n            \\sum \\tau (n)q^n = q \\prod_{n >= 1} (1-q^n)^{24}\n        \n        will produce them in time :math:`~{O}(N)`, against :math:`~{O}(N^{3/2})` for\n        individual calls to :literal:`ramanujantau`; of course the space complexity then\n        becomes :math:`~{O}(N)`.\n        \n        ::\n        \n            ? tauvec(N) = Vec(q*eta(q + O(q^N))^24);\n            ? N = 10^4; v = tauvec(N);\n            time = 26 ms.\n            ? ramanujantau(N)\n            %3 = -482606811957501440000\n            ? w = vector(N, n, ramanujantau(n)); \\\\ much slower !\n            time = 13,190 ms.\n            ? v == w\n            %4 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1383ramanujantau(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ramanujantau (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1382ramanujantau(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1382ramanujantau(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("ramanujantau", 0);

  /* "cypari/auto_gen.pxi":24142
 *             %4 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ramanujantau(_n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 24142, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24143
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = ramanujantau(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24144
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ramanujantau(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = ramanujantau(__pyx_v__n);

  /* "cypari/auto_gen.pxi":24145
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = ramanujantau(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def random(N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 24145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24114
 *         return new_gen(_ret)
 * 
 *     def ramanujantau(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Compute the value of Ramanujan's tau function at an individual :math:`n`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.ramanujantau", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24147
 *         return new_gen(_ret)
 * 
 *     def random(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a random element in various natural sets depending on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1385random(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1384random[] = "\n        Returns a random element in various natural sets depending on the\n        argument :math:`N`.\n        \n        - :literal:`t_INT`: returns an integer\n          uniformly distributed between :math:`0` and :math:`N-1`. Omitting the argument\n          is equivalent to :literal:`random(2^31)`.\n        \n        - :literal:`t_REAL`: returns a real number in :math:`[0,1[` with the same accuracy as\n          :math:`N` (whose mantissa has the same number of significant words).\n        \n        - :literal:`t_INTMOD`: returns a random intmod for the same modulus.\n        \n        - :literal:`t_FFELT`: returns a random element in the same finite field.\n        \n        - :literal:`t_VEC` of length :math:`2`, :math:`N = [a,b]`: returns an integer uniformly\n          distributed between :math:`a` and :math:`b`.\n        \n        - :literal:`t_VEC` generated by :literal:`ellinit` over a finite field :math:`k`\n          (coefficients are :literal:`t_INTMOD`\302\240s modulo a prime or :literal:`t_FFELT`\302\240s): returns a\n          \"random\" :math:`k`-rational :emphasis:`affine` point on the curve. More precisely\n          if the curve has a single point (at infinity!) we return it; otherwise\n          we return an affine point by drawing an abscissa uniformly at\n          random until :literal:`ellordinate` succeeds. Note that this is definitely not a\n          uniform distribution over :math:`E(k)`, but it should be good enough for\n          applications.\n        \n        - :literal:`t_POL` return a random polynomial of degree at most the degree of :math:`N`.\n          The coefficients are drawn by applying :literal:`random` to the leading\n          coefficient of :math:`N`.\n        \n        ::\n        \n            ? random(10)\n            %1 = 9\n            ? random(Mod(0,7))\n            %2 = Mod(1, 7)\n            ? a = ffgen(ffinit(3,7), 'a); random(a)\n            %3 = a^6 + 2*a^5 + a^4 + a^3 + a^2 + 2*a\n            ? E = ellinit""([3,7]*Mod(1,109)); random(E)\n            %4 = [Mod(103, 109), Mod(10, 109)]\n            ? E = ellinit([1,7]*a^0); random(E)\n            %5 = [a^6 + a^5 + 2*a^4 + 2*a^2, 2*a^6 + 2*a^4 + 2*a^3 + a^2 + 2*a]\n            ? random(Mod(1,7)*x^4)\n            %6 = Mod(5, 7)*x^4 + Mod(6, 7)*x^3 + Mod(2, 7)*x^2 + Mod(2, 7)*x + Mod(5, 7)\n            \n        \n        These variants all depend on a single internal generator, and are\n        independent from your operating system's random number generators.\n        A random seed may be obtained via :literal:`getrand`, and reset\n        using :literal:`setrand`: from a given seed, and given sequence of :literal:`random`\302\240s,\n        the exact same values will be generated. The same seed is used at each\n        startup, reseed the generator yourself if this is a problem. Note that\n        internal functions also call the random number generator; adding such a\n        function call in the middle of your code will change the numbers produced.\n        \n        :strong:`Technical note.`\n        Up to\n        version 2.4 included, the internal generator produced pseudo-random numbers\n        by means of linear congruences, which were not well distributed in arithmetic\n        progressions. We now\n        use Brent's XORGEN algorithm, based on Feedback Shift Registers, see\n        :literal:`http://wwwmaths.anu.edu.au/~brent/random.html`. The generator has period\n        :math:`2^{4096}-1`, passes the Crush battery of statistical tests of L'Ecuyer and\n        Simard, but is not suitable for cryptographic purposes: one can reconstruct\n        the state vector from a small sample of consecutive values, thus predicting\n        the entire sequence.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1385random(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("random (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1384random(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1384random(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("random", 0);

  /* "cypari/auto_gen.pxi":24216
 *         the entire sequence.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = genrand(_N)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 24216, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24217
 *         '''
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = genrand(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24218
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = genrand(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = genrand(__pyx_v__N);

  /* "cypari/auto_gen.pxi":24219
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = genrand(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def randomprime(N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 24219, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24147
 *         return new_gen(_ret)
 * 
 *     def random(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a random element in various natural sets depending on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.random", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24221
 *         return new_gen(_ret)
 * 
 *     def randomprime(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a strong pseudo prime (see :literal:`ispseudoprime`) in :math:`[2,N-1]`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1387randomprime(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1386randomprime[] = "\n        Returns a strong pseudo prime (see :literal:`ispseudoprime`) in :math:`[2,N-1]`.\n        A :literal:`t_VEC` :math:`N = [a,b]` is also allowed, with :math:`a <= b` in which case a\n        pseudo prime :math:`a <= p <= b` is returned; if no prime exists in the\n        interval, the function will run into an infinite loop. If the upper bound\n        is less than :math:`2^{64}` the pseudo prime returned is a proven prime.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1387randomprime(PyObject *__pyx_v_N, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("randomprime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1386randomprime(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_N));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1386randomprime(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_N) {
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("randomprime", 0);

  /* "cypari/auto_gen.pxi":24229
 *         is less than :math:`2^{64}` the pseudo prime returned is a proven prime.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = randomprime(_N)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 24229, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24230
 *         '''
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = randomprime(_N)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24231
 *         sig_on()
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = randomprime(_N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = randomprime(__pyx_v__N);

  /* "cypari/auto_gen.pxi":24232
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = randomprime(_N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def real(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 24232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24221
 *         return new_gen(_ret)
 * 
 *     def randomprime(N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a strong pseudo prime (see :literal:`ispseudoprime`) in :math:`[2,N-1]`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.randomprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24234
 *         return new_gen(_ret)
 * 
 *     def real(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real part of :math:`x`. In the case where :math:`x` is a quadratic number, this is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1389real(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1388real[] = "\n        Real part of :math:`x`. In the case where :math:`x` is a quadratic number, this is the\n        coefficient of :math:`1` in the \"canonical\" integral basis :math:`(1,\\omega)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1389real(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("real (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1388real(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1388real(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("real", 0);

  /* "cypari/auto_gen.pxi":24239
 *         coefficient of :math:`1` in the "canonical" integral basis :math:`(1,\omega)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = greal(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 24239, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24240
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = greal(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24241
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = greal(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = greal(__pyx_v__x);

  /* "cypari/auto_gen.pxi":24242
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = greal(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def removeprimes(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 24242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24234
 *         return new_gen(_ret)
 * 
 *     def real(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Real part of :math:`x`. In the case where :math:`x` is a quadratic number, this is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.real", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24244
 *         return new_gen(_ret)
 * 
 *     def removeprimes(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the primes listed in :math:`x` from
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1391removeprimes(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1390removeprimes[] = "\n        Removes the primes listed in :math:`x` from\n        the prime number table. In particular :literal:`removeprimes(addprimes())` empties\n        the extra prime table. :math:`x` can also be a single integer. List the current\n        extra primes if :math:`x` is omitted.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1391removeprimes(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("removeprimes (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1390removeprimes(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1390removeprimes(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("removeprimes", 0);

  /* "cypari/auto_gen.pxi":24251
 *         extra primes if :math:`x` is omitted.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = removeprimes(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 24251, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24252
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = removeprimes(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24253
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = removeprimes(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = removeprimes(__pyx_v__x);

  /* "cypari/auto_gen.pxi":24254
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = removeprimes(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfalgtobasis(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 24254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24244
 *         return new_gen(_ret)
 * 
 *     def removeprimes(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Removes the primes listed in :math:`x` from
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.removeprimes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24256
 *         return new_gen(_ret)
 * 
 *     def rnfalgtobasis(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expresses :math:`x` on the relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1393rnfalgtobasis(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1392rnfalgtobasis[] = "\n        Expresses :math:`x` on the relative\n        integral basis. Here, :math:`rnf` is a relative number field extension :math:`L/K`\n        as output by :literal:`rnfinit`, and :math:`x` an element of :math:`L` in absolute form, i.e.\n        expressed as a polynomial or polmod with polmod coefficients, :emphasis:`not` on\n        the relative integral basis.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1393rnfalgtobasis(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfalgtobasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1392rnfalgtobasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1392rnfalgtobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfalgtobasis", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24264
 *         the relative integral basis.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24265
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24265, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24266
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24267
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24268
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfalgtobasis(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24269
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfalgtobasis(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfbasis(bnf, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24256
 *         return new_gen(_ret)
 * 
 *     def rnfalgtobasis(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Expresses :math:`x` on the relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfalgtobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24271
 *         return new_gen(_ret)
 * 
 *     def rnfbasis(bnf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` the field represented by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1395rnfbasis(PyObject *__pyx_v_bnf, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1394rnfbasis[] = "\n        Let :math:`K` the field represented by\n        :emphasis:`bnf`, as output by :literal:`bnfinit`. :math:`M` is a projective :math:`\\mathbb{Z}_K`-module\n        of rank :math:`n` (:math:`M\\otimes K` is an :math:`n`-dimensional :math:`K`-vector space), given by a\n        pseudo-basis of size :math:`n`. The routine returns either a true :math:`\\mathbb{Z}_K`-basis of\n        :math:`M` (of size :math:`n`) if it exists, or an :math:`n+1`-element generating set of :math:`M` if\n        not.\n        \n        It is allowed to use a monic irreducible polynomial :math:`P` in :math:`K[X]` instead of\n        :math:`M`, in which case, :math:`M` is defined as the ring of integers of :math:`K[X]/(P)`,\n        viewed as a :math:`\\mathbb{Z}_K`-module.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1395rnfbasis(PyObject *__pyx_v_bnf, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1394rnfbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1394rnfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_M) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfbasis", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_gen.pxi":24284
 *         viewed as a :math:`\mathbb{Z}_K`-module.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24285
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24285, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24286
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfbasis(_bnf, _M)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24287
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfbasis(_bnf, _M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24288
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfbasis(_bnf, _M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfbasis(__pyx_v__bnf, __pyx_v__M);

  /* "cypari/auto_gen.pxi":24289
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfbasis(_bnf, _M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfbasistoalg(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24271
 *         return new_gen(_ret)
 * 
 *     def rnfbasis(bnf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` the field represented by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24291
 *         return new_gen(_ret)
 * 
 *     def rnfbasistoalg(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the representation of :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1397rnfbasistoalg(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1396rnfbasistoalg[] = "\n        Computes the representation of :math:`x`\n        as a polmod with polmods coefficients. Here, :math:`rnf` is a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit`, and :math:`x` an element of\n        :math:`L` expressed on the relative integral basis.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1397rnfbasistoalg(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfbasistoalg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1396rnfbasistoalg(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1396rnfbasistoalg(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfbasistoalg", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24298
 *         :math:`L` expressed on the relative integral basis.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24299
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24299, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24300
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24301
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24302
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfbasistoalg(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24303
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfbasistoalg(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfcharpoly(nf, T, a, var=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24291
 *         return new_gen(_ret)
 * 
 *     def rnfbasistoalg(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the representation of :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfbasistoalg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24305
 *         return new_gen(_ret)
 * 
 *     def rnfcharpoly(nf, T, a, var=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Characteristic polynomial of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1399rnfcharpoly(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1398rnfcharpoly[] = "\n        Characteristic polynomial of\n        :math:`a` over :math:`nf`, where :math:`a` belongs to the algebra defined by :math:`T` over\n        :math:`nf`, i.e.\302\240:math:`nf[X]/(T)`. Returns a polynomial in variable :math:`v`\n        (:math:`x` by default).\n        \n        ::\n        \n            ? nf = nfinit(y^2+1);\n            ? rnfcharpoly(nf, x^2+y*x+1, x+y)\n            %2 = x^2 + Mod(-y, y^2 + 1)*x + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1399rnfcharpoly(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_var = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfcharpoly (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_a,&__pyx_n_s_var,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_T)) != 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_a)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfcharpoly", 0, 2, 3, 1); __PYX_ERR(10, 24305, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_var);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfcharpoly") < 0)) __PYX_ERR(10, 24305, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_T = values[0];
    __pyx_v_a = values[1];
    __pyx_v_var = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfcharpoly", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24305, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1398rnfcharpoly(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_T, __pyx_v_a, __pyx_v_var);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1398rnfcharpoly(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T, PyObject *__pyx_v_a, PyObject *__pyx_v_var) {
  long __pyx_v__var;
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  long __pyx_t_4;
  int __pyx_t_5;
  GEN __pyx_t_6;
  __Pyx_RefNannySetupContext("rnfcharpoly", 0);
  __Pyx_INCREF(__pyx_v_T);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":24318
 *             %2 = x^2 + Mod(-y, y^2 + 1)*x + 1
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         cdef long _var = -1
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24319
 *         '''
 *         T = objtogen(T)
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         cdef long _var = -1
 *         if var is not None:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24320
 *         T = objtogen(T)
 *         a = objtogen(a)
 *         cdef long _var = -1             # <<<<<<<<<<<<<<
 *         if var is not None:
 *             _var = get_var(var)
 */
  __pyx_v__var = -1L;

  /* "cypari/auto_gen.pxi":24321
 *         a = objtogen(a)
 *         cdef long _var = -1
 *         if var is not None:             # <<<<<<<<<<<<<<
 *             _var = get_var(var)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v_var != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/auto_gen.pxi":24322
 *         cdef long _var = -1
 *         if var is not None:
 *             _var = get_var(var)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_4 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_var); if (unlikely(__pyx_t_4 == ((long)-2L))) __PYX_ERR(10, 24322, __pyx_L1_error)
    __pyx_v__var = __pyx_t_4;

    /* "cypari/auto_gen.pxi":24321
 *         a = objtogen(a)
 *         cdef long _var = -1
 *         if var is not None:             # <<<<<<<<<<<<<<
 *             _var = get_var(var)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":24323
 *         if var is not None:
 *             _var = get_var(var)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(10, 24323, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24324
 *             _var = get_var(var)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_6;

  /* "cypari/auto_gen.pxi":24325
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_6;

  /* "cypari/auto_gen.pxi":24326
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)
 *         return new_gen(_ret)
 */
  __pyx_t_6 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_6;

  /* "cypari/auto_gen.pxi":24327
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfcharpoly(__pyx_v__nf, __pyx_v__T, __pyx_v__a, __pyx_v__var);

  /* "cypari/auto_gen.pxi":24328
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfcharpoly(_nf, _T, _a, _var)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfconductor(bnf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24305
 *         return new_gen(_ret)
 * 
 *     def rnfcharpoly(nf, T, a, var=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Characteristic polynomial of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfcharpoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24330
 *         return new_gen(_ret)
 * 
 *     def rnfconductor(bnf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`bnf` structure attached to a number field :math:`K`, as produced
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1401rnfconductor(PyObject *__pyx_v_bnf, PyObject *__pyx_v_T); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1400rnfconductor[] = "\n        Given a :emphasis:`bnf` structure attached to a number field :math:`K`, as produced\n        by :literal:`bnfinit`, and :math:`T` a monic irreducible polynomial in :math:`K[x]`\n        defining an Abelian extension :math:`L = K[x]/(T)`, computes the class field\n        theory conductor of this Abelian extension. The result is a 3-component vector\n        :math:`[conductor,bnr,subgroup]`, where :emphasis:`conductor` is\n        the conductor of the extension given as a 2-component row vector\n        :math:`[f_0,f_ oo ]`, :emphasis:`bnr` is the attached :literal:`bnr` structure\n        and :emphasis:`subgroup` is a matrix in HNF defining the subgroup of the ray class\n        group on the ray class group generators :literal:`bnr.gen`.\n        \n        :strong:`Huge discriminants, helping rnfdisc.` the format :math:`[T,B]` is\n        also accepted instead of :math:`T` and computes the conductor of the extension\n        provided it factors completely over prime divisors of rational primes :math:`p < B`,\n        see :literal:`\077\077rnfinit`: the valuation of :math:`f_0` is then correct at all prime\n        ideals :math:`p` above a rational prime :math:`p < B` but may be incorrect at other\n        primes.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1401rnfconductor(PyObject *__pyx_v_bnf, PyObject *__pyx_v_T) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfconductor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1400rnfconductor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_T));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1400rnfconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_T) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfconductor", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_gen.pxi":24349
 *         primes.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24350
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24350, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24351
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfconductor(_bnf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24352
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfconductor(_bnf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24353
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfconductor(_bnf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfconductor(__pyx_v__bnf, __pyx_v__T);

  /* "cypari/auto_gen.pxi":24354
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfconductor(_bnf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfdedekind(nf, pol, pr=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24330
 *         return new_gen(_ret)
 * 
 *     def rnfconductor(bnf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`bnf` structure attached to a number field :math:`K`, as produced
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24356
 *         return new_gen(_ret)
 * 
 *     def rnfdedekind(nf, pol, pr=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`K` coded by :math:`nf` and a monic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1403rnfdedekind(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1402rnfdedekind[] = "\n        Given a number field :math:`K` coded by :math:`nf` and a monic\n        polynomial :math:`P\\in \\mathbb{Z}_K[X]`, irreducible over :math:`K` and thus defining a relative\n        extension :math:`L` of :math:`K`, applies Dedekind's criterion to the order\n        :math:`\\mathbb{Z}_K[X]/(P)`, at the prime ideal :emphasis:`pr`. It is possible to set :emphasis:`pr`\n        to a vector of prime ideals (test maximality at all primes in the vector),\n        or to omit altogether, in which case maximality at :emphasis:`all` primes is tested;\n        in this situation :emphasis:`flag` is automatically set to :math:`1`.\n        \n        The default historic behavior (:emphasis:`flag` is 0 or omitted and :emphasis:`pr` is a\n        single prime ideal) is not so useful since\n        :literal:`rnfpseudobasis` gives more information and is generally not that\n        much slower. It returns a 3-component vector :math:`[max, basis, v]`:\n        \n        - :emphasis:`basis` is a pseudo-basis of an enlarged order :math:`O` produced by\n          Dedekind's criterion, containing the original order :math:`\\mathbb{Z}_K[X]/(P)`\n          with index a power of :emphasis:`pr`. Possibly equal to the original order.\n        \n        - :emphasis:`max` is a flag equal to 1 if the enlarged order :math:`O`\n          could be proven to be :emphasis:`pr`-maximal and to 0 otherwise; it may still be\n          maximal in the latter case if :emphasis:`pr` is ramified in :math:`L`,\n        \n        - :math:`v` is the valuation at :emphasis:`pr` of the order discriminant.\n        \n        If :emphasis:`flag` is non-zero, on the other hand, we just return :math:`1` if the order\n        :math:`\\mathbb{Z}_K[X]/(P)` is :emphasis:`pr`-maximal (resp.\302\240maximal at all relevant primes, as\n        described above), and :math:`0` if not. This is much faster than the default,\n        since the enlarged order is not computed.\n        \n        ::\n        \n            ? n""f = nfinit(y^2-3); P = x^3 - 2*y;\n            ? pr3 = idealprimedec(nf,3)[1];\n            ? rnfdedekind(nf, P, pr3)\n            %3 = [1, [[1, 0, 0; 0, 1, 0; 0, 0, 1], [1, 1, 1]], 8]\n            ? rnfdedekind(nf, P, pr3, 1)\n            %4 = 1\n        \n        In this example, :literal:`pr3` is the ramified ideal above :math:`3`,\n        and the order generated by the cube roots of :math:`y` is already\n        :literal:`pr3`-maximal. The order-discriminant has valuation :math:`8`. On the other\n        hand, the order is not maximal at the prime above 2:\n        \n        ::\n        \n            ? pr2 = idealprimedec(nf,2)[1];\n            ? rnfdedekind(nf, P, pr2, 1)\n            %6 = 0\n            ? rnfdedekind(nf, P, pr2)\n            %7 = [0, [[2, 0, 0; 0, 1, 0; 0, 0, 1], [[1, 0; 0, 1], [1, 0; 0, 1],\n             [1, 1/2; 0, 1/2]]], 2]\n        \n        The enlarged order is not proven to be :literal:`pr2`-maximal yet. In fact, it\n        is; it is in fact the maximal order:\n        \n        ::\n        \n            ? B = rnfpseudobasis(nf, P)\n            %8 = [[1, 0, 0; 0, 1, 0; 0, 0, 1], [1, 1, [1, 1/2; 0, 1/2]],\n             [162, 0; 0, 162], -1]\n            ? idealval(nf,B[3], pr2)\n            %9 = 2\n        \n        It is possible to use this routine with non-monic\n        :math:`P = \\sum_{i <= n} a_i X^i \\in \\mathbb{Z}_K[X]` if :math:`flag = 1`;\n        in this case, we test maximality of Dedekind's order generated by\n        \n        .. MATH::\n        \n            1, a_n \\alpha, a_n\\alpha^2 + a_{n-1}\\alpha,...,\n            a_n\\alpha^{n-1} + a_{n-1}\\alpha^{n-2} +...+ a_1\\alpha.\n        \n        The routine will fail if :math:`P` is :math:`0` on the projective line over the residue\n        field :math:`\\mathbb{Z}_K/pr` (FIXME).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1403rnfdedekind(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_pr = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfdedekind (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_pr,&__pyx_n_s_flag,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pr);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfdedekind") < 0)) __PYX_ERR(10, 24356, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    __pyx_v_pr = values[1];
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24356, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfdedekind", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24356, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfdedekind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1402rnfdedekind(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pol, __pyx_v_pr, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1402rnfdedekind(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_pr, long __pyx_v_flag) {
  int __pyx_v__have_pr;
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("rnfdedekind", 0);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":24432
 *         field :math:`\mathbb{Z}_K/pr` (FIXME).
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24432, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24433
 *         '''
 *         pol = objtogen(pol)
 *         cdef bint _have_pr = (pr is not None)             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             pr = objtogen(pr)
 */
  __pyx_t_2 = (__pyx_v_pr != Py_None);
  __pyx_v__have_pr = __pyx_t_2;

  /* "cypari/auto_gen.pxi":24434
 *         pol = objtogen(pol)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":24435
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:
 *             pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24435, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":24434
 *         pol = objtogen(pol)
 *         cdef bint _have_pr = (pr is not None)
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             pr = objtogen(pr)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":24436
 *         if _have_pr:
 *             pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 24436, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24437
 *             pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":24438
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_4;

  /* "cypari/auto_gen.pxi":24439
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL             # <<<<<<<<<<<<<<
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 */
  __pyx_v__pr = NULL;

  /* "cypari/auto_gen.pxi":24440
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 */
  __pyx_t_2 = (__pyx_v__have_pr != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":24441
 *         cdef GEN _pr = NULL
 *         if _have_pr:
 *             _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
    __pyx_v__pr = __pyx_t_4;

    /* "cypari/auto_gen.pxi":24440
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _pr = NULL
 *         if _have_pr:             # <<<<<<<<<<<<<<
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 */
  }

  /* "cypari/auto_gen.pxi":24442
 *         if _have_pr:
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfdedekind(__pyx_v__nf, __pyx_v__pol, __pyx_v__pr, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":24443
 *             _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfdedekind(_nf, _pol, _pr, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfdet(nf, M):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24356
 *         return new_gen(_ret)
 * 
 *     def rnfdedekind(nf, pol, pr=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`K` coded by :math:`nf` and a monic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfdedekind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24445
 *         return new_gen(_ret)
 * 
 *     def rnfdet(nf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`M` over the maximal
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1405rnfdet(PyObject *__pyx_v_nf, PyObject *__pyx_v_M); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1404rnfdet[] = "\n        Given a pseudo-matrix :math:`M` over the maximal\n        order of :math:`nf`, computes its determinant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1405rnfdet(PyObject *__pyx_v_nf, PyObject *__pyx_v_M) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfdet (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1404rnfdet(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_M));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1404rnfdet(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_M) {
  GEN __pyx_v__nf;
  GEN __pyx_v__M;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfdet", 0);
  __Pyx_INCREF(__pyx_v_M);

  /* "cypari/auto_gen.pxi":24450
 *         order of :math:`nf`, computes its determinant.
 *         '''
 *         M = objtogen(M)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_M, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_M, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24451
 *         '''
 *         M = objtogen(M)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _M = (<Gen>M).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24451, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24452
 *         M = objtogen(M)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfdet(_nf, _M)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24453
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _M = (<Gen>M).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfdet(_nf, _M)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_M)->__pyx_base.g;
  __pyx_v__M = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24454
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfdet(_nf, _M)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfdet(__pyx_v__nf, __pyx_v__M);

  /* "cypari/auto_gen.pxi":24455
 *         cdef GEN _M = (<Gen>M).g
 *         cdef GEN _ret = rnfdet(_nf, _M)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfdisc(nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24445
 *         return new_gen(_ret)
 * 
 *     def rnfdet(nf, M):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a pseudo-matrix :math:`M` over the maximal
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfdet", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_M);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24457
 *         return new_gen(_ret)
 * 
 *     def rnfdisc(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1407rnfdisc(PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1406rnfdisc[] = "\n        Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output\n        by :literal:`nfinit`, and a monic irreducible polynomial :math:`T\\in K[x]` defining a\n        relative extension :math:`L = K[x]/(T)`, compute the relative discriminant of :math:`L`.\n        This is a vector :math:`[D,d]`, where :math:`D` is the relative ideal discriminant and\n        :math:`d` is the relative discriminant considered as an element of :math:`K^*/{K^*}^2`.\n        The main variable of :math:`nf` :emphasis:`must` be of lower priority than that of\n        :math:`T`, see ``priority`` (in the PARI manual).\n        \n        :strong:`Huge discriminants, helping rnfdisc.` the format :math:`[T,B]` is\n        also accepted instead of :math:`T` and computes an order which is maximal at all\n        :math:`p < B`, see :literal:`\077\077rnfinit`: the valuation of :math:`D` is then correct at all\n        prime ideals :math:`p` above a rational prime :math:`p < B` but may be incorrect\n        at other primes.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1407rnfdisc(PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfdisc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1406rnfdisc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_T));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1406rnfdisc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfdisc", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_gen.pxi":24473
 *         at other primes.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24474
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24474, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24475
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfdiscf(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24476
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfdiscf(_nf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24477
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfdiscf(_nf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfdiscf(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_gen.pxi":24478
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfdiscf(_nf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltabstorel(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24457
 *         return new_gen(_ret)
 * 
 *     def rnfdisc(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfdisc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24480
 *         return new_gen(_ret)
 * 
 *     def rnfeltabstorel(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1409rnfeltabstorel(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1408rnfeltabstorel[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be an\n        element of :math:`L` expressed as a polynomial modulo the absolute equation\n        :literal:`:emphasis:`rnf`.pol`, or in terms of the absolute :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L`\n        if :emphasis:`rnf` contains one (as in :literal:`rnfinit(nf,pol,1)`, or after\n        a call to :literal:`nfinit(rnf)`).\n        Computes :math:`x` as an element of the relative extension\n        :math:`L/K` as a polmod with polmod coefficients.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.polabs\n            %2 = x^4 + 1\n            ? rnfeltabstorel(L, Mod(x, L.polabs))\n            %3 = Mod(x, x^2 + Mod(-y, y^2 + 1))\n            ? rnfeltabstorel(L, 1/3)\n            %4 = 1/3\n            ? rnfeltabstorel(L, Mod(x, x^2-y))\n            %5 = Mod(x, x^2 + Mod(-y, y^2 + 1))\n            \n            ? rnfeltabstorel(L, [0,0,0,1]~) \\\\ Z_L not initialized yet\n             *** at top-level: rnfeltabstorel(L,[0,\n             *** ^--------------------\n             *** rnfeltabstorel: incorrect type in rnfeltabstorel, apply nfinit(rnf).\n            ? nfinit(L); \\\\ initialize now\n            ? rnfeltabstorel(L, [0,0,0,1]~)\n            %6 = Mod(Mod(y, y^2 + 1)*x, x^2 + Mod(-y, y^2 + 1))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1409rnfeltabstorel(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltabstorel (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1408rnfeltabstorel(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1408rnfeltabstorel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltabstorel", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24511
 *             %6 = Mod(Mod(y, y^2 + 1)*x, x^2 + Mod(-y, y^2 + 1))
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24512
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24512, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24513
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24514
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24515
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltabstorel(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24516
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltabstorel(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltdown(rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24480
 *         return new_gen(_ret)
 * 
 *     def rnfeltabstorel(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfeltabstorel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24518
 *         return new_gen(_ret)
 * 
 *     def rnfeltdown(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1411rnfeltdown(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1410rnfeltdown[] = "\n        :math:`rnf` being a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being an element of\n        :math:`L` expressed as a polynomial or polmod with polmod coefficients (or as a\n        :literal:`t_COL` on :literal:`nfinit(rnf).zk`), computes\n        :math:`x` as an element of :math:`K` as a :literal:`t_POLMOD` if :math:`flag = 0` and as a :literal:`t_COL`\n        otherwise. If :math:`x` is not in :math:`K`, a domain error occurs.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.pol\n            %2 = x^4 + 1\n            ? rnfeltdown(L, Mod(x^2, L.pol))\n            %3 = Mod(y, y^2 + 1)\n            ? rnfeltdown(L, Mod(x^2, L.pol), 1)\n            %4 = [0, 1]~\n            ? rnfeltdown(L, Mod(y, x^2-y))\n            %5 = Mod(y, y^2 + 1)\n            ? rnfeltdown(L, Mod(y,K.pol))\n            %6 = Mod(y, y^2 + 1)\n            ? rnfeltdown(L, Mod(x, L.pol))\n             *** at top-level: rnfeltdown(L,Mod(x,x\n             *** ^--------------------\n             *** rnfeltdown: domain error in rnfeltdown: element not in the base field\n            ? rnfeltdown(L, Mod(y, x^2-y), 1) \\\\ as a t_COL\n            %7 = [0, 1]~\n            ? rnfeltdown(L, [0,1,0,0]~) \\\\ not allowed without absolute nf struct\n             *** rnfeltdown: incorrect type in rnfeltdown (t_COL).\n            ? nfinit(L); \\\\ add absolute nf structure to L\n            ? rnfeltdown(L, [0,1,0,0]~) \\\\ now OK\n            %8 = Mod(y, y^2 + 1)\n        \n        If we had started with\n        :literal:`L = rnfinit(K, x^2-y, 1)`, then the final would have worked directly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1411rnfeltdown(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltdown (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfeltdown") < 0)) __PYX_ERR(10, 24518, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24518, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfeltdown", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24518, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfeltdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1410rnfeltdown(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1410rnfeltdown(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltdown", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24555
 *         :literal:`L = rnfinit(K, x^2-y, 1)`, then the final would have worked directly.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24555, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24556
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24556, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24557
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24558
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24559
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltdown0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":24560
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltdown0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltnorm(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24518
 *         return new_gen(_ret)
 * 
 *     def rnfeltdown(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfeltdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24562
 *         return new_gen(_ret)
 * 
 *     def rnfeltnorm(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1413rnfeltnorm(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1412rnfeltnorm[] = "\n        :math:`rnf` being a relative number field extension :math:`L/K` as output by\n        :literal:`rnfinit` and :math:`x` being an element of :math:`L`, returns the relative norm\n        :math:`N_{L/K}(x)` as an element of :math:`K`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? rnfeltnorm(L, Mod(x, L.pol))\n            %2 = Mod(x, x^2 + Mod(-y, y^2 + 1))\n            ? rnfeltnorm(L, 2)\n            %3 = 4\n            ? rnfeltnorm(L, Mod(x, x^2-y))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1413rnfeltnorm(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltnorm (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1412rnfeltnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1412rnfeltnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltnorm", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24577
 *             ? rnfeltnorm(L, Mod(x, x^2-y))
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24578
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24578, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24579
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24580
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24581
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltnorm(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24582
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltnorm(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltreltoabs(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24562
 *         return new_gen(_ret)
 * 
 *     def rnfeltnorm(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfeltnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24584
 *         return new_gen(_ret)
 * 
 *     def rnfeltreltoabs(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1415rnfeltreltoabs(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1414rnfeltreltoabs[] = "\n        :math:`rnf` being a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being an\n        element of :math:`L` expressed as a polynomial or polmod with polmod\n        coefficients, computes :math:`x` as an element of the absolute extension :math:`L/\\mathbb{Q}` as\n        a polynomial modulo the absolute equation :literal:`:emphasis:`rnf`.pol`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.pol\n            %2 = x^4 + 1\n            ? rnfeltreltoabs(L, Mod(x, L.pol))\n            %3 = Mod(x, x^4 + 1)\n            ? rnfeltreltoabs(L, Mod(y, x^2-y))\n            %4 = Mod(x^2, x^4 + 1)\n            ? rnfeltreltoabs(L, Mod(y,K.pol))\n            %5 = Mod(x^2, x^4 + 1)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1415rnfeltreltoabs(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltreltoabs (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1414rnfeltreltoabs(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1414rnfeltreltoabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltreltoabs", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24604
 *             %5 = Mod(x^2, x^4 + 1)
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24605
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24605, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24606
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24607
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24608
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltreltoabs(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24609
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltreltoabs(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfelttrace(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24609, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24584
 *         return new_gen(_ret)
 * 
 *     def rnfeltreltoabs(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfeltreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24611
 *         return new_gen(_ret)
 * 
 *     def rnfelttrace(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1417rnfelttrace(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1416rnfelttrace[] = "\n        :math:`rnf` being a relative number field extension :math:`L/K` as output by\n        :literal:`rnfinit` and :math:`x` being an element of :math:`L`, returns the relative trace\n        :math:`Tr_{L/K}(x)` as an element of :math:`K`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? rnfelttrace(L, Mod(x, L.pol))\n            %2 = 0\n            ? rnfelttrace(L, 2)\n            %3 = 4\n            ? rnfelttrace(L, Mod(x, x^2-y))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1417rnfelttrace(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfelttrace (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1416rnfelttrace(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1416rnfelttrace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfelttrace", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24626
 *             ? rnfelttrace(L, Mod(x, x^2-y))
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24627
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24627, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24628
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24629
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24630
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfelttrace(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24631
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfelttrace(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfeltup(rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24611
 *         return new_gen(_ret)
 * 
 *     def rnfelttrace(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfelttrace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24633
 *         return new_gen(_ret)
 * 
 *     def rnfeltup(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1419rnfeltup(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1418rnfeltup[] = "\n        :math:`rnf` being a relative number field extension :math:`L/K` as output by\n        :literal:`rnfinit` and :math:`x` being an element of :math:`K`, computes :math:`x` as an element of\n        the absolute extension :math:`L/\\mathbb{Q}`. As a :literal:`t_POLMOD` modulo :literal:`:emphasis:`rnf`.pol`\n        if :math:`flag = 0` and as a :literal:`t_COL` on the absolute field integer basis if\n        :math:`flag = 1`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); L = rnfinit(K, x^2-y);\n            ? L.pol\n            %2 = x^4 + 1\n            ? rnfeltup(L, Mod(y, K.pol))\n            %3 = Mod(x^2, x^4 + 1)\n            ? rnfeltup(L, y)\n            %4 = Mod(x^2, x^4 + 1)\n            ? rnfeltup(L, [1,2]~) \\\\ in terms of K.zk\n            %5 = Mod(2*x^2 + 1, x^4 + 1)\n            ? rnfeltup(L, y, 1) \\\\ in terms of nfinit(L).zk\n            %6 = [0, 1, 0, 0]~\n            ? rnfeltup(L, [1,2]~, 1)\n            %7 = [1, 2, 0, 0]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1419rnfeltup(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfeltup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfeltup") < 0)) __PYX_ERR(10, 24633, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24633, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfeltup", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24633, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfeltup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1418rnfeltup(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1418rnfeltup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfeltup", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24657
 *             %7 = [1, 2, 0, 0]~
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24657, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24658
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24658, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24659
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24660
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24661
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfeltup0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":24662
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfeltup0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfequation(nf, pol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24633
 *         return new_gen(_ret)
 * 
 *     def rnfeltup(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number field extension :math:`L/K` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfeltup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24664
 *         return new_gen(_ret)
 * 
 *     def rnfequation(nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1421rnfequation(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1420rnfequation[] = "\n        Given a number field\n        :math:`nf` as output by :literal:`nfinit` (or simply a polynomial) and a\n        polynomial :emphasis:`pol` with coefficients in :math:`nf` defining a relative\n        extension :math:`L` of :math:`nf`, computes an absolute equation of :math:`L` over\n        :math:`\\mathbb{Q}`.\n        \n        The main variable of :math:`nf` :emphasis:`must` be of lower priority than that\n        of :emphasis:`pol` (see ``priority`` (in the PARI manual)). Note that for efficiency, this does\n        not check whether the relative equation is irreducible over :math:`nf`, but\n        only if it is squarefree. If it is reducible but squarefree, the result will\n        be the absolute equation of the \303\251tale algebra defined by :emphasis:`pol`. If\n        :emphasis:`pol` is not squarefree, raise an :literal:`e_DOMAIN` exception.\n        \n        ::\n        \n            ? rnfequation(y^2+1, x^2 - y)\n            %1 = x^4 + 1\n            ? T = y^3-2; rnfequation(nfinit(T), (x^3-2)/(x-Mod(y,T)))\n            %2 = x^6 + 108 \\\\ Galois closure of Q(2^(1/3))\n        \n        If :math:`flag` is non-zero, outputs a 3-component row vector :math:`[z,a,k]`, where\n        \n        - :math:`z` is the absolute equation of :math:`L` over :math:`\\mathbb{Q}`, as in the default\n          behavior,\n        \n        - :math:`a` expresses as a :literal:`t_POLMOD` modulo :math:`z` a root :math:`\\alpha` of the\n          polynomial defining the base field :math:`nf`,\n        \n        - :math:`k` is a small integer such that :math:`\\theta = \\beta+k\\alpha`\n          is a root of :math:`z`, where :math:`\\beta` is a root of :math:`pol`. It is guaranteed\n          that :math:`k = 0` whenever :math:`\\mathbb{Q} (\\beta) = L`.\n        \n        ::\n        \n            ? T = y^3-2; pol = x^2 +x*y + y^2;\n            ? [z,a,k] = rnfequation(T, pol, 1);\n            ? z\n            %3 = x^6 + 108\n            ? subst(T, y, a)\n           "" %4 = 0\n            ? alpha= Mod(y, T);\n            ? beta = Mod(x*Mod(1,T), pol);\n            ? subst(z, x, beta + k*alpha)\n            %7 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1421rnfequation(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfequation (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_flag,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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfequation") < 0)) __PYX_ERR(10, 24664, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24664, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfequation", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24664, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfequation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1420rnfequation(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1420rnfequation(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfequation", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_gen.pxi":24711
 *             %7 = 0
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24712
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24712, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24713
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24714
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24715
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfequation0(__pyx_v__nf, __pyx_v__pol, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":24716
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfequation0(_nf, _pol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfhnfbasis(bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24664
 *         return new_gen(_ret)
 * 
 *     def rnfequation(nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfequation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24718
 *         return new_gen(_ret)
 * 
 *     def rnfhnfbasis(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1423rnfhnfbasis(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1422rnfhnfbasis[] = "\n        Given :math:`bnf` as output by\n        :literal:`bnfinit`, and either a polynomial :math:`x` with coefficients in :math:`bnf`\n        defining a relative extension :math:`L` of :math:`bnf`, or a pseudo-basis :math:`x` of\n        such an extension, gives either a true :math:`bnf`-basis of :math:`L` in upper\n        triangular Hermite normal form, if it exists, and returns :math:`0` otherwise.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1423rnfhnfbasis(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfhnfbasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1422rnfhnfbasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1422rnfhnfbasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfhnfbasis", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24726
 *         triangular Hermite normal form, if it exists, and returns :math:`0` otherwise.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24727
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24727, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24728
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24729
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24730
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfhnfbasis(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24731
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfhnfbasis(_bnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealabstorel(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24718
 *         return new_gen(_ret)
 * 
 *     def rnfhnfbasis(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfhnfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24733
 *         return new_gen(_ret)
 * 
 *     def rnfidealabstorel(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1425rnfidealabstorel(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1424rnfidealabstorel[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be an\n        ideal of the absolute extension :math:`L/\\mathbb{Q}`. Returns the relative pseudo-matrix in\n        HNF giving the ideal :math:`x` considered as an ideal of the relative extension\n        :math:`L/K`, i.e.\302\240as a :math:`\\mathbb{Z}_K`-module.\n        \n        Let :literal:`Labs` be an (absolute) :literal:`nf` structure attached to :math:`L`,\n        obtained via :literal:`Labs = nfinit(rnf))`. Then :literal:`rnf` \"knows\" about\n        :literal:`Labs` and :math:`x` may be given in any format\n        attached to :literal:`Labs`, e.g. a prime ideal or an ideal in HNF wrt.\n        :literal:`Labs.zk`:\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y); Labs = nfinit(rnf);\n            ? m = idealhnf(Labs, 17, x^3+2); \\\\ some ideal in HNF wrt. Labs.zk\n            ? B = rnfidealabstorel(rnf, m)\n            %3 = [[1, 8; 0, 1], [[17, 4; 0, 1], 1]] \\\\ pseudo-basis for m as Z_K-module\n            ? A = rnfidealreltoabs(rnf, B)\n            %4 = [17, x^2 + 4, x + 8, x^3 + 8*x^2] \\\\ Z-basis for m in Q[x]/(rnf.polabs)\n            ? mathnf(matalgtobasis(Labs, A)) == m\n            %5 = 1\n        \n        If on the other hand, we do not have a :literal:`Labs` at hand,\n        because it would be too expensive to compute, but we nevertheless have\n        a :math:`\\mathbb{Z}`-basis for :math:`x`, then we can use the function with this basis as\n        argument. The entries of :math:`x` may be given either modulo :literal:`rnf.polabs`\n        (absolute form, possibly lifted) or modulo :literal:`rnf.pol` (relative form as\n        :literal:`t_POLMOD`\302\240s):\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y);\n            ? rnfidealabstorel(rnf, [17, x^2 + 4, x + 8, x^3 + 8*x^2])\n            %2 = [[1, 8; 0, 1], [[17, 4; 0, 1],"" 1]]\n            ? rnfidealabstorel(rnf, Mod([17, y + 4, x + 8, y*x + 8*y], x^2-y))\n            %3 = [[1, 8; 0, 1], [[17, 4; 0, 1], 1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1425rnfidealabstorel(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealabstorel (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1424rnfidealabstorel(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1424rnfidealabstorel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealabstorel", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24773
 *             %3 = [[1, 8; 0, 1], [[17, 4; 0, 1], 1]]
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24774
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24774, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24775
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24776
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24777
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealabstorel(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24778
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealabstorel(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealdown(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24778, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24733
 *         return new_gen(_ret)
 * 
 *     def rnfidealabstorel(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealabstorel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24780
 *         return new_gen(_ret)
 * 
 *     def rnfidealdown(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1427rnfidealdown(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1426rnfidealdown[] = "\n        Let :math:`rnf` be a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit`, and :math:`x` an ideal of\n        :math:`L`, given either in relative form or by a :math:`\\mathbb{Z}`-basis of elements of :math:`L`\n        (see ``rnfidealabstorel`` (in the PARI manual)). This function returns the ideal of :math:`K`\n        below :math:`x`, i.e.\302\240the intersection of :math:`x` with :math:`K`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1427rnfidealdown(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealdown (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1426rnfidealdown(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1426rnfidealdown(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealdown", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24788
 *         below :math:`x`, i.e.the intersection of :math:`x` with :math:`K`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24788, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24789
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24789, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24790
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24791
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24792
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealdown(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24793
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealdown(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealfactor(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24793, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24780
 *         return new_gen(_ret)
 * 
 *     def rnfidealdown(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24795
 *         return new_gen(_ret)
 * 
 *     def rnfidealfactor(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor into prime ideal powers the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1429rnfidealfactor(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1428rnfidealfactor[] = "\n        Factor into prime ideal powers the\n        ideal :math:`x` in the attached absolute number field :math:`L = nfinit (rnf)`.\n        The output format is similar to the :literal:`factor` function, and the prime\n        ideals are represented in the form output by the :literal:`idealprimedec`\n        function for :math:`L`.\n        \n        ::\n        \n            ? rnf = rnfinit(nfinit(y^2+1), x^2-y+1);\n            ? rnfidealfactor(rnf, y+1) \\\\ P_2^2\n            %2 =\n            [[2, [0,0,1,0]~, 4, 1, [0,0,0,2;0,0,-2,0;-1,-1,0,0;1,-1,0,0]] 2]\n            \n            ? rnfidealfactor(rnf, x) \\\\ P_2\n            %3 =\n            [[2, [0,0,1,0]~, 4, 1, [0,0,0,2;0,0,-2,0;-1,-1,0,0;1,-1,0,0]] 1]\n            \n            ? L = nfinit(rnf);\n            ? id = idealhnf(L, idealhnf(L, 25, (x+1)^2));\n            ? idealfactor(L, id) == rnfidealfactor(rnf, id)\n            %6 = 1\n        \n        Note that ideals of the base field :math:`K` must be explicitly\n        lifted to :math:`L` via :literal:`rnfidealup` before they can be factored.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1429rnfidealfactor(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealfactor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1428rnfidealfactor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1428rnfidealfactor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealfactor", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24822
 *         lifted to :math:`L` via :literal:`rnfidealup` before they can be factored.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24823
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24823, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24824
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24825
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24826
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealfactor(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24827
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealfactor(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealhnf(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24795
 *         return new_gen(_ret)
 * 
 *     def rnfidealfactor(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Factor into prime ideal powers the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealfactor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24829
 *         return new_gen(_ret)
 * 
 *     def rnfidealhnf(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1431rnfidealhnf(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1430rnfidealhnf[] = "\n        :math:`rnf` being a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being a relative\n        ideal (which can be, as in the absolute case, of many different types,\n        including of course elements), computes the HNF pseudo-matrix attached to\n        :math:`x`, viewed as a :math:`\\mathbb{Z}_K`-module.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1431rnfidealhnf(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealhnf (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1430rnfidealhnf(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1430rnfidealhnf(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealhnf", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24837
 *         :math:`x`, viewed as a :math:`\mathbb{Z}_K`-module.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24838
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24838, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24839
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24840
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24841
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealhnf(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24842
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealhnf(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealmul(rnf, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24829
 *         return new_gen(_ret)
 * 
 *     def rnfidealhnf(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealhnf", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24844
 *         return new_gen(_ret)
 * 
 *     def rnfidealmul(rnf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1433rnfidealmul(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1432rnfidealmul[] = "\n        :math:`rnf` being a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` and :math:`y` being ideals\n        of the relative extension :math:`L/K` given by pseudo-matrices, outputs the ideal\n        product, again as a relative ideal.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1433rnfidealmul(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealmul (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnfidealmul", 1, 2, 2, 1); __PYX_ERR(10, 24844, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealmul") < 0)) __PYX_ERR(10, 24844, __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_x = values[0];
    __pyx_v_y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealmul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24844, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1432rnfidealmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), __pyx_v_x, __pyx_v_y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1432rnfidealmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealmul", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":24851
 *         product, again as a relative ideal.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24851, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24852
 *         '''
 *         x = objtogen(x)
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24853
 *         x = objtogen(x)
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24853, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24854
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24855
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24856
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24857
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealmul(__pyx_v__rnf, __pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":24858
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = rnfidealmul(_rnf, _x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealnormabs(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24858, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24844
 *         return new_gen(_ret)
 * 
 *     def rnfidealmul(rnf, x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24860
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormabs(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1435rnfidealnormabs(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1434rnfidealnormabs[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be a\n        relative ideal (which can be, as in the absolute case, of many different\n        types, including of course elements). This function computes the norm of the\n        :math:`x` considered as an ideal of the absolute extension :math:`L/\\mathbb{Q}`. This is\n        identical to\n        \n        ::\n        \n             idealnorm(rnf, rnfidealnormrel(rnf,x))\n        \n        but faster.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1435rnfidealnormabs(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealnormabs (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1434rnfidealnormabs(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1434rnfidealnormabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealnormabs", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24875
 *         but faster.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24875, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24876
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24876, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24877
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24878
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24879
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealnormabs(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24880
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormabs(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealnormrel(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24880, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24860
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormabs(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealnormabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24882
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormrel(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1437rnfidealnormrel(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1436rnfidealnormrel[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be a\n        relative ideal (which can be, as in the absolute case, of many different\n        types, including of course elements). This function computes the relative\n        norm of :math:`x` as an ideal of :math:`K` in HNF.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1437rnfidealnormrel(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealnormrel (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1436rnfidealnormrel(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1436rnfidealnormrel(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealnormrel", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24890
 *         norm of :math:`x` as an ideal of :math:`K` in HNF.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24890, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24891
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24891, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24892
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24893
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24894
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealnormrel(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24895
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealnormrel(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealprimedec(rnf, pr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24882
 *         return new_gen(_ret)
 * 
 *     def rnfidealnormrel(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealnormrel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24897
 *         return new_gen(_ret)
 * 
 *     def rnfidealprimedec(rnf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1439rnfidealprimedec(PyObject *__pyx_v_rnf, PyObject *__pyx_v_pr); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1438rnfidealprimedec[] = "\n        Let :emphasis:`rnf` be a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit`, and :emphasis:`pr` a maximal\n        ideal of :math:`K` (:emphasis:`prid`), this function completes the :emphasis:`rnf`\n        with a :emphasis:`nf` structure attached to :math:`L` (see ``rnfinit`` (in the PARI manual))\n        and returns the prime ideal decomposition of :emphasis:`pr` in :math:`L/K`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^3+y+1);\n            ? P = idealprimedec(K, 2)[1];\n            ? S = rnfidealprimedec(rnf, P);\n            ? #S\n            %4 = 1\n        \n        The argument :emphasis:`pr` is also allowed to be a prime number :math:`p`, in which\n        case the function returns a pair of vectors :literal:`[SK,SL]`, where :literal:`SK` contains\n        the primes of :math:`K` above :math:`p` and :literal:`SL`:math:`[i]` is the vector of primes of :math:`L`\n        above :literal:`SK`:math:`[i]`.\n        \n        ::\n        \n            ? [SK,SL] = rnfidealprimedec(rnf, 5);\n            ? [#SK, vector(#SL,i,#SL[i])]\n            %6 = [2, [2, 2]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1439rnfidealprimedec(PyObject *__pyx_v_rnf, PyObject *__pyx_v_pr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealprimedec (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1438rnfidealprimedec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_pr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1438rnfidealprimedec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_pr) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__pr;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealprimedec", 0);
  __Pyx_INCREF(__pyx_v_pr);

  /* "cypari/auto_gen.pxi":24924
 *             %6 = [2, [2, 2]]
 *         '''
 *         pr = objtogen(pr)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pr, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24924, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pr, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24925
 *         '''
 *         pr = objtogen(pr)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _pr = (<Gen>pr).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24925, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24926
 *         pr = objtogen(pr)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24927
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _pr = (<Gen>pr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pr)->__pyx_base.g;
  __pyx_v__pr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24928
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealprimedec(__pyx_v__rnf, __pyx_v__pr);

  /* "cypari/auto_gen.pxi":24929
 *         cdef GEN _pr = (<Gen>pr).g
 *         cdef GEN _ret = rnfidealprimedec(_rnf, _pr)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealreltoabs(rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24897
 *         return new_gen(_ret)
 * 
 *     def rnfidealprimedec(rnf, pr):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealprimedec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24931
 *         return new_gen(_ret)
 * 
 *     def rnfidealreltoabs(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1441rnfidealreltoabs(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1440rnfidealreltoabs[] = "\n        Let :math:`rnf` be a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be a\n        relative ideal, given as a :math:`\\mathbb{Z}_K`-module by a pseudo matrix :math:`[A,I]`.\n        This function returns the ideal :math:`x` as an absolute ideal of :math:`L/\\mathbb{Q}`.\n        If :math:`flag = 0`, the result is given by a vector of :literal:`t_POLMOD`\302\240s modulo\n        :literal:`rnf.pol` forming a :math:`\\mathbb{Z}`-basis; if :math:`flag = 1`, it is given in HNF in terms\n        of the fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L`, see ``rnfinit`` (in the PARI manual).\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y);\n            ? P = idealprimedec(K,2)[1];\n            ? P = rnfidealup(rnf, P)\n            %3 = [2, x^2 + 1, 2*x, x^3 + x]\n            ? Prel = rnfidealhnf(rnf, P)\n            %4 = [[1, 0; 0, 1], [[2, 1; 0, 1], [2, 1; 0, 1]]]\n            ? rnfidealreltoabs(rnf,Prel)\n            %5 = [2, x^2 + 1, 2*x, x^3 + x]\n            ? rnfidealreltoabs(rnf,Prel,1)\n            %6 =\n            [2 1 0 0]\n            \n            [0 1 0 0]\n            \n            [0 0 2 1]\n            \n            [0 0 0 1]\n        \n        The reason why we do not return by default (:math:`flag = 0`) the customary HNF in\n        terms of a fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L` is precisely because\n        a :emphasis:`rnf` does not contain such a basis by default. Completing the\n        structure so that it contains a :emphasis:`nf` structure for :math:`L` is polynomial\n        time but costly when the absolute degree is large, thus it is not done by\n        default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1441rnfidealreltoabs(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealreltoabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealreltoabs") < 0)) __PYX_ERR(10, 24931, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24931, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealreltoabs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24931, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1440rnfidealreltoabs(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1440rnfidealreltoabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealreltoabs", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24968
 *         default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24969
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24969, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24970
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24971
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24972
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealreltoabs0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":24973
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealreltoabs0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealtwoelt(rnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24931
 *         return new_gen(_ret)
 * 
 *     def rnfidealreltoabs(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24975
 *         return new_gen(_ret)
 * 
 *     def rnfidealtwoelt(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1443rnfidealtwoelt(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1442rnfidealtwoelt[] = "\n        :math:`rnf` being a relative\n        number field extension :math:`L/K` as output by :literal:`rnfinit` and :math:`x` being an\n        ideal of the relative extension :math:`L/K` given by a pseudo-matrix, gives a\n        vector of two generators of :math:`x` over :math:`\\mathbb{Z}_L` expressed as polmods with polmod\n        coefficients.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1443rnfidealtwoelt(PyObject *__pyx_v_rnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealtwoelt (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1442rnfidealtwoelt(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1442rnfidealtwoelt(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealtwoelt", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":24983
 *         coefficients.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":24984
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 24984, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":24985
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24986
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":24987
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealtwoelement(__pyx_v__rnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":24988
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealtwoelement(_rnf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfidealup(rnf, x, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 24988, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24975
 *         return new_gen(_ret)
 * 
 *     def rnfidealtwoelt(rnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`rnf` being a relative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealtwoelt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":24990
 *         return new_gen(_ret)
 * 
 *     def rnfidealup(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1445rnfidealup(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1444rnfidealup[] = "\n        Let :math:`rnf` be a relative number\n        field extension :math:`L/K` as output by :literal:`rnfinit` and let :math:`x` be an ideal of\n        :math:`K`. This function returns the ideal :math:`x\\mathbb{Z}_L` as an absolute ideal of :math:`L/\\mathbb{Q}`,\n        in the form of a :math:`\\mathbb{Z}`-basis. If :math:`flag = 0`, the result is given by a vector of\n        polynomials (modulo :literal:`rnf.pol`); if :math:`flag = 1`, it is given in HNF in terms\n        of the fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L`, see ``rnfinit`` (in the PARI manual).\n        \n        ::\n        \n            ? K = nfinit(y^2+1); rnf = rnfinit(K, x^2-y);\n            ? P = idealprimedec(K,2)[1];\n            ? rnfidealup(rnf, P)\n            %3 = [2, x^2 + 1, 2*x, x^3 + x]\n            ? rnfidealup(rnf, P,1)\n            %4 =\n            [2 1 0 0]\n            \n            [0 1 0 0]\n            \n            [0 0 2 1]\n            \n            [0 0 0 1]\n        \n        The reason why we do not return by default (:math:`flag = 0`) the customary HNF in\n        terms of a fixed :math:`\\mathbb{Z}`-basis for :math:`\\mathbb{Z}_L` is precisely because\n        a :emphasis:`rnf` does not contain such a basis by default. Completing the\n        structure so that it contains a :emphasis:`nf` structure for :math:`L` is polynomial\n        time but costly when the absolute degree is large, thus it is not done by\n        default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1445rnfidealup(PyObject *__pyx_v_rnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfidealup (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfidealup") < 0)) __PYX_ERR(10, 24990, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 24990, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfidealup", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 24990, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1444rnfidealup(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1444rnfidealup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__rnf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfidealup", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":25022
 *         default. Note that setting :math:`flag = 1` will complete the :emphasis:`rnf`.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25023
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25023, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25024
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25025
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25026
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfidealup0(__pyx_v__rnf, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25027
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfidealup0(_rnf, _x, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfinit(nf, T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":24990
 *         return new_gen(_ret)
 * 
 *     def rnfidealup(rnf, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`rnf` be a relative number
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfidealup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25029
 *         return new_gen(_ret)
 * 
 *     def rnfinit(nf, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1447rnfinit(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1446rnfinit[] = "\n        Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by\n        :literal:`nfinit`, and a monic irreducible polynomial :math:`T` in :math:`K[x]` defining a\n        relative extension :math:`L = K[x]/(T)`, this computes data to work in :math:`L/K`\n        The main variable of :math:`T` must be of higher priority\n        (see ``priority`` (in the PARI manual)) than that of :math:`nf`, and the coefficients of\n        :math:`T` must be in :math:`K`.\n        \n        The result is a row vector, whose components are technical.\n        We let :math:`m = [K:\\mathbb{Q}]` the degree of the base field, :math:`n = [L:K]` the relative\n        degree, :math:`r_1` and :math:`r_2` the number of real and complex places of :math:`K`. Access\n        to this information via :emphasis:`member functions` is preferred since the\n        specific data organization specified below will change in the future.\n        \n        If :math:`flag = 1`, add an :emphasis:`nf` structure attached to :math:`L` to :emphasis:`rnf`.\n        This is likely to be very expensive if the absolute degree :math:`mn` is large,\n        but fixes an integer basis for :math:`\\mathbb{Z}_L` as a :math:`\\mathbb{Z}`-module and allows to input\n        and output elements of :math:`L` in absolute form: as :literal:`t_COL` for elements,\n        as :literal:`t_MAT` in HNF for ideals, as :literal:`prid` for prime ideals. Without such\n        a call, elements of :math:`L` are represented as :literal:`t_POLMOD`, etc.\n        Note that a subsequent :literal:`nfinit`:math:`(rnf)` will also explicitly\n        add such a component, and so will the following functions :literal:`rnfidealmul`,\n        :literal:`rnfidealtwoelt`, :literal:`rnfidealprimedec`, :literal:`rnfidealup` (with flag 1)\n        and :literal:`rnfidealreltoabs` (with flag 1). The absolute :emphasis:`nf` structure\n        attached to :math:`L` can be recovered using :literal:`nfinit(rnf)`.\n        \n   ""     :math:`rnf[1]`(:literal:`rnf.pol`) contains the relative polynomial :math:`T`.\n        \n        :math:`rnf[2]` contains the integer basis :math:`[A,d]` of :math:`K`, as\n        (integral) elements of :math:`L/\\mathbb{Q}`. More precisely, :math:`A` is a vector of\n        polynomial with integer coefficients, :math:`d` is a denominator, and the integer\n        basis is given by :math:`A/d`.\n        \n        :math:`rnf[3]` (:literal:`rnf.disc`) is a two-component row vector\n        :math:`[d (L/K),s]` where :math:`d (L/K)` is the relative ideal discriminant\n        of :math:`L/K` and :math:`s` is the discriminant of :math:`L/K` viewed as an element of\n        :math:`K^*/(K^*)^2`, in other words it is the output of :literal:`rnfdisc`.\n        \n        :math:`rnf[4]`(:literal:`rnf.index`) is the ideal index :math:`f`, i.e.\302\240such\n        that :math:`d(T)\\mathbb{Z}_K = f^2d (L/K)`.\n        \n        :math:`rnf[5]` is currently unused.\n        \n        :math:`rnf[6]` is currently unused.\n        \n        :math:`rnf[7]` (:literal:`rnf.zk`) is the pseudo-basis :math:`(A,I)` for the maximal\n        order :math:`\\mathbb{Z}_L` as a :math:`\\mathbb{Z}_K`-module: :math:`A` is the relative integral pseudo basis\n        expressed as polynomials (in the variable of :math:`T`) with polmod coefficients\n        in :math:`nf`, and the second component :math:`I` is the ideal list of the\n        pseudobasis in HNF.\n        \n        :math:`rnf[8]` is the inverse matrix of the integral basis matrix, with\n        coefficients polmods in :math:`nf`.\n        \n        :math:`rnf[9]` is currently unused.\n        \n        :math:`rnf[10]` (:literal:`rnf.nf`) is :math:`nf`.\n        \n        :math:`rnf[11]` is an extension of :literal:`rnfequation(K, T, 1)`. Namely, a\n        vector :math:`[P, a, k, K.pol, T]` describing the :emphasis:`absolute`\n        extension :math:`L/\\mathbb{Q}`: :math:`P` is an absolute equation, more conveniently obtained\n      ""  as :literal:`rnf.polabs`; :math:`a` expresses the generator :math:`\\alpha = y mod K.pol`\n        of the number field :math:`K` as an element of :math:`L`, i.e.\302\240a polynomial modulo the\n        absolute equation :math:`P`;\n        \n        :math:`k` is a small integer such that, if :math:`\\beta` is an abstract root of :math:`T`\n        and :math:`\\alpha` the generator of :math:`K` given above, then :math:`P(\\beta + k\\alpha) = 0`.\n        It is guaranteed that :math:`k = 0` if :math:`\\mathbb{Q} (\\beta) = L`.\n        \n        :strong:`Caveat.` Be careful if :math:`k != 0` when dealing simultaneously with\n        absolute and relative quantities since :math:`L = \\mathbb{Q} (\\beta + k\\alpha) =\n        K(\\alpha)`, and the generator chosen for the absolute extension is not the\n        same as for the relative one. If this happens, one can of course go on\n        working, but we advise to change the relative polynomial so that its root\n        becomes :math:`\\beta + k \\alpha`. Typical GP instructions would be\n        \n        ::\n        \n             [P,a,k] = rnfequation(K, T, 1);\n             if (k, T = subst(T, x, x - k*Mod(y, K.pol)));\n             L = rnfinit(K, T);\n        \n        :math:`rnf[12]` is by default unused and set equal to 0. This field is used\n        to store further information about the field as it becomes available (which\n        is rarely needed, hence would be too expensive to compute during the initial\n        :literal:`rnfinit` call).\n        \n        :strong:`Huge discriminants, helping rnfdisc.` When :math:`T` has a\n        discriminant which is difficult to factor, it is hard to compute\n        :math:`\\mathbb{Z}_L`. As in :literal:`nfinit`, the special input format :math:`[T,B]`\n        is also accepted, where :math:`T` is a polynomial as above and :math:`B` is\n        an integer. Instead of :math:`\\mathbb{Z}_L`, this produces an order which is maximal\n        at all primes less than :math:`""B`. The result is actually a complete and correct\n        :emphasis:`rnf` structure if all prime divisors of the relative ideal\n        discriminant divide a rational prime less than :math:`B`. In general, the order\n        may not be maximal at primes :math:`p \\| p` for :math:`p >= B` such that\n        :math:`p^2` divides the relative ideal discriminant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1447rnfinit(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_flag,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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfinit") < 0)) __PYX_ERR(10, 25029, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25029, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfinit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25029, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1446rnfinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_T, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1446rnfinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfinit", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_gen.pxi":25128
 *         :math:`p^2` divides the relative ideal discriminant.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25129
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25129, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25130
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25131
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25132
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfinit0(__pyx_v__nf, __pyx_v__T, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25133
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfinit0(_nf, _T, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfisabelian(nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25029
 *         return new_gen(_ret)
 * 
 *     def rnfinit(nf, T, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25135
 *         return new_gen(_ret)
 * 
 *     def rnfisabelian(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being a relative polynomial with coefficients
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1449rnfisabelian(PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1448rnfisabelian[] = "\n        :math:`T` being a relative polynomial with coefficients\n        in :emphasis:`nf`, return 1 if it defines an abelian extension, and 0 otherwise.\n        \n        ::\n        \n            ? K = nfinit(y^2 + 23);\n            ? rnfisabelian(K, x^3 - 3*x - y)\n            %2 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1449rnfisabelian(PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisabelian (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1448rnfisabelian(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_T));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1448rnfisabelian(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisabelian", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_gen.pxi":25146
 *             %2 = 1
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25147
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25147, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25148
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef long _ret = rnfisabelian(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25149
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rnfisabelian(_nf, _T)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25150
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef long _ret = rnfisabelian(_nf, _T)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rnfisabelian(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_gen.pxi":25151
 *         cdef GEN _T = (<Gen>T).g
 *         cdef long _ret = rnfisabelian(_nf, _T)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":25152
 *         cdef long _ret = rnfisabelian(_nf, _T)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def rnfisfree(bnf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25135
 *         return new_gen(_ret)
 * 
 *     def rnfisabelian(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`T` being a relative polynomial with coefficients
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfisabelian", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25154
 *         return _ret
 * 
 *     def rnfisfree(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1451rnfisfree(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1450rnfisfree[] = "\n        Given :math:`bnf` as output by\n        :literal:`bnfinit`, and either a polynomial :math:`x` with coefficients in :math:`bnf`\n        defining a relative extension :math:`L` of :math:`bnf`, or a pseudo-basis :math:`x` of\n        such an extension, returns true (1) if :math:`L/bnf` is free, false (0) if\n        not.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1451rnfisfree(PyObject *__pyx_v_bnf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisfree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1450rnfisfree(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1450rnfisfree(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnf, PyObject *__pyx_v_x) {
  GEN __pyx_v__bnf;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisfree", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":25162
 *         not.
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25163
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25163, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25164
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rnfisfree(_bnf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnf)->__pyx_base.g;
  __pyx_v__bnf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25165
 *         sig_on()
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rnfisfree(_bnf, _x)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25166
 *         cdef GEN _bnf = (<Gen>bnf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rnfisfree(_bnf, _x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rnfisfree(__pyx_v__bnf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":25167
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = rnfisfree(_bnf, _x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":25168
 *         cdef long _ret = rnfisfree(_bnf, _x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def rnfislocalcyclo(rnf):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25168, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25154
 *         return _ret
 * 
 *     def rnfisfree(bnf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given :math:`bnf` as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfisfree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25170
 *         return _ret
 * 
 *     def rnfislocalcyclo(rnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number field extension :math:`L/K` as output
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1453rnfislocalcyclo(PyObject *__pyx_v_rnf, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1452rnfislocalcyclo[] = "\n        Let :emphasis:`rnf` be a relative number field extension :math:`L/K` as output\n        by :literal:`rnfinit` whose degree :math:`[L:K]` is a power of a prime :math:`\\ell`.\n        Return :math:`1` if the :math:`\\ell`-extension is locally cyclotomic (locally contained in\n        the cyclotomic :math:`\\mathbb{Z}_\\ell`-extension of :math:`K_v` at all places :math:`v \\| \\ell`), and\n        :math:`0` if not.\n        \n        ::\n        \n            ? K = nfinit(y^2 + y + 1);\n            ? L = rnfinit(K, x^3 - y); /* = K(zeta_9), globally cyclotomic */\n            ? rnfislocalcyclo(L)\n            %3 = 1\n            \\\\ we expect 3-adic continuity by Krasner's lemma\n            ? vector(5, i, rnfislocalcyclo(rnfinit(K, x^3 - y + 3^i)))\n            %5 = [0, 1, 1, 1, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1453rnfislocalcyclo(PyObject *__pyx_v_rnf, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfislocalcyclo (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1452rnfislocalcyclo(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_rnf));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1452rnfislocalcyclo(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_rnf) {
  GEN __pyx_v__rnf;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("rnfislocalcyclo", 0);

  /* "cypari/auto_gen.pxi":25188
 *             %5 = [0, 1, 1, 1, 1]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25188, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25189
 *         '''
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_rnf)->__pyx_base.g;
  __pyx_v__rnf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25190
 *         sig_on()
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef long _ret = rnfislocalcyclo(_rnf)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = rnfislocalcyclo(__pyx_v__rnf);

  /* "cypari/auto_gen.pxi":25191
 *         cdef GEN _rnf = (<Gen>rnf).g
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":25192
 *         cdef long _ret = rnfislocalcyclo(_rnf)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def rnfisnorm(T, a, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25170
 *         return _ret
 * 
 *     def rnfislocalcyclo(rnf):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`rnf` be a relative number field extension :math:`L/K` as output
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfislocalcyclo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25194
 *         return _ret
 * 
 *     def rnfisnorm(T, a, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Similar to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1455rnfisnorm(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1454rnfisnorm[] = "\n        Similar to\n        :literal:`bnfisnorm` but in the relative case. :math:`T` is as output by\n        :literal:`rnfisnorminit` applied to the extension :math:`L/K`. This tries to decide\n        whether the element :math:`a` in :math:`K` is the norm of some :math:`x` in the extension\n        :math:`L/K`.\n        \n        The output is a vector :math:`[x,q]`, where :math:`a = \\mathrm{Norm} (x)*q`. The\n        algorithm looks for a solution :math:`x` which is an :math:`S`-integer, with :math:`S` a list\n        of places of :math:`K` containing at least the ramified primes, the generators of\n        the class group of :math:`L`, as well as those primes dividing :math:`a`. If :math:`L/K` is\n        Galois, then this is enough; otherwise, :math:`flag` is used to add more primes to\n        :math:`S`: all the places above the primes :math:`p <= flag` (resp.\302\240:math:`p\\|flag`) if :math:`flag > 0`\n        (resp.\302\240:math:`flag < 0`).\n        \n        The answer is guaranteed (i.e.\302\240:math:`a` is a norm iff :math:`q = 1`) if the field is\n        Galois, or, under GRH, if :math:`S` contains all primes less than\n        :math:`12\\log^2\\|\\mathrm{disc} (M)\\|`, where :math:`M` is the normal\n        closure of :math:`L/K`.\n        \n        If :literal:`rnfisnorminit` has determined (or was told) that :math:`L/K` is\n        Galois, and :math:`flag != 0`, a Warning is issued (so that you can set\n        :math:`flag = 1` to check whether :math:`L/K` is known to be Galois, according to :math:`T`).\n        Example:\n        \n        ::\n        \n            bnf = bnfinit(y^3 + y^2 - 2*y - 1);\n            p = x^2 + Mod(y^2 + 2*y + 1, bnf.pol);\n            T = rnfisnorminit(bnf, p);\n            rnfisnorm(T, 17)\n        \n        checks whether :math:`17` is a norm in the Galois extension :math:`\\mathbb{Q} (\\beta) /\n        \\mathbb{Q} (\\alpha)`, where :math:`\\alpha^3 + \\alpha^2 - 2\\alpha - 1 = 0` and :math:`\\beta^2 +\n        ""\\alpha^2 + 2\\alpha + 1 = 0` (it is).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1455rnfisnorm(PyObject *__pyx_v_T, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_flag,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_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfisnorm") < 0)) __PYX_ERR(10, 25194, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_a = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25194, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfisnorm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25194, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1454rnfisnorm(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_T), __pyx_v_a, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1454rnfisnorm(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_T, PyObject *__pyx_v_a, long __pyx_v_flag) {
  GEN __pyx_v__T;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisnorm", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":25231
 *         \alpha^2 + 2\alpha + 1 = 0` (it is).
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25231, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25232
 *         '''
 *         a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25232, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25233
 *         a = objtogen(a)
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25234
 *         sig_on()
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25235
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfisnorm(__pyx_v__T, __pyx_v__a, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25236
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = rnfisnorm(_T, _a, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfisnorminit(pol, polrel, long flag=2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25194
 *         return _ret
 * 
 *     def rnfisnorm(T, a, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Similar to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25238
 *         return new_gen(_ret)
 * 
 *     def rnfisnorminit(pol, polrel, long flag=2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be defined by a root of :emphasis:`pol`, and :math:`L/K` the extension defined
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1457rnfisnorminit(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1456rnfisnorminit[] = "\n        Let :math:`K` be defined by a root of :emphasis:`pol`, and :math:`L/K` the extension defined\n        by the polynomial :emphasis:`polrel`. As usual, :emphasis:`pol` can in fact be an :emphasis:`nf`,\n        or :emphasis:`bnf`, etc; if :emphasis:`pol` has degree :math:`1` (the base field is :math:`\\mathbb{Q}`),\n        polrel is also allowed to be an :emphasis:`nf`, etc. Computes technical data needed\n        by :literal:`rnfisnorm` to solve norm equations :math:`Nx = a`, for :math:`x` in :math:`L`, and :math:`a`\n        in :math:`K`.\n        \n        If :math:`flag = 0`, do not care whether :math:`L/K` is Galois or not.\n        \n        If :math:`flag = 1`, :math:`L/K` is assumed to be Galois (unchecked), which speeds up\n        :literal:`rnfisnorm`.\n        \n        If :math:`flag = 2`, let the routine determine whether :math:`L/K` is Galois.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1457rnfisnorminit(PyObject *__pyx_v_pol, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_polrel = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisnorminit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_polrel,&__pyx_n_s_flag,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_polrel)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfisnorminit") < 0)) __PYX_ERR(10, 25238, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_polrel = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25238, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)2);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfisnorminit", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25238, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfisnorminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1456rnfisnorminit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_pol), __pyx_v_polrel, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1456rnfisnorminit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_pol, PyObject *__pyx_v_polrel, long __pyx_v_flag) {
  GEN __pyx_v__pol;
  GEN __pyx_v__polrel;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfisnorminit", 0);
  __Pyx_INCREF(__pyx_v_polrel);

  /* "cypari/auto_gen.pxi":25254
 *         If :math:`flag = 2`, let the routine determine whether :math:`L/K` is Galois.
 *         '''
 *         polrel = objtogen(polrel)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_polrel, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25254, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_polrel, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25255
 *         '''
 *         polrel = objtogen(polrel)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25255, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25256
 *         polrel = objtogen(polrel)
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25257
 *         sig_on()
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _polrel = (<Gen>polrel).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_polrel)->__pyx_base.g;
  __pyx_v__polrel = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25258
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfisnorminit(__pyx_v__pol, __pyx_v__polrel, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25259
 *         cdef GEN _polrel = (<Gen>polrel).g
 *         cdef GEN _ret = rnfisnorminit(_pol, _polrel, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfkummer(bnr, subgp=None, long d=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25238
 *         return new_gen(_ret)
 * 
 *     def rnfisnorminit(pol, polrel, long flag=2):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`K` be defined by a root of :emphasis:`pol`, and :math:`L/K` the extension defined
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfisnorminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_polrel);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25261
 *         return new_gen(_ret)
 * 
 *     def rnfkummer(bnr, subgp=None, long d=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1459rnfkummer(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1458rnfkummer[] = "\n        :emphasis:`bnr`\n        being as output by :literal:`bnrinit`, finds a relative equation for the\n        class field corresponding to the module in :emphasis:`bnr` and the given\n        congruence subgroup (the full ray class field if :emphasis:`subgp` is omitted).\n        If :math:`d` is positive, outputs the list of all relative equations of\n        degree :math:`d` contained in the ray class field defined by :emphasis:`bnr`, with\n        the :emphasis:`same` conductor as :math:`(bnr, subgp)`.\n        \n        :strong:`Warning.` This routine only works for subgroups of prime index. It\n        uses Kummer theory, adjoining necessary roots of unity (it needs to compute a\n        tough :literal:`bnfinit` here), and finds a generator via Hecke's characterization\n        of ramification in Kummer extensions of prime degree. If your extension does\n        not have prime degree, for the time being, you have to split it by hand as a\n        tower / compositum of such extensions.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1459rnfkummer(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_subgp = 0;
  long __pyx_v_d;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfkummer (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_subgp,&__pyx_n_s_d,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_subgp);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfkummer") < 0)) __PYX_ERR(10, 25261, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_subgp = values[0];
    if (values[1]) {
      __pyx_v_d = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_d == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25261, __pyx_L3_error)
    } else {
      __pyx_v_d = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25261, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfkummer", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25261, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfkummer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1458rnfkummer(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_subgp, __pyx_v_d, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1458rnfkummer(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_subgp, long __pyx_v_d, long __pyx_v_precision) {
  int __pyx_v__have_subgp;
  GEN __pyx_v__bnr;
  GEN __pyx_v__subgp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("rnfkummer", 0);
  __Pyx_INCREF(__pyx_v_subgp);

  /* "cypari/auto_gen.pxi":25278
 *         tower / compositum of such extensions.
 *         '''
 *         cdef bint _have_subgp = (subgp is not None)             # <<<<<<<<<<<<<<
 *         if _have_subgp:
 *             subgp = objtogen(subgp)
 */
  __pyx_t_1 = (__pyx_v_subgp != Py_None);
  __pyx_v__have_subgp = __pyx_t_1;

  /* "cypari/auto_gen.pxi":25279
 *         '''
 *         cdef bint _have_subgp = (subgp is not None)
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             subgp = objtogen(subgp)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_subgp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":25280
 *         cdef bint _have_subgp = (subgp is not None)
 *         if _have_subgp:
 *             subgp = objtogen(subgp)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_subgp, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 25280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_subgp, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":25279
 *         '''
 *         cdef bint _have_subgp = (subgp is not None)
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             subgp = objtogen(subgp)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":25281
 *         if _have_subgp:
 *             subgp = objtogen(subgp)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 25281, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25282
 *             subgp = objtogen(subgp)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":25283
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL             # <<<<<<<<<<<<<<
 *         if _have_subgp:
 *             _subgp = (<Gen>subgp).g
 */
  __pyx_v__subgp = NULL;

  /* "cypari/auto_gen.pxi":25284
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_subgp != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":25285
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:
 *             _subgp = (<Gen>subgp).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_subgp)->__pyx_base.g;
    __pyx_v__subgp = __pyx_t_4;

    /* "cypari/auto_gen.pxi":25284
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _subgp = NULL
 *         if _have_subgp:             # <<<<<<<<<<<<<<
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":25286
 *         if _have_subgp:
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":25287
 *             _subgp = (<Gen>subgp).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfkummer(__pyx_v__bnr, __pyx_v__subgp, __pyx_v_d, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":25288
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfkummer(_bnr, _subgp, d, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnflllgram(nf, pol, order, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 25288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25261
 *         return new_gen(_ret)
 * 
 *     def rnfkummer(bnr, subgp=None, long d=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfkummer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_subgp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25290
 *         return new_gen(_ret)
 * 
 *     def rnflllgram(nf, pol, order, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1461rnflllgram(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1460rnflllgram[] = "\n        Given a polynomial\n        :emphasis:`pol` with coefficients in :emphasis:`nf` defining a relative extension :math:`L` and\n        a suborder :emphasis:`order` of :math:`L` (of maximal rank), as output by\n        :literal:`rnfpseudobasis`:math:`(nf,pol)` or similar, gives\n        :math:`[[neworder],U]`, where :emphasis:`neworder` is a reduced order and :math:`U` is\n        the unimodular transformation matrix.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1461rnflllgram(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  PyObject *__pyx_v_order = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnflllgram (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_order,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pol)) != 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_order)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rnflllgram", 0, 2, 3, 1); __PYX_ERR(10, 25290, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnflllgram") < 0)) __PYX_ERR(10, 25290, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_pol = values[0];
    __pyx_v_order = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25290, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnflllgram", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25290, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1460rnflllgram(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pol, __pyx_v_order, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1460rnflllgram(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, PyObject *__pyx_v_order, long __pyx_v_precision) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__order;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnflllgram", 0);
  __Pyx_INCREF(__pyx_v_pol);
  __Pyx_INCREF(__pyx_v_order);

  /* "cypari/auto_gen.pxi":25299
 *         the unimodular transformation matrix.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         order = objtogen(order)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25300
 *         '''
 *         pol = objtogen(pol)
 *         order = objtogen(order)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_order, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_order, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25301
 *         pol = objtogen(pol)
 *         order = objtogen(order)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25301, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25302
 *         order = objtogen(order)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _order = (<Gen>order).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25303
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _order = (<Gen>order).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25304
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _order = (<Gen>order).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_order)->__pyx_base.g;
  __pyx_v__order = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25305
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _order = (<Gen>order).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":25306
 *         cdef GEN _order = (<Gen>order).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnflllgram(__pyx_v__nf, __pyx_v__pol, __pyx_v__order, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":25307
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnflllgram(_nf, _pol, _order, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfnormgroup(bnr, pol):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25307, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25290
 *         return new_gen(_ret)
 * 
 *     def rnflllgram(nf, pol, order, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnflllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XDECREF(__pyx_v_order);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25309
 *         return new_gen(_ret)
 * 
 *     def rnfnormgroup(bnr, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being a big ray
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1463rnfnormgroup(PyObject *__pyx_v_bnr, PyObject *__pyx_v_pol); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1462rnfnormgroup[] = "\n        :emphasis:`bnr` being a big ray\n        class field as output by :literal:`bnrinit` and :emphasis:`pol` a relative polynomial\n        defining an Abelian extension, computes the norm group (alias Artin\n        or Takagi group) corresponding to the Abelian extension of\n        :math:`bnf =`:literal:`bnr.bnf`\n        defined by :emphasis:`pol`, where the module corresponding to :emphasis:`bnr` is assumed\n        to be a multiple of the conductor (i.e.\302\240:emphasis:`pol` defines a subextension of\n        bnr). The result is the HNF defining the norm group on the given generators\n        of :literal:`bnr.gen`. Note that neither the fact that :emphasis:`pol` defines an\n        Abelian extension nor the fact that the module is a multiple of the conductor\n        is checked. The result is undefined if the assumption is not correct,\n        but the function will return the empty matrix :literal:`[;]` if it detects a\n        problem; it may also not detect the problem and return a wrong result.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1463rnfnormgroup(PyObject *__pyx_v_bnr, PyObject *__pyx_v_pol) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfnormgroup (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1462rnfnormgroup(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), ((PyObject *)__pyx_v_pol));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1462rnfnormgroup(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_pol) {
  GEN __pyx_v__bnr;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfnormgroup", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_gen.pxi":25325
 *         problem; it may also not detect the problem and return a wrong result.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25326
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25326, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25327
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25328
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25329
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfnormgroup(__pyx_v__bnr, __pyx_v__pol);

  /* "cypari/auto_gen.pxi":25330
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfnormgroup(_bnr, _pol)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpolred(nf, pol, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25309
 *         return new_gen(_ret)
 * 
 *     def rnfnormgroup(bnr, pol):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being a big ray
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfnormgroup", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25332
 *         return new_gen(_ret)
 * 
 *     def rnfpolred(nf, pol, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete: use :literal:`rnfpolredbest` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1465rnfpolred(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1464rnfpolred[] = "\n        This function is obsolete: use :literal:`rnfpolredbest` instead.\n        Relative version of :literal:`polred`. Given a monic polynomial :emphasis:`pol` with\n        coefficients in :math:`nf`, finds a list of relative polynomials defining some\n        subfields, hopefully simpler and containing the original field. In the present\n        version :strong:`2.11.3`, this is slower and less efficient than :literal:`rnfpolredbest`.\n        \n        :strong:`Remark.` this function is based on an incomplete reduction\n        theory of lattices over number fields, implemented by :literal:`rnflllgram`, which\n        deserves to be improved.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1465rnfpolred(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpolred (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_precision,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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfpolred") < 0)) __PYX_ERR(10, 25332, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25332, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfpolred", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25332, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfpolred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1464rnfpolred(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pol, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1464rnfpolred(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_precision) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("rnfpolred", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_gen.pxi":25344
 *         deserves to be improved.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)
 *         pol = objtogen(pol)
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 25344, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":25345
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         sig_on()
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__77, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 25345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":25346
 *         from warnings import warn
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 25346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":25347
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 25347, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25348
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":25349
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_4;

  /* "cypari/auto_gen.pxi":25350
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":25351
 *         cdef GEN _pol = (<Gen>pol).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpolred(__pyx_v__nf, __pyx_v__pol, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":25352
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = rnfpolred(_nf, _pol, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpolredabs(nf, pol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 25352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25332
 *         return new_gen(_ret)
 * 
 *     def rnfpolred(nf, pol, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is obsolete: use :literal:`rnfpolredbest` instead.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfpolred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25354
 *         return new_gen(_ret)
 * 
 *     def rnfpolredabs(nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredabs`. Given an irreducible monic polynomial
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1467rnfpolredabs(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1466rnfpolredabs[] = "\n        Relative version of :literal:`polredabs`. Given an irreducible monic polynomial\n        :emphasis:`pol` with coefficients in :math:`nf`, finds a canonical relative\n        polynomial defining the same field, hopefully with small coefficients.\n        Note that the equation is only canonical for a fixed :emphasis:`nf`, using a\n        different defining polynomial in the :emphasis:`nf` structure will produce a\n        different relative equation.\n        \n        The binary digits of :math:`flag` correspond to :math:`1`: add information to convert\n        elements to the new representation, :math:`2`: absolute polynomial, instead of\n        relative, :math:`16`: possibly use a suborder of the maximal order. More precisely:\n        \n        0: default, return :math:`P`\n        \n        1: returns :math:`[P,a]` where :math:`P` is the default output and :math:`a`,\n        a :literal:`t_POLMOD` modulo :math:`P`, is a root of :emphasis:`pol`.\n        \n        2: returns :emphasis:`Pabs`, an absolute, instead of a relative, polynomial.\n        This polynomial is canonical and does not depend on the :emphasis:`nf` structure.\n        Same as but faster than\n        \n        ::\n        \n             polredabs(rnfequation(nf, pol))\n        \n        3: returns :math:`[Pabs,a,b]`, where :emphasis:`Pabs` is an absolute polynomial\n        as above, :math:`a`, :math:`b` are :literal:`t_POLMOD` modulo :emphasis:`Pabs`, roots of :literal:`nf.pol`\n        and :emphasis:`pol` respectively.\n        \n        16: possibly use a suborder of the maximal order. This is slower than the\n        default when the relative discriminant is smooth, and much faster otherwise.\n        In this case the result is no longer canonical; see ``polredabs`` (in the PARI manual).\n        \n        :strong:`Warning.` The complexity of :literal:`rnfpolredabs`\n        is exponential in the absolute degree. The function :literal:`rnfpolredbest` runs\n        in polynomial"" time, and tends to return polynomials with smaller\n        discriminants.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1467rnfpolredabs(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpolredabs (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_flag,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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfpolredabs") < 0)) __PYX_ERR(10, 25354, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25354, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfpolredabs", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25354, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfpolredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1466rnfpolredabs(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1466rnfpolredabs(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfpolredabs", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_gen.pxi":25393
 *         discriminants.
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25393, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25394
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25394, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25395
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25396
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25397
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpolredabs(__pyx_v__nf, __pyx_v__pol, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25398
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredabs(_nf, _pol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpolredbest(nf, pol, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25354
 *         return new_gen(_ret)
 * 
 *     def rnfpolredabs(nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredabs`. Given an irreducible monic polynomial
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfpolredabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25400
 *         return new_gen(_ret)
 * 
 *     def rnfpolredbest(nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredbest`. Given a monic polynomial :emphasis:`pol`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1469rnfpolredbest(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1468rnfpolredbest[] = "\n        Relative version of :literal:`polredbest`. Given a monic polynomial :emphasis:`pol`\n        with coefficients in :math:`nf`, finds a simpler relative polynomial :math:`P`\n        defining the same field. As opposed to :literal:`rnfpolredabs` this function does\n        not return a :emphasis:`smallest` (canonical) polynomial with respect to some\n        measure, but it does run in polynomial time.\n        \n        The binary digits of :math:`flag` correspond to :math:`1`: add information to convert\n        elements to the new representation, :math:`2`: absolute polynomial, instead of\n        relative. More precisely:\n        \n        0: default, return :math:`P`\n        \n        1: returns :math:`[P,a]` where :math:`P` is the default output and :math:`a`,\n        a :literal:`t_POLMOD` modulo :math:`P`, is a root of :emphasis:`pol`.\n        \n        2: returns :emphasis:`Pabs`, an absolute, instead of a relative, polynomial.\n        Same as but faster than\n        \n        ::\n        \n             rnfequation(nf, rnfpolredbest(nf,pol))\n        \n        3: returns :math:`[Pabs,a,b]`, where :emphasis:`Pabs` is an absolute polynomial\n        as above, :math:`a`, :math:`b` are :literal:`t_POLMOD` modulo :emphasis:`Pabs`, roots of :literal:`nf.pol`\n        and :emphasis:`pol` respectively.\n        \n        ::\n        \n            ? K = nfinit(y^3-2); pol = x^2 +x*y + y^2;\n            ? [P, a] = rnfpolredbest(K,pol,1);\n            ? P\n            %3 = x^2 - x + Mod(y - 1, y^3 - 2)\n            ? a\n            %4 = Mod(Mod(2*y^2+3*y+4,y^3-2)*x + Mod(-y^2-2*y-2,y^3-2),\n             x^2 - x + Mod(y-1,y^3-2))\n            ? subst(K.pol,y,a)\n            %5 = 0\n            ? [Pabs, a, b] = rnfpolredbest(K,pol,3);\n            ? Pabs\n            %7 = x^6 - 3*x^5 + 5*x^3 - 3*x + 1\n            ? a\n            %8 = Mod(-x^2+x+1, x^6-3*x^5+5*x^3-3*x+1)\n            ? b\n            %9 = Mod(2*x^5-5*x^4-3*x^3+10*x^2+5*x-5, x^6-3*x^5+5*x^3""-3*x+1)\n            ? subst(K.pol,y,a)\n            %10 = 0\n            ? substvec(pol,[x,y],[a,b])\n            %11 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1469rnfpolredbest(PyObject *__pyx_v_nf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_pol = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpolredbest (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pol,&__pyx_n_s_flag,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_pol)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfpolredbest") < 0)) __PYX_ERR(10, 25400, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_pol = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25400, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfpolredbest", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25400, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfpolredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1468rnfpolredbest(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), __pyx_v_pol, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1468rnfpolredbest(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_pol, long __pyx_v_flag) {
  GEN __pyx_v__nf;
  GEN __pyx_v__pol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfpolredbest", 0);
  __Pyx_INCREF(__pyx_v_pol);

  /* "cypari/auto_gen.pxi":25451
 *             %11 = 0
 *         '''
 *         pol = objtogen(pol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_pol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_pol, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25452
 *         '''
 *         pol = objtogen(pol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25452, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25453
 *         pol = objtogen(pol)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25454
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_pol)->__pyx_base.g;
  __pyx_v__pol = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25455
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpolredbest(__pyx_v__nf, __pyx_v__pol, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25456
 *         cdef GEN _pol = (<Gen>pol).g
 *         cdef GEN _ret = rnfpolredbest(_nf, _pol, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfpseudobasis(nf, T):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25400
 *         return new_gen(_ret)
 * 
 *     def rnfpolredbest(nf, pol, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Relative version of :literal:`polredbest`. Given a monic polynomial :emphasis:`pol`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfpolredbest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25458
 *         return new_gen(_ret)
 * 
 *     def rnfpseudobasis(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1471rnfpseudobasis(PyObject *__pyx_v_nf, PyObject *__pyx_v_T); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1470rnfpseudobasis[] = "\n        Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by\n        :literal:`nfinit`, and a monic irreducible polynomial :math:`T` in :math:`K[x]` defining a\n        relative extension :math:`L = K[x]/(T)`, computes the relative discriminant of :math:`L`\n        and a pseudo-basis :math:`(A,J)` for the maximal order :math:`\\mathbb{Z}_L` viewed as a\n        :math:`\\mathbb{Z}_K`-module. This is output as a vector :math:`[A,J,D,d]`, where :math:`D` is the\n        relative ideal discriminant and :math:`d` is the relative discriminant considered\n        as an element of :math:`K^*/{K^*}^2`.\n        \n        ::\n        \n            ? K = nfinit(y^2+1);\n            ? [A,J,D,d] = rnfpseudobasis(K, x^2+y);\n            ? A\n            %3 =\n            [1 0]\n            \n            [0 1]\n            \n            ? J\n            %4 = [1, 1]\n            ? D\n            %5 = [0, -4]~\n            ? d\n            %6 = [0, -1]~\n        \n        :strong:`Huge discriminants, helping rnfdisc.` the format :math:`[T,B]` is\n        also accepted instead of :math:`T` and produce an order which is maximal at all\n        primes :math:`p < B`, see :literal:`\077\077rnfinit`.\n        \n        ::\n        \n            ? p = 585403248812100232206609398101;\n            ? q = 711171340236468512951957953369;\n            ? T = x^2 + 3*(p*q)^2;\n            ? [A,J,D,d] = V = rnfpseudobasis(K, T); D\n            time = 22,178 ms.\n            %10 =\n            [3 0]\n            \n            [0 3]\n            ? [A,J,D,d] = W = rnfpseudobasis(K, [T,100]); D\n            time = 5 ms.\n            %11 =\n            [3 0]\n            \n            [0 3]\n            ? V == W\n            %12 = 1\n        \n        In this example, the results are identical since :math:`D \\cap \\mathbb{Z}`\n        factors over primes less than :math:`100`. Had it not been the case, the\n        order would have been guaranteed maximal at primes :""math:`p \\| p` for :math:`p\n        <= 100` only (and might not have been maximal at any maximal ideal\n        :math:`p` such that :math:`p^2` dividing :math:`D`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1471rnfpseudobasis(PyObject *__pyx_v_nf, PyObject *__pyx_v_T) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfpseudobasis (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1470rnfpseudobasis(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_T));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1470rnfpseudobasis(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_T) {
  GEN __pyx_v__nf;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfpseudobasis", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_gen.pxi":25515
 *         :math:`p` such that :math:`p^2` dividing :math:`D`.
 *         '''
 *         T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25516
 *         '''
 *         T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25516, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25517
 *         T = objtogen(T)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25518
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
  __pyx_v__T = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25519
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfpseudobasis(__pyx_v__nf, __pyx_v__T);

  /* "cypari/auto_gen.pxi":25520
 *         cdef GEN _T = (<Gen>T).g
 *         cdef GEN _ret = rnfpseudobasis(_nf, _T)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def rnfsteinitz(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25520, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25458
 *         return new_gen(_ret)
 * 
 *     def rnfpseudobasis(nf, T):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given an :emphasis:`nf` structure attached to a number field :math:`K`, as output by
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfpseudobasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25522
 *         return new_gen(_ret)
 * 
 *     def rnfsteinitz(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`nf` as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1473rnfsteinitz(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1472rnfsteinitz[] = "\n        Given a number field :math:`nf` as\n        output by :literal:`nfinit` and either a polynomial :math:`x` with coefficients in\n        :math:`nf` defining a relative extension :math:`L` of :math:`nf`, or a pseudo-basis\n        :math:`x` of such an extension as output for example by :literal:`rnfpseudobasis`,\n        computes another pseudo-basis :math:`(A,I)` (not in HNF in general) such that all\n        the ideals of :math:`I` except perhaps the last one are equal to the ring of\n        integers of :math:`nf`, and outputs the four-component row vector :math:`[A,I,D,d]`\n        as in :literal:`rnfpseudobasis`. The name of this function comes from the fact\n        that the ideal class of the last ideal of :math:`I`, which is well defined, is the\n        Steinitz class of the :math:`\\mathbb{Z}_K`-module :math:`\\mathbb{Z}_L` (its image in :math:`SK_0(\\mathbb{Z}_K)`).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1473rnfsteinitz(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfsteinitz (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1472rnfsteinitz(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1472rnfsteinitz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_nf, PyObject *__pyx_v_x) {
  GEN __pyx_v__nf;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("rnfsteinitz", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":25535
 *         Steinitz class of the :math:`\mathbb{Z}_K`-module :math:`\mathbb{Z}_L` (its image in :math:`SK_0(\mathbb{Z}_K)`).
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25535, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25536
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25536, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25537
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf)->__pyx_base.g;
  __pyx_v__nf = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25538
 *         sig_on()
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25539
 *         cdef GEN _nf = (<Gen>nf).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = rnfsteinitz(__pyx_v__nf, __pyx_v__x);

  /* "cypari/auto_gen.pxi":25540
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = rnfsteinitz(_nf, _x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def select(f, A, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25522
 *         return new_gen(_ret)
 * 
 *     def rnfsteinitz(nf, x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a number field :math:`nf` as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.rnfsteinitz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25542
 *         return new_gen(_ret)
 * 
 *     def select(f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         We first describe the default behavior, when :math:`flag` is 0 or omitted.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1475select(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1474select[] = "\n        We first describe the default behavior, when :math:`flag` is 0 or omitted.\n        Given a vector or list :literal:`A` and a :literal:`t_CLOSURE` :literal:`f`, :literal:`select`\n        returns the elements :math:`x` of :literal:`A` such that :math:`f(x)` is non-zero. In other\n        words, :literal:`f` is seen as a selection function returning a boolean value.\n        \n        ::\n        \n            ? select(x->isprime(x), vector(50,i,i^2+1))\n            %1 = [2, 5, 17, 37, 101, 197, 257, 401, 577, 677, 1297, 1601]\n            ? select(x->(x<100), %)\n            %2 = [2, 5, 17, 37]\n        \n        returns the primes of the form :math:`i^2+1` for some :math:`i <= 50`,\n        then the elements less than 100 in the preceding result. The :literal:`select`\n        function also applies to a matrix :literal:`A`, seen as a vector of columns, i.e. it\n        selects columns instead of entries, and returns the matrix whose columns are\n        the selected ones.\n        \n        :strong:`Remark.` For :math:`v` a :literal:`t_VEC`, :literal:`t_COL`, :literal:`t_LIST` or :literal:`t_MAT`,\n        the alternative set-notations\n        \n        ::\n        \n            [g(x) | x <- v, f(x)]\n            [x | x <- v, f(x)]\n            [g(x) | x <- v]\n        \n        are available as shortcuts for\n        \n        ::\n        \n            apply(g, select(f, Vec(v)))\n            select(f, Vec(v))\n            apply(g, Vec(v))\n        \n        respectively:\n        \n        ::\n        \n            ? [ x | x <- vector(50,i,i^2+1), isprime(x) ]\n            %1 = [2, 5, 17, 37, 101, 197, 257, 401, 577, 677, 1297, 1601]\n        \n        If :math:`flag = 1`, this function returns instead the :emphasis:`indices` of\n        the selected elements, and not the elements themselves (indirect selection):\n        \n        ::\n        \n            ? V = vector(50,i,i^2+1);\n            ? select(x->isprime(x), V, 1)\n            %2 = Vecsmall(""[1, 2, 4, 6, 10, 14, 16, 20, 24, 26, 36, 40])\n            ? vecextract(V, %)\n            %3 = [2, 5, 17, 37, 101, 197, 257, 401, 577, 677, 1297, 1601]\n        \n        The following function lists the elements in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`:\n        \n        ::\n        \n            ? invertibles(N) = select(x->gcd(x,N) == 1, [1..N])\n        \n        Finally\n        \n        ::\n        \n            ? select(x->x, M)\n        \n        selects the non-0 entries in :literal:`M`. If the latter is a\n        :literal:`t_MAT`, we extract the matrix of non-0 columns. Note that :emphasis:`removing`\n        entries instead of selecting them just involves replacing the selection\n        function :literal:`f` with its negation:\n        \n        ::\n        \n            ? select(x->!isprime(x), vector(50,i,i^2+1))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1475select(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_A = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("select (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_flag,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_A)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "select") < 0)) __PYX_ERR(10, 25542, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_A = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25542, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("select", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25542, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1474select(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_A, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1474select(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_A, long __pyx_v_flag) {
  GEN __pyx_v__f;
  GEN __pyx_v__A;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("select", 0);
  __Pyx_INCREF(__pyx_v_A);

  /* "cypari/auto_gen.pxi":25618
 *             ? select(x->!isprime(x), vector(50,i,i^2+1))
 *         '''
 *         A = objtogen(A)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_A, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_A, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25619
 *         '''
 *         A = objtogen(A)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25619, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25620
 *         A = objtogen(A)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = select0(_f, _A, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25621
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = select0(_f, _A, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_A)->__pyx_base.g;
  __pyx_v__A = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25622
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = select0(_f, _A, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = select0(__pyx_v__f, __pyx_v__A, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25623
 *         cdef GEN _A = (<Gen>A).g
 *         cdef GEN _ret = select0(_f, _A, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def seralgdep(s, long p, long r):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25542
 *         return new_gen(_ret)
 * 
 *     def select(f, A, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         We first describe the default behavior, when :math:`flag` is 0 or omitted.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.select", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_A);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25625
 *         return new_gen(_ret)
 * 
 *     def seralgdep(s, long p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a linear relation between powers :math:`(1,s,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1477seralgdep(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1476seralgdep[] = "\n        finds a linear relation between powers :math:`(1,s,\n        ..., s^p)` of the series :math:`s`, with polynomial coefficients of degree\n        :math:`<= r`. In case no relation is found, return :math:`0`.\n        \n        ::\n        \n            ? s = 1 + 10*y - 46*y^2 + 460*y^3 - 5658*y^4 + 77740*y^5 + O(y^6);\n            ? seralgdep(s, 2, 2)\n            %2 = -x^2 + (8*y^2 + 20*y + 1)\n            ? subst(%, x, s)\n            %3 = O(y^6)\n            ? seralgdep(s, 1, 3)\n            %4 = (-77*y^2 - 20*y - 1)*x + (310*y^3 + 231*y^2 + 30*y + 1)\n            ? seralgdep(s, 1, 2)\n            %5 = 0\n        \n        The series main variable must not be :math:`x`, so as to be able\n        to express the result as a polynomial in :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1477seralgdep(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_p;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("seralgdep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_r,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_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("seralgdep", 1, 2, 2, 1); __PYX_ERR(10, 25625, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "seralgdep") < 0)) __PYX_ERR(10, 25625, __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_p = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_p == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25625, __pyx_L3_error)
    __pyx_v_r = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25625, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("seralgdep", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25625, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.seralgdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1476seralgdep(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_p, __pyx_v_r);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1476seralgdep(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_p, long __pyx_v_r) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("seralgdep", 0);

  /* "cypari/auto_gen.pxi":25646
 *         to express the result as a polynomial in :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = seralgdep(_s, p, r)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25646, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25647
 *         '''
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = seralgdep(_s, p, r)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25648
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = seralgdep(_s, p, r)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = seralgdep(__pyx_v__s, __pyx_v_p, __pyx_v_r);

  /* "cypari/auto_gen.pxi":25649
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = seralgdep(_s, p, r)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serchop(s, long n=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25625
 *         return new_gen(_ret)
 * 
 *     def seralgdep(s, long p, long r):             # <<<<<<<<<<<<<<
 *         r'''
 *         finds a linear relation between powers :math:`(1,s,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.seralgdep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25651
 *         return new_gen(_ret)
 * 
 *     def serchop(s, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Remove all terms of degree strictly less than :math:`n` in series :math:`s`. When
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1479serchop(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1478serchop[] = "\n        Remove all terms of degree strictly less than :math:`n` in series :math:`s`. When\n        the series contains no terms of degree :math:`< n`, return :math:`O(x^n)`.\n        \n        ::\n        \n            ? s = 1/x + x + 2*x^2 + O(x^3);\n            ? serchop(s)\n            %2 = x + 2*x^3 + O(x^3)\n            ? serchop(s, 2)\n            %3 = 2*x^2 + O(x^3)\n            ? serchop(s, 100)\n            %4 = O(x^100)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1479serchop(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serchop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "serchop") < 0)) __PYX_ERR(10, 25651, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25651, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("serchop", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25651, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.serchop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1478serchop(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1478serchop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_n) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("serchop", 0);

  /* "cypari/auto_gen.pxi":25666
 *             %4 = O(x^100)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serchop(_s, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25666, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25667
 *         '''
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = serchop(_s, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25668
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serchop(_s, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = serchop(__pyx_v__s, __pyx_v_n);

  /* "cypari/auto_gen.pxi":25669
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serchop(_s, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serconvol(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25669, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25651
 *         return new_gen(_ret)
 * 
 *     def serchop(s, long n=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Remove all terms of degree strictly less than :math:`n` in series :math:`s`. When
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.serchop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25671
 *         return new_gen(_ret)
 * 
 *     def serconvol(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Convolution (or Hadamard product) of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1481serconvol(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1480serconvol[] = "\n        Convolution (or Hadamard product) of the\n        two power series :math:`x` and :math:`y`; in other words if :math:`x = \\sum a_k*X^k` and :math:`y = \\sum\n        b_k*X^k` then :math:`serconvol (x,y) = \\sum a_k*b_k*X^k`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1481serconvol(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serconvol (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1480serconvol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1480serconvol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("serconvol", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":25677
 *         b_k*X^k` then :math:`serconvol (x,y) = \sum a_k*b_k*X^k`.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25678
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25678, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25679
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = convol(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25680
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = convol(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25681
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = convol(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = convol(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":25682
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = convol(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serlaplace(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25671
 *         return new_gen(_ret)
 * 
 *     def serconvol(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Convolution (or Hadamard product) of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.serconvol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25684
 *         return new_gen(_ret)
 * 
 *     def serlaplace(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be a power series with non-negative
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1483serlaplace(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1482serlaplace[] = "\n        :math:`x` must be a power series with non-negative\n        exponents or a polynomial. If :math:`x = \\sum (a_k/k!)*X^k` then the result is :math:`\\sum\n        a_k*X^k`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1483serlaplace(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serlaplace (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1482serlaplace(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1482serlaplace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("serlaplace", 0);

  /* "cypari/auto_gen.pxi":25690
 *         a_k*X^k`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = laplace(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25690, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25691
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = laplace(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25692
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = laplace(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = laplace(__pyx_v__x);

  /* "cypari/auto_gen.pxi":25693
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = laplace(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serprec(x, v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25684
 *         return new_gen(_ret)
 * 
 *     def serlaplace(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be a power series with non-negative
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.serlaplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25695
 *         return new_gen(_ret)
 * 
 *     def serprec(x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute precision of :math:`x` with respect to power series
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1485serprec(PyObject *__pyx_v_x, PyObject *__pyx_v_v); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1484serprec[] = "\n        Returns the absolute precision of :math:`x` with respect to power series\n        in the variable :math:`v`; this is the\n        minimum precision of the components of :math:`x`. The result is :literal:`+oo` if :math:`x`\n        is an exact object (as a series in :math:`v`):\n        \n        ::\n        \n            ? serprec(x + O(y^2), y)\n            %1 = 2\n            ? serprec(x + 2, x)\n            %2 = +oo\n            ? serprec(2 + x + O(x^2), y)\n            %3 = +oo\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1485serprec(PyObject *__pyx_v_x, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serprec (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1484serprec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1484serprec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_t_2;
  GEN __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("serprec", 0);

  /* "cypari/auto_gen.pxi":25711
 *             %3 = +oo
 *         '''
 *         cdef long _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_1 == ((long)-2L))) __PYX_ERR(10, 25711, __pyx_L1_error)
  __pyx_v__v = __pyx_t_1;

  /* "cypari/auto_gen.pxi":25712
 *         '''
 *         cdef long _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpserprec(_x, _v)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25712, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25713
 *         cdef long _v = get_var(v)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpserprec(_x, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25714
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpserprec(_x, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpserprec(__pyx_v__x, __pyx_v__v);

  /* "cypari/auto_gen.pxi":25715
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpserprec(_x, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def serreverse(s):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_4)) __PYX_ERR(10, 25715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25695
 *         return new_gen(_ret)
 * 
 *     def serprec(x, v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the absolute precision of :math:`x` with respect to power series
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen_base.serprec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25717
 *         return new_gen(_ret)
 * 
 *     def serreverse(s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reverse power series of :math:`s`, i.e. the series :math:`t` such that :math:`t(s) = x`;
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1487serreverse(PyObject *__pyx_v_s, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1486serreverse[] = "\n        Reverse power series of :math:`s`, i.e. the series :math:`t` such that :math:`t(s) = x`;\n        :math:`s` must be a power series whose valuation is exactly equal to one.\n        \n        ::\n        \n            ? \\ps 8\n            ? t = serreverse(tan(x))\n            %2 = x - 1/3*x^3 + 1/5*x^5 - 1/7*x^7 + O(x^8)\n            ? tan(t)\n            %3 = x + O(x^8)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1487serreverse(PyObject *__pyx_v_s, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serreverse (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1486serreverse(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1486serreverse(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("serreverse", 0);

  /* "cypari/auto_gen.pxi":25730
 *             %3 = x + O(x^8)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serreverse(_s)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25730, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25731
 *         '''
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = serreverse(_s)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25732
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serreverse(_s)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = serreverse(__pyx_v__s);

  /* "cypari/auto_gen.pxi":25733
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _ret = serreverse(_s)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setbinop(f, X, Y=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25717
 *         return new_gen(_ret)
 * 
 *     def serreverse(s):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reverse power series of :math:`s`, i.e. the series :math:`t` such that :math:`t(s) = x`;
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.serreverse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25735
 *         return new_gen(_ret)
 * 
 *     def setbinop(f, X, Y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The set whose elements are the f(x,y), where x,y run through X,Y.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1489setbinop(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1488setbinop[] = "\n        The set whose elements are the f(x,y), where x,y run through X,Y.\n        respectively. If :math:`Y` is omitted, assume that :math:`X = Y` and that :math:`f` is symmetric:\n        :math:`f(x,y) = f(y,x)` for all :math:`x,y` in :math:`X`.\n        \n        ::\n        \n            ? X = [1,2,3]; Y = [2,3,4];\n            ? setbinop((x,y)->x+y, X,Y) \\\\ set X + Y\n            %2 = [3, 4, 5, 6, 7]\n            ? setbinop((x,y)->x-y, X,Y) \\\\ set X - Y\n            %3 = [-3, -2, -1, 0, 1]\n            ? setbinop((x,y)->x+y, X) \\\\ set 2X = X + X\n            %2 = [2, 3, 4, 5, 6]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1489setbinop(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_Y = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setbinop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_Y,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setbinop") < 0)) __PYX_ERR(10, 25735, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_X = values[0];
    __pyx_v_Y = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setbinop", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25735, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.setbinop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1488setbinop(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_X, __pyx_v_Y);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1488setbinop(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) {
  int __pyx_v__have_Y;
  GEN __pyx_v__f;
  GEN __pyx_v__X;
  GEN __pyx_v__Y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("setbinop", 0);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_Y);

  /* "cypari/auto_gen.pxi":25751
 *             %2 = [2, 3, 4, 5, 6]
 *         '''
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25751, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25752
 *         '''
 *         X = objtogen(X)
 *         cdef bint _have_Y = (Y is not None)             # <<<<<<<<<<<<<<
 *         if _have_Y:
 *             Y = objtogen(Y)
 */
  __pyx_t_2 = (__pyx_v_Y != Py_None);
  __pyx_v__have_Y = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25753
 *         X = objtogen(X)
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             Y = objtogen(Y)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_Y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":25754
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:
 *             Y = objtogen(Y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25754, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_Y, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":25753
 *         X = objtogen(X)
 *         cdef bint _have_Y = (Y is not None)
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             Y = objtogen(Y)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":25755
 *         if _have_Y:
 *             Y = objtogen(Y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 25755, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25756
 *             Y = objtogen(Y)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_4;

  /* "cypari/auto_gen.pxi":25757
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Y = NULL
 *         if _have_Y:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_4;

  /* "cypari/auto_gen.pxi":25758
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL             # <<<<<<<<<<<<<<
 *         if _have_Y:
 *             _Y = (<Gen>Y).g
 */
  __pyx_v__Y = NULL;

  /* "cypari/auto_gen.pxi":25759
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 */
  __pyx_t_2 = (__pyx_v__have_Y != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":25760
 *         cdef GEN _Y = NULL
 *         if _have_Y:
 *             _Y = (<Gen>Y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Y)->__pyx_base.g;
    __pyx_v__Y = __pyx_t_4;

    /* "cypari/auto_gen.pxi":25759
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _Y = NULL
 *         if _have_Y:             # <<<<<<<<<<<<<<
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 */
  }

  /* "cypari/auto_gen.pxi":25761
 *         if _have_Y:
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setbinop(__pyx_v__f, __pyx_v__X, __pyx_v__Y);

  /* "cypari/auto_gen.pxi":25762
 *             _Y = (<Gen>Y).g
 *         cdef GEN _ret = setbinop(_f, _X, _Y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setintersect(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25735
 *         return new_gen(_ret)
 * 
 *     def setbinop(f, X, Y=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         The set whose elements are the f(x,y), where x,y run through X,Y.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.setbinop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_Y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25764
 *         return new_gen(_ret)
 * 
 *     def setintersect(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1491setintersect(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1490setintersect[] = "\n        Intersection of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).\n        If :math:`x` or :math:`y` is not a set, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1491setintersect(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setintersect (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1490setintersect(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1490setintersect(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setintersect", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":25769
 *         If :math:`x` or :math:`y` is not a set, the result is undefined.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25769, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25770
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25770, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25771
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setintersect(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25772
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setintersect(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25773
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setintersect(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setintersect(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":25774
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setintersect(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setisset(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25764
 *         return new_gen(_ret)
 * 
 *     def setintersect(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Intersection of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.setintersect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25776
 *         return new_gen(_ret)
 * 
 *     def setisset(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a set, false (0) if
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1493setisset(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1492setisset[] = "\n        Returns true (1) if :math:`x` is a set, false (0) if\n        not. In PARI, a set is a row vector whose entries are strictly\n        increasing with respect to a (somewhat arbitrary) universal comparison\n        function. To convert any object into a set (this is most useful for\n        vectors, of course), use the function :literal:`Set`.\n        \n        ::\n        \n            ? a = [3, 1, 1, 2];\n            ? setisset(a)\n            %2 = 0\n            ? Set(a)\n            %3 = [1, 2, 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1493setisset(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setisset (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1492setisset(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1492setisset(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("setisset", 0);

  /* "cypari/auto_gen.pxi":25792
 *             %3 = [1, 2, 3]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setisset(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25792, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25793
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = setisset(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25794
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setisset(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = setisset(__pyx_v__x);

  /* "cypari/auto_gen.pxi":25795
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setisset(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":25796
 *         cdef long _ret = setisset(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def setminus(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25776
 *         return new_gen(_ret)
 * 
 *     def setisset(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns true (1) if :math:`x` is a set, false (0) if
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.setisset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25798
 *         return _ret
 * 
 *     def setminus(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the two sets :math:`x` and :math:`y` (see :literal:`setisset`),
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1495setminus(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1494setminus[] = "\n        Difference of the two sets :math:`x` and :math:`y` (see :literal:`setisset`),\n        i.e.\302\240set of elements of :math:`x` which do not belong to :math:`y`.\n        If :math:`x` or :math:`y` is not a set, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1495setminus(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setminus (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1494setminus(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1494setminus(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setminus", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":25804
 *         If :math:`x` or :math:`y` is not a set, the result is undefined.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25805
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25805, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25806
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setminus(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25807
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setminus(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25808
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setminus(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setminus(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":25809
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setminus(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def setrand(n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25798
 *         return _ret
 * 
 *     def setminus(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Difference of the two sets :math:`x` and :math:`y` (see :literal:`setisset`),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.setminus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25811
 *         return new_gen(_ret)
 * 
 *     def setrand(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reseeds the random number generator using the seed :math:`n`. No value is
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1497setrand(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1496setrand[] = "\n        Reseeds the random number generator using the seed :math:`n`. No value is\n        returned. The seed is a small positive integer :math:`0 < n < 2^{64}` used to\n        generate deterministically a suitable state array. All gp session start\n        by an implicit :literal:`setrand(1)`, so resetting the seed to this value allows\n        to replay all computations since the session start. Alternatively,\n        running a randomized computation starting by :literal:`setrand` (:math:`n`)\n        twice with the same :math:`n` will generate the exact same output.\n        \n        In the other direction, including a call to :literal:`setrand(getwalltime())`\n        from your gprc will cause GP to produce different streams of random numbers\n        in each session. (Unix users may want to use :literal:`/dev/urandom` instead\n        of :literal:`getwalltime`.)\n        \n        For debugging purposes, one can also record a particular random state\n        using :literal:`getrand` (the value is encoded as a huge integer) and feed it to\n        :literal:`setrand`:\n        \n        ::\n        \n            ? state = getrand(); \\\\ record seed\n            ...\n            ? setrand(state); \\\\ we can now replay the exact same computations\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1497setrand(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setrand (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1496setrand(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1496setrand(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n) {
  GEN __pyx_v__n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  __Pyx_RefNannySetupContext("setrand", 0);

  /* "cypari/auto_gen.pxi":25836
 *             ? setrand(state); \\ we can now replay the exact same computations
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         setrand(_n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25836, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25837
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         setrand(_n)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25838
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         setrand(_n)             # <<<<<<<<<<<<<<
 *         clear_stack()
 * 
 */
  setrand(__pyx_v__n);

  /* "cypari/auto_gen.pxi":25839
 *         cdef GEN _n = (<Gen>n).g
 *         setrand(_n)
 *         clear_stack()             # <<<<<<<<<<<<<<
 * 
 *     def setsearch(S, x, long flag=0):
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":25811
 *         return new_gen(_ret)
 * 
 *     def setrand(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Reseeds the random number generator using the seed :math:`n`. No value is
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.setrand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25841
 *         clear_stack()
 * 
 *     def setsearch(S, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the set :math:`S` (see :literal:`setisset`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1499setsearch(PyObject *__pyx_v_S, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1498setsearch[] = "\n        Determines whether :math:`x` belongs to the set :math:`S` (see :literal:`setisset`).\n        \n        We first describe the default behavior, when :math:`flag` is zero or omitted. If :math:`x`\n        belongs to the set :math:`S`, returns the index :math:`j` such that :math:`S[j] = x`, otherwise\n        returns 0.\n        \n        ::\n        \n            ? T = [7,2,3,5]; S = Set(T);\n            ? setsearch(S, 2)\n            %2 = 1\n            ? setsearch(S, 4) \\\\ not found\n            %3 = 0\n            ? setsearch(T, 7) \\\\ search in a randomly sorted vector\n            %4 = 0 \\\\ WRONG !\n        \n        If :math:`S` is not a set, we also allow sorted lists with\n        respect to the :literal:`cmp` sorting function, without repeated entries,\n        as per :literal:`listsort`:math:`(L,1)`; otherwise the result is undefined.\n        \n        ::\n        \n            ? L = List([1,4,2,3,2]); setsearch(L, 4)\n            %1 = 0 \\\\ WRONG !\n            ? listsort(L, 1); L \\\\ sort L first\n            %2 = List([1, 2, 3, 4])\n            ? setsearch(L, 4)\n            %3 = 4 \\\\ now correct\n        \n        If :math:`flag` is non-zero, this function returns the index :math:`j` where :math:`x` should be\n        inserted, and :math:`0` if it already belongs to :math:`S`. This is meant to be used for\n        dynamically growing (sorted) lists, in conjunction with :literal:`listinsert`.\n        \n        ::\n        \n            ? L = List([1,5,2,3,2]); listsort(L,1); L\n            %1 = List([1,2,3,5])\n            ? j = setsearch(L, 4, 1) \\\\ 4 should have been inserted at index j\n            %2 = 4\n            ? listinsert(L, 4, j); L\n            %3 = List([1, 2, 3, 4, 5])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1499setsearch(PyObject *__pyx_v_S, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setsearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setsearch") < 0)) __PYX_ERR(10, 25841, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25841, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setsearch", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25841, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.setsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1498setsearch(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_S), __pyx_v_x, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1498setsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_S, PyObject *__pyx_v_x, long __pyx_v_flag) {
  GEN __pyx_v__S;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setsearch", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":25885
 *             %3 = List([1, 2, 3, 4, 5])
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _S = (<Gen>S).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25885, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25886
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25886, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25887
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _S = (<Gen>S).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setsearch(_S, _x, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_S)->__pyx_base.g;
  __pyx_v__S = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25888
 *         sig_on()
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = setsearch(_S, _x, flag)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25889
 *         cdef GEN _S = (<Gen>S).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setsearch(_S, _x, flag)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = setsearch(__pyx_v__S, __pyx_v__x, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":25890
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = setsearch(_S, _x, flag)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":25891
 *         cdef long _ret = setsearch(_S, _x, flag)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def setunion(x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25891, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25841
 *         clear_stack()
 * 
 *     def setsearch(S, x, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the set :math:`S` (see :literal:`setisset`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.setsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25893
 *         return _ret
 * 
 *     def setunion(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Union of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1501setunion(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1500setunion[] = "\n        Union of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).\n        If :math:`x` or :math:`y` is not a set, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1501setunion(PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("setunion (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1500setunion(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1500setunion(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("setunion", 0);
  __Pyx_INCREF(__pyx_v_y);

  /* "cypari/auto_gen.pxi":25898
 *         If :math:`x` or :math:`y` is not a set, the result is undefined.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":25899
 *         '''
 *         y = objtogen(y)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 25899, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25900
 *         y = objtogen(y)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setunion(_x, _y)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25901
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = setunion(_x, _y)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":25902
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setunion(_x, _y)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = setunion(__pyx_v__x, __pyx_v__y);

  /* "cypari/auto_gen.pxi":25903
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _ret = setunion(_x, _y)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def shift(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 25903, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25893
 *         return _ret
 * 
 *     def setunion(x, y):             # <<<<<<<<<<<<<<
 *         r'''
 *         Union of the two sets :math:`x` and :math:`y` (see :literal:`setisset`).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.setunion", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25905
 *         return new_gen(_ret)
 * 
 *     def shift(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Shifts :math:`x` componentwise left by :math:`n` bits if :math:`n >= 0` and right by :math:`\|n\|`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1503shift(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1502shift[] = "\n        Shifts :math:`x` componentwise left by :math:`n` bits if :math:`n >= 0` and right by :math:`\\|n\\|`\n        bits if :math:`n < 0`. May be abbreviated as :math:`x` :literal:` << ` :math:`n` or :math:`x` :literal:` >> ` :math:`(-n)`.\n        A left shift by :math:`n` corresponds to multiplication by :math:`2^n`. A right shift of an\n        integer :math:`x` by :math:`\\|n\\|` corresponds to a Euclidean division of :math:`x` by :math:`2^{\\|n\\|}`\n        with a remainder of the same sign as :math:`x`, hence is not the same (in general) as\n        :math:`x \\ 2^n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1503shift(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shift (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25905, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1502shift(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1502shift(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("shift", 0);

  /* "cypari/auto_gen.pxi":25914
 *         :math:`x \ 2^n`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gshift(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25914, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25915
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gshift(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25916
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gshift(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gshift(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":25917
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gshift(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def shiftmul(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25905
 *         return new_gen(_ret)
 * 
 *     def shift(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Shifts :math:`x` componentwise left by :math:`n` bits if :math:`n >= 0` and right by :math:`\|n\|`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.shift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25919
 *         return new_gen(_ret)
 * 
 *     def shiftmul(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplies :math:`x` by :math:`2^n`. The difference with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1505shiftmul(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1504shiftmul[] = "\n        Multiplies :math:`x` by :math:`2^n`. The difference with\n        :literal:`shift` is that when :math:`n < 0`, ordinary division takes place, hence for\n        example if :math:`x` is an integer the result may be a fraction, while for shifts\n        Euclidean division takes place when :math:`n < 0` hence if :math:`x` is an integer the result\n        is still an integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1505shiftmul(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("shiftmul (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25919, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.shiftmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1504shiftmul(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1504shiftmul(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("shiftmul", 0);

  /* "cypari/auto_gen.pxi":25927
 *         is still an integer.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gmul2n(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25927, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25928
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gmul2n(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25929
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gmul2n(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gmul2n(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":25930
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gmul2n(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sigma(x, long k=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25919
 *         return new_gen(_ret)
 * 
 *     def shiftmul(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Multiplies :math:`x` by :math:`2^n`. The difference with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.shiftmul", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25932
 *         return new_gen(_ret)
 * 
 *     def sigma(x, long k=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the :math:`k-th` powers of the positive divisors of :math:`\|x\|`. :math:`x`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1507sigma(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1506sigma[] = "\n        Sum of the :math:`k-th` powers of the positive divisors of :math:`\\|x\\|`. :math:`x`\n        and :math:`k` must be of type integer.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1507sigma(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sigma (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sigma") < 0)) __PYX_ERR(10, 25932, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25932, __pyx_L3_error)
    } else {
      __pyx_v_k = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sigma", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25932, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1506sigma(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_k);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1506sigma(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_k) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sigma", 0);

  /* "cypari/auto_gen.pxi":25937
 *         and :math:`k` must be of type integer.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sumdivk(_x, k)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25937, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25938
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumdivk(_x, k)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25939
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sumdivk(_x, k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumdivk(__pyx_v__x, __pyx_v_k);

  /* "cypari/auto_gen.pxi":25940
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sumdivk(_x, k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sign(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25932
 *         return new_gen(_ret)
 * 
 *     def sigma(x, long k=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of the :math:`k-th` powers of the positive divisors of :math:`\|x\|`. :math:`x`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sigma", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25942
 *         return new_gen(_ret)
 * 
 *     def sign(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         sign (:math:`0`, :math:`1` or :math:`-1`) of :math:`x`, which must be of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1509sign(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1508sign[] = "\n        sign (:math:`0`, :math:`1` or :math:`-1`) of :math:`x`, which must be of\n        type integer, real or fraction; :literal:`t_QUAD` with positive discriminants and\n        :literal:`t_INFINITY` are also supported.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1509sign(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1508sign(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1508sign(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  int __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sign", 0);

  /* "cypari/auto_gen.pxi":25948
 *         :literal:`t_INFINITY` are also supported.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = gsigne(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25948, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25949
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef int _ret = gsigne(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25950
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = gsigne(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = gsigne(__pyx_v__x);

  /* "cypari/auto_gen.pxi":25951
 *         cdef GEN _x = (<Gen>x).g
 *         cdef int _ret = gsigne(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":25952
 *         cdef int _ret = gsigne(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def simplify(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25942
 *         return new_gen(_ret)
 * 
 *     def sign(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         sign (:math:`0`, :math:`1` or :math:`-1`) of :math:`x`, which must be of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25954
 *         return _ret
 * 
 *     def simplify(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function simplifies :math:`x` as much as it can. Specifically, a complex or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1511simplify(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1510simplify[] = "\n        This function simplifies :math:`x` as much as it can. Specifically, a complex or\n        quadratic number whose imaginary part is the integer 0 (i.e.\302\240not :literal:`Mod(0,2)`\n        or :literal:`0.E-28`) is converted to its real part, and a polynomial of degree :math:`0`\n        is converted to its constant term. Simplifications occur recursively.\n        \n        This function is especially useful before using arithmetic functions,\n        which expect integer arguments:\n        \n        ::\n        \n            ? x = 2 + y - y\n            %1 = 2\n            ? isprime(x)\n             *** at top-level: isprime(x)\n             *** ^----------\n             *** isprime: not an integer argument in an arithmetic function\n            ? type(x)\n            %2 = \"t_POL\"\n            ? type(simplify(x))\n            %3 = \"t_INT\"\n        \n        Note that GP results are simplified as above before they are stored in the\n        history. (Unless you disable automatic simplification with :literal:`\\\\backslash y`, that is.)\n        In particular\n        \n        ::\n        \n            ? type(%1)\n            %4 = \"t_INT\"\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1511simplify(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("simplify (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1510simplify(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1510simplify(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("simplify", 0);

  /* "cypari/auto_gen.pxi":25986
 *             %4 = "t_INT"
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = simplify(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25986, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25987
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = simplify(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25988
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = simplify(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = simplify(__pyx_v__x);

  /* "cypari/auto_gen.pxi":25989
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = simplify(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sin(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25989, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25954
 *         return _ret
 * 
 *     def simplify(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function simplifies :math:`x` as much as it can. Specifically, a complex or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.simplify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":25991
 *         return new_gen(_ret)
 * 
 *     def sin(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1513sin(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1512sin[] = "\n        Sine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1513sin(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sin (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sin") < 0)) __PYX_ERR(10, 25991, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 25991, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sin", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 25991, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1512sin(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1512sin(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sin", 0);

  /* "cypari/auto_gen.pxi":25995
 *         Sine of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 25995, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":25996
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsin(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":25997
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsin(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":25998
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsin(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsin(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":25999
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsin(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sinc(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 25999, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":25991
 *         return new_gen(_ret)
 * 
 *     def sin(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26001
 *         return new_gen(_ret)
 * 
 *     def sinc(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cardinal sine of :math:`x`, i.e. :math:`\sin (x)/x` if :math:`x != 0`, :math:`1` otherwise.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1515sinc(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1514sinc[] = "\n        Cardinal sine of :math:`x`, i.e. :math:`\\sin (x)/x` if :math:`x != 0`, :math:`1` otherwise.\n        Note that this function also allows to compute\n        \n        .. MATH::\n        \n            (1-\\cos (x)) / x^2 = sinc (x/2)^2 / 2\n        \n        accurately near :math:`x = 0`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1515sinc(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sinc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sinc") < 0)) __PYX_ERR(10, 26001, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26001, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sinc", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26001, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sinc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1514sinc(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1514sinc(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sinc", 0);

  /* "cypari/auto_gen.pxi":26012
 *         accurately near :math:`x = 0`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26012, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26013
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinc(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26014
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsinc(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26015
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinc(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsinc(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26016
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinc(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sinh(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26001
 *         return new_gen(_ret)
 * 
 *     def sinc(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Cardinal sine of :math:`x`, i.e. :math:`\sin (x)/x` if :math:`x != 0`, :math:`1` otherwise.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sinc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26018
 *         return new_gen(_ret)
 * 
 *     def sinh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic sine of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1517sinh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1516sinh[] = "\n        Hyperbolic sine of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1517sinh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sinh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sinh") < 0)) __PYX_ERR(10, 26018, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26018, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sinh", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26018, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1516sinh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1516sinh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sinh", 0);

  /* "cypari/auto_gen.pxi":26022
 *         Hyperbolic sine of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26022, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26023
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinh(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26024
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsinh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26025
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsinh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26026
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsinh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sizebyte(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26018
 *         return new_gen(_ret)
 * 
 *     def sinh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic sine of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sinh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26028
 *         return new_gen(_ret)
 * 
 *     def sizebyte(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the total number of bytes occupied by the tree representing the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1519sizebyte(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1518sizebyte[] = "\n        Outputs the total number of bytes occupied by the tree representing the\n        PARI object :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1519sizebyte(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sizebyte (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1518sizebyte(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1518sizebyte(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sizebyte", 0);

  /* "cypari/auto_gen.pxi":26033
 *         PARI object :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = gsizebyte(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26033, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26034
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = gsizebyte(_x)
 *         clear_stack()
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26035
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = gsizebyte(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = gsizebyte(__pyx_v__x);

  /* "cypari/auto_gen.pxi":26036
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = gsizebyte(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":26037
 *         cdef long _ret = gsizebyte(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def sizedigit(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26037, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26028
 *         return new_gen(_ret)
 * 
 *     def sizebyte(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Outputs the total number of bytes occupied by the tree representing the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sizebyte", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26039
 *         return _ret
 * 
 *     def sizedigit(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is DEPRECATED, essentially meaningless, and provided for
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1521sizedigit(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1520sizedigit[] = "\n        This function is DEPRECATED, essentially meaningless, and provided for\n        backwards compatibility only. Don't use it!\n        \n        outputs a quick upper bound for the number of decimal digits of (the\n        components of) :math:`x`, off by at most :math:`1`. More precisely, for a positive\n        integer :math:`x`, it computes (approximately) the ceiling of\n        \n        .. MATH::\n        \n            floor (1 + \\log_2 x) \\log_{10}2,\n        \n        To count the number of decimal digits of a positive integer :math:`x`, use\n        :literal:`\\#digits(x)`. To estimate (recursively) the size of :math:`x`, use\n        :literal:`normlp(x)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1521sizedigit(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sizedigit (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1520sizedigit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1520sizedigit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  GEN __pyx_v__x;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sizedigit", 0);

  /* "cypari/auto_gen.pxi":26056
 *         :literal:`normlp(x)`.
 *         '''
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26056, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26056, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":26057
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__78, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":26058
 *         from warnings import warn
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = sizedigit(_x)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26058, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26059
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = sizedigit(_x)
 *         clear_stack()
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26060
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = sizedigit(_x)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = sizedigit(__pyx_v__x);

  /* "cypari/auto_gen.pxi":26061
 *         cdef GEN _x = (<Gen>x).g
 *         cdef long _ret = sizedigit(_x)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":26062
 *         cdef long _ret = sizedigit(_x)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def sqr(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26062, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26039
 *         return _ret
 * 
 *     def sizedigit(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is DEPRECATED, essentially meaningless, and provided for
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sizedigit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26064
 *         return _ret
 * 
 *     def sqr(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of :math:`x`. This operation is not completely
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1523sqr(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1522sqr[] = "\n        Square of :math:`x`. This operation is not completely\n        straightforward, i.e.\302\240identical to :math:`x * x`, since it can usually be\n        computed more efficiently (roughly one-half of the elementary\n        multiplications can be saved). Also, squaring a :math:`2`-adic number increases\n        its precision. For example,\n        \n        ::\n        \n            ? (1 + O(2^4))^2\n            %1 = 1 + O(2^5)\n            ? (1 + O(2^4)) * (1 + O(2^4))\n            %2 = 1 + O(2^4)\n        \n        Note that this function is also called whenever one multiplies two objects\n        which are known to be :emphasis:`identical`, e.g.\302\240they are the value of the same\n        variable, or we are computing a power.\n        \n        ::\n        \n            ? x = (1 + O(2^4)); x * x\n            %3 = 1 + O(2^5)\n            ? (1 + O(2^4))^4\n            %4 = 1 + O(2^6)\n        \n        (note the difference between :literal:`\\%2` and :literal:`\\%3` above).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1523sqr(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1522sqr(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1522sqr(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sqr", 0);

  /* "cypari/auto_gen.pxi":26092
 *         (note the difference between :literal:`\%2` and :literal:`\%3` above).
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gsqr(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26092, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26093
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsqr(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26094
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gsqr(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsqr(__pyx_v__x);

  /* "cypari/auto_gen.pxi":26095
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gsqr(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sqrt(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26064
 *         return _ret
 * 
 *     def sqr(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Square of :math:`x`. This operation is not completely
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sqr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26097
 *         return new_gen(_ret)
 * 
 *     def sqrt(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the square root of :math:`x`, defined as :math:`\sqrt{x} =
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1525sqrt(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1524sqrt[] = "\n        Principal branch of the square root of :math:`x`, defined as :math:`\\sqrt{x} =\n        \\exp (\\log x / 2)`. In particular, we have\n        :math:`Arg(sqrt(x))\\in ]-\\pi/2, \\pi/2]`, and if :math:`x\\in \\mathbb{R}` and :math:`x < 0`,\n        then the result is complex with positive imaginary part.\n        \n        Intmod a prime :math:`p`, :literal:`t_PADIC` and :literal:`t_FFELT` are allowed as arguments. In\n        the first 2 cases (:literal:`t_INTMOD`, :literal:`t_PADIC`), the square root (if it\n        exists) which is returned is the one whose first :math:`p`-adic digit is in the\n        interval :math:`[0,p/2]`. For other arguments, the result is undefined.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1525sqrt(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sqrt") < 0)) __PYX_ERR(10, 26097, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26097, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sqrt", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26097, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sqrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1524sqrt(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1524sqrt(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sqrt", 0);

  /* "cypari/auto_gen.pxi":26109
 *         interval :math:`[0,p/2]`. For other arguments, the result is undefined.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26109, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26110
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsqrt(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26111
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsqrt(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26112
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsqrt(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsqrt(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26113
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gsqrt(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sqrtint(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26097
 *         return new_gen(_ret)
 * 
 *     def sqrt(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Principal branch of the square root of :math:`x`, defined as :math:`\sqrt{x} =
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sqrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26115
 *         return new_gen(_ret)
 * 
 *     def sqrtint(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer square root of :math:`x`, i.e. the largest integer :math:`y`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1527sqrtint(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1526sqrtint[] = "\n        Returns the integer square root of :math:`x`, i.e. the largest integer :math:`y`\n        such that :math:`y^2 <= x`, where :math:`x` a non-negative integer.\n        \n        ::\n        \n            ? N = 120938191237; sqrtint(N)\n            %1 = 347761\n            ? sqrt(N)\n            %2 = 347761.68741970412747602130964414095216\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1527sqrtint(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrtint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1526sqrtint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1526sqrtint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sqrtint", 0);

  /* "cypari/auto_gen.pxi":26127
 *             %2 = 347761.68741970412747602130964414095216
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtint(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26127, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26128
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sqrtint(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26129
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtint(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sqrtint(__pyx_v__x);

  /* "cypari/auto_gen.pxi":26130
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtint(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sqrtnint(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26115
 *         return new_gen(_ret)
 * 
 *     def sqrtint(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer square root of :math:`x`, i.e. the largest integer :math:`y`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sqrtint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26132
 *         return new_gen(_ret)
 * 
 *     def sqrtnint(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer :math:`n`-th root of :math:`x`, i.e. the largest integer :math:`y` such
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1529sqrtnint(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1528sqrtnint[] = "\n        Returns the integer :math:`n`-th root of :math:`x`, i.e. the largest integer :math:`y` such\n        that :math:`y^n <= x`, where :math:`x` is a non-negative integer.\n        \n        ::\n        \n            ? N = 120938191237; sqrtnint(N, 5)\n            %1 = 164\n            ? N^(1/5)\n            %2 = 164.63140849829660842958614676939677391\n        \n        The special case :math:`n = 2` is :literal:`sqrtint`\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1529sqrtnint(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrtnint (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26132, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sqrtnint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1528sqrtnint(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1528sqrtnint(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sqrtnint", 0);

  /* "cypari/auto_gen.pxi":26146
 *         The special case :math:`n = 2` is :literal:`sqrtint`
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtnint(_x, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26146, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26147
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sqrtnint(_x, n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26148
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtnint(_x, n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sqrtnint(__pyx_v__x, __pyx_v_n);

  /* "cypari/auto_gen.pxi":26149
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = sqrtnint(_x, n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def subgrouplist(bnr, bound=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26132
 *         return new_gen(_ret)
 * 
 *     def sqrtnint(x, long n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the integer :math:`n`-th root of :math:`x`, i.e. the largest integer :math:`y` such
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sqrtnint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26151
 *         return new_gen(_ret)
 * 
 *     def subgrouplist(bnr, bound=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit` or a list of cyclic components
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1531subgrouplist(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1530subgrouplist[] = "\n        :emphasis:`bnr` being as output by :literal:`bnrinit` or a list of cyclic components\n        of a finite Abelian group :math:`G`, outputs the list of subgroups of :math:`G`. Subgroups\n        are given as HNF left divisors of the SNF matrix corresponding to :math:`G`.\n        \n        If :math:`flag = 0` (default) and :emphasis:`bnr` is as output by :literal:`bnrinit`, gives\n        only the subgroups whose modulus is the conductor. Otherwise, the modulus is\n        not taken into account.\n        \n        If :emphasis:`bound` is present, and is a positive integer, restrict the output to\n        subgroups of index less than :emphasis:`bound`. If :emphasis:`bound` is a vector\n        containing a single positive integer :math:`B`, then only subgroups of index\n        exactly equal to :math:`B` are computed. For instance\n        \n        ::\n        \n            ? subgrouplist([6,2])\n            %1 = [[6, 0; 0, 2], [2, 0; 0, 2], [6, 3; 0, 1], [2, 1; 0, 1], [3, 0; 0, 2],\n            [1, 0; 0, 2], [6, 0; 0, 1], [2, 0; 0, 1], [3, 0; 0, 1], [1, 0; 0, 1]]\n            ? subgrouplist([6,2],3) \\\\ index less than 3\n            %2 = [[2, 1; 0, 1], [1, 0; 0, 2], [2, 0; 0, 1], [3, 0; 0, 1], [1, 0; 0, 1]]\n            ? subgrouplist([6,2],[3]) \\\\ index 3\n            %3 = [[3, 0; 0, 1]]\n            ? bnr = bnrinit(bnfinit(x), [120,[1]], 1);\n            ? L = subgrouplist(bnr, [8]);\n        \n        In the last example, :math:`L` corresponds to the 24 subfields of\n        :math:`\\mathbb{Q} (\\zeta_{120})`, of degree :math:`8` and conductor :math:`120 oo` (by setting :emphasis:`flag`,\n        we see there are a total of :math:`43` subgroups of degree :math:`8`).\n        \n        ::\n        \n            ? vector(#L, i, galoissubcyclo(bnr, L[i]))\n        \n        will produce their equations. (For a general base field, you would\n        have to rely on :literal:`bnrstark`, or :literal:`rnfkummer`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1531subgrouplist(PyObject *__pyx_v_bnr, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_bound = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subgrouplist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bound,&__pyx_n_s_flag,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bound);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subgrouplist") < 0)) __PYX_ERR(10, 26151, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_bound = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26151, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subgrouplist", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26151, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.subgrouplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1530subgrouplist(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_bnr), __pyx_v_bound, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1530subgrouplist(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_bnr, PyObject *__pyx_v_bound, long __pyx_v_flag) {
  int __pyx_v__have_bound;
  GEN __pyx_v__bnr;
  GEN __pyx_v__bound;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("subgrouplist", 0);
  __Pyx_INCREF(__pyx_v_bound);

  /* "cypari/auto_gen.pxi":26189
 *         have to rely on :literal:`bnrstark`, or :literal:`rnfkummer`.)
 *         '''
 *         cdef bint _have_bound = (bound is not None)             # <<<<<<<<<<<<<<
 *         if _have_bound:
 *             bound = objtogen(bound)
 */
  __pyx_t_1 = (__pyx_v_bound != Py_None);
  __pyx_v__have_bound = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26190
 *         '''
 *         cdef bint _have_bound = (bound is not None)
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             bound = objtogen(bound)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_bound != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26191
 *         cdef bint _have_bound = (bound is not None)
 *         if _have_bound:
 *             bound = objtogen(bound)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_bound, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_bound, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":26190
 *         '''
 *         cdef bint _have_bound = (bound is not None)
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             bound = objtogen(bound)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26192
 *         if _have_bound:
 *             bound = objtogen(bound)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26192, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26193
 *             bound = objtogen(bound)
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g             # <<<<<<<<<<<<<<
 *         cdef GEN _bound = NULL
 *         if _have_bound:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bnr)->__pyx_base.g;
  __pyx_v__bnr = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26194
 *         sig_on()
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL             # <<<<<<<<<<<<<<
 *         if _have_bound:
 *             _bound = (<Gen>bound).g
 */
  __pyx_v__bound = NULL;

  /* "cypari/auto_gen.pxi":26195
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 */
  __pyx_t_1 = (__pyx_v__have_bound != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26196
 *         cdef GEN _bound = NULL
 *         if _have_bound:
 *             _bound = (<Gen>bound).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_bound)->__pyx_base.g;
    __pyx_v__bound = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26195
 *         cdef GEN _bnr = (<Gen>bnr).g
 *         cdef GEN _bound = NULL
 *         if _have_bound:             # <<<<<<<<<<<<<<
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 */
  }

  /* "cypari/auto_gen.pxi":26197
 *         if _have_bound:
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = subgrouplist0(__pyx_v__bnr, __pyx_v__bound, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":26198
 *             _bound = (<Gen>bound).g
 *         cdef GEN _ret = subgrouplist0(_bnr, _bound, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def subst(x, y, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26151
 *         return new_gen(_ret)
 * 
 *     def subgrouplist(bnr, bound=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :emphasis:`bnr` being as output by :literal:`bnrinit` or a list of cyclic components
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.subgrouplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bound);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26200
 *         return new_gen(_ret)
 * 
 *     def subst(x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the simple variable :math:`y` by the argument :math:`z` in the "polynomial"
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1533subst(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1532subst[] = "\n        Replace the simple variable :math:`y` by the argument :math:`z` in the \"polynomial\"\n        expression :math:`x`. Every type is allowed for :math:`x`, but if it is not a genuine\n        polynomial (or power series, or rational function), the substitution will be\n        done as if the scalar components were polynomials of degree zero. In\n        particular, beware that:\n        \n        ::\n        \n            ? subst(1, x, [1,2; 3,4])\n            %1 =\n            [1 0]\n            \n            [0 1]\n            \n            ? subst(1, x, Mat([0,1]))\n             *** at top-level: subst(1,x,Mat([0,1])\n             *** ^--------------------\n             *** subst: forbidden substitution by a non square matrix.\n        \n        If :math:`x` is a power series, :math:`z` must be either a polynomial, a power\n        series, or a rational function. Finally, if :math:`x` is a vector,\n        matrix or list, the substitution is applied to each individual entry.\n        \n        Use the function :literal:`substvec` to replace several variables at once,\n        or the function :literal:`substpol` to replace a polynomial expression.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1533subst(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subst (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_z,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_y)) != 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("subst", 1, 2, 2, 1); __PYX_ERR(10, 26200, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subst") < 0)) __PYX_ERR(10, 26200, __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_y = values[0];
    __pyx_v_z = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subst", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26200, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.subst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1532subst(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1532subst(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  long __pyx_v__y;
  GEN __pyx_v__x;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("subst", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":26228
 *         or the function :literal:`substpol` to replace a polynomial expression.
 *         '''
 *         cdef long _y = get_var(y)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_y); if (unlikely(__pyx_t_1 == ((long)-2L))) __PYX_ERR(10, 26228, __pyx_L1_error)
  __pyx_v__y = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26229
 *         '''
 *         cdef long _y = get_var(y)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/auto_gen.pxi":26230
 *         cdef long _y = get_var(y)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26230, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26231
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubst(_x, _y, _z)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26232
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsubst(_x, _y, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26233
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubst(_x, _y, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsubst(__pyx_v__x, __pyx_v__y, __pyx_v__z);

  /* "cypari/auto_gen.pxi":26234
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubst(_x, _y, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def substpol(x, y, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26200
 *         return new_gen(_ret)
 * 
 *     def subst(x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the simple variable :math:`y` by the argument :math:`z` in the "polynomial"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.subst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26236
 *         return new_gen(_ret)
 * 
 *     def substpol(x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the "variable" :math:`y` by the argument :math:`z` in the "polynomial"
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1535substpol(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1534substpol[] = "\n        Replace the \"variable\" :math:`y` by the argument :math:`z` in the \"polynomial\"\n        expression :math:`x`. Every type is allowed for :math:`x`, but the same behavior\n        as :literal:`subst` above apply.\n        \n        The difference with :literal:`subst` is that :math:`y` is allowed to be any polynomial\n        here. The substitution is done moding out all components of :math:`x`\n        (recursively) by :math:`y - t`, where :math:`t` is a new free variable of lowest\n        priority. Then substituting :math:`t` by :math:`z` in the resulting expression. For\n        instance\n        \n        ::\n        \n            ? substpol(x^4 + x^2 + 1, x^2, y)\n            %1 = y^2 + y + 1\n            ? substpol(x^4 + x^2 + 1, x^3, y)\n            %2 = x^2 + y*x + 1\n            ? substpol(x^4 + x^2 + 1, (x+1)^2, y)\n            %3 = (-4*y - 6)*x + (y^2 + 3*y - 3)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1535substpol(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("substpol (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_z,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_y)) != 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("substpol", 1, 2, 2, 1); __PYX_ERR(10, 26236, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "substpol") < 0)) __PYX_ERR(10, 26236, __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_y = values[0];
    __pyx_v_z = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("substpol", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26236, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.substpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1534substpol(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1534substpol(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("substpol", 0);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":26257
 *             %3 = (-4*y - 6)*x + (y^2 + 3*y - 3)
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26258
 *         '''
 *         y = objtogen(y)
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26258, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26259
 *         y = objtogen(y)
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 26259, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26260
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26261
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26262
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26263
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsubstpol(__pyx_v__x, __pyx_v__y, __pyx_v__z);

  /* "cypari/auto_gen.pxi":26264
 *         cdef GEN _z = (<Gen>z).g
 *         cdef GEN _ret = gsubstpol(_x, _y, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def substvec(x, v, w):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26264, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26236
 *         return new_gen(_ret)
 * 
 *     def substpol(x, y, z):             # <<<<<<<<<<<<<<
 *         r'''
 *         Replace the "variable" :math:`y` by the argument :math:`z` in the "polynomial"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.substpol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26266
 *         return new_gen(_ret)
 * 
 *     def substvec(x, v, w):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`v` being a vector of monomials of degree 1 (variables),
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1537substvec(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1536substvec[] = "\n        :math:`v` being a vector of monomials of degree 1 (variables),\n        :math:`w` a vector of expressions of the same length, replace in the expression\n        :math:`x` all occurrences of :math:`v_i` by :math:`w_i`. The substitutions are done\n        simultaneously; more precisely, the :math:`v_i` are first replaced by new\n        variables in :math:`x`, then these are replaced by the :math:`w_i`:\n        \n        ::\n        \n            ? substvec([x,y], [x,y], [y,x])\n            %1 = [y, x]\n            ? substvec([x,y], [x,y], [y,x+y])\n            %2 = [y, x + y] \\\\ not [y, 2*y]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1537substvec(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("substvec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_w,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_v)) != 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_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("substvec", 1, 2, 2, 1); __PYX_ERR(10, 26266, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "substvec") < 0)) __PYX_ERR(10, 26266, __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_v = values[0];
    __pyx_v_w = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("substvec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26266, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.substvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1536substvec(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_v, __pyx_v_w);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1536substvec(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_v, PyObject *__pyx_v_w) {
  GEN __pyx_v__x;
  GEN __pyx_v__v;
  GEN __pyx_v__w;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("substvec", 0);
  __Pyx_INCREF(__pyx_v_v);
  __Pyx_INCREF(__pyx_v_w);

  /* "cypari/auto_gen.pxi":26281
 *             %2 = [y, x + y] \\ not [y, 2*y]
 *         '''
 *         v = objtogen(v)             # <<<<<<<<<<<<<<
 *         w = objtogen(w)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_v, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_v, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26282
 *         '''
 *         v = objtogen(v)
 *         w = objtogen(w)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26283
 *         v = objtogen(v)
 *         w = objtogen(w)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 26283, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26284
 *         w = objtogen(w)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _w = (<Gen>w).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26285
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26286
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
  __pyx_v__w = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26287
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gsubstvec(__pyx_v__x, __pyx_v__v, __pyx_v__w);

  /* "cypari/auto_gen.pxi":26288
 *         cdef GEN _w = (<Gen>w).g
 *         cdef GEN _ret = gsubstvec(_x, _v, _w)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumdedekind(h, k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26266
 *         return new_gen(_ret)
 * 
 *     def substvec(x, v, w):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`v` being a vector of monomials of degree 1 (variables),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.substvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26290
 *         return new_gen(_ret)
 * 
 *     def sumdedekind(h, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Dedekind sum attached to the integers :math:`h` and :math:`k`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1539sumdedekind(PyObject *__pyx_v_h, PyObject *__pyx_v_k); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1538sumdedekind[] = "\n        Returns the Dedekind sum attached to the integers :math:`h` and :math:`k`,\n        corresponding to a fast implementation of\n        \n        ::\n        \n             s(h,k) = sum(n = 1, k-1, (n/k)*(frac(h*n/k) - 1/2))\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1539sumdedekind(PyObject *__pyx_v_h, PyObject *__pyx_v_k) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumdedekind (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1538sumdedekind(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_h), ((PyObject *)__pyx_v_k));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1538sumdedekind(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_h, PyObject *__pyx_v_k) {
  GEN __pyx_v__h;
  GEN __pyx_v__k;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sumdedekind", 0);
  __Pyx_INCREF(__pyx_v_k);

  /* "cypari/auto_gen.pxi":26299
 *              s(h,k) = sum(n = 1, k-1, (n/k)*(frac(h*n/k) - 1/2))
 *         '''
 *         k = objtogen(k)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _h = (<Gen>h).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26300
 *         '''
 *         k = objtogen(k)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _k = (<Gen>k).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 26300, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26301
 *         k = objtogen(k)
 *         sig_on()
 *         cdef GEN _h = (<Gen>h).g             # <<<<<<<<<<<<<<
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = sumdedekind(_h, _k)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_h)->__pyx_base.g;
  __pyx_v__h = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26302
 *         sig_on()
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _k = (<Gen>k).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumdedekind(_h, _k)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_k)->__pyx_base.g;
  __pyx_v__k = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26303
 *         cdef GEN _h = (<Gen>h).g
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = sumdedekind(_h, _k)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumdedekind(__pyx_v__h, __pyx_v__k);

  /* "cypari/auto_gen.pxi":26304
 *         cdef GEN _k = (<Gen>k).g
 *         cdef GEN _ret = sumdedekind(_h, _k)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumdigits(n, B=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26290
 *         return new_gen(_ret)
 * 
 *     def sumdedekind(h, k):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the Dedekind sum attached to the integers :math:`h` and :math:`k`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumdedekind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26306
 *         return new_gen(_ret)
 * 
 *     def sumdigits(n, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of digits in the integer :math:`\|n\|`, when written in base :math:`B > 1`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1541sumdigits(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1540sumdigits[] = "\n        Sum of digits in the integer :math:`\\|n\\|`, when written in base :math:`B > 1`.\n        \n        ::\n        \n            ? sumdigits(123456789)\n            %1 = 45\n            ? sumdigits(123456789, 2)\n            %1 = 16\n        \n        Note that the sum of bits in :math:`n` is also returned by\n        :literal:`hammingweight`. This function is much faster than\n        :literal:`vecsum(digits(n,B))` when :math:`B` is :math:`10` or a power of :math:`2`, and only\n        slightly faster in other cases.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1541sumdigits(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumdigits (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumdigits") < 0)) __PYX_ERR(10, 26306, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumdigits", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26306, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1540sumdigits(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n), __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1540sumdigits(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, PyObject *__pyx_v_B) {
  int __pyx_v__have_B;
  GEN __pyx_v__n;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumdigits", 0);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":26322
 *         slightly faster in other cases.
 *         '''
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_1 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26323
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26324
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26324, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":26323
 *         '''
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26325
 *         if _have_B:
 *             B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26325, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26326
 *             B = objtogen(B)
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26327
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_gen.pxi":26328
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)
 */
  __pyx_t_1 = (__pyx_v__have_B != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26329
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumdigits0(_n, _B)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26328
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)
 */
  }

  /* "cypari/auto_gen.pxi":26330
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumdigits0(__pyx_v__n, __pyx_v__B);

  /* "cypari/auto_gen.pxi":26331
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = sumdigits0(_n, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumeulerrat(F, s=None, long a=2, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26306
 *         return new_gen(_ret)
 * 
 *     def sumdigits(n, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sum of digits in the integer :math:`\|n\|`, when written in base :math:`B > 1`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumdigits", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26333
 *         return new_gen(_ret)
 * 
 *     def sumeulerrat(F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1543sumeulerrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1542sumeulerrat[] = "\n        :math:`\\sum_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.\n        \n        ::\n        \n            ? sumeulerrat(1/q)\n            %1 = 0.45224742004106549850654336483224793418\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1543sumeulerrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_s = 0;
  long __pyx_v_a;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumeulerrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_s);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumeulerrat") < 0)) __PYX_ERR(10, 26333, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_s = values[0];
    if (values[1]) {
      __pyx_v_a = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_a == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26333, __pyx_L3_error)
    } else {
      __pyx_v_a = ((long)2);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26333, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumeulerrat", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26333, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1542sumeulerrat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_s, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1542sumeulerrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_s, long __pyx_v_a, long __pyx_v_precision) {
  int __pyx_v__have_s;
  GEN __pyx_v__F;
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumeulerrat", 0);
  __Pyx_INCREF(__pyx_v_s);

  /* "cypari/auto_gen.pxi":26342
 *             %1 = 0.45224742004106549850654336483224793418
 *         '''
 *         cdef bint _have_s = (s is not None)             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             s = objtogen(s)
 */
  __pyx_t_1 = (__pyx_v_s != Py_None);
  __pyx_v__have_s = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26343
 *         '''
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_s != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26344
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:
 *             s = objtogen(s)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_s, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":26343
 *         '''
 *         cdef bint _have_s = (s is not None)
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             s = objtogen(s)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26345
 *         if _have_s:
 *             s = objtogen(s)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26345, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26346
 *             s = objtogen(s)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _s = NULL
 *         if _have_s:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26347
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL             # <<<<<<<<<<<<<<
 *         if _have_s:
 *             _s = (<Gen>s).g
 */
  __pyx_v__s = NULL;

  /* "cypari/auto_gen.pxi":26348
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_s != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26349
 *         cdef GEN _s = NULL
 *         if _have_s:
 *             _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
    __pyx_v__s = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26348
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _s = NULL
 *         if _have_s:             # <<<<<<<<<<<<<<
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":26350
 *         if _have_s:
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26351
 *             _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumeulerrat(__pyx_v__F, __pyx_v__s, __pyx_v_a, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26352
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumeulerrat(_F, _s, a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumformal(f, v=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26333
 *         return new_gen(_ret)
 * 
 *     def sumeulerrat(F, s=None, long a=2, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{p >= a, p prime}F(p^s)`, where :math:`F` is a rational function.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumeulerrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26354
 *         return new_gen(_ret)
 * 
 *     def sumformal(f, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal sum of the polynomial expression :math:`f` with respect to the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1545sumformal(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1544sumformal[] = "\n        formal sum of the polynomial expression :math:`f` with respect to the\n        main variable if :math:`v` is omitted, with respect to the variable :math:`v` otherwise;\n        it is assumed that the base ring has characteristic zero. In other words,\n        considering :math:`f` as a polynomial function in the variable :math:`v`,\n        returns :math:`F`, a polynomial in :math:`v` vanishing at :math:`0`, such that :math:`F(b) - F(a)\n        = sum_{v = a+1}^b f(v)`:\n        \n        ::\n        \n            ? sumformal(n) \\\\ 1 + ... + n\n            %1 = 1/2*n^2 + 1/2*n\n            ? f(n) = n^3+n^2+1;\n            ? F = sumformal(f(n)) \\\\ f(1) + ... + f(n)\n            %3 = 1/4*n^4 + 5/6*n^3 + 3/4*n^2 + 7/6*n\n            ? sum(n = 1, 2000, f(n)) == subst(F, n, 2000)\n            %4 = 1\n            ? sum(n = 1001, 2000, f(n)) == subst(F, n, 2000) - subst(F, n, 1000)\n            %5 = 1\n            ? sumformal(x^2 + x*y + y^2, y)\n            %6 = y*x^2 + (1/2*y^2 + 1/2*y)*x + (1/3*y^3 + 1/2*y^2 + 1/6*y)\n            ? x^2 * y + x * sumformal(y) + sumformal(y^2) == %\n            %7 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1545sumformal(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumformal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumformal") < 0)) __PYX_ERR(10, 26354, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_v = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumformal", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26354, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1544sumformal(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_f), __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1544sumformal(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_f, PyObject *__pyx_v_v) {
  long __pyx_v__v;
  GEN __pyx_v__f;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  GEN __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("sumformal", 0);

  /* "cypari/auto_gen.pxi":26379
 *             %7 = 1
 *         '''
 *         cdef long _v = -1             # <<<<<<<<<<<<<<
 *         if v is not None:
 *             _v = get_var(v)
 */
  __pyx_v__v = -1L;

  /* "cypari/auto_gen.pxi":26380
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v_v != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":26381
 *         cdef long _v = -1
 *         if v is not None:
 *             _v = get_var(v)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 */
    __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(10, 26381, __pyx_L1_error)
    __pyx_v__v = __pyx_t_3;

    /* "cypari/auto_gen.pxi":26380
 *         '''
 *         cdef long _v = -1
 *         if v is not None:             # <<<<<<<<<<<<<<
 *             _v = get_var(v)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26382
 *         if v is not None:
 *             _v = get_var(v)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = sumformal(_f, _v)
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(10, 26382, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26383
 *             _v = get_var(v)
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumformal(_f, _v)
 *         return new_gen(_ret)
 */
  __pyx_t_5 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f)->__pyx_base.g;
  __pyx_v__f = __pyx_t_5;

  /* "cypari/auto_gen.pxi":26384
 *         sig_on()
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = sumformal(_f, _v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumformal(__pyx_v__f, __pyx_v__v);

  /* "cypari/auto_gen.pxi":26385
 *         cdef GEN _f = (<Gen>f).g
 *         cdef GEN _ret = sumformal(_f, _v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnumapinit(asymp, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_6)) __PYX_ERR(10, 26385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26354
 *         return new_gen(_ret)
 * 
 *     def sumformal(f, v=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         formal sum of the polynomial expression :math:`f` with respect to the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumformal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26387
 *         return new_gen(_ret)
 * 
 *     def sumnumapinit(asymp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Abel-Plana summation of a series :math:`\sum f(n)`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1547sumnumapinit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1546sumnumapinit[] = "\n        Initialize tables for Abel-Plana summation of a series :math:`\\sum f(n)`,\n        where :math:`f` is holomorphic in a right half-plane.\n        If given, :literal:`asymp` is of the form :math:`[+oo, \\alpha]`,\n        as in :literal:`intnum` and indicates the decrease rate at infinity of functions\n        to be summed. A positive\n        :math:`\\alpha > 0` encodes an exponential decrease of type :math:`\\exp (-\\alpha n)` and\n        a negative :math:`-2 < \\alpha < -1` encodes a slow polynomial decrease of type\n        :math:`n^{\\alpha}`.\n        \n        ::\n        \n            ? \\p200\n            ? sumnumap(n=1, n^-2);\n            time = 163 ms.\n            ? tab = sumnumapinit();\n            time = 160 ms.\n            ? sumnum(n=1, n^-2, tab); \\\\ faster\n            time = 7 ms.\n            \n            ? tab = sumnumapinit([+oo, log(2)]); \\\\ decrease like 2^-n\n            time = 164 ms.\n            ? sumnumap(n=1, 2^-n, tab) - 1\n            time = 36 ms.\n            %5 = 3.0127431466707723218 E-282\n            \n            ? tab = sumnumapinit([+oo, -4/3]); \\\\ decrease like n^(-4/3)\n            time = 166 ms.\n            ? sumnumap(n=1, n^(-4/3), tab);\n            time = 181 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1547sumnumapinit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnumapinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnumapinit") < 0)) __PYX_ERR(10, 26387, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26387, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnumapinit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26387, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnumapinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1546sumnumapinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_asymp), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1546sumnumapinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, long __pyx_v_precision) {
  GEN __pyx_v__asymp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sumnumapinit", 0);

  /* "cypari/auto_gen.pxi":26419
 *             time = 181 ms.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26419, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26420
 *         '''
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
  __pyx_v__asymp = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26421
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26422
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnumapinit(__pyx_v__asymp, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26423
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumapinit(_asymp, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnuminit(asymp, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26387
 *         return new_gen(_ret)
 * 
 *     def sumnumapinit(asymp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Abel-Plana summation of a series :math:`\sum f(n)`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnumapinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26425
 *         return new_gen(_ret)
 * 
 *     def sumnuminit(asymp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Euler-MacLaurin delta summation of a series with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1549sumnuminit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1548sumnuminit[] = "\n        Initialize tables for Euler-MacLaurin delta summation of a series with\n        positive terms. If given, :literal:`asymp` is of the form :math:`[+oo, \\alpha]`,\n        as in :literal:`intnum` and indicates the decrease rate at infinity of functions\n        to be summed. A positive\n        :math:`\\alpha > 0` encodes an exponential decrease of type :math:`\\exp (-\\alpha n)` and\n        a negative :math:`-2 < \\alpha < -1` encodes a slow polynomial decrease of type\n        :math:`n^{\\alpha}`.\n        \n        ::\n        \n            ? \\p200\n            ? sumnum(n=1, n^-2);\n            time = 200 ms.\n            ? tab = sumnuminit();\n            time = 188 ms.\n            ? sumnum(n=1, n^-2, tab); \\\\ faster\n            time = 8 ms.\n            \n            ? tab = sumnuminit([+oo, log(2)]); \\\\ decrease like 2^-n\n            time = 200 ms.\n            ? sumnum(n=1, 2^-n, tab)\n            time = 44 ms.\n            \n            ? tab = sumnuminit([+oo, -4/3]); \\\\ decrease like n^(-4/3)\n            time = 200 ms.\n            ? sumnum(n=1, n^(-4/3), tab);\n            time = 221 ms.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1549sumnuminit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnuminit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnuminit") < 0)) __PYX_ERR(10, 26425, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26425, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnuminit", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26425, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1548sumnuminit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_asymp), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1548sumnuminit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, long __pyx_v_precision) {
  GEN __pyx_v__asymp;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sumnuminit", 0);

  /* "cypari/auto_gen.pxi":26455
 *             time = 221 ms.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26455, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26456
 *         '''
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnuminit(_asymp, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
  __pyx_v__asymp = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26457
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnuminit(_asymp, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26458
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnuminit(_asymp, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnuminit(__pyx_v__asymp, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26459
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnuminit(_asymp, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnumlagrangeinit(asymp, c1=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26425
 *         return new_gen(_ret)
 * 
 *     def sumnuminit(asymp, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Euler-MacLaurin delta summation of a series with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnuminit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26461
 *         return new_gen(_ret)
 * 
 *     def sumnumlagrangeinit(asymp, c1=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Lagrange summation of a series. By
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1551sumnumlagrangeinit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1550sumnumlagrangeinit[] = "\n        Initialize tables for Lagrange summation of a series. By\n        default, assume that the remainder :math:`R(n) = \\sum_{m >= n} f(m)`\n        has an asymptotic expansion\n        \n        .. MATH::\n        \n            R(n) = \\sum_{m >= n} f(n) ~ \\sum_{i >= 1} a_i / n^i\n        \n        at infinity. The argument :literal:`asymp` allows to specify different\n        expansions:\n        \n        - a real number :math:`\\beta` means\n          \n        \n        .. MATH::\n        \n            R(n) = n^{-\\beta} \\sum_{i >= 1} a_i / n^i\n        \n        - a :literal:`t_CLOSURE` :math:`g` means\n          \n        \n        .. MATH::\n        \n            R(n) = g(n) \\sum_{i >= 1} a_i / n^i\n        \n          (The preceding case corresponds to :math:`g(n) = n^{-\\beta}`.)\n        \n        - a pair :math:`[\\alpha,\\beta]` where :math:`\\beta` is as above and\n          :math:`\\alpha\\in {2, 1, 1/2, 1/3, 1/4}`. We let :math:`R_2(n) = R(n) - f(n)/2`\n          and :math:`R_\\alpha (n) = R(n)` for :math:`\\alpha != 2`. Then\n          \n        \n        .. MATH::\n        \n            R_\\alpha (n) = g(n) \\sum_{i >= 1} a_i / n^{i\\alpha}\n        \n          Note that the initialization times increase considerable for the :math:`\\alpha`\n          is this list (:math:`1/4` being the slowest).\n        \n        The constant :math:`c1` is technical and computed by the program, but can be set\n        by the user: the number of interpolation steps will be chosen close to\n        :math:`c1.B`, where :math:`B` is the bit accuracy.\n        \n        ::\n        \n            ? \\p2000\n            ? sumnumlagrange(n=1, n^-2);\n            time = 173 ms.\n            ? tab = sumnumlagrangeinit();\n            time = 172 ms.\n            ? sumnumlagrange(n=1, n^-2, tab);\n            time = 4 ms.\n            \n            ? \\p115\n            ? sumnumlagrange(n=1, n^(-4/3)) - zeta(4/3);\n            %1 = -0.1093[...] \\\\ junk: expansion ""in n^(1/3)\n            time = 84 ms.\n            ? tab = sumnumlagrangeinit([1/3,0]); \\\\ alpha = 1/3\n            time = 336 ms.\n            ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3)\n            time = 84 ms.\n            %3 = 1.0151767349262596893 E-115 \\\\ now OK\n            \n            ? tab = sumnumlagrangeinit(1/3); \\\\ alpha = 1, beta = 1/3: much faster\n            time = 3ms\n            ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3) \\\\ ... but wrong\n            %5 = -0.273825[...] \\\\ junk !\n            ? tab = sumnumlagrangeinit(-2/3); \\\\ alpha = 1, beta = -2/3\n            time = 3ms\n            ? sumnumlagrange(n=1, n^(-4/3), tab) - zeta(4/3)\n            %6 = 2.030353469852519379 E-115 \\\\ now OK\n        \n        in The final example with :math:`\\zeta (4/3)`, the remainder\n        :math:`R_1(n)` is of the form :math:`n^{-1/3} \\sum_{i >= 0} a_i / n^i`, i.e.\n        :math:`n^{2/3} \\sum_{i >= 1} a_i / n^i`. The explains the wrong result\n        for :math:`\\beta = 1/3` and the correction with :math:`\\beta = -2/3`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1551sumnumlagrangeinit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_c1 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnumlagrangeinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_c1,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c1);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnumlagrangeinit") < 0)) __PYX_ERR(10, 26461, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_c1 = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26461, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnumlagrangeinit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26461, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnumlagrangeinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1550sumnumlagrangeinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_asymp), __pyx_v_c1, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1550sumnumlagrangeinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, PyObject *__pyx_v_c1, long __pyx_v_precision) {
  int __pyx_v__have_c1;
  GEN __pyx_v__asymp;
  GEN __pyx_v__c1;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumnumlagrangeinit", 0);
  __Pyx_INCREF(__pyx_v_c1);

  /* "cypari/auto_gen.pxi":26540
 *         for :math:`\beta = 1/3` and the correction with :math:`\beta = -2/3`.
 *         '''
 *         cdef bint _have_c1 = (c1 is not None)             # <<<<<<<<<<<<<<
 *         if _have_c1:
 *             c1 = objtogen(c1)
 */
  __pyx_t_1 = (__pyx_v_c1 != Py_None);
  __pyx_v__have_c1 = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26541
 *         '''
 *         cdef bint _have_c1 = (c1 is not None)
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             c1 = objtogen(c1)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_c1 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26542
 *         cdef bint _have_c1 = (c1 is not None)
 *         if _have_c1:
 *             c1 = objtogen(c1)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_c1, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26542, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_c1, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":26541
 *         '''
 *         cdef bint _have_c1 = (c1 is not None)
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             c1 = objtogen(c1)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26543
 *         if _have_c1:
 *             c1 = objtogen(c1)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26543, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26544
 *             c1 = objtogen(c1)
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _c1 = NULL
 *         if _have_c1:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
  __pyx_v__asymp = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26545
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL             # <<<<<<<<<<<<<<
 *         if _have_c1:
 *             _c1 = (<Gen>c1).g
 */
  __pyx_v__c1 = NULL;

  /* "cypari/auto_gen.pxi":26546
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_c1 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26547
 *         cdef GEN _c1 = NULL
 *         if _have_c1:
 *             _c1 = (<Gen>c1).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_c1)->__pyx_base.g;
    __pyx_v__c1 = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26546
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _c1 = NULL
 *         if _have_c1:             # <<<<<<<<<<<<<<
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":26548
 *         if _have_c1:
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26549
 *             _c1 = (<Gen>c1).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnumlagrangeinit(__pyx_v__asymp, __pyx_v__c1, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26550
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumlagrangeinit(_asymp, _c1, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnummonieninit(asymp, w=None, n0=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26461
 *         return new_gen(_ret)
 * 
 *     def sumnumlagrangeinit(asymp, c1=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Lagrange summation of a series. By
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnumlagrangeinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_c1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26552
 *         return new_gen(_ret)
 * 
 *     def sumnummonieninit(asymp, w=None, n0=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Monien summation of a series :math:`\sum_{n >= n_0}
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1553sumnummonieninit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1552sumnummonieninit[] = "\n        Initialize tables for Monien summation of a series :math:`\\sum_{n >= n_0}\n        f(n)` where :math:`f(1/z)` has a complex analytic continuation in a (complex)\n        neighbourhood of the segment :math:`[0,1]`.\n        \n        By default, assume that :math:`f(n) = O(n^{-2})` and has a non-zero asymptotic\n        expansion\n        \n        .. MATH::\n        \n            f(n) = \\sum_{i >= 2} a_i / n^i\n        \n        at infinity. Note that the sum starts at :math:`i = 2`! The argument :literal:`asymp`\n        allows to specify different expansions:\n        \n        - a real number :math:`\\beta > 0` means\n          \n        \n        .. MATH::\n        \n            f(n) = \\sum_{i >= 1} a_i / n^{i + \\beta}\n        \n          (Now the summation starts at :math:`1`.)\n        \n        - a vector :math:`[\\alpha,\\beta]` of reals, where we must have :math:`\\alpha > 0`\n          and :math:`\\alpha + \\beta > 1` to ensure convergence, means that\n          \n        \n        .. MATH::\n        \n            f(n) = \\sum_{i >= 1} a_i / n^{\\alpha i + \\beta}\n        \n          Note that :math:`asymp = [1, \\beta]` is equivalent to\n          :math:`asymp = \\beta`.\n        \n        ::\n        \n            ? \\p57\n            ? s = sumnum(n = 1, sin(1/sqrt(n)) / n); \\\\ reference point\n            \n            ? \\p38\n            ? sumnummonien(n = 1, sin(1/sqrt(n)) / n) - s\n            %2 = -0.001[...] \\\\ completely wrong\n            \n            ? t = sumnummonieninit(1/2); \\\\ f(n) = sum_i 1 / n^(i+1/2)\n            ? sumnummonien(n = 1, sin(1/sqrt(n)) / n, t) - s\n            %3 = 0.E-37 \\\\ now correct\n        \n        (As a matter of fact, in the above summation, the\n        result given by :literal:`sumnum` at :literal:`\\\\p38` is slighly incorrect,\n        so we had to increase the accuracy to :literal:`\\\\p57`.)\n        \n        The argument :math:`w` is used to sum expressions of the form\n        ""\n        .. MATH::\n        \n            \\sum_{n >= n_0} f(n) w(n),\n        \n        for varying :math:`f` :emphasis:`as above`, and fixed weight function :math:`w`, where we\n        further assume that the auxiliary sums\n        \n        .. MATH::\n        \n            g_w(m) = \\sum_{n >= n_0} w(n) / n^{\\alpha m + \\beta}\n        \n        converge for all :math:`m >= 1`. Note that for non-negative integers :math:`k`,\n        and weight :math:`w(n) = (\\log n)^k`, the function :math:`g_w(m) = \\zeta^{(k)}(\\alpha m +\n        \\beta)` has a simple expression; for general weights, :math:`g_w` is\n        computed using :literal:`sumnum`. The following variants are available\n        \n        - an integer :math:`k >= 0`, to code :math:`w(n) = (\\log n)^k`;\n        \n        - a :literal:`t_CLOSURE` computing the values :math:`w(n)`, where we\n          assume that :math:`w(n) = O(n^\\epsilon)` for all :math:`\\epsilon > 0`;\n        \n        - a vector :math:`[w, fast]`, where :math:`w` is a closure as above\n          and :literal:`fast` is a scalar;\n          we assume that :math:`w(n) = O(n^{fast+\\epsilon})`; note that\n          :math:`w = [w, 0]` is equivalent to :math:`w = w`. Note that if\n          :math:`w` decreases exponentially, :literal:`suminf` should be used instead.\n        \n        The subsequent calls to :literal:`sumnummonien` :emphasis:`must` use the same value\n        of :math:`n_0` as was used here.\n        \n        ::\n        \n            ? \\p300\n            ? sumnummonien(n = 1, n^-2*log(n)) + zeta'(2)\n            time = 328 ms.\n            %1 = -1.323[...]E-6 \\\\ completely wrong, f does not satisfy hypotheses !\n            ? tab = sumnummonieninit(, 1); \\\\ codes w(n) = log(n)\n            time = 3,993 ms.\n            ? sumnummonien(n = 1, n^-2, tab) + zeta'(2)\n            time = 41 ms.\n            %3 = -5.562684646268003458 E-309 \\\\ now perfect\n            \n            ? tab = sumnummonieninit(, n->log""(n)); \\\\ generic, slower\n            time = 9,808 ms.\n            ? sumnummonien(n = 1, n^-2, tab) + zeta'(2)\n            time = 40 ms.\n            %5 = -5.562684646268003458 E-309 \\\\ identical result\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1553sumnummonieninit(PyObject *__pyx_v_asymp, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_n0 = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnummonieninit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_n0,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[0] = ((PyObject *)Py_None);
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n0);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnummonieninit") < 0)) __PYX_ERR(10, 26552, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_w = values[0];
    __pyx_v_n0 = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26552, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnummonieninit", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26552, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnummonieninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1552sumnummonieninit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_asymp), __pyx_v_w, __pyx_v_n0, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1552sumnummonieninit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_asymp, PyObject *__pyx_v_w, PyObject *__pyx_v_n0, long __pyx_v_precision) {
  int __pyx_v__have_w;
  int __pyx_v__have_n0;
  GEN __pyx_v__asymp;
  GEN __pyx_v__w;
  GEN __pyx_v__n0;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("sumnummonieninit", 0);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_n0);

  /* "cypari/auto_gen.pxi":26655
 *             %5 = -5.562684646268003458 E-309 \\ identical result
 *         '''
 *         cdef bint _have_w = (w is not None)             # <<<<<<<<<<<<<<
 *         if _have_w:
 *             w = objtogen(w)
 */
  __pyx_t_1 = (__pyx_v_w != Py_None);
  __pyx_v__have_w = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26656
 *         '''
 *         cdef bint _have_w = (w is not None)
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 */
  __pyx_t_1 = (__pyx_v__have_w != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26657
 *         cdef bint _have_w = (w is not None)
 *         if _have_w:
 *             w = objtogen(w)             # <<<<<<<<<<<<<<
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_w, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26657, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":26656
 *         '''
 *         cdef bint _have_w = (w is not None)
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 */
  }

  /* "cypari/auto_gen.pxi":26658
 *         if _have_w:
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)             # <<<<<<<<<<<<<<
 *         if _have_n0:
 *             n0 = objtogen(n0)
 */
  __pyx_t_1 = (__pyx_v_n0 != Py_None);
  __pyx_v__have_n0 = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26659
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             n0 = objtogen(n0)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_n0 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26660
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:
 *             n0 = objtogen(n0)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n0, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_n0, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":26659
 *             w = objtogen(w)
 *         cdef bint _have_n0 = (n0 is not None)
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             n0 = objtogen(n0)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26661
 *         if _have_n0:
 *             n0 = objtogen(n0)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26661, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26662
 *             n0 = objtogen(n0)
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g             # <<<<<<<<<<<<<<
 *         cdef GEN _w = NULL
 *         if _have_w:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_asymp)->__pyx_base.g;
  __pyx_v__asymp = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26663
 *         sig_on()
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL             # <<<<<<<<<<<<<<
 *         if _have_w:
 *             _w = (<Gen>w).g
 */
  __pyx_v__w = NULL;

  /* "cypari/auto_gen.pxi":26664
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 */
  __pyx_t_1 = (__pyx_v__have_w != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26665
 *         cdef GEN _w = NULL
 *         if _have_w:
 *             _w = (<Gen>w).g             # <<<<<<<<<<<<<<
 *         cdef GEN _n0 = NULL
 *         if _have_n0:
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_w)->__pyx_base.g;
    __pyx_v__w = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26664
 *         cdef GEN _asymp = (<Gen>asymp).g
 *         cdef GEN _w = NULL
 *         if _have_w:             # <<<<<<<<<<<<<<
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 */
  }

  /* "cypari/auto_gen.pxi":26666
 *         if _have_w:
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL             # <<<<<<<<<<<<<<
 *         if _have_n0:
 *             _n0 = (<Gen>n0).g
 */
  __pyx_v__n0 = NULL;

  /* "cypari/auto_gen.pxi":26667
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_n0 != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26668
 *         cdef GEN _n0 = NULL
 *         if _have_n0:
 *             _n0 = (<Gen>n0).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n0)->__pyx_base.g;
    __pyx_v__n0 = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26667
 *             _w = (<Gen>w).g
 *         cdef GEN _n0 = NULL
 *         if _have_n0:             # <<<<<<<<<<<<<<
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":26669
 *         if _have_n0:
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26670
 *             _n0 = (<Gen>n0).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnummonieninit(__pyx_v__asymp, __pyx_v__w, __pyx_v__n0, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26671
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnummonieninit(_asymp, _w, _n0, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def sumnumrat(F, a, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26552
 *         return new_gen(_ret)
 * 
 *     def sumnummonieninit(asymp, w=None, n0=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initialize tables for Monien summation of a series :math:`\sum_{n >= n_0}
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnummonieninit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_n0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26673
 *         return new_gen(_ret)
 * 
 *     def sumnumrat(F, a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{n >= a}F(n)`, where :math:`F` is a rational function of degree less
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1555sumnumrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1554sumnumrat[] = "\n        :math:`\\sum_{n >= a}F(n)`, where :math:`F` is a rational function of degree less\n        than or equal to :math:`-2` and where poles of :math:`F` at integers :math:`>= a` are\n        omitted from the summation. The argument :math:`a` must be a :literal:`t_INT`\n        or :literal:`-oo`.\n        \n        ::\n        \n            ? sumnumrat(1/(x^2+1)^2,0)\n            %1 = 1.3068369754229086939178621382829073480\n            ? sumnumrat(1/x^2, -oo) \\\\ value at x=0 is discarded\n            %2 = 3.2898681336964528729448303332920503784\n            ? 2*zeta(2)\n            %3 = 3.2898681336964528729448303332920503784\n        \n        When :math:`\\deg F = -1`, we define\n        \n        .. MATH::\n        \n            \\sum_{- oo }^{ oo } F(n) := \\sum_{n >= 0} (F(n) + F(-1-n)):\n        \n        ::\n        \n            ? sumnumrat(1/x, -oo)\n            %4 = 0.E-38\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1555sumnumrat(PyObject *__pyx_v_F, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumnumrat (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_precision,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_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sumnumrat") < 0)) __PYX_ERR(10, 26673, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_a = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26673, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sumnumrat", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26673, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1554sumnumrat(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_F), __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1554sumnumrat(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_F, PyObject *__pyx_v_a, long __pyx_v_precision) {
  GEN __pyx_v__F;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("sumnumrat", 0);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":26700
 *             %4 = 0.E-38
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26701
 *         '''
 *         a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 26701, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26702
 *         a = objtogen(a)
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_F)->__pyx_base.g;
  __pyx_v__F = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26703
 *         sig_on()
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26704
 *         cdef GEN _F = (<Gen>F).g
 *         cdef GEN _a = (<Gen>a).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26705
 *         cdef GEN _a = (<Gen>a).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = sumnumrat(__pyx_v__F, __pyx_v__a, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26706
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = sumnumrat(_F, _a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def tan(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26706, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26673
 *         return new_gen(_ret)
 * 
 *     def sumnumrat(F, a, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`\sum_{n >= a}F(n)`, where :math:`F` is a rational function of degree less
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.sumnumrat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26708
 *         return new_gen(_ret)
 * 
 *     def tan(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1557tan(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1556tan[] = "\n        Tangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1557tan(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tan") < 0)) __PYX_ERR(10, 26708, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26708, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tan", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26708, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.tan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1556tan(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1556tan(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("tan", 0);

  /* "cypari/auto_gen.pxi":26712
 *         Tangent of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26712, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26713
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtan(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26714
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtan(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26715
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtan(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtan(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26716
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtan(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def tanh(x, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26708
 *         return new_gen(_ret)
 * 
 *     def tan(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Tangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.tan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26718
 *         return new_gen(_ret)
 * 
 *     def tanh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic tangent of :math:`x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1559tanh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1558tanh[] = "\n        Hyperbolic tangent of :math:`x`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1559tanh(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("tanh (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tanh") < 0)) __PYX_ERR(10, 26718, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26718, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("tanh", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26718, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.tanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1558tanh(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1558tanh(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("tanh", 0);

  /* "cypari/auto_gen.pxi":26722
 *         Hyperbolic tangent of :math:`x`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26722, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26723
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtanh(_x, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26724
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtanh(_x, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26725
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtanh(_x, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtanh(__pyx_v__x, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26726
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gtanh(_x, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def taylor(x, t, long serprec=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26718
 *         return new_gen(_ret)
 * 
 *     def tanh(x, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hyperbolic tangent of :math:`x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.tanh", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26728
 *         return new_gen(_ret)
 * 
 *     def taylor(x, t, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Taylor expansion around :math:`0` of :math:`x` with respect to
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1561taylor(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1560taylor[] = "\n        Taylor expansion around :math:`0` of :math:`x` with respect to\n        the simple variable :math:`t`. :math:`x` can be of any reasonable type, for example a\n        rational function. Contrary to :literal:`Ser`, which takes the valuation into\n        account, this function adds :math:`O(t^d)` to all components of :math:`x`.\n        \n        ::\n        \n            ? taylor(x/(1+y), y, 5)\n            %1 = (y^4 - y^3 + y^2 - y + 1)*x + O(y^5)\n            ? Ser(x/(1+y), y, 5)\n             *** at top-level: Ser(x/(1+y),y,5)\n             *** ^----------------\n             *** Ser: main variable must have higher priority in gtoser.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1561taylor(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_t = 0;
  long __pyx_v_serprec;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("taylor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_serprec,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_t)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_serprec);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "taylor") < 0)) __PYX_ERR(10, 26728, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_t = values[0];
    if (values[1]) {
      __pyx_v_serprec = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_serprec == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26728, __pyx_L3_error)
    } else {
      __pyx_v_serprec = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("taylor", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26728, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.taylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1560taylor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_t, __pyx_v_serprec);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1560taylor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_t, long __pyx_v_serprec) {
  long __pyx_v__t;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("taylor", 0);

  /* "cypari/auto_gen.pxi":26744
 *              *** Ser: main variable must have higher priority in gtoser.
 *         '''
 *         cdef long _t = get_var(t)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_t); if (unlikely(__pyx_t_1 == ((long)-2L))) __PYX_ERR(10, 26744, __pyx_L1_error)
  __pyx_v__t = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26745
 *         '''
 *         cdef long _t = get_var(t)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 26745, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26746
 *         cdef long _t = get_var(t)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26747
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 */
  __pyx_t_4 = ((__pyx_v_serprec < 0) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":26748
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 *         return new_gen(_ret)
 */
    __pyx_v_serprec = precdl;

    /* "cypari/auto_gen.pxi":26747
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         if serprec < 0:             # <<<<<<<<<<<<<<
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 */
  }

  /* "cypari/auto_gen.pxi":26749
 *         if serprec < 0:
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = tayl(__pyx_v__x, __pyx_v__t, __pyx_v_serprec);

  /* "cypari/auto_gen.pxi":26750
 *             serprec = precdl  # Global PARI series precision
 *         cdef GEN _ret = tayl(_x, _t, serprec)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def teichmuller(x, tab=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_5)) __PYX_ERR(10, 26750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26728
 *         return new_gen(_ret)
 * 
 *     def taylor(x, t, long serprec=-1):             # <<<<<<<<<<<<<<
 *         r'''
 *         Taylor expansion around :math:`0` of :math:`x` with respect to
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen_base.taylor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26752
 *         return new_gen(_ret)
 * 
 *     def teichmuller(x, tab=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Teichmller character of the :math:`p`-adic number :math:`x`, i.e. the unique
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1563teichmuller(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1562teichmuller[] = "\n        Teichm\303\274ller character of the :math:`p`-adic number :math:`x`, i.e. the unique\n        :math:`(p-1)`-th root of unity congruent to :math:`x / p^{v_p(x)}` modulo :math:`p`.\n        If :math:`x` is of the form :math:`[p,n]`, for a prime :math:`p` and integer :math:`n`,\n        return the lifts to :math:`\\mathbb{Z}` of the images of :math:`i + O(p^n)` for\n        :math:`i = 1,..., p-1`, i.e. all roots of :math:`1` ordered by residue class modulo\n        :math:`p`. Such a vector can be fed back to :literal:`teichmuller`, as the\n        optional argument :literal:`tab`, to speed up later computations.\n        \n        ::\n        \n            ? z = teichmuller(2 + O(101^5))\n            %1 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)\n            ? z^100\n            %2 = 1 + O(101^5)\n            ? T = teichmuller([101, 5]);\n            ? teichmuller(2 + O(101^5), T)\n            %4 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)\n        \n        As a rule of thumb, if more than\n        \n        .. MATH::\n        \n            p / 2(\\log_2(p) + hammingweight (p))\n        \n        values of :literal:`teichmuller` are to be computed, then it is worthwile to\n        initialize:\n        \n        ::\n        \n            ? p = 101; n = 100; T = teichmuller([p,n]); \\\\ instantaneous\n            ? for(i=1,10^3, vector(p-1, i, teichmuller(i+O(p^n), T)))\n            time = 60 ms.\n            ? for(i=1,10^3, vector(p-1, i, teichmuller(i+O(p^n))))\n            time = 1,293 ms.\n            ? 1 + 2*(log(p)/log(2) + hammingweight(p))\n            %8 = 22.316[...]\n        \n        Here the precompuation induces a speedup by a factor\n        :math:`1293/ 60 ~ 21.5`.\n        \n        :strong:`Caveat.`\n        If the accuracy of :literal:`tab` (the argument :math:`n` above) is lower than the\n        precision of :math:`x`, the :emphasis:`former` is used, i.e. the cached value is not\n        refined to higher accurac""y. It the accuracy of :literal:`tab` is larger, then\n        the precision of :math:`x` is used:\n        \n        ::\n        \n            ? Tlow = teichmuller([101, 2]); \\\\ lower accuracy !\n            ? teichmuller(2 + O(101^5), Tlow)\n            %10 = 2 + 83*101 + O(101^5) \\\\ no longer a root of 1\n            \n            ? Thigh = teichmuller([101, 10]); \\\\ higher accuracy\n            ? teichmuller(2 + O(101^5), Thigh)\n            %12 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1563teichmuller(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_tab = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("teichmuller (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tab,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tab);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "teichmuller") < 0)) __PYX_ERR(10, 26752, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_tab = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("teichmuller", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26752, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.teichmuller", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1562teichmuller(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_tab);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1562teichmuller(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_tab) {
  int __pyx_v__have_tab;
  GEN __pyx_v__x;
  GEN __pyx_v__tab;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("teichmuller", 0);
  __Pyx_INCREF(__pyx_v_tab);

  /* "cypari/auto_gen.pxi":26810
 *             %12 = 2 + 83*101 + 18*101^2 + 69*101^3 + 62*101^4 + O(101^5)
 *         '''
 *         cdef bint _have_tab = (tab is not None)             # <<<<<<<<<<<<<<
 *         if _have_tab:
 *             tab = objtogen(tab)
 */
  __pyx_t_1 = (__pyx_v_tab != Py_None);
  __pyx_v__have_tab = __pyx_t_1;

  /* "cypari/auto_gen.pxi":26811
 *         '''
 *         cdef bint _have_tab = (tab is not None)
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             tab = objtogen(tab)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_tab != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26812
 *         cdef bint _have_tab = (tab is not None)
 *         if _have_tab:
 *             tab = objtogen(tab)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_tab, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26812, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_tab, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":26811
 *         '''
 *         cdef bint _have_tab = (tab is not None)
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             tab = objtogen(tab)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26813
 *         if _have_tab:
 *             tab = objtogen(tab)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26813, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26814
 *             tab = objtogen(tab)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _tab = NULL
 *         if _have_tab:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26815
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL             # <<<<<<<<<<<<<<
 *         if _have_tab:
 *             _tab = (<Gen>tab).g
 */
  __pyx_v__tab = NULL;

  /* "cypari/auto_gen.pxi":26816
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)
 */
  __pyx_t_1 = (__pyx_v__have_tab != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":26817
 *         cdef GEN _tab = NULL
 *         if _have_tab:
 *             _tab = (<Gen>tab).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = teichmuller(_x, _tab)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tab)->__pyx_base.g;
    __pyx_v__tab = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26816
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _tab = NULL
 *         if _have_tab:             # <<<<<<<<<<<<<<
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)
 */
  }

  /* "cypari/auto_gen.pxi":26818
 *         if _have_tab:
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = teichmuller(__pyx_v__x, __pyx_v__tab);

  /* "cypari/auto_gen.pxi":26819
 *             _tab = (<Gen>tab).g
 *         cdef GEN _ret = teichmuller(_x, _tab)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def theta(q, z, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 26819, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26752
 *         return new_gen(_ret)
 * 
 *     def teichmuller(x, tab=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Teichmller character of the :math:`p`-adic number :math:`x`, i.e. the unique
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.teichmuller", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tab);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26821
 *         return new_gen(_ret)
 * 
 *     def theta(q, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Jacobi sine theta-function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1565theta(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1564theta[] = "\n        Jacobi sine theta-function\n        \n        .. MATH::\n        \n            \\theta_1(z, q) = 2q^{1/4} \\sum_{n >= 0} (-1)^n q^{n(n+1)} \\sin ((2n+1)z).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1565theta(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("theta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_precision,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_z)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "theta") < 0)) __PYX_ERR(10, 26821, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26821, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("theta", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26821, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.theta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1564theta(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_q), __pyx_v_z, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1564theta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, PyObject *__pyx_v_z, long __pyx_v_precision) {
  GEN __pyx_v__q;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("theta", 0);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":26829
 *             \theta_1(z, q) = 2q^{1/4} \sum_{n >= 0} (-1)^n q^{n(n+1)} \sin ((2n+1)z).
 *         '''
 *         z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26829, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26830
 *         '''
 *         z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _z = (<Gen>z).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 26830, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26831
 *         z = objtogen(z)
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26832
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = theta(_q, _z, precision)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
  __pyx_v__z = __pyx_t_3;

  /* "cypari/auto_gen.pxi":26833
 *         cdef GEN _q = (<Gen>q).g
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = theta(_q, _z, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26834
 *         cdef GEN _z = (<Gen>z).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = theta(_q, _z, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = theta(__pyx_v__q, __pyx_v__z, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26835
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = theta(_q, _z, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def thetanullk(q, long k, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26821
 *         return new_gen(_ret)
 * 
 *     def theta(q, z, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Jacobi sine theta-function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.theta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26837
 *         return new_gen(_ret)
 * 
 *     def thetanullk(q, long k, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1567thetanullk(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1566thetanullk[] = "\n        :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1567thetanullk(PyObject *__pyx_v_q, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_k;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("thetanullk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,&__pyx_n_s_precision,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_k)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "thetanullk") < 0)) __PYX_ERR(10, 26837, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26837, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26837, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("thetanullk", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26837, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.thetanullk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1566thetanullk(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_q), __pyx_v_k, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1566thetanullk(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_q, long __pyx_v_k, long __pyx_v_precision) {
  GEN __pyx_v__q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("thetanullk", 0);

  /* "cypari/auto_gen.pxi":26841
 *         :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _q = (<Gen>q).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 26841, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26842
 *         '''
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thetanullk(_q, k, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_q)->__pyx_base.g;
  __pyx_v__q = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26843
 *         sig_on()
 *         cdef GEN _q = (<Gen>q).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = thetanullk(_q, k, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":26844
 *         cdef GEN _q = (<Gen>q).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thetanullk(_q, k, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = thetanullk(__pyx_v__q, __pyx_v_k, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":26845
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thetanullk(_q, k, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def thue(tnf, a, sol=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 26845, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26837
 *         return new_gen(_ret)
 * 
 *     def thetanullk(q, long k, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`k`-th derivative at :math:`z = 0` of :math:`theta (q,z)`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.thetanullk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26847
 *         return new_gen(_ret)
 * 
 *     def thue(tnf, a, sol=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all solutions of the equation
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1569thue(PyObject *__pyx_v_tnf, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1568thue[] = "\n        Returns all solutions of the equation\n        :math:`P(x,y) = a` in integers :math:`x` and :math:`y`, where :emphasis:`tnf` was created with\n        :math:`thueinit (P)`. If present, :emphasis:`sol` must contain the solutions of\n        :math:`\\mathrm{Norm} (x) = a` modulo units of positive norm in the number field\n        defined by :math:`P` (as computed by :literal:`bnfisintnorm`). If there are infinitely\n        many solutions, an error is issued.\n        \n        It is allowed to input directly the polynomial :math:`P` instead of a :emphasis:`tnf`,\n        in which case, the function first performs :literal:`thueinit(P,0)`. This is\n        very wasteful if more than one value of :math:`a` is required.\n        \n        If :emphasis:`tnf` was computed without assuming GRH (flag :math:`1` in :literal:`thueinit`),\n        then the result is unconditional. Otherwise, it depends in principle of the\n        truth of the GRH, but may still be unconditionally correct in some\n        favorable cases. The result is conditional on the GRH if\n        :math:`a != \302\261 1` and :math:`P` has a single irreducible rational factor, whose\n        attached tentative class number :math:`h` and regulator :math:`R` (as computed\n        assuming the GRH) satisfy\n        \n        - :math:`h > 1`,\n        \n        - :math:`R/0.2 > 1.5`.\n        \n        Here's how to solve the Thue equation :math:`x^{13} - 5y^{13} = - 4`:\n        \n        ::\n        \n            ? tnf = thueinit(x^13 - 5);\n            ? thue(tnf, -4)\n            %1 = [[1, 1]]\n        \n        In this case, one checks that :literal:`bnfinit(x^13 -5).no`\n        is :math:`1`. Hence, the only solution is :math:`(x,y) = (1,1)` and the result is\n        unconditional. On the other hand:\n        \n        ::\n        \n            ? P = x^3-2*x^2+3*x-17; tnf = thueinit(P);\n            ? thue(tnf, -15)\n            %2 = [[1, 1]] \\\\ a priori conditional on the GRH.\n            ""? K = bnfinit(P); K.no\n            %3 = 3\n            ? K.reg\n            %4 = 2.8682185139262873674706034475498755834\n        \n        This time the result is conditional. All results computed using this\n        particular :emphasis:`tnf` are likewise conditional, :emphasis:`except` for a right-hand\n        side of :math:`\302\261 1`.\n        The above result is in fact correct, so we did not just disprove the GRH:\n        \n        ::\n        \n            ? tnf = thueinit(x^3-2*x^2+3*x-17, 1 /*unconditional*/);\n            ? thue(tnf, -15)\n            %4 = [[1, 1]]\n        \n        Note that reducible or non-monic polynomials are allowed:\n        \n        ::\n        \n            ? tnf = thueinit((2*x+1)^5 * (4*x^3-2*x^2+3*x-17), 1);\n            ? thue(tnf, 128)\n            %2 = [[-1, 0], [1, 0]]\n        \n        Reducible polynomials are in fact much easier to handle.\n        \n        :strong:`Note.` When :math:`P` is irreducible without a real root, the default\n        strategy is to use brute force enumeration in time :math:`\\|a\\|^{1/\\deg P}` and\n        avoid computing a touch :emphasis:`bnf` attached to :math:`P`, see :literal:`thueinit`.\n        Besides reusing a quantity you might need for other purposes, the\n        default argument :emphasis:`sol` can also be used to use a different strategy\n        and prove that there are no solutions; of course you need to compute a\n        :emphasis:`bnf` on you own to obtain :emphasis:`sol`. If there :emphasis:`are` solutions\n        this won't help unless :math:`P` is quadratic, since the enumeration will be\n        performed in any case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1569thue(PyObject *__pyx_v_tnf, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_a = 0;
  PyObject *__pyx_v_sol = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("thue (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_sol,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_a)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sol);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "thue") < 0)) __PYX_ERR(10, 26847, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_a = values[0];
    __pyx_v_sol = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("thue", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26847, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.thue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1568thue(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_tnf), __pyx_v_a, __pyx_v_sol);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1568thue(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_tnf, PyObject *__pyx_v_a, PyObject *__pyx_v_sol) {
  int __pyx_v__have_sol;
  GEN __pyx_v__tnf;
  GEN __pyx_v__a;
  GEN __pyx_v__sol;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("thue", 0);
  __Pyx_INCREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_sol);

  /* "cypari/auto_gen.pxi":26925
 *         performed in any case.
 *         '''
 *         a = objtogen(a)             # <<<<<<<<<<<<<<
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":26926
 *         '''
 *         a = objtogen(a)
 *         cdef bint _have_sol = (sol is not None)             # <<<<<<<<<<<<<<
 *         if _have_sol:
 *             sol = objtogen(sol)
 */
  __pyx_t_2 = (__pyx_v_sol != Py_None);
  __pyx_v__have_sol = __pyx_t_2;

  /* "cypari/auto_gen.pxi":26927
 *         a = objtogen(a)
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             sol = objtogen(sol)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_sol != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":26928
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:
 *             sol = objtogen(sol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _tnf = (<Gen>tnf).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_sol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_sol, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":26927
 *         a = objtogen(a)
 *         cdef bint _have_sol = (sol is not None)
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             sol = objtogen(sol)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":26929
 *         if _have_sol:
 *             sol = objtogen(sol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _tnf = (<Gen>tnf).g
 *         cdef GEN _a = (<Gen>a).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 26929, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":26930
 *             sol = objtogen(sol)
 *         sig_on()
 *         cdef GEN _tnf = (<Gen>tnf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_tnf)->__pyx_base.g;
  __pyx_v__tnf = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26931
 *         sig_on()
 *         cdef GEN _tnf = (<Gen>tnf).g
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _sol = NULL
 *         if _have_sol:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_4;

  /* "cypari/auto_gen.pxi":26932
 *         cdef GEN _tnf = (<Gen>tnf).g
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL             # <<<<<<<<<<<<<<
 *         if _have_sol:
 *             _sol = (<Gen>sol).g
 */
  __pyx_v__sol = NULL;

  /* "cypari/auto_gen.pxi":26933
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 */
  __pyx_t_2 = (__pyx_v__have_sol != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":26934
 *         cdef GEN _sol = NULL
 *         if _have_sol:
 *             _sol = (<Gen>sol).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_sol)->__pyx_base.g;
    __pyx_v__sol = __pyx_t_4;

    /* "cypari/auto_gen.pxi":26933
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _sol = NULL
 *         if _have_sol:             # <<<<<<<<<<<<<<
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 */
  }

  /* "cypari/auto_gen.pxi":26935
 *         if _have_sol:
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = thue(__pyx_v__tnf, __pyx_v__a, __pyx_v__sol);

  /* "cypari/auto_gen.pxi":26936
 *             _sol = (<Gen>sol).g
 *         cdef GEN _ret = thue(_tnf, _a, _sol)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def thueinit(P, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 26936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26847
 *         return new_gen(_ret)
 * 
 *     def thue(tnf, a, sol=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns all solutions of the equation
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.thue", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_sol);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":26938
 *         return new_gen(_ret)
 * 
 *     def thueinit(P, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the :emphasis:`tnf` corresponding to :math:`P`, a non-constant
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1571thueinit(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1570thueinit[] = "\n        Initializes the :emphasis:`tnf` corresponding to :math:`P`, a non-constant\n        univariate polynomial with integer coefficients.\n        The result is meant to be used in conjunction with :literal:`thue` to solve Thue\n        equations :math:`P(X / Y)Y^{\\deg P} = a`, where :math:`a` is an integer. Accordingly,\n        :math:`P` must either have at least two distinct irreducible factors over :math:`\\mathbb{Q}`,\n        or have one irreducible factor :math:`T` with degree :math:`> 2` or two conjugate\n        complex roots: under these (necessary and sufficient) conditions, the\n        equation has finitely many integer solutions.\n        \n        ::\n        \n            ? S = thueinit(t^2+1);\n            ? thue(S, 5)\n            %2 = [[-2, -1], [-2, 1], [-1, -2], [-1, 2], [1, -2], [1, 2], [2, -1], [2, 1]]\n            ? S = thueinit(t+1);\n             *** at top-level: thueinit(t+1)\n             *** ^-------------\n             *** thueinit: domain error in thueinit: P = t + 1\n        \n        The hardest case is when :math:`\\deg P > 2` and :math:`P` is irreducible\n        with at least one real root. The routine then uses Bilu-Hanrot's algorithm.\n        \n        If :math:`flag` is non-zero, certify results unconditionally. Otherwise, assume\n        GRH, this being much faster of course. In the latter case, the result\n        may still be unconditionally correct, see :literal:`thue`. For instance in most\n        cases where :math:`P` is reducible (not a pure power of an irreducible), :emphasis:`or`\n        conditional computed class groups are trivial :emphasis:`or` the right hand side\n        is :math:`\302\2611`, then results are unconditional.\n        \n        :strong:`Note.` The general philosophy is to disprove the existence of large\n        solutions then to enumerate bounded solutions naively. The implementation\n        will overflow when there exist huge solutions and the equation has degree\n        :math:`> 2` (t""he quadratic imaginary case is special, since we can stick to\n        :literal:`bnfisintnorm`, there are no fundamental units):\n        \n        ::\n        \n            ? thue(t^3+2, 10^30)\n             *** at top-level: L=thue(t^3+2,10^30)\n             *** ^-----------------\n             *** thue: overflow in thue (SmallSols): y <= 80665203789619036028928.\n            ? thue(x^2+2, 10^30) \\\\ quadratic case much easier\n            %1 = [[-1000000000000000, 0], [1000000000000000, 0]]\n        \n        :strong:`Note.` It is sometimes possible to circumvent the above, and in any\n        case obtain an important speed-up, if you can write :math:`P = Q(x^d)` for some :math:`d >\n        1` and :math:`Q` still satisfying the :literal:`thueinit` hypotheses. You can then solve\n        the equation attached to :math:`Q` then eliminate all solutions :math:`(x,y)` such that\n        either :math:`x` or :math:`y` is not a :math:`d`-th power.\n        \n        ::\n        \n            ? thue(x^4+1, 10^40); \\\\ stopped after 10 hours\n            ? filter(L,d) =\n             my(x,y); [[x,y] | v<-L, ispower(v[1],d,&x)&&ispower(v[2],d,&y)];\n            ? L = thue(x^2+1, 10^40);\n            ? filter(L, 2)\n            %4 = [[0, 10000000000], [10000000000, 0]]\n        \n        The last 2 commands use less than 20ms.\n        \n        :strong:`Note.` When :math:`P` is irreducible without a real root, the equation\n        can be solved unconditionnally in time :math:`\\|a\\|^{1/\\deg P}`. When this\n        latter quantity is huge and the equation has no solutions, this fact\n        may still be ascertained via arithmetic conditions but this now implies\n        solving norm equations, computing a :emphasis:`bnf` and possibly assuming the GRH.\n        When there is no real root, the code does not compute a :emphasis:`bnf`\n        (with certification if :math:`flag = 1`) if it expects this to be an \"easy\"\n        computation (because the result would only ""be used for huge values of :math:`a`).\n        See :literal:`thue` for a way to compute an expensive :emphasis:`bnf` on your own and\n        still get a result where this default cheap strategy fails.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1571thueinit(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("thueinit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "thueinit") < 0)) __PYX_ERR(10, 26938, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26938, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 26938, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("thueinit", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 26938, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.thueinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1570thueinit(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_P), __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1570thueinit(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__P;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("thueinit", 0);

  /* "cypari/auto_gen.pxi":27012
 *         still get a result where this default cheap strategy fails.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27012, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27013
 *         '''
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thueinit(_P, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27014
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = thueinit(_P, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":27015
 *         cdef GEN _P = (<Gen>P).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thueinit(_P, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = thueinit(__pyx_v__P, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":27016
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = thueinit(_P, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def trace(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":26938
 *         return new_gen(_ret)
 * 
 *     def thueinit(P, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Initializes the :emphasis:`tnf` corresponding to :math:`P`, a non-constant
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.thueinit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27018
 *         return new_gen(_ret)
 * 
 *     def trace(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This applies to quite general :math:`x`. If :math:`x` is not a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1573trace(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1572trace[] = "\n        This applies to quite general :math:`x`. If :math:`x` is not a\n        matrix, it is equal to the sum of :math:`x` and its conjugate, except for polmods\n        where it is the trace as an algebraic number.\n        \n        For :math:`x` a square matrix, it is the ordinary trace. If :math:`x` is a\n        non-square matrix (but not a vector), an error occurs.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1573trace(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("trace (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1572trace(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1572trace(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("trace", 0);

  /* "cypari/auto_gen.pxi":27027
 *         non-square matrix (but not a vector), an error occurs.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrace(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27027, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27028
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gtrace(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27029
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrace(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gtrace(__pyx_v__x);

  /* "cypari/auto_gen.pxi":27030
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gtrace(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def type(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27030, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27018
 *         return new_gen(_ret)
 * 
 *     def trace(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This applies to quite general :math:`x`. If :math:`x` is not a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27032
 *         return new_gen(_ret)
 * 
 *     def type(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This is useful only under :literal:`gp`. Returns the internal type name of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1575type(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1574type[] = "\n        This is useful only under :literal:`gp`. Returns the internal type name of\n        the PARI object :math:`x` as a string. Check out existing type names with the\n        metacommand :literal:`\\\\t`. For example :literal:`type(1)` will return \":literal:`t_INT`\".\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1575type(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1574type(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1574type(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("type", 0);

  /* "cypari/auto_gen.pxi":27038
 *         metacommand :literal:`\\t`. For example :literal:`type(1)` will return ":literal:`t_INT`".
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = type0(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27038, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27039
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = type0(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27040
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = type0(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = type0(__pyx_v__x);

  /* "cypari/auto_gen.pxi":27041
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = type0(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def valuation(x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27032
 *         return new_gen(_ret)
 * 
 *     def type(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         This is useful only under :literal:`gp`. Returns the internal type name of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27043
 *         return new_gen(_ret)
 * 
 *     def valuation(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the highest
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1577valuation(PyObject *__pyx_v_x, PyObject *__pyx_v_p); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1576valuation[] = "\n        Computes the highest\n        exponent of :math:`p` dividing :math:`x`. If :math:`p` is of type integer, :math:`x` must be an\n        integer, an intmod whose modulus is divisible by :math:`p`, a fraction, a\n        :math:`q`-adic number with :math:`q = p`, or a polynomial or power series in which case the\n        valuation is the minimum of the valuation of the coefficients.\n        \n        If :math:`p` is of type polynomial, :math:`x` must be of type polynomial or rational\n        function, and also a power series if :math:`x` is a monomial. Finally, the\n        valuation of a vector, complex or quadratic number is the minimum of the\n        component valuations.\n        \n        If :math:`x = 0`, the result is :literal:`+oo` if :math:`x` is an exact object. If :math:`x` is a\n        :math:`p`-adic numbers or power series, the result is the exponent of the zero.\n        Any other type combinations gives an error.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1577valuation(PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("valuation (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1576valuation(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), ((PyObject *)__pyx_v_p));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1576valuation(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_p) {
  GEN __pyx_v__x;
  GEN __pyx_v__p;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("valuation", 0);
  __Pyx_INCREF(__pyx_v_p);

  /* "cypari/auto_gen.pxi":27060
 *         Any other type combinations gives an error.
 *         '''
 *         p = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27061
 *         '''
 *         p = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27061, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27062
 *         p = objtogen(p)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gpvaluation(_x, _p)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27063
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpvaluation(_x, _p)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_p)->__pyx_base.g;
  __pyx_v__p = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27064
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gpvaluation(_x, _p)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpvaluation(__pyx_v__x, __pyx_v__p);

  /* "cypari/auto_gen.pxi":27065
 *         cdef GEN _p = (<Gen>p).g
 *         cdef GEN _ret = gpvaluation(_x, _p)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def variable(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27043
 *         return new_gen(_ret)
 * 
 *     def valuation(x, p):             # <<<<<<<<<<<<<<
 *         r'''
 *         Computes the highest
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.valuation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27067
 *         return new_gen(_ret)
 * 
 *     def variable(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the main variable of the object :math:`x` (the variable with the highest
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1579variable(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1578variable[] = "\n        Gives the main variable of the object :math:`x` (the variable with the highest\n        priority used in :math:`x`), and :math:`p` if :math:`x` is a :math:`p`-adic number. Return :math:`0` if\n        :math:`x` has no variable attached to it.\n        \n        ::\n        \n            ? variable(x^2 + y)\n            %1 = x\n            ? variable(1 + O(5^2))\n            %2 = 5\n            ? variable([x,y,z,t])\n            %3 = x\n            ? variable(1)\n            %4 = 0\n        \n        The construction\n        \n        ::\n        \n             if (!variable(x),...)\n        \n        can be used to test whether a variable is attached to :math:`x`.\n        \n        If :math:`x` is omitted, returns the list of user variables known to the\n        interpreter, by order of decreasing priority. (Highest priority is initially\n        :math:`x`, which come first until :literal:`varhigher` is used.) If :literal:`varhigher`\n        or :literal:`varlower` are used, it is quite possible to end up with different\n        variables (with different priorities) printed in the same way: they\n        will then appear multiple times in the output:\n        \n        ::\n        \n            ? varhigher(\"y\");\n            ? varlower(\"y\");\n            ? variable()\n            %4 = [y, x, y]\n        \n        Using :literal:`v = variable()` then :literal:`v[1]`, :literal:`v[2]`,\n        etc.\302\240allows to recover and use existing variables.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1579variable(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("variable (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1578variable(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1578variable(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("variable", 0);

  /* "cypari/auto_gen.pxi":27109
 *         etc.allows to recover and use existing variables.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpolvar(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27109, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27110
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gpolvar(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27111
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpolvar(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gpolvar(__pyx_v__x);

  /* "cypari/auto_gen.pxi":27112
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = gpolvar(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def variables(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27112, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27067
 *         return new_gen(_ret)
 * 
 *     def variable(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the main variable of the object :math:`x` (the variable with the highest
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.variable", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27114
 *         return new_gen(_ret)
 * 
 *     def variables(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the list of all variables occuring in object :math:`x` (all user
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1581variables(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1580variables[] = "\n        Returns the list of all variables occuring in object :math:`x` (all user\n        variables known to the interpreter if :math:`x` is omitted), sorted by\n        decreasing priority.\n        \n        ::\n        \n            ? variables([x^2 + y*z + O(t), a+x])\n            %1 = [x, y, z, t, a]\n        \n        The construction\n        \n        ::\n        \n             if (!variables(x),...)\n        \n        can be used to test whether a variable is attached to :math:`x`.\n        \n        If :literal:`varhigher` or :literal:`varlower` are used, it is quite possible to end up\n        with different variables (with different priorities) printed in the same\n        way: they will then appear multiple times in the output:\n        \n        ::\n        \n            ? y1 = varhigher(\"y\");\n            ? y2 = varlower(\"y\");\n            ? variables(y*y1*y2)\n            %4 = [y, y, y]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1581variables(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("variables (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1580variables(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1580variables(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("variables", 0);

  /* "cypari/auto_gen.pxi":27144
 *             %4 = [y, y, y]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = variables_vec(_x)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27144, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27145
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = variables_vec(_x)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27146
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = variables_vec(_x)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = variables_vec(__pyx_v__x);

  /* "cypari/auto_gen.pxi":27147
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _ret = variables_vec(_x)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecextract(x, y, z=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27147, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27114
 *         return new_gen(_ret)
 * 
 *     def variables(x):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns the list of all variables occuring in object :math:`x` (all user
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.variables", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27149
 *         return new_gen(_ret)
 * 
 *     def vecextract(x, y, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extraction of components of the vector or matrix :math:`x` according to :math:`y`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1583vecextract(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1582vecextract[] = "\n        Extraction of components of the vector or matrix :math:`x` according to :math:`y`.\n        In case :math:`x` is a matrix, its components are the :emphasis:`columns` of :math:`x`. The\n        parameter :math:`y` is a component specifier, which is either an integer, a string\n        describing a range, or a vector.\n        \n        If :math:`y` is an integer, it is considered as a mask: the binary bits of :math:`y` are\n        read from right to left, but correspond to taking the components from left to\n        right. For example, if :math:`y = 13 = (1101)_2` then the components 1,3 and 4 are\n        extracted.\n        \n        If :math:`y` is a vector (:literal:`t_VEC`, :literal:`t_COL` or :literal:`t_VECSMALL`), which must have\n        integer entries, these entries correspond to the component numbers to be\n        extracted, in the order specified.\n        \n        If :math:`y` is a string, it can be\n        \n        - a single (non-zero) index giving a component number (a negative\n          index means we start counting from the end).\n        \n        - a range of the form :literal:`\":math:`a`..:math:`b`\"`, where :math:`a` and :math:`b` are\n          indexes as above. Any of :math:`a` and :math:`b` can be omitted; in this case, we take\n          as default values :math:`a = 1` and :math:`b = -1`, i.e.\302\240the first and last components\n          respectively. We then extract all components in the interval :math:`[a,b]`, in\n          reverse order if :math:`b < a`.\n        \n        In addition, if the first character in the string is :literal:`^`, the\n        complement of the given set of indices is taken.\n        \n        If :math:`z` is not omitted, :math:`x` must be a matrix. :math:`y` is then the :emphasis:`row`\n        specifier, and :math:`z` the :emphasis:`column` specifier, where the component specifier\n        is as explained above.\n        \n        ::\n        \n            ? v = [a, b, c, d, e];\n           "" ? vecextract(v, 5) \\\\ mask\n            %1 = [a, c]\n            ? vecextract(v, [4, 2, 1]) \\\\ component list\n            %2 = [d, b, a]\n            ? vecextract(v, \"2..4\") \\\\ interval\n            %3 = [b, c, d]\n            ? vecextract(v, \"-1..-3\") \\\\ interval + reverse order\n            %4 = [e, d, c]\n            ? vecextract(v, \"^2\") \\\\ complement\n            %5 = [a, c, d, e]\n            ? vecextract(matid(3), \"2..\", \"..\")\n            %6 =\n            [0 1 0]\n            \n            [0 0 1]\n        \n        The range notations :literal:`v[i..j]` and :literal:`v[^i]` (for :literal:`t_VEC` or\n        :literal:`t_COL`) and :literal:`M[i..j, k..l]` and friends (for :literal:`t_MAT`) implement a\n        subset of the above, in a simpler and :emphasis:`faster` way, hence should be\n        preferred in most common situations. The following features are not\n        implemented in the range notation:\n        \n        - reverse order,\n        \n        - omitting either :math:`a` or :math:`b` in :literal:`:math:`a`..:math:`b``.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1583vecextract(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_z = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecextract (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_y,&__pyx_n_s_z,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_y)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vecextract") < 0)) __PYX_ERR(10, 27149, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_y = values[0];
    __pyx_v_z = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vecextract", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27149, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecextract", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1582vecextract(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_y, __pyx_v_z);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1582vecextract(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) {
  int __pyx_v__have_z;
  GEN __pyx_v__x;
  GEN __pyx_v__y;
  GEN __pyx_v__z;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("vecextract", 0);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_z);

  /* "cypari/auto_gen.pxi":27212
 *         - omitting either :math:`a` or :math:`b` in :literal:`:math:`a`..:math:`b``.
 *         '''
 *         y = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27213
 *         '''
 *         y = objtogen(y)
 *         cdef bint _have_z = (z is not None)             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             z = objtogen(z)
 */
  __pyx_t_2 = (__pyx_v_z != Py_None);
  __pyx_v__have_z = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27214
 *         y = objtogen(y)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":27215
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:
 *             z = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27215, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_z, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":27214
 *         y = objtogen(y)
 *         cdef bint _have_z = (z is not None)
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             z = objtogen(z)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":27216
 *         if _have_z:
 *             z = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 27216, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27217
 *             z = objtogen(z)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27218
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g             # <<<<<<<<<<<<<<
 *         cdef GEN _z = NULL
 *         if _have_z:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_y)->__pyx_base.g;
  __pyx_v__y = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27219
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL             # <<<<<<<<<<<<<<
 *         if _have_z:
 *             _z = (<Gen>z).g
 */
  __pyx_v__z = NULL;

  /* "cypari/auto_gen.pxi":27220
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)
 */
  __pyx_t_2 = (__pyx_v__have_z != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":27221
 *         cdef GEN _z = NULL
 *         if _have_z:
 *             _z = (<Gen>z).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = extract0(_x, _y, _z)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_z)->__pyx_base.g;
    __pyx_v__z = __pyx_t_4;

    /* "cypari/auto_gen.pxi":27220
 *         cdef GEN _y = (<Gen>y).g
 *         cdef GEN _z = NULL
 *         if _have_z:             # <<<<<<<<<<<<<<
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)
 */
  }

  /* "cypari/auto_gen.pxi":27222
 *         if _have_z:
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = extract0(__pyx_v__x, __pyx_v__y, __pyx_v__z);

  /* "cypari/auto_gen.pxi":27223
 *             _z = (<Gen>z).g
 *         cdef GEN _ret = extract0(_x, _y, _z)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecprod(v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27223, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27149
 *         return new_gen(_ret)
 * 
 *     def vecextract(x, y, z=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Extraction of components of the vector or matrix :math:`x` according to :math:`y`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecextract", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_z);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27225
 *         return new_gen(_ret)
 * 
 *     def vecprod(v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the product of the components of the vector :math:`v`. Return :math:`1` on an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1585vecprod(PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1584vecprod[] = "\n        Return the product of the components of the vector :math:`v`. Return :math:`1` on an\n        empty vector.\n        \n        ::\n        \n            ? vecprod([1,2,3])\n            %1 = 6\n            ? vecprod([])\n            %2 = 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1585vecprod(PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecprod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1584vecprod(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1584vecprod(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("vecprod", 0);

  /* "cypari/auto_gen.pxi":27237
 *             %2 = 1
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecprod(_v)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27237, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27238
 *         '''
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = vecprod(_v)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27239
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecprod(_v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = vecprod(__pyx_v__v);

  /* "cypari/auto_gen.pxi":27240
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecprod(_v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecsearch(v, x, cmpf=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27225
 *         return new_gen(_ret)
 * 
 *     def vecprod(v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the product of the components of the vector :math:`v`. Return :math:`1` on an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecprod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27242
 *         return new_gen(_ret)
 * 
 *     def vecsearch(v, x, cmpf=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the sorted vector or list :math:`v`: return
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1587vecsearch(PyObject *__pyx_v_v, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1586vecsearch[] = "\n        Determines whether :math:`x` belongs to the sorted vector or list :math:`v`: return\n        the (positive) index where :math:`x` was found, or :math:`0` if it does not belong to\n        :math:`v`.\n        \n        If the comparison function cmpf is omitted, we assume that :math:`v` is sorted in\n        increasing order, according to the standard comparison function :literal:`lex`,\n        thereby restricting the possible types for :math:`x` and the elements of :math:`v`\n        (integers, fractions, reals, and vectors of such). We also transparently\n        allow a :literal:`t_VECSMALL` :math:`x` in this case, for the natural ordering of the\n        integers.\n        \n        If :literal:`cmpf` is present, it is understood as a comparison function and we\n        assume that :math:`v` is sorted according to it, see :literal:`vecsort` for how to\n        encode comparison functions.\n        \n        ::\n        \n            ? v = [1,3,4,5,7];\n            ? vecsearch(v, 3)\n            %2 = 2\n            ? vecsearch(v, 6)\n            %3 = 0 \\\\ not in the list\n            ? vecsearch([7,6,5], 5) \\\\ unsorted vector: result undefined\n            %4 = 0\n        \n        Note that if we are sorting with respect to a key\n        which is expensive to compute (e.g. a discriminant), one should rather\n        precompute all keys, sort that vector and search in the vector of keys,\n        rather than searching in the original vector with respect to a comparison\n        function.\n        \n        By abuse of notation, :math:`x` is also allowed to be a matrix, seen as a vector\n        of its columns; again by abuse of notation, a :literal:`t_VEC` is considered\n        as part of the matrix, if its transpose is one of the matrix columns.\n        \n        ::\n        \n            ? v = vecsort([3,0,2; 1,0,2]) \\\\ sort matrix columns according to lex order\n            %1 =\n            [0 2 3]\n            \n            [0 2 1]\n      ""      ? vecsearch(v, [3,1]~)\n            %2 = 3\n            ? vecsearch(v, [3,1]) \\\\ can search for x or x~\n            %3 = 3\n            ? vecsearch(v, [1,2])\n            %4 = 0 \\\\ not in the list\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1587vecsearch(PyObject *__pyx_v_v, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_cmpf = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecsearch (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_cmpf,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmpf);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vecsearch") < 0)) __PYX_ERR(10, 27242, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_cmpf = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vecsearch", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27242, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1586vecsearch(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_v), __pyx_v_x, __pyx_v_cmpf);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1586vecsearch(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v, PyObject *__pyx_v_x, PyObject *__pyx_v_cmpf) {
  int __pyx_v__have_cmpf;
  GEN __pyx_v__v;
  GEN __pyx_v__x;
  GEN __pyx_v__cmpf;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("vecsearch", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_cmpf);

  /* "cypari/auto_gen.pxi":27293
 *             %4 = 0 \\ not in the list
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27294
 *         '''
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 */
  __pyx_t_2 = (__pyx_v_cmpf != Py_None);
  __pyx_v__have_cmpf = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27295
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":27296
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cmpf, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_cmpf, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":27295
 *         x = objtogen(x)
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":27297
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 27297, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27298
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27299
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27300
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 */
  __pyx_v__cmpf = NULL;

  /* "cypari/auto_gen.pxi":27301
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 */
  __pyx_t_2 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":27302
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 *         clear_stack()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cmpf)->__pyx_base.g;
    __pyx_v__cmpf = __pyx_t_4;

    /* "cypari/auto_gen.pxi":27301
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 */
  }

  /* "cypari/auto_gen.pxi":27303
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = vecsearch(__pyx_v__v, __pyx_v__x, __pyx_v__cmpf);

  /* "cypari/auto_gen.pxi":27304
 *             _cmpf = (<Gen>cmpf).g
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":27305
 *         cdef long _ret = vecsearch(_v, _x, _cmpf)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def vecsort(x, cmpf=None, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27242
 *         return new_gen(_ret)
 * 
 *     def vecsearch(v, x, cmpf=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         Determines whether :math:`x` belongs to the sorted vector or list :math:`v`: return
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecsearch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_cmpf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27307
 *         return _ret
 * 
 *     def vecsort(x, cmpf=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the vector :math:`x` in ascending order, using a mergesort method.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1589vecsort(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1588vecsort[] = "\n        Sorts the vector :math:`x` in ascending order, using a mergesort method.\n        :math:`x` must be a list, vector or matrix (seen as a vector of its columns).\n        Note that mergesort is stable, hence the initial ordering of \"equal\"\n        entries (with respect to the sorting criterion) is not changed.\n        \n        If :literal:`cmpf` is omitted, we use the standard comparison function\n        :literal:`lex`, thereby restricting the possible types for the elements of :math:`x`\n        (integers, fractions or reals and vectors of those). We also transparently\n        allow a :literal:`t_VECSMALL` :math:`x` in this case, for the standard ordering on the\n        integers.\n        \n        If :literal:`cmpf` is present, it is understood as a comparison function and we\n        sort according to it. The following possibilities exist:\n        \n        - an integer :math:`k`: sort according to the value of the :math:`k`-th\n          subcomponents of the components of\302\240:math:`x`.\n        \n        - a vector: sort lexicographically according to the components listed in\n          the vector. For example, if :math:`cmpf = [2,1,3]`, sort with respect to\n          the second component, and when these are equal, with respect to the first,\n          and when these are equal, with respect to the third.\n        \n        - a comparison function: :literal:`t_CLOSURE` with two arguments :math:`x` and :math:`y`,\n          and returning a real number which is :math:`< 0`, :math:`> 0` or :math:`= 0` if :math:`x < y`, :math:`x > y` or\n          :math:`x = y` respectively.\n        \n        - a key: :literal:`t_CLOSURE` with one argument :math:`x` and returning\n          the value :math:`f(x)` with respect to which we sort.\n        \n        ::\n        \n            ? vecsort([3,0,2; 1,0,2]) \\\\ sort columns according to lex order\n            %1 =\n            [0 2 3]\n            \n            [0 2 1]\n            ? vecsort(v, (x,y)->y-""x) \\\\ reverse sort\n            ? vecsort(v, (x,y)->abs(x)-abs(y)) \\\\ sort by increasing absolute value\n            ? vecsort(v, abs) \\\\ sort by increasing absolute value, using key\n            ? cmpf(x,y) = my(dx = poldisc(x), dy = poldisc(y)); abs(dx) - abs(dy);\n            ? v = [x^2+1, x^3-2, x^4+5*x+1] vecsort(v, cmpf) \\\\ comparison function\n            ? vecsort(v, x->abs(poldisc(x))) \\\\ key\n        \n        The :literal:`abs` and :literal:`cmpf` examples show how to use a named function\n        instead of an anonymous function. It is preferable to use a :emphasis:`key`\n        whenever possible rather than include it in the comparison function as above\n        since the key is evaluated :math:`O(n)` times instead of :math:`O(n\\log n)`,\n        where :math:`n` is the number of entries.\n        \n        A direct approach is also possible and equivalent to using a sorting key:\n        \n        ::\n        \n            ? T = [abs(poldisc(x)) | x<-v];\n            ? perm = vecsort(T,,1); \\\\ indirect sort\n            ? vecextract(v, perm)\n        \n        This also provides the vector :math:`T` of all keys, which is\n        interesting for instance in later :literal:`vecsearch` calls: it is more\n        efficient to sort :math:`T` (:literal:`T = vecextract(T, perm)`) then search for a key\n        in :math:`T` rather than to search in :math:`v` using a comparison function or a key.\n        Note also that :literal:`mapisdefined` is often easier to use and faster than\n        :literal:`vecsearch`.\n        \n        The binary digits of :emphasis:`flag` mean:\n        \n        - 1: indirect sorting of the vector :math:`x`, i.e.\302\240if :math:`x` is an\n          :math:`n`-component vector, returns a permutation of :math:`[1,2,...,n]` which\n          applied to the components of :math:`x` sorts :math:`x` in increasing order.\n          For example, :literal:`vecextract(x, vecsort(x,,1))` is equivalent to\n          :literal:`vecs""ort(x)`.\n        \n        - 4: use descending instead of ascending order.\n        \n        - 8: remove \"duplicate\" entries with respect to the sorting function\n          (keep the first occurring entry). For example:\n        \n        ::\n        \n             ? vecsort([Pi,Mod(1,2),z], (x,y)->0, 8) \\\\ make everything compare equal\n             %1 = [3.141592653589793238462643383]\n             ? vecsort([[2,3],[0,1],[0,3]], 2, 8)\n             %2 = [[0, 1], [2, 3]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1589vecsort(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cmpf = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecsort (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cmpf,&__pyx_n_s_flag,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmpf);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vecsort") < 0)) __PYX_ERR(10, 27307, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_cmpf = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27307, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("vecsort", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27307, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1588vecsort(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_cmpf, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1588vecsort(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_cmpf, long __pyx_v_flag) {
  int __pyx_v__have_cmpf;
  GEN __pyx_v__x;
  GEN __pyx_v__cmpf;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("vecsort", 0);
  __Pyx_INCREF(__pyx_v_cmpf);

  /* "cypari/auto_gen.pxi":27393
 *              %2 = [[0, 1], [2, 3]]
 *         '''
 *         cdef bint _have_cmpf = (cmpf is not None)             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 */
  __pyx_t_1 = (__pyx_v_cmpf != Py_None);
  __pyx_v__have_cmpf = __pyx_t_1;

  /* "cypari/auto_gen.pxi":27394
 *         '''
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":27395
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_cmpf, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 27395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_cmpf, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":27394
 *         '''
 *         cdef bint _have_cmpf = (cmpf is not None)
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":27396
 *         if _have_cmpf:
 *             cmpf = objtogen(cmpf)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 27396, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27397
 *             cmpf = objtogen(cmpf)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27398
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL             # <<<<<<<<<<<<<<
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 */
  __pyx_v__cmpf = NULL;

  /* "cypari/auto_gen.pxi":27399
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 */
  __pyx_t_1 = (__pyx_v__have_cmpf != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":27400
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_cmpf)->__pyx_base.g;
    __pyx_v__cmpf = __pyx_t_4;

    /* "cypari/auto_gen.pxi":27399
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _cmpf = NULL
 *         if _have_cmpf:             # <<<<<<<<<<<<<<
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 */
  }

  /* "cypari/auto_gen.pxi":27401
 *         if _have_cmpf:
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = vecsort0(__pyx_v__x, __pyx_v__cmpf, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":27402
 *             _cmpf = (<Gen>cmpf).g
 *         cdef GEN _ret = vecsort0(_x, _cmpf, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def vecsum(v):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 27402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27307
 *         return _ret
 * 
 *     def vecsort(x, cmpf=None, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Sorts the vector :math:`x` in ascending order, using a mergesort method.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecsort", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cmpf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27404
 *         return new_gen(_ret)
 * 
 *     def vecsum(v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the sum of the components of the vector :math:`v`. Return :math:`0` on an
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1591vecsum(PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1590vecsum[] = "\n        Return the sum of the components of the vector :math:`v`. Return :math:`0` on an\n        empty vector.\n        \n        ::\n        \n            ? vecsum([1,2,3])\n            %1 = 6\n            ? vecsum([])\n            %2 = 0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1591vecsum(PyObject *__pyx_v_v, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecsum (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1590vecsum(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_v));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1590vecsum(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_v) {
  GEN __pyx_v__v;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("vecsum", 0);

  /* "cypari/auto_gen.pxi":27416
 *             %2 = 0
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecsum(_v)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27416, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27417
 *         '''
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = vecsum(_v)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_v)->__pyx_base.g;
  __pyx_v__v = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27418
 *         sig_on()
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecsum(_v)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = vecsum(__pyx_v__v);

  /* "cypari/auto_gen.pxi":27419
 *         cdef GEN _v = (<Gen>v).g
 *         cdef GEN _ret = vecsum(_v)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def weber(x, long flag=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27419, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27404
 *         return new_gen(_ret)
 * 
 *     def vecsum(v):             # <<<<<<<<<<<<<<
 *         r'''
 *         Return the sum of the components of the vector :math:`v`. Return :math:`0` on an
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.vecsum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27421
 *         return new_gen(_ret)
 * 
 *     def weber(x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         One of Weber's three :math:`f` functions.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1593weber(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1592weber[] = "\n        One of Weber's three :math:`f` functions.\n        If :math:`flag = 0`, returns\n        \n        .. MATH::\n        \n            f(x) = \\exp (-i\\pi/24).\\eta ((x+1)/2)/\\eta (x) {such that}\n            j = (f^{24}-16)^3/f^{24},\n        \n        where :math:`j` is the elliptic :math:`j`-invariant (see the function :literal:`ellj`).\n        If :math:`flag = 1`, returns\n        \n        .. MATH::\n        \n            f_1(x) = \\eta (x/2)/\\eta (x) {such that}\n            j = (f_1^{24}+16)^3/f_1^{24}.\n        \n        Finally, if :math:`flag = 2`, returns\n        \n        .. MATH::\n        \n            f_2(x) = \\sqrt{2}\\eta (2x)/\\eta (x) {such that}\n            j = (f_2^{24}+16)^3/f_2^{24}.\n        \n        Note the identities :math:`f^8 = f_1^8+f_2^8` and :math:`ff_1f_2 = \\sqrt2`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1593weber(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("weber (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weber") < 0)) __PYX_ERR(10, 27421, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27421, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27421, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("weber", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27421, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.weber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1592weber(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1592weber(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, long __pyx_v_flag, long __pyx_v_precision) {
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("weber", 0);

  /* "cypari/auto_gen.pxi":27448
 *         Note the identities :math:`f^8 = f_1^8+f_2^8` and :math:`ff_1f_2 = \sqrt2`.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27448, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27449
 *         '''
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = weber0(_x, flag, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27450
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = weber0(_x, flag, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":27451
 *         cdef GEN _x = (<Gen>x).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = weber0(_x, flag, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = weber0(__pyx_v__x, __pyx_v_flag, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":27452
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = weber0(_x, flag, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zeta(s, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27452, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27421
 *         return new_gen(_ret)
 * 
 *     def weber(x, long flag=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         One of Weber's three :math:`f` functions.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.weber", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27454
 *         return new_gen(_ret)
 * 
 *     def zeta(s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s != 1` a complex number, Riemann's zeta
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1595zeta(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1594zeta[] = "\n        For :math:`s != 1` a complex number, Riemann's zeta\n        function :math:`\\zeta (s) = \\sum_{n >= 1}n^{-s}`,\n        computed using the Euler-Maclaurin summation formula, except\n        when :math:`s` is of type integer, in which case it is computed using\n        Bernoulli numbers for :math:`s <= 0` or :math:`s > 0` and\n        even, and using modular forms for :math:`s > 0` and odd. Power series\n        are also allowed:\n        \n        ::\n        \n            ? zeta(2) - Pi^2/6\n            %1 = 0.E-38\n            ? zeta(1+x+O(x^3))\n            %2 = 1.0000000000000000000000000000000000000*x^-1 + \\\n             0.57721566490153286060651209008240243104 + O(x)\n        \n        For :math:`s != 1` a :math:`p`-adic number, Kubota-Leopoldt zeta function at :math:`s`, that\n        is the unique continuous :math:`p`-adic function on the :math:`p`-adic integers\n        that interpolates the values of :math:`(1 - p^{-k}) \\zeta (k)` at negative\n        integers :math:`k` such that :math:`k = 1 (mod p-1)` (resp. :math:`k` is odd) if\n        :math:`p` is odd (resp. :math:`p = 2`). Power series are not allowed in this case.\n        \n        ::\n        \n            ? zeta(-3+O(5^10))\n            %1 = 4*5^-1 + 4 + 3*5 + 4*5^3 + 4*5^5 + 4*5^7 + O(5^9)))))\n            ? (1-5^3) * zeta(-3)\n            %2 = -1.0333333333333333333333333333333333333\n            ? bestappr(%)\n            %3 = -31/30\n            ? zeta(-3+O(5^10)) - (-31/30)\n            %4 = O(5^9)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1595zeta(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zeta (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zeta") < 0)) __PYX_ERR(10, 27454, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27454, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zeta", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27454, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.zeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1594zeta(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1594zeta(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("zeta", 0);

  /* "cypari/auto_gen.pxi":27489
 *             %4 = O(5^9)
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27489, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27490
 *         '''
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gzeta(_s, precision)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27491
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = gzeta(_s, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":27492
 *         cdef GEN _s = (<Gen>s).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gzeta(_s, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = gzeta(__pyx_v__s, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":27493
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = gzeta(_s, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetahurwitz(s, x, long der=0, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27454
 *         return new_gen(_ret)
 * 
 *     def zeta(s, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s != 1` a complex number, Riemann's zeta
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zeta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27495
 *         return new_gen(_ret)
 * 
 *     def zetahurwitz(s, x, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz zeta function :math:`\zeta (s,x) = \sum_{n >= 0}(n+x)^{-s}` and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1597zetahurwitz(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1596zetahurwitz[] = "\n        Hurwitz zeta function :math:`\\zeta (s,x) = \\sum_{n >= 0}(n+x)^{-s}` and\n        analytically continued, with :math:`s != 1` and :math:`x` not a negative or zero\n        integer. Note that :math:`\\zeta (s,1) = \\zeta (s)`. :math:`s` can also be a polynomial,\n        rational function, or power series. If :literal:`der` is positive, compute the\n        :literal:`der`'th derivative with respect to :math:`s`. Note that the derivative\n        with respect to :math:`x` is simply :math:`-s\\zeta (s+1,x)`.\n        \n        ::\n        \n            ? zetahurwitz(Pi,Pi)\n            %1 = 0.056155444497585099925180502385781494484\n            ? zetahurwitz(2,1) - zeta(2)\n            %2 = -2.350988701644575016 E-38\n            ? zetahurwitz(Pi,3) - (zeta(Pi)-1-1/2^Pi)\n            %3 = -2.2040519077917890774 E-39\n            ? zetahurwitz(-7/2,1) - zeta(-7/2)\n            %4 = -2.295887403949780289 E-41\n            ? zetahurwitz(-2.3,Pi+I*log(2))\n            %5 = -5.1928369229555125820137832704455696057\\\n             - 6.1349660138824147237884128986232049582*I\n            ? zetahurwitz(-1+x^2+O(x^3),1)\n            %6 = -0.083333333333333333333333333333333333333\\\n             - 0.16542114370045092921391966024278064276*x^2 + O(x^3)\n            ? zetahurwitz(1+x+O(x^4),2)\n            %7 = 1.0000000000000000000000000000000000000*x^-1\\\n             - 0.42278433509846713939348790991759756896\\\n             + 0.072815845483676724860586375874901319138*x + O(x^2)\n            ? zetahurwitz(2,1,2) \\\\ zeta''(2)\n            %8 = 1.9892802342989010234208586874215163815\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1597zetahurwitz(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  long __pyx_v_der;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetahurwitz (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_der,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_der);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetahurwitz") < 0)) __PYX_ERR(10, 27495, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    if (values[1]) {
      __pyx_v_der = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_der == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27495, __pyx_L3_error)
    } else {
      __pyx_v_der = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27495, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetahurwitz", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27495, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.zetahurwitz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1596zetahurwitz(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_x, __pyx_v_der, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1596zetahurwitz(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_x, long __pyx_v_der, long __pyx_v_precision) {
  GEN __pyx_v__s;
  GEN __pyx_v__x;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("zetahurwitz", 0);
  __Pyx_INCREF(__pyx_v_x);

  /* "cypari/auto_gen.pxi":27527
 *             %8 = 1.9892802342989010234208586874215163815
 *         '''
 *         x = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27527, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27528
 *         '''
 *         x = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27528, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27529
 *         x = objtogen(x)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27530
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27531
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 */
  __pyx_t_4 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_4) {

    /* "cypari/auto_gen.pxi":27532
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":27531
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _x = (<Gen>x).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 */
  }

  /* "cypari/auto_gen.pxi":27533
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetahurwitz(__pyx_v__s, __pyx_v__x, __pyx_v_der, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":27534
 *             precision = default_bitprec()
 *         cdef GEN _ret = zetahurwitz(_s, _x, der, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetamult(s, T=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27534, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27495
 *         return new_gen(_ret)
 * 
 *     def zetahurwitz(s, x, long der=0, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Hurwitz zeta function :math:`\zeta (s,x) = \sum_{n >= 0}(n+x)^{-s}` and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zetahurwitz", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27536
 *         return new_gen(_ret)
 * 
 *     def zetamult(s, T=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a vector of positive integers such that :math:`s[1] >= 2`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1599zetamult(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1598zetamult[] = "\n        For :math:`s` a vector of positive integers such that :math:`s[1] >= 2`,\n        returns the multiple zeta value (MZV)\n        \n        .. MATH::\n        \n            \\zeta (s_1,..., s_k) = \\sum_{n_1 > ... > n_k > 0} n_1^{-s_1}...n_k^{-s_k}.\n        \n        ::\n        \n            ? zetamult([2,1]) - zeta(3) \\\\ Euler's identity\n            %1 = 0.E-38\n        \n        If the bit precision is :math:`B`, this function runs in time :math:`~{O}(k B^2)`.\n        \n        If :math:`T` is provided, it must be the output of :literal:`zetamultinit`:math:`(w)` for\n        some :math:`w >= s_1 +...+ s_k` and will provide a small speed up,\n        usually about 10\\%.\n        \n        ::\n        \n            ? T = zetamultinit(20); s = [2,1,1,1,1,1,1,1,1];\n            ? for(i=1,10^3, zetamult(s))\n            time = 373 ms.\n            ? for(i=1,10^3, zetamult(s, T)) \\\\ faster\n            time = 279 ms.\n            ? zetamult(vector(10,i,2), T)\n            %4 = 1.7165384749821433018378232207719985786 E-10\n            ? zetamult(vector(11,i,2), T) \\\\ overshoot\n             *** at top-level: zetamult(vector(11,i\n             *** ^--------------------\n             *** zetamult: domain error in zetamult: weight > 20\n        \n        In addition to the above format (:literal:`avec`), the function\n        also accepts an internal binary format :literal:`evec` (each :math:`s_i` is replaced\n        by :math:`s_i` bits, all of them 0 but the last one), and an :literal:`index` format\n        (if :math:`e` is the positive integer attached the :literal:`evec` vector of\n        bits, the index is the integer :math:`e + 2^{k-2}`). The function\n        :literal:`zetamultconvert` allows to pass from one format to the other; the\n        function :literal:`zetamultall` computes simultaneously all MZVs of weight\n        :math:`\\sum_{i <= k} s_i` up to :math:`n`.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1599zetamult(PyObject *__pyx_v_s, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetamult (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_T);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetamult") < 0)) __PYX_ERR(10, 27536, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27536, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetamult", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27536, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.zetamult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1598zetamult(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_s), __pyx_v_T, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1598zetamult(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_s, PyObject *__pyx_v_T, long __pyx_v_precision) {
  int __pyx_v__have_T;
  GEN __pyx_v__s;
  GEN __pyx_v__T;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("zetamult", 0);
  __Pyx_INCREF(__pyx_v_T);

  /* "cypari/auto_gen.pxi":27579
 *         :math:`\sum_{i <= k} s_i` up to :math:`n`.
 *         '''
 *         cdef bint _have_T = (T is not None)             # <<<<<<<<<<<<<<
 *         if _have_T:
 *             T = objtogen(T)
 */
  __pyx_t_1 = (__pyx_v_T != Py_None);
  __pyx_v__have_T = __pyx_t_1;

  /* "cypari/auto_gen.pxi":27580
 *         '''
 *         cdef bint _have_T = (T is not None)
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             T = objtogen(T)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_T != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":27581
 *         cdef bint _have_T = (T is not None)
 *         if _have_T:
 *             T = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 27581, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_T, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":27580
 *         '''
 *         cdef bint _have_T = (T is not None)
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             T = objtogen(T)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":27582
 *         if _have_T:
 *             T = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 27582, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27583
 *             T = objtogen(T)
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g             # <<<<<<<<<<<<<<
 *         cdef GEN _T = NULL
 *         if _have_T:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s)->__pyx_base.g;
  __pyx_v__s = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27584
 *         sig_on()
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL             # <<<<<<<<<<<<<<
 *         if _have_T:
 *             _T = (<Gen>T).g
 */
  __pyx_v__T = NULL;

  /* "cypari/auto_gen.pxi":27585
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  __pyx_t_1 = (__pyx_v__have_T != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":27586
 *         cdef GEN _T = NULL
 *         if _have_T:
 *             _T = (<Gen>T).g             # <<<<<<<<<<<<<<
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamult0(_s, _T, precision)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_T)->__pyx_base.g;
    __pyx_v__T = __pyx_t_4;

    /* "cypari/auto_gen.pxi":27585
 *         cdef GEN _s = (<Gen>s).g
 *         cdef GEN _T = NULL
 *         if _have_T:             # <<<<<<<<<<<<<<
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 */
  }

  /* "cypari/auto_gen.pxi":27587
 *         if _have_T:
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetamult0(_s, _T, precision)
 *         return new_gen(_ret)
 */
  __pyx_v_precision = __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0);

  /* "cypari/auto_gen.pxi":27588
 *             _T = (<Gen>T).g
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamult0(_s, _T, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetamult0(__pyx_v__s, __pyx_v__T, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":27589
 *         precision = prec_bits_to_words(precision)
 *         cdef GEN _ret = zetamult0(_s, _T, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zetamultconvert(a, long fl=1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 27589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27536
 *         return new_gen(_ret)
 * 
 *     def zetamult(s, T=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         For :math:`s` a vector of positive integers such that :math:`s[1] >= 2`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zetamult", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_T);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27591
 *         return new_gen(_ret)
 * 
 *     def zetamultconvert(a, long fl=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`a` being either an :literal:`evec`, :literal:`avec`, or index :literal:`m`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1601zetamultconvert(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1600zetamultconvert[] = "\n        :literal:`a` being either an :literal:`evec`, :literal:`avec`, or index :literal:`m`,\n        converts into :literal:`evec` (:literal:`fl = 0`), :literal:`avec` (:literal:`fl = 1`, default), or\n        index :literal:`m` (:literal:`fl = 2`); see :literal:`zetamult` for explanations.\n        \n        ::\n        \n            ? zetamultconvert(10)\n            %1 = Vecsmall([3, 2])\n            ? zetamultconvert(13)\n            %2 = Vecsmall([2, 2, 1])\n            ? zetamultconvert(10, 0)\n            %3 = Vecsmall([0, 0, 1, 0, 1])\n            ? zetamultconvert(13, 0)\n            %4 = Vecsmall([0, 1, 0, 1, 1])\n        \n        The last two lines imply that :math:`[3,2]` and :math:`[2,2,1]`\n        are dual (reverse order of bits and swap :math:`0` and :math:`1` in :literal:`evec` form).\n        Hence they have the same zeta value:\n        \n        ::\n        \n            ? zetamult([3,2])\n            %5 = 0.22881039760335375976874614894168879193\n            ? zetamult([2,2,1])\n            %6 = 0.22881039760335375976874614894168879193\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1601zetamultconvert(PyObject *__pyx_v_a, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_fl;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zetamultconvert (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fl,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zetamultconvert") < 0)) __PYX_ERR(10, 27591, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_fl = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_fl == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27591, __pyx_L3_error)
    } else {
      __pyx_v_fl = ((long)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zetamultconvert", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27591, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.zetamultconvert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1600zetamultconvert(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_a), __pyx_v_fl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1600zetamultconvert(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_a, long __pyx_v_fl) {
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("zetamultconvert", 0);

  /* "cypari/auto_gen.pxi":27619
 *             %6 = 0.22881039760335375976874614894168879193
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = zetamultconvert(_a, fl)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27619, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27620
 *         '''
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zetamultconvert(_a, fl)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
  __pyx_v__a = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27621
 *         sig_on()
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = zetamultconvert(_a, fl)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zetamultconvert(__pyx_v__a, __pyx_v_fl);

  /* "cypari/auto_gen.pxi":27622
 *         cdef GEN _a = (<Gen>a).g
 *         cdef GEN _ret = zetamultconvert(_a, fl)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchar(D):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27591
 *         return new_gen(_ret)
 * 
 *     def zetamultconvert(a, long fl=1):             # <<<<<<<<<<<<<<
 *         r'''
 *         :literal:`a` being either an :literal:`evec`, :literal:`avec`, or index :literal:`m`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zetamultconvert", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27624
 *         return new_gen(_ret)
 * 
 *     def znchar(D):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a datum :math:`D` describing a group :math:`(\mathbb{Z}/N\mathbb{Z})^*` and a Dirichlet
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1603znchar(PyObject *__pyx_v_D, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1602znchar[] = "\n        Given a datum :math:`D` describing a group :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` and a Dirichlet\n        character :math:`\\chi`, return the pair :literal:`[G, chi]`, where :literal:`G` is\n        :literal:`znstar(N, 1)`) and :literal:`chi` is a GP character.\n        \n        The following possibilities for :math:`D` are supported\n        \n        - a non-zero :literal:`t_INT` congruent to :math:`0,1` modulo :math:`4`, return the real\n          character modulo :math:`D` given by the Kronecker symbol :math:`(D/.)`;\n        \n        - a :literal:`t_INTMOD` :literal:`Mod(m, N)`, return the Conrey character\n          modulo :math:`N` of index :math:`m` (see :literal:`znconreylog`).\n        \n        - a modular form space as per :literal:`mfinit`:math:`([N,k,\\chi])` or a modular\n          form for such a space, return the underlying Dirichlet character :math:`\\chi`\n          (which may be defined modulo a divisor of :math:`N` but need not be primitive).\n        \n        In the remaining cases, :literal:`G` is initialized by :literal:`znstar(N, 1)`.\n        \n        - a pair :literal:`[G, chi]`, where :literal:`chi` is a standard GP Dirichlet\n          character :math:`c = (c_j)` on :literal:`G` (generic character :literal:`t_VEC` or\n          Conrey characters :literal:`t_COL` or :literal:`t_INT`); given\n          generators :math:`G = \\oplus (\\mathbb{Z}/d_j\\mathbb{Z}) g_j`, :math:`\\chi (g_j) = e(c_j/d_j)`.\n        \n        - a pair :literal:`[G, chin]`, where :literal:`chin` is a :emphasis:`normalized`\n          representation :math:`[n, ~{c}]` of the Dirichlet character :math:`c`; :math:`\\chi (g_j)\n          = e(~{c}_j / n)` where :math:`n` is minimal (order of :math:`\\chi`).\n        \n        ::\n        \n            ? [G,chi] = znchar(-3);\n            ? G.cyc\n            %2 = [2]\n            ? chareval(G, chi, 2)\n            %3 = 1/2\n            ? kronecker(-3,2)\n            %4 = -1\n            ? znchartokronecker(G"",chi)\n            %5 = -3\n            ? mf = mfinit([28, 5/2, Mod(2,7)]); [f] = mfbasis(mf);\n            ? [G,chi] = znchar(mf); [G.mod, chi]\n            %7 = [7, [2]~]\n            ? [G,chi] = znchar(f); chi\n            %8 = [28, [0, 2]~]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1603znchar(PyObject *__pyx_v_D, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchar (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1602znchar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_D));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1602znchar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_D) {
  GEN __pyx_v__D;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("znchar", 0);

  /* "cypari/auto_gen.pxi":27670
 *             %8 = [28, [0, 2]~]
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = znchar(_D)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 27670, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27671
 *         '''
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchar(_D)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_D)->__pyx_base.g;
  __pyx_v__D = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27672
 *         sig_on()
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = znchar(_D)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchar(__pyx_v__D);

  /* "cypari/auto_gen.pxi":27673
 *         cdef GEN _D = (<Gen>D).g
 *         cdef GEN _ret = znchar(_D)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncharconductor(G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 27673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27624
 *         return new_gen(_ret)
 * 
 *     def znchar(D):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a datum :math:`D` describing a group :math:`(\mathbb{Z}/N\mathbb{Z})^*` and a Dirichlet
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27675
 *         return new_gen(_ret)
 * 
 *     def zncharconductor(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1605zncharconductor(PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1604zncharconductor[] = "\n        Let :emphasis:`G` be attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q, 1)`) and :literal:`chi` be a Dirichlet character on\n        :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`).\n        Return the conductor of :literal:`chi`:\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? zncharconductor(G,11) \\\\ primitive\n            %2 = 126000\n            ? zncharconductor(G,1) \\\\ trivial character, not primitive!\n            %3 = 1\n            ? zncharconductor(G,1009) \\\\ character mod 5^3\n            %4 = 125\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1605zncharconductor(PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncharconductor (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1604zncharconductor(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1604zncharconductor(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zncharconductor", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":27692
 *             %4 = 125
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27692, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27693
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27693, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27694
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = zncharconductor(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27695
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zncharconductor(_G, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27696
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = zncharconductor(_G, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zncharconductor(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":27697
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = zncharconductor(_G, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchardecompose(G, chi, Q):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27697, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27675
 *         return new_gen(_ret)
 * 
 *     def zncharconductor(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zncharconductor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27699
 *         return new_gen(_ret)
 * 
 *     def znchardecompose(G, chi, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`N = \prod_p p^{e_p}` and a Dirichlet character :math:`\chi`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1607znchardecompose(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1606znchardecompose[] = "\n        Let :math:`N = \\prod_p p^{e_p}` and a Dirichlet character :math:`\\chi`,\n        we have a decomposition :math:`\\chi = \\prod_p \\chi_p` into character modulo :math:`N`\n        where the conductor of :math:`\\chi_p` divides :math:`p^{e_p}`; it equals :math:`p^{e_p}` for\n        all :math:`p` if and only if :math:`\\chi` is primitive.\n        \n        Given a :emphasis:`znstar` G describing a group :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, a Dirichlet\n        character :literal:`chi` and an integer :math:`Q`, return :math:`\\prod_{p \\| (Q,N)} \\chi_p`.\n        For instance, if :math:`Q = p` is a prime divisor of :math:`N`, the function returns\n        :math:`\\chi_p` (as a character modulo :math:`N`), given as a Conrey character (:literal:`t_COL`).\n        \n        ::\n        \n            ? G = znstar(40, 1);\n            ? G.cyc\n            %2 = [4, 2, 2]\n            ? chi = [2, 1, 1];\n            ? chi2 = znchardecompose(G, chi, 2)\n            %4 = [1, 1, 0]~\n            ? chi5 = znchardecompose(G, chi, 5)\n            %5 = [0, 0, 2]~\n            ? znchardecompose(G, chi, 3)\n            %6 = [0, 0, 0]~\n            ? c = charmul(G, chi2, chi5)\n            %7 = [1, 1, 2]~ \\\\ t_COL: in terms of Conrey generators !\n            ? znconreychar(G,c)\n            %8 = [2, 1, 1] \\\\ t_VEC: in terms of SNF generators\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1607znchardecompose(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_Q = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchardecompose (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_Q,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_chi)) != 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_Q)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("znchardecompose", 1, 2, 2, 1); __PYX_ERR(10, 27699, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znchardecompose") < 0)) __PYX_ERR(10, 27699, __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_chi = values[0];
    __pyx_v_Q = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znchardecompose", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27699, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchardecompose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1606znchardecompose(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_chi, __pyx_v_Q);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1606znchardecompose(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_Q) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__Q;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znchardecompose", 0);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_Q);

  /* "cypari/auto_gen.pxi":27728
 *             %8 = [2, 1, 1] \\ t_VEC: in terms of SNF generators
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27728, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27729
 *         '''
 *         chi = objtogen(chi)
 *         Q = objtogen(Q)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_Q, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_Q, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27730
 *         chi = objtogen(chi)
 *         Q = objtogen(Q)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27730, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27731
 *         Q = objtogen(Q)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _Q = (<Gen>Q).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27732
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27733
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _Q = (<Gen>Q).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_Q)->__pyx_base.g;
  __pyx_v__Q = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27734
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchardecompose(__pyx_v__G, __pyx_v__chi, __pyx_v__Q);

  /* "cypari/auto_gen.pxi":27735
 *         cdef GEN _Q = (<Gen>Q).g
 *         cdef GEN _ret = znchardecompose(_G, _chi, _Q)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchargauss(G, chi, a=None, long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27735, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27699
 *         return new_gen(_ret)
 * 
 *     def znchardecompose(G, chi, Q):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`N = \prod_p p^{e_p}` and a Dirichlet character :math:`\chi`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchardecompose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_Q);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27737
 *         return new_gen(_ret)
 * 
 *     def znchargauss(G, chi, a=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a Dirichlet character :math:`\chi` on :math:`G = (\mathbb{Z}/N\mathbb{Z})^*` (see
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1609znchargauss(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1608znchargauss[] = "\n        Given a Dirichlet character :math:`\\chi` on :math:`G = (\\mathbb{Z}/N\\mathbb{Z})^*` (see\n        :literal:`znchar`), return the complex Gauss sum\n        \n        .. MATH::\n        \n            g(\\chi,a) = \\sum_{n = 1}^N \\chi (n) e(a n/N)\n        \n        ::\n        \n            ? [G,chi] = znchar(-3); \\\\ quadratic Gauss sum: I*sqrt(3)\n            ? znchargauss(G,chi)\n            %2 = 1.7320508075688772935274463415058723670*I\n            ? [G,chi] = znchar(5);\n            ? znchargauss(G,chi) \\\\ sqrt(5)\n            %2 = 2.2360679774997896964091736687312762354\n            ? G = znstar(300,1); chi = [1,1,12]~;\n            ? znchargauss(G,chi) / sqrt(300) - exp(2*I*Pi*11/25) \\\\ = 0\n            %4 = 2.350988701644575016 E-38 + 1.4693679385278593850 E-39*I\n            ? lfuntheta([G,chi], 1) \\\\ = 0\n            %5 = -5.79[...] E-39 - 2.71[...] E-40*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1609znchargauss(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_a = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchargauss (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_a,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  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_chi)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znchargauss") < 0)) __PYX_ERR(10, 27737, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chi = values[0];
    __pyx_v_a = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27737, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znchargauss", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27737, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchargauss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1608znchargauss(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_chi, __pyx_v_a, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1608znchargauss(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_a, long __pyx_v_precision) {
  int __pyx_v__have_a;
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__a;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("znchargauss", 0);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_a);

  /* "cypari/auto_gen.pxi":27760
 *             %5 = -5.79[...] E-39 - 2.71[...] E-40*I
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27760, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27761
 *         '''
 *         chi = objtogen(chi)
 *         cdef bint _have_a = (a is not None)             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             a = objtogen(a)
 */
  __pyx_t_2 = (__pyx_v_a != Py_None);
  __pyx_v__have_a = __pyx_t_2;

  /* "cypari/auto_gen.pxi":27762
 *         chi = objtogen(chi)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":27763
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:
 *             a = objtogen(a)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_a, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27763, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":27762
 *         chi = objtogen(chi)
 *         cdef bint _have_a = (a is not None)
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             a = objtogen(a)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":27764
 *         if _have_a:
 *             a = objtogen(a)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 27764, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27765
 *             a = objtogen(a)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27766
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _a = NULL
 *         if _have_a:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_4;

  /* "cypari/auto_gen.pxi":27767
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL             # <<<<<<<<<<<<<<
 *         if _have_a:
 *             _a = (<Gen>a).g
 */
  __pyx_v__a = NULL;

  /* "cypari/auto_gen.pxi":27768
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         if not precision:
 */
  __pyx_t_2 = (__pyx_v__have_a != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":27769
 *         cdef GEN _a = NULL
 *         if _have_a:
 *             _a = (<Gen>a).g             # <<<<<<<<<<<<<<
 *         if not precision:
 *             precision = default_bitprec()
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a)->__pyx_base.g;
    __pyx_v__a = __pyx_t_4;

    /* "cypari/auto_gen.pxi":27768
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _a = NULL
 *         if _have_a:             # <<<<<<<<<<<<<<
 *             _a = (<Gen>a).g
 *         if not precision:
 */
  }

  /* "cypari/auto_gen.pxi":27770
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 */
  __pyx_t_2 = ((!(__pyx_v_precision != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":27771
 *             _a = (<Gen>a).g
 *         if not precision:
 *             precision = default_bitprec()             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 *         return new_gen(_ret)
 */
    __pyx_v_precision = __pyx_f_6cypari_5_pari_default_bitprec(0, NULL);

    /* "cypari/auto_gen.pxi":27770
 *         if _have_a:
 *             _a = (<Gen>a).g
 *         if not precision:             # <<<<<<<<<<<<<<
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 */
  }

  /* "cypari/auto_gen.pxi":27772
 *         if not precision:
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchargauss(__pyx_v__G, __pyx_v__chi, __pyx_v__a, __pyx_v_precision);

  /* "cypari/auto_gen.pxi":27773
 *             precision = default_bitprec()
 *         cdef GEN _ret = znchargauss(_G, _chi, _a, precision)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncharinduce(G, chi, N):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27737
 *         return new_gen(_ret)
 * 
 *     def znchargauss(G, chi, a=None, long precision=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a Dirichlet character :math:`\chi` on :math:`G = (\mathbb{Z}/N\mathbb{Z})^*` (see
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchargauss", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27775
 *         return new_gen(_ret)
 * 
 *     def zncharinduce(G, chi, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per :literal:`G = znstar(q,1)`)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1611zncharinduce(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1610zncharinduce[] = "\n        Let :math:`G` be attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per :literal:`G = znstar(q,1)`)\n        and let :literal:`chi` be a Dirichlet character on :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`, given by\n        \n        - a :literal:`t_VEC`: a standard character on :literal:`bid.gen`,\n        \n        - a :literal:`t_INT` or a :literal:`t_COL`: a Conrey index in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` or its\n          Conrey logarithm;\n          see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        Let :math:`N` be a multiple of :math:`q`, return the character modulo :math:`N` extending\n        :literal:`chi`. As usual for arithmetic functions, the new modulus :math:`N` can be\n        given as a :literal:`t_INT`, via a factorization matrix or a pair\n        :literal:`[N, factor(N)]`, or by :literal:`znstar(N,1)`.\n        \n        ::\n        \n            ? G = znstar(4, 1);\n            ? chi = znconreylog(G,1); \\\\ trivial character mod 4\n            ? zncharinduce(G, chi, 80) \\\\ now mod 80\n            %3 = [0, 0, 0]~\n            ? zncharinduce(G, 1, 80) \\\\ same using directly Conrey label\n            %4 = [0, 0, 0]~\n            ? G2 = znstar(80, 1);\n            ? zncharinduce(G, 1, G2) \\\\ same\n            %4 = [0, 0, 0]~\n            \n            ? chi = zncharinduce(G, 3, G2) \\\\ extend the non-trivial character mod 4\n            %5 = [1, 0, 0]~\n            ? [G0,chi0] = znchartoprimitive(G2, chi);\n            ? G0.mod\n            %7 = 4\n            ? chi0\n            %8 = [1]~\n        \n        Here is a larger example:\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? label = 1009;\n            ? chi = znconreylog(G, label)\n            %3 = [0, 0, 0, 14, 0]~\n            ? [G0,chi0] = znchartoprimitive(G, label); \\\\ works also with 'chi'\n            ? G0.mod\n            %5 = 125\n            ? chi0 \\\\ primitive character mod 5^3 att""ached to chi\n            %6 = [14]~\n            ? G0 = znstar(N0, 1);\n            ? zncharinduce(G0, chi0, G) \\\\ induce back\n            %8 = [0, 0, 0, 14, 0]~\n            ? znconreyexp(G, %)\n            %9 = 1009\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1611zncharinduce(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncharinduce (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_N,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_chi)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_N)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncharinduce", 1, 2, 2, 1); __PYX_ERR(10, 27775, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zncharinduce") < 0)) __PYX_ERR(10, 27775, __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_chi = values[0];
    __pyx_v_N = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zncharinduce", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27775, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.zncharinduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1610zncharinduce(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_chi, __pyx_v_N);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1610zncharinduce(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, PyObject *__pyx_v_N) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__N;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zncharinduce", 0);
  __Pyx_INCREF(__pyx_v_chi);
  __Pyx_INCREF(__pyx_v_N);

  /* "cypari/auto_gen.pxi":27830
 *             %9 = 1009
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         N = objtogen(N)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27830, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27831
 *         '''
 *         chi = objtogen(chi)
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27832
 *         chi = objtogen(chi)
 *         N = objtogen(N)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27832, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27833
 *         N = objtogen(N)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27834
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27835
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27836
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zncharinduce(__pyx_v__G, __pyx_v__chi, __pyx_v__N);

  /* "cypari/auto_gen.pxi":27837
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _ret = zncharinduce(_G, _chi, _N)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncharisodd(G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27775
 *         return new_gen(_ret)
 * 
 *     def zncharinduce(G, chi, N):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per :literal:`G = znstar(q,1)`)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zncharinduce", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27839
 *         return new_gen(_ret)
 * 
 *     def zncharisodd(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1613zncharisodd(PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1612zncharisodd[] = "\n        Let :math:`G` be attached to :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)\n        and let :literal:`chi` be a Dirichlet character on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, given by\n        \n        - a :literal:`t_VEC`: a standard character on :literal:`G.gen`,\n        \n        - a :literal:`t_INT` or a :literal:`t_COL`: a Conrey index in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` or its\n          Conrey logarithm;\n          see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        Return :math:`1` if and only if :literal:`chi`:math:`(-1) = -1` and :math:`0` otherwise.\n        \n        ::\n        \n            ? G = znstar(8, 1);\n            ? zncharisodd(G, 1) \\\\ trivial character\n            %2 = 0\n            ? zncharisodd(G, 3)\n            %3 = 1\n            ? chareval(G, 3, -1)\n            %4 = 1/2\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1613zncharisodd(PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncharisodd (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1612zncharisodd(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1612zncharisodd(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  long __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("zncharisodd", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":27862
 *             %4 = 1/2
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27863
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27863, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27864
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef long _ret = zncharisodd(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27865
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef long _ret = zncharisodd(_G, _chi)
 *         clear_stack()
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27866
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef long _ret = zncharisodd(_G, _chi)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return _ret
 */
  __pyx_v__ret = zncharisodd(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":27867
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef long _ret = zncharisodd(_G, _chi)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return _ret
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/auto_gen.pxi":27868
 *         cdef long _ret = zncharisodd(_G, _chi)
 *         clear_stack()
 *         return _ret             # <<<<<<<<<<<<<<
 * 
 *     def znchartokronecker(G, chi, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v__ret); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27868, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27839
 *         return new_gen(_ret)
 * 
 *     def zncharisodd(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zncharisodd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27870
 *         return _ret
 * 
 *     def znchartokronecker(G, chi, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1615znchartokronecker(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1614znchartokronecker[] = "\n        Let :math:`G` be attached to :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)\n        and let :literal:`chi` be a Dirichlet character on :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, given by\n        \n        - a :literal:`t_VEC`: a standard character on :literal:`bid.gen`,\n        \n        - a :literal:`t_INT` or a :literal:`t_COL`: a Conrey index in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` or its\n          Conrey logarithm;\n          see ``dirichletchar`` (in the PARI manual) or :literal:`\077\077character`.\n        \n        If :math:`flag = 0`, return the discriminant :math:`D` if :literal:`chi` is real equal to the\n        Kronecker symbol :math:`(D/.)` and :math:`0` otherwise. The discriminant :math:`D` is\n        fundamental if and only if :literal:`chi` is primitive.\n        \n        If :math:`flag = 1`, return the fundamental discriminant attached to the\n        corresponding primitive character.\n        \n        ::\n        \n            ? G = znstar(8,1); CHARS = [1,3,5,7]; \\\\ Conrey labels\n            ? apply(t->znchartokronecker(G,t), CHARS)\n            %2 = [4, -8, 8, -4]\n            ? apply(t->znchartokronecker(G,t,1), CHARS)\n            %3 = [1, -8, 8, -4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1615znchartokronecker(PyObject *__pyx_v_G, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_chi = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchartokronecker (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_chi,&__pyx_n_s_flag,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_chi)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znchartokronecker") < 0)) __PYX_ERR(10, 27870, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_chi = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 27870, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znchartokronecker", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 27870, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchartokronecker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1614znchartokronecker(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), __pyx_v_chi, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1614znchartokronecker(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi, long __pyx_v_flag) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znchartokronecker", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":27896
 *             %3 = [1, -8, 8, -4]
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27897
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27897, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27898
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27899
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27900
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchartokronecker(__pyx_v__G, __pyx_v__chi, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":27901
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartokronecker(_G, _chi, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znchartoprimitive(G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27870
 *         return _ret
 * 
 *     def znchartokronecker(G, chi, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :math:`G` be attached to :math:`(\mathbb{Z}/N\mathbb{Z})^*` (as per :literal:`G = znstar(N,1)`)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchartokronecker", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27903
 *         return new_gen(_ret)
 * 
 *     def znchartoprimitive(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1617znchartoprimitive(PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1616znchartoprimitive[] = "\n        Let :emphasis:`G` be attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q, 1)`) and :literal:`chi` be a Dirichlet character on\n        :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`, of conductor :math:`q_0 \\| q`.\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? [G0,chi0] = znchartoprimitive(G,11)\n            ? G0.mod\n            %3 = 126000\n            ? chi0\n            %4 = 11\n            ? [G0,chi0] = znchartoprimitive(G,1);\\\\ trivial character, not primitive!\n            ? G0.mod\n            %6 = 1\n            ? chi0\n            %7 = []~\n            ? [G0,chi0] = znchartoprimitive(G,1009)\n            ? G0.mod\n            %4 = 125\n            ? chi0\n            %5 = [14]~\n        \n        Note that :literal:`znconreyconductor` is more efficient since\n        it can return :math:`\\chi_0` and its conductor :math:`q_0` without needing to initialize\n        :math:`G_0`. (The price to pay is a more cryptic format and the need to\n        initalize :math:`G_0` later but the can be done once for all characters\n        of conductor :math:`q_0`.)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1617znchartoprimitive(PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znchartoprimitive (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1616znchartoprimitive(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1616znchartoprimitive(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znchartoprimitive", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":27934
 *         of conductor :math:`q_0`.)
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":27935
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 27935, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":27936
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27937
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":27938
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znchartoprimitive(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":27939
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znchartoprimitive(_G, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znconreychar(G, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 27939, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27903
 *         return new_gen(_ret)
 * 
 *     def znchartoprimitive(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Let :emphasis:`G` be attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znchartoprimitive", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":27941
 *         return new_gen(_ret)
 * 
 *     def znconreychar(G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1619znconreychar(PyObject *__pyx_v_G, PyObject *__pyx_v_m); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1618znconreychar[] = "\n        Given a :emphasis:`znstar` :math:`G` attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q,1)`), this function returns the Dirichlet character\n        attached to :math:`m \\in (\\mathbb{Z}/q\\mathbb{Z})^*` via Conrey's logarithm, which\n        establishes a \"canonical\" bijection between :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` and its dual.\n        \n        Let :math:`q = \\prod_p p^{e_p}` be the factorization of :math:`q` into distinct primes.\n        For all odd :math:`p` with :math:`e_p > 0`, let :math:`g_p` be the element in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`\n        which is\n        \n        - congruent to :math:`1` mod :math:`q/p^{e_p}`,\n        \n        - congruent mod :math:`p^{e_p}` to the smallest positive integer that generates\n          :math:`(\\mathbb{Z}/p^2\\mathbb{Z})^*`.\n        \n        For :math:`p = 2`, we let :math:`g_4` (if :math:`2^{e_2} >= 4`) and :math:`g_8` (if furthermore\n        (:math:`2^{e_2} >= 8`) be the elements in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` which are\n        \n        - congruent to :math:`1` mod :math:`q/2^{e_2}`,\n        \n        - :math:`g_4 = -1 mod 2^{e_2}`,\n        \n        - :math:`g_8 = 5 mod 2^{e_2}`.\n        \n        Then the :math:`g_p` (and the extra :math:`g_4` and :math:`g_8` if :math:`2^{e_2} >= 2`) are\n        independent generators of :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`, i.e. every :math:`m` in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` can be\n        written uniquely as :math:`\\prod_p g_p^{m_p}`, where :math:`m_p` is defined modulo the\n        order :math:`o_p` of :math:`g_p` and :math:`p \\in S_q`, the set of prime divisors of :math:`q`\n        together with :math:`4` if :math:`4 \\| q` and :math:`8` if :math:`8 \\| q`. Note that the :math:`g_p`\n        are in general :emphasis:`not` SNF generators as produced by :literal:`znstar` whenever\n        :math:`\\omega (q) >= 2`, although their number is the same. They however allow\n        t""o handle the finite abelian group :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` in a fast and elegant way.\n        (Which unfortunately does not generalize to ray class groups or Hecke\n        characters.)\n        \n        The Conrey logarithm of :math:`m` is the vector :math:`(m_p)_{p\\in S_q}`, obtained\n        via :literal:`znconreylog`. The Conrey character :math:`\\chi_q(m,.)` attached to\n        :math:`m` mod :math:`q` maps\n        each :math:`g_p`, :math:`p\\in S_q` to :math:`e(m_p / o_p)`, where :math:`e(x) = \\exp (2i\\pi x)`.\n        This function returns the Conrey character expressed in the standard PARI\n        way in terms of the SNF generators :literal:`G.gen`.\n        \n        ::\n        \n            ? G = znstar(8,1);\n            ? G.cyc\n            %2 = [2, 2] \\\\ Z/2 x Z/2\n            ? G.gen\n            %3 = [7, 3]\n            ? znconreychar(G,1) \\\\ 1 is always the trivial character\n            %4 = [0, 0]\n            ? znconreychar(G,2) \\\\ 2 is not coprime to 8 !!!\n             *** at top-level: znconreychar(G,2)\n             *** ^-----------------\n             *** znconreychar: elements not coprime in Zideallog:\n             2\n             8\n             *** Break loop: type 'break' to go back to GP prompt\n            break>\n            \n            ? znconreychar(G,3)\n            %5 = [0, 1]\n            ? znconreychar(G,5)\n            %6 = [1, 1]\n            ? znconreychar(G,7)\n            %7 = [1, 0]\n        \n        We indeed get all 4 characters of :math:`(\\mathbb{Z}/8\\mathbb{Z})^*`.\n        \n        For convenience, we allow to input the :emphasis:`Conrey logarithm` of :math:`m`\n        instead of :math:`m`:\n        \n        ::\n        \n            ? G = znstar(55, 1);\n            ? znconreychar(G,7)\n            %2 = [7, 0]\n            ? znconreychar(G, znconreylog(G,7))\n            %3 = [7, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1619znconreychar(PyObject *__pyx_v_G, PyObject *__pyx_v_m) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znconreychar (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1618znconreychar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), ((PyObject *)__pyx_v_m));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1618znconreychar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_m) {
  GEN __pyx_v__G;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znconreychar", 0);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_gen.pxi":28022
 *             %3 = [7, 0]
 *         '''
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":28023
 *         '''
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 28023, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28024
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreychar(_G, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":28025
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znconreychar(_G, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_gen.pxi":28026
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreychar(_G, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znconreychar(__pyx_v__G, __pyx_v__m);

  /* "cypari/auto_gen.pxi":28027
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreychar(_G, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znconreyexp(G, chi):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28027, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":27941
 *         return new_gen(_ret)
 * 
 *     def znconreychar(G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znconreychar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":28029
 *         return new_gen(_ret)
 * 
 *     def znconreyexp(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1621znconreyexp(PyObject *__pyx_v_G, PyObject *__pyx_v_chi); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1620znconreyexp[] = "\n        Given a :emphasis:`znstar` :math:`G` attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q, 1)`), this function returns the Conrey exponential of\n        the character :emphasis:`chi`: it returns the integer\n        :math:`m \\in (\\mathbb{Z}/q\\mathbb{Z})^*` such that :literal:`znconreylog(G, :math:`m`)` is :emphasis:`chi`.\n        \n        The character :emphasis:`chi` is given either as a\n        \n        - :literal:`t_VEC`: in terms of the generators :literal:`G.gen`;\n        \n        - :literal:`t_COL`: a Conrey logarithm.\n        \n        ::\n        \n            ? G = znstar(126000, 1)\n            ? znconreylog(G,1)\n            %2 = [0, 0, 0, 0, 0]~\n            ? znconreyexp(G,%)\n            %3 = 1\n            ? G.cyc \\\\ SNF generators\n            %4 = [300, 12, 2, 2, 2]\n            ? chi = [100, 1, 0, 1, 0]; \\\\ some random character on SNF generators\n            ? znconreylog(G, chi) \\\\ in terms of Conrey generators\n            %6 = [0, 3, 3, 0, 2]~\n            ? znconreyexp(G, %) \\\\ apply to a Conrey log\n            %7 = 18251\n            ? znconreyexp(G, chi) \\\\ ... or a char on SNF generators\n            %8 = 18251\n            ? znconreychar(G,%)\n            %9 = [100, 1, 0, 1, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1621znconreyexp(PyObject *__pyx_v_G, PyObject *__pyx_v_chi) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znconreyexp (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1620znconreyexp(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), ((PyObject *)__pyx_v_chi));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1620znconreyexp(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_chi) {
  GEN __pyx_v__G;
  GEN __pyx_v__chi;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znconreyexp", 0);
  __Pyx_INCREF(__pyx_v_chi);

  /* "cypari/auto_gen.pxi":28061
 *             %9 = [100, 1, 0, 1, 0]
 *         '''
 *         chi = objtogen(chi)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_chi, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28061, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_chi, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":28062
 *         '''
 *         chi = objtogen(chi)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 28062, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28063
 *         chi = objtogen(chi)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znconreyexp(_G, _chi)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":28064
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znconreyexp(_G, _chi)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_chi)->__pyx_base.g;
  __pyx_v__chi = __pyx_t_3;

  /* "cypari/auto_gen.pxi":28065
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znconreyexp(_G, _chi)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znconreyexp(__pyx_v__G, __pyx_v__chi);

  /* "cypari/auto_gen.pxi":28066
 *         cdef GEN _chi = (<Gen>chi).g
 *         cdef GEN _ret = znconreyexp(_G, _chi)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znconreylog(G, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28066, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":28029
 *         return new_gen(_ret)
 * 
 *     def znconreyexp(G, chi):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` :math:`G` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znconreyexp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_chi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":28068
 *         return new_gen(_ret)
 * 
 *     def znconreylog(G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1623znconreylog(PyObject *__pyx_v_G, PyObject *__pyx_v_m); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1622znconreylog[] = "\n        Given a :emphasis:`znstar` attached to :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` (as per\n        :literal:`G = znstar(q,1)`), this function returns the Conrey logarithm of\n        :math:`m \\in (\\mathbb{Z}/q\\mathbb{Z})^*`.\n        \n        Let :math:`q = \\prod_p p^{e_p}` be the factorization of :math:`q` into distinct primes,\n        where we assume :math:`e_2 = 0` or :math:`e_2 >= 2`. (If :math:`e_2 = 1`, we can ignore :math:`2`\n        from the factorization, as if we replaced :math:`q` by :math:`q/2`, since :math:`(\\mathbb{Z}/q\\mathbb{Z})^*\n        ~ (\\mathbb{Z}/(q/2)\\mathbb{Z})^*`.)\n        \n        For all odd :math:`p` with :math:`e_p > 0`, let :math:`g_p` be the element in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*`\n        which is\n        \n        - congruent to :math:`1` mod :math:`q/p^{e_p}`,\n        \n        - congruent mod :math:`p^{e_p}` to the smallest positive integer that generates\n          :math:`(\\mathbb{Z}/p^2\\mathbb{Z})^*`.\n        \n        For :math:`p = 2`, we let :math:`g_4` (if :math:`2^{e_2} >= 4`) and :math:`g_8` (if furthermore\n        (:math:`2^{e_2} >= 8`) be the elements in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` which are\n        \n        - congruent to :math:`1` mod :math:`q/2^{e_2}`,\n        \n        - :math:`g_4 = -1 mod 2^{e_2}`,\n        \n        - :math:`g_8 = 5 mod 2^{e_2}`.\n        \n        Then the :math:`g_p` (and the extra :math:`g_4` and :math:`g_8` if :math:`2^{e_2} >= 2`) are\n        independent generators of :math:`\\mathbb{Z}/q\\mathbb{Z}^*`, i.e. every :math:`m` in :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` can be\n        written uniquely as :math:`\\prod_p g_p^{m_p}`, where :math:`m_p` is defined modulo the\n        order :math:`o_p` of :math:`g_p` and :math:`p \\in S_q`, the set of prime divisors of :math:`q`\n        together with :math:`4` if :math:`4 \\| q` and :math:`8` if :math:`8 \\| q`. Note that the :math:`g_p`\n        are in general :emphasis:`not` SNF generators as produced by :l""iteral:`znstar` whenever\n        :math:`\\omega (q) >= 2`, although their number is the same. They however allow\n        to handle the finite abelian group :math:`(\\mathbb{Z}/q\\mathbb{Z})^*` in a fast and elegant way.\n        (Which unfortunately does not generalize to ray class groups or Hecke\n        characters.)\n        \n        The Conrey logarithm of :math:`m` is the vector :math:`(m_p)_{p\\in S_q}`. The inverse\n        function :literal:`znconreyexp` recovers the Conrey label :math:`m` from a character.\n        \n        ::\n        \n            ? G = znstar(126000, 1);\n            ? znconreylog(G,1)\n            %2 = [0, 0, 0, 0, 0]~\n            ? znconreyexp(G, %)\n            %3 = 1\n            ? znconreylog(G,2) \\\\ 2 is not coprime to modulus !!!\n             *** at top-level: znconreylog(G,2)\n             *** ^-----------------\n             *** znconreylog: elements not coprime in Zideallog:\n             2\n             126000\n             *** Break loop: type 'break' to go back to GP prompt\n            break>\n            ? znconreylog(G,11) \\\\ wrt. Conrey generators\n            %4 = [0, 3, 1, 76, 4]~\n            ? log11 = ideallog(,11,G) \\\\ wrt. SNF generators\n            %5 = [178, 3, -75, 1, 0]~\n        \n        For convenience, we allow to input the ordinary discrete log of :math:`m`,\n        :math:`ideallog(,m,bid)`, which allows to convert discrete logs\n        from :literal:`bid.gen` generators to Conrey generators.\n        \n        ::\n        \n            ? znconreylog(G, log11)\n            %7 = [0, 3, 1, 76, 4]~\n        \n        We also allow a character (:literal:`t_VEC`) on :literal:`bid.gen` and\n        return its representation on the Conrey generators.\n        \n        ::\n        \n            ? G.cyc\n            %8 = [300, 12, 2, 2, 2]\n            ? chi = [10,1,0,1,1];\n            ? znconreylog(G, chi)\n            %10 = [1, 3, 3, 10, 2]~\n            ? n = znconreyexp(G, chi)\n            %11"" = 84149\n            ? znconreychar(G, n)\n            %12 = [10, 1, 0, 1, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1623znconreylog(PyObject *__pyx_v_G, PyObject *__pyx_v_m) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znconreylog (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1622znconreylog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_G), ((PyObject *)__pyx_v_m));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1622znconreylog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_G, PyObject *__pyx_v_m) {
  GEN __pyx_v__G;
  GEN __pyx_v__m;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  GEN __pyx_t_3;
  __Pyx_RefNannySetupContext("znconreylog", 0);
  __Pyx_INCREF(__pyx_v_m);

  /* "cypari/auto_gen.pxi":28154
 *             %12 = [10, 1, 0, 1, 1]
 *         '''
 *         m = objtogen(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_m, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28154, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_m, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":28155
 *         '''
 *         m = objtogen(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(10, 28155, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28156
 *         m = objtogen(m)
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g             # <<<<<<<<<<<<<<
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreylog(_G, _m)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_G)->__pyx_base.g;
  __pyx_v__G = __pyx_t_3;

  /* "cypari/auto_gen.pxi":28157
 *         sig_on()
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znconreylog(_G, _m)
 *         return new_gen(_ret)
 */
  __pyx_t_3 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_m)->__pyx_base.g;
  __pyx_v__m = __pyx_t_3;

  /* "cypari/auto_gen.pxi":28158
 *         cdef GEN _G = (<Gen>G).g
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreylog(_G, _m)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znconreylog(__pyx_v__G, __pyx_v__m);

  /* "cypari/auto_gen.pxi":28159
 *         cdef GEN _m = (<Gen>m).g
 *         cdef GEN _ret = znconreylog(_G, _m)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def zncoppersmith(P, N, X, B=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":28068
 *         return new_gen(_ret)
 * 
 *     def znconreylog(G, m):             # <<<<<<<<<<<<<<
 *         r'''
 *         Given a :emphasis:`znstar` attached to :math:`(\mathbb{Z}/q\mathbb{Z})^*` (as per
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znconreylog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_m);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":28161
 *         return new_gen(_ret)
 * 
 *     def zncoppersmith(P, N, X, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N` being an integer and :math:`P\in \mathbb{Z}[X]`, finds all integers :math:`x` with
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1625zncoppersmith(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1624zncoppersmith[] = "\n        :math:`N` being an integer and :math:`P\\in \\mathbb{Z}[X]`, finds all integers :math:`x` with\n        :math:`\\|x\\| <= X` such that\n        \n        .. MATH::\n        \n            \\mathrm{gcd} (N, P(x)) >= B,\n        \n        using Coppersmith's algorithm, a famous application of the LLL\n        algorithm meant to help in the factorization of :math:`N`. The parameter :math:`X` must be\n        smaller than\n        :math:`\\exp (\\log^2 (B/p) / (\\deg (P) \\log (N/p)))`, where :math:`p` is the gcd of the\n        leading coefficient of :math:`P` and :math:`N`. In applications to factorization,\n        we should have :math:`p = 1` (otherwise we have factored :math:`N` if :math:`p != N`\n        or we can reduce the degree of :math:`P`); for :math:`B = N` and :math:`p = 1`, the condition\n        means :math:`X < N^{1/\\deg (P)}`. Some :math:`x` larger than :math:`X` may be returned if you are\n        very lucky. The routine runs in polynomial time in :math:`\\deg (P)` and :math:`\\log N`\n        but the smaller :math:`B`, or the larger :math:`X`, the slower.\n        The strength of Coppersmith method is the ability to find roots modulo a\n        general :emphasis:`composite` :math:`N`: if :math:`N` is a prime or a prime power,\n        :literal:`polrootsmod` or :literal:`polrootspadic` will be much faster.\n        \n        We shall now present two simple applications. The first one is\n        finding non-trivial factors of :math:`N`, given some partial information on the\n        factors; in that case :math:`B` must obviously be smaller than the largest\n        non-trivial divisor of :math:`N`.\n        \n        ::\n        \n            setrand(1); \\\\ to make the example reproducible\n            [a,b] = [10^30, 10^31]; D = 20;\n            p = randomprime([a,b]);\n            q = randomprime([a,b]); N = p*q;\n            \\\\ assume we know 0) p | N; 1) p in [a,b]; 2) the last D digits of p\n            p0 = p % 10^D;\n            ""\n            ? L = zncoppersmith(10^D*x + p0, N, b \\ 10^D, a)\n            time = 1ms.\n            %6 = [738281386540]\n            ? gcd(L[1] * 10^D + p0, N) == p\n            %7 = 1\n        \n        and we recovered :math:`p`, faster than by trying all\n        possibilities :math:`x < 10^{11}`.\n        \n        The second application is an attack on RSA with low exponent, when the\n        message :math:`x` is short and the padding :math:`P` is known to the attacker. We use\n        the same RSA modulus :math:`N` as in the first example:\n        \n        ::\n        \n            setrand(1);\n            P = random(N); \\\\ known padding\n            e = 3; \\\\ small public encryption exponent\n            X = floor(N^0.3); \\\\ N^(1/e - epsilon)\n            x0 = random(X); \\\\ unknown short message\n            C = lift( (Mod(x0,N) + P)^e ); \\\\ known ciphertext, with padding P\n            zncoppersmith((P + x)^3 - C, N, X)\n            \n            \\\\ result in 244ms.\n            %14 = [2679982004001230401]\n            \n            ? %[1] == x0\n            %15 = 1\n        \n        We guessed an integer of the order of :math:`10^{18}`, almost instantly.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1625zncoppersmith(PyObject *__pyx_v_P, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_N = 0;
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_B = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zncoppersmith (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_N,&__pyx_n_s_X,&__pyx_n_s_B,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((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  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_N)) != 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_X)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zncoppersmith", 0, 2, 3, 1); __PYX_ERR(10, 28161, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zncoppersmith") < 0)) __PYX_ERR(10, 28161, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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_N = values[0];
    __pyx_v_X = values[1];
    __pyx_v_B = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zncoppersmith", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 28161, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.zncoppersmith", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1624zncoppersmith(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_P), __pyx_v_N, __pyx_v_X, __pyx_v_B);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1624zncoppersmith(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_P, PyObject *__pyx_v_N, PyObject *__pyx_v_X, PyObject *__pyx_v_B) {
  int __pyx_v__have_B;
  GEN __pyx_v__P;
  GEN __pyx_v__N;
  GEN __pyx_v__X;
  GEN __pyx_v__B;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("zncoppersmith", 0);
  __Pyx_INCREF(__pyx_v_N);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_INCREF(__pyx_v_B);

  /* "cypari/auto_gen.pxi":28229
 *         We guessed an integer of the order of :math:`10^{18}`, almost instantly.
 *         '''
 *         N = objtogen(N)             # <<<<<<<<<<<<<<
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_N, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28229, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_N, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":28230
 *         '''
 *         N = objtogen(N)
 *         X = objtogen(X)             # <<<<<<<<<<<<<<
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_X, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_X, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":28231
 *         N = objtogen(N)
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             B = objtogen(B)
 */
  __pyx_t_2 = (__pyx_v_B != Py_None);
  __pyx_v__have_B = __pyx_t_2;

  /* "cypari/auto_gen.pxi":28232
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":28233
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:
 *             B = objtogen(B)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_B, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":28232
 *         X = objtogen(X)
 *         cdef bint _have_B = (B is not None)
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             B = objtogen(B)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":28234
 *         if _have_B:
 *             B = objtogen(B)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _N = (<Gen>N).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 28234, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28235
 *             B = objtogen(B)
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g             # <<<<<<<<<<<<<<
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _X = (<Gen>X).g
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_P)->__pyx_base.g;
  __pyx_v__P = __pyx_t_4;

  /* "cypari/auto_gen.pxi":28236
 *         sig_on()
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _N = (<Gen>N).g             # <<<<<<<<<<<<<<
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_N)->__pyx_base.g;
  __pyx_v__N = __pyx_t_4;

  /* "cypari/auto_gen.pxi":28237
 *         cdef GEN _P = (<Gen>P).g
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _X = (<Gen>X).g             # <<<<<<<<<<<<<<
 *         cdef GEN _B = NULL
 *         if _have_B:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_X)->__pyx_base.g;
  __pyx_v__X = __pyx_t_4;

  /* "cypari/auto_gen.pxi":28238
 *         cdef GEN _N = (<Gen>N).g
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL             # <<<<<<<<<<<<<<
 *         if _have_B:
 *             _B = (<Gen>B).g
 */
  __pyx_v__B = NULL;

  /* "cypari/auto_gen.pxi":28239
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 */
  __pyx_t_2 = (__pyx_v__have_B != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":28240
 *         cdef GEN _B = NULL
 *         if _have_B:
 *             _B = (<Gen>B).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_B)->__pyx_base.g;
    __pyx_v__B = __pyx_t_4;

    /* "cypari/auto_gen.pxi":28239
 *         cdef GEN _X = (<Gen>X).g
 *         cdef GEN _B = NULL
 *         if _have_B:             # <<<<<<<<<<<<<<
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 */
  }

  /* "cypari/auto_gen.pxi":28241
 *         if _have_B:
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = zncoppersmith(__pyx_v__P, __pyx_v__N, __pyx_v__X, __pyx_v__B);

  /* "cypari/auto_gen.pxi":28242
 *             _B = (<Gen>B).g
 *         cdef GEN _ret = zncoppersmith(_P, _N, _X, _B)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znlog(x, g, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":28161
 *         return new_gen(_ret)
 * 
 *     def zncoppersmith(P, N, X, B=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`N` being an integer and :math:`P\in \mathbb{Z}[X]`, finds all integers :math:`x` with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.zncoppersmith", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_N);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_B);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":28244
 *         return new_gen(_ret)
 * 
 *     def znlog(x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This functions allows two distinct modes of operation depending
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1627znlog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1626znlog[] = "\n        This functions allows two distinct modes of operation depending\n        on :math:`g`:\n        \n        - if :math:`g` is the output of :literal:`znstar` (with initialization),\n          we compute the discrete logarithm of :math:`x` with respect to the generators\n          contained in the structure. See :literal:`ideallog` for details.\n        \n        - else :math:`g` is an explicit element in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*`, we compute the\n          discrete logarithm of :math:`x` in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` in base :math:`g`. The rest of this\n          entry describes the latter possibility.\n        \n        The result is :math:`[]` when :math:`x` is not a power of :math:`g`, though the function may\n        also enter an infinite loop in this case.\n        \n        If present, :math:`o` represents the multiplicative order of :math:`g`, see\n        ``DLfun`` (in the PARI manual); the preferred format for this parameter is\n        :literal:`[ord, factor(ord)]`, where :literal:`ord` is the order of :math:`g`.\n        This provides a definite speedup when the discrete log problem is simple:\n        \n        ::\n        \n            ? p = nextprime(10^4); g = znprimroot(p); o = [p-1, factor(p-1)];\n            ? for(i=1,10^4, znlog(i, g, o))\n            time = 163 ms.\n            ? for(i=1,10^4, znlog(i, g))\n            time = 200 ms. \\\\ a little slower\n        \n        The result is undefined if :math:`g` is not invertible mod :math:`N` or if the supplied\n        order is incorrect.\n        \n        This function uses\n        \n        - a combination of generic discrete log algorithms (see below).\n        \n        - in :math:`(\\mathbb{Z}/N\\mathbb{Z})^*` when :math:`N` is prime: a linear sieve index calculus\n          method, suitable for :math:`N < 10^{50}`, say, is used for large prime divisors of\n          the order.\n        \n        The generic discrete log algorithms are:\n        \n        - Poh""lig-Hellman algorithm, to reduce to groups of prime order :math:`q`,\n          where :math:`q \\| p-1` and :math:`p` is an odd prime divisor of :math:`N`,\n        \n        - Shanks baby-step/giant-step (:math:`q < 2^{32}` is small),\n        \n        - Pollard rho method (:math:`q > 2^{32}`).\n        \n        The latter two algorithms require :math:`O(\\sqrt{q})` operations in the group on\n        average, hence will not be able to treat cases where :math:`q > 10^{30}`, say.\n        In addition, Pollard rho is not able to handle the case where there are no\n        solutions: it will enter an infinite loop.\n        \n        ::\n        \n            ? g = znprimroot(101)\n            %1 = Mod(2,101)\n            ? znlog(5, g)\n            %2 = 24\n            ? g^24\n            %3 = Mod(5, 101)\n            \n            ? G = znprimroot(2 * 101^10)\n            %4 = Mod(110462212541120451003, 220924425082240902002)\n            ? znlog(5, G)\n            %5 = 76210072736547066624\n            ? G^% == 5\n            %6 = 1\n            ? N = 2^4*3^2*5^3*7^4*11; g = Mod(13, N); znlog(g^110, g)\n            %7 = 110\n            ? znlog(6, Mod(2,3)) \\\\ no solution\n            %8 = []\n        \n        For convenience, :math:`g` is also allowed to be a :math:`p`-adic number:\n        \n        ::\n        \n            ? g = 3+O(5^10); znlog(2, g)\n            %1 = 1015243\n            ? g^%\n            %2 = 2 + O(5^10)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1627znlog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_g = 0;
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znlog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g,&__pyx_n_s_o,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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_g)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znlog") < 0)) __PYX_ERR(10, 28244, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_g = values[0];
    __pyx_v_o = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znlog", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 28244, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.znlog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1626znlog(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_g, __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1626znlog(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_g, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__g;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("znlog", 0);
  __Pyx_INCREF(__pyx_v_g);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_gen.pxi":28327
 *             %2 = 2 + O(5^10)
 *         '''
 *         g = objtogen(g)             # <<<<<<<<<<<<<<
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_g, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_g, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/auto_gen.pxi":28328
 *         '''
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_2 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_2;

  /* "cypari/auto_gen.pxi":28329
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":28330
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "cypari/auto_gen.pxi":28329
 *         g = objtogen(g)
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":28331
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 28331, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28332
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":28333
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_g)->__pyx_base.g;
  __pyx_v__g = __pyx_t_4;

  /* "cypari/auto_gen.pxi":28334
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_gen.pxi":28335
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 */
  __pyx_t_2 = (__pyx_v__have_o != 0);
  if (__pyx_t_2) {

    /* "cypari/auto_gen.pxi":28336
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_gen.pxi":28335
 *         cdef GEN _g = (<Gen>g).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 */
  }

  /* "cypari/auto_gen.pxi":28337
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znlog0(__pyx_v__x, __pyx_v__g, __pyx_v__o);

  /* "cypari/auto_gen.pxi":28338
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znlog0(_x, _g, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znorder(x, o=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 28338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":28244
 *         return new_gen(_ret)
 * 
 *     def znlog(x, g, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         This functions allows two distinct modes of operation depending
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znlog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":28340
 *         return new_gen(_ret)
 * 
 *     def znorder(x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be an integer mod :math:`n`, and the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1629znorder(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1628znorder[] = "\n        :math:`x` must be an integer mod :math:`n`, and the\n        result is the order of :math:`x` in the multiplicative group :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`. Returns\n        an error if :math:`x` is not invertible.\n        The parameter o, if present, represents a non-zero\n        multiple of the order of :math:`x`, see ``DLfun`` (in the PARI manual); the preferred format for\n        this parameter is :literal:`[ord, factor(ord)]`, where :literal:`ord = eulerphi(n)`\n        is the cardinality of the group.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1629znorder(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_o = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znorder (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_o,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_o);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znorder") < 0)) __PYX_ERR(10, 28340, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_o = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znorder", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 28340, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.znorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1628znorder(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_x), __pyx_v_o);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1628znorder(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_x, PyObject *__pyx_v_o) {
  int __pyx_v__have_o;
  GEN __pyx_v__x;
  GEN __pyx_v__o;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GEN __pyx_t_4;
  __Pyx_RefNannySetupContext("znorder", 0);
  __Pyx_INCREF(__pyx_v_o);

  /* "cypari/auto_gen.pxi":28350
 *         is the cardinality of the group.
 *         '''
 *         cdef bint _have_o = (o is not None)             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             o = objtogen(o)
 */
  __pyx_t_1 = (__pyx_v_o != Py_None);
  __pyx_v__have_o = __pyx_t_1;

  /* "cypari/auto_gen.pxi":28351
 *         '''
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  __pyx_t_1 = (__pyx_v__have_o != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":28352
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:
 *             o = objtogen(o)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_o, 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 28352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_o, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/auto_gen.pxi":28351
 *         '''
 *         cdef bint _have_o = (o is not None)
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             o = objtogen(o)
 *         sig_on()
 */
  }

  /* "cypari/auto_gen.pxi":28353
 *         if _have_o:
 *             o = objtogen(o)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(10, 28353, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28354
 *             o = objtogen(o)
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g             # <<<<<<<<<<<<<<
 *         cdef GEN _o = NULL
 *         if _have_o:
 */
  __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x)->__pyx_base.g;
  __pyx_v__x = __pyx_t_4;

  /* "cypari/auto_gen.pxi":28355
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL             # <<<<<<<<<<<<<<
 *         if _have_o:
 *             _o = (<Gen>o).g
 */
  __pyx_v__o = NULL;

  /* "cypari/auto_gen.pxi":28356
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)
 */
  __pyx_t_1 = (__pyx_v__have_o != 0);
  if (__pyx_t_1) {

    /* "cypari/auto_gen.pxi":28357
 *         cdef GEN _o = NULL
 *         if _have_o:
 *             _o = (<Gen>o).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znorder(_x, _o)
 *         return new_gen(_ret)
 */
    __pyx_t_4 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_o)->__pyx_base.g;
    __pyx_v__o = __pyx_t_4;

    /* "cypari/auto_gen.pxi":28356
 *         cdef GEN _x = (<Gen>x).g
 *         cdef GEN _o = NULL
 *         if _have_o:             # <<<<<<<<<<<<<<
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)
 */
  }

  /* "cypari/auto_gen.pxi":28358
 *         if _have_o:
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znorder(__pyx_v__x, __pyx_v__o);

  /* "cypari/auto_gen.pxi":28359
 *             _o = (<Gen>o).g
 *         cdef GEN _ret = znorder(_x, _o)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znprimroot(n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_2)) __PYX_ERR(10, 28359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":28340
 *         return new_gen(_ret)
 * 
 *     def znorder(x, o=None):             # <<<<<<<<<<<<<<
 *         r'''
 *         :math:`x` must be an integer mod :math:`n`, and the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znorder", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_o);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":28361
 *         return new_gen(_ret)
 * 
 *     def znprimroot(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a primitive root (generator) of :math:`(\mathbb{Z}/n\mathbb{Z})^*`, whenever this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1631znprimroot(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1630znprimroot[] = "\n        Returns a primitive root (generator) of :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`, whenever this\n        latter group is cyclic (:math:`n = 4` or :math:`n = 2p^k` or :math:`n = p^k`, where :math:`p` is an\n        odd prime and :math:`k >= 0`). If the group is not cyclic, the result is\n        undefined. If :math:`n` is a prime power, then the smallest positive primitive\n        root is returned. This may not be true for :math:`n = 2p^k`, :math:`p` odd.\n        \n        Note that this function requires factoring :math:`p-1` for :math:`p` as above,\n        in order to determine the exact order of elements in\n        :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`: this is likely to be costly if :math:`p` is large.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1631znprimroot(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znprimroot (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1630znprimroot(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1630znprimroot(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("znprimroot", 0);

  /* "cypari/auto_gen.pxi":28373
 *         :math:`(\mathbb{Z}/n\mathbb{Z})^*`: this is likely to be costly if :math:`p` is large.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znprimroot(_n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 28373, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28374
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znprimroot(_n)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":28375
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znprimroot(_n)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znprimroot(__pyx_v__n);

  /* "cypari/auto_gen.pxi":28376
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znprimroot(_n)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 *     def znstar(n, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 28376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":28361
 *         return new_gen(_ret)
 * 
 *     def znprimroot(n):             # <<<<<<<<<<<<<<
 *         r'''
 *         Returns a primitive root (generator) of :math:`(\mathbb{Z}/n\mathbb{Z})^*`, whenever this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znprimroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/auto_gen.pxi":28378
 *         return new_gen(_ret)
 * 
 *     def znstar(n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the structure of the multiplicative group :math:`(\mathbb{Z}/n\mathbb{Z})^*`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1633znstar(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_8Gen_base_1632znstar[] = "\n        Gives the structure of the multiplicative group :math:`(\\mathbb{Z}/n\\mathbb{Z})^*`.\n        The output :math:`G` depends on the value of :emphasis:`flag`:\n        \n        - :math:`flag = 0` (default), an abelian group structure :math:`[h,d,g]`,\n          where :math:`h = \\phi (n)` is the order (:literal:`G.no`), :math:`d` (:literal:`G.cyc`)\n          is a :math:`k`-component row-vector :math:`d` of integers :math:`d_i` such that :math:`d_i > 1`,\n          :math:`d_i \\| d_{i-1}` for :math:`i >= 2` and\n          \n        \n        .. MATH::\n        \n            (\\mathbb{Z}/n\\mathbb{Z})^* ~ \\prod_{i = 1}^k (\\mathbb{Z}/d_i\\mathbb{Z}),\n        \n          and :math:`g` (:literal:`G.gen`) is a :math:`k`-component row vector giving generators of\n          the image of the cyclic groups :math:`\\mathbb{Z}/d_i\\mathbb{Z}`.\n        \n        - :math:`flag = 1` the result is a :literal:`bid` structure;\n          this allows computing discrete logarithms using :literal:`znlog` (also in the\n          non-cyclic case!).\n        \n        ::\n        \n            ? G = znstar(40)\n            %1 = [16, [4, 2, 2], [Mod(17, 40), Mod(21, 40), Mod(11, 40)]]\n            ? G.no \\\\ eulerphi(40)\n            %2 = 16\n            ? G.cyc \\\\ cycle structure\n            %3 = [4, 2, 2]\n            ? G.gen \\\\ generators for the cyclic components\n            %4 = [Mod(17, 40), Mod(21, 40), Mod(11, 40)]\n            ? apply(znorder, G.gen)\n            %5 = [4, 2, 2]\n        \n        For user convenience, we define :literal:`znstar(0)` as\n        :literal:`[2, [2], [-1]]`, corresponding to :math:`\\mathbb{Z}^*`, but :math:`flag = 1` is not\n        implemented in this trivial case.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1633znstar(PyObject *__pyx_v_n, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("znstar (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "znstar") < 0)) __PYX_ERR(10, 28378, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(10, 28378, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("znstar", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(10, 28378, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen_base.znstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1632znstar(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_n), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1632znstar(struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_n, long __pyx_v_flag) {
  GEN __pyx_v__n;
  GEN __pyx_v__ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  GEN __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("znstar", 0);

  /* "cypari/auto_gen.pxi":28417
 *         implemented in this trivial case.
 *         '''
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znstar0(_n, flag)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(10, 28417, __pyx_L1_error)

  /* "cypari/auto_gen.pxi":28418
 *         '''
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g             # <<<<<<<<<<<<<<
 *         cdef GEN _ret = znstar0(_n, flag)
 *         return new_gen(_ret)
 */
  __pyx_t_2 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n)->__pyx_base.g;
  __pyx_v__n = __pyx_t_2;

  /* "cypari/auto_gen.pxi":28419
 *         sig_on()
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znstar0(_n, flag)             # <<<<<<<<<<<<<<
 *         return new_gen(_ret)
 * 
 */
  __pyx_v__ret = znstar0(__pyx_v__n, __pyx_v_flag);

  /* "cypari/auto_gen.pxi":28420
 *         cdef GEN _n = (<Gen>n).g
 *         cdef GEN _ret = znstar0(_n, flag)
 *         return new_gen(_ret)             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v__ret)); if (unlikely(!__pyx_t_3)) __PYX_ERR(10, 28420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/auto_gen.pxi":28378
 *         return new_gen(_ret)
 * 
 *     def znstar(n, long flag=0):             # <<<<<<<<<<<<<<
 *         r'''
 *         Gives the structure of the multiplicative group :math:`(\mathbb{Z}/n\mathbb{Z})^*`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen_base.znstar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1635__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1635__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1634__reduce_cython__(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1634__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__79, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(8, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1637__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_8Gen_base_1637__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_8Gen_base_1636__setstate_cython__(((struct __pyx_obj_6cypari_5_pari_Gen_base *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_8Gen_base_1636__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen_base *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__80, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(8, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen_base.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":90
 * include 'auto_gen.pxi'
 * 
 * cdef pari_longword_to_int(pari_longword x):             # <<<<<<<<<<<<<<
 *     return int(x)
 * 
 */

static PyObject *__pyx_f_6cypari_5_pari_pari_longword_to_int(__pyx_t_6cypari_8paridecl_pari_longword __pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pari_longword_to_int", 0);

  /* "cypari/gen.pyx":91
 * 
 * cdef pari_longword_to_int(pari_longword x):
 *     return int(x)             # <<<<<<<<<<<<<<
 * 
 * @cython.final
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":90
 * include 'auto_gen.pxi'
 * 
 * cdef pari_longword_to_int(pari_longword x):             # <<<<<<<<<<<<<<
 *     return int(x)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.pari_longword_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":98
 *     Cython extension class that models the PARI GEN type.
 *     """
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("PARI objects cannot be instantiated directly; use pari(x) to convert x to PARI")
 * 
 */

/* Python wrapper */
static int __pyx_pw_6cypari_5_pari_3Gen_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_6cypari_5_pari_3Gen_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen___init__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6cypari_5_pari_3Gen___init__(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "cypari/gen.pyx":99
 *     """
 *     def __init__(self):
 *         raise RuntimeError("PARI objects cannot be instantiated directly; use pari(x) to convert x to PARI")             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__81, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(6, 99, __pyx_L1_error)

  /* "cypari/gen.pyx":98
 *     Cython extension class that models the PARI GEN type.
 *     """
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         raise RuntimeError("PARI objects cannot be instantiated directly; use pari(x) to convert x to PARI")
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":101
 *         raise RuntimeError("PARI objects cannot be instantiated directly; use pari(x) to convert x to PARI")
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         sig_free(<void*>self.b)
 * 
 */

/* Python wrapper */
static void __pyx_pw_6cypari_5_pari_3Gen_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_6cypari_5_pari_3Gen_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_6cypari_5_pari_3Gen_2__dealloc__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_6cypari_5_pari_3Gen_2__dealloc__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "cypari/gen.pyx":102
 * 
 *     def __dealloc__(self):
 *         sig_free(<void*>self.b)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  sig_free(((void *)__pyx_v_self->__pyx_base.b));

  /* "cypari/gen.pyx":101
 *         raise RuntimeError("PARI objects cannot be instantiated directly; use pari(x) to convert x to PARI")
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         sig_free(<void*>self.b)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "cypari/gen.pyx":104
 *         sig_free(<void*>self.b)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Display representation of a gen.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_5__repr__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_4__repr__[] = "\n        Display representation of a gen.\n\n        OUTPUT: a Python string\n\n        EXAMPLES::\n\n            sage: pari('vector(5,i,i)')\n            [1, 2, 3, 4, 5]\n            sage: pari('[1,2;3,4]')\n            [1, 2; 3, 4]\n            sage: pari('Str(hello)')\n            \"hello\"\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_4__repr__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_5__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_4__repr__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_4__repr__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  char *__pyx_v_c;
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "cypari/gen.pyx":120
 *         """
 *         cdef char *c
 *         sig_on()             # <<<<<<<<<<<<<<
 *         # Use sig_block(), which is needed because GENtostr() uses
 *         # malloc(), which is dangerous inside sig_on()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 120, __pyx_L1_error)

  /* "cypari/gen.pyx":123
 *         # Use sig_block(), which is needed because GENtostr() uses
 *         # malloc(), which is dangerous inside sig_on()
 *         sig_block()             # <<<<<<<<<<<<<<
 *         c = GENtostr(self.g)
 *         sig_unblock()
 */
  sig_block();

  /* "cypari/gen.pyx":124
 *         # malloc(), which is dangerous inside sig_on()
 *         sig_block()
 *         c = GENtostr(self.g)             # <<<<<<<<<<<<<<
 *         sig_unblock()
 *         sig_off()
 */
  __pyx_v_c = GENtostr(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":125
 *         sig_block()
 *         c = GENtostr(self.g)
 *         sig_unblock()             # <<<<<<<<<<<<<<
 *         sig_off()
 * 
 */
  sig_unblock();

  /* "cypari/gen.pyx":126
 *         c = GENtostr(self.g)
 *         sig_unblock()
 *         sig_off()             # <<<<<<<<<<<<<<
 * 
 *         s = String(c)
 */
  sig_off();

  /* "cypari/gen.pyx":128
 *         sig_off()
 * 
 *         s = String(c)             # <<<<<<<<<<<<<<
 *         pari_free(c)
 *         return s
 */
  __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_f_6cypari_5_pari_String(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 128, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_s = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "cypari/gen.pyx":129
 * 
 *         s = String(c)
 *         pari_free(c)             # <<<<<<<<<<<<<<
 *         return s
 * 
 */
  pari_free(__pyx_v_c);

  /* "cypari/gen.pyx":130
 *         s = String(c)
 *         pari_free(c)
 *         return s             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_s);
  __pyx_r = __pyx_v_s;
  goto __pyx_L0;

  /* "cypari/gen.pyx":104
 *         sig_free(<void*>self.b)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Display representation of a gen.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":132
 *         return s
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert this Gen to a string.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_7__str__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_6__str__[] = "\n        Convert this Gen to a string.\n\n        Except for PARI strings, we have ``str(x) == repr(x)``.\n        For strings (type ``t_STR``), the returned string is not quoted.\n\n        OUTPUT: a Python string\n\n        EXAMPLES::\n\n            sage: print(pari('vector(5,i,i)'))\n            [1, 2, 3, 4, 5]\n            sage: print(pari('[1,2;3,4]'))\n            [1, 2; 3, 4]\n            sage: print(pari('Str(hello)'))\n            hello\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_6__str__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_7__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_6__str__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_6__str__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "cypari/gen.pyx":151
 *         """
 *         # Use __repr__ except for strings
 *         if typ(self.g) == t_STR:             # <<<<<<<<<<<<<<
 *             return String(GSTR(self.g))
 *         return repr(self)
 */
  __pyx_t_1 = ((typ(__pyx_v_self->__pyx_base.g) == t_STR) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":152
 *         # Use __repr__ except for strings
 *         if typ(self.g) == t_STR:
 *             return String(GSTR(self.g))             # <<<<<<<<<<<<<<
 *         return repr(self)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBytes_FromString(GSTR(__pyx_v_self->__pyx_base.g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_f_6cypari_5_pari_String(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 152, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":151
 *         """
 *         # Use __repr__ except for strings
 *         if typ(self.g) == t_STR:             # <<<<<<<<<<<<<<
 *             return String(GSTR(self.g))
 *         return repr(self)
 */
  }

  /* "cypari/gen.pyx":153
 *         if typ(self.g) == t_STR:
 *             return String(GSTR(self.g))
 *         return repr(self)             # <<<<<<<<<<<<<<
 * 
 *     def __hash__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 153, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":132
 *         return s
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert this Gen to a string.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":155
 *         return repr(self)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the hash of self, computed using PARI's hash_GEN().
 */

/* Python wrapper */
static Py_hash_t __pyx_pw_6cypari_5_pari_3Gen_9__hash__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_8__hash__[] = "\n        Return the hash of self, computed using PARI's hash_GEN().\n\n        TESTS::\n\n            sage: type(pari('1 + 2.0*I').__hash__())\n            <... 'int'>\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_8__hash__;
#endif
static Py_hash_t __pyx_pw_6cypari_5_pari_3Gen_9__hash__(PyObject *__pyx_v_self) {
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hash__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_8__hash__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_hash_t __pyx_pf_6cypari_5_pari_3Gen_8__hash__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_h;
  Py_hash_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__hash__", 0);

  /* "cypari/gen.pyx":165
 *         """
 *         cdef long h
 *         sig_on()             # <<<<<<<<<<<<<<
 *         h = <long>hash_GEN(self.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 165, __pyx_L1_error)

  /* "cypari/gen.pyx":166
 *         cdef long h
 *         sig_on()
 *         h = <long>hash_GEN(self.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return h
 */
  __pyx_v_h = ((long)hash_GEN(__pyx_v_self->__pyx_base.g));

  /* "cypari/gen.pyx":167
 *         sig_on()
 *         h = <long>hash_GEN(self.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return h
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":168
 *         h = <long>hash_GEN(self.g)
 *         sig_off()
 *         return h             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_r = __pyx_v_h;
  goto __pyx_L0;

  /* "cypari/gen.pyx":155
 *         return repr(self)
 * 
 *     def __hash__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the hash of self, computed using PARI's hash_GEN().
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.__hash__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  if (unlikely(__pyx_r == -1) && !PyErr_Occurred()) __pyx_r = -2;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":170
 *         return h
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Iterate over the components of ``self``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_11__iter__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_10__iter__[] = "\n        Iterate over the components of ``self``.\n\n        The items in the iteration are of type :class:`Gen` with the\n        following exceptions:\n\n        - items of a ``t_VECSMALL`` are of type ``int``\n\n        - items of a ``t_STR`` are of type ``str``\n\n        EXAMPLES:\n\n        We can iterate over PARI vectors or columns::\n\n            sage: L = pari(\"vector(10,i,i^2)\")\n            sage: L.__iter__()\n            <generator object at ...>\n            sage: [x for x in L]\n            [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n            sage: list(L)\n            [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n            sage: list(pari(\"vector(10,i,i^2)~\"))\n            [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n\n        For polynomials, we iterate over the list of coefficients::\n\n            sage: pol = pari(\"x^3 + 5/3*x\"); list(pol)\n            [0, 5/3, 0, 1]\n\n        For power series or Laurent series, we get all coefficients starting\n        from the lowest degree term.  This includes trailing zeros::\n\n            sage: list(pari('x^2 + O(x^8)'))\n            [1, 0, 0, 0, 0, 0]\n            sage: list(pari('x^-2 + O(x^0)'))\n            [1, 0]\n\n        For matrices, we iterate over the columns::\n\n            sage: M = pari.matrix(3,2,[1,4,2,5,3,6]); M\n            [1, 4; 2, 5; 3, 6]\n            sage: list(M)\n            [[1, 2, 3]~, [4, 5, 6]~]\n\n        Other types are first converted to a vector using :meth:`Vec`::\n\n            sage: Q = pari('Qfb(1, 2, 3)')\n            sage: tuple(Q)\n            (1, 2, 3)\n            sage: Q.Vec()\n            [1, 2, 3]\n\n        We get an error for \"scalar\" types or for types which cannot be\n        converted to a PARI vector::\n\n            sage: iter(pari(42))\n            Traceback (most recent call last):\n            ...\n            TypeError: PARI object of type 't_INT' is not iterable\n            sage: iter(pari(\"x->x\"))\n            Traceback (most recent call last):""\n            ...\n            PariError: incorrect type in gtovec (t_CLOSURE)\n\n        For ``t_VECSMALL``, the items are Python integers::\n\n            sage: v = pari(\"Vecsmall([1,2,3,4,5,6])\")\n            sage: list(v)\n            [1, 2, 3, 4, 5, 6]\n            sage: type(list(v)[0]).__name__\n            'int'\n\n        For ``t_STR``, the items are Python strings::\n\n            sage: v = pari('\"hello\"')\n            sage: list(v)\n            ['h', 'e', 'l', 'l', 'o']\n\n        TESTS:\n\n        The following are deprecated::\n\n            sage: tuple(pari('3/5'))\n            doctest:...: DeprecationWarning: iterating a PARI 't_FRAC' is deprecated\n            (3, 5)\n            sage: tuple(pari('1 + 5*I'))\n            doctest:...: DeprecationWarning: iterating a PARI 't_COMPLEX' is deprecated\n            (1, 5)\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_10__iter__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_11__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_10__iter__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6cypari_5_pari_3Gen_8__iter___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cypari/gen.pyx":282
 *             # Special case: items of type int
 *             x = self.g
 *             return (x[i] for i in range(1, lg(x)))             # <<<<<<<<<<<<<<
 *         elif t == t_STR:
 *             # Special case: convert to str
 */

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_8__iter___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *)__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_1_genexpr(__pyx_ptype_6cypari_5_pari___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 282, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6cypari_5_pari_3Gen_8__iter___2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_iter___locals_genexpr, __pyx_n_s_cypari__pari); if (unlikely(!gen)) __PYX_ERR(6, 282, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.__iter__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6cypari_5_pari_3Gen_8__iter___2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 282, __pyx_L1_error)
  __pyx_t_1 = lg(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_x);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_x[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 282, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6cypari_5_pari_3Gen_8__iter___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cypari/gen.pyx":291
 *         # Now iterate over the vector v
 *         x = v.g
 *         return (new_ref(gel(x, i), v) for i in range(1, lg(x)))             # <<<<<<<<<<<<<<
 * 
 *     def list(self):
 */

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_8__iter___3genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *)__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_2_genexpr(__pyx_ptype_6cypari_5_pari___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 291, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6cypari_5_pari_3Gen_8__iter___5generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_iter___locals_genexpr, __pyx_n_s_cypari__pari); if (unlikely(!gen)) __PYX_ERR(6, 291, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.__iter__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6cypari_5_pari_3Gen_8__iter___5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  long __pyx_t_1;
  long __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 291, __pyx_L1_error)
  __pyx_t_1 = lg(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_x);
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_v)) { __Pyx_RaiseClosureNameError("v"); __PYX_ERR(6, 291, __pyx_L1_error) }
    __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_v);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_ref(gel(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_x, __pyx_cur_scope->__pyx_v_i), ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4))); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 291, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":170
 *         return h
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Iterate over the components of ``self``.
 */

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_10__iter__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *__pyx_cur_scope;
  long __pyx_v_t;
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  Py_UCS4 __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  GEN __pyx_t_10;
  __Pyx_RefNannySetupContext("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *)__pyx_tp_new_6cypari_5_pari___pyx_scope_struct____iter__(__pyx_ptype_6cypari_5_pari___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 170, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }

  /* "cypari/gen.pyx":261
 *         """
 *         cdef long i
 *         cdef long t = typ(self.g)             # <<<<<<<<<<<<<<
 *         cdef GEN x
 * 
 */
  __pyx_v_t = typ(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":266
 *         # First convert self to a vector type
 *         cdef Gen v
 *         if t == t_VEC or t == t_COL or t == t_MAT:             # <<<<<<<<<<<<<<
 *             # These are vector-like and can be iterated over directly
 *             v = self
 */
  switch (__pyx_v_t) {
    case t_VEC:
    case t_COL:
    case t_MAT:
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":268
 *         if t == t_VEC or t == t_COL or t == t_MAT:
 *             # These are vector-like and can be iterated over directly
 *             v = self             # <<<<<<<<<<<<<<
 *         elif t == t_POL:
 *             v = self.Vecrev()
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __pyx_cur_scope->__pyx_v_v = __pyx_v_self;

    /* "cypari/gen.pyx":266
 *         # First convert self to a vector type
 *         cdef Gen v
 *         if t == t_VEC or t == t_COL or t == t_MAT:             # <<<<<<<<<<<<<<
 *             # These are vector-like and can be iterated over directly
 *             v = self
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":269
 *             # These are vector-like and can be iterated over directly
 *             v = self
 *         elif t == t_POL:             # <<<<<<<<<<<<<<
 *             v = self.Vecrev()
 *         elif t == t_FRAC or t == t_RFRAC or t == t_COMPLEX:
 */
  __pyx_t_1 = ((__pyx_v_t == t_POL) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":270
 *             v = self
 *         elif t == t_POL:
 *             v = self.Vecrev()             # <<<<<<<<<<<<<<
 *         elif t == t_FRAC or t == t_RFRAC or t == t_COMPLEX:
 *             # Also treat as vector
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Vecrev); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 270, __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(6, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(6, 270, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_v_v = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "cypari/gen.pyx":269
 *             # These are vector-like and can be iterated over directly
 *             v = self
 *         elif t == t_POL:             # <<<<<<<<<<<<<<
 *             v = self.Vecrev()
 *         elif t == t_FRAC or t == t_RFRAC or t == t_COMPLEX:
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":271
 *         elif t == t_POL:
 *             v = self.Vecrev()
 *         elif t == t_FRAC or t == t_RFRAC or t == t_COMPLEX:             # <<<<<<<<<<<<<<
 *             # Also treat as vector
 *             # Deprecated, make this an error in the future
 */
  switch (__pyx_v_t) {
    case t_FRAC:
    case t_RFRAC:
    case t_COMPLEX:
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":274
 *             # Also treat as vector
 *             # Deprecated, make this an error in the future
 *             from warnings import warn             # <<<<<<<<<<<<<<
 *             warn(f"iterating a PARI {self.type()} is deprecated", DeprecationWarning)
 *             v = self
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_warn);
    __Pyx_GIVEREF(__pyx_n_s_warn);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_warn = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cypari/gen.pyx":275
 *             # Deprecated, make this an error in the future
 *             from warnings import warn
 *             warn(f"iterating a PARI {self.type()} is deprecated", DeprecationWarning)             # <<<<<<<<<<<<<<
 *             v = self
 *         elif is_scalar_t(t):
 */
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = 0;
    __pyx_t_6 = 127;
    __Pyx_INCREF(__pyx_kp_u_iterating_a_PARI);
    __pyx_t_5 += 17;
    __Pyx_GIVEREF(__pyx_kp_u_iterating_a_PARI);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_u_iterating_a_PARI);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_4, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
    __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_kp_u_is_deprecated);
    __pyx_t_5 += 14;
    __Pyx_GIVEREF(__pyx_kp_u_is_deprecated);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_kp_u_is_deprecated);
    __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_2, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 275, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v_warn);
    __pyx_t_2 = __pyx_v_warn; __pyx_t_4 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_9 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_builtin_DeprecationWarning};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 275, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_builtin_DeprecationWarning};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 275, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_7);
      __Pyx_INCREF(__pyx_builtin_DeprecationWarning);
      __Pyx_GIVEREF(__pyx_builtin_DeprecationWarning);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_builtin_DeprecationWarning);
      __pyx_t_7 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cypari/gen.pyx":276
 *             from warnings import warn
 *             warn(f"iterating a PARI {self.type()} is deprecated", DeprecationWarning)
 *             v = self             # <<<<<<<<<<<<<<
 *         elif is_scalar_t(t):
 *             raise TypeError(f"PARI object of type {self.type()} is not iterable")
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __pyx_cur_scope->__pyx_v_v = __pyx_v_self;

    /* "cypari/gen.pyx":271
 *         elif t == t_POL:
 *             v = self.Vecrev()
 *         elif t == t_FRAC or t == t_RFRAC or t == t_COMPLEX:             # <<<<<<<<<<<<<<
 *             # Also treat as vector
 *             # Deprecated, make this an error in the future
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":277
 *             warn(f"iterating a PARI {self.type()} is deprecated", DeprecationWarning)
 *             v = self
 *         elif is_scalar_t(t):             # <<<<<<<<<<<<<<
 *             raise TypeError(f"PARI object of type {self.type()} is not iterable")
 *         elif t == t_VECSMALL:
 */
  __pyx_t_1 = (is_scalar_t(__pyx_v_t) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":278
 *             v = self
 *         elif is_scalar_t(t):
 *             raise TypeError(f"PARI object of type {self.type()} is not iterable")             # <<<<<<<<<<<<<<
 *         elif t == t_VECSMALL:
 *             # Special case: items of type int
 */
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_6 = 127;
    __Pyx_INCREF(__pyx_kp_u_PARI_object_of_type);
    __pyx_t_5 += 20;
    __Pyx_GIVEREF(__pyx_kp_u_PARI_object_of_type);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_PARI_object_of_type);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_FormatSimple(__pyx_t_2, __pyx_empty_unicode); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_8) : __pyx_t_6;
    __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_INCREF(__pyx_kp_u_is_not_iterable);
    __pyx_t_5 += 16;
    __Pyx_GIVEREF(__pyx_kp_u_is_not_iterable);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_is_not_iterable);
    __pyx_t_8 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 278, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(6, 278, __pyx_L1_error)

    /* "cypari/gen.pyx":277
 *             warn(f"iterating a PARI {self.type()} is deprecated", DeprecationWarning)
 *             v = self
 *         elif is_scalar_t(t):             # <<<<<<<<<<<<<<
 *             raise TypeError(f"PARI object of type {self.type()} is not iterable")
 *         elif t == t_VECSMALL:
 */
  }

  /* "cypari/gen.pyx":279
 *         elif is_scalar_t(t):
 *             raise TypeError(f"PARI object of type {self.type()} is not iterable")
 *         elif t == t_VECSMALL:             # <<<<<<<<<<<<<<
 *             # Special case: items of type int
 *             x = self.g
 */
  __pyx_t_1 = ((__pyx_v_t == t_VECSMALL) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":281
 *         elif t == t_VECSMALL:
 *             # Special case: items of type int
 *             x = self.g             # <<<<<<<<<<<<<<
 *             return (x[i] for i in range(1, lg(x)))
 *         elif t == t_STR:
 */
    __pyx_t_10 = __pyx_v_self->__pyx_base.g;
    __pyx_cur_scope->__pyx_v_x = __pyx_t_10;

    /* "cypari/gen.pyx":282
 *             # Special case: items of type int
 *             x = self.g
 *             return (x[i] for i in range(1, lg(x)))             # <<<<<<<<<<<<<<
 *         elif t == t_STR:
 *             # Special case: convert to str
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __pyx_pf_6cypari_5_pari_3Gen_8__iter___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":279
 *         elif is_scalar_t(t):
 *             raise TypeError(f"PARI object of type {self.type()} is not iterable")
 *         elif t == t_VECSMALL:             # <<<<<<<<<<<<<<
 *             # Special case: items of type int
 *             x = self.g
 */
  }

  /* "cypari/gen.pyx":283
 *             x = self.g
 *             return (x[i] for i in range(1, lg(x)))
 *         elif t == t_STR:             # <<<<<<<<<<<<<<
 *             # Special case: convert to str
 *             return iter(String(GSTR(self.g)))
 */
  __pyx_t_1 = ((__pyx_v_t == t_STR) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":285
 *         elif t == t_STR:
 *             # Special case: convert to str
 *             return iter(String(GSTR(self.g)))             # <<<<<<<<<<<<<<
 *         else:
 *             v = self.Vec()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBytes_FromString(GSTR(__pyx_v_self->__pyx_base.g)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __pyx_f_6cypari_5_pari_String(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":283
 *             x = self.g
 *             return (x[i] for i in range(1, lg(x)))
 *         elif t == t_STR:             # <<<<<<<<<<<<<<
 *             # Special case: convert to str
 *             return iter(String(GSTR(self.g)))
 */
  }

  /* "cypari/gen.pyx":287
 *             return iter(String(GSTR(self.g)))
 *         else:
 *             v = self.Vec()             # <<<<<<<<<<<<<<
 * 
 *         # Now iterate over the vector v
 */
  /*else*/ {
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_Vec); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(6, 287, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_cur_scope->__pyx_v_v = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "cypari/gen.pyx":290
 * 
 *         # Now iterate over the vector v
 *         x = v.g             # <<<<<<<<<<<<<<
 *         return (new_ref(gel(x, i), v) for i in range(1, lg(x)))
 * 
 */
  __pyx_t_10 = __pyx_cur_scope->__pyx_v_v->__pyx_base.g;
  __pyx_cur_scope->__pyx_v_x = __pyx_t_10;

  /* "cypari/gen.pyx":291
 *         # Now iterate over the vector v
 *         x = v.g
 *         return (new_ref(gel(x, i), v) for i in range(1, lg(x)))             # <<<<<<<<<<<<<<
 * 
 *     def list(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __pyx_pf_6cypari_5_pari_3Gen_8__iter___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":170
 *         return h
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Iterate over the components of ``self``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cypari._pari.Gen.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":293
 *         return (new_ref(gel(x, i), v) for i in range(1, lg(x)))
 * 
 *     def list(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert self to a list of PARI gens.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_13list(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_12list[] = "\n        Convert self to a list of PARI gens.\n\n        EXAMPLES:\n\n        A PARI vector becomes a Python list::\n\n            sage: L = pari(\"vector(10,i,i^2)\").list()\n            sage: L\n            [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n            sage: type(L)\n            <... 'list'>\n            sage: isinstance(L[0], Gen)\n            True\n\n        For polynomials, list() returns the list of coefficients::\n\n            sage: pol = pari(\"x^3 + 5/3*x\"); pol.list()\n            [0, 5/3, 0, 1]\n\n        For power series or Laurent series, we get all coefficients starting\n        from the lowest degree term.  This includes trailing zeros::\n\n            sage: pari('x^2 + O(x^8)').list()\n            [1, 0, 0, 0, 0, 0]\n            sage: pari('x^-2 + O(x^0)').list()\n            [1, 0]\n\n        For matrices, we get a list of columns::\n\n            sage: M = pari.matrix(3,2,[1,4,2,5,3,6]); M\n            [1, 4; 2, 5; 3, 6]\n            sage: M.list()\n            [[1, 2, 3]~, [4, 5, 6]~]\n\n        TESTS:\n\n        For \"scalar\" types, this is deprecated. Currently, we get a\n        1-element list containing ``self``::\n\n            sage: pari(42).list()\n            doctest:...: DeprecationWarning: calling list() on scalar PARI types is deprecated\n            [42]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_13list(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("list (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_12list(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_12list(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("list", 0);

  /* "cypari/gen.pyx":338
 *             [42]
 *         """
 *         if is_scalar_t(typ(self.g)):             # <<<<<<<<<<<<<<
 *             # Deprecated, make this an error in the future
 *             from warnings import warn
 */
  __pyx_t_1 = (is_scalar_t(typ(__pyx_v_self->__pyx_base.g)) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":340
 *         if is_scalar_t(typ(self.g)):
 *             # Deprecated, make this an error in the future
 *             from warnings import warn             # <<<<<<<<<<<<<<
 *             warn("calling list() on scalar PARI types is deprecated", DeprecationWarning)
 *             return [self]
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_warn);
    __Pyx_GIVEREF(__pyx_n_s_warn);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 340, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_warn = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cypari/gen.pyx":341
 *             # Deprecated, make this an error in the future
 *             from warnings import warn
 *             warn("calling list() on scalar PARI types is deprecated", DeprecationWarning)             # <<<<<<<<<<<<<<
 *             return [self]
 *         return [x for x in self]
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__82, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cypari/gen.pyx":342
 *             from warnings import warn
 *             warn("calling list() on scalar PARI types is deprecated", DeprecationWarning)
 *             return [self]             # <<<<<<<<<<<<<<
 *         return [x for x in self]
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 342, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":338
 *             [42]
 *         """
 *         if is_scalar_t(typ(self.g)):             # <<<<<<<<<<<<<<
 *             # Deprecated, make this an error in the future
 *             from warnings import warn
 */
  }

  /* "cypari/gen.pyx":343
 *             warn("calling list() on scalar PARI types is deprecated", DeprecationWarning)
 *             return [self]
 *         return [x for x in self]             # <<<<<<<<<<<<<<
 * 
 *     def __reduce__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 343, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(((PyObject *)__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_v_self))) {
    __pyx_t_2 = ((PyObject *)__pyx_v_self); __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 343, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(6, 343, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(6, 343, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_6)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(6, 343, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_6);
    __pyx_t_6 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_v_x))) __PYX_ERR(6, 343, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":293
 *         return (new_ref(gel(x, i), v) for i in range(1, lg(x)))
 * 
 *     def list(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert self to a list of PARI gens.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen.list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":345
 *         return [x for x in self]
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_15__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_14__reduce__[] = "\n        EXAMPLES::\n\n            sage: from pickle import loads, dumps\n            sage: f = pari('x^3 - 3')\n            sage: loads(dumps(f)) == f\n            True\n            sage: f = pari('\"hello world\"')\n            sage: loads(dumps(f)) == f\n            True\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_15__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_14__reduce__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_14__reduce__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_v_s = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__reduce__", 0);

  /* "cypari/gen.pyx":357
 *             True
 *         """
 *         s = repr(self)             # <<<<<<<<<<<<<<
 *         return (objtogen, (s,))
 * 
 */
  __pyx_t_1 = PyObject_Repr(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_s = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":358
 *         """
 *         s = repr(self)
 *         return (objtogen, (s,))             # <<<<<<<<<<<<<<
 * 
 *     def __add__(left, right):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_objtogen); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":345
 *         return [x for x in self]
 * 
 *     def __reduce__(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":360
 *         return (objtogen, (s,))
 * 
 *     def __add__(left, right):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` plus ``right``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_17__add__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_16__add__[] = "\n        Return ``left`` plus ``right``.\n\n        EXAMPLES::\n\n            sage: pari(15) + pari(6)\n            21\n            sage: pari(\"x^3+x^2+x+1\") + pari(\"x^2\")\n            x^3 + 2*x^2 + x + 1\n            sage: 2e20 + pari(\"1e20\")\n            3.00000000000000 E20\n            sage: -2 + pari(3)\n            1\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_16__add__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_17__add__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__add__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_16__add__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_16__add__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__add__", 0);

  /* "cypari/gen.pyx":376
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":377
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_left, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 377, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":378
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 378, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":376
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":379
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         sig_on()
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 379, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":380
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gadd(t0.g, t1.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":376
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":381
 *         except Exception:
 *             return NotImplemented
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gadd(t0.g, t1.g))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 381, __pyx_L1_error)

  /* "cypari/gen.pyx":382
 *             return NotImplemented
 *         sig_on()
 *         return new_gen(gadd(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def __sub__(left, right):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gadd(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":360
 *         return (objtogen, (s,))
 * 
 *     def __add__(left, right):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` plus ``right``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":384
 *         return new_gen(gadd(t0.g, t1.g))
 * 
 *     def __sub__(left, right):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` minus ``right``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_19__sub__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_18__sub__[] = "\n        Return ``left`` minus ``right``.\n\n        EXAMPLES::\n\n            sage: pari(15) - pari(6)\n            9\n            sage: pari(\"x^3+x^2+x+1\") - pari(\"x^2\")\n            x^3 + x + 1\n            sage: 2e20 - pari(\"1e20\")\n            1.00000000000000 E20\n            sage: -2 - pari(3)\n            -5\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_18__sub__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_19__sub__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_18__sub__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_18__sub__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__sub__", 0);

  /* "cypari/gen.pyx":400
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":401
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_left, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 401, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":402
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 402, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":400
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":403
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         sig_on()
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 403, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":404
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gsub(t0.g, t1.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":400
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":405
 *         except Exception:
 *             return NotImplemented
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gsub(t0.g, t1.g))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 405, __pyx_L1_error)

  /* "cypari/gen.pyx":406
 *             return NotImplemented
 *         sig_on()
 *         return new_gen(gsub(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(left, right):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gsub(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":384
 *         return new_gen(gadd(t0.g, t1.g))
 * 
 *     def __sub__(left, right):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` minus ``right``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":408
 *         return new_gen(gsub(t0.g, t1.g))
 * 
 *     def __mul__(left, right):             # <<<<<<<<<<<<<<
 *         cdef Gen t0, t1
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_21__mul__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_21__mul__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_20__mul__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_20__mul__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__mul__", 0);

  /* "cypari/gen.pyx":410
 *     def __mul__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":411
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_left, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 411, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":412
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 412, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":410
 *     def __mul__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":413
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         sig_on()
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 413, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":414
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gmul(t0.g, t1.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":410
 *     def __mul__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":415
 *         except Exception:
 *             return NotImplemented
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gmul(t0.g, t1.g))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 415, __pyx_L1_error)

  /* "cypari/gen.pyx":416
 *             return NotImplemented
 *         sig_on()
 *         return new_gen(gmul(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def __div__(left, right):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gmul(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":408
 *         return new_gen(gsub(t0.g, t1.g))
 * 
 *     def __mul__(left, right):             # <<<<<<<<<<<<<<
 *         cdef Gen t0, t1
 *         try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":418
 *         return new_gen(gmul(t0.g, t1.g))
 * 
 *     def __div__(left, right):             # <<<<<<<<<<<<<<
 *         cdef Gen t0, t1
 *         try:
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_23__div__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_23__div__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__div__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_22__div__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000))*/

#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_22__div__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__div__", 0);

  /* "cypari/gen.pyx":420
 *     def __div__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":421
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_left, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 421, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":422
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 422, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":420
 *     def __div__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":423
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         sig_on()
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 423, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":424
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gdiv(t0.g, t1.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":420
 *     def __div__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":425
 *         except Exception:
 *             return NotImplemented
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gdiv(t0.g, t1.g))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 425, __pyx_L1_error)

  /* "cypari/gen.pyx":426
 *             return NotImplemented
 *         sig_on()
 *         return new_gen(gdiv(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def __truediv__(left, right):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gdiv(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":418
 *         return new_gen(gmul(t0.g, t1.g))
 * 
 *     def __div__(left, right):             # <<<<<<<<<<<<<<
 *         cdef Gen t0, t1
 *         try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000))*/

/* "cypari/gen.pyx":428
 *         return new_gen(gdiv(t0.g, t1.g))
 * 
 *     def __truediv__(left, right):             # <<<<<<<<<<<<<<
 *         cdef Gen t0, t1
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_25__truediv__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_25__truediv__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__truediv__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_24__truediv__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_24__truediv__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__truediv__", 0);

  /* "cypari/gen.pyx":430
 *     def __truediv__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":431
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_left, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 431, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":432
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 432, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":430
 *     def __truediv__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":433
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         sig_on()
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__truediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 433, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":434
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gdiv(t0.g, t1.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":430
 *     def __truediv__(left, right):
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":435
 *         except Exception:
 *             return NotImplemented
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gdiv(t0.g, t1.g))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 435, __pyx_L1_error)

  /* "cypari/gen.pyx":436
 *             return NotImplemented
 *         sig_on()
 *         return new_gen(gdiv(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def _add_one(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gdiv(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":428
 *         return new_gen(gdiv(t0.g, t1.g))
 * 
 *     def __truediv__(left, right):             # <<<<<<<<<<<<<<
 *         cdef Gen t0, t1
 *         try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__truediv__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":438
 *         return new_gen(gdiv(t0.g, t1.g))
 * 
 *     def _add_one(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return self + 1.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_27_add_one(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_26_add_one[] = "\n        Return self + 1.\n\n        OUTPUT: pari gen\n\n        EXAMPLES::\n\n            sage: n = pari(5)\n            sage: n._add_one()\n            6\n            sage: n = pari('x^3')\n            sage: n._add_one()\n            x^3 + 1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_27_add_one(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_add_one (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_26_add_one(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_26_add_one(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("_add_one", 0);

  /* "cypari/gen.pyx":453
 *             x^3 + 1
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gaddsg(1, self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 453, __pyx_L1_error)

  /* "cypari/gen.pyx":454
 *         """
 *         sig_on()
 *         return new_gen(gaddsg(1, self.g))             # <<<<<<<<<<<<<<
 * 
 *     def __mod__(left, right):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gaddsg(1, __pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":438
 *         return new_gen(gdiv(t0.g, t1.g))
 * 
 *     def _add_one(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return self + 1.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen._add_one", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":456
 *         return new_gen(gaddsg(1, self.g))
 * 
 *     def __mod__(left, right):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` modulo ``right``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_29__mod__(PyObject *__pyx_v_left, PyObject *__pyx_v_right); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_28__mod__[] = "\n        Return ``left`` modulo ``right``.\n\n        EXAMPLES::\n\n            sage: pari(15) % pari(6)\n            3\n            sage: pari(\"x^3+x^2+x+1\") % pari(\"x^2\")\n            x + 1\n            sage: pari(-2) % 3\n            1\n            sage: -2 % pari(3)\n            1\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_28__mod__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_29__mod__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mod__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_28__mod__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_28__mod__(PyObject *__pyx_v_left, PyObject *__pyx_v_right) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("__mod__", 0);

  /* "cypari/gen.pyx":472
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":473
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_left, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 473, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":474
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 474, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":472
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":475
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         sig_on()
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__mod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 475, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":476
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gmod(t0.g, t1.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":472
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":477
 *         except Exception:
 *             return NotImplemented
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gmod(t0.g, t1.g))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 477, __pyx_L1_error)

  /* "cypari/gen.pyx":478
 *             return NotImplemented
 *         sig_on()
 *         return new_gen(gmod(t0.g, t1.g))             # <<<<<<<<<<<<<<
 * 
 *     def __pow__(left, right, m):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gmod(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":456
 *         return new_gen(gaddsg(1, self.g))
 * 
 *     def __mod__(left, right):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` modulo ``right``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__mod__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":480
 *         return new_gen(gmod(t0.g, t1.g))
 * 
 *     def __pow__(left, right, m):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` to the power ``right`` (if ``m`` is ``None``) or
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_31__pow__(PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_m); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_30__pow__[] = "\n        Return ``left`` to the power ``right`` (if ``m`` is ``None``) or\n        ``Mod(left, m)^right`` if ``m`` is not ``None``.\n\n        EXAMPLES::\n\n            sage: pari(5) ** pari(3)\n            125\n            sage: pari(\"x-1\") ** 3\n            x^3 - 3*x^2 + 3*x - 1\n            sage: pow(pari(5), pari(28), int(29))\n            Mod(1, 29)\n            sage: 2 ** pari(-5)\n            1/32\n            sage: pari(2) ** -5\n            1/32\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_30__pow__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_31__pow__(PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_m) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pow__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_30__pow__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right), ((PyObject *)__pyx_v_m));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_30__pow__(PyObject *__pyx_v_left, PyObject *__pyx_v_right, PyObject *__pyx_v_m) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__pow__", 0);

  /* "cypari/gen.pyx":499
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":500
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_left, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 500, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":501
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 501, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":499
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":502
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         if m is not None:
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 502, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":503
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         if m is not None:
 *             t0 = t0.Mod(m)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":499
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":504
 *         except Exception:
 *             return NotImplemented
 *         if m is not None:             # <<<<<<<<<<<<<<
 *             t0 = t0.Mod(m)
 *         sig_on()
 */
  __pyx_t_8 = (__pyx_v_m != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {

    /* "cypari/gen.pyx":505
 *             return NotImplemented
 *         if m is not None:
 *             t0 = t0.Mod(m)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gpow(t0.g, t1.g, prec_bits_to_words(0)))
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_t0), __pyx_n_s_Mod); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_m) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_m);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(6, 505, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_t0, ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_7));
    __pyx_t_7 = 0;

    /* "cypari/gen.pyx":504
 *         except Exception:
 *             return NotImplemented
 *         if m is not None:             # <<<<<<<<<<<<<<
 *             t0 = t0.Mod(m)
 *         sig_on()
 */
  }

  /* "cypari/gen.pyx":506
 *         if m is not None:
 *             t0 = t0.Mod(m)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gpow(t0.g, t1.g, prec_bits_to_words(0)))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 506, __pyx_L1_error)

  /* "cypari/gen.pyx":507
 *             t0 = t0.Mod(m)
 *         sig_on()
 *         return new_gen(gpow(t0.g, t1.g, prec_bits_to_words(0)))             # <<<<<<<<<<<<<<
 * 
 *     def __neg__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gpow(__pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g, __pyx_f_6cypari_5_pari_prec_bits_to_words(0, 0)))); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":480
 *         return new_gen(gmod(t0.g, t1.g))
 * 
 *     def __pow__(left, right, m):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``left`` to the power ``right`` (if ``m`` is ``None``) or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__pow__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":509
 *         return new_gen(gpow(t0.g, t1.g, prec_bits_to_words(0)))
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gneg(self.g))
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_33__neg__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_33__neg__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_32__neg__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_32__neg__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__neg__", 0);

  /* "cypari/gen.pyx":510
 * 
 *     def __neg__(self):
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gneg(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 510, __pyx_L1_error)

  /* "cypari/gen.pyx":511
 *     def __neg__(self):
 *         sig_on()
 *         return new_gen(gneg(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def __rshift__(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gneg(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":509
 *         return new_gen(gpow(t0.g, t1.g, prec_bits_to_words(0)))
 * 
 *     def __neg__(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gneg(self.g))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":513
 *         return new_gen(gneg(self.g))
 * 
 *     def __rshift__(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Divide ``self`` by `2^n` (truncating or not, depending on the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_35__rshift__(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_34__rshift__[] = "\n        Divide ``self`` by `2^n` (truncating or not, depending on the\n        input type).\n\n        EXAMPLES::\n\n            sage: pari(25) >> 3\n            3\n            sage: pari('25/2') >> 2\n            25/8\n            sage: pari('x') >> 3\n            1/8*x\n            sage: pari(1.0) >> 100\n            7.88860905221012 E-31\n            sage: 33 >> pari(2)\n            8\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_34__rshift__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_35__rshift__(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__rshift__ (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 513, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.__rshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_34__rshift__(((PyObject *)__pyx_v_self), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_34__rshift__(PyObject *__pyx_v_self, long __pyx_v_n) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__rshift__", 0);

  /* "cypari/gen.pyx":531
 *             8
 *         """
 *         cdef Gen t0 = objtogen(self)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gshift(t0.g, -n))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":532
 *         """
 *         cdef Gen t0 = objtogen(self)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gshift(t0.g, -n))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 532, __pyx_L1_error)

  /* "cypari/gen.pyx":533
 *         cdef Gen t0 = objtogen(self)
 *         sig_on()
 *         return new_gen(gshift(t0.g, -n))             # <<<<<<<<<<<<<<
 * 
 *     def __lshift__(self, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gshift(__pyx_v_t0->__pyx_base.g, (-__pyx_v_n)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 533, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":513
 *         return new_gen(gneg(self.g))
 * 
 *     def __rshift__(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Divide ``self`` by `2^n` (truncating or not, depending on the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.__rshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":535
 *         return new_gen(gshift(t0.g, -n))
 * 
 *     def __lshift__(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Multiply ``self`` by `2^n`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_37__lshift__(PyObject *__pyx_v_self, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_36__lshift__[] = "\n        Multiply ``self`` by `2^n`.\n\n        EXAMPLES::\n\n            sage: pari(25) << 3\n            200\n            sage: pari('25/32') << 2\n            25/8\n            sage: pari('x') << 3\n            8*x\n            sage: pari(1.0) << 100\n            1.26765060022823 E30\n            sage: 33 << pari(2)\n            132\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_36__lshift__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_37__lshift__(PyObject *__pyx_v_self, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__lshift__ (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 535, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.__lshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_36__lshift__(((PyObject *)__pyx_v_self), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_36__lshift__(PyObject *__pyx_v_self, long __pyx_v_n) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__lshift__", 0);

  /* "cypari/gen.pyx":552
 *             132
 *         """
 *         cdef Gen t0 = objtogen(self)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gshift(t0.g, n))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_self, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":553
 *         """
 *         cdef Gen t0 = objtogen(self)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gshift(t0.g, n))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 553, __pyx_L1_error)

  /* "cypari/gen.pyx":554
 *         cdef Gen t0 = objtogen(self)
 *         sig_on()
 *         return new_gen(gshift(t0.g, n))             # <<<<<<<<<<<<<<
 * 
 *     def __invert__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gshift(__pyx_v_t0->__pyx_base.g, __pyx_v_n))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":535
 *         return new_gen(gshift(t0.g, -n))
 * 
 *     def __lshift__(self, long n):             # <<<<<<<<<<<<<<
 *         """
 *         Multiply ``self`` by `2^n`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.__lshift__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":556
 *         return new_gen(gshift(t0.g, n))
 * 
 *     def __invert__(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(ginv(self.g))
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_39__invert__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_39__invert__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__invert__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_38__invert__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_38__invert__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__invert__", 0);

  /* "cypari/gen.pyx":557
 * 
 *     def __invert__(self):
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(ginv(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 557, __pyx_L1_error)

  /* "cypari/gen.pyx":558
 *     def __invert__(self):
 *         sig_on()
 *         return new_gen(ginv(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def getattr(self, attr):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(ginv(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":556
 *         return new_gen(gshift(t0.g, n))
 * 
 *     def __invert__(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(ginv(self.g))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.__invert__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":560
 *         return new_gen(ginv(self.g))
 * 
 *     def getattr(self, attr):             # <<<<<<<<<<<<<<
 *         """
 *         Return the PARI attribute with the given name.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_41getattr(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_40getattr[] = "\n        Return the PARI attribute with the given name.\n\n        EXAMPLES::\n\n            sage: K = pari(\"nfinit(x^2 - x - 1)\")\n            sage: K.getattr(\"pol\")\n            x^2 - x - 1\n            sage: K.getattr(\"disc\")\n            5\n\n            sage: K.getattr(\"reg\")\n            Traceback (most recent call last):\n            ...\n            PariError: _.reg: incorrect type in reg (t_VEC)\n            sage: K.getattr(\"zzz\")\n            Traceback (most recent call last):\n            ...\n            PariError: not a function in function call\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_41getattr(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("getattr (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_40getattr(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_40getattr(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_v_s = 0;
  char *__pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("getattr", 0);

  /* "cypari/gen.pyx":581
 *             PariError: not a function in function call
 *         """
 *         cdef bytes s = ("_." + attr).encode('ascii')             # <<<<<<<<<<<<<<
 *         cdef char *t = s
 *         sig_on()
 */
  __pyx_t_2 = PyNumber_Add(__pyx_kp_s__83, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 581, __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_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_n_s_ascii) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_n_s_ascii);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(6, 581, __pyx_L1_error)
  __pyx_v_s = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":582
 *         """
 *         cdef bytes s = ("_." + attr).encode('ascii')
 *         cdef char *t = s             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(closure_callgen1(strtofunction(t), self.g))
 */
  if (unlikely(__pyx_v_s == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(6, 582, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_s); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(6, 582, __pyx_L1_error)
  __pyx_v_t = __pyx_t_4;

  /* "cypari/gen.pyx":583
 *         cdef bytes s = ("_." + attr).encode('ascii')
 *         cdef char *t = s
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(closure_callgen1(strtofunction(t), self.g))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 583, __pyx_L1_error)

  /* "cypari/gen.pyx":584
 *         cdef char *t = s
 *         sig_on()
 *         return new_gen(closure_callgen1(strtofunction(t), self.g))             # <<<<<<<<<<<<<<
 * 
 *     def mod(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(closure_callgen1(strtofunction(__pyx_v_t), __pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":560
 *         return new_gen(ginv(self.g))
 * 
 *     def getattr(self, attr):             # <<<<<<<<<<<<<<
 *         """
 *         Return the PARI attribute with the given name.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.getattr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":586
 *         return new_gen(closure_callgen1(strtofunction(t), self.g))
 * 
 *     def mod(self):             # <<<<<<<<<<<<<<
 *         """
 *         Given an INTMOD or POLMOD ``Mod(a,m)``, return the modulus `m`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_43mod(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_42mod[] = "\n        Given an INTMOD or POLMOD ``Mod(a,m)``, return the modulus `m`.\n\n        EXAMPLES::\n\n            sage: pari(4).Mod(5).mod()\n            5\n            sage: pari(\"Mod(x, x*y)\").mod()\n            y*x\n            sage: pari(\"[Mod(4,5)]\").mod()\n            Traceback (most recent call last):\n            ...\n            TypeError: Not an INTMOD or POLMOD in mod()\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_43mod(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mod (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_42mod(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_42mod(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("mod", 0);

  /* "cypari/gen.pyx":601
 *             TypeError: Not an INTMOD or POLMOD in mod()
 *         """
 *         if typ(self.g) != t_INTMOD and typ(self.g) != t_POLMOD:             # <<<<<<<<<<<<<<
 *             raise TypeError("Not an INTMOD or POLMOD in mod()")
 *         sig_on()
 */
  __pyx_t_2 = ((typ(__pyx_v_self->__pyx_base.g) != t_INTMOD) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((typ(__pyx_v_self->__pyx_base.g) != t_POLMOD) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":602
 *         """
 *         if typ(self.g) != t_INTMOD and typ(self.g) != t_POLMOD:
 *             raise TypeError("Not an INTMOD or POLMOD in mod()")             # <<<<<<<<<<<<<<
 *         sig_on()
 *         # The hardcoded 1 below refers to the position in the internal
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__84, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 602, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(6, 602, __pyx_L1_error)

    /* "cypari/gen.pyx":601
 *             TypeError: Not an INTMOD or POLMOD in mod()
 *         """
 *         if typ(self.g) != t_INTMOD and typ(self.g) != t_POLMOD:             # <<<<<<<<<<<<<<
 *             raise TypeError("Not an INTMOD or POLMOD in mod()")
 *         sig_on()
 */
  }

  /* "cypari/gen.pyx":603
 *         if typ(self.g) != t_INTMOD and typ(self.g) != t_POLMOD:
 *             raise TypeError("Not an INTMOD or POLMOD in mod()")
 *         sig_on()             # <<<<<<<<<<<<<<
 *         # The hardcoded 1 below refers to the position in the internal
 *         # representation of a INTMOD or POLDMOD where the modulus is
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(6, 603, __pyx_L1_error)

  /* "cypari/gen.pyx":607
 *         # representation of a INTMOD or POLDMOD where the modulus is
 *         # stored.
 *         return new_gen(gel(self.g, 1))             # <<<<<<<<<<<<<<
 * 
 *     # Special case: SageMath uses polred(), so mark it as not
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gel(__pyx_v_self->__pyx_base.g, 1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":586
 *         return new_gen(closure_callgen1(strtofunction(t), self.g))
 * 
 *     def mod(self):             # <<<<<<<<<<<<<<
 *         """
 *         Given an INTMOD or POLMOD ``Mod(a,m)``, return the modulus `m`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.mod", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":611
 *     # Special case: SageMath uses polred(), so mark it as not
 *     # obsolete: https://trac.sagemath.org/ticket/22165
 *     def polred(self, *args, **kwds):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is :emphasis:`deprecated`, use :meth:`.polredbest` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_45polred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_44polred[] = "\n        This function is :emphasis:`deprecated`, use :meth:`.polredbest` instead.\n\n        TESTS::\n\n            sage: pari('x^4 + 8').polred(2)\n            [0, x; 1/2*x^2 + 1, x^2 - 2*x + 3; -1/2*x^2 + 1, x^2 - 2*x + 3; 1/2*x^2, x^2 + 2; 1/4*x^3, x^4 + 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_45polred(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwds = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polred (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "polred", 1))) return NULL;
  if (unlikely(__pyx_kwds)) {
    __pyx_v_kwds = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwds)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwds);
  } else {
    __pyx_v_kwds = NULL;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_44polred(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_args, __pyx_v_kwds);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwds);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_44polred(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwds) {
  PyObject *__pyx_v_warnings = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("polred", 0);

  /* "cypari/gen.pyx":620
 *             [0, x; 1/2*x^2 + 1, x^2 - 2*x + 3; -1/2*x^2 + 1, x^2 - 2*x + 3; 1/2*x^2, x^2 + 2; 1/4*x^3, x^4 + 2]
 *         '''
 *         import warnings             # <<<<<<<<<<<<<<
 *         with warnings.catch_warnings():
 *             warnings.simplefilter("ignore")
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 620, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_warnings = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":621
 *         '''
 *         import warnings
 *         with warnings.catch_warnings():             # <<<<<<<<<<<<<<
 *             warnings.simplefilter("ignore")
 *             return super(Gen, self).polred(*args, **kwds)
 */
  /*with:*/ {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_n_s_catch_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_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_1)) __PYX_ERR(6, 621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 621, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 621, __pyx_L3_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /*try:*/ {
      {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
        __Pyx_XGOTREF(__pyx_t_6);
        __Pyx_XGOTREF(__pyx_t_7);
        __Pyx_XGOTREF(__pyx_t_8);
        /*try:*/ {

          /* "cypari/gen.pyx":622
 *         import warnings
 *         with warnings.catch_warnings():
 *             warnings.simplefilter("ignore")             # <<<<<<<<<<<<<<
 *             return super(Gen, self).polred(*args, **kwds)
 * 
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_warnings, __pyx_n_s_simplefilter); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 622, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_n_s_ignore) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_n_s_ignore);
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 622, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "cypari/gen.pyx":623
 *         with warnings.catch_warnings():
 *             warnings.simplefilter("ignore")
 *             return super(Gen, self).polred(*args, **kwds)             # <<<<<<<<<<<<<<
 * 
 *     def nf_get_pol(self):
 */
          __Pyx_XDECREF(__pyx_r);
          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 623, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(((PyObject *)__pyx_ptype_6cypari_5_pari_Gen));
          __Pyx_GIVEREF(((PyObject *)__pyx_ptype_6cypari_5_pari_Gen));
          PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_6cypari_5_pari_Gen));
          __Pyx_INCREF(((PyObject *)__pyx_v_self));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
          PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 623, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_polred); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 623, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_v_kwds); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 623, __pyx_L7_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_r = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L11_try_return;

          /* "cypari/gen.pyx":621
 *         '''
 *         import warnings
 *         with warnings.catch_warnings():             # <<<<<<<<<<<<<<
 *             warnings.simplefilter("ignore")
 *             return super(Gen, self).polred(*args, **kwds)
 */
        }
        __pyx_L7_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        /*except:*/ {
          __Pyx_AddTraceback("cypari._pari.Gen.polred", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(6, 621, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 621, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 621, __pyx_L9_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (__pyx_t_10 < 0) __PYX_ERR(6, 621, __pyx_L9_except_error)
          __pyx_t_11 = ((!(__pyx_t_10 != 0)) != 0);
          if (__pyx_t_11) {
            __Pyx_GIVEREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_1);
            __Pyx_XGIVEREF(__pyx_t_3);
            __Pyx_ErrRestoreWithState(__pyx_t_2, __pyx_t_1, __pyx_t_3);
            __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; 
            __PYX_ERR(6, 621, __pyx_L9_except_error)
          }
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L8_exception_handled;
        }
        __pyx_L9_except_error:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L1_error;
        __pyx_L11_try_return:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
        goto __pyx_L4_return;
        __pyx_L8_exception_handled:;
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_XGIVEREF(__pyx_t_7);
        __Pyx_XGIVEREF(__pyx_t_8);
        __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      }
    }
    /*finally:*/ {
      /*normal exit:*/{
        if (__pyx_t_4) {
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__85, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 621, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        goto __pyx_L6;
      }
      __pyx_L4_return: {
        __pyx_t_8 = __pyx_r;
        __pyx_r = 0;
        if (__pyx_t_4) {
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__85, NULL);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 621, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __pyx_r = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L0;
      }
      __pyx_L6:;
    }
    goto __pyx_L16;
    __pyx_L3_error:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L1_error;
    __pyx_L16:;
  }

  /* "cypari/gen.pyx":611
 *     # Special case: SageMath uses polred(), so mark it as not
 *     # obsolete: https://trac.sagemath.org/ticket/22165
 *     def polred(self, *args, **kwds):             # <<<<<<<<<<<<<<
 *         r'''
 *         This function is :emphasis:`deprecated`, use :meth:`.polredbest` instead.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen.polred", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warnings);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":625
 *             return super(Gen, self).polred(*args, **kwds)
 * 
 *     def nf_get_pol(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the defining polynomial of this number field.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_47nf_get_pol(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_46nf_get_pol[] = "\n        Returns the defining polynomial of this number field.\n\n        INPUT:\n\n        - ``self`` -- A PARI number field being the output of ``nfinit()``,\n                      ``bnfinit()`` or ``bnrinit()``.\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**4 - 4*x**2 + 1).bnfinit()\n            sage: bnr = K.bnrinit(2*x)\n            sage: bnr.nf_get_pol()\n            x^4 - 4*x^2 + 1\n\n        For relative number fields, this returns the relative\n        polynomial::\n\n            sage: y = pari.varhigher('y')\n            sage: L = K.rnfinit(y**2 - 5)\n            sage: L.nf_get_pol()\n            y^2 - 5\n\n        An error is raised for invalid input::\n\n            sage: pari(\"[0]\").nf_get_pol()\n            Traceback (most recent call last):\n            ...\n            PariError: incorrect type in pol (t_VEC)\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_47nf_get_pol(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nf_get_pol (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_46nf_get_pol(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_46nf_get_pol(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("nf_get_pol", 0);

  /* "cypari/gen.pyx":658
 * 
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(member_pol(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 658, __pyx_L1_error)

  /* "cypari/gen.pyx":659
 *         """
 *         sig_on()
 *         return new_gen(member_pol(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def nf_get_diff(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(member_pol(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":625
 *             return super(Gen, self).polred(*args, **kwds)
 * 
 *     def nf_get_pol(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the defining polynomial of this number field.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.nf_get_pol", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":661
 *         return new_gen(member_pol(self.g))
 * 
 *     def nf_get_diff(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the different of this number field as a PARI ideal.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_49nf_get_diff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_48nf_get_diff[] = "\n        Returns the different of this number field as a PARI ideal.\n\n        INPUT:\n\n        - ``self`` -- A PARI number field being the output of ``nfinit()``,\n                      ``bnfinit()`` or ``bnrinit()``.\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**4 - 4*x**2 + 1).nfinit()\n            sage: K.nf_get_diff()\n            [12, 0, 0, 0; 0, 12, 8, 0; 0, 0, 4, 0; 0, 0, 0, 4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_49nf_get_diff(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nf_get_diff (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_48nf_get_diff(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_48nf_get_diff(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("nf_get_diff", 0);

  /* "cypari/gen.pyx":677
 *             [12, 0, 0, 0; 0, 12, 8, 0; 0, 0, 4, 0; 0, 0, 0, 4]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(member_diff(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 677, __pyx_L1_error)

  /* "cypari/gen.pyx":678
 *         """
 *         sig_on()
 *         return new_gen(member_diff(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def nf_get_sign(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(member_diff(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":661
 *         return new_gen(member_pol(self.g))
 * 
 *     def nf_get_diff(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the different of this number field as a PARI ideal.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.nf_get_diff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":680
 *         return new_gen(member_diff(self.g))
 * 
 *     def nf_get_sign(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a Python list ``[r1, r2]``, where ``r1`` and ``r2`` are
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_51nf_get_sign(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_50nf_get_sign[] = "\n        Returns a Python list ``[r1, r2]``, where ``r1`` and ``r2`` are\n        Python ints representing the number of real embeddings and pairs\n        of complex embeddings of this number field, respectively.\n\n        INPUT:\n\n        - ``self`` -- A PARI number field being the output of ``nfinit()``,\n                      ``bnfinit()`` or ``bnrinit()``.\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**4 - 4*x**2 + 1).nfinit()\n            sage: s = K.nf_get_sign(); s\n            [4, 0]\n            sage: type(s); type(s[0])\n            <... 'list'>\n            <... 'int'>\n            sage: pari.polcyclo(15).nfinit().nf_get_sign()\n            [0, 4]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_51nf_get_sign(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nf_get_sign (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_50nf_get_sign(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_50nf_get_sign(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_r1;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_r2;
  GEN __pyx_v_sign;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("nf_get_sign", 0);

  /* "cypari/gen.pyx":706
 *         cdef pari_longword r2
 *         cdef GEN sign
 *         sig_on()             # <<<<<<<<<<<<<<
 *         sign = member_sign(self.g)
 *         r1 = itos(gel(sign, 1))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 706, __pyx_L1_error)

  /* "cypari/gen.pyx":707
 *         cdef GEN sign
 *         sig_on()
 *         sign = member_sign(self.g)             # <<<<<<<<<<<<<<
 *         r1 = itos(gel(sign, 1))
 *         r2 = itos(gel(sign, 2))
 */
  __pyx_v_sign = member_sign(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":708
 *         sig_on()
 *         sign = member_sign(self.g)
 *         r1 = itos(gel(sign, 1))             # <<<<<<<<<<<<<<
 *         r2 = itos(gel(sign, 2))
 *         sig_off()
 */
  __pyx_v_r1 = itos(gel(__pyx_v_sign, 1));

  /* "cypari/gen.pyx":709
 *         sign = member_sign(self.g)
 *         r1 = itos(gel(sign, 1))
 *         r2 = itos(gel(sign, 2))             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return [int(r1), int(r2)]
 */
  __pyx_v_r2 = itos(gel(__pyx_v_sign, 2));

  /* "cypari/gen.pyx":710
 *         r1 = itos(gel(sign, 1))
 *         r2 = itos(gel(sign, 2))
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return [int(r1), int(r2)]
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":711
 *         r2 = itos(gel(sign, 2))
 *         sig_off()
 *         return [int(r1), int(r2)]             # <<<<<<<<<<<<<<
 * 
 *     def nf_get_zk(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_r1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_r2); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":680
 *         return new_gen(member_diff(self.g))
 * 
 *     def nf_get_sign(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a Python list ``[r1, r2]``, where ``r1`` and ``r2`` are
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.nf_get_sign", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":713
 *         return [int(r1), int(r2)]
 * 
 *     def nf_get_zk(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a vector with a `\ZZ`-basis for the ring of integers of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_53nf_get_zk(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_52nf_get_zk[] = "\n        Returns a vector with a `\\ZZ`-basis for the ring of integers of\n        this number field. The first element is always `1`.\n\n        INPUT:\n\n        - ``self`` -- A PARI number field being the output of ``nfinit()``,\n                      ``bnfinit()`` or ``bnrinit()``.\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**4 - 4*x**2 + 1).nfinit()\n            sage: K.nf_get_zk()\n            [1, x, x^3 - 4*x, x^2 - 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_53nf_get_zk(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nf_get_zk (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_52nf_get_zk(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_52nf_get_zk(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("nf_get_zk", 0);

  /* "cypari/gen.pyx":730
 *             [1, x, x^3 - 4*x, x^2 - 2]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(member_zk(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 730, __pyx_L1_error)

  /* "cypari/gen.pyx":731
 *         """
 *         sig_on()
 *         return new_gen(member_zk(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def bnf_get_no(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(member_zk(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":713
 *         return [int(r1), int(r2)]
 * 
 *     def nf_get_zk(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a vector with a `\ZZ`-basis for the ring of integers of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.nf_get_zk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":733
 *         return new_gen(member_zk(self.g))
 * 
 *     def bnf_get_no(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the class number of ``self``, a "big number field" (``bnf``).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_55bnf_get_no(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_54bnf_get_no[] = "\n        Returns the class number of ``self``, a \"big number field\" (``bnf``).\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**2 + 65).bnfinit()\n            sage: K.bnf_get_no()\n            8\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_55bnf_get_no(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnf_get_no (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_54bnf_get_no(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_54bnf_get_no(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bnf_get_no", 0);

  /* "cypari/gen.pyx":744
 *             8
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bnf_get_no(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 744, __pyx_L1_error)

  /* "cypari/gen.pyx":745
 *         """
 *         sig_on()
 *         return new_gen(bnf_get_no(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def bnf_get_cyc(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bnf_get_no(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":733
 *         return new_gen(member_zk(self.g))
 * 
 *     def bnf_get_no(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the class number of ``self``, a "big number field" (``bnf``).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bnf_get_no", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":747
 *         return new_gen(bnf_get_no(self.g))
 * 
 *     def bnf_get_cyc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the structure of the class group of this number field as
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_57bnf_get_cyc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_56bnf_get_cyc[] = "\n        Returns the structure of the class group of this number field as\n        a vector of SNF invariants.\n\n        NOTE: ``self`` must be a \"big number field\" (``bnf``).\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**2 + 65).bnfinit()\n            sage: K.bnf_get_cyc()\n            [4, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_57bnf_get_cyc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnf_get_cyc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_56bnf_get_cyc(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_56bnf_get_cyc(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bnf_get_cyc", 0);

  /* "cypari/gen.pyx":761
 *             [4, 2]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bnf_get_cyc(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 761, __pyx_L1_error)

  /* "cypari/gen.pyx":762
 *         """
 *         sig_on()
 *         return new_gen(bnf_get_cyc(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def bnf_get_gen(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bnf_get_cyc(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 762, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":747
 *         return new_gen(bnf_get_no(self.g))
 * 
 *     def bnf_get_cyc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the structure of the class group of this number field as
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bnf_get_cyc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":764
 *         return new_gen(bnf_get_cyc(self.g))
 * 
 *     def bnf_get_gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a vector of generators of the class group of this
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_59bnf_get_gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_58bnf_get_gen[] = "\n        Returns a vector of generators of the class group of this\n        number field.\n\n        NOTE: ``self`` must be a \"big number field\" (``bnf``).\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**2 + 65).bnfinit()\n            sage: G = K.bnf_get_gen(); G\n            [[3, 2; 0, 1], [2, 1; 0, 1]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_59bnf_get_gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnf_get_gen (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_58bnf_get_gen(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_58bnf_get_gen(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bnf_get_gen", 0);

  /* "cypari/gen.pyx":778
 *             [[3, 2; 0, 1], [2, 1; 0, 1]]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bnf_get_gen(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 778, __pyx_L1_error)

  /* "cypari/gen.pyx":779
 *         """
 *         sig_on()
 *         return new_gen(bnf_get_gen(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def bnf_get_reg(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bnf_get_gen(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":764
 *         return new_gen(bnf_get_cyc(self.g))
 * 
 *     def bnf_get_gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a vector of generators of the class group of this
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bnf_get_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":781
 *         return new_gen(bnf_get_gen(self.g))
 * 
 *     def bnf_get_reg(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the regulator of this number field.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_61bnf_get_reg(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_60bnf_get_reg[] = "\n        Returns the regulator of this number field.\n\n        NOTE: ``self`` must be a \"big number field\" (``bnf``).\n\n        EXAMPLES::\n\n            sage: x = pari('x')\n            sage: K = (x**4 - 4*x**2 + 1).bnfinit()\n            sage: K.bnf_get_reg()\n            2.66089858019037...\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_61bnf_get_reg(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnf_get_reg (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_60bnf_get_reg(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_60bnf_get_reg(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bnf_get_reg", 0);

  /* "cypari/gen.pyx":794
 *             2.66089858019037...
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bnf_get_reg(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 794, __pyx_L1_error)

  /* "cypari/gen.pyx":795
 *         """
 *         sig_on()
 *         return new_gen(bnf_get_reg(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def bnfunit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bnf_get_reg(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":781
 *         return new_gen(bnf_get_gen(self.g))
 * 
 *     def bnf_get_reg(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the regulator of this number field.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bnf_get_reg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":797
 *         return new_gen(bnf_get_reg(self.g))
 * 
 *     def bnfunit(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(bnf_get_fu(self.g))
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_63bnfunit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_63bnfunit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bnfunit (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_62bnfunit(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_62bnfunit(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bnfunit", 0);

  /* "cypari/gen.pyx":798
 * 
 *     def bnfunit(self):
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bnf_get_fu(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 798, __pyx_L1_error)

  /* "cypari/gen.pyx":799
 *     def bnfunit(self):
 *         sig_on()
 *         return new_gen(bnf_get_fu(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def pr_get_p(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bnf_get_fu(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":797
 *         return new_gen(bnf_get_reg(self.g))
 * 
 *     def bnfunit(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(bnf_get_fu(self.g))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bnfunit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":801
 *         return new_gen(bnf_get_fu(self.g))
 * 
 *     def pr_get_p(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the prime of `\ZZ` lying below this prime ideal.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_65pr_get_p(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_64pr_get_p[] = "\n        Returns the prime of `\\ZZ` lying below this prime ideal.\n\n        NOTE: ``self`` must be a PARI prime ideal (as returned by\n        ``idealprimedec`` for example).\n\n        EXAMPLES::\n\n            sage: i = pari('i')\n            sage: K = (i**2 + 1).nfinit()\n            sage: F = K.idealprimedec(5); F\n            [[5, [-2, 1]~, 1, 1, [2, -1; 1, 2]], [5, [2, 1]~, 1, 1, [-2, -1; 1, -2]]]\n            sage: F[0].pr_get_p()\n            5\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_65pr_get_p(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pr_get_p (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_64pr_get_p(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_64pr_get_p(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pr_get_p", 0);

  /* "cypari/gen.pyx":817
 *             5
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(pr_get_p(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 817, __pyx_L1_error)

  /* "cypari/gen.pyx":818
 *         """
 *         sig_on()
 *         return new_gen(pr_get_p(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def pr_get_e(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(pr_get_p(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":801
 *         return new_gen(bnf_get_fu(self.g))
 * 
 *     def pr_get_p(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the prime of `\ZZ` lying below this prime ideal.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.pr_get_p", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":820
 *         return new_gen(pr_get_p(self.g))
 * 
 *     def pr_get_e(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the ramification index (over `\QQ`) of this prime ideal.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_67pr_get_e(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_66pr_get_e[] = "\n        Returns the ramification index (over `\\QQ`) of this prime ideal.\n\n        NOTE: ``self`` must be a PARI prime ideal (as returned by\n        ``idealprimedec`` for example).\n\n        EXAMPLES::\n\n            sage: i = pari('i')\n            sage: K = (i**2 + 1).nfinit()\n            sage: K.idealprimedec(2)[0].pr_get_e()\n            2\n            sage: K.idealprimedec(3)[0].pr_get_e()\n            1\n            sage: K.idealprimedec(5)[0].pr_get_e()\n            1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_67pr_get_e(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pr_get_e (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_66pr_get_e(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_66pr_get_e(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_e;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pr_get_e", 0);

  /* "cypari/gen.pyx":839
 *         """
 *         cdef pari_longword e
 *         sig_on()             # <<<<<<<<<<<<<<
 *         e = pr_get_e(self.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 839, __pyx_L1_error)

  /* "cypari/gen.pyx":840
 *         cdef pari_longword e
 *         sig_on()
 *         e = pr_get_e(self.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return pari_longword_to_int(e)
 */
  __pyx_v_e = pr_get_e(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":841
 *         sig_on()
 *         e = pr_get_e(self.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return pari_longword_to_int(e)
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":842
 *         e = pr_get_e(self.g)
 *         sig_off()
 *         return pari_longword_to_int(e)             # <<<<<<<<<<<<<<
 * 
 *     def pr_get_f(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6cypari_5_pari_pari_longword_to_int(__pyx_v_e); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 842, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":820
 *         return new_gen(pr_get_p(self.g))
 * 
 *     def pr_get_e(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the ramification index (over `\QQ`) of this prime ideal.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.pr_get_e", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":844
 *         return pari_longword_to_int(e)
 * 
 *     def pr_get_f(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the residue class degree (over `\QQ`) of this prime ideal.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_69pr_get_f(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_68pr_get_f[] = "\n        Returns the residue class degree (over `\\QQ`) of this prime ideal.\n\n        NOTE: ``self`` must be a PARI prime ideal (as returned by\n        ``idealprimedec`` for example).\n\n        EXAMPLES::\n\n            sage: i = pari('i')\n            sage: K = (i**2 + 1).nfinit()\n            sage: K.idealprimedec(2)[0].pr_get_f()\n            1\n            sage: K.idealprimedec(3)[0].pr_get_f()\n            2\n            sage: K.idealprimedec(5)[0].pr_get_f()\n            1\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_69pr_get_f(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pr_get_f (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_68pr_get_f(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_68pr_get_f(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_f;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pr_get_f", 0);

  /* "cypari/gen.pyx":863
 *         """
 *         cdef pari_longword f
 *         sig_on()             # <<<<<<<<<<<<<<
 *         f = pr_get_f(self.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 863, __pyx_L1_error)

  /* "cypari/gen.pyx":864
 *         cdef pari_longword f
 *         sig_on()
 *         f = pr_get_f(self.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return pari_longword_to_int(f)
 */
  __pyx_v_f = pr_get_f(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":865
 *         sig_on()
 *         f = pr_get_f(self.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return pari_longword_to_int(f)
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":866
 *         f = pr_get_f(self.g)
 *         sig_off()
 *         return pari_longword_to_int(f)             # <<<<<<<<<<<<<<
 * 
 *     def pr_get_gen(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6cypari_5_pari_pari_longword_to_int(__pyx_v_f); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":844
 *         return pari_longword_to_int(e)
 * 
 *     def pr_get_f(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the residue class degree (over `\QQ`) of this prime ideal.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.pr_get_f", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":868
 *         return pari_longword_to_int(f)
 * 
 *     def pr_get_gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the second generator of this PARI prime ideal, where the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_71pr_get_gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_70pr_get_gen[] = "\n        Returns the second generator of this PARI prime ideal, where the\n        first generator is ``self.pr_get_p()``.\n\n        NOTE: ``self`` must be a PARI prime ideal (as returned by\n        ``idealprimedec`` for example).\n\n        EXAMPLES::\n\n            sage: i = pari('i')\n            sage: K = (i**2 + 1).nfinit()\n            sage: g = K.idealprimedec(2)[0].pr_get_gen(); g\n            [1, 1]~\n            sage: g = K.idealprimedec(3)[0].pr_get_gen(); g\n            [3, 0]~\n            sage: g = K.idealprimedec(5)[0].pr_get_gen(); g\n            [-2, 1]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_71pr_get_gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pr_get_gen (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_70pr_get_gen(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_70pr_get_gen(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("pr_get_gen", 0);

  /* "cypari/gen.pyx":887
 *             [-2, 1]~
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(pr_get_gen(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 887, __pyx_L1_error)

  /* "cypari/gen.pyx":888
 *         """
 *         sig_on()
 *         return new_gen(pr_get_gen(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def bid_get_cyc(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(pr_get_gen(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 888, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":868
 *         return pari_longword_to_int(f)
 * 
 *     def pr_get_gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the second generator of this PARI prime ideal, where the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.pr_get_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":890
 *         return new_gen(pr_get_gen(self.g))
 * 
 *     def bid_get_cyc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the structure of the group `(O_K/I)^*`, where `I` is the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_73bid_get_cyc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_72bid_get_cyc[] = "\n        Returns the structure of the group `(O_K/I)^*`, where `I` is the\n        ideal represented by ``self``.\n\n        NOTE: ``self`` must be a \"big ideal\" (``bid``) as returned by\n        ``idealstar`` for example.\n\n        EXAMPLES::\n\n            sage: i = pari('i')\n            sage: K = (i**2 + 1).bnfinit()\n            sage: J = K.idealstar(4*i + 2)\n            sage: J.bid_get_cyc()\n            [4, 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_73bid_get_cyc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bid_get_cyc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_72bid_get_cyc(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_72bid_get_cyc(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bid_get_cyc", 0);

  /* "cypari/gen.pyx":906
 *             [4, 2]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bid_get_cyc(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 906, __pyx_L1_error)

  /* "cypari/gen.pyx":907
 *         """
 *         sig_on()
 *         return new_gen(bid_get_cyc(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def bid_get_gen(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bid_get_cyc(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":890
 *         return new_gen(pr_get_gen(self.g))
 * 
 *     def bid_get_cyc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the structure of the group `(O_K/I)^*`, where `I` is the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bid_get_cyc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":909
 *         return new_gen(bid_get_cyc(self.g))
 * 
 *     def bid_get_gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a vector of generators of the group `(O_K/I)^*`, where
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_75bid_get_gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_74bid_get_gen[] = "\n        Returns a vector of generators of the group `(O_K/I)^*`, where\n        `I` is the ideal represented by ``self``.\n\n        NOTE: ``self`` must be a \"big ideal\" (``bid``) with generators,\n        as returned by ``idealstar`` with ``flag`` = 2.\n\n        EXAMPLES::\n\n            sage: i = pari('i')\n            sage: K = (i**2 + 1).bnfinit()\n            sage: J = K.idealstar(4*i + 2, 2)\n            sage: J.bid_get_gen()\n            [7, [-2, -1]~]\n\n        We get an exception if we do not supply ``flag = 2`` to\n        ``idealstar``::\n\n            sage: J = K.idealstar(3)\n            sage: J.bid_get_gen()\n            Traceback (most recent call last):\n            ...\n            PariError: missing bid generators. Use idealstar(,,2)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_75bid_get_gen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bid_get_gen (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_74bid_get_gen(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_74bid_get_gen(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bid_get_gen", 0);

  /* "cypari/gen.pyx":934
 *             PariError: missing bid generators. Use idealstar(,,2)
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bid_get_gen(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 934, __pyx_L1_error)

  /* "cypari/gen.pyx":935
 *         """
 *         sig_on()
 *         return new_gen(bid_get_gen(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bid_get_gen(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":909
 *         return new_gen(bid_get_cyc(self.g))
 * 
 *     def bid_get_gen(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a vector of generators of the group `(O_K/I)^*`, where
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bid_get_gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":937
 *         return new_gen(bid_get_gen(self.g))
 * 
 *     def __getitem__(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the nth entry of self. The indexing is 0-based, like in
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_77__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_76__getitem__[] = "\n        Return the nth entry of self. The indexing is 0-based, like in\n        Python. Note that this is *different* than the default behavior\n        of the PARI/GP interpreter.\n\n        EXAMPLES::\n\n            sage: p = pari('1 + 2*x + 3*x^2')\n            sage: p[0]\n            1\n            sage: p[2]\n            3\n            sage: p[100]\n            0\n            sage: p[-1]\n            0\n            sage: q = pari('x^2 + 3*x^3 + O(x^6)')\n            sage: q[3]\n            3\n            sage: q[5]\n            0\n            sage: q[6]\n            Traceback (most recent call last):\n            ...\n            IndexError: index out of range\n            sage: m = pari('[1,2;3,4]')\n            sage: m[0]\n            [1, 3]~\n            sage: m[1,0]\n            3\n            sage: l = pari('List([1,2,3])')\n            sage: l[1]\n            2\n            sage: s = pari('\"hello, world!\"')\n            sage: s[0]\n            'h'\n            sage: s[4]\n            'o'\n            sage: s[12]\n            '!'\n            sage: s[13]\n            Traceback (most recent call last):\n            ...\n            IndexError: index out of range\n            sage: v = pari('[1,2,3]')\n            sage: v[0]\n            1\n            sage: c = pari('Col([1,2,3])')\n            sage: c[1]\n            2\n            sage: sv = pari('Vecsmall([1,2,3])')\n            sage: sv[2]\n            3\n            sage: type(sv[2])\n            <... 'int'>\n            sage: [pari('3/5')[i] for i in range(2)]\n            [3, 5]\n            sage: [pari('1 + 5*I')[i] for i in range(2)]\n            [1, 5]\n            sage: [pari('Qfb(1, 2, 3)')[i] for i in range(3)]\n            [1, 2, 3]\n            sage: pari(57)[0]\n            Traceback (most recent call last):\n            ...\n            TypeError: PARI object of type 't_INT' cannot be indexed\n            sage: m = pari(\"[[1,2;3,4],5]\") ; m[0][1,0]\n            3\n            sage: v ""= pari(list(range(20)))\n            sage: v[2:5]\n            [2, 3, 4]\n            sage: v[:]\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n            sage: v[10:]\n            [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n            sage: v[:5]\n            [0, 1, 2, 3, 4]\n            sage: v[5:5]\n            []\n            sage: v\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n            sage: v[-1]\n            Traceback (most recent call last):\n            ...\n            IndexError: index out of range\n            sage: v[:-3]\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]\n            sage: v[5:]\n            [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n            sage: pari([])[::]\n            []\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_76__getitem__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_77__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_76__getitem__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_6cypari_5_pari_3Gen_11__getitem___2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "cypari/gen.pyx":1079
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop+2)+'"')
 *                 # slow call
 *                 return objtogen(self[i] for i in inds)             # <<<<<<<<<<<<<<
 * 
 *         if pari_type == t_POL:
 */

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_11__getitem___genexpr(PyObject *__pyx_self) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *)__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_4_genexpr(__pyx_ptype_6cypari_5_pari___pyx_scope_struct_4_genexpr, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 1079, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *) __pyx_self;
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6cypari_5_pari_3Gen_11__getitem___2generator2, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_getitem___locals_genexpr, __pyx_n_s_cypari__pari); if (unlikely(!gen)) __PYX_ERR(6, 1079, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.__getitem__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_6cypari_5_pari_3Gen_11__getitem___2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1079, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_inds)) { __Pyx_RaiseClosureNameError("inds"); __PYX_ERR(6, 1079, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_inds)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_inds)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_inds; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_inds); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1079, __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(6, 1079, __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(6, 1079, __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(6, 1079, __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(6, 1079, __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(6, 1079, __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(6, 1079, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(6, 1079, __pyx_L1_error) }
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1079, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(6, 1079, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":937
 *         return new_gen(bid_get_gen(self.g))
 * 
 *     def __getitem__(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the nth entry of self. The indexing is 0-based, like in
 */

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_76__getitem__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *__pyx_cur_scope;
  int __pyx_v_pari_type;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_i;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_j;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_l;
  PyObject *__pyx_v_ind = NULL;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_val = NULL;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_stop = NULL;
  PyObject *__pyx_v_step = NULL;
  Py_ssize_t __pyx_v_k;
  long __pyx_v_bound;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  long __pyx_t_13;
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __pyx_cur_scope = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *)__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_3___getitem__(__pyx_ptype_6cypari_5_pari___pyx_scope_struct_3___getitem__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(6, 937, __pyx_L1_error)
  } else {
    __Pyx_GOTREF(__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);

  /* "cypari/gen.pyx":1032
 *         cdef pari_longword i, j, l
 * 
 *         pari_type = typ(self.g)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(n, tuple):
 */
  __pyx_v_pari_type = typ(__pyx_cur_scope->__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":1034
 *         pari_type = typ(self.g)
 * 
 *         if isinstance(n, tuple):             # <<<<<<<<<<<<<<
 *             if pari_type != t_MAT:
 *                 raise TypeError("self must be of pari type t_MAT")
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_n); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1035
 * 
 *         if isinstance(n, tuple):
 *             if pari_type != t_MAT:             # <<<<<<<<<<<<<<
 *                 raise TypeError("self must be of pari type t_MAT")
 *             if len(n) != 2:
 */
    __pyx_t_2 = ((__pyx_v_pari_type != t_MAT) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "cypari/gen.pyx":1036
 *         if isinstance(n, tuple):
 *             if pari_type != t_MAT:
 *                 raise TypeError("self must be of pari type t_MAT")             # <<<<<<<<<<<<<<
 *             if len(n) != 2:
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__86, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1036, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(6, 1036, __pyx_L1_error)

      /* "cypari/gen.pyx":1035
 * 
 *         if isinstance(n, tuple):
 *             if pari_type != t_MAT:             # <<<<<<<<<<<<<<
 *                 raise TypeError("self must be of pari type t_MAT")
 *             if len(n) != 2:
 */
    }

    /* "cypari/gen.pyx":1037
 *             if pari_type != t_MAT:
 *                 raise TypeError("self must be of pari type t_MAT")
 *             if len(n) != 2:             # <<<<<<<<<<<<<<
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")
 *             i = int(n[0])
 */
    __pyx_t_4 = PyObject_Length(__pyx_v_n); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1037, __pyx_L1_error)
    __pyx_t_2 = ((__pyx_t_4 != 2) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "cypari/gen.pyx":1038
 *                 raise TypeError("self must be of pari type t_MAT")
 *             if len(n) != 2:
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")             # <<<<<<<<<<<<<<
 *             i = int(n[0])
 *             j = int(n[1])
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1038, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(6, 1038, __pyx_L1_error)

      /* "cypari/gen.pyx":1037
 *             if pari_type != t_MAT:
 *                 raise TypeError("self must be of pari type t_MAT")
 *             if len(n) != 2:             # <<<<<<<<<<<<<<
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")
 *             i = int(n[0])
 */
    }

    /* "cypari/gen.pyx":1039
 *             if len(n) != 2:
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")
 *             i = int(n[0])             # <<<<<<<<<<<<<<
 *             j = int(n[1])
 * 
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_n, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1039, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1039, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_i = __pyx_t_6;

    /* "cypari/gen.pyx":1040
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")
 *             i = int(n[0])
 *             j = int(n[1])             # <<<<<<<<<<<<<<
 * 
 *             if i < 0 or i >= glength(<GEN>(self.g[1])):
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_n, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1040, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_j = __pyx_t_6;

    /* "cypari/gen.pyx":1042
 *             j = int(n[1])
 * 
 *             if i < 0 or i >= glength(<GEN>(self.g[1])):             # <<<<<<<<<<<<<<
 *                 raise IndexError("row index out of range")
 *             if j < 0 or j >= glength(self.g):
 */
    __pyx_t_1 = ((__pyx_v_i < 0) != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_i >= glength(((GEN)(__pyx_cur_scope->__pyx_v_self->__pyx_base.g[1])))) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L7_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "cypari/gen.pyx":1043
 * 
 *             if i < 0 or i >= glength(<GEN>(self.g[1])):
 *                 raise IndexError("row index out of range")             # <<<<<<<<<<<<<<
 *             if j < 0 or j >= glength(self.g):
 *                 raise IndexError("column index out of range")
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1043, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(6, 1043, __pyx_L1_error)

      /* "cypari/gen.pyx":1042
 *             j = int(n[1])
 * 
 *             if i < 0 or i >= glength(<GEN>(self.g[1])):             # <<<<<<<<<<<<<<
 *                 raise IndexError("row index out of range")
 *             if j < 0 or j >= glength(self.g):
 */
    }

    /* "cypari/gen.pyx":1044
 *             if i < 0 or i >= glength(<GEN>(self.g[1])):
 *                 raise IndexError("row index out of range")
 *             if j < 0 or j >= glength(self.g):             # <<<<<<<<<<<<<<
 *                 raise IndexError("column index out of range")
 * 
 */
    __pyx_t_1 = ((__pyx_v_j < 0) != 0);
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_j >= glength(__pyx_cur_scope->__pyx_v_self->__pyx_base.g)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L10_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "cypari/gen.pyx":1045
 *                 raise IndexError("row index out of range")
 *             if j < 0 or j >= glength(self.g):
 *                 raise IndexError("column index out of range")             # <<<<<<<<<<<<<<
 * 
 *             ind = (i,j)
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__89, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1045, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(6, 1045, __pyx_L1_error)

      /* "cypari/gen.pyx":1044
 *             if i < 0 or i >= glength(<GEN>(self.g[1])):
 *                 raise IndexError("row index out of range")
 *             if j < 0 or j >= glength(self.g):             # <<<<<<<<<<<<<<
 *                 raise IndexError("column index out of range")
 * 
 */
    }

    /* "cypari/gen.pyx":1047
 *                 raise IndexError("column index out of range")
 * 
 *             ind = (i,j)             # <<<<<<<<<<<<<<
 * 
 *             if self.refers_to is not None and ind in self.refers_to:
 */
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1047, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_v_ind = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "cypari/gen.pyx":1049
 *             ind = (i,j)
 * 
 *             if self.refers_to is not None and ind in self.refers_to:             # <<<<<<<<<<<<<<
 *                 return self.refers_to[ind]
 *             else:
 */
    __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to != ((PyObject*)Py_None));
    __pyx_t_8 = (__pyx_t_1 != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_2 = __pyx_t_8;
      goto __pyx_L13_bool_binop_done;
    }
    if (unlikely(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(6, 1049, __pyx_L1_error)
    }
    __pyx_t_8 = (__Pyx_PyDict_ContainsTF(__pyx_v_ind, __pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(6, 1049, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_8 != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L13_bool_binop_done:;
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":1050
 * 
 *             if self.refers_to is not None and ind in self.refers_to:
 *                 return self.refers_to[ind]             # <<<<<<<<<<<<<<
 *             else:
 *                 ## In this case, we're being asked to return
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1050, __pyx_L1_error)
      }
      __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to, __pyx_v_ind); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      goto __pyx_L0;

      /* "cypari/gen.pyx":1049
 *             ind = (i,j)
 * 
 *             if self.refers_to is not None and ind in self.refers_to:             # <<<<<<<<<<<<<<
 *                 return self.refers_to[ind]
 *             else:
 */
    }

    /* "cypari/gen.pyx":1056
 *                 ## we need to create such a gen, add it to
 *                 ## self.refers_to, and return it.
 *                 val = new_ref(gmael(self.g, j+1, i+1), self)             # <<<<<<<<<<<<<<
 *                 if self.refers_to is None:
 *                     self.refers_to = {ind: val}
 */
    /*else*/ {
      __pyx_t_7 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_ref(gmael(__pyx_cur_scope->__pyx_v_self->__pyx_base.g, (__pyx_v_j + 1), (__pyx_v_i + 1)), ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_7))); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1056, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_val = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "cypari/gen.pyx":1057
 *                 ## self.refers_to, and return it.
 *                 val = new_ref(gmael(self.g, j+1, i+1), self)
 *                 if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                     self.refers_to = {ind: val}
 *                 else:
 */
      __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == ((PyObject*)Py_None));
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {

        /* "cypari/gen.pyx":1058
 *                 val = new_ref(gmael(self.g, j+1, i+1), self)
 *                 if self.refers_to is None:
 *                     self.refers_to = {ind: val}             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.refers_to[ind] = val
 */
        __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1058, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (PyDict_SetItem(__pyx_t_5, __pyx_v_ind, ((PyObject *)__pyx_v_val)) < 0) __PYX_ERR(6, 1058, __pyx_L1_error)
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to);
        __pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to = ((PyObject*)__pyx_t_5);
        __pyx_t_5 = 0;

        /* "cypari/gen.pyx":1057
 *                 ## self.refers_to, and return it.
 *                 val = new_ref(gmael(self.g, j+1, i+1), self)
 *                 if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                     self.refers_to = {ind: val}
 *                 else:
 */
        goto __pyx_L15;
      }

      /* "cypari/gen.pyx":1060
 *                     self.refers_to = {ind: val}
 *                 else:
 *                     self.refers_to[ind] = val             # <<<<<<<<<<<<<<
 *                 return val
 * 
 */
      /*else*/ {
        if (unlikely(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(6, 1060, __pyx_L1_error)
        }
        if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to, __pyx_v_ind, ((PyObject *)__pyx_v_val)) < 0)) __PYX_ERR(6, 1060, __pyx_L1_error)
      }
      __pyx_L15:;

      /* "cypari/gen.pyx":1061
 *                 else:
 *                     self.refers_to[ind] = val
 *                 return val             # <<<<<<<<<<<<<<
 * 
 *         elif isinstance(n, slice):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_val));
      __pyx_r = ((PyObject *)__pyx_v_val);
      goto __pyx_L0;
    }

    /* "cypari/gen.pyx":1034
 *         pari_type = typ(self.g)
 * 
 *         if isinstance(n, tuple):             # <<<<<<<<<<<<<<
 *             if pari_type != t_MAT:
 *                 raise TypeError("self must be of pari type t_MAT")
 */
  }

  /* "cypari/gen.pyx":1063
 *                 return val
 * 
 *         elif isinstance(n, slice):             # <<<<<<<<<<<<<<
 *             l = glength(self.g)
 *             start, stop, step = n.indices(l)
 */
  __pyx_t_1 = PySlice_Check(__pyx_v_n); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1064
 * 
 *         elif isinstance(n, slice):
 *             l = glength(self.g)             # <<<<<<<<<<<<<<
 *             start, stop, step = n.indices(l)
 *             inds = xrange(start, stop, step)
 */
    __pyx_v_l = glength(__pyx_cur_scope->__pyx_v_self->__pyx_base.g);

    /* "cypari/gen.pyx":1065
 *         elif isinstance(n, slice):
 *             l = glength(self.g)
 *             start, stop, step = n.indices(l)             # <<<<<<<<<<<<<<
 *             inds = xrange(start, stop, step)
 *             k = len(inds)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_indices); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_l); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_5 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(6, 1065, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_7 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L16_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 1; __pyx_t_3 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_3)) goto __pyx_L16_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 2; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L16_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 3) < 0) __PYX_ERR(6, 1065, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L17_unpacking_done;
      __pyx_L16_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(6, 1065, __pyx_L1_error)
      __pyx_L17_unpacking_done:;
    }
    __pyx_v_start = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_v_stop = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_step = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "cypari/gen.pyx":1066
 *             l = glength(self.g)
 *             start, stop, step = n.indices(l)
 *             inds = xrange(start, stop, step)             # <<<<<<<<<<<<<<
 *             k = len(inds)
 *             # fast exit for empty vector
 */
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_start);
    __Pyx_GIVEREF(__pyx_v_start);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_start);
    __Pyx_INCREF(__pyx_v_stop);
    __Pyx_GIVEREF(__pyx_v_stop);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_stop);
    __Pyx_INCREF(__pyx_v_step);
    __Pyx_GIVEREF(__pyx_v_step);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_step);
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_xrange, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1066, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_9);
    __pyx_cur_scope->__pyx_v_inds = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "cypari/gen.pyx":1067
 *             start, stop, step = n.indices(l)
 *             inds = xrange(start, stop, step)
 *             k = len(inds)             # <<<<<<<<<<<<<<
 *             # fast exit for empty vector
 *             if k == 0:
 */
    __pyx_t_9 = __pyx_cur_scope->__pyx_v_inds;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_4 = PyObject_Length(__pyx_t_9); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1067, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_k = __pyx_t_4;

    /* "cypari/gen.pyx":1069
 *             k = len(inds)
 *             # fast exit for empty vector
 *             if k == 0:             # <<<<<<<<<<<<<<
 *                 sig_on()
 *                 return new_gen(zerovec(0))
 */
    __pyx_t_2 = ((__pyx_v_k == 0) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":1070
 *             # fast exit for empty vector
 *             if k == 0:
 *                 sig_on()             # <<<<<<<<<<<<<<
 *                 return new_gen(zerovec(0))
 *             # fast call, beware pari is one based
 */
      __pyx_t_12 = sig_on(); if (unlikely(__pyx_t_12 == ((int)0))) __PYX_ERR(6, 1070, __pyx_L1_error)

      /* "cypari/gen.pyx":1071
 *             if k == 0:
 *                 sig_on()
 *                 return new_gen(zerovec(0))             # <<<<<<<<<<<<<<
 *             # fast call, beware pari is one based
 *             if pari_type == t_VEC:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(zerovec(0))); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;

      /* "cypari/gen.pyx":1069
 *             k = len(inds)
 *             # fast exit for empty vector
 *             if k == 0:             # <<<<<<<<<<<<<<
 *                 sig_on()
 *                 return new_gen(zerovec(0))
 */
    }

    /* "cypari/gen.pyx":1073
 *                 return new_gen(zerovec(0))
 *             # fast call, beware pari is one based
 *             if pari_type == t_VEC:             # <<<<<<<<<<<<<<
 *                 if step==1:
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')
 */
    __pyx_t_2 = ((__pyx_v_pari_type == t_VEC) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":1074
 *             # fast call, beware pari is one based
 *             if pari_type == t_VEC:
 *                 if step==1:             # <<<<<<<<<<<<<<
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')
 *                 if step==-1:
 */
      __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_v_step, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 1074, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_2) {

        /* "cypari/gen.pyx":1075
 *             if pari_type == t_VEC:
 *                 if step==1:
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')             # <<<<<<<<<<<<<<
 *                 if step==-1:
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop+2)+'"')
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_vecextract); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Add(__pyx_kp_s__90, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__91); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_stop); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = PyNumber_Add(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Add(__pyx_t_10, __pyx_kp_s__90); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_9 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L0;

        /* "cypari/gen.pyx":1074
 *             # fast call, beware pari is one based
 *             if pari_type == t_VEC:
 *                 if step==1:             # <<<<<<<<<<<<<<
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')
 *                 if step==-1:
 */
      }

      /* "cypari/gen.pyx":1076
 *                 if step==1:
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')
 *                 if step==-1:             # <<<<<<<<<<<<<<
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop+2)+'"')
 *                 # slow call
 */
      __pyx_t_9 = __Pyx_PyInt_EqObjC(__pyx_v_step, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 1076, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (__pyx_t_2) {

        /* "cypari/gen.pyx":1077
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')
 *                 if step==-1:
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop+2)+'"')             # <<<<<<<<<<<<<<
 *                 # slow call
 *                 return objtogen(self[i] for i in inds)
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_vecextract); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_start, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Add(__pyx_kp_s__90, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__91); if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_stop, __pyx_int_2, 2, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Add(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_kp_s__90); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        __pyx_t_9 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_r = __pyx_t_9;
        __pyx_t_9 = 0;
        goto __pyx_L0;

        /* "cypari/gen.pyx":1076
 *                 if step==1:
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')
 *                 if step==-1:             # <<<<<<<<<<<<<<
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop+2)+'"')
 *                 # slow call
 */
      }

      /* "cypari/gen.pyx":1079
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop+2)+'"')
 *                 # slow call
 *                 return objtogen(self[i] for i in inds)             # <<<<<<<<<<<<<<
 * 
 *         if pari_type == t_POL:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_9 = __pyx_pf_6cypari_5_pari_3Gen_11__getitem___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_t_9, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "cypari/gen.pyx":1073
 *                 return new_gen(zerovec(0))
 *             # fast call, beware pari is one based
 *             if pari_type == t_VEC:             # <<<<<<<<<<<<<<
 *                 if step==1:
 *                     return self.vecextract('"'+str(start+1)+".."+str(stop)+'"')
 */
    }

    /* "cypari/gen.pyx":1063
 *                 return val
 * 
 *         elif isinstance(n, slice):             # <<<<<<<<<<<<<<
 *             l = glength(self.g)
 *             start, stop, step = n.indices(l)
 */
  }

  /* "cypari/gen.pyx":1081
 *                 return objtogen(self[i] for i in inds)
 * 
 *         if pari_type == t_POL:             # <<<<<<<<<<<<<<
 *                 return self.polcoeff(n)
 * 
 */
  __pyx_t_2 = ((__pyx_v_pari_type == t_POL) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1082
 * 
 *         if pari_type == t_POL:
 *                 return self.polcoeff(n)             # <<<<<<<<<<<<<<
 * 
 *         elif pari_type == t_SER:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_polcoeff); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_5 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_7, __pyx_v_n) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_n);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1082, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1081
 *                 return objtogen(self[i] for i in inds)
 * 
 *         if pari_type == t_POL:             # <<<<<<<<<<<<<<
 *                 return self.polcoeff(n)
 * 
 */
  }

  /* "cypari/gen.pyx":1084
 *                 return self.polcoeff(n)
 * 
 *         elif pari_type == t_SER:             # <<<<<<<<<<<<<<
 *             bound = valp(self.g) + lg(self.g) - 2
 *             if n >= bound:
 */
  __pyx_t_2 = ((__pyx_v_pari_type == t_SER) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1085
 * 
 *         elif pari_type == t_SER:
 *             bound = valp(self.g) + lg(self.g) - 2             # <<<<<<<<<<<<<<
 *             if n >= bound:
 *                 raise IndexError("index out of range")
 */
    __pyx_v_bound = ((valp(__pyx_cur_scope->__pyx_v_self->__pyx_base.g) + lg(__pyx_cur_scope->__pyx_v_self->__pyx_base.g)) - 2);

    /* "cypari/gen.pyx":1086
 *         elif pari_type == t_SER:
 *             bound = valp(self.g) + lg(self.g) - 2
 *             if n >= bound:             # <<<<<<<<<<<<<<
 *                 raise IndexError("index out of range")
 *             return self.polcoeff(n)
 */
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_bound); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1086, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyObject_RichCompare(__pyx_v_n, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1086, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 1086, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(__pyx_t_2)) {

      /* "cypari/gen.pyx":1087
 *             bound = valp(self.g) + lg(self.g) - 2
 *             if n >= bound:
 *                 raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *             return self.polcoeff(n)
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(6, 1087, __pyx_L1_error)

      /* "cypari/gen.pyx":1086
 *         elif pari_type == t_SER:
 *             bound = valp(self.g) + lg(self.g) - 2
 *             if n >= bound:             # <<<<<<<<<<<<<<
 *                 raise IndexError("index out of range")
 *             return self.polcoeff(n)
 */
    }

    /* "cypari/gen.pyx":1088
 *             if n >= bound:
 *                 raise IndexError("index out of range")
 *             return self.polcoeff(n)             # <<<<<<<<<<<<<<
 * 
 *         elif pari_type in (t_INT, t_REAL, t_PADIC, t_QUAD, t_FFELT, t_INTMOD, t_POLMOD):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_polcoeff); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_v_n) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_n);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1088, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1084
 *                 return self.polcoeff(n)
 * 
 *         elif pari_type == t_SER:             # <<<<<<<<<<<<<<
 *             bound = valp(self.g) + lg(self.g) - 2
 *             if n >= bound:
 */
  }

  /* "cypari/gen.pyx":1090
 *             return self.polcoeff(n)
 * 
 *         elif pari_type in (t_INT, t_REAL, t_PADIC, t_QUAD, t_FFELT, t_INTMOD, t_POLMOD):             # <<<<<<<<<<<<<<
 *             # these are definitely scalar!
 *             raise TypeError("PARI object of type %r cannot be indexed" % self.type())
 */
  switch (__pyx_v_pari_type) {
    case t_INT:
    case t_REAL:
    case t_PADIC:
    case t_QUAD:
    case t_FFELT:
    case t_INTMOD:
    case t_POLMOD:
    __pyx_t_2 = 1;
    break;
    default:
    __pyx_t_2 = 0;
    break;
  }
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":1092
 *         elif pari_type in (t_INT, t_REAL, t_PADIC, t_QUAD, t_FFELT, t_INTMOD, t_POLMOD):
 *             # these are definitely scalar!
 *             raise TypeError("PARI object of type %r cannot be indexed" % self.type())             # <<<<<<<<<<<<<<
 * 
 *         # Assume the length fits in a long, even in 64 bit Windows.
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyString_FormatSafe(__pyx_kp_s_PARI_object_of_type_r_cannot_be, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_9, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __PYX_ERR(6, 1092, __pyx_L1_error)

    /* "cypari/gen.pyx":1090
 *             return self.polcoeff(n)
 * 
 *         elif pari_type in (t_INT, t_REAL, t_PADIC, t_QUAD, t_FFELT, t_INTMOD, t_POLMOD):             # <<<<<<<<<<<<<<
 *             # these are definitely scalar!
 *             raise TypeError("PARI object of type %r cannot be indexed" % self.type())
 */
  }

  /* "cypari/gen.pyx":1095
 * 
 *         # Assume the length fits in a long, even in 64 bit Windows.
 *         elif n < 0 or n >= <long>glength(self.g):             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 * 
 */
  __pyx_t_9 = PyObject_RichCompare(__pyx_v_n, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1095, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 1095, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L24_bool_binop_done;
  }
  __pyx_t_9 = __Pyx_PyInt_From_long(((long)glength(__pyx_cur_scope->__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1095, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_n, __pyx_t_9, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1095, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 1095, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __pyx_t_2;
  __pyx_L24_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":1096
 *         # Assume the length fits in a long, even in 64 bit Windows.
 *         elif n < 0 or n >= <long>glength(self.g):
 *             raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 * 
 *         elif pari_type == t_VEC or pari_type == t_MAT:
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__92, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1096, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(6, 1096, __pyx_L1_error)

    /* "cypari/gen.pyx":1095
 * 
 *         # Assume the length fits in a long, even in 64 bit Windows.
 *         elif n < 0 or n >= <long>glength(self.g):             # <<<<<<<<<<<<<<
 *             raise IndexError("index out of range")
 * 
 */
  }

  /* "cypari/gen.pyx":1098
 *             raise IndexError("index out of range")
 * 
 *         elif pari_type == t_VEC or pari_type == t_MAT:             # <<<<<<<<<<<<<<
 *             #t_VEC    : row vector        [ code ] [  x_1  ] ... [  x_k  ]
 *             #t_MAT    : matrix            [ code ] [ col_1 ] ... [ col_k ]
 */
  switch (__pyx_v_pari_type) {
    case t_VEC:
    case t_MAT:
    __pyx_t_1 = 1;
    break;
    default:
    __pyx_t_1 = 0;
    break;
  }
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":1101
 *             #t_VEC    : row vector        [ code ] [  x_1  ] ... [  x_k  ]
 *             #t_MAT    : matrix            [ code ] [ col_1 ] ... [ col_k ]
 *             if self.refers_to is not None and n in self.refers_to:             # <<<<<<<<<<<<<<
 *                 return self.refers_to[n]
 *             else:
 */
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to != ((PyObject*)Py_None));
    __pyx_t_8 = (__pyx_t_2 != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_1 = __pyx_t_8;
      goto __pyx_L27_bool_binop_done;
    }
    if (unlikely(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(6, 1101, __pyx_L1_error)
    }
    __pyx_t_8 = (__Pyx_PyDict_ContainsTF(__pyx_v_n, __pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(6, 1101, __pyx_L1_error)
    __pyx_t_2 = (__pyx_t_8 != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L27_bool_binop_done:;
    if (__pyx_t_1) {

      /* "cypari/gen.pyx":1102
 *             #t_MAT    : matrix            [ code ] [ col_1 ] ... [ col_k ]
 *             if self.refers_to is not None and n in self.refers_to:
 *                 return self.refers_to[n]             # <<<<<<<<<<<<<<
 *             else:
 *                 ## In this case, we're being asked to return
 */
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1102, __pyx_L1_error)
      }
      __pyx_t_5 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to, __pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1102, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "cypari/gen.pyx":1101
 *             #t_VEC    : row vector        [ code ] [  x_1  ] ... [  x_k  ]
 *             #t_MAT    : matrix            [ code ] [ col_1 ] ... [ col_k ]
 *             if self.refers_to is not None and n in self.refers_to:             # <<<<<<<<<<<<<<
 *                 return self.refers_to[n]
 *             else:
 */
    }

    /* "cypari/gen.pyx":1108
 *                 ## we need to create such a gen, add it to
 *                 ## self.refers_to, and return it.
 *                 val = new_ref(gel(self.g, n+1), self)             # <<<<<<<<<<<<<<
 *                 if self.refers_to is None:
 *                     self.refers_to = {n: val}
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_13 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1108, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_9 = ((PyObject *)__pyx_f_6cypari_5_pari_new_ref(gel(__pyx_cur_scope->__pyx_v_self->__pyx_base.g, __pyx_t_13), ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5))); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_val = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_9);
      __pyx_t_9 = 0;

      /* "cypari/gen.pyx":1109
 *                 ## self.refers_to, and return it.
 *                 val = new_ref(gel(self.g, n+1), self)
 *                 if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                     self.refers_to = {n: val}
 *                 else:
 */
      __pyx_t_1 = (__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == ((PyObject*)Py_None));
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "cypari/gen.pyx":1110
 *                 val = new_ref(gel(self.g, n+1), self)
 *                 if self.refers_to is None:
 *                     self.refers_to = {n: val}             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.refers_to[n] = val
 */
        __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (PyDict_SetItem(__pyx_t_9, __pyx_v_n, ((PyObject *)__pyx_v_val)) < 0) __PYX_ERR(6, 1110, __pyx_L1_error)
        __Pyx_GIVEREF(__pyx_t_9);
        __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to);
        __Pyx_DECREF(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to);
        __pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to = ((PyObject*)__pyx_t_9);
        __pyx_t_9 = 0;

        /* "cypari/gen.pyx":1109
 *                 ## self.refers_to, and return it.
 *                 val = new_ref(gel(self.g, n+1), self)
 *                 if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                     self.refers_to = {n: val}
 *                 else:
 */
        goto __pyx_L29;
      }

      /* "cypari/gen.pyx":1112
 *                     self.refers_to = {n: val}
 *                 else:
 *                     self.refers_to[n] = val             # <<<<<<<<<<<<<<
 *                 return val
 * 
 */
      /*else*/ {
        if (unlikely(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(6, 1112, __pyx_L1_error)
        }
        if (unlikely(PyDict_SetItem(__pyx_cur_scope->__pyx_v_self->__pyx_base.refers_to, __pyx_v_n, ((PyObject *)__pyx_v_val)) < 0)) __PYX_ERR(6, 1112, __pyx_L1_error)
      }
      __pyx_L29:;

      /* "cypari/gen.pyx":1113
 *                 else:
 *                     self.refers_to[n] = val
 *                 return val             # <<<<<<<<<<<<<<
 * 
 *         elif pari_type == t_VECSMALL:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_val));
      __pyx_r = ((PyObject *)__pyx_v_val);
      goto __pyx_L0;
    }

    /* "cypari/gen.pyx":1098
 *             raise IndexError("index out of range")
 * 
 *         elif pari_type == t_VEC or pari_type == t_MAT:             # <<<<<<<<<<<<<<
 *             #t_VEC    : row vector        [ code ] [  x_1  ] ... [  x_k  ]
 *             #t_MAT    : matrix            [ code ] [ col_1 ] ... [ col_k ]
 */
  }

  /* "cypari/gen.pyx":1115
 *                 return val
 * 
 *         elif pari_type == t_VECSMALL:             # <<<<<<<<<<<<<<
 *             #t_VECSMALL: vec. small ints  [ code ] [ x_1 ] ... [ x_k ]
 *             return pari_longword_to_int(self.g[n+1])
 */
  __pyx_t_2 = ((__pyx_v_pari_type == t_VECSMALL) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1117
 *         elif pari_type == t_VECSMALL:
 *             #t_VECSMALL: vec. small ints  [ code ] [ x_1 ] ... [ x_k ]
 *             return pari_longword_to_int(self.g[n+1])             # <<<<<<<<<<<<<<
 * 
 *         elif pari_type == t_STR:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 1117, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __pyx_f_6cypari_5_pari_pari_longword_to_int((__pyx_cur_scope->__pyx_v_self->__pyx_base.g[__pyx_t_4])); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1117, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1115
 *                 return val
 * 
 *         elif pari_type == t_VECSMALL:             # <<<<<<<<<<<<<<
 *             #t_VECSMALL: vec. small ints  [ code ] [ x_1 ] ... [ x_k ]
 *             return pari_longword_to_int(self.g[n+1])
 */
  }

  /* "cypari/gen.pyx":1119
 *             return pari_longword_to_int(self.g[n+1])
 * 
 *         elif pari_type == t_STR:             # <<<<<<<<<<<<<<
 *             #t_STR    : string            [ code ] [ man_1 ] ... [ man_k ]
 *             return chr( (<char *>(self.g+1))[n] )
 */
  __pyx_t_2 = ((__pyx_v_pari_type == t_STR) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1121
 *         elif pari_type == t_STR:
 *             #t_STR    : string            [ code ] [ man_1 ] ... [ man_k ]
 *             return chr( (<char *>(self.g+1))[n] )             # <<<<<<<<<<<<<<
 * 
 *         elif pari_type == t_LIST:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyIndex_AsSsize_t(__pyx_v_n); if (unlikely((__pyx_t_4 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(6, 1121, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyInt_From_char((((char *)(__pyx_cur_scope->__pyx_v_self->__pyx_base.g + 1))[__pyx_t_4])); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1119
 *             return pari_longword_to_int(self.g[n+1])
 * 
 *         elif pari_type == t_STR:             # <<<<<<<<<<<<<<
 *             #t_STR    : string            [ code ] [ man_1 ] ... [ man_k ]
 *             return chr( (<char *>(self.g+1))[n] )
 */
  }

  /* "cypari/gen.pyx":1123
 *             return chr( (<char *>(self.g+1))[n] )
 * 
 *         elif pari_type == t_LIST:             # <<<<<<<<<<<<<<
 *             return self.component(n+1)
 * 
 */
  __pyx_t_2 = ((__pyx_v_pari_type == t_LIST) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1124
 * 
 *         elif pari_type == t_LIST:
 *             return self.component(n+1)             # <<<<<<<<<<<<<<
 * 
 *         #elif pari_type in (t_FRAC, t_RFRAC):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s_component); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_3, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7);
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1123
 *             return chr( (<char *>(self.g+1))[n] )
 * 
 *         elif pari_type == t_LIST:             # <<<<<<<<<<<<<<
 *             return self.component(n+1)
 * 
 */
  }

  /* "cypari/gen.pyx":1142
 *             ## generic code, which currently handles cases
 *             ## as mentioned above
 *             return new_ref(gel(self.g,n+1), self)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, n, y):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_13 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1142, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = ((PyObject *)__pyx_cur_scope->__pyx_v_self);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_9 = ((PyObject *)__pyx_f_6cypari_5_pari_new_ref(gel(__pyx_cur_scope->__pyx_v_self->__pyx_base.g, __pyx_t_13), ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5))); if (unlikely(!__pyx_t_9)) __PYX_ERR(6, 1142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_9;
    __pyx_t_9 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":937
 *         return new_gen(bid_get_gen(self.g))
 * 
 *     def __getitem__(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the nth entry of self. The indexing is 0-based, like in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("cypari._pari.Gen.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ind);
  __Pyx_XDECREF((PyObject *)__pyx_v_val);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XDECREF(__pyx_v_step);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1144
 *             return new_ref(gel(self.g,n+1), self)
 * 
 *     def __setitem__(self, n, y):             # <<<<<<<<<<<<<<
 *         r"""
 *         Set the nth entry to a reference to y.
 */

/* Python wrapper */
static int __pyx_pw_6cypari_5_pari_3Gen_79__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_y); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_78__setitem__[] = "\n        Set the nth entry to a reference to y.\n\n\n            -  The indexing is 0-based, like everywhere else in Python, but\n               *unlike* in PARI/GP.\n\n            -  Assignment sets the nth entry to a reference to y, assuming y is\n               an object of type gen. This is the same as in Python, but\n               *different* than what happens in the gp interpreter, where\n               assignment makes a copy of y.\n\n            -  Because setting creates references it is *possible* to make\n               circular references, unlike in GP. Do *not* do this (see the\n               example below). If you need circular references, work at the Python\n               level (where they work well), not the PARI object level.\n\n\n\n        EXAMPLES::\n\n            sage: v = pari(list(range(10)))\n            sage: v\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n            sage: v[0] = 10\n            sage: w = pari([5,8,-20])\n            sage: v\n            [10, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n            sage: v[1] = w\n            sage: v\n            [10, [5, 8, -20], 2, 3, 4, 5, 6, 7, 8, 9]\n            sage: w[0] = -30\n            sage: v\n            [10, [-30, 8, -20], 2, 3, 4, 5, 6, 7, 8, 9]\n            sage: t = v[1]; t[1] = 10 ; v\n            [10, [-30, 10, -20], 2, 3, 4, 5, 6, 7, 8, 9]\n            sage: v[1][0] = 54321 ; v\n            [10, [54321, 10, -20], 2, 3, 4, 5, 6, 7, 8, 9]\n            sage: w\n            [54321, 10, -20]\n            sage: v = pari([[[[0,1],2],3],4]) ; v[0][0][0][1] = 12 ; v\n            [[[[0, 12], 2], 3], 4]\n            sage: m = pari.matrix(2,2,list(range(4))) ; l = pari([5,6]) ; n = pari.matrix(2,2,[7,8,9,0]) ; m[1,0] = l ; l[1] = n ; m[1,0][1][1,1] = 1111 ; m\n            [0, 1; [5, [7, 8; 9, 1111]], 3]\n            sage: m = pari(\"[[1,2;3,4],5,6]\") ; m[0][1,1] = 11 ; m\n            [[1, 2; 3, 11], 5, 6]\n\n        Finally, we create a circular reference::\n\n            sage: v = pari([0])\n   ""         sage: w = pari([v])\n            sage: v\n            [0]\n            sage: w\n            [[0]]\n            sage: v[0] = w\n\n        Now there is a circular reference. Accessing v[0] will crash Sage.\n\n        ::\n\n            sage: s=pari.vector(2,[0,0])\n            sage: s[:1]\n            [0]\n            sage: s[:1]=[1]\n            sage: s\n            [1, 0]\n            sage: isinstance(s[0], Gen)\n            True\n            sage: s = pari(list(range(20))) ; s\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n            sage: s[0:10:2] = list(range(50,55)) ; s\n            [50, 1, 51, 3, 52, 5, 53, 7, 54, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n            sage: s[10:20:3] = list(range(100,150)) ; s\n            [50, 1, 51, 3, 52, 5, 53, 7, 54, 9, 100, 11, 12, 101, 14, 15, 102, 17, 18, 103]\n\n        TESTS::\n\n            sage: v = pari(list(range(10))) ; v\n            [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n            sage: v[:] = list(range(20, 30))\n            sage: v\n            [20, 21, 22, 23, 24, 25, 26, 27, 28, 29]\n            sage: isinstance(v[0], Gen)\n            True\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_78__setitem__;
#endif
static int __pyx_pw_6cypari_5_pari_3Gen_79__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_y) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_78__setitem__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_n), ((PyObject *)__pyx_v_y));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6cypari_5_pari_3Gen_78__setitem__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n, PyObject *__pyx_v_y) {
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_i;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_j;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_l;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x = 0;
  PyObject *__pyx_v_ind = NULL;
  PyObject *__pyx_v_inds = NULL;
  Py_ssize_t __pyx_v_k;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_t_11;
  int __pyx_t_12;
  char const *__pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "cypari/gen.pyx":1232
 *         """
 *         cdef pari_longword i, j, l
 *         cdef Gen x = objtogen(y)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t ii, jj, step
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_y, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":1235
 *         cdef Py_ssize_t ii, jj, step
 * 
 *         sig_on()             # <<<<<<<<<<<<<<
 *         try:
 *             if isinstance(n, tuple):
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 1235, __pyx_L1_error)

  /* "cypari/gen.pyx":1236
 * 
 *         sig_on()
 *         try:             # <<<<<<<<<<<<<<
 *             if isinstance(n, tuple):
 *                 if typ(self.g) != t_MAT:
 */
  /*try:*/ {

    /* "cypari/gen.pyx":1237
 *         sig_on()
 *         try:
 *             if isinstance(n, tuple):             # <<<<<<<<<<<<<<
 *                 if typ(self.g) != t_MAT:
 *                     raise TypeError("cannot index PARI type %s by tuple" % typ(self.g))
 */
    __pyx_t_3 = PyTuple_Check(__pyx_v_n); 
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "cypari/gen.pyx":1238
 *         try:
 *             if isinstance(n, tuple):
 *                 if typ(self.g) != t_MAT:             # <<<<<<<<<<<<<<
 *                     raise TypeError("cannot index PARI type %s by tuple" % typ(self.g))
 * 
 */
      __pyx_t_4 = ((typ(__pyx_v_self->__pyx_base.g) != t_MAT) != 0);
      if (unlikely(__pyx_t_4)) {

        /* "cypari/gen.pyx":1239
 *             if isinstance(n, tuple):
 *                 if typ(self.g) != t_MAT:
 *                     raise TypeError("cannot index PARI type %s by tuple" % typ(self.g))             # <<<<<<<<<<<<<<
 * 
 *                 if len(n) != 2:
 */
        __pyx_t_1 = __Pyx_PyInt_From_long(typ(__pyx_v_self->__pyx_base.g)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1239, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_cannot_index_PARI_type_s_by_tupl, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1239, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1239, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(6, 1239, __pyx_L4_error)

        /* "cypari/gen.pyx":1238
 *         try:
 *             if isinstance(n, tuple):
 *                 if typ(self.g) != t_MAT:             # <<<<<<<<<<<<<<
 *                     raise TypeError("cannot index PARI type %s by tuple" % typ(self.g))
 * 
 */
      }

      /* "cypari/gen.pyx":1241
 *                     raise TypeError("cannot index PARI type %s by tuple" % typ(self.g))
 * 
 *                 if len(n) != 2:             # <<<<<<<<<<<<<<
 *                     raise ValueError("matrix index must be of the form [row, column]")
 * 
 */
      __pyx_t_6 = PyObject_Length(__pyx_v_n); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1241, __pyx_L4_error)
      __pyx_t_4 = ((__pyx_t_6 != 2) != 0);
      if (unlikely(__pyx_t_4)) {

        /* "cypari/gen.pyx":1242
 * 
 *                 if len(n) != 2:
 *                     raise ValueError("matrix index must be of the form [row, column]")             # <<<<<<<<<<<<<<
 * 
 *                 i = n[0]
 */
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__93, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1242, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(6, 1242, __pyx_L4_error)

        /* "cypari/gen.pyx":1241
 *                     raise TypeError("cannot index PARI type %s by tuple" % typ(self.g))
 * 
 *                 if len(n) != 2:             # <<<<<<<<<<<<<<
 *                     raise ValueError("matrix index must be of the form [row, column]")
 * 
 */
      }

      /* "cypari/gen.pyx":1244
 *                     raise ValueError("matrix index must be of the form [row, column]")
 * 
 *                 i = n[0]             # <<<<<<<<<<<<<<
 *                 j = n[1]
 *                 ind = (i,j)
 */
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_n, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1244, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1244, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_i = __pyx_t_7;

      /* "cypari/gen.pyx":1245
 * 
 *                 i = n[0]
 *                 j = n[1]             # <<<<<<<<<<<<<<
 *                 ind = (i,j)
 * 
 */
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_n, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1245, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_1); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1245, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_j = __pyx_t_7;

      /* "cypari/gen.pyx":1246
 *                 i = n[0]
 *                 j = n[1]
 *                 ind = (i,j)             # <<<<<<<<<<<<<<
 * 
 *                 if i < 0 or i >= glength(<GEN>(self.g[1])):
 */
      __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1246, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1246, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1246, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
      __pyx_t_1 = 0;
      __pyx_t_5 = 0;
      __pyx_v_ind = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "cypari/gen.pyx":1248
 *                 ind = (i,j)
 * 
 *                 if i < 0 or i >= glength(<GEN>(self.g[1])):             # <<<<<<<<<<<<<<
 *                     raise IndexError("row i(=%s) must be between 0 and %s" % (i, self.nrows()-1))
 *                 if j < 0 or j >= glength(self.g):
 */
      __pyx_t_3 = ((__pyx_v_i < 0) != 0);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_4 = __pyx_t_3;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_3 = ((__pyx_v_i >= glength(((GEN)(__pyx_v_self->__pyx_base.g[1])))) != 0);
      __pyx_t_4 = __pyx_t_3;
      __pyx_L10_bool_binop_done:;
      if (unlikely(__pyx_t_4)) {

        /* "cypari/gen.pyx":1249
 * 
 *                 if i < 0 or i >= glength(<GEN>(self.g[1])):
 *                     raise IndexError("row i(=%s) must be between 0 and %s" % (i, self.nrows()-1))             # <<<<<<<<<<<<<<
 *                 if j < 0 or j >= glength(self.g):
 *                     raise IndexError("column j(=%s) must be between 0 and %s" % (j, self.ncols()-1))
 */
        __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1249, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_nrows); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1249, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1249, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_5, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1249, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1249, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
        __pyx_t_8 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_row_i_s_must_be_between_0_and_s, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1249, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1249, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(6, 1249, __pyx_L4_error)

        /* "cypari/gen.pyx":1248
 *                 ind = (i,j)
 * 
 *                 if i < 0 or i >= glength(<GEN>(self.g[1])):             # <<<<<<<<<<<<<<
 *                     raise IndexError("row i(=%s) must be between 0 and %s" % (i, self.nrows()-1))
 *                 if j < 0 or j >= glength(self.g):
 */
      }

      /* "cypari/gen.pyx":1250
 *                 if i < 0 or i >= glength(<GEN>(self.g[1])):
 *                     raise IndexError("row i(=%s) must be between 0 and %s" % (i, self.nrows()-1))
 *                 if j < 0 or j >= glength(self.g):             # <<<<<<<<<<<<<<
 *                     raise IndexError("column j(=%s) must be between 0 and %s" % (j, self.ncols()-1))
 *                 if self.refers_to is None:
 */
      __pyx_t_3 = ((__pyx_v_j < 0) != 0);
      if (!__pyx_t_3) {
      } else {
        __pyx_t_4 = __pyx_t_3;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_3 = ((__pyx_v_j >= glength(__pyx_v_self->__pyx_base.g)) != 0);
      __pyx_t_4 = __pyx_t_3;
      __pyx_L13_bool_binop_done:;
      if (unlikely(__pyx_t_4)) {

        /* "cypari/gen.pyx":1251
 *                     raise IndexError("row i(=%s) must be between 0 and %s" % (i, self.nrows()-1))
 *                 if j < 0 or j >= glength(self.g):
 *                     raise IndexError("column j(=%s) must be between 0 and %s" % (j, self.ncols()-1))             # <<<<<<<<<<<<<<
 *                 if self.refers_to is None:
 *                     self.refers_to = {ind: x}
 */
        __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_j); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1251, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ncols); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1251, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1251, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1251, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1251, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
        __pyx_t_5 = 0;
        __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_column_j_s_must_be_between_0_and, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1251, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1251, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_1, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __PYX_ERR(6, 1251, __pyx_L4_error)

        /* "cypari/gen.pyx":1250
 *                 if i < 0 or i >= glength(<GEN>(self.g[1])):
 *                     raise IndexError("row i(=%s) must be between 0 and %s" % (i, self.nrows()-1))
 *                 if j < 0 or j >= glength(self.g):             # <<<<<<<<<<<<<<
 *                     raise IndexError("column j(=%s) must be between 0 and %s" % (j, self.ncols()-1))
 *                 if self.refers_to is None:
 */
      }

      /* "cypari/gen.pyx":1252
 *                 if j < 0 or j >= glength(self.g):
 *                     raise IndexError("column j(=%s) must be between 0 and %s" % (j, self.ncols()-1))
 *                 if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                     self.refers_to = {ind: x}
 *                 else:
 */
      __pyx_t_4 = (__pyx_v_self->__pyx_base.refers_to == ((PyObject*)Py_None));
      __pyx_t_3 = (__pyx_t_4 != 0);
      if (__pyx_t_3) {

        /* "cypari/gen.pyx":1253
 *                     raise IndexError("column j(=%s) must be between 0 and %s" % (j, self.ncols()-1))
 *                 if self.refers_to is None:
 *                     self.refers_to = {ind: x}             # <<<<<<<<<<<<<<
 *                 else:
 *                     self.refers_to[ind] = x
 */
        __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1253, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(__pyx_t_1, __pyx_v_ind, ((PyObject *)__pyx_v_x)) < 0) __PYX_ERR(6, 1253, __pyx_L4_error)
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_v_self->__pyx_base.refers_to);
        __Pyx_DECREF(__pyx_v_self->__pyx_base.refers_to);
        __pyx_v_self->__pyx_base.refers_to = ((PyObject*)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "cypari/gen.pyx":1252
 *                 if j < 0 or j >= glength(self.g):
 *                     raise IndexError("column j(=%s) must be between 0 and %s" % (j, self.ncols()-1))
 *                 if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                     self.refers_to = {ind: x}
 *                 else:
 */
        goto __pyx_L15;
      }

      /* "cypari/gen.pyx":1255
 *                     self.refers_to = {ind: x}
 *                 else:
 *                     self.refers_to[ind] = x             # <<<<<<<<<<<<<<
 *                 (<GEN>(self.g)[j+1])[i+1] = <pari_longword>(x.g)
 *                 return
 */
      /*else*/ {
        if (unlikely(__pyx_v_self->__pyx_base.refers_to == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(6, 1255, __pyx_L4_error)
        }
        if (unlikely(PyDict_SetItem(__pyx_v_self->__pyx_base.refers_to, __pyx_v_ind, ((PyObject *)__pyx_v_x)) < 0)) __PYX_ERR(6, 1255, __pyx_L4_error)
      }
      __pyx_L15:;

      /* "cypari/gen.pyx":1256
 *                 else:
 *                     self.refers_to[ind] = x
 *                 (<GEN>(self.g)[j+1])[i+1] = <pari_longword>(x.g)             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      (((GEN)(__pyx_v_self->__pyx_base.g[(__pyx_v_j + 1)]))[(__pyx_v_i + 1)]) = ((__pyx_t_6cypari_8paridecl_pari_longword)__pyx_v_x->__pyx_base.g);

      /* "cypari/gen.pyx":1257
 *                     self.refers_to[ind] = x
 *                 (<GEN>(self.g)[j+1])[i+1] = <pari_longword>(x.g)
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             elif isinstance(n, slice):
 */
      __pyx_r = 0;
      goto __pyx_L3_return;

      /* "cypari/gen.pyx":1237
 *         sig_on()
 *         try:
 *             if isinstance(n, tuple):             # <<<<<<<<<<<<<<
 *                 if typ(self.g) != t_MAT:
 *                     raise TypeError("cannot index PARI type %s by tuple" % typ(self.g))
 */
    }

    /* "cypari/gen.pyx":1259
 *                 return
 * 
 *             elif isinstance(n, slice):             # <<<<<<<<<<<<<<
 *                 l = glength(self.g)
 *                 inds = range(*n.indices(l))
 */
    __pyx_t_3 = PySlice_Check(__pyx_v_n); 
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "cypari/gen.pyx":1260
 * 
 *             elif isinstance(n, slice):
 *                 l = glength(self.g)             # <<<<<<<<<<<<<<
 *                 inds = range(*n.indices(l))
 *                 k = len(inds)
 */
      __pyx_v_l = glength(__pyx_v_self->__pyx_base.g);

      /* "cypari/gen.pyx":1261
 *             elif isinstance(n, slice):
 *                 l = glength(self.g)
 *                 inds = range(*n.indices(l))             # <<<<<<<<<<<<<<
 *                 k = len(inds)
 *                 if k > len(y):
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_n, __pyx_n_s_indices); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1261, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_l); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1261, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      __pyx_t_1 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_9, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1261, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1261, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1261, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_inds = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "cypari/gen.pyx":1262
 *                 l = glength(self.g)
 *                 inds = range(*n.indices(l))
 *                 k = len(inds)             # <<<<<<<<<<<<<<
 *                 if k > len(y):
 *                     raise ValueError("attempt to assign sequence of size %s to slice of size %s" % (len(y), k))
 */
      __pyx_t_6 = PyObject_Length(__pyx_v_inds); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1262, __pyx_L4_error)
      __pyx_v_k = __pyx_t_6;

      /* "cypari/gen.pyx":1263
 *                 inds = range(*n.indices(l))
 *                 k = len(inds)
 *                 if k > len(y):             # <<<<<<<<<<<<<<
 *                     raise ValueError("attempt to assign sequence of size %s to slice of size %s" % (len(y), k))
 * 
 */
      __pyx_t_6 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1263, __pyx_L4_error)
      __pyx_t_4 = ((__pyx_v_k > __pyx_t_6) != 0);
      if (unlikely(__pyx_t_4)) {

        /* "cypari/gen.pyx":1264
 *                 k = len(inds)
 *                 if k > len(y):
 *                     raise ValueError("attempt to assign sequence of size %s to slice of size %s" % (len(y), k))             # <<<<<<<<<<<<<<
 * 
 *                 # actually set the values
 */
        __pyx_t_6 = PyObject_Length(__pyx_v_y); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(6, 1264, __pyx_L4_error)
        __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1264, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_k); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1264, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1264, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
        __pyx_t_1 = 0;
        __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_attempt_to_assign_sequence_of_si, __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1264, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1264, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_Raise(__pyx_t_5, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __PYX_ERR(6, 1264, __pyx_L4_error)

        /* "cypari/gen.pyx":1263
 *                 inds = range(*n.indices(l))
 *                 k = len(inds)
 *                 if k > len(y):             # <<<<<<<<<<<<<<
 *                     raise ValueError("attempt to assign sequence of size %s to slice of size %s" % (len(y), k))
 * 
 */
      }

      /* "cypari/gen.pyx":1267
 * 
 *                 # actually set the values
 *                 for i,j in enumerate(inds):             # <<<<<<<<<<<<<<
 *                     self[j] = y[i]
 *                 return
 */
      __pyx_t_7 = 0;
      if (likely(PyList_CheckExact(__pyx_v_inds)) || PyTuple_CheckExact(__pyx_v_inds)) {
        __pyx_t_5 = __pyx_v_inds; __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
        __pyx_t_10 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_inds); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1267, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(6, 1267, __pyx_L4_error)
      }
      for (;;) {
        if (likely(!__pyx_t_10)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(6, 1267, __pyx_L4_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1267, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          } else {
            if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(6, 1267, __pyx_L4_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1267, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          }
        } else {
          __pyx_t_8 = __pyx_t_10(__pyx_t_5);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(6, 1267, __pyx_L4_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __pyx_t_11 = __Pyx_PyInt_As_long(__pyx_t_8); if (unlikely((__pyx_t_11 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1267, __pyx_L4_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_j = __pyx_t_11;
        __pyx_v_i = __pyx_t_7;
        __pyx_t_7 = (__pyx_t_7 + 1);

        /* "cypari/gen.pyx":1268
 *                 # actually set the values
 *                 for i,j in enumerate(inds):
 *                     self[j] = y[i]             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_y, __pyx_v_i, __pyx_t_6cypari_8paridecl_pari_longword, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1268, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (unlikely(__Pyx_SetItemInt(((PyObject *)__pyx_v_self), __pyx_v_j, __pyx_t_8, __pyx_t_6cypari_8paridecl_pari_longword, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(6, 1268, __pyx_L4_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

        /* "cypari/gen.pyx":1267
 * 
 *                 # actually set the values
 *                 for i,j in enumerate(inds):             # <<<<<<<<<<<<<<
 *                     self[j] = y[i]
 *                 return
 */
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cypari/gen.pyx":1269
 *                 for i,j in enumerate(inds):
 *                     self[j] = y[i]
 *                 return             # <<<<<<<<<<<<<<
 * 
 *             i = int(n)
 */
      __pyx_r = 0;
      goto __pyx_L3_return;

      /* "cypari/gen.pyx":1259
 *                 return
 * 
 *             elif isinstance(n, slice):             # <<<<<<<<<<<<<<
 *                 l = glength(self.g)
 *                 inds = range(*n.indices(l))
 */
    }

    /* "cypari/gen.pyx":1271
 *                 return
 * 
 *             i = int(n)             # <<<<<<<<<<<<<<
 * 
 *             if i < 0 or i >= glength(self.g):
 */
    __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1271, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_7 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1271, __pyx_L4_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_i = __pyx_t_7;

    /* "cypari/gen.pyx":1273
 *             i = int(n)
 * 
 *             if i < 0 or i >= glength(self.g):             # <<<<<<<<<<<<<<
 *                 raise IndexError("index (%s) must be between 0 and %s" % (i, <pari_longword>glength(self.g)-1))
 * 
 */
    __pyx_t_3 = ((__pyx_v_i < 0) != 0);
    if (!__pyx_t_3) {
    } else {
      __pyx_t_4 = __pyx_t_3;
      goto __pyx_L20_bool_binop_done;
    }
    __pyx_t_3 = ((__pyx_v_i >= glength(__pyx_v_self->__pyx_base.g)) != 0);
    __pyx_t_4 = __pyx_t_3;
    __pyx_L20_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "cypari/gen.pyx":1274
 * 
 *             if i < 0 or i >= glength(self.g):
 *                 raise IndexError("index (%s) must be between 0 and %s" % (i, <pari_longword>glength(self.g)-1))             # <<<<<<<<<<<<<<
 * 
 *             # so python memory manager will work correctly
 */
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1274, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyInt_From_long((((__pyx_t_6cypari_8paridecl_pari_longword)glength(__pyx_v_self->__pyx_base.g)) - 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1274, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1274, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8);
      __pyx_t_5 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyString_Format(__pyx_kp_s_index_s_must_be_between_0_and_s, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1274, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1274, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __PYX_ERR(6, 1274, __pyx_L4_error)

      /* "cypari/gen.pyx":1273
 *             i = int(n)
 * 
 *             if i < 0 or i >= glength(self.g):             # <<<<<<<<<<<<<<
 *                 raise IndexError("index (%s) must be between 0 and %s" % (i, <pari_longword>glength(self.g)-1))
 * 
 */
    }

    /* "cypari/gen.pyx":1279
 *             # and not free x if PARI part of self is the
 *             # only thing pointing to it.
 *             if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                 self.refers_to = {i: x}
 *             else:
 */
    __pyx_t_4 = (__pyx_v_self->__pyx_base.refers_to == ((PyObject*)Py_None));
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "cypari/gen.pyx":1280
 *             # only thing pointing to it.
 *             if self.refers_to is None:
 *                 self.refers_to = {i: x}             # <<<<<<<<<<<<<<
 *             else:
 *                 self.refers_to[i] = x
 */
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1280, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 1280, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_1, __pyx_t_8, ((PyObject *)__pyx_v_x)) < 0) __PYX_ERR(6, 1280, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_v_self->__pyx_base.refers_to);
      __Pyx_DECREF(__pyx_v_self->__pyx_base.refers_to);
      __pyx_v_self->__pyx_base.refers_to = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "cypari/gen.pyx":1279
 *             # and not free x if PARI part of self is the
 *             # only thing pointing to it.
 *             if self.refers_to is None:             # <<<<<<<<<<<<<<
 *                 self.refers_to = {i: x}
 *             else:
 */
      goto __pyx_L22;
    }

    /* "cypari/gen.pyx":1282
 *                 self.refers_to = {i: x}
 *             else:
 *                 self.refers_to[i] = x             # <<<<<<<<<<<<<<
 * 
 *             ## correct indexing for t_POLs
 */
    /*else*/ {
      if (unlikely(__pyx_v_self->__pyx_base.refers_to == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(6, 1282, __pyx_L4_error)
      }
      __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1282, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(PyDict_SetItem(__pyx_v_self->__pyx_base.refers_to, __pyx_t_1, ((PyObject *)__pyx_v_x)) < 0)) __PYX_ERR(6, 1282, __pyx_L4_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L22:;

    /* "cypari/gen.pyx":1285
 * 
 *             ## correct indexing for t_POLs
 *             if typ(self.g) == t_POL:             # <<<<<<<<<<<<<<
 *                 i = i + 1
 * 
 */
    __pyx_t_3 = ((typ(__pyx_v_self->__pyx_base.g) == t_POL) != 0);
    if (__pyx_t_3) {

      /* "cypari/gen.pyx":1286
 *             ## correct indexing for t_POLs
 *             if typ(self.g) == t_POL:
 *                 i = i + 1             # <<<<<<<<<<<<<<
 * 
 *             ## actually set the value
 */
      __pyx_v_i = (__pyx_v_i + 1);

      /* "cypari/gen.pyx":1285
 * 
 *             ## correct indexing for t_POLs
 *             if typ(self.g) == t_POL:             # <<<<<<<<<<<<<<
 *                 i = i + 1
 * 
 */
    }

    /* "cypari/gen.pyx":1289
 * 
 *             ## actually set the value
 *             (self.g)[i+1] = <pari_longword>(x.g)             # <<<<<<<<<<<<<<
 *             return
 *         finally:
 */
    (__pyx_v_self->__pyx_base.g[(__pyx_v_i + 1)]) = ((__pyx_t_6cypari_8paridecl_pari_longword)__pyx_v_x->__pyx_base.g);

    /* "cypari/gen.pyx":1290
 *             ## actually set the value
 *             (self.g)[i+1] = <pari_longword>(x.g)
 *             return             # <<<<<<<<<<<<<<
 *         finally:
 *             sig_off()
 */
    __pyx_r = 0;
    goto __pyx_L3_return;
  }

  /* "cypari/gen.pyx":1292
 *             return
 *         finally:
 *             sig_off()             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16) < 0)) __Pyx_ErrFetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __pyx_t_2 = __pyx_lineno; __pyx_t_12 = __pyx_clineno; __pyx_t_13 = __pyx_filename;
      {
        sig_off();
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_ExceptionReset(__pyx_t_17, __pyx_t_18, __pyx_t_19);
      }
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_ErrRestore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0;
      __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_12; __pyx_filename = __pyx_t_13;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_20 = __pyx_r;
      sig_off();
      __pyx_r = __pyx_t_20;
      goto __pyx_L0;
    }
  }

  /* "cypari/gen.pyx":1144
 *             return new_ref(gel(self.g,n+1), self)
 * 
 *     def __setitem__(self, n, y):             # <<<<<<<<<<<<<<
 *         r"""
 *         Set the nth entry to a reference to y.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("cypari._pari.Gen.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_ind);
  __Pyx_XDECREF(__pyx_v_inds);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1294
 *             sig_off()
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return glength(self.g)
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_pw_6cypari_5_pari_3Gen_81__len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_pw_6cypari_5_pari_3Gen_81__len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_80__len__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_pf_6cypari_5_pari_3Gen_80__len__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "cypari/gen.pyx":1295
 * 
 *     def __len__(self):
 *         return glength(self.g)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(left, right, int op):
 */
  __pyx_r = glength(__pyx_v_self->__pyx_base.g);
  goto __pyx_L0;

  /* "cypari/gen.pyx":1294
 *             sig_off()
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return glength(self.g)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1297
 *         return glength(self.g)
 * 
 *     def __richcmp__(left, right, int op):             # <<<<<<<<<<<<<<
 *         """
 *         Compare ``left`` and ``right`` using ``op``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_83__richcmp__(PyObject *__pyx_v_left, PyObject *__pyx_v_right, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_83__richcmp__(PyObject *__pyx_v_left, PyObject *__pyx_v_right, int __pyx_v_op) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_82__richcmp__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_left), ((PyObject *)__pyx_v_right), ((int)__pyx_v_op));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_82__richcmp__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_left, PyObject *__pyx_v_right, int __pyx_v_op) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  int __pyx_v_r;
  GEN __pyx_v_x;
  GEN __pyx_v_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  GEN __pyx_t_8;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "cypari/gen.pyx":1358
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":1359
 *         cdef Gen t0, t1
 *         try:
 *             t0 = objtogen(left)             # <<<<<<<<<<<<<<
 *             t1 = objtogen(right)
 *         except Exception:
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(((PyObject *)__pyx_v_left), 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1359, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":1360
 *         try:
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             return NotImplemented
 */
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_right, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1360, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "cypari/gen.pyx":1358
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "cypari/gen.pyx":1361
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 *         cdef bint r
 */
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_5) {
      __Pyx_AddTraceback("cypari._pari.Gen.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(6, 1361, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "cypari/gen.pyx":1362
 *             t1 = objtogen(right)
 *         except Exception:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 *         cdef bint r
 *         cdef GEN x = t0.g
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_builtin_NotImplemented);
      __pyx_r = __pyx_builtin_NotImplemented;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "cypari/gen.pyx":1358
 *         """
 *         cdef Gen t0, t1
 *         try:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(left)
 *             t1 = objtogen(right)
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L8_try_end:;
  }

  /* "cypari/gen.pyx":1364
 *             return NotImplemented
 *         cdef bint r
 *         cdef GEN x = t0.g             # <<<<<<<<<<<<<<
 *         cdef GEN y = t1.g
 *         sig_on()
 */
  __pyx_t_8 = __pyx_v_t0->__pyx_base.g;
  __pyx_v_x = __pyx_t_8;

  /* "cypari/gen.pyx":1365
 *         cdef bint r
 *         cdef GEN x = t0.g
 *         cdef GEN y = t1.g             # <<<<<<<<<<<<<<
 *         sig_on()
 *         if op == Py_EQ:
 */
  __pyx_t_8 = __pyx_v_t1->__pyx_base.g;
  __pyx_v_y = __pyx_t_8;

  /* "cypari/gen.pyx":1366
 *         cdef GEN x = t0.g
 *         cdef GEN y = t1.g
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if op == Py_EQ:
 *             r = (gequal(x, y) != 0)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 1366, __pyx_L1_error)

  /* "cypari/gen.pyx":1367
 *         cdef GEN y = t1.g
 *         sig_on()
 *         if op == Py_EQ:             # <<<<<<<<<<<<<<
 *             r = (gequal(x, y) != 0)
 *         elif op == Py_NE:
 */
  __pyx_t_9 = ((__pyx_v_op == Py_EQ) != 0);
  if (__pyx_t_9) {

    /* "cypari/gen.pyx":1368
 *         sig_on()
 *         if op == Py_EQ:
 *             r = (gequal(x, y) != 0)             # <<<<<<<<<<<<<<
 *         elif op == Py_NE:
 *             r = (gequal(x, y) == 0)
 */
    __pyx_v_r = (gequal(__pyx_v_x, __pyx_v_y) != 0);

    /* "cypari/gen.pyx":1367
 *         cdef GEN y = t1.g
 *         sig_on()
 *         if op == Py_EQ:             # <<<<<<<<<<<<<<
 *             r = (gequal(x, y) != 0)
 *         elif op == Py_NE:
 */
    goto __pyx_L11;
  }

  /* "cypari/gen.pyx":1369
 *         if op == Py_EQ:
 *             r = (gequal(x, y) != 0)
 *         elif op == Py_NE:             # <<<<<<<<<<<<<<
 *             r = (gequal(x, y) == 0)
 *         elif op == Py_LE:
 */
  __pyx_t_9 = ((__pyx_v_op == Py_NE) != 0);
  if (__pyx_t_9) {

    /* "cypari/gen.pyx":1370
 *             r = (gequal(x, y) != 0)
 *         elif op == Py_NE:
 *             r = (gequal(x, y) == 0)             # <<<<<<<<<<<<<<
 *         elif op == Py_LE:
 *             r = (gcmp(x, y) <= 0)
 */
    __pyx_v_r = (gequal(__pyx_v_x, __pyx_v_y) == 0);

    /* "cypari/gen.pyx":1369
 *         if op == Py_EQ:
 *             r = (gequal(x, y) != 0)
 *         elif op == Py_NE:             # <<<<<<<<<<<<<<
 *             r = (gequal(x, y) == 0)
 *         elif op == Py_LE:
 */
    goto __pyx_L11;
  }

  /* "cypari/gen.pyx":1371
 *         elif op == Py_NE:
 *             r = (gequal(x, y) == 0)
 *         elif op == Py_LE:             # <<<<<<<<<<<<<<
 *             r = (gcmp(x, y) <= 0)
 *         elif op == Py_GE:
 */
  __pyx_t_9 = ((__pyx_v_op == Py_LE) != 0);
  if (__pyx_t_9) {

    /* "cypari/gen.pyx":1372
 *             r = (gequal(x, y) == 0)
 *         elif op == Py_LE:
 *             r = (gcmp(x, y) <= 0)             # <<<<<<<<<<<<<<
 *         elif op == Py_GE:
 *             r = (gcmp(x, y) >= 0)
 */
    __pyx_v_r = (gcmp(__pyx_v_x, __pyx_v_y) <= 0);

    /* "cypari/gen.pyx":1371
 *         elif op == Py_NE:
 *             r = (gequal(x, y) == 0)
 *         elif op == Py_LE:             # <<<<<<<<<<<<<<
 *             r = (gcmp(x, y) <= 0)
 *         elif op == Py_GE:
 */
    goto __pyx_L11;
  }

  /* "cypari/gen.pyx":1373
 *         elif op == Py_LE:
 *             r = (gcmp(x, y) <= 0)
 *         elif op == Py_GE:             # <<<<<<<<<<<<<<
 *             r = (gcmp(x, y) >= 0)
 *         elif op == Py_LT:
 */
  __pyx_t_9 = ((__pyx_v_op == Py_GE) != 0);
  if (__pyx_t_9) {

    /* "cypari/gen.pyx":1374
 *             r = (gcmp(x, y) <= 0)
 *         elif op == Py_GE:
 *             r = (gcmp(x, y) >= 0)             # <<<<<<<<<<<<<<
 *         elif op == Py_LT:
 *             r = (gcmp(x, y) < 0)
 */
    __pyx_v_r = (gcmp(__pyx_v_x, __pyx_v_y) >= 0);

    /* "cypari/gen.pyx":1373
 *         elif op == Py_LE:
 *             r = (gcmp(x, y) <= 0)
 *         elif op == Py_GE:             # <<<<<<<<<<<<<<
 *             r = (gcmp(x, y) >= 0)
 *         elif op == Py_LT:
 */
    goto __pyx_L11;
  }

  /* "cypari/gen.pyx":1375
 *         elif op == Py_GE:
 *             r = (gcmp(x, y) >= 0)
 *         elif op == Py_LT:             # <<<<<<<<<<<<<<
 *             r = (gcmp(x, y) < 0)
 *         else:  # Py_GT
 */
  __pyx_t_9 = ((__pyx_v_op == Py_LT) != 0);
  if (__pyx_t_9) {

    /* "cypari/gen.pyx":1376
 *             r = (gcmp(x, y) >= 0)
 *         elif op == Py_LT:
 *             r = (gcmp(x, y) < 0)             # <<<<<<<<<<<<<<
 *         else:  # Py_GT
 *             r = (gcmp(x, y) > 0)
 */
    __pyx_v_r = (gcmp(__pyx_v_x, __pyx_v_y) < 0);

    /* "cypari/gen.pyx":1375
 *         elif op == Py_GE:
 *             r = (gcmp(x, y) >= 0)
 *         elif op == Py_LT:             # <<<<<<<<<<<<<<
 *             r = (gcmp(x, y) < 0)
 *         else:  # Py_GT
 */
    goto __pyx_L11;
  }

  /* "cypari/gen.pyx":1378
 *             r = (gcmp(x, y) < 0)
 *         else:  # Py_GT
 *             r = (gcmp(x, y) > 0)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return r
 */
  /*else*/ {
    __pyx_v_r = (gcmp(__pyx_v_x, __pyx_v_y) > 0);
  }
  __pyx_L11:;

  /* "cypari/gen.pyx":1379
 *         else:  # Py_GT
 *             r = (gcmp(x, y) > 0)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1380
 *             r = (gcmp(x, y) > 0)
 *         sig_off()
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     def __cmp__(self, Gen other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_r); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1297
 *         return glength(self.g)
 * 
 *     def __richcmp__(left, right, int op):             # <<<<<<<<<<<<<<
 *         """
 *         Compare ``left`` and ``right`` using ``op``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("cypari._pari.Gen.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1382
 *         return r
 * 
 *     def __cmp__(self, Gen other):             # <<<<<<<<<<<<<<
 *         """
 *         Compare ``left`` and ``right``.
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static int __pyx_pw_6cypari_5_pari_3Gen_85__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_84__cmp__[] = "\n        Compare ``left`` and ``right``.\n\n        This uses PARI's ``cmp_universal()`` routine, which defines\n        a total ordering on the set of all PARI objects (up to the\n        indistinguishability relation given by ``gidentical()``).\n\n        .. WARNING::\n\n            This comparison is only mathematically meaningful when\n            comparing 2 integers. In particular, when comparing\n            rationals or reals, this does not correspond to the natural\n            ordering.\n\n        EXAMPLES::\n\n            sage: cmp(pari(5), 5)\n            0\n            sage: cmp(pari(5), 10)\n            -1\n            sage: cmp(pari(2.5), None)\n            1\n            sage: cmp(pari(3), pari(3))\n            0\n            sage: cmp(pari('x^2 + 1'), pari('I-1'))\n            1\n            sage: cmp(pari('I'), pari('I'))\n            0\n\n        Beware when comparing rationals or reals::\n\n            sage: cmp(pari('2/3'), pari('2/5'))\n            -1\n            sage: two = pari('2.000000000000000000000000')\n            sage: cmp(two, pari(1.0))\n            1\n            sage: cmp(two, pari(2.0))\n            1\n            sage: cmp(two, pari(3.0))\n            1\n\n        Since :trac:`17026`, different elements with the same string\n        representation can be distinguished by ``cmp()``::\n\n            sage: a = pari(0); a\n            0\n            sage: b = pari(\"0*ffgen(ffinit(29, 10))\"); b\n            0\n            sage: cmp(a, b)\n            -1\n\n            sage: x = pari(\"x\"); x\n            x\n            sage: y = pari(\"ffgen(ffinit(3, 5))\"); y\n            x\n            sage: cmp(x, y)\n            1\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_84__cmp__;
#endif
static int __pyx_pw_6cypari_5_pari_3Gen_85__cmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cmp__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_6cypari_5_pari_Gen, 1, "other", 0))) __PYX_ERR(6, 1382, __pyx_L1_error)
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_84__cmp__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static int __pyx_pf_6cypari_5_pari_3Gen_84__cmp__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_other) {
  int __pyx_v_r;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__cmp__", 0);

  /* "cypari/gen.pyx":1441
 *             1
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef int r = cmp_universal(self.g, other.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1441, __pyx_L1_error)

  /* "cypari/gen.pyx":1442
 *         """
 *         sig_on()
 *         cdef int r = cmp_universal(self.g, other.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return r
 */
  __pyx_v_r = cmp_universal(__pyx_v_self->__pyx_base.g, __pyx_v_other->__pyx_base.g);

  /* "cypari/gen.pyx":1443
 *         sig_on()
 *         cdef int r = cmp_universal(self.g, other.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1444
 *         cdef int r = cmp_universal(self.g, other.g)
 *         sig_off()
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     def cmp_universal(Gen self, Gen other):
 */
  __pyx_r = __pyx_v_r;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1382
 *         return r
 * 
 *     def __cmp__(self, Gen other):             # <<<<<<<<<<<<<<
 *         """
 *         Compare ``left`` and ``right``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.__cmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cypari/gen.pyx":1446
 *         return r
 * 
 *     def cmp_universal(Gen self, Gen other):             # <<<<<<<<<<<<<<
 *         """
 *         Provide access to Pari's cmp_universal function in Python 3.  In
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_87cmp_universal(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_86cmp_universal[] = "\n        Provide access to Pari's cmp_universal function in Python 3.  In\n        Python 2 cmp_universal is used by the __cmp__ method.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_87cmp_universal(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("cmp_universal (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_6cypari_5_pari_Gen, 1, "other", 0))) __PYX_ERR(6, 1446, __pyx_L1_error)
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_86cmp_universal(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_other));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_86cmp_universal(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_other) {
  int __pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("cmp_universal", 0);

  /* "cypari/gen.pyx":1451
 *         Python 2 cmp_universal is used by the __cmp__ method.
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef int r = cmp_universal(self.g, other.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1451, __pyx_L1_error)

  /* "cypari/gen.pyx":1452
 *         """
 *         sig_on()
 *         cdef int r = cmp_universal(self.g, other.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return r
 */
  __pyx_v_r = cmp_universal(__pyx_v_self->__pyx_base.g, __pyx_v_other->__pyx_base.g);

  /* "cypari/gen.pyx":1453
 *         sig_on()
 *         cdef int r = cmp_universal(self.g, other.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return r
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1454
 *         cdef int r = cmp_universal(self.g, other.g)
 *         sig_off()
 *         return r             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_r); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1446
 *         return r
 * 
 *     def cmp_universal(Gen self, Gen other):             # <<<<<<<<<<<<<<
 *         """
 *         Provide access to Pari's cmp_universal function in Python 3.  In
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.cmp_universal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1456
 *         return r
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gcopy(self.g))
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_89__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_89__copy__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_88__copy__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_88__copy__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__copy__", 0);

  /* "cypari/gen.pyx":1457
 * 
 *     def __copy__(self):
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gcopy(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1457, __pyx_L1_error)

  /* "cypari/gen.pyx":1458
 *     def __copy__(self):
 *         sig_on()
 *         return new_gen(gcopy(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def __hex__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gcopy(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1456
 *         return r
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gcopy(self.g))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1460
 *         return new_gen(gcopy(self.g))
 * 
 *     def __hex__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the hexadecimal digits of self in lower case.
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_91__hex__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_90__hex__[] = "\n        Return the hexadecimal digits of self in lower case.\n\n        EXAMPLES::\n\n            sage: print(hex(pari(0)))\n            0\n            sage: print(hex(pari(15)))\n            f\n            sage: print(hex(pari(16)))\n            10\n            sage: print(hex(pari(16938402384092843092843098243)))\n            36bb1e3929d1a8fe2802f083\n            sage: print(hex(long(16938402384092843092843098243)))\n            0x36bb1e3929d1a8fe2802f083L\n            sage: print(hex(pari(-16938402384092843092843098243)))\n            -36bb1e3929d1a8fe2802f083\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_90__hex__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_91__hex__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__hex__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_90__hex__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000))*/

#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_90__hex__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  GEN __pyx_v_x;
  int __pyx_v_lx;
  GEN __pyx_v_xp;
  __pyx_t_6cypari_8paridecl_pari_ulongword __pyx_v_w;
  char *__pyx_v_s;
  char *__pyx_v_sp;
  char *__pyx_v_hexdigits;
  CYTHON_UNUSED int __pyx_v_i;
  CYTHON_UNUSED int __pyx_v_j;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_size;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  GEN __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  size_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__hex__", 0);

  /* "cypari/gen.pyx":1486
 *         cdef char *sp
 *         cdef char *hexdigits
 *         hexdigits = "0123456789abcdef"             # <<<<<<<<<<<<<<
 *         cdef int i, j
 *         cdef pari_longword size
 */
  __pyx_v_hexdigits = ((char *)"0123456789abcdef");

  /* "cypari/gen.pyx":1489
 *         cdef int i, j
 *         cdef pari_longword size
 *         x = self.g             # <<<<<<<<<<<<<<
 *         if typ(x) != t_INT:
 *             raise TypeError("Gen must be of PARI type t_INT")
 */
  __pyx_t_1 = __pyx_v_self->__pyx_base.g;
  __pyx_v_x = __pyx_t_1;

  /* "cypari/gen.pyx":1490
 *         cdef pari_longword size
 *         x = self.g
 *         if typ(x) != t_INT:             # <<<<<<<<<<<<<<
 *             raise TypeError("Gen must be of PARI type t_INT")
 *         if not signe(x):
 */
  __pyx_t_2 = ((typ(__pyx_v_x) != t_INT) != 0);
  if (unlikely(__pyx_t_2)) {

    /* "cypari/gen.pyx":1491
 *         x = self.g
 *         if typ(x) != t_INT:
 *             raise TypeError("Gen must be of PARI type t_INT")             # <<<<<<<<<<<<<<
 *         if not signe(x):
 *             return "0"
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__94, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1491, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(6, 1491, __pyx_L1_error)

    /* "cypari/gen.pyx":1490
 *         cdef pari_longword size
 *         x = self.g
 *         if typ(x) != t_INT:             # <<<<<<<<<<<<<<
 *             raise TypeError("Gen must be of PARI type t_INT")
 *         if not signe(x):
 */
  }

  /* "cypari/gen.pyx":1492
 *         if typ(x) != t_INT:
 *             raise TypeError("Gen must be of PARI type t_INT")
 *         if not signe(x):             # <<<<<<<<<<<<<<
 *             return "0"
 *         lx = lgefint(x)-2  # number of words
 */
  __pyx_t_2 = ((!(signe(__pyx_v_x) != 0)) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1493
 *             raise TypeError("Gen must be of PARI type t_INT")
 *         if not signe(x):
 *             return "0"             # <<<<<<<<<<<<<<
 *         lx = lgefint(x)-2  # number of words
 *         size = lx*2*sizeof(pari_ulongword)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_kp_s_0);
    __pyx_r = __pyx_kp_s_0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1492
 *         if typ(x) != t_INT:
 *             raise TypeError("Gen must be of PARI type t_INT")
 *         if not signe(x):             # <<<<<<<<<<<<<<
 *             return "0"
 *         lx = lgefint(x)-2  # number of words
 */
  }

  /* "cypari/gen.pyx":1494
 *         if not signe(x):
 *             return "0"
 *         lx = lgefint(x)-2  # number of words             # <<<<<<<<<<<<<<
 *         size = lx*2*sizeof(pari_ulongword)
 *         s = <char *>sig_malloc(size+2) # 1 char for sign, 1 char for '\0'
 */
  __pyx_v_lx = (lgefint(__pyx_v_x) - 2);

  /* "cypari/gen.pyx":1495
 *             return "0"
 *         lx = lgefint(x)-2  # number of words
 *         size = lx*2*sizeof(pari_ulongword)             # <<<<<<<<<<<<<<
 *         s = <char *>sig_malloc(size+2) # 1 char for sign, 1 char for '\0'
 *         sp = s + size + 1
 */
  __pyx_v_size = ((__pyx_v_lx * 2) * (sizeof(__pyx_t_6cypari_8paridecl_pari_ulongword)));

  /* "cypari/gen.pyx":1496
 *         lx = lgefint(x)-2  # number of words
 *         size = lx*2*sizeof(pari_ulongword)
 *         s = <char *>sig_malloc(size+2) # 1 char for sign, 1 char for '\0'             # <<<<<<<<<<<<<<
 *         sp = s + size + 1
 *         sp[0] = 0
 */
  __pyx_v_s = ((char *)sig_malloc((__pyx_v_size + 2)));

  /* "cypari/gen.pyx":1497
 *         size = lx*2*sizeof(pari_ulongword)
 *         s = <char *>sig_malloc(size+2) # 1 char for sign, 1 char for '\0'
 *         sp = s + size + 1             # <<<<<<<<<<<<<<
 *         sp[0] = 0
 *         xp = int_LSW(x)
 */
  __pyx_v_sp = ((__pyx_v_s + __pyx_v_size) + 1);

  /* "cypari/gen.pyx":1498
 *         s = <char *>sig_malloc(size+2) # 1 char for sign, 1 char for '\0'
 *         sp = s + size + 1
 *         sp[0] = 0             # <<<<<<<<<<<<<<
 *         xp = int_LSW(x)
 *         for i from 0 <= i < lx:
 */
  (__pyx_v_sp[0]) = 0;

  /* "cypari/gen.pyx":1499
 *         sp = s + size + 1
 *         sp[0] = 0
 *         xp = int_LSW(x)             # <<<<<<<<<<<<<<
 *         for i from 0 <= i < lx:
 *             w = xp[0]
 */
  __pyx_v_xp = int_LSW(__pyx_v_x);

  /* "cypari/gen.pyx":1500
 *         sp[0] = 0
 *         xp = int_LSW(x)
 *         for i from 0 <= i < lx:             # <<<<<<<<<<<<<<
 *             w = xp[0]
 *             for j from 0 <= j < 2*sizeof(pari_longword):
 */
  __pyx_t_4 = __pyx_v_lx;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_4; __pyx_v_i++) {

    /* "cypari/gen.pyx":1501
 *         xp = int_LSW(x)
 *         for i from 0 <= i < lx:
 *             w = xp[0]             # <<<<<<<<<<<<<<
 *             for j from 0 <= j < 2*sizeof(pari_longword):
 *                 sp = sp-1
 */
    __pyx_v_w = (__pyx_v_xp[0]);

    /* "cypari/gen.pyx":1502
 *         for i from 0 <= i < lx:
 *             w = xp[0]
 *             for j from 0 <= j < 2*sizeof(pari_longword):             # <<<<<<<<<<<<<<
 *                 sp = sp-1
 *                 sp[0] = hexdigits[w & 15]
 */
    __pyx_t_5 = (2 * (sizeof(__pyx_t_6cypari_8paridecl_pari_longword)));
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_5; __pyx_v_j++) {

      /* "cypari/gen.pyx":1503
 *             w = xp[0]
 *             for j from 0 <= j < 2*sizeof(pari_longword):
 *                 sp = sp-1             # <<<<<<<<<<<<<<
 *                 sp[0] = hexdigits[w & 15]
 *                 w = w>>4
 */
      __pyx_v_sp = (__pyx_v_sp - 1);

      /* "cypari/gen.pyx":1504
 *             for j from 0 <= j < 2*sizeof(pari_longword):
 *                 sp = sp-1
 *                 sp[0] = hexdigits[w & 15]             # <<<<<<<<<<<<<<
 *                 w = w>>4
 *             xp = int_nextW(xp)
 */
      (__pyx_v_sp[0]) = (__pyx_v_hexdigits[(__pyx_v_w & 15)]);

      /* "cypari/gen.pyx":1505
 *                 sp = sp-1
 *                 sp[0] = hexdigits[w & 15]
 *                 w = w>>4             # <<<<<<<<<<<<<<
 *             xp = int_nextW(xp)
 *         # remove leading zeros!
 */
      __pyx_v_w = (__pyx_v_w >> 4);
    }

    /* "cypari/gen.pyx":1506
 *                 sp[0] = hexdigits[w & 15]
 *                 w = w>>4
 *             xp = int_nextW(xp)             # <<<<<<<<<<<<<<
 *         # remove leading zeros!
 *         while sp[0] == c'0':
 */
    __pyx_v_xp = int_nextW(__pyx_v_xp);
  }

  /* "cypari/gen.pyx":1508
 *             xp = int_nextW(xp)
 *         # remove leading zeros!
 *         while sp[0] == c'0':             # <<<<<<<<<<<<<<
 *             sp = sp+1
 *         if signe(x) < 0:
 */
  while (1) {
    __pyx_t_2 = (((__pyx_v_sp[0]) == '0') != 0);
    if (!__pyx_t_2) break;

    /* "cypari/gen.pyx":1509
 *         # remove leading zeros!
 *         while sp[0] == c'0':
 *             sp = sp+1             # <<<<<<<<<<<<<<
 *         if signe(x) < 0:
 *             sp = sp-1
 */
    __pyx_v_sp = (__pyx_v_sp + 1);
  }

  /* "cypari/gen.pyx":1510
 *         while sp[0] == c'0':
 *             sp = sp+1
 *         if signe(x) < 0:             # <<<<<<<<<<<<<<
 *             sp = sp-1
 *             sp[0] = c'-'
 */
  __pyx_t_2 = ((signe(__pyx_v_x) < 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1511
 *             sp = sp+1
 *         if signe(x) < 0:
 *             sp = sp-1             # <<<<<<<<<<<<<<
 *             sp[0] = c'-'
 *         k = <object>sp
 */
    __pyx_v_sp = (__pyx_v_sp - 1);

    /* "cypari/gen.pyx":1512
 *         if signe(x) < 0:
 *             sp = sp-1
 *             sp[0] = c'-'             # <<<<<<<<<<<<<<
 *         k = <object>sp
 *         sig_free(s)
 */
    (__pyx_v_sp[0]) = '-';

    /* "cypari/gen.pyx":1510
 *         while sp[0] == c'0':
 *             sp = sp+1
 *         if signe(x) < 0:             # <<<<<<<<<<<<<<
 *             sp = sp-1
 *             sp[0] = c'-'
 */
  }

  /* "cypari/gen.pyx":1513
 *             sp = sp-1
 *             sp[0] = c'-'
 *         k = <object>sp             # <<<<<<<<<<<<<<
 *         sig_free(s)
 *         return k
 */
  __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_sp); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_k = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "cypari/gen.pyx":1514
 *             sp[0] = c'-'
 *         k = <object>sp
 *         sig_free(s)             # <<<<<<<<<<<<<<
 *         return k
 * 
 */
  sig_free(__pyx_v_s);

  /* "cypari/gen.pyx":1515
 *         k = <object>sp
 *         sig_free(s)
 *         return k             # <<<<<<<<<<<<<<
 * 
 *     def __int__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_k);
  __pyx_r = __pyx_v_k;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1460
 *         return new_gen(gcopy(self.g))
 * 
 *     def __hex__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the hexadecimal digits of self in lower case.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen.__hex__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000))*/

/* "cypari/gen.pyx":1517
 *         return k
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert ``self`` to a Python integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_93__int__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_92__int__[] = "\n        Convert ``self`` to a Python integer.\n\n        If the number is too large to fit into a Python ``int``, a\n        Python ``long`` is returned instead.\n\n        EXAMPLES::\n\n            sage: int(pari(0))\n            0\n            sage: int(pari(10))\n            10\n            sage: int(pari(-10))\n            -10\n            sage: str(int(pari(123456789012345678901234567890)))\n            '123456789012345678901234567890'\n            sage: str(int(pari(-123456789012345678901234567890)))\n            '-123456789012345678901234567890'\n            sage: int(pari(2**31-1))\n            2147483647\n            sage: int(pari(-2**31))\n            -2147483648\n            sage: int(pari(\"Pol(10)\"))\n            10\n            sage: int(pari(\"Mod(2, 7)\"))\n            2\n            sage: int(pari(2**63-1)) == 9223372036854775807\n            True\n            sage: int(pari(2**63+2)) == 9223372036854775810\n            True\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_92__int__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_93__int__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__int__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_92__int__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_92__int__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__int__", 0);

  /* "cypari/gen.pyx":1549
 *             True
 *         """
 *         return gen_to_integer(self)             # <<<<<<<<<<<<<<
 * 
 *     def __index__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6cypari_5_pari_gen_to_integer(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1517
 *         return k
 * 
 *     def __int__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert ``self`` to a Python integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.__int__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1551
 *         return gen_to_integer(self)
 * 
 *     def __index__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Coerce ``self`` (which must be a :class:`Gen` of type
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_95__index__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_94__index__[] = "\n        Coerce ``self`` (which must be a :class:`Gen` of type\n        ``t_INT``) to a Python integer.\n\n        EXAMPLES::\n \n            >>> from operator import index\n            >>> i = pari(2)\n            >>> i.__index__()\n            2\n            >>> L = [0, 1, 2, 3, 4]\n            >>> L[i]\n            2\n            >>> pari(\"2^100\").__index__() == 1267650600228229401496703205376\n            True\n            >>> pari(\"2.5\").__index__()\n            Traceback (most recent call last):\n            ...\n            TypeError: cannot coerce 2.50000000000000 (type t_REAL) to integer\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_94__index__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_95__index__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__index__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_94__index__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_94__index__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__index__", 0);

  /* "cypari/gen.pyx":1572
 *             TypeError: cannot coerce 2.50000000000000 (type t_REAL) to integer
 *         """
 *         if typ(self.g) != t_INT:             # <<<<<<<<<<<<<<
 *             msg = "cannot coerce {0!r} (type {1}) to integer".format(self, self.type())
 *             raise TypeError(msg)
 */
  __pyx_t_1 = ((typ(__pyx_v_self->__pyx_base.g) != t_INT) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":1573
 *         """
 *         if typ(self.g) != t_INT:
 *             msg = "cannot coerce {0!r} (type {1}) to integer".format(self, self.type())             # <<<<<<<<<<<<<<
 *             raise TypeError(msg)
 *         return gen_to_integer(self)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_cannot_coerce_0_r_type_1_to_inte, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1573, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_t_4};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1573, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_self), __pyx_t_4};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1573, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, ((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1573, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_msg = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "cypari/gen.pyx":1574
 *         if typ(self.g) != t_INT:
 *             msg = "cannot coerce {0!r} (type {1}) to integer".format(self, self.type())
 *             raise TypeError(msg)             # <<<<<<<<<<<<<<
 *         return gen_to_integer(self)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_v_msg); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1574, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(6, 1574, __pyx_L1_error)

    /* "cypari/gen.pyx":1572
 *             TypeError: cannot coerce 2.50000000000000 (type t_REAL) to integer
 *         """
 *         if typ(self.g) != t_INT:             # <<<<<<<<<<<<<<
 *             msg = "cannot coerce {0!r} (type {1}) to integer".format(self, self.type())
 *             raise TypeError(msg)
 */
  }

  /* "cypari/gen.pyx":1575
 *             msg = "cannot coerce {0!r} (type {1}) to integer".format(self, self.type())
 *             raise TypeError(msg)
 *         return gen_to_integer(self)             # <<<<<<<<<<<<<<
 * 
 *     def python_list_small(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6cypari_5_pari_gen_to_integer(__pyx_v_self, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1551
 *         return gen_to_integer(self)
 * 
 *     def __index__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Coerce ``self`` (which must be a :class:`Gen` of type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen.__index__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1577
 *         return gen_to_integer(self)
 * 
 *     def python_list_small(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return a Python list of the PARI gens. This object must be of type
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_97python_list_small(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_96python_list_small[] = "\n        Return a Python list of the PARI gens. This object must be of type\n        t_VECSMALL, and the resulting list contains python 'int's.\n\n        EXAMPLES::\n\n            sage: v=pari([1,2,3,10,102,10]).Vecsmall()\n            sage: w = v.python_list_small()\n            sage: w\n            [1, 2, 3, 10, 102, 10]\n            sage: type(w[0])\n            <... 'int'>\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_97python_list_small(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("python_list_small (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_96python_list_small(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_96python_list_small(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  long __pyx_t_4;
  long __pyx_t_5;
  long __pyx_t_6;
  __Pyx_RefNannySetupContext("python_list_small", 0);

  /* "cypari/gen.pyx":1592
 *         """
 *         cdef long n
 *         if typ(self.g) != t_VECSMALL:             # <<<<<<<<<<<<<<
 *             raise TypeError("Object (=%s) must be of type t_VECSMALL." % self)
 *         return [pari_longword_to_int(self.g[n+1])
 */
  __pyx_t_1 = ((typ(__pyx_v_self->__pyx_base.g) != t_VECSMALL) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":1593
 *         cdef long n
 *         if typ(self.g) != t_VECSMALL:
 *             raise TypeError("Object (=%s) must be of type t_VECSMALL." % self)             # <<<<<<<<<<<<<<
 *         return [pari_longword_to_int(self.g[n+1])
 *                 for n in range(<long>glength(self.g))]
 */
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Object_s_must_be_of_type_t_VECSM, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1593, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(6, 1593, __pyx_L1_error)

    /* "cypari/gen.pyx":1592
 *         """
 *         cdef long n
 *         if typ(self.g) != t_VECSMALL:             # <<<<<<<<<<<<<<
 *             raise TypeError("Object (=%s) must be of type t_VECSMALL." % self)
 *         return [pari_longword_to_int(self.g[n+1])
 */
  }

  /* "cypari/gen.pyx":1594
 *         if typ(self.g) != t_VECSMALL:
 *             raise TypeError("Object (=%s) must be of type t_VECSMALL." % self)
 *         return [pari_longword_to_int(self.g[n+1])             # <<<<<<<<<<<<<<
 *                 for n in range(<long>glength(self.g))]
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "cypari/gen.pyx":1595
 *             raise TypeError("Object (=%s) must be of type t_VECSMALL." % self)
 *         return [pari_longword_to_int(self.g[n+1])
 *                 for n in range(<long>glength(self.g))]             # <<<<<<<<<<<<<<
 * 
 *     def python_list(self):
 */
  __pyx_t_4 = ((long)glength(__pyx_v_self->__pyx_base.g));
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_v_n = __pyx_t_6;

    /* "cypari/gen.pyx":1594
 *         if typ(self.g) != t_VECSMALL:
 *             raise TypeError("Object (=%s) must be of type t_VECSMALL." % self)
 *         return [pari_longword_to_int(self.g[n+1])             # <<<<<<<<<<<<<<
 *                 for n in range(<long>glength(self.g))]
 * 
 */
    __pyx_t_2 = __pyx_f_6cypari_5_pari_pari_longword_to_int((__pyx_v_self->__pyx_base.g[(__pyx_v_n + 1)])); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1594, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(6, 1594, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1577
 *         return gen_to_integer(self)
 * 
 *     def python_list_small(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return a Python list of the PARI gens. This object must be of type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.python_list_small", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1597
 *                 for n in range(<long>glength(self.g))]
 * 
 *     def python_list(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return a Python list of the PARI gens. This object must be of type
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_99python_list(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_98python_list[] = "\n        Return a Python list of the PARI gens. This object must be of type\n        t_VEC or t_COL.\n\n        INPUT: None\n\n        OUTPUT:\n\n        -  ``list`` - Python list whose elements are the\n           elements of the input gen.\n\n\n        EXAMPLES::\n\n            sage: v = pari([1,2,3,10,102,10])\n            sage: w = v.python_list()\n            sage: w\n            [1, 2, 3, 10, 102, 10]\n            sage: isinstance(w[0], Gen)\n            True\n            sage: pari(\"[1,2,3]\").python_list()\n            [1, 2, 3]\n\n            sage: pari(\"[1,2,3]~\").python_list()\n            [1, 2, 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_99python_list(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("python_list (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_98python_list(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_98python_list(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  long __pyx_t_5;
  long __pyx_t_6;
  long __pyx_t_7;
  __Pyx_RefNannySetupContext("python_list", 0);

  /* "cypari/gen.pyx":1627
 *         cdef Gen t
 * 
 *         if typ(self.g) != t_VEC and typ(self.g) != t_COL:             # <<<<<<<<<<<<<<
 *             raise TypeError("Object (=%s) must be of type t_VEC or t_COL." % self)
 *         return [self[n] for n in range(<long>glength(self.g))]
 */
  __pyx_t_2 = ((typ(__pyx_v_self->__pyx_base.g) != t_VEC) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((typ(__pyx_v_self->__pyx_base.g) != t_COL) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":1628
 * 
 *         if typ(self.g) != t_VEC and typ(self.g) != t_COL:
 *             raise TypeError("Object (=%s) must be of type t_VEC or t_COL." % self)             # <<<<<<<<<<<<<<
 *         return [self[n] for n in range(<long>glength(self.g))]
 * 
 */
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Object_s_must_be_of_type_t_VEC_o, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1628, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1628, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(6, 1628, __pyx_L1_error)

    /* "cypari/gen.pyx":1627
 *         cdef Gen t
 * 
 *         if typ(self.g) != t_VEC and typ(self.g) != t_COL:             # <<<<<<<<<<<<<<
 *             raise TypeError("Object (=%s) must be of type t_VEC or t_COL." % self)
 *         return [self[n] for n in range(<long>glength(self.g))]
 */
  }

  /* "cypari/gen.pyx":1629
 *         if typ(self.g) != t_VEC and typ(self.g) != t_COL:
 *             raise TypeError("Object (=%s) must be of type t_VEC or t_COL." % self)
 *         return [self[n] for n in range(<long>glength(self.g))]             # <<<<<<<<<<<<<<
 * 
 *     def python(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = ((long)glength(__pyx_v_self->__pyx_base.g));
  __pyx_t_6 = __pyx_t_5;
  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
    __pyx_v_n = __pyx_t_7;
    __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_n, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1629, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(6, 1629, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1597
 *                 for n in range(<long>glength(self.g))]
 * 
 *     def python_list(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return a Python list of the PARI gens. This object must be of type
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.python_list", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1631
 *         return [self[n] for n in range(<long>glength(self.g))]
 * 
 *     def python(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the closest Python equivalent of the given PARI object.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_101python(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_100python[] = "\n        Return the closest Python equivalent of the given PARI object.\n\n        See :func:`~sage.libs.cypari.convert.gen_to_python` for more informations.\n\n        EXAMPLES::\n\n            sage: pari('1.2').python()\n            1.2\n            sage: pari('389/17').python()\n            Fraction(389, 17)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_101python(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("python (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_100python(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_100python(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("python", 0);

  /* "cypari/gen.pyx":1644
 *             Fraction(389, 17)
 *         """
 *         return gen_to_python(self)             # <<<<<<<<<<<<<<
 * 
 *     def __long__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_6cypari_5_pari_gen_to_python(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1644, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1631
 *         return [self[n] for n in range(<long>glength(self.g))]
 * 
 *     def python(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the closest Python equivalent of the given PARI object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.python", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1646
 *         return gen_to_python(self)
 * 
 *     def __long__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert ``self`` to a Python ``long``.
 */

/* Python wrapper */
#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_103__long__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_102__long__[] = "\n        Convert ``self`` to a Python ``long``.\n\n        EXAMPLES::\n\n            sage: long(pari(0))\n            0L\n            sage: long(pari(10))\n            10L\n            sage: long(pari(-10))\n            -10L\n            sage: long(pari(123456789012345678901234567890))\n            123456789012345678901234567890L\n            sage: long(pari(-123456789012345678901234567890))\n            -123456789012345678901234567890L\n            sage: long(pari(2**31-1))\n            2147483647L\n            sage: long(pari(-2**31))\n            -2147483648L\n            sage: long(pari(\"Pol(10)\"))\n            10L\n            sage: long(pari(\"Mod(2, 7)\"))\n            2L\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_102__long__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_103__long__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__long__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_102__long__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

#if PY_MAJOR_VERSION < 3
static PyObject *__pyx_pf_6cypari_5_pari_3Gen_102__long__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__long__", 0);

  /* "cypari/gen.pyx":1671
 *             2L
 *         """
 *         x = gen_to_integer(self)             # <<<<<<<<<<<<<<
 *         if isinstance(x, long):
 *             return x
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_gen_to_integer(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":1672
 *         """
 *         x = gen_to_integer(self)
 *         if isinstance(x, long):             # <<<<<<<<<<<<<<
 *             return x
 *         else:
 */
  __pyx_t_2 = PyLong_Check(__pyx_v_x); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "cypari/gen.pyx":1673
 *         x = gen_to_integer(self)
 *         if isinstance(x, long):
 *             return x             # <<<<<<<<<<<<<<
 *         else:
 *             return long(x)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_x);
    __pyx_r = __pyx_v_x;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1672
 *         """
 *         x = gen_to_integer(self)
 *         if isinstance(x, long):             # <<<<<<<<<<<<<<
 *             return x
 *         else:
 */
  }

  /* "cypari/gen.pyx":1675
 *             return x
 *         else:
 *             return long(x)             # <<<<<<<<<<<<<<
 * 
 *     def __float__(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyLong_Type)), __pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1675, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":1646
 *         return gen_to_python(self)
 * 
 *     def __long__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Convert ``self`` to a Python ``long``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.__long__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if PY_MAJOR_VERSION < 3)*/

/* "cypari/gen.pyx":1677
 *             return long(x)
 * 
 *     def __float__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return Python float.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_105__float__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_104__float__[] = "\n        Return Python float.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_104__float__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_105__float__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__float__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_104__float__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_104__float__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  double __pyx_v_d;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__float__", 0);

  /* "cypari/gen.pyx":1682
 *         """
 *         cdef double d
 *         sig_on()             # <<<<<<<<<<<<<<
 *         d = gtodouble(self.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1682, __pyx_L1_error)

  /* "cypari/gen.pyx":1683
 *         cdef double d
 *         sig_on()
 *         d = gtodouble(self.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return d
 */
  __pyx_v_d = gtodouble(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":1684
 *         sig_on()
 *         d = gtodouble(self.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return d
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1685
 *         d = gtodouble(self.g)
 *         sig_off()
 *         return d             # <<<<<<<<<<<<<<
 * 
 *     def __complex__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1685, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1677
 *             return long(x)
 * 
 *     def __float__(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return Python float.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.__float__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1687
 *         return d
 * 
 *     def __complex__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return ``self`` as a Python ``complex``
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_107__complex__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_106__complex__[] = "\n        Return ``self`` as a Python ``complex``\n        value.\n\n        EXAMPLES::\n\n            sage: g = pari(-1.0)**(0.2); g\n            0.809016994374947 + 0.587785252292473*I\n            sage: g.__complex__()\n            (0.8090169943749475+0.5877852522924731j)\n            sage: complex(g)\n            (0.8090169943749475+0.5877852522924731j)\n\n        ::\n\n            sage: g = pari('Mod(3,5)'); g\n            Mod(3, 5)\n            sage: complex(g)\n            Traceback (most recent call last):\n            ...\n            PariError: incorrect type in greal/gimag (t_INTMOD)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_107__complex__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__complex__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_106__complex__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_106__complex__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  double __pyx_v_re;
  double __pyx_v_im;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("__complex__", 0);

  /* "cypari/gen.pyx":1711
 *         """
 *         cdef double re, im
 *         sig_on()             # <<<<<<<<<<<<<<
 *         re = gtodouble(greal(self.g))
 *         im = gtodouble(gimag(self.g))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1711, __pyx_L1_error)

  /* "cypari/gen.pyx":1712
 *         cdef double re, im
 *         sig_on()
 *         re = gtodouble(greal(self.g))             # <<<<<<<<<<<<<<
 *         im = gtodouble(gimag(self.g))
 *         sig_off()
 */
  __pyx_v_re = gtodouble(greal(__pyx_v_self->__pyx_base.g));

  /* "cypari/gen.pyx":1713
 *         sig_on()
 *         re = gtodouble(greal(self.g))
 *         im = gtodouble(gimag(self.g))             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return complex(re, im)
 */
  __pyx_v_im = gtodouble(gimag(__pyx_v_self->__pyx_base.g));

  /* "cypari/gen.pyx":1714
 *         re = gtodouble(greal(self.g))
 *         im = gtodouble(gimag(self.g))
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return complex(re, im)
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1715
 *         im = gtodouble(gimag(self.g))
 *         sig_off()
 *         return complex(re, im)             # <<<<<<<<<<<<<<
 * 
 *     def __nonzero__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_re); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_im); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyComplex_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1687
 *         return d
 * 
 *     def __complex__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return ``self`` as a Python ``complex``
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.__complex__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1717
 *         return complex(re, im)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

/* Python wrapper */
static int __pyx_pw_6cypari_5_pari_3Gen_109__nonzero__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_6cypari_5_pari_3Gen_109__nonzero__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_108__nonzero__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6cypari_5_pari_3Gen_108__nonzero__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__nonzero__", 0);

  /* "cypari/gen.pyx":1731
 *             False
 *         """
 *         return not gequal0(self.g)             # <<<<<<<<<<<<<<
 * 
 *     def gequal(a, b):
 */
  __pyx_r = (!(gequal0(__pyx_v_self->__pyx_base.g) != 0));
  goto __pyx_L0;

  /* "cypari/gen.pyx":1717
 *         return complex(re, im)
 * 
 *     def __nonzero__(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1733
 *         return not gequal0(self.g)
 * 
 *     def gequal(a, b):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether `a` and `b` are equal using PARI's ``gequal``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_111gequal(PyObject *__pyx_v_a, PyObject *__pyx_v_b); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_110gequal[] = "\n        Check whether `a` and `b` are equal using PARI's ``gequal``.\n\n        EXAMPLES::\n\n            sage: a = pari(1); b = pari(1.0); c = pari('\"some_string\"')\n            sage: a.gequal(a)\n            True\n            sage: b.gequal(b)\n            True\n            sage: c.gequal(c)\n            True\n            sage: a.gequal(b)\n            True\n            sage: a.gequal(c)\n            False\n\n        WARNING: this relation is not transitive::\n\n            sage: a = pari('[0]'); b = pari(0); c = pari('[0,0]')\n            sage: a.gequal(b)\n            True\n            sage: b.gequal(c)\n            True\n            sage: a.gequal(c)\n            False\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_111gequal(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gequal (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_110gequal(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a), ((PyObject *)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_110gequal(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_a, PyObject *__pyx_v_b) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("gequal", 0);

  /* "cypari/gen.pyx":1761
 *             False
 *         """
 *         cdef Gen t0 = objtogen(b)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef int ret = gequal(a.g, t0.g)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_b, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":1762
 *         """
 *         cdef Gen t0 = objtogen(b)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef int ret = gequal(a.g, t0.g)
 *         sig_off()
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 1762, __pyx_L1_error)

  /* "cypari/gen.pyx":1763
 *         cdef Gen t0 = objtogen(b)
 *         sig_on()
 *         cdef int ret = gequal(a.g, t0.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return ret != 0
 */
  __pyx_v_ret = gequal(__pyx_v_a->__pyx_base.g, __pyx_v_t0->__pyx_base.g);

  /* "cypari/gen.pyx":1764
 *         sig_on()
 *         cdef int ret = gequal(a.g, t0.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return ret != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1765
 *         cdef int ret = gequal(a.g, t0.g)
 *         sig_off()
 *         return ret != 0             # <<<<<<<<<<<<<<
 * 
 *     def gequal0(a):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_ret != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 1765, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1733
 *         return not gequal0(self.g)
 * 
 *     def gequal(a, b):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether `a` and `b` are equal using PARI's ``gequal``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.gequal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1767
 *         return ret != 0
 * 
 *     def gequal0(a):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether `a` is equal to zero.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_113gequal0(PyObject *__pyx_v_a, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_112gequal0[] = "\n        Check whether `a` is equal to zero.\n\n        EXAMPLES::\n\n            sage: pari(0).gequal0()\n            True\n            sage: pari(1).gequal0()\n            False\n            sage: pari(1e-100).gequal0()\n            False\n            sage: pari(\"0.0 + 0.0*I\").gequal0()\n            True\n            sage: (pari('ffgen(3^20)')*0).gequal0()\n            True\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_113gequal0(PyObject *__pyx_v_a, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gequal0 (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_112gequal0(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_112gequal0(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_a) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("gequal0", 0);

  /* "cypari/gen.pyx":1784
 *             True
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef int ret = gequal0(a.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1784, __pyx_L1_error)

  /* "cypari/gen.pyx":1785
 *         """
 *         sig_on()
 *         cdef int ret = gequal0(a.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return ret != 0
 */
  __pyx_v_ret = gequal0(__pyx_v_a->__pyx_base.g);

  /* "cypari/gen.pyx":1786
 *         sig_on()
 *         cdef int ret = gequal0(a.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return ret != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1787
 *         cdef int ret = gequal0(a.g)
 *         sig_off()
 *         return ret != 0             # <<<<<<<<<<<<<<
 * 
 *     def gequal_long(a, long b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_ret != 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1767
 *         return ret != 0
 * 
 *     def gequal0(a):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether `a` is equal to zero.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.gequal0", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1789
 *         return ret != 0
 * 
 *     def gequal_long(a, long b):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether `a` is equal to the ``long int`` `b` using PARI's ``gequalsg``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_115gequal_long(PyObject *__pyx_v_a, PyObject *__pyx_arg_b); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_114gequal_long[] = "\n        Check whether `a` is equal to the ``long int`` `b` using PARI's ``gequalsg``.\n\n        EXAMPLES::\n\n            sage: a = pari(1); b = pari(2.0); c = pari('3*matid(3)')\n            sage: a.gequal_long(1)\n            True\n            sage: a.gequal_long(-1)\n            False\n            sage: a.gequal_long(0)\n            False\n            sage: b.gequal_long(2)\n            True\n            sage: b.gequal_long(-2)\n            False\n            sage: c.gequal_long(3)\n            True\n            sage: c.gequal_long(-3)\n            False\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_115gequal_long(PyObject *__pyx_v_a, PyObject *__pyx_arg_b) {
  long __pyx_v_b;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("gequal_long (wrapper)", 0);
  assert(__pyx_arg_b); {
    __pyx_v_b = __Pyx_PyInt_As_long(__pyx_arg_b); if (unlikely((__pyx_v_b == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1789, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.gequal_long", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_114gequal_long(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_a), ((long)__pyx_v_b));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_114gequal_long(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_a, long __pyx_v_b) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("gequal_long", 0);

  /* "cypari/gen.pyx":1811
 *             False
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef int ret = gequalsg(b, a.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1811, __pyx_L1_error)

  /* "cypari/gen.pyx":1812
 *         """
 *         sig_on()
 *         cdef int ret = gequalsg(b, a.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return ret != 0
 */
  __pyx_v_ret = gequalsg(__pyx_v_b, __pyx_v_a->__pyx_base.g);

  /* "cypari/gen.pyx":1813
 *         sig_on()
 *         cdef int ret = gequalsg(b, a.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return ret != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1814
 *         cdef int ret = gequalsg(b, a.g)
 *         sig_off()
 *         return ret != 0             # <<<<<<<<<<<<<<
 * 
 *     def isprime(self, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_ret != 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1814, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1789
 *         return ret != 0
 * 
 *     def gequal_long(a, long b):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether `a` is equal to the ``long int`` `b` using PARI's ``gequalsg``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.gequal_long", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1816
 *         return ret != 0
 * 
 *     def isprime(self, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         isprime(x, flag=0): Returns True if x is a PROVEN prime number, and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_117isprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_116isprime[] = "\n        isprime(x, flag=0): Returns True if x is a PROVEN prime number, and\n        False otherwise.\n\n        INPUT:\n\n\n        -  ``flag`` - int 0 (default): use a combination of\n           algorithms. 1: certify primality using the Pocklington-Lehmer Test.\n           2: certify primality using the APRCL test.\n\n\n        OUTPUT:\n\n\n        -  ``bool`` - True or False\n\n\n        EXAMPLES::\n\n            sage: pari(9).isprime()\n            False\n            sage: pari(17).isprime()\n            True\n            sage: n = pari(561)    # smallest Carmichael number\n            sage: n.isprime()      # not just a pseudo-primality test!\n            False\n            sage: n.isprime(1)\n            False\n            sage: n.isprime(2)\n            False\n            sage: n = pari(2**31-1)\n            sage: n.isprime(1)\n            True\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_117isprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "isprime") < 0)) __PYX_ERR(6, 1816, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1816, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("isprime", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 1816, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.isprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_116isprime(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_116isprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag) {
  GEN __pyx_v_x;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("isprime", 0);

  /* "cypari/gen.pyx":1853
 *         """
 *         cdef GEN x
 *         sig_on()             # <<<<<<<<<<<<<<
 *         x = gisprime(self.g, flag)
 *         if typ(x) != t_INT:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1853, __pyx_L1_error)

  /* "cypari/gen.pyx":1854
 *         cdef GEN x
 *         sig_on()
 *         x = gisprime(self.g, flag)             # <<<<<<<<<<<<<<
 *         if typ(x) != t_INT:
 *             # case flag=1 with prime input: x is the certificate
 */
  __pyx_v_x = gisprime(__pyx_v_self->__pyx_base.g, __pyx_v_flag);

  /* "cypari/gen.pyx":1855
 *         sig_on()
 *         x = gisprime(self.g, flag)
 *         if typ(x) != t_INT:             # <<<<<<<<<<<<<<
 *             # case flag=1 with prime input: x is the certificate
 *             return True, new_gen(x)
 */
  __pyx_t_2 = ((typ(__pyx_v_x) != t_INT) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1857
 *         if typ(x) != t_INT:
 *             # case flag=1 with prime input: x is the certificate
 *             return True, new_gen(x)             # <<<<<<<<<<<<<<
 *         else:
 *             sig_off()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_x)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1857, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(Py_True);
    __Pyx_GIVEREF(Py_True);
    PyTuple_SET_ITEM(__pyx_t_4, 0, Py_True);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1855
 *         sig_on()
 *         x = gisprime(self.g, flag)
 *         if typ(x) != t_INT:             # <<<<<<<<<<<<<<
 *             # case flag=1 with prime input: x is the certificate
 *             return True, new_gen(x)
 */
  }

  /* "cypari/gen.pyx":1859
 *             return True, new_gen(x)
 *         else:
 *             sig_off()             # <<<<<<<<<<<<<<
 *             return signe(x) != 0
 * 
 */
  /*else*/ {
    sig_off();

    /* "cypari/gen.pyx":1860
 *         else:
 *             sig_off()
 *             return signe(x) != 0             # <<<<<<<<<<<<<<
 * 
 *     def ispseudoprime(self, long flag=0):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong((signe(__pyx_v_x) != 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":1816
 *         return ret != 0
 * 
 *     def isprime(self, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         isprime(x, flag=0): Returns True if x is a PROVEN prime number, and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.isprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1862
 *             return signe(x) != 0
 * 
 *     def ispseudoprime(self, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         ispseudoprime(x, flag=0): Returns True if x is a pseudo-prime
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_119ispseudoprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_118ispseudoprime[] = "\n        ispseudoprime(x, flag=0): Returns True if x is a pseudo-prime\n        number, and False otherwise.\n\n        INPUT:\n\n\n        -  ``flag`` - int 0 (default): checks whether x is a\n           Baillie-Pomerance-Selfridge-Wagstaff pseudo prime (strong\n           Rabin-Miller pseudo prime for base 2, followed by strong Lucas test\n           for the sequence (P,-1), P smallest positive integer such that\n           `P^2 - 4` is not a square mod x). 0: checks whether x is a\n           strong Miller-Rabin pseudo prime for flag randomly chosen bases\n           (with end-matching to catch square roots of -1).\n\n\n        OUTPUT:\n\n\n        -  ``bool`` - True or False, or when flag=1, either False or a tuple\n           (True, cert) where ``cert`` is a primality certificate.\n\n\n        EXAMPLES::\n\n            sage: pari(9).ispseudoprime()\n            False\n            sage: pari(17).ispseudoprime()\n            True\n            sage: n = pari(561)     # smallest Carmichael number\n            sage: n.ispseudoprime(2)\n            False\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_119ispseudoprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ispseudoprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ispseudoprime") < 0)) __PYX_ERR(6, 1862, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 1862, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ispseudoprime", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 1862, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.ispseudoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_118ispseudoprime(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_118ispseudoprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag) {
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ispseudoprime", 0);

  /* "cypari/gen.pyx":1896
 *             False
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef pari_longword t = ispseudoprime(self.g, flag)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1896, __pyx_L1_error)

  /* "cypari/gen.pyx":1897
 *         """
 *         sig_on()
 *         cdef pari_longword t = ispseudoprime(self.g, flag)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return t != 0
 */
  __pyx_v_t = ispseudoprime(__pyx_v_self->__pyx_base.g, __pyx_v_flag);

  /* "cypari/gen.pyx":1898
 *         sig_on()
 *         cdef pari_longword t = ispseudoprime(self.g, flag)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return t != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":1899
 *         cdef pari_longword t = ispseudoprime(self.g, flag)
 *         sig_off()
 *         return t != 0             # <<<<<<<<<<<<<<
 * 
 *     def ispower(self, k=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_t != 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 1899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":1862
 *             return signe(x) != 0
 * 
 *     def ispseudoprime(self, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         ispseudoprime(x, flag=0): Returns True if x is a pseudo-prime
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.ispseudoprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1901
 *         return t != 0
 * 
 *     def ispower(self, k=None):             # <<<<<<<<<<<<<<
 *         r"""
 *         Determine whether or not self is a perfect k-th power. If k is not
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_121ispower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_120ispower[] = "\n        Determine whether or not self is a perfect k-th power. If k is not\n        specified, find the largest k so that self is a k-th power.\n\n        INPUT:\n\n\n        -  ``k`` - int (optional)\n\n\n        OUTPUT:\n\n\n        -  ``power`` - int, what power it is\n\n        -  ``g`` - what it is a power of\n\n\n        EXAMPLES::\n\n            sage: pari(9).ispower()\n            (2, 3)\n            sage: pari(17).ispower()\n            (1, 17)\n            sage: pari(17).ispower(2)\n            (False, None)\n            sage: pari(17).ispower(1)\n            (1, 17)\n            sage: pari(2).ispower()\n            (1, 2)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_121ispower(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_k = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ispower (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_k,0};
    PyObject* values[1] = {0};
    values[0] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ispower") < 0)) __PYX_ERR(6, 1901, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_k = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ispower", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 1901, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.ispower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_120ispower(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_k);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_120ispower(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_k) {
  long __pyx_v_n;
  GEN __pyx_v_x;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("ispower", 0);

  /* "cypari/gen.pyx":1937
 *         cdef Gen t0
 * 
 *         if k is None:             # <<<<<<<<<<<<<<
 *             sig_on()
 *             n = <long>gisanypower(self.g, &x)
 */
  __pyx_t_1 = (__pyx_v_k == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1938
 * 
 *         if k is None:
 *             sig_on()             # <<<<<<<<<<<<<<
 *             n = <long>gisanypower(self.g, &x)
 *             if n == 0:
 */
    __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(6, 1938, __pyx_L1_error)

    /* "cypari/gen.pyx":1939
 *         if k is None:
 *             sig_on()
 *             n = <long>gisanypower(self.g, &x)             # <<<<<<<<<<<<<<
 *             if n == 0:
 *                 sig_off()
 */
    __pyx_v_n = ((long)gisanypower(__pyx_v_self->__pyx_base.g, (&__pyx_v_x)));

    /* "cypari/gen.pyx":1940
 *             sig_on()
 *             n = <long>gisanypower(self.g, &x)
 *             if n == 0:             # <<<<<<<<<<<<<<
 *                 sig_off()
 *                 return 1, self
 */
    __pyx_t_2 = ((__pyx_v_n == 0) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":1941
 *             n = <long>gisanypower(self.g, &x)
 *             if n == 0:
 *                 sig_off()             # <<<<<<<<<<<<<<
 *                 return 1, self
 *             else:
 */
      sig_off();

      /* "cypari/gen.pyx":1942
 *             if n == 0:
 *                 sig_off()
 *                 return 1, self             # <<<<<<<<<<<<<<
 *             else:
 *                 return n, new_gen(x)
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self));
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "cypari/gen.pyx":1940
 *             sig_on()
 *             n = <long>gisanypower(self.g, &x)
 *             if n == 0:             # <<<<<<<<<<<<<<
 *                 sig_off()
 *                 return 1, self
 */
    }

    /* "cypari/gen.pyx":1944
 *                 return 1, self
 *             else:
 *                 return n, new_gen(x)             # <<<<<<<<<<<<<<
 *         else:
 *             t0 = objtogen(k)
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1944, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_x)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1944, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1944, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      goto __pyx_L0;
    }

    /* "cypari/gen.pyx":1937
 *         cdef Gen t0
 * 
 *         if k is None:             # <<<<<<<<<<<<<<
 *             sig_on()
 *             n = <long>gisanypower(self.g, &x)
 */
  }

  /* "cypari/gen.pyx":1946
 *                 return n, new_gen(x)
 *         else:
 *             t0 = objtogen(k)             # <<<<<<<<<<<<<<
 *             sig_on()
 *             n = <long>ispower(self.g, t0.g, &x)
 */
  /*else*/ {
    __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_k, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1946, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "cypari/gen.pyx":1947
 *         else:
 *             t0 = objtogen(k)
 *             sig_on()             # <<<<<<<<<<<<<<
 *             n = <long>ispower(self.g, t0.g, &x)
 *             if n == 0:
 */
    __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(6, 1947, __pyx_L1_error)

    /* "cypari/gen.pyx":1948
 *             t0 = objtogen(k)
 *             sig_on()
 *             n = <long>ispower(self.g, t0.g, &x)             # <<<<<<<<<<<<<<
 *             if n == 0:
 *                 sig_off()
 */
    __pyx_v_n = ((long)ispower(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g, (&__pyx_v_x)));

    /* "cypari/gen.pyx":1949
 *             sig_on()
 *             n = <long>ispower(self.g, t0.g, &x)
 *             if n == 0:             # <<<<<<<<<<<<<<
 *                 sig_off()
 *                 return False, None
 */
    __pyx_t_2 = ((__pyx_v_n == 0) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":1950
 *             n = <long>ispower(self.g, t0.g, &x)
 *             if n == 0:
 *                 sig_off()             # <<<<<<<<<<<<<<
 *                 return False, None
 *             else:
 */
      sig_off();

      /* "cypari/gen.pyx":1951
 *             if n == 0:
 *                 sig_off()
 *                 return False, None             # <<<<<<<<<<<<<<
 *             else:
 *                 return k, new_gen(x)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_tuple__95);
      __pyx_r = __pyx_tuple__95;
      goto __pyx_L0;

      /* "cypari/gen.pyx":1949
 *             sig_on()
 *             n = <long>ispower(self.g, t0.g, &x)
 *             if n == 0:             # <<<<<<<<<<<<<<
 *                 sig_off()
 *                 return False, None
 */
    }

    /* "cypari/gen.pyx":1953
 *                 return False, None
 *             else:
 *                 return k, new_gen(x)             # <<<<<<<<<<<<<<
 * 
 *     def isprimepower(self):
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_x)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 1953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1953, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_k);
      __Pyx_GIVEREF(__pyx_v_k);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_k);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
  }

  /* "cypari/gen.pyx":1901
 *         return t != 0
 * 
 *     def ispower(self, k=None):             # <<<<<<<<<<<<<<
 *         r"""
 *         Determine whether or not self is a perfect k-th power. If k is not
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen.ispower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1955
 *                 return k, new_gen(x)
 * 
 *     def isprimepower(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether ``self`` is a prime power (with an exponent >= 1).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_123isprimepower(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_122isprimepower[] = "\n        Check whether ``self`` is a prime power (with an exponent >= 1).\n\n        INPUT:\n\n        - ``self`` - A PARI integer\n\n        OUTPUT:\n\n        A tuple ``(k, p)`` where `k` is a Python integer and `p` a PARI\n        integer.\n\n        - If the input was a prime power, `p` is the prime and `k` the\n          power.\n        - Otherwise, `k = 0` and `p` is ``self``.\n\n        .. SEEALSO::\n\n            If you don't need a proof that `p` is prime, you can use\n            :meth:`ispseudoprimepower` instead.\n\n        EXAMPLES::\n\n            sage: pari(9).isprimepower()\n            (2, 3)\n            sage: pari(17).isprimepower()\n            (1, 17)\n            sage: pari(18).isprimepower()\n            (0, 18)\n            sage: pari(3**12345).isprimepower()\n            (12345, 3)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_123isprimepower(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("isprimepower (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_122isprimepower(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_122isprimepower(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  GEN __pyx_v_x;
  long __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("isprimepower", 0);

  /* "cypari/gen.pyx":1991
 *         cdef long n
 * 
 *         sig_on()             # <<<<<<<<<<<<<<
 *         n = <long>isprimepower(self.g, &x)
 *         if n == 0:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 1991, __pyx_L1_error)

  /* "cypari/gen.pyx":1992
 * 
 *         sig_on()
 *         n = <long>isprimepower(self.g, &x)             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             sig_off()
 */
  __pyx_v_n = ((long)isprimepower(__pyx_v_self->__pyx_base.g, (&__pyx_v_x)));

  /* "cypari/gen.pyx":1993
 *         sig_on()
 *         n = <long>isprimepower(self.g, &x)
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             return 0, self
 */
  __pyx_t_2 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":1994
 *         n = <long>isprimepower(self.g, &x)
 *         if n == 0:
 *             sig_off()             # <<<<<<<<<<<<<<
 *             return 0, self
 *         else:
 */
    sig_off();

    /* "cypari/gen.pyx":1995
 *         if n == 0:
 *             sig_off()
 *             return 0, self             # <<<<<<<<<<<<<<
 *         else:
 *             return n, new_gen(x)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1995, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":1993
 *         sig_on()
 *         n = <long>isprimepower(self.g, &x)
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             return 0, self
 */
  }

  /* "cypari/gen.pyx":1997
 *             return 0, self
 *         else:
 *             return n, new_gen(x)             # <<<<<<<<<<<<<<
 * 
 *     def ispseudoprimepower(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_x)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 1997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":1955
 *                 return k, new_gen(x)
 * 
 *     def isprimepower(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether ``self`` is a prime power (with an exponent >= 1).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen.isprimepower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":1999
 *             return n, new_gen(x)
 * 
 *     def ispseudoprimepower(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether ``self`` is the power (with an exponent >= 1) of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_125ispseudoprimepower(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_124ispseudoprimepower[] = "\n        Check whether ``self`` is the power (with an exponent >= 1) of\n        a pseudo-prime.\n\n        INPUT:\n\n        - ``self`` - A PARI integer\n\n        OUTPUT:\n\n        A tuple ``(k, p)`` where `k` is a Python integer and `p` a PARI\n        integer.\n\n        - If the input was a pseudoprime power, `p` is the pseudoprime\n          and `k` the power.\n        - Otherwise, `k = 0` and `p` is ``self``.\n\n        EXAMPLES::\n\n            sage: pari(3**12345).ispseudoprimepower()\n            (12345, 3)\n            sage: p = pari(2**1500 + 1465)         # nextprime(2^1500)\n            sage: (p**11).ispseudoprimepower()[0]  # very fast\n            11\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_125ispseudoprimepower(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ispseudoprimepower (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_124ispseudoprimepower(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_124ispseudoprimepower(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  GEN __pyx_v_x;
  long __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("ispseudoprimepower", 0);

  /* "cypari/gen.pyx":2028
 *         cdef long n
 * 
 *         sig_on()             # <<<<<<<<<<<<<<
 *         n = <long>ispseudoprimepower(self.g, &x)
 *         if n == 0:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2028, __pyx_L1_error)

  /* "cypari/gen.pyx":2029
 * 
 *         sig_on()
 *         n = <long>ispseudoprimepower(self.g, &x)             # <<<<<<<<<<<<<<
 *         if n == 0:
 *             sig_off()
 */
  __pyx_v_n = ((long)ispseudoprimepower(__pyx_v_self->__pyx_base.g, (&__pyx_v_x)));

  /* "cypari/gen.pyx":2030
 *         sig_on()
 *         n = <long>ispseudoprimepower(self.g, &x)
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             return 0, self
 */
  __pyx_t_2 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":2031
 *         n = <long>ispseudoprimepower(self.g, &x)
 *         if n == 0:
 *             sig_off()             # <<<<<<<<<<<<<<
 *             return 0, self
 *         else:
 */
    sig_off();

    /* "cypari/gen.pyx":2032
 *         if n == 0:
 *             sig_off()
 *             return 0, self             # <<<<<<<<<<<<<<
 *         else:
 *             return n, new_gen(x)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2032, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self));
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":2030
 *         sig_on()
 *         n = <long>ispseudoprimepower(self.g, &x)
 *         if n == 0:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             return 0, self
 */
  }

  /* "cypari/gen.pyx":2034
 *             return 0, self
 *         else:
 *             return n, new_gen(x)             # <<<<<<<<<<<<<<
 * 
 *     def vecmax(x):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_x)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 2034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":1999
 *             return n, new_gen(x)
 * 
 *     def ispseudoprimepower(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Check whether ``self`` is the power (with an exponent >= 1) of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen.ispseudoprimepower", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2036
 *             return n, new_gen(x)
 * 
 *     def vecmax(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the maximum of the elements of the vector/matrix `x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_127vecmax(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_126vecmax[] = "\n        Return the maximum of the elements of the vector/matrix `x`.\n\n        EXAMPLES::\n\n            sage: pari([1, '-5/3', 8.0]).vecmax()\n            8.00000000000000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_127vecmax(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecmax (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_126vecmax(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_126vecmax(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vecmax", 0);

  /* "cypari/gen.pyx":2045
 *             8.00000000000000
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(vecmax(x.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2045, __pyx_L1_error)

  /* "cypari/gen.pyx":2046
 *         """
 *         sig_on()
 *         return new_gen(vecmax(x.g))             # <<<<<<<<<<<<<<
 * 
 *     def vecmin(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(vecmax(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2046, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2036
 *             return n, new_gen(x)
 * 
 *     def vecmax(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the maximum of the elements of the vector/matrix `x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.vecmax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2048
 *         return new_gen(vecmax(x.g))
 * 
 *     def vecmin(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the minimum of the elements of the vector/matrix `x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_129vecmin(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_128vecmin[] = "\n        Return the minimum of the elements of the vector/matrix `x`.\n\n        EXAMPLES::\n\n            sage: pari([1, '-5/3', 8.0]).vecmin()\n            -5/3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_129vecmin(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("vecmin (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_128vecmin(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_128vecmin(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("vecmin", 0);

  /* "cypari/gen.pyx":2057
 *             -5/3
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(vecmin(x.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2057, __pyx_L1_error)

  /* "cypari/gen.pyx":2058
 *         """
 *         sig_on()
 *         return new_gen(vecmin(x.g))             # <<<<<<<<<<<<<<
 * 
 *     def Col(x, long n = 0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(vecmin(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2048
 *         return new_gen(vecmax(x.g))
 * 
 *     def vecmin(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the minimum of the elements of the vector/matrix `x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.vecmin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2060
 *         return new_gen(vecmin(x.g))
 * 
 *     def Col(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a column vector with minimal size `|n|`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_131Col(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_130Col[] = "\n        Transform the object `x` into a column vector with minimal size `|n|`.\n\n        INPUT:\n\n        - ``x`` -- gen\n\n        - ``n`` -- Make the column vector of minimal length `|n|`. If `n > 0`,\n          append zeros; if `n < 0`, prepend zeros.\n\n        OUTPUT:\n\n        A PARI column vector (type ``t_COL``)\n\n        EXAMPLES::\n\n            sage: pari(1.5).Col()\n            [1.50000000000000]~\n            sage: pari([1,2,3,4]).Col()\n            [1, 2, 3, 4]~\n            sage: pari('[1,2; 3,4]').Col()\n            [[1, 2], [3, 4]]~\n            sage: pari('\"CyPari\"').Col()\n            [\"C\", \"y\", \"P\", \"a\", \"r\", \"i\"]~\n            sage: pari('x + 3*x^3').Col()\n            [3, 0, 1, 0]~\n            sage: pari('x + 3*x^3 + O(x^5)').Col()\n            [1, 0, 3, 0]~\n\n        We demonstate the `n` argument::\n\n            sage: pari([1,2,3,4]).Col(2)\n            [1, 2, 3, 4]~\n            sage: pari([1,2,3,4]).Col(-2)\n            [1, 2, 3, 4]~\n            sage: pari([1,2,3,4]).Col(6)\n            [1, 2, 3, 4, 0, 0]~\n            sage: pari([1,2,3,4]).Col(-6)\n            [0, 0, 1, 2, 3, 4]~\n\n        See also :meth:`Vec` (create a row vector) for more examples\n        and :meth:`Colrev` (create a column in reversed order).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_131Col(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Col (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Col") < 0)) __PYX_ERR(6, 2060, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2060, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Col", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2060, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.Col", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_130Col(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_130Col(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Col", 0);

  /* "cypari/gen.pyx":2104
 *         and :meth:`Colrev` (create a column in reversed order).
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(_Vec_append(gtocol(x.g), gen_0, n))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2104, __pyx_L1_error)

  /* "cypari/gen.pyx":2105
 *         """
 *         sig_on()
 *         return new_gen(_Vec_append(gtocol(x.g), gen_0, n))             # <<<<<<<<<<<<<<
 * 
 *     def Colrev(x, long n = 0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_f_6cypari_5_pari__Vec_append(gtocol(__pyx_v_x->__pyx_base.g), gen_0, __pyx_v_n))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2060
 *         return new_gen(vecmin(x.g))
 * 
 *     def Col(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a column vector with minimal size `|n|`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.Col", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2107
 *         return new_gen(_Vec_append(gtocol(x.g), gen_0, n))
 * 
 *     def Colrev(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a column vector with minimal size `|n|`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_133Colrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_132Colrev[] = "\n        Transform the object `x` into a column vector with minimal size `|n|`.\n        The order of the resulting vector is reversed compared to :meth:`Col`.\n\n        INPUT:\n\n        - ``x`` -- gen\n\n        - ``n`` -- Make the vector of minimal length `|n|`. If `n > 0`,\n          prepend zeros; if `n < 0`, append zeros.\n\n        OUTPUT:\n\n        A PARI column vector (type ``t_COL``)\n\n        EXAMPLES::\n\n            sage: pari(1.5).Colrev()\n            [1.50000000000000]~\n            sage: pari([1,2,3,4]).Colrev()\n            [4, 3, 2, 1]~\n            sage: pari('[1,2; 3,4]').Colrev()\n            [[3, 4], [1, 2]]~\n            sage: pari('x + 3*x^3').Colrev()\n            [0, 1, 0, 3]~\n\n        We demonstate the `n` argument::\n\n            sage: pari([1,2,3,4]).Colrev(2)\n            [4, 3, 2, 1]~\n            sage: pari([1,2,3,4]).Colrev(-2)\n            [4, 3, 2, 1]~\n            sage: pari([1,2,3,4]).Colrev(6)\n            [0, 0, 4, 3, 2, 1]~\n            sage: pari([1,2,3,4]).Colrev(-6)\n            [4, 3, 2, 1, 0, 0]~\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_133Colrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Colrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Colrev") < 0)) __PYX_ERR(6, 2107, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2107, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Colrev", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2107, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.Colrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_132Colrev(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_132Colrev(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n) {
  GEN __pyx_v_v;
  GEN __pyx_v_L;
  GEN __pyx_v_R;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("Colrev", 0);

  /* "cypari/gen.pyx":2145
 *             [4, 3, 2, 1, 0, 0]~
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         # Create a non-reversed column vector
 *         cdef GEN v = _Vec_append(gtocol(x.g), gen_0, n)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2145, __pyx_L1_error)

  /* "cypari/gen.pyx":2147
 *         sig_on()
 *         # Create a non-reversed column vector
 *         cdef GEN v = _Vec_append(gtocol(x.g), gen_0, n)             # <<<<<<<<<<<<<<
 *         # Reverse it in-place
 *         cdef GEN L = v + 1
 */
  __pyx_v_v = __pyx_f_6cypari_5_pari__Vec_append(gtocol(__pyx_v_x->__pyx_base.g), gen_0, __pyx_v_n);

  /* "cypari/gen.pyx":2149
 *         cdef GEN v = _Vec_append(gtocol(x.g), gen_0, n)
 *         # Reverse it in-place
 *         cdef GEN L = v + 1             # <<<<<<<<<<<<<<
 *         cdef GEN R = v + (lg(v)-1)
 *         cdef pari_longword t
 */
  __pyx_v_L = (__pyx_v_v + 1);

  /* "cypari/gen.pyx":2150
 *         # Reverse it in-place
 *         cdef GEN L = v + 1
 *         cdef GEN R = v + (lg(v)-1)             # <<<<<<<<<<<<<<
 *         cdef pari_longword t
 *         while (L < R):
 */
  __pyx_v_R = (__pyx_v_v + (lg(__pyx_v_v) - 1));

  /* "cypari/gen.pyx":2152
 *         cdef GEN R = v + (lg(v)-1)
 *         cdef pari_longword t
 *         while (L < R):             # <<<<<<<<<<<<<<
 *             t = L[0]
 *             L[0] = R[0]
 */
  while (1) {
    __pyx_t_2 = ((__pyx_v_L < __pyx_v_R) != 0);
    if (!__pyx_t_2) break;

    /* "cypari/gen.pyx":2153
 *         cdef pari_longword t
 *         while (L < R):
 *             t = L[0]             # <<<<<<<<<<<<<<
 *             L[0] = R[0]
 *             R[0] = t
 */
    __pyx_v_t = (__pyx_v_L[0]);

    /* "cypari/gen.pyx":2154
 *         while (L < R):
 *             t = L[0]
 *             L[0] = R[0]             # <<<<<<<<<<<<<<
 *             R[0] = t
 *             L += 1
 */
    (__pyx_v_L[0]) = (__pyx_v_R[0]);

    /* "cypari/gen.pyx":2155
 *             t = L[0]
 *             L[0] = R[0]
 *             R[0] = t             # <<<<<<<<<<<<<<
 *             L += 1
 *             R -= 1
 */
    (__pyx_v_R[0]) = __pyx_v_t;

    /* "cypari/gen.pyx":2156
 *             L[0] = R[0]
 *             R[0] = t
 *             L += 1             # <<<<<<<<<<<<<<
 *             R -= 1
 *         return new_gen(v)
 */
    __pyx_v_L = (__pyx_v_L + 1);

    /* "cypari/gen.pyx":2157
 *             R[0] = t
 *             L += 1
 *             R -= 1             # <<<<<<<<<<<<<<
 *         return new_gen(v)
 * 
 */
    __pyx_v_R = (__pyx_v_R - 1);
  }

  /* "cypari/gen.pyx":2158
 *             L += 1
 *             R -= 1
 *         return new_gen(v)             # <<<<<<<<<<<<<<
 * 
 *     def Ser(f, v=-1, long precision=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_v)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2158, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2107
 *         return new_gen(_Vec_append(gtocol(x.g), gen_0, n))
 * 
 *     def Colrev(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a column vector with minimal size `|n|`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.Colrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2160
 *         return new_gen(v)
 * 
 *     def Ser(f, v=-1, long precision=-1):             # <<<<<<<<<<<<<<
 *         """
 *         Return a power series or Laurent series in the variable `v`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_135Ser(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_134Ser[] = "\n        Return a power series or Laurent series in the variable `v`\n        constructed from the object `f`.\n\n        INPUT:\n\n        - ``f`` -- PARI gen\n\n        - ``v`` -- PARI variable (default: `x`)\n\n        - ``precision`` -- the desired relative precision (default:\n          the value returned by ``pari.get_series_precision()``).\n          This is the absolute precision minus the `v`-adic valuation.\n\n        OUTPUT:\n\n        - PARI object of type ``t_SER``\n\n        The series is constructed from `f` in the following way:\n\n        - If `f` is a scalar, a constant power series is returned.\n\n        - If `f` is a polynomial, it is converted into a power series\n          in the obvious way.\n\n        - If `f` is a rational function, it will be expanded in a\n          Laurent series around `v = 0`.\n\n        - If `f` is a vector, its coefficients become the coefficients\n          of the power series, starting from the constant term.  This\n          is the convention used by the function ``Polrev()``, and the\n          reverse of that used by ``Pol()``.\n\n        .. warning::\n\n           This function will not transform objects containing\n           variables of higher priority than `v`.\n\n        EXAMPLES::\n\n            sage: pari(2).Ser()\n            2 + O(x^16)\n            sage: pari('Mod(0, 7)').Ser()\n            Mod(0, 7)*x^15 + O(x^16)\n\n            sage: x = pari([1, 2, 3, 4, 5])\n            sage: x.Ser()\n            1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + O(x^16)\n            sage: f = x.Ser('v'); print(f)\n            1 + 2*v + 3*v^2 + 4*v^3 + 5*v^4 + O(v^16)\n            sage: pari(1)/f\n            1 - 2*v + v^2 + 6*v^5 - 17*v^6 + 16*v^7 - 5*v^8 + 36*v^10 - 132*v^11 + 181*v^12 - 110*v^13 + 25*v^14 + 216*v^15 + O(v^16)\n\n            sage: pari('x^5').Ser(precision=20)\n            x^5 + O(x^25)\n            sage: pari('1/x').Ser(precision=1)\n            x^-1 + O(x^0)\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_135Ser(PyObject *__pyx_v_f, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_v = 0;
  long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Ser (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_precision,0};
    PyObject* values[2] = {0,0};
    values[0] = ((PyObject *)__pyx_int_neg_1);
    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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Ser") < 0)) __PYX_ERR(6, 2160, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    __pyx_v_v = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_precision == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2160, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Ser", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2160, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.Ser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_134Ser(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_f), __pyx_v_v, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_134Ser(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_f, PyObject *__pyx_v_v, long __pyx_v_precision) {
  long __pyx_v_vn;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("Ser", 0);

  /* "cypari/gen.pyx":2220
 * 
 *         """
 *         if precision < 0:             # <<<<<<<<<<<<<<
 *             precision = <long>precdl  # Global PARI series precision
 *         sig_on()
 */
  __pyx_t_1 = ((__pyx_v_precision < 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":2221
 *         """
 *         if precision < 0:
 *             precision = <long>precdl  # Global PARI series precision             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef long vn = <long>get_var(v)
 */
    __pyx_v_precision = ((long)precdl);

    /* "cypari/gen.pyx":2220
 * 
 *         """
 *         if precision < 0:             # <<<<<<<<<<<<<<
 *             precision = <long>precdl  # Global PARI series precision
 *         sig_on()
 */
  }

  /* "cypari/gen.pyx":2222
 *         if precision < 0:
 *             precision = <long>precdl  # Global PARI series precision
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long vn = <long>get_var(v)
 *         if typ(f.g) == t_VEC:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 2222, __pyx_L1_error)

  /* "cypari/gen.pyx":2223
 *             precision = <long>precdl  # Global PARI series precision
 *         sig_on()
 *         cdef long vn = <long>get_var(v)             # <<<<<<<<<<<<<<
 *         if typ(f.g) == t_VEC:
 *             # The precision flag is ignored for vectors, so we first
 */
  __pyx_t_3 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_3 == ((long)-2L))) __PYX_ERR(6, 2223, __pyx_L1_error)
  __pyx_v_vn = ((long)__pyx_t_3);

  /* "cypari/gen.pyx":2224
 *         sig_on()
 *         cdef long vn = <long>get_var(v)
 *         if typ(f.g) == t_VEC:             # <<<<<<<<<<<<<<
 *             # The precision flag is ignored for vectors, so we first
 *             # convert the vector to a polynomial.
 */
  __pyx_t_1 = ((typ(__pyx_v_f->__pyx_base.g) == t_VEC) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":2227
 *             # The precision flag is ignored for vectors, so we first
 *             # convert the vector to a polynomial.
 *             return new_gen(gtoser(gtopolyrev(f.g, vn), vn, precision))             # <<<<<<<<<<<<<<
 *         else:
 *             return new_gen(gtoser(f.g, vn, precision))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gtoser(gtopolyrev(__pyx_v_f->__pyx_base.g, __pyx_v_vn), __pyx_v_vn, __pyx_v_precision))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":2224
 *         sig_on()
 *         cdef long vn = <long>get_var(v)
 *         if typ(f.g) == t_VEC:             # <<<<<<<<<<<<<<
 *             # The precision flag is ignored for vectors, so we first
 *             # convert the vector to a polynomial.
 */
  }

  /* "cypari/gen.pyx":2229
 *             return new_gen(gtoser(gtopolyrev(f.g, vn), vn, precision))
 *         else:
 *             return new_gen(gtoser(f.g, vn, precision))             # <<<<<<<<<<<<<<
 * 
 *     def Str(self):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gtoser(__pyx_v_f->__pyx_base.g, __pyx_v_vn, __pyx_v_precision))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2229, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":2160
 *         return new_gen(v)
 * 
 *     def Ser(f, v=-1, long precision=-1):             # <<<<<<<<<<<<<<
 *         """
 *         Return a power series or Laurent series in the variable `v`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.Ser", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2231
 *             return new_gen(gtoser(f.g, vn, precision))
 * 
 *     def Str(self):             # <<<<<<<<<<<<<<
 *         """
 *         Str(self): Return the print representation of self as a PARI
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_137Str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_136Str[] = "\n        Str(self): Return the print representation of self as a PARI\n        object.\n\n        INPUT:\n\n\n        -  ``self`` - gen\n\n\n        OUTPUT:\n\n\n        -  ``gen`` - a PARI Gen of type t_STR, i.e., a PARI\n           string\n\n\n        EXAMPLES::\n\n            sage: pari([1,2,['abc',1]]).Str()\n            \"[1, 2, [abc, 1]]\"\n            sage: pari([1,1, 1.54]).Str()\n            \"[1, 1, 1.54000000000000]\"\n            sage: pari(1).Str()       # 1 is automatically converted to string rep\n            \"1\"\n            sage: x = pari('x')       # PARI variable \"x\"\n            sage: x.Str()             # is converted to string rep.\n            \"x\"\n            sage: x.Str().type()\n            't_STR'\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_137Str(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Str (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_136Str(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_136Str(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  char *__pyx_v_c;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Str", 0);

  /* "cypari/gen.pyx":2264
 *         """
 *         cdef char* c
 *         sig_on()             # <<<<<<<<<<<<<<
 *         # Use sig_block(), which is needed because GENtostr() uses
 *         # malloc(), which is dangerous inside sig_on()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2264, __pyx_L1_error)

  /* "cypari/gen.pyx":2267
 *         # Use sig_block(), which is needed because GENtostr() uses
 *         # malloc(), which is dangerous inside sig_on()
 *         sig_block()             # <<<<<<<<<<<<<<
 *         c = GENtostr(self.g)
 *         sig_unblock()
 */
  sig_block();

  /* "cypari/gen.pyx":2268
 *         # malloc(), which is dangerous inside sig_on()
 *         sig_block()
 *         c = GENtostr(self.g)             # <<<<<<<<<<<<<<
 *         sig_unblock()
 *         v = new_gen(strtoGENstr(c))
 */
  __pyx_v_c = GENtostr(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":2269
 *         sig_block()
 *         c = GENtostr(self.g)
 *         sig_unblock()             # <<<<<<<<<<<<<<
 *         v = new_gen(strtoGENstr(c))
 *         pari_free(c)
 */
  sig_unblock();

  /* "cypari/gen.pyx":2270
 *         c = GENtostr(self.g)
 *         sig_unblock()
 *         v = new_gen(strtoGENstr(c))             # <<<<<<<<<<<<<<
 *         pari_free(c)
 *         return v
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(strtoGENstr(__pyx_v_c))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_v = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/gen.pyx":2271
 *         sig_unblock()
 *         v = new_gen(strtoGENstr(c))
 *         pari_free(c)             # <<<<<<<<<<<<<<
 *         return v
 * 
 */
  pari_free(__pyx_v_c);

  /* "cypari/gen.pyx":2272
 *         v = new_gen(strtoGENstr(c))
 *         pari_free(c)
 *         return v             # <<<<<<<<<<<<<<
 * 
 *     def Strexpand(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_v));
  __pyx_r = ((PyObject *)__pyx_v_v);
  goto __pyx_L0;

  /* "cypari/gen.pyx":2231
 *             return new_gen(gtoser(f.g, vn, precision))
 * 
 *     def Str(self):             # <<<<<<<<<<<<<<
 *         """
 *         Str(self): Return the print representation of self as a PARI
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.Str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2274
 *         return v
 * 
 *     def Strexpand(x):             # <<<<<<<<<<<<<<
 *         """
 *         Concatenate the entries of the vector `x` into a single string,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_139Strexpand(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_138Strexpand[] = "\n        Concatenate the entries of the vector `x` into a single string,\n        then perform tilde expansion and environment variable expansion\n        similar to shells.\n\n        INPUT:\n\n        - ``x`` -- PARI gen. Either a vector or an element which is then\n          treated like `[x]`.\n\n        OUTPUT:\n\n        - PARI string (type ``t_STR``)\n\n        EXAMPLES::\n\n            sage: pari('\"~/subdir\"').Strexpand()     # random\n            \"/home/johndoe/subdir\"\n            sage: pari('\"$SHELL\"').Strexpand()  # random\n            \"/bin/bash\"\n\n        TESTS::\n\n            sage: a = pari('\"$HOME\"')\n            sage: a.Strexpand() != a\n            True\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_139Strexpand(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Strexpand (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_138Strexpand(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_138Strexpand(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("Strexpand", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_x);

  /* "cypari/gen.pyx":2302
 *             True
 *         """
 *         if typ(x.g) != t_VEC:             # <<<<<<<<<<<<<<
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()
 */
  __pyx_t_1 = ((typ(__pyx_v_x->__pyx_base.g) != t_VEC) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":2303
 *         """
 *         if typ(x.g) != t_VEC:
 *             x = list_of_Gens_to_Gen([x])             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(Strexpand(x.g))
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_x));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
    PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_x));
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_list_of_Gens_to_Gen(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_x, ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "cypari/gen.pyx":2302
 *             True
 *         """
 *         if typ(x.g) != t_VEC:             # <<<<<<<<<<<<<<
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()
 */
  }

  /* "cypari/gen.pyx":2304
 *         if typ(x.g) != t_VEC:
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(Strexpand(x.g))
 * 
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(6, 2304, __pyx_L1_error)

  /* "cypari/gen.pyx":2305
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()
 *         return new_gen(Strexpand(x.g))             # <<<<<<<<<<<<<<
 * 
 *     def Strtex(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(Strexpand(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2274
 *         return v
 * 
 *     def Strexpand(x):             # <<<<<<<<<<<<<<
 *         """
 *         Concatenate the entries of the vector `x` into a single string,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.Strexpand", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2307
 *         return new_gen(Strexpand(x.g))
 * 
 *     def Strtex(x):             # <<<<<<<<<<<<<<
 *         r"""
 *         Strtex(x): Translates the vector x of PARI gens to TeX format and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_141Strtex(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_140Strtex[] = "\n        Strtex(x): Translates the vector x of PARI gens to TeX format and\n        returns the resulting concatenated strings as a PARI t_STR.\n\n        INPUT:\n\n        - ``x`` -- PARI gen. Either a vector or an element which is then\n          treated like `[x]`.\n\n        OUTPUT:\n\n        - PARI string (type ``t_STR``)\n\n        EXAMPLES::\n\n            sage: v=pari('x^2')\n            sage: v.Strtex()\n            \"x^2\"\n            sage: v=pari(['1/x^2','x'])\n            sage: v.Strtex()\n            \"\\\\frac{1}{x^2}x\"\n            sage: v=pari(['1 + 1/x + 1/(y+1)','x-1'])\n            sage: v.Strtex()\n            \"\\\\frac{ \\\\left(y\\n + 2\\\\right) \\\\*x\\n + \\\\left(y\\n + 1\\\\right) }{ \\\\left(y\\n + 1\\\\right) \\\\*x}x\\n - 1\"\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_141Strtex(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Strtex (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_140Strtex(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_140Strtex(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("Strtex", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_x);

  /* "cypari/gen.pyx":2333
 *             "\\frac{ \\left(y\n + 2\\right) \\*x\n + \\left(y\n + 1\\right) }{ \\left(y\n + 1\\right) \\*x}x\n - 1"
 *         """
 *         if typ(x.g) != t_VEC:             # <<<<<<<<<<<<<<
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()
 */
  __pyx_t_1 = ((typ(__pyx_v_x->__pyx_base.g) != t_VEC) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":2334
 *         """
 *         if typ(x.g) != t_VEC:
 *             x = list_of_Gens_to_Gen([x])             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(Strtex(x.g))
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_v_x));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_x));
    PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_x));
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_list_of_Gens_to_Gen(((PyObject*)__pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_x, ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "cypari/gen.pyx":2333
 *             "\\frac{ \\left(y\n + 2\\right) \\*x\n + \\left(y\n + 1\\right) }{ \\left(y\n + 1\\right) \\*x}x\n - 1"
 *         """
 *         if typ(x.g) != t_VEC:             # <<<<<<<<<<<<<<
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()
 */
  }

  /* "cypari/gen.pyx":2335
 *         if typ(x.g) != t_VEC:
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(Strtex(x.g))
 * 
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(6, 2335, __pyx_L1_error)

  /* "cypari/gen.pyx":2336
 *             x = list_of_Gens_to_Gen([x])
 *         sig_on()
 *         return new_gen(Strtex(x.g))             # <<<<<<<<<<<<<<
 * 
 *     def Vec(x, long n = 0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(Strtex(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2307
 *         return new_gen(Strexpand(x.g))
 * 
 *     def Strtex(x):             # <<<<<<<<<<<<<<
 *         r"""
 *         Strtex(x): Translates the vector x of PARI gens to TeX format and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.Strtex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2338
 *         return new_gen(Strtex(x.g))
 * 
 *     def Vec(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a vector with minimal size `|n|`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_143Vec(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_142Vec[] = "\n        Transform the object `x` into a vector with minimal size `|n|`.\n\n        INPUT:\n\n        - ``x`` -- gen\n\n        - ``n`` -- Make the vector of minimal length `|n|`. If `n > 0`,\n          append zeros; if `n < 0`, prepend zeros.\n\n        OUTPUT:\n\n        A PARI vector (type ``t_VEC``)\n\n        EXAMPLES::\n\n            sage: pari(1).Vec()\n            [1]\n            sage: pari('x^3').Vec()\n            [1, 0, 0, 0]\n            sage: pari('x^3 + 3*x - 2').Vec()\n            [1, 0, 3, -2]\n            sage: pari([1,2,3]).Vec()\n            [1, 2, 3]\n            sage: pari('[1, 2; 3, 4]').Vec()\n            [[1, 3]~, [2, 4]~]\n            sage: pari('\"CyPari\"').Vec()\n            [\"C\", \"y\", \"P\", \"a\", \"r\", \"i\"]\n            sage: pari('2*x^2 + 3*x^3 + O(x^5)').Vec()\n            [2, 3, 0]\n            sage: pari('2*x^-2 + 3*x^3 + O(x^5)').Vec()\n            [2, 0, 0, 0, 0, 3, 0]\n\n        Note the different term ordering for polynomials and series::\n\n            sage: pari('1 + x + 3*x^3 + O(x^5)').Vec()\n            [1, 1, 0, 3, 0]\n            sage: pari('1 + x + 3*x^3').Vec()\n            [3, 0, 1, 1]\n\n        We demonstate the `n` argument::\n\n            sage: pari([1,2,3,4]).Vec(2)\n            [1, 2, 3, 4]\n            sage: pari([1,2,3,4]).Vec(-2)\n            [1, 2, 3, 4]\n            sage: pari([1,2,3,4]).Vec(6)\n            [1, 2, 3, 4, 0, 0]\n            sage: pari([1,2,3,4]).Vec(-6)\n            [0, 0, 1, 2, 3, 4]\n\n        See also :meth:`Col` (create a column vector) and :meth:`Vecrev`\n        (create a vector in reversed order).\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_143Vec(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vec (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vec") < 0)) __PYX_ERR(6, 2338, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2338, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vec", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2338, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.Vec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_142Vec(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_142Vec(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Vec", 0);

  /* "cypari/gen.pyx":2393
 *         (create a vector in reversed order).
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(_Vec_append(gtovec(x.g), gen_0, n))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2393, __pyx_L1_error)

  /* "cypari/gen.pyx":2394
 *         """
 *         sig_on()
 *         return new_gen(_Vec_append(gtovec(x.g), gen_0, n))             # <<<<<<<<<<<<<<
 * 
 *     def Vecrev(x, long n = 0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_f_6cypari_5_pari__Vec_append(gtovec(__pyx_v_x->__pyx_base.g), gen_0, __pyx_v_n))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2394, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2338
 *         return new_gen(Strtex(x.g))
 * 
 *     def Vec(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a vector with minimal size `|n|`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.Vec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2396
 *         return new_gen(_Vec_append(gtovec(x.g), gen_0, n))
 * 
 *     def Vecrev(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a vector with minimal size `|n|`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_145Vecrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_144Vecrev[] = "\n        Transform the object `x` into a vector with minimal size `|n|`.\n        The order of the resulting vector is reversed compared to :meth:`Vec`.\n\n        INPUT:\n\n        - ``x`` -- gen\n\n        - ``n`` -- Make the vector of minimal length `|n|`. If `n > 0`,\n          prepend zeros; if `n < 0`, append zeros.\n\n        OUTPUT:\n\n        A PARI vector (type ``t_VEC``)\n\n        EXAMPLES::\n\n            sage: pari(1).Vecrev()\n            [1]\n            sage: pari('x^3').Vecrev()\n            [0, 0, 0, 1]\n            sage: pari('x^3 + 3*x - 2').Vecrev()\n            [-2, 3, 0, 1]\n            sage: pari([1, 2, 3]).Vecrev()\n            [3, 2, 1]\n            sage: pari('Col([1, 2, 3])').Vecrev()\n            [3, 2, 1]\n            sage: pari('[1, 2; 3, 4]').Vecrev()\n            [[2, 4]~, [1, 3]~]\n            sage: pari('\"CyPari\"').Vecrev()\n            [\"i\", \"r\", \"a\", \"P\", \"y\", \"C\"]\n\n        We demonstate the `n` argument::\n\n            sage: pari([1,2,3,4]).Vecrev(2)\n            [4, 3, 2, 1]\n            sage: pari([1,2,3,4]).Vecrev(-2)\n            [4, 3, 2, 1]\n            sage: pari([1,2,3,4]).Vecrev(6)\n            [0, 0, 4, 3, 2, 1]\n            sage: pari([1,2,3,4]).Vecrev(-6)\n            [4, 3, 2, 1, 0, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_145Vecrev(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vecrev (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vecrev") < 0)) __PYX_ERR(6, 2396, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2396, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vecrev", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2396, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.Vecrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_144Vecrev(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_144Vecrev(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Vecrev", 0);

  /* "cypari/gen.pyx":2440
 *             [4, 3, 2, 1, 0, 0]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(_Vec_append(gtovecrev(x.g), gen_0, -n))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2440, __pyx_L1_error)

  /* "cypari/gen.pyx":2441
 *         """
 *         sig_on()
 *         return new_gen(_Vec_append(gtovecrev(x.g), gen_0, -n))             # <<<<<<<<<<<<<<
 * 
 *     def Vecsmall(x, long n = 0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_f_6cypari_5_pari__Vec_append(gtovecrev(__pyx_v_x->__pyx_base.g), gen_0, (-__pyx_v_n)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2396
 *         return new_gen(_Vec_append(gtovec(x.g), gen_0, n))
 * 
 *     def Vecrev(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a vector with minimal size `|n|`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.Vecrev", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2443
 *         return new_gen(_Vec_append(gtovecrev(x.g), gen_0, -n))
 * 
 *     def Vecsmall(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a ``t_VECSMALL`` with minimal size `|n|`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_147Vecsmall(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_146Vecsmall[] = "\n        Transform the object `x` into a ``t_VECSMALL`` with minimal size `|n|`.\n\n        INPUT:\n\n        - ``x`` -- gen\n\n        - ``n`` -- Make the vector of minimal length `|n|`. If `n > 0`,\n          append zeros; if `n < 0`, prepend zeros.\n\n        OUTPUT:\n\n        A PARI vector of small integers (type ``t_VECSMALL``)\n\n        EXAMPLES::\n\n            sage: pari([1,2,3]).Vecsmall()\n            Vecsmall([1, 2, 3])\n            sage: pari('\"CyPari\"').Vecsmall()\n            Vecsmall([67, 121, 80, 97, 114, 105])\n            sage: pari(1234).Vecsmall()\n            Vecsmall([1234])\n            sage: pari('x^2 + 2*x + 3').Vecsmall()\n            Vecsmall([1, 2, 3])\n\n        We demonstate the `n` argument::\n\n            sage: pari([1,2,3]).Vecsmall(2)\n            Vecsmall([1, 2, 3])\n            sage: pari([1,2,3]).Vecsmall(-2)\n            Vecsmall([1, 2, 3])\n            sage: pari([1,2,3]).Vecsmall(6)\n            Vecsmall([1, 2, 3, 0, 0, 0])\n            sage: pari([1,2,3]).Vecsmall(-6)\n            Vecsmall([0, 0, 0, 1, 2, 3])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_147Vecsmall(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Vecsmall (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Vecsmall") < 0)) __PYX_ERR(6, 2443, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2443, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Vecsmall", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2443, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.Vecsmall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_146Vecsmall(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_146Vecsmall(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("Vecsmall", 0);

  /* "cypari/gen.pyx":2480
 *             Vecsmall([0, 0, 0, 1, 2, 3])
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(_Vec_append(gtovecsmall(x.g), <GEN>0, n))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2480, __pyx_L1_error)

  /* "cypari/gen.pyx":2481
 *         """
 *         sig_on()
 *         return new_gen(_Vec_append(gtovecsmall(x.g), <GEN>0, n))             # <<<<<<<<<<<<<<
 * 
 *     def bittest(x, long n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_f_6cypari_5_pari__Vec_append(gtovecsmall(__pyx_v_x->__pyx_base.g), ((GEN)0), __pyx_v_n))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2443
 *         return new_gen(_Vec_append(gtovecrev(x.g), gen_0, -n))
 * 
 *     def Vecsmall(x, long n = 0):             # <<<<<<<<<<<<<<
 *         """
 *         Transform the object `x` into a ``t_VECSMALL`` with minimal size `|n|`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.Vecsmall", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2483
 *         return new_gen(_Vec_append(gtovecsmall(x.g), <GEN>0, n))
 * 
 *     def bittest(x, long n):             # <<<<<<<<<<<<<<
 *         """
 *         bittest(x, long n): Returns bit number n (coefficient of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_149bittest(PyObject *__pyx_v_x, PyObject *__pyx_arg_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_148bittest[] = "\n        bittest(x, long n): Returns bit number n (coefficient of\n        `2^n` in binary) of the integer x. Negative numbers behave\n        as if modulo a big power of 2.\n\n        INPUT:\n\n\n        -  ``x`` - Gen (pari integer)\n\n\n        OUTPUT:\n\n\n        -  ``bool`` - a Python bool\n\n\n        EXAMPLES::\n\n            sage: x = pari(6)\n            sage: x.bittest(0)\n            False\n            sage: x.bittest(1)\n            True\n            sage: x.bittest(2)\n            True\n            sage: x.bittest(3)\n            False\n            sage: pari(-3).bittest(0)\n            True\n            sage: pari(-3).bittest(1)\n            False\n            sage: [pari(-3).bittest(n) for n in range(10)]\n            [True, False, True, True, True, True, True, True, True, True]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_149bittest(PyObject *__pyx_v_x, PyObject *__pyx_arg_n) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bittest (wrapper)", 0);
  assert(__pyx_arg_n); {
    __pyx_v_n = __Pyx_PyInt_As_long(__pyx_arg_n); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2483, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.bittest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_148bittest(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), ((long)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_148bittest(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n) {
  long __pyx_v_b;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("bittest", 0);

  /* "cypari/gen.pyx":2519
 *             [True, False, True, True, True, True, True, True, True, True]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long b = <long>bittest(x.g, n)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2519, __pyx_L1_error)

  /* "cypari/gen.pyx":2520
 *         """
 *         sig_on()
 *         cdef long b = <long>bittest(x.g, n)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return b != 0
 */
  __pyx_v_b = ((long)bittest(__pyx_v_x->__pyx_base.g, __pyx_v_n));

  /* "cypari/gen.pyx":2521
 *         sig_on()
 *         cdef long b = <long>bittest(x.g, n)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return b != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":2522
 *         cdef long b = <long>bittest(x.g, n)
 *         sig_off()
 *         return b != 0             # <<<<<<<<<<<<<<
 * 
 *     lift_centered = Gen_base.centerlift
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_b != 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2522, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2483
 *         return new_gen(_Vec_append(gtovecsmall(x.g), <GEN>0, n))
 * 
 *     def bittest(x, long n):             # <<<<<<<<<<<<<<
 *         """
 *         bittest(x, long n): Returns bit number n (coefficient of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bittest", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2526
 *     lift_centered = Gen_base.centerlift
 * 
 *     def padicprime(x):             # <<<<<<<<<<<<<<
 *         """
 *         The uniformizer of the p-adic ring this element lies in, as a t_INT.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_151padicprime(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_150padicprime[] = "\n        The uniformizer of the p-adic ring this element lies in, as a t_INT.\n\n        INPUT:\n\n        - ``x`` - gen, of type t_PADIC\n\n        OUTPUT:\n\n        - ``p`` - gen, of type t_INT\n\n        EXAMPLES::\n\n            sage: y = pari('11^-10 + 5*11^-7 + 11^-6 + O(11)')\n            sage: y.padicprime()\n            11\n            sage: y.padicprime().type()\n            't_INT'\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_151padicprime(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("padicprime (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_150padicprime(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_150padicprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("padicprime", 0);

  /* "cypari/gen.pyx":2546
 *             't_INT'
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gel(x.g, 2))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2546, __pyx_L1_error)

  /* "cypari/gen.pyx":2547
 *         """
 *         sig_on()
 *         return new_gen(gel(x.g, 2))             # <<<<<<<<<<<<<<
 * 
 *     def precision(x, long n=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gel(__pyx_v_x->__pyx_base.g, 2))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2526
 *     lift_centered = Gen_base.centerlift
 * 
 *     def padicprime(x):             # <<<<<<<<<<<<<<
 *         """
 *         The uniformizer of the p-adic ring this element lies in, as a t_INT.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.padicprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2549
 *         return new_gen(gel(x.g, 2))
 * 
 *     def precision(x, long n=-1):             # <<<<<<<<<<<<<<
 *         """
 *         Change the precision of `x` to be `n`, where `n` is an integer.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_153precision(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_152precision[] = "\n        Change the precision of `x` to be `n`, where `n` is an integer.\n        If `n` is omitted, output the real precision of `x`.\n\n        INPUT:\n\n        -  ``x`` - gen\n\n        -  ``n`` - (optional) int\n\n        OUTPUT: gen\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_153precision(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("precision (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "precision") < 0)) __PYX_ERR(6, 2549, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2549, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("precision", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2549, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_152precision(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_152precision(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("precision", 0);

  /* "cypari/gen.pyx":2562
 *         OUTPUT: gen
 *         """
 *         if n <= 0:             # <<<<<<<<<<<<<<
 *             return <long>precision(x.g)
 *         sig_on()
 */
  __pyx_t_1 = ((__pyx_v_n <= 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":2563
 *         """
 *         if n <= 0:
 *             return <long>precision(x.g)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(precision0(x.g, n))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_long(((long)precision(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":2562
 *         OUTPUT: gen
 *         """
 *         if n <= 0:             # <<<<<<<<<<<<<<
 *             return <long>precision(x.g)
 *         sig_on()
 */
  }

  /* "cypari/gen.pyx":2564
 *         if n <= 0:
 *             return <long>precision(x.g)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(precision0(x.g, n))
 * 
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(6, 2564, __pyx_L1_error)

  /* "cypari/gen.pyx":2565
 *             return <long>precision(x.g)
 *         sig_on()
 *         return new_gen(precision0(x.g, n))             # <<<<<<<<<<<<<<
 * 
 *     def round(x, estimate=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(precision0(__pyx_v_x->__pyx_base.g, __pyx_v_n))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2549
 *         return new_gen(gel(x.g, 2))
 * 
 *     def precision(x, long n=-1):             # <<<<<<<<<<<<<<
 *         """
 *         Change the precision of `x` to be `n`, where `n` is an integer.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.precision", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2567
 *         return new_gen(precision0(x.g, n))
 * 
 *     def round(x, estimate=False):             # <<<<<<<<<<<<<<
 *         """
 *         round(x,estimate=False): If x is a real number, returns x rounded
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_155round(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_154round[] = "\n        round(x,estimate=False): If x is a real number, returns x rounded\n        to the nearest integer (rounding up). If the optional argument\n        estimate is True, also returns the binary exponent e of the\n        difference between the original and the rounded value (the\n        \"fractional part\") (this is the integer ceiling of log_2(error)).\n\n        When x is a general PARI object, this function returns the result\n        of rounding every coefficient at every level of PARI object. Note\n        that this is different than what the truncate function does (see\n        the example below).\n\n        One use of round is to get exact results after a long approximate\n        computation, when theory tells you that the coefficients must be\n        integers.\n\n        INPUT:\n\n\n        -  ``x`` - gen\n\n        -  ``estimate`` - (optional) bool, False by default\n\n\n        OUTPUT:\n\n        - if estimate is False, return a single gen.\n\n        - if estimate is True, return rounded version of x and error\n          estimate in bits, both as gens.\n\n        EXAMPLES::\n\n            sage: pari('1.5').round()\n            2\n            sage: pari('1.5').round(True)\n            (2, -1) # Py3\n            (2, -1L) # Py2\n            sage: pari('1.5 + 2.1*I').round()\n            2 + 2*I\n            sage: pari('1.0001').round(True)\n            (1, -14) # Py3\n            (1, -14L) # Py2\n            sage: pari('(2.4*x^2 - 1.7)/x').round()\n            (2*x^2 - 2)/x\n            sage: pari('(2.4*x^2 - 1.7)/x').truncate()\n            2.40000000000000*x\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_155round(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_estimate = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("round (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_estimate,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_estimate);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "round") < 0)) __PYX_ERR(6, 2567, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_estimate = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("round", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2567, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_154round(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_estimate);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_154round(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_estimate) {
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_e;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_y = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("round", 0);

  /* "cypari/gen.pyx":2619
 *         cdef pari_longword e
 *         cdef Gen y
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if not estimate:
 *             return new_gen(ground(x.g))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2619, __pyx_L1_error)

  /* "cypari/gen.pyx":2620
 *         cdef Gen y
 *         sig_on()
 *         if not estimate:             # <<<<<<<<<<<<<<
 *             return new_gen(ground(x.g))
 *         y = new_gen(grndtoi(x.g, &e))
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_estimate); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 2620, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cypari/gen.pyx":2621
 *         sig_on()
 *         if not estimate:
 *             return new_gen(ground(x.g))             # <<<<<<<<<<<<<<
 *         y = new_gen(grndtoi(x.g, &e))
 *         return y, e
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(ground(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2621, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":2620
 *         cdef Gen y
 *         sig_on()
 *         if not estimate:             # <<<<<<<<<<<<<<
 *             return new_gen(ground(x.g))
 *         y = new_gen(grndtoi(x.g, &e))
 */
  }

  /* "cypari/gen.pyx":2622
 *         if not estimate:
 *             return new_gen(ground(x.g))
 *         y = new_gen(grndtoi(x.g, &e))             # <<<<<<<<<<<<<<
 *         return y, e
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(grndtoi(__pyx_v_x->__pyx_base.g, (&__pyx_v_e)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_y = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cypari/gen.pyx":2623
 *             return new_gen(ground(x.g))
 *         y = new_gen(grndtoi(x.g, &e))
 *         return y, e             # <<<<<<<<<<<<<<
 * 
 *     def sizeword(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 2623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_y));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_y));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_y));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2567
 *         return new_gen(precision0(x.g, n))
 * 
 *     def round(x, estimate=False):             # <<<<<<<<<<<<<<
 *         """
 *         round(x,estimate=False): If x is a real number, returns x rounded
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen.round", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2625
 *         return y, e
 * 
 *     def sizeword(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the total number of machine words occupied by the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_157sizeword(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_156sizeword[] = "\n        Return the total number of machine words occupied by the\n        complete tree of the object x.  A machine word is 32 or\n        64 bits, depending on the computer.\n\n        INPUT:\n\n        -  ``x`` - gen\n\n        OUTPUT: int (a Python int)\n\n        EXAMPLES::\n\n            sage: pari('0').sizeword()\n            2\n            sage: pari('1').sizeword()\n            3\n            sage: pari('1000000').sizeword()\n            3\n            sage: pari('10^100').sizeword()\n            13      # 32-bit\n            8       # 64-bit\n            sage: pari(1.0).sizeword()\n            4       # 32-bit\n            3       # 64-bit\n            sage: pari('x').sizeword()\n            7\n            sage: pari('x^20').sizeword()\n            26\n            sage: pari('[x, I]').sizeword()\n            16\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_157sizeword(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sizeword (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_156sizeword(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_156sizeword(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("sizeword", 0);

  /* "cypari/gen.pyx":2658
 *             16
 *         """
 *         return <long>gsizeword(x.g)             # <<<<<<<<<<<<<<
 * 
 *     def sizebyte(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(((long)gsizeword(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2658, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2625
 *         return y, e
 * 
 *     def sizeword(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the total number of machine words occupied by the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.sizeword", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2660
 *         return <long>gsizeword(x.g)
 * 
 *     def sizebyte(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the total number of bytes occupied by the complete tree
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_159sizebyte(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_158sizebyte[] = "\n        Return the total number of bytes occupied by the complete tree\n        of the object x. Note that this number depends on whether the\n        computer is 32-bit or 64-bit.\n\n        INPUT:\n\n        -  ``x`` - gen\n\n        OUTPUT: int (a Python int)\n\n        EXAMPLE::\n\n            sage: pari('1').sizebyte()\n            12           # 32-bit\n            24           # 64-bit\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_159sizebyte(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sizebyte (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_158sizebyte(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_158sizebyte(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("sizebyte", 0);

  /* "cypari/gen.pyx":2678
 *             24           # 64-bit
 *         """
 *         return <long>gsizebyte(x.g)             # <<<<<<<<<<<<<<
 * 
 *     def truncate(x, estimate=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(((long)gsizebyte(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2678, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2660
 *         return <long>gsizeword(x.g)
 * 
 *     def sizebyte(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the total number of bytes occupied by the complete tree
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.sizebyte", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2680
 *         return <long>gsizebyte(x.g)
 * 
 *     def truncate(x, estimate=False):             # <<<<<<<<<<<<<<
 *         """
 *         truncate(x,estimate=False): Return the truncation of x. If estimate
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_161truncate(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_160truncate[] = "\n        truncate(x,estimate=False): Return the truncation of x. If estimate\n        is True, also return the number of error bits.\n\n        When x is in the real numbers, this means that the part after the\n        decimal point is chopped away, e is the binary exponent of the\n        difference between the original and truncated value (the\n        \"fractional part\"). If x is a rational function, the result is the\n        integer part (Euclidean quotient of numerator by denominator) and\n        if requested the error estimate is 0.\n\n        When truncate is applied to a power series (in X), it transforms it\n        into a polynomial or a rational function with denominator a power\n        of X, by chopping away the `O(X^k)`. Similarly, when\n        applied to a p-adic number, it transforms it into an integer or a\n        rational number by chopping away the `O(p^k)`.\n\n        INPUT:\n\n\n        -  ``x`` - gen\n\n        -  ``estimate`` - (optional) bool, which is False by\n           default\n\n\n        OUTPUT:\n\n        - if estimate is False, return a single gen.\n\n        - if estimate is True, return rounded version of x and error\n          estimate in bits, both as gens.\n\n        EXAMPLES::\n\n            sage: pari('(x^2+1)/x').round()\n            (x^2 + 1)/x\n            sage: pari('(x^2+1)/x').truncate()\n            x\n            sage: pari('1.043').truncate()\n            1\n            sage: pari('1.043').truncate(True)\n            (1, -5)\n            sage: pari('1.6').truncate()\n            1\n            sage: pari('1.6').round()\n            2\n            sage: pari('1/3 + 2 + 3^2 + O(3^3)').truncate()\n            34/3\n            sage: pari('sin(x+O(x^10))').truncate()\n            1/362880*x^9 - 1/5040*x^7 + 1/120*x^5 - 1/6*x^3 + x\n            sage: pari('sin(x+O(x^10))').round()   # each coefficient has abs < 1\n            x + O(x^10)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_161truncate(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_estimate = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("truncate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_estimate,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_estimate);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "truncate") < 0)) __PYX_ERR(6, 2680, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_estimate = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("truncate", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2680, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.truncate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_160truncate(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_estimate);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_160truncate(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_estimate) {
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_e;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_y = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("truncate", 0);

  /* "cypari/gen.pyx":2737
 *         cdef pari_longword e
 *         cdef Gen y
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if not estimate:
 *             return new_gen(gtrunc(x.g))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2737, __pyx_L1_error)

  /* "cypari/gen.pyx":2738
 *         cdef Gen y
 *         sig_on()
 *         if not estimate:             # <<<<<<<<<<<<<<
 *             return new_gen(gtrunc(x.g))
 *         y = new_gen(gcvtoi(x.g, &e))
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_estimate); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 2738, __pyx_L1_error)
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "cypari/gen.pyx":2739
 *         sig_on()
 *         if not estimate:
 *             return new_gen(gtrunc(x.g))             # <<<<<<<<<<<<<<
 *         y = new_gen(gcvtoi(x.g, &e))
 *         return y, pari_longword_to_int(e)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gtrunc(__pyx_v_x->__pyx_base.g))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2739, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":2738
 *         cdef Gen y
 *         sig_on()
 *         if not estimate:             # <<<<<<<<<<<<<<
 *             return new_gen(gtrunc(x.g))
 *         y = new_gen(gcvtoi(x.g, &e))
 */
  }

  /* "cypari/gen.pyx":2740
 *         if not estimate:
 *             return new_gen(gtrunc(x.g))
 *         y = new_gen(gcvtoi(x.g, &e))             # <<<<<<<<<<<<<<
 *         return y, pari_longword_to_int(e)
 * 
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gcvtoi(__pyx_v_x->__pyx_base.g, (&__pyx_v_e)))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_y = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cypari/gen.pyx":2741
 *             return new_gen(gtrunc(x.g))
 *         y = new_gen(gcvtoi(x.g, &e))
 *         return y, pari_longword_to_int(e)             # <<<<<<<<<<<<<<
 * 
 *     def _valp(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __pyx_f_6cypari_5_pari_pari_longword_to_int(__pyx_v_e); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 2741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_y));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_y));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_y));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2680
 *         return <long>gsizebyte(x.g)
 * 
 *     def truncate(x, estimate=False):             # <<<<<<<<<<<<<<
 *         """
 *         truncate(x,estimate=False): Return the truncation of x. If estimate
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen.truncate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2743
 *         return y, pari_longword_to_int(e)
 * 
 *     def _valp(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the valuation of x where x is a p-adic number (t_PADIC)
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_163_valp(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_162_valp[] = "\n        Return the valuation of x where x is a p-adic number (t_PADIC)\n        or a Laurent series (t_SER).  If x is a different type, this\n        will give a bogus number.\n\n        EXAMPLES::\n\n            sage: pari('1/x^2 + O(x^10)')._valp()\n            -2\n            sage: pari('O(x^10)')._valp()\n            10\n            sage: pari('(1145234796 + O(3^10))/771966234')._valp()\n            -2\n            sage: pari('O(2^10)')._valp()\n            10\n            sage: pari('x')._valp()   # random\n            -35184372088832\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_163_valp(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_valp (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_162_valp(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_162_valp(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("_valp", 0);

  /* "cypari/gen.pyx":2763
 *         """
 *         # This is a simple macro, so we don't need sig_on()
 *         return valp(x.g)             # <<<<<<<<<<<<<<
 * 
 *     def bernfrac(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(valp(__pyx_v_x->__pyx_base.g)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2763, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2743
 *         return y, pari_longword_to_int(e)
 * 
 *     def _valp(x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the valuation of x where x is a p-adic number (t_PADIC)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen._valp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2765
 *         return valp(x.g)
 * 
 *     def bernfrac(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         The Bernoulli number `B_x`, where `B_0 = 1`,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_165bernfrac(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_164bernfrac[] = "\n        The Bernoulli number `B_x`, where `B_0 = 1`,\n        `B_1 = -1/2`, `B_2 = 1/6,\\ldots,` expressed as a\n        rational number. The argument `x` should be of type\n        integer.\n\n        EXAMPLES::\n\n            sage: pari(18).bernfrac()\n            43867/798\n            sage: [pari(n).bernfrac() for n in range(10)]\n            [1, -1/2, 1/6, 0, -1/30, 0, 1/42, 0, -1/30, 0]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_165bernfrac(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bernfrac (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_164bernfrac(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_164bernfrac(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bernfrac", 0);

  /* "cypari/gen.pyx":2779
 *             [1, -1/2, 1/6, 0, -1/30, 0, 1/42, 0, -1/30, 0]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bernfrac(self))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2779, __pyx_L1_error)

  /* "cypari/gen.pyx":2780
 *         """
 *         sig_on()
 *         return new_gen(bernfrac(self))             # <<<<<<<<<<<<<<
 * 
 *     def bernreal(self, unsigned long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_As_long(((PyObject *)__pyx_v_self)); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2780, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bernfrac(__pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2765
 *         return valp(x.g)
 * 
 *     def bernfrac(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         The Bernoulli number `B_x`, where `B_0 = 1`,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.bernfrac", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2782
 *         return new_gen(bernfrac(self))
 * 
 *     def bernreal(self, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         r"""
 *         The Bernoulli number `B_x`, as for the function bernfrac,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_167bernreal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_166bernreal[] = "\n        The Bernoulli number `B_x`, as for the function bernfrac,\n        but `B_x` is returned as a real number (with the current\n        precision).\n\n        EXAMPLES::\n\n            sage: pari(18).bernreal()\n            54.9711779448622\n            sage: old_prec = pari.set_real_precision(192)\n            sage: pari(18).bernreal(precision=192)\n            54.97117794486215538847117794486215538847117794486215538...\n            sage: pari.set_real_precision(old_prec)\n            192\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_167bernreal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bernreal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bernreal") < 0)) __PYX_ERR(6, 2782, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2782, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bernreal", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2782, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.bernreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_166bernreal(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_166bernreal(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, unsigned long __pyx_v_precision) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("bernreal", 0);

  /* "cypari/gen.pyx":2798
 *             192
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bernreal(self, prec_bits_to_words(precision)))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2798, __pyx_L1_error)

  /* "cypari/gen.pyx":2799
 *         """
 *         sig_on()
 *         return new_gen(bernreal(self, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 * 
 *     def besselk(Gen nu, x, flag=None, unsigned long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_As_long(((PyObject *)__pyx_v_self)); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2799, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bernreal(__pyx_t_2, __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2782
 *         return new_gen(bernfrac(self))
 * 
 *     def bernreal(self, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         r"""
 *         The Bernoulli number `B_x`, as for the function bernfrac,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.bernreal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2801
 *         return new_gen(bernreal(self, prec_bits_to_words(precision)))
 * 
 *     def besselk(Gen nu, x, flag=None, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         nu.besselk(x): K-Bessel function (modified Bessel function
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_169besselk(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_168besselk[] = "\n        nu.besselk(x): K-Bessel function (modified Bessel function\n        of the second kind) of index nu, which can be complex, and argument\n        x.\n\n        If `nu` or `x` is an exact argument, it is first\n        converted to a real or complex number using the optional parameter\n        precision (in bits). If the arguments are inexact (e.g. real), the\n        smallest of their precisions is used in the computation, and the\n        parameter precision is ignored.\n\n        INPUT:\n\n\n        -  ``nu`` - a complex number\n\n        -  ``x`` - real number (positive or negative)\n\n        EXAMPLES::\n\n            sage: pari(complex(2, 1)).besselk(3)\n            0.0455907718407551 + 0.0289192946582081*I\n\n        ::\n\n            sage: pari(complex(2, 1)).besselk(-3)\n            -4.34870874986752 - 5.38744882697109*I\n\n        ::\n\n            sage: pari(complex(2, 1)).besselk(300)\n            3.74224603319728 E-132 + 2.49071062641525 E-134*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_169besselk(PyObject *__pyx_v_nu, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  CYTHON_UNUSED PyObject *__pyx_v_flag = 0;
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("besselk (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((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  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "besselk") < 0)) __PYX_ERR(6, 2801, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_x = values[0];
    __pyx_v_flag = values[1];
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[2]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2801, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("besselk", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2801, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.besselk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_168besselk(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nu), __pyx_v_x, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_168besselk(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_nu, PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_flag, unsigned long __pyx_v_precision) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("besselk", 0);

  /* "cypari/gen.pyx":2835
 *             3.74224603319728 E-132 + 2.49071062641525 E-134*I
 *         """
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(kbessel(nu.g, t0.g, prec_bits_to_words(precision)))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2835, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":2836
 *         """
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(kbessel(nu.g, t0.g, prec_bits_to_words(precision)))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 2836, __pyx_L1_error)

  /* "cypari/gen.pyx":2837
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 *         return new_gen(kbessel(nu.g, t0.g, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 * 
 *     def eint1(x, long n=0, unsigned long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(kbessel(__pyx_v_nu->__pyx_base.g, __pyx_v_t0->__pyx_base.g, __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2801
 *         return new_gen(bernreal(self, prec_bits_to_words(precision)))
 * 
 *     def besselk(Gen nu, x, flag=None, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         nu.besselk(x): K-Bessel function (modified Bessel function
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.besselk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2839
 *         return new_gen(kbessel(nu.g, t0.g, prec_bits_to_words(precision)))
 * 
 *     def eint1(x, long n=0, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         r"""
 *         x.eint1(n): exponential integral E1(x):
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_171eint1(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_170eint1[] = "\n        x.eint1(n): exponential integral E1(x):\n\n        .. MATH::\n\n                         \\int_{x}^{\\infty} \\frac{e^{-t}}{t} dt\n\n\n        If n is present, output the vector [eint1(x), eint1(2\\*x), ...,\n        eint1(n\\*x)]. This is faster than repeatedly calling eint1(i\\*x).\n\n        If `x` is an exact argument, it is first converted to a\n        real or complex number using the optional parameter precision (in\n        bits). If `x` is inexact (e.g. real), its own precision is\n        used in the computation, and the parameter precision is ignored.\n\n        REFERENCE:\n\n        - See page 262, Prop 5.6.12, of Cohen's book \"A Course in\n          Computational Algebraic Number Theory\".\n\n        EXAMPLES:\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_171eint1(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eint1 (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_precision,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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "eint1") < 0)) __PYX_ERR(6, 2839, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2839, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)0);
    }
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2839, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("eint1", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2839, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.eint1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_170eint1(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_170eint1(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_n, unsigned long __pyx_v_precision) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("eint1", 0);

  /* "cypari/gen.pyx":2863
 *         EXAMPLES:
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if n <= 0:
 *             return new_gen(eint1(x.g, prec_bits_to_words(precision)))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2863, __pyx_L1_error)

  /* "cypari/gen.pyx":2864
 *         """
 *         sig_on()
 *         if n <= 0:             # <<<<<<<<<<<<<<
 *             return new_gen(eint1(x.g, prec_bits_to_words(precision)))
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_n <= 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":2865
 *         sig_on()
 *         if n <= 0:
 *             return new_gen(eint1(x.g, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 *         else:
 *             return new_gen(veceint1(x.g, stoi(n), prec_bits_to_words(precision)))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(eint1(__pyx_v_x->__pyx_base.g, __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2865, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":2864
 *         """
 *         sig_on()
 *         if n <= 0:             # <<<<<<<<<<<<<<
 *             return new_gen(eint1(x.g, prec_bits_to_words(precision)))
 *         else:
 */
  }

  /* "cypari/gen.pyx":2867
 *             return new_gen(eint1(x.g, prec_bits_to_words(precision)))
 *         else:
 *             return new_gen(veceint1(x.g, stoi(n), prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 * 
 *     log_gamma = Gen_base.lngamma
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(veceint1(__pyx_v_x->__pyx_base.g, stoi(__pyx_v_n), __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2867, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":2839
 *         return new_gen(kbessel(nu.g, t0.g, prec_bits_to_words(precision)))
 * 
 *     def eint1(x, long n=0, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         r"""
 *         x.eint1(n): exponential integral E1(x):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.eint1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2871
 *     log_gamma = Gen_base.lngamma
 * 
 *     def polylog(x, long m, long flag=0, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         x.polylog(m,flag=0): m-th polylogarithm of x. flag is optional, and
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_173polylog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_172polylog[] = "\n        x.polylog(m,flag=0): m-th polylogarithm of x. flag is optional, and\n        can be 0: default, 1: D_m -modified m-th polylog of x, 2:\n        D_m-modified m-th polylog of x, 3: P_m-modified m-th polylog of\n        x.\n\n        If `x` is an exact argument, it is first converted to a\n        real or complex number using the optional parameter precision (in\n        bits). If `x` is inexact (e.g. real), its own precision is\n        used in the computation, and the parameter precision is ignored.\n\n        TODO: Add more explanation, copied from the PARI manual.\n\n        EXAMPLES::\n\n            sage: pari(10).polylog(3)\n            5.64181141475134 - 8.32820207698027*I\n            sage: pari(10).polylog(3,0)\n            5.64181141475134 - 8.32820207698027*I\n            sage: pari(10).polylog(3,1)\n            0.523778453502411\n            sage: pari(10).polylog(3,2)\n            -0.400459056163451\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_173polylog(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_m;
  long __pyx_v_flag;
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polylog (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_m,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polylog") < 0)) __PYX_ERR(6, 2871, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_m = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_m == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2871, __pyx_L3_error)
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2871, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[2]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[2]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2871, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polylog", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2871, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.polylog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_172polylog(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_m, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_172polylog(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, long __pyx_v_m, long __pyx_v_flag, unsigned long __pyx_v_precision) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("polylog", 0);

  /* "cypari/gen.pyx":2896
 *             -0.400459056163451
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(polylog0(m, x.g, flag, prec_bits_to_words(precision)))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2896, __pyx_L1_error)

  /* "cypari/gen.pyx":2897
 *         """
 *         sig_on()
 *         return new_gen(polylog0(m, x.g, flag, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 * 
 *     def sqrtn(x, n, unsigned long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(polylog0(__pyx_v_m, __pyx_v_x->__pyx_base.g, __pyx_v_flag, __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2897, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2871
 *     log_gamma = Gen_base.lngamma
 * 
 *     def polylog(x, long m, long flag=0, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         x.polylog(m,flag=0): m-th polylogarithm of x. flag is optional, and
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.polylog", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2899
 *         return new_gen(polylog0(m, x.g, flag, prec_bits_to_words(precision)))
 * 
 *     def sqrtn(x, n, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         r"""
 *         x.sqrtn(n): return the principal branch of the n-th root of x,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_175sqrtn(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_174sqrtn[] = "\n        x.sqrtn(n): return the principal branch of the n-th root of x,\n        i.e., the one such that\n        `\\arg(\\sqrt(x)) \\in ]-\\pi/n, \\pi/n]`. Also returns a second\n        argument which is a suitable root of unity allowing one to recover\n        all the other roots. If it was not possible to find such a number,\n        then this second return value is 0. If the argument is present and\n        no square root exists, return 0 instead of raising an error.\n\n        If `x` is an exact argument, it is first converted to a\n        real or complex number using the optional parameter precision (in\n        bits). If `x` is inexact (e.g. real), its own precision is\n        used in the computation, and the parameter precision is ignored.\n\n        .. NOTE::\n\n           intmods (modulo a prime) and `p`-adic numbers are\n           allowed as arguments.\n\n        INPUT:\n\n\n        -  ``x`` - gen\n\n        -  ``n`` - integer\n\n\n        OUTPUT:\n\n\n        -  ``gen`` - principal n-th root of x\n\n        -  ``gen`` - root of unity z that gives the other\n           roots\n\n\n        EXAMPLES::\n\n            sage: s, z = pari(2).sqrtn(5)\n            sage: z\n            0.309016994374947 + 0.951056516295154*I\n            sage: s\n            1.14869835499704\n            sage: s**5\n            2.00000000000000\n            sage: z**5\n            1.00000000000000 - 2.710505431 E-20*I       # 32-bit\n            1.00000000000000 - 2.71050543121376 E-20*I  # 64-bit\n            sage: (s*z)**5\n            2.00000000000000 + 0.E-19*I\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_175sqrtn(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_n = 0;
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sqrtn (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_precision,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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sqrtn") < 0)) __PYX_ERR(6, 2899, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = values[0];
    if (values[1]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2899, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("sqrtn", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2899, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.sqrtn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_174sqrtn(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_n, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_174sqrtn(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_n, unsigned long __pyx_v_precision) {
  GEN __pyx_v_zetan;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_ans = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("sqrtn", 0);

  /* "cypari/gen.pyx":2952
 *         """
 *         cdef GEN zetan
 *         cdef Gen t0 = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         ans = new_gen_noclear(gsqrtn(x.g, t0.g, &zetan, prec_bits_to_words(precision)))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2952, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":2953
 *         cdef GEN zetan
 *         cdef Gen t0 = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         ans = new_gen_noclear(gsqrtn(x.g, t0.g, &zetan, prec_bits_to_words(precision)))
 *         return ans, new_gen(zetan)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 2953, __pyx_L1_error)

  /* "cypari/gen.pyx":2954
 *         cdef Gen t0 = objtogen(n)
 *         sig_on()
 *         ans = new_gen_noclear(gsqrtn(x.g, t0.g, &zetan, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 *         return ans, new_gen(zetan)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(gsqrtn(__pyx_v_x->__pyx_base.g, __pyx_v_t0->__pyx_base.g, (&__pyx_v_zetan), __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ans = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":2955
 *         sig_on()
 *         ans = new_gen_noclear(gsqrtn(x.g, t0.g, &zetan, prec_bits_to_words(precision)))
 *         return ans, new_gen(zetan)             # <<<<<<<<<<<<<<
 * 
 *     def ffprimroot(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_zetan)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 2955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_ans));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ans));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ans));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2899
 *         return new_gen(polylog0(m, x.g, flag, prec_bits_to_words(precision)))
 * 
 *     def sqrtn(x, n, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         r"""
 *         x.sqrtn(n): return the principal branch of the n-th root of x,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.sqrtn", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_ans);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2957
 *         return ans, new_gen(zetan)
 * 
 *     def ffprimroot(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return a primitive root of the multiplicative group of the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_177ffprimroot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_176ffprimroot[] = "\n        Return a primitive root of the multiplicative group of the\n        definition field of the given finite field element.\n\n        INPUT:\n\n        - ``self`` -- a PARI finite field element (``FFELT``)\n\n        OUTPUT:\n\n        - A generator of the multiplicative group of the finite field\n          generated by ``self``.\n\n        EXAMPLES::\n\n            sage: b = pari(9).ffgen().ffprimroot()\n            sage: b  # random\n            a + 1\n            sage: b.fforder()\n            8\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_177ffprimroot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ffprimroot (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_176ffprimroot(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_176ffprimroot(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ffprimroot", 0);

  /* "cypari/gen.pyx":2979
 *             8
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(ffprimroot(self.g, NULL))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2979, __pyx_L1_error)

  /* "cypari/gen.pyx":2980
 *         """
 *         sig_on()
 *         return new_gen(ffprimroot(self.g, NULL))             # <<<<<<<<<<<<<<
 * 
 *     def fibonacci(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(ffprimroot(__pyx_v_self->__pyx_base.g, NULL))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 2980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2957
 *         return ans, new_gen(zetan)
 * 
 *     def ffprimroot(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return a primitive root of the multiplicative group of the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.ffprimroot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2982
 *         return new_gen(ffprimroot(self.g, NULL))
 * 
 *     def fibonacci(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the Fibonacci number of index x.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_179fibonacci(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_178fibonacci[] = "\n        Return the Fibonacci number of index x.\n\n        EXAMPLES::\n\n            sage: pari(18).fibonacci()\n            2584\n            sage: [pari(n).fibonacci() for n in range(10)]\n            [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_179fibonacci(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fibonacci (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_178fibonacci(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_178fibonacci(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("fibonacci", 0);

  /* "cypari/gen.pyx":2993
 *             [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(fibo(self))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 2993, __pyx_L1_error)

  /* "cypari/gen.pyx":2994
 *         """
 *         sig_on()
 *         return new_gen(fibo(self))             # <<<<<<<<<<<<<<
 * 
 *     def issquare(x, find_root=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_As_long(((PyObject *)__pyx_v_self)); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 2994, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(fibo(__pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 2994, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":2982
 *         return new_gen(ffprimroot(self.g, NULL))
 * 
 *     def fibonacci(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the Fibonacci number of index x.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.fibonacci", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":2996
 *         return new_gen(fibo(self))
 * 
 *     def issquare(x, find_root=False):             # <<<<<<<<<<<<<<
 *         """
 *         issquare(x,n): ``True`` if x is a square, ``False`` if not. If
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_181issquare(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_180issquare[] = "\n        issquare(x,n): ``True`` if x is a square, ``False`` if not. If\n        ``find_root`` is given, also returns the exact square root.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_181issquare(PyObject *__pyx_v_x, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_find_root = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("issquare (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_find_root,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_find_root);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "issquare") < 0)) __PYX_ERR(6, 2996, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_find_root = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("issquare", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 2996, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.issquare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_180issquare(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x), __pyx_v_find_root);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_180issquare(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x, PyObject *__pyx_v_find_root) {
  GEN __pyx_v_G;
  long __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("issquare", 0);

  /* "cypari/gen.pyx":3004
 *         cdef long t
 *         cdef Gen g
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if find_root:
 *             t = <long>itos(gissquareall(x.g, &G))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3004, __pyx_L1_error)

  /* "cypari/gen.pyx":3005
 *         cdef Gen g
 *         sig_on()
 *         if find_root:             # <<<<<<<<<<<<<<
 *             t = <long>itos(gissquareall(x.g, &G))
 *             if t:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_find_root); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 3005, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3006
 *         sig_on()
 *         if find_root:
 *             t = <long>itos(gissquareall(x.g, &G))             # <<<<<<<<<<<<<<
 *             if t:
 *                 return True, new_gen(G)
 */
    __pyx_v_t = ((long)itos(gissquareall(__pyx_v_x->__pyx_base.g, (&__pyx_v_G))));

    /* "cypari/gen.pyx":3007
 *         if find_root:
 *             t = <long>itos(gissquareall(x.g, &G))
 *             if t:             # <<<<<<<<<<<<<<
 *                 return True, new_gen(G)
 *             else:
 */
    __pyx_t_2 = (__pyx_v_t != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":3008
 *             t = <long>itos(gissquareall(x.g, &G))
 *             if t:
 *                 return True, new_gen(G)             # <<<<<<<<<<<<<<
 *             else:
 *                 clear_stack()
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_G)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3008, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(Py_True);
      __Pyx_GIVEREF(Py_True);
      PyTuple_SET_ITEM(__pyx_t_4, 0, Py_True);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "cypari/gen.pyx":3007
 *         if find_root:
 *             t = <long>itos(gissquareall(x.g, &G))
 *             if t:             # <<<<<<<<<<<<<<
 *                 return True, new_gen(G)
 *             else:
 */
    }

    /* "cypari/gen.pyx":3010
 *                 return True, new_gen(G)
 *             else:
 *                 clear_stack()             # <<<<<<<<<<<<<<
 *                 return False, None
 *         else:
 */
    /*else*/ {
      __pyx_f_6cypari_5_pari_clear_stack();

      /* "cypari/gen.pyx":3011
 *             else:
 *                 clear_stack()
 *                 return False, None             # <<<<<<<<<<<<<<
 *         else:
 *             t = <long>itos(gissquare(x.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_tuple__95);
      __pyx_r = __pyx_tuple__95;
      goto __pyx_L0;
    }

    /* "cypari/gen.pyx":3005
 *         cdef Gen g
 *         sig_on()
 *         if find_root:             # <<<<<<<<<<<<<<
 *             t = <long>itos(gissquareall(x.g, &G))
 *             if t:
 */
  }

  /* "cypari/gen.pyx":3013
 *                 return False, None
 *         else:
 *             t = <long>itos(gissquare(x.g))             # <<<<<<<<<<<<<<
 *             sig_off()
 *             return t != 0
 */
  /*else*/ {
    __pyx_v_t = ((long)itos(gissquare(__pyx_v_x->__pyx_base.g)));

    /* "cypari/gen.pyx":3014
 *         else:
 *             t = <long>itos(gissquare(x.g))
 *             sig_off()             # <<<<<<<<<<<<<<
 *             return t != 0
 * 
 */
    sig_off();

    /* "cypari/gen.pyx":3015
 *             t = <long>itos(gissquare(x.g))
 *             sig_off()
 *             return t != 0             # <<<<<<<<<<<<<<
 * 
 *     def issquarefree(self):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_t != 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":2996
 *         return new_gen(fibo(self))
 * 
 *     def issquare(x, find_root=False):             # <<<<<<<<<<<<<<
 *         """
 *         issquare(x,n): ``True`` if x is a square, ``False`` if not. If
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.issquare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3017
 *             return t != 0
 * 
 *     def issquarefree(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_183issquarefree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_182issquarefree[] = "\n        EXAMPLES::\n\n            sage: pari(10).issquarefree()\n            True\n            sage: pari(20).issquarefree()\n            False\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_183issquarefree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("issquarefree (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_182issquarefree(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_182issquarefree(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("issquarefree", 0);

  /* "cypari/gen.pyx":3026
 *             False
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long t = <long>issquarefree(self.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3026, __pyx_L1_error)

  /* "cypari/gen.pyx":3027
 *         """
 *         sig_on()
 *         cdef long t = <long>issquarefree(self.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return t != 0
 */
  __pyx_v_t = ((long)issquarefree(__pyx_v_self->__pyx_base.g));

  /* "cypari/gen.pyx":3028
 *         sig_on()
 *         cdef long t = <long>issquarefree(self.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return t != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":3029
 *         cdef long t = <long>issquarefree(self.g)
 *         sig_off()
 *         return t != 0             # <<<<<<<<<<<<<<
 * 
 *     def sumdiv(n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_t != 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3017
 *             return t != 0
 * 
 *     def issquarefree(self):             # <<<<<<<<<<<<<<
 *         """
 *         EXAMPLES::
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.issquarefree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3031
 *         return t != 0
 * 
 *     def sumdiv(n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the sum of the divisors of `n`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_185sumdiv(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_184sumdiv[] = "\n        Return the sum of the divisors of `n`.\n\n        EXAMPLES::\n\n            sage: pari(10).sumdiv()\n            18\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_185sumdiv(PyObject *__pyx_v_n, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumdiv (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_184sumdiv(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_184sumdiv(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_n) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("sumdiv", 0);

  /* "cypari/gen.pyx":3040
 *             18
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(sumdiv(n.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3040, __pyx_L1_error)

  /* "cypari/gen.pyx":3041
 *         """
 *         sig_on()
 *         return new_gen(sumdiv(n.g))             # <<<<<<<<<<<<<<
 * 
 *     def sumdivk(n, long k):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(sumdiv(__pyx_v_n->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3031
 *         return t != 0
 * 
 *     def sumdiv(n):             # <<<<<<<<<<<<<<
 *         """
 *         Return the sum of the divisors of `n`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.sumdiv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3043
 *         return new_gen(sumdiv(n.g))
 * 
 *     def sumdivk(n, long k):             # <<<<<<<<<<<<<<
 *         """
 *         Return the sum of the k-th powers of the divisors of n.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_187sumdivk(PyObject *__pyx_v_n, PyObject *__pyx_arg_k); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_186sumdivk[] = "\n        Return the sum of the k-th powers of the divisors of n.\n\n        EXAMPLES::\n\n            sage: pari(10).sumdivk(2)\n            130\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_187sumdivk(PyObject *__pyx_v_n, PyObject *__pyx_arg_k) {
  long __pyx_v_k;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("sumdivk (wrapper)", 0);
  assert(__pyx_arg_k); {
    __pyx_v_k = __Pyx_PyInt_As_long(__pyx_arg_k); if (unlikely((__pyx_v_k == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3043, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.sumdivk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_186sumdivk(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_n), ((long)__pyx_v_k));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_186sumdivk(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_n, long __pyx_v_k) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("sumdivk", 0);

  /* "cypari/gen.pyx":3052
 *             130
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(sumdivk(n.g, k))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3052, __pyx_L1_error)

  /* "cypari/gen.pyx":3053
 *         """
 *         sig_on()
 *         return new_gen(sumdivk(n.g, k))             # <<<<<<<<<<<<<<
 * 
 *     def Zn_issquare(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(sumdivk(__pyx_v_n->__pyx_base.g, __pyx_v_k))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3043
 *         return new_gen(sumdiv(n.g))
 * 
 *     def sumdivk(n, long k):             # <<<<<<<<<<<<<<
 *         """
 *         Return the sum of the k-th powers of the divisors of n.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.sumdivk", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3055
 *         return new_gen(sumdivk(n.g, k))
 * 
 *     def Zn_issquare(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``True`` if ``self`` is a square modulo `n`, ``False``
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_189Zn_issquare(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_188Zn_issquare[] = "\n        Return ``True`` if ``self`` is a square modulo `n`, ``False``\n        if not.\n\n        INPUT:\n\n        - ``self`` -- integer\n\n        - ``n`` -- integer or factorisation matrix\n\n        EXAMPLES::\n\n            sage: pari(3).Zn_issquare(4)\n            False\n            sage: pari(4).Zn_issquare(pari(30).factor())\n            True\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_189Zn_issquare(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Zn_issquare (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_188Zn_issquare(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_188Zn_issquare(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  long __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("Zn_issquare", 0);

  /* "cypari/gen.pyx":3074
 * 
 *         """
 *         cdef Gen t0 = objtogen(n)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef long t = <long>Zn_issquare(self.g, t0.g)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3074, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3075
 *         """
 *         cdef Gen t0 = objtogen(n)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long t = <long>Zn_issquare(self.g, t0.g)
 *         sig_off()
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3075, __pyx_L1_error)

  /* "cypari/gen.pyx":3076
 *         cdef Gen t0 = objtogen(n)
 *         sig_on()
 *         cdef long t = <long>Zn_issquare(self.g, t0.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return t != 0
 */
  __pyx_v_t = ((long)Zn_issquare(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g));

  /* "cypari/gen.pyx":3077
 *         sig_on()
 *         cdef long t = <long>Zn_issquare(self.g, t0.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return t != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":3078
 *         cdef long t = <long>Zn_issquare(self.g, t0.g)
 *         sig_off()
 *         return t != 0             # <<<<<<<<<<<<<<
 * 
 *     def Zn_sqrt(self, n):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_t != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3078, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3055
 *         return new_gen(sumdivk(n.g, k))
 * 
 *     def Zn_issquare(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return ``True`` if ``self`` is a square modulo `n`, ``False``
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.Zn_issquare", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3080
 *         return t != 0
 * 
 *     def Zn_sqrt(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return a square root of ``self`` modulo `n`, if such a square
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_191Zn_sqrt(PyObject *__pyx_v_self, PyObject *__pyx_v_n); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_190Zn_sqrt[] = "\n        Return a square root of ``self`` modulo `n`, if such a square\n        root exists; otherwise, raise a ``ValueError``.\n\n        INPUT:\n\n        - ``self`` -- integer\n\n        - ``n`` -- integer or factorisation matrix\n\n        EXAMPLES::\n\n            sage: pari(3).Zn_sqrt(4)\n            Traceback (most recent call last):\n            ...\n            ValueError: 3 is not a square modulo 4\n            sage: pari(4).Zn_sqrt(pari(30).factor())\n            22\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_191Zn_sqrt(PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Zn_sqrt (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_190Zn_sqrt(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_n));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_190Zn_sqrt(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_n) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  GEN __pyx_v_s;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("Zn_sqrt", 0);

  /* "cypari/gen.pyx":3101
 * 
 *         """
 *         cdef Gen t0 = objtogen(n)             # <<<<<<<<<<<<<<
 *         cdef GEN s
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3103
 *         cdef Gen t0 = objtogen(n)
 *         cdef GEN s
 *         sig_on()             # <<<<<<<<<<<<<<
 *         s = Zn_sqrt(self.g, t0.g)
 *         if s == NULL:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3103, __pyx_L1_error)

  /* "cypari/gen.pyx":3104
 *         cdef GEN s
 *         sig_on()
 *         s = Zn_sqrt(self.g, t0.g)             # <<<<<<<<<<<<<<
 *         if s == NULL:
 *             sig_off()
 */
  __pyx_v_s = Zn_sqrt(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g);

  /* "cypari/gen.pyx":3105
 *         sig_on()
 *         s = Zn_sqrt(self.g, t0.g)
 *         if s == NULL:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             raise ValueError("%s is not a square modulo %s" % (self, n))
 */
  __pyx_t_3 = ((__pyx_v_s == NULL) != 0);
  if (unlikely(__pyx_t_3)) {

    /* "cypari/gen.pyx":3106
 *         s = Zn_sqrt(self.g, t0.g)
 *         if s == NULL:
 *             sig_off()             # <<<<<<<<<<<<<<
 *             raise ValueError("%s is not a square modulo %s" % (self, n))
 *         return new_gen(s)
 */
    sig_off();

    /* "cypari/gen.pyx":3107
 *         if s == NULL:
 *             sig_off()
 *             raise ValueError("%s is not a square modulo %s" % (self, n))             # <<<<<<<<<<<<<<
 *         return new_gen(s)
 * 
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3107, __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_INCREF(__pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_n);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_s_is_not_a_square_modulo_s, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3107, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(6, 3107, __pyx_L1_error)

    /* "cypari/gen.pyx":3105
 *         sig_on()
 *         s = Zn_sqrt(self.g, t0.g)
 *         if s == NULL:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             raise ValueError("%s is not a square modulo %s" % (self, n))
 */
  }

  /* "cypari/gen.pyx":3108
 *             sig_off()
 *             raise ValueError("%s is not a square modulo %s" % (self, n))
 *         return new_gen(s)             # <<<<<<<<<<<<<<
 * 
 *     def ellan(self, long n, python_ints=False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_s)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3080
 *         return t != 0
 * 
 *     def Zn_sqrt(self, n):             # <<<<<<<<<<<<<<
 *         """
 *         Return a square root of ``self`` modulo `n`, if such a square
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.Zn_sqrt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3110
 *         return new_gen(s)
 * 
 *     def ellan(self, long n, python_ints=False):             # <<<<<<<<<<<<<<
 *         """
 *         Return the first `n` Fourier coefficients of the modular
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_193ellan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_192ellan[] = "\n        Return the first `n` Fourier coefficients of the modular\n        form attached to this elliptic curve. See ellak for more details.\n\n        INPUT:\n\n\n        -  ``n`` - a long integer\n\n        -  ``python_ints`` - bool (default is False); if True,\n           return a list of Python ints instead of a PARI Gen wrapper.\n\n\n        EXAMPLES::\n\n            sage: e = pari([0, -1, 1, -10, -20]).ellinit()\n            sage: e.ellan(3)\n            [1, -2, -1]\n            sage: e.ellan(20)\n            [1, -2, -1, 2, 1, 2, -2, 0, -2, -2, 1, -2, 4, 4, -1, -4, -2, 4, 0, 2]\n            sage: e.ellan(-1)\n            []\n            sage: v = e.ellan(10, python_ints=True); v\n            [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n            sage: type(v)\n            <... 'list'>\n            sage: type(v[0])\n            <... 'int'>\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_193ellan(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_python_ints = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellan (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_python_ints,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_False);
    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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_python_ints);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellan") < 0)) __PYX_ERR(6, 3110, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3110, __pyx_L3_error)
    __pyx_v_python_ints = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellan", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3110, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.ellan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_192ellan(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_n, __pyx_v_python_ints);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_192ellan(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_python_ints) {
  GEN __pyx_v_g;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  long __pyx_t_8;
  __Pyx_RefNannySetupContext("ellan", 0);

  /* "cypari/gen.pyx":3140
 *             <... 'int'>
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN g = anell(self.g, n)
 *         if python_ints:
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3140, __pyx_L1_error)

  /* "cypari/gen.pyx":3141
 *         """
 *         sig_on()
 *         cdef GEN g = anell(self.g, n)             # <<<<<<<<<<<<<<
 *         if python_ints:
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))
 */
  __pyx_v_g = anell(__pyx_v_self->__pyx_base.g, __pyx_v_n);

  /* "cypari/gen.pyx":3142
 *         sig_on()
 *         cdef GEN g = anell(self.g, n)
 *         if python_ints:             # <<<<<<<<<<<<<<
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))
 *                  for i in range(<long>glength(g))]
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_python_ints); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 3142, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3143
 *         cdef GEN g = anell(self.g, n)
 *         if python_ints:
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))             # <<<<<<<<<<<<<<
 *                  for i in range(<long>glength(g))]
 *             clear_stack()
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "cypari/gen.pyx":3144
 *         if python_ints:
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))
 *                  for i in range(<long>glength(g))]             # <<<<<<<<<<<<<<
 *             clear_stack()
 *             return v
 */
    __pyx_t_4 = __Pyx_PyInt_From_long(((long)glength(__pyx_v_g))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 3144, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(6, 3144, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3144, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(6, 3144, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3144, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_7(__pyx_t_4);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(6, 3144, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "cypari/gen.pyx":3143
 *         cdef GEN g = anell(self.g, n)
 *         if python_ints:
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))             # <<<<<<<<<<<<<<
 *                  for i in range(<long>glength(g))]
 *             clear_stack()
 */
      __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3143, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_f_6cypari_5_pari_pari_longword_to_int(gtolong(gel(__pyx_v_g, __pyx_t_8))); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_5))) __PYX_ERR(6, 3143, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cypari/gen.pyx":3144
 *         if python_ints:
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))
 *                  for i in range(<long>glength(g))]             # <<<<<<<<<<<<<<
 *             clear_stack()
 *             return v
 */
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_v = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/gen.pyx":3145
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))
 *                  for i in range(<long>glength(g))]
 *             clear_stack()             # <<<<<<<<<<<<<<
 *             return v
 *         else:
 */
    __pyx_f_6cypari_5_pari_clear_stack();

    /* "cypari/gen.pyx":3146
 *                  for i in range(<long>glength(g))]
 *             clear_stack()
 *             return v             # <<<<<<<<<<<<<<
 *         else:
 *             return new_gen(g)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_v);
    __pyx_r = __pyx_v_v;
    goto __pyx_L0;

    /* "cypari/gen.pyx":3142
 *         sig_on()
 *         cdef GEN g = anell(self.g, n)
 *         if python_ints:             # <<<<<<<<<<<<<<
 *             v = [pari_longword_to_int(gtolong(gel(g, i+1)))
 *                  for i in range(<long>glength(g))]
 */
  }

  /* "cypari/gen.pyx":3148
 *             return v
 *         else:
 *             return new_gen(g)             # <<<<<<<<<<<<<<
 * 
 *     def ellaplist(self, long n, python_ints=False):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":3110
 *         return new_gen(s)
 * 
 *     def ellan(self, long n, python_ints=False):             # <<<<<<<<<<<<<<
 *         """
 *         Return the first `n` Fourier coefficients of the modular
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen.ellan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3150
 *             return new_gen(g)
 * 
 *     def ellaplist(self, long n, python_ints=False):             # <<<<<<<<<<<<<<
 *         r"""
 *         e.ellaplist(n): Returns a PARI list of all the prime-indexed
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_195ellaplist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_194ellaplist[] = "\n        e.ellaplist(n): Returns a PARI list of all the prime-indexed\n        coefficients `a_p` (up to n) of the `L`-function\n        of the elliptic curve `e`, i.e. the Fourier coefficients of\n        the newform attached to `e`.\n\n        INPUT:\n\n        - ``self`` -- an elliptic curve\n\n        - ``n`` -- a long integer\n\n        - ``python_ints`` -- bool (default is False); if True,\n          return a list of Python ints instead of a PARI Gen wrapper.\n\n        .. WARNING::\n\n            The curve e must be a medium or long vector of the type given by\n            ellinit. For this function to work for every n and not just those\n            prime to the conductor, e must be a minimal Weierstrass equation.\n            If this is not the case, use the function ellminimalmodel first\n            before using ellaplist (or you will get INCORRECT RESULTS!)\n\n        EXAMPLES::\n\n            sage: e = pari([0, -1, 1, -10, -20]).ellinit()\n            sage: v = e.ellaplist(10); v\n            [-2, -1, 1, -2]\n            sage: isinstance(v, Gen)\n            True\n            sage: v.type()\n            't_VEC'\n            sage: e.ellan(10)\n            [1, -2, -1, 2, 1, 2, -2, 0, -2, -2]\n            sage: v = e.ellaplist(10, python_ints=True); v\n            [-2, -1, 1, -2]\n            sage: type(v)\n            <... 'list'>\n            sage: type(v[0])\n            <... 'int'>\n\n        TESTS::\n\n            sage: v = e.ellaplist(1)\n            sage: v, isinstance(v, Gen)\n            ([], True)\n            sage: v = e.ellaplist(1, python_ints=True)\n            sage: v, isinstance(v, list)\n            ([], True)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_195ellaplist(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_n;
  PyObject *__pyx_v_python_ints = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellaplist (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,&__pyx_n_s_python_ints,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_False);
    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_n)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_python_ints);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellaplist") < 0)) __PYX_ERR(6, 3150, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_n = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3150, __pyx_L3_error)
    __pyx_v_python_ints = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellaplist", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.ellaplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_194ellaplist(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_n, __pyx_v_python_ints);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_194ellaplist(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_n, PyObject *__pyx_v_python_ints) {
  GEN __pyx_v_g;
  long __pyx_v_i;
  GEN __pyx_v_curve;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  GEN __pyx_t_10;
  long __pyx_t_11;
  long __pyx_t_12;
  long __pyx_t_13;
  __Pyx_RefNannySetupContext("ellaplist", 0);

  /* "cypari/gen.pyx":3201
 *             ([], True)
 *         """
 *         if python_ints:             # <<<<<<<<<<<<<<
 *             return [int(x) for x in self.ellaplist(n)]
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_python_ints); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(6, 3201, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":3202
 *         """
 *         if python_ints:
 *             return [int(x) for x in self.ellaplist(n)]             # <<<<<<<<<<<<<<
 * 
 *         sig_on()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ellaplist); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3202, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 3202, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          if (__pyx_t_7 >= 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_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(6, 3202, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3202, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_7 >= 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_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(6, 3202, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3202, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_8(__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(6, 3202, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(6, 3202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":3201
 *             ([], True)
 *         """
 *         if python_ints:             # <<<<<<<<<<<<<<
 *             return [int(x) for x in self.ellaplist(n)]
 * 
 */
  }

  /* "cypari/gen.pyx":3204
 *             return [int(x) for x in self.ellaplist(n)]
 * 
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if n < 2:
 *             return new_gen(zerovec(0))
 */
  __pyx_t_9 = sig_on(); if (unlikely(__pyx_t_9 == ((int)0))) __PYX_ERR(6, 3204, __pyx_L1_error)

  /* "cypari/gen.pyx":3205
 * 
 *         sig_on()
 *         if n < 2:             # <<<<<<<<<<<<<<
 *             return new_gen(zerovec(0))
 * 
 */
  __pyx_t_1 = ((__pyx_v_n < 2) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":3206
 *         sig_on()
 *         if n < 2:
 *             return new_gen(zerovec(0))             # <<<<<<<<<<<<<<
 * 
 *         # Make a table of primes up to n: this returns a t_VECSMALL
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(zerovec(0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":3205
 * 
 *         sig_on()
 *         if n < 2:             # <<<<<<<<<<<<<<
 *             return new_gen(zerovec(0))
 * 
 */
  }

  /* "cypari/gen.pyx":3210
 *         # Make a table of primes up to n: this returns a t_VECSMALL
 *         # that we artificially change to a t_VEC
 *         cdef GEN g = primes_upto_zv(n)             # <<<<<<<<<<<<<<
 *         settyp(g, t_VEC)
 * 
 */
  __pyx_v_g = primes_upto_zv(__pyx_v_n);

  /* "cypari/gen.pyx":3211
 *         # that we artificially change to a t_VEC
 *         cdef GEN g = primes_upto_zv(n)
 *         settyp(g, t_VEC)             # <<<<<<<<<<<<<<
 * 
 *         # Replace each prime in the table by ellap of it
 */
  (void)(settyp(__pyx_v_g, t_VEC));

  /* "cypari/gen.pyx":3215
 *         # Replace each prime in the table by ellap of it
 *         cdef long i
 *         cdef GEN curve = self.g             # <<<<<<<<<<<<<<
 *         for i in range(1, lg(g)):
 *             set_gel(g, i, ellap(curve, utoi(g[i])))
 */
  __pyx_t_10 = __pyx_v_self->__pyx_base.g;
  __pyx_v_curve = __pyx_t_10;

  /* "cypari/gen.pyx":3216
 *         cdef long i
 *         cdef GEN curve = self.g
 *         for i in range(1, lg(g)):             # <<<<<<<<<<<<<<
 *             set_gel(g, i, ellap(curve, utoi(g[i])))
 *         return new_gen(g)
 */
  __pyx_t_11 = lg(__pyx_v_g);
  __pyx_t_12 = __pyx_t_11;
  for (__pyx_t_13 = 1; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
    __pyx_v_i = __pyx_t_13;

    /* "cypari/gen.pyx":3217
 *         cdef GEN curve = self.g
 *         for i in range(1, lg(g)):
 *             set_gel(g, i, ellap(curve, utoi(g[i])))             # <<<<<<<<<<<<<<
 *         return new_gen(g)
 * 
 */
    (void)(set_gel(__pyx_v_g, __pyx_v_i, ellap(__pyx_v_curve, utoi((__pyx_v_g[__pyx_v_i])))));
  }

  /* "cypari/gen.pyx":3218
 *         for i in range(1, lg(g)):
 *             set_gel(g, i, ellap(curve, utoi(g[i])))
 *         return new_gen(g)             # <<<<<<<<<<<<<<
 * 
 *     def ellisoncurve(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3150
 *             return new_gen(g)
 * 
 *     def ellaplist(self, long n, python_ints=False):             # <<<<<<<<<<<<<<
 *         r"""
 *         e.ellaplist(n): Returns a PARI list of all the prime-indexed
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("cypari._pari.Gen.ellaplist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3220
 *         return new_gen(g)
 * 
 *     def ellisoncurve(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         e.ellisoncurve(x): return True if the point x is on the elliptic
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_197ellisoncurve(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_196ellisoncurve[] = "\n        e.ellisoncurve(x): return True if the point x is on the elliptic\n        curve e, False otherwise.\n\n        If the point or the curve have inexact coefficients, an attempt is\n        made to take this into account.\n\n        EXAMPLES::\n\n            sage: e = pari([0,1,1,-2,0]).ellinit()\n            sage: e.ellisoncurve([1,0])\n            True\n            sage: e.ellisoncurve([1,1])\n            False\n            sage: e.ellisoncurve([1,0.00000000000000001])\n            False\n            sage: e.ellisoncurve([1,0.000000000000000001])\n            True\n            sage: e.ellisoncurve([0])\n            True\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_197ellisoncurve(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellisoncurve (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_196ellisoncurve(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_196ellisoncurve(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  int __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("ellisoncurve", 0);

  /* "cypari/gen.pyx":3242
 *             True
 *         """
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef int t = oncurve(self.g, t0.g)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3243
 *         """
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef int t = oncurve(self.g, t0.g)
 *         sig_off()
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3243, __pyx_L1_error)

  /* "cypari/gen.pyx":3244
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 *         cdef int t = oncurve(self.g, t0.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return t != 0
 */
  __pyx_v_t = oncurve(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g);

  /* "cypari/gen.pyx":3245
 *         sig_on()
 *         cdef int t = oncurve(self.g, t0.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return t != 0
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":3246
 *         cdef int t = oncurve(self.g, t0.g)
 *         sig_off()
 *         return t != 0             # <<<<<<<<<<<<<<
 * 
 *     def ellminimalmodel(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_t != 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3220
 *         return new_gen(g)
 * 
 *     def ellisoncurve(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         e.ellisoncurve(x): return True if the point x is on the elliptic
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.ellisoncurve", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3248
 *         return t != 0
 * 
 *     def ellminimalmodel(self):             # <<<<<<<<<<<<<<
 *         """
 *         ellminimalmodel(e): return the standard minimal integral model of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_199ellminimalmodel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_198ellminimalmodel[] = "\n        ellminimalmodel(e): return the standard minimal integral model of\n        the rational elliptic curve e and the corresponding change of\n        variables. INPUT:\n\n\n        -  ``e`` - Gen (that defines an elliptic curve)\n\n\n        OUTPUT:\n\n\n        -  ``gen`` - minimal model\n\n        -  ``gen`` - change of coordinates\n\n\n        EXAMPLES::\n\n            sage: e = pari([1,2,3,4,5]).ellinit()\n            sage: F, ch = e.ellminimalmodel()\n            sage: F[:5]\n            [1, -1, 0, 4, 3]\n            sage: ch\n            [1, -1, 0, -1]\n            sage: e.ellchangecurve(ch)[:5]\n            [1, -1, 0, 4, 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_199ellminimalmodel(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellminimalmodel (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_198ellminimalmodel(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_198ellminimalmodel(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  GEN __pyx_v_x;
  GEN __pyx_v_y;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_model = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_change = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ellminimalmodel", 0);

  /* "cypari/gen.pyx":3280
 *         cdef Gen model, change
 *         cdef pari_sp t
 *         sig_on()             # <<<<<<<<<<<<<<
 *         x = ellminimalmodel(self.g, &y)
 *         change = new_gen_noclear(y)
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3280, __pyx_L1_error)

  /* "cypari/gen.pyx":3281
 *         cdef pari_sp t
 *         sig_on()
 *         x = ellminimalmodel(self.g, &y)             # <<<<<<<<<<<<<<
 *         change = new_gen_noclear(y)
 *         model = new_gen(x)
 */
  __pyx_v_x = ellminimalmodel(__pyx_v_self->__pyx_base.g, (&__pyx_v_y));

  /* "cypari/gen.pyx":3282
 *         sig_on()
 *         x = ellminimalmodel(self.g, &y)
 *         change = new_gen_noclear(y)             # <<<<<<<<<<<<<<
 *         model = new_gen(x)
 *         return model, change
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(__pyx_v_y)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_change = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/gen.pyx":3283
 *         x = ellminimalmodel(self.g, &y)
 *         change = new_gen_noclear(y)
 *         model = new_gen(x)             # <<<<<<<<<<<<<<
 *         return model, change
 * 
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_x)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_model = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "cypari/gen.pyx":3284
 *         change = new_gen_noclear(y)
 *         model = new_gen(x)
 *         return model, change             # <<<<<<<<<<<<<<
 * 
 *     def elltors(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_model));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_model));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_model));
  __Pyx_INCREF(((PyObject *)__pyx_v_change));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_change));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_change));
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3248
 *         return t != 0
 * 
 *     def ellminimalmodel(self):             # <<<<<<<<<<<<<<
 *         """
 *         ellminimalmodel(e): return the standard minimal integral model of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.ellminimalmodel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_model);
  __Pyx_XDECREF((PyObject *)__pyx_v_change);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3286
 *         return model, change
 * 
 *     def elltors(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return information about the torsion subgroup of the given
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_201elltors(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_200elltors[] = "\n        Return information about the torsion subgroup of the given\n        elliptic curve.\n\n        INPUT:\n\n        -  ``e`` - elliptic curve over `\\QQ`\n\n        OUTPUT:\n\n\n        -  ``gen`` - the order of the torsion subgroup, a.k.a.\n           the number of points of finite order\n\n        -  ``gen`` - vector giving the structure of the torsion\n           subgroup as a product of cyclic groups, sorted in non-increasing\n           order\n\n        -  ``gen`` - vector giving points on e generating these\n           cyclic groups\n\n\n        EXAMPLES::\n\n            sage: e = pari([1,0,1,-19,26]).ellinit()\n            sage: e.elltors()\n            [12, [6, 2], [[1, 2], [3, -2]]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_201elltors(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("elltors (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_200elltors(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_200elltors(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("elltors", 0);

  /* "cypari/gen.pyx":3315
 *             [12, [6, 2], [[1, 2], [3, -2]]]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(elltors(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3315, __pyx_L1_error)

  /* "cypari/gen.pyx":3316
 *         """
 *         sig_on()
 *         return new_gen(elltors(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def omega(self, unsigned long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(elltors(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3286
 *         return model, change
 * 
 *     def elltors(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return information about the torsion subgroup of the given
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.elltors", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3318
 *         return new_gen(elltors(self.g))
 * 
 *     def omega(self, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         Return the basis for the period lattice of this elliptic curve.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_203omega(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_202omega[] = "\n        Return the basis for the period lattice of this elliptic curve.\n\n        EXAMPLES::\n\n            sage: e = pari([0, -1, 1, -10, -20]).ellinit()\n            sage: e.omega()\n            [1.26920930427955, 0.634604652139777 - 1.45881661693850*I]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_203omega(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("omega (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "omega") < 0)) __PYX_ERR(6, 3318, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3318, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("omega", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3318, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.omega", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_202omega(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_202omega(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, unsigned long __pyx_v_precision) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("omega", 0);

  /* "cypari/gen.pyx":3328
 *             [1.26920930427955, 0.634604652139777 - 1.45881661693850*I]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(ellR_omega(self.g, prec_bits_to_words(precision)))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3328, __pyx_L1_error)

  /* "cypari/gen.pyx":3329
 *         """
 *         sig_on()
 *         return new_gen(ellR_omega(self.g, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 * 
 *     def disc(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(ellR_omega(__pyx_v_self->__pyx_base.g, __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3329, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3318
 *         return new_gen(elltors(self.g))
 * 
 *     def omega(self, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         Return the basis for the period lattice of this elliptic curve.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.omega", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3331
 *         return new_gen(ellR_omega(self.g, prec_bits_to_words(precision)))
 * 
 *     def disc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the discriminant of this object.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_205disc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_204disc[] = "\n        Return the discriminant of this object.\n\n        EXAMPLES::\n\n            sage: e = pari([0, -1, 1, -10, -20]).ellinit()\n            sage: e.disc()\n            -161051\n            sage: _.factor()\n            [-1, 1; 11, 5]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_205disc(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("disc (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_204disc(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_204disc(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("disc", 0);

  /* "cypari/gen.pyx":3343
 *             [-1, 1; 11, 5]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(member_disc(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3343, __pyx_L1_error)

  /* "cypari/gen.pyx":3344
 *         """
 *         sig_on()
 *         return new_gen(member_disc(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def j(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(member_disc(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3331
 *         return new_gen(ellR_omega(self.g, prec_bits_to_words(precision)))
 * 
 *     def disc(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the discriminant of this object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.disc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3346
 *         return new_gen(member_disc(self.g))
 * 
 *     def j(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the j-invariant of this object.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_207j(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_206j[] = "\n        Return the j-invariant of this object.\n\n        EXAMPLES::\n\n            sage: e = pari([0, -1, 1, -10, -20]).ellinit()\n            sage: e.j()\n            -122023936/161051\n            sage: _.factor()\n            [-1, 1; 2, 12; 11, -5; 31, 3]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_207j(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("j (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_206j(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_206j(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("j", 0);

  /* "cypari/gen.pyx":3358
 *             [-1, 1; 2, 12; 11, -5; 31, 3]
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(member_j(self.g))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3358, __pyx_L1_error)

  /* "cypari/gen.pyx":3359
 *         """
 *         sig_on()
 *         return new_gen(member_j(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def _eltabstorel(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(member_j(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3346
 *         return new_gen(member_disc(self.g))
 * 
 *     def j(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the j-invariant of this object.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.j", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3361
 *         return new_gen(member_j(self.g))
 * 
 *     def _eltabstorel(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the relative number field element corresponding to `x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_209_eltabstorel(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_208_eltabstorel[] = "\n        Return the relative number field element corresponding to `x`.\n\n        The result is a ``t_POLMOD`` with ``t_POLMOD`` coefficients.\n\n        .. WARNING::\n\n            This is a low-level version of :meth:`rnfeltabstorel` that\n            only needs the output of :meth:`_nf_rnfeq`, not a full\n            PARI ``rnf`` structure.  This method may raise errors or\n            return undefined results if called with invalid arguments.\n\n        TESTS::\n\n            sage: K = pari('y^2 + 1').nfinit()\n            sage: rnfeq = K._nf_rnfeq('x^2 + 2')\n            sage: f_abs = rnfeq[0]; f_abs\n            x^4 + 6*x^2 + 1\n            sage: x_rel = rnfeq._eltabstorel('x'); x_rel\n            Mod(x + Mod(-y, y^2 + 1), x^2 + 2)\n            sage: f_abs(x_rel)\n            Mod(0, x^2 + 2)\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_209_eltabstorel(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_eltabstorel (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_208_eltabstorel(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_208_eltabstorel(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_eltabstorel", 0);

  /* "cypari/gen.pyx":3386
 * 
 *         """
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(eltabstorel(self.g, t0.g))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3387
 *         """
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(eltabstorel(self.g, t0.g))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3387, __pyx_L1_error)

  /* "cypari/gen.pyx":3388
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 *         return new_gen(eltabstorel(self.g, t0.g))             # <<<<<<<<<<<<<<
 * 
 *     def _eltabstorel_lift(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(eltabstorel(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3361
 *         return new_gen(member_j(self.g))
 * 
 *     def _eltabstorel(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the relative number field element corresponding to `x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen._eltabstorel", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3390
 *         return new_gen(eltabstorel(self.g, t0.g))
 * 
 *     def _eltabstorel_lift(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the relative number field element corresponding to `x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_211_eltabstorel_lift(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_210_eltabstorel_lift[] = "\n        Return the relative number field element corresponding to `x`.\n\n        The result is a ``t_POL`` with ``t_POLMOD`` coefficients.\n\n        .. WARNING::\n\n            This is a low-level version of :meth:`rnfeltabstorel` that\n            only needs the output of :meth:`_nf_rnfeq`, not a full\n            PARI ``rnf`` structure.  This method may raise errors or\n            return undefined results if called with invalid arguments.\n\n        TESTS::\n\n            sage: K = pari('y^2 + 1').nfinit()\n            sage: rnfeq = K._nf_rnfeq('x^2 + 2')\n            sage: rnfeq._eltabstorel_lift('x')\n            x + Mod(-y, y^2 + 1)\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_211_eltabstorel_lift(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_eltabstorel_lift (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_210_eltabstorel_lift(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_210_eltabstorel_lift(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_eltabstorel_lift", 0);

  /* "cypari/gen.pyx":3411
 * 
 *         """
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(eltabstorel_lift(self.g, t0.g))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3412
 *         """
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(eltabstorel_lift(self.g, t0.g))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3412, __pyx_L1_error)

  /* "cypari/gen.pyx":3413
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 *         return new_gen(eltabstorel_lift(self.g, t0.g))             # <<<<<<<<<<<<<<
 * 
 *     def _eltreltoabs(self, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(eltabstorel_lift(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3390
 *         return new_gen(eltabstorel(self.g, t0.g))
 * 
 *     def _eltabstorel_lift(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the relative number field element corresponding to `x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen._eltabstorel_lift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3415
 *         return new_gen(eltabstorel_lift(self.g, t0.g))
 * 
 *     def _eltreltoabs(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the absolute number field element corresponding to `x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_213_eltreltoabs(PyObject *__pyx_v_self, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_212_eltreltoabs[] = "\n        Return the absolute number field element corresponding to `x`.\n\n        The result is a ``t_POL``.\n\n        .. WARNING::\n\n            This is a low-level version of :meth:`rnfeltreltoabs` that\n            only needs the output of :meth:`_nf_rnfeq`, not a full\n            PARI ``rnf`` structure.  This method may raise errors or\n            return undefined results if called with invalid arguments.\n\n        TESTS::\n\n            sage: K = pari('y^2 + 1').nfinit()\n            sage: rnfeq = K._nf_rnfeq('x^2 + 2')\n            sage: rnfeq._eltreltoabs('x')\n            1/2*x^3 + 7/2*x\n            sage: rnfeq._eltreltoabs('y')\n            1/2*x^3 + 5/2*x\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_213_eltreltoabs(PyObject *__pyx_v_self, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_eltreltoabs (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_212_eltreltoabs(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_212_eltreltoabs(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_eltreltoabs", 0);

  /* "cypari/gen.pyx":3438
 * 
 *         """
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(eltreltoabs(self.g, t0.g))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3439
 *         """
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(eltreltoabs(self.g, t0.g))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3439, __pyx_L1_error)

  /* "cypari/gen.pyx":3440
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 *         return new_gen(eltreltoabs(self.g, t0.g))             # <<<<<<<<<<<<<<
 * 
 *     def galoissubfields(self, long flag=0, v=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(eltreltoabs(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3415
 *         return new_gen(eltabstorel_lift(self.g, t0.g))
 * 
 *     def _eltreltoabs(self, x):             # <<<<<<<<<<<<<<
 *         """
 *         Return the absolute number field element corresponding to `x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen._eltreltoabs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3442
 *         return new_gen(eltreltoabs(self.g, t0.g))
 * 
 *     def galoissubfields(self, long flag=0, v=-1):             # <<<<<<<<<<<<<<
 *         """
 *         List all subfields of the Galois group ``self``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_215galoissubfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_214galoissubfields[] = "\n        List all subfields of the Galois group ``self``.\n\n        This wraps the `galoissubfields`_ function from PARI.\n\n        This method is essentially the same as applying\n        :meth:`galoisfixedfield` to each group returned by\n        :meth:`galoissubgroups`.\n\n        INPUT:\n\n        - ``self`` -- A Galois group as generated by :meth:`galoisinit`.\n\n        - ``flag`` -- Has the same meaning as in :meth:`galoisfixedfield`.\n\n        - ``v`` -- Has the same meaning as in :meth:`galoisfixedfield`.\n\n        OUTPUT:\n\n        A vector of all subfields of this group.  Each entry is as\n        described in the :meth:`galoisfixedfield` method.\n\n        EXAMPLES::\n\n            sage: G = pari('x^6 + 108').galoisinit()\n            sage: G.galoissubfields(flag=1)\n            [x, x^2 + 972, x^3 + 54, x^3 + 864, x^3 - 54, x^6 + 108]\n            sage: G = pari('x^4 + 1').galoisinit()\n            sage: G.galoissubfields(flag=2, v='z')[3]\n            [z^2 + 2, Mod(x^3 + x, x^4 + 1), [x^2 - z*x - 1, x^2 + z*x - 1]]\n\n        .. _galoissubfields: http://pari.math.u-bordeaux.fr/dochtml/html.stable/Functions_related_to_general_number_fields.html#galoissubfields\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_215galoissubfields(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_v = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("galoissubfields (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_v,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_neg_1);
    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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "galoissubfields") < 0)) __PYX_ERR(6, 3442, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3442, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_v = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("galoissubfields", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3442, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.galoissubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_214galoissubfields(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_flag, __pyx_v_v);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_214galoissubfields(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag, PyObject *__pyx_v_v) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("galoissubfields", 0);

  /* "cypari/gen.pyx":3476
 *         .. _galoissubfields: http://pari.math.u-bordeaux.fr/dochtml/html.stable/Functions_related_to_general_number_fields.html#galoissubfields
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(galoissubfields(self.g, flag, get_var(v)))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3476, __pyx_L1_error)

  /* "cypari/gen.pyx":3477
 *         """
 *         sig_on()
 *         return new_gen(galoissubfields(self.g, flag, get_var(v)))             # <<<<<<<<<<<<<<
 * 
 *     def nfeltval(self, x, p):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_v); if (unlikely(__pyx_t_2 == ((long)-2L))) __PYX_ERR(6, 3477, __pyx_L1_error)
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(galoissubfields(__pyx_v_self->__pyx_base.g, __pyx_v_flag, __pyx_t_2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3442
 *         return new_gen(eltreltoabs(self.g, t0.g))
 * 
 *     def galoissubfields(self, long flag=0, v=-1):             # <<<<<<<<<<<<<<
 *         """
 *         List all subfields of the Galois group ``self``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.galoissubfields", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3479
 *         return new_gen(galoissubfields(self.g, flag, get_var(v)))
 * 
 *     def nfeltval(self, x, p):             # <<<<<<<<<<<<<<
 *         """
 *         Return the valuation of the number field element `x` at the prime `p`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_217nfeltval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_216nfeltval[] = "\n        Return the valuation of the number field element `x` at the prime `p`.\n\n        EXAMPLES::\n\n            sage: nf = pari('x^2 + 1').nfinit()\n            sage: p = nf.idealprimedec(5)[0]\n            sage: nf.nfeltval('50 - 25*x', p)\n            3\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_217nfeltval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_p = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfeltval (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_p,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_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("nfeltval", 1, 2, 2, 1); __PYX_ERR(6, 3479, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfeltval") < 0)) __PYX_ERR(6, 3479, __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_x = values[0];
    __pyx_v_p = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfeltval", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3479, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.nfeltval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_216nfeltval(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_x, __pyx_v_p);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_216nfeltval(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_p) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  long __pyx_v_v;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("nfeltval", 0);

  /* "cypari/gen.pyx":3490
 *             3
 *         """
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef Gen t1 = objtogen(p)
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3491
 *         """
 *         cdef Gen t0 = objtogen(x)
 *         cdef Gen t1 = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef long v = <long>nfval(self.g, t0.g, t1.g)
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3492
 *         cdef Gen t0 = objtogen(x)
 *         cdef Gen t1 = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long v = <long>nfval(self.g, t0.g, t1.g)
 *         sig_off()
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3492, __pyx_L1_error)

  /* "cypari/gen.pyx":3493
 *         cdef Gen t1 = objtogen(p)
 *         sig_on()
 *         cdef long v = <long>nfval(self.g, t0.g, t1.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return v
 */
  __pyx_v_v = ((long)nfval(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g));

  /* "cypari/gen.pyx":3494
 *         sig_on()
 *         cdef long v = <long>nfval(self.g, t0.g, t1.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return v
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":3495
 *         cdef long v = <long>nfval(self.g, t0.g, t1.g)
 *         sig_off()
 *         return v             # <<<<<<<<<<<<<<
 * 
 *     def nfbasis(self, long flag=0, fa=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_v); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3479
 *         return new_gen(galoissubfields(self.g, flag, get_var(v)))
 * 
 *     def nfeltval(self, x, p):             # <<<<<<<<<<<<<<
 *         """
 *         Return the valuation of the number field element `x` at the prime `p`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.nfeltval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3497
 *         return v
 * 
 *     def nfbasis(self, long flag=0, fa=None):             # <<<<<<<<<<<<<<
 *         """
 *         Integral basis of the field `\QQ[a]`, where ``a`` is a root of
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_219nfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_218nfbasis[] = "\n        Integral basis of the field `\\QQ[a]`, where ``a`` is a root of\n        the polynomial x.\n\n        INPUT:\n\n        - ``flag``: if set to 1 and ``fa`` is not given: assume that no\n          square of a prime > 500000 divides the discriminant of ``x``.\n\n        - ``fa``: If present, encodes a subset of primes at which to\n          check for maximality. This must be one of the three following\n          things:\n\n            - an integer: check all primes up to ``fa`` using trial\n              division.\n\n            - a vector: a list of primes to check.\n\n            - a matrix: a partial factorization of the discriminant\n              of ``x``.\n\n        .. NOTE::\n\n            In earlier versions of Sage, other bits in ``flag`` were\n            defined but these are now simply ignored.\n\n        EXAMPLES::\n\n            sage: pari('x^3 - 17').nfbasis()\n            [1, x, 1/3*x^2 - 1/3*x + 1/3]\n\n        We test ``flag`` = 1, noting it gives a wrong result when the\n        discriminant (-4 * `p`^2 * `q` in the example below) has a big square\n        factor::\n\n            sage: p = pari(10**10).nextprime(); q = (p+1).nextprime()\n            sage: x = pari('x'); f = x**2 + p**2*q\n            sage: pari(f).nfbasis(1)   # Wrong result\n            [1, x]\n            sage: pari(f).nfbasis()    # Correct result\n            [1, 1/10000000019*x]\n            sage: pari(f).nfbasis(fa=10**6)   # Check primes up to 10^6: wrong result\n            [1, x]\n            sage: pari(f).nfbasis(fa=\"[2,2; %s,2]\"%p)    # Correct result and faster\n            [1, 1/10000000019*x]\n            sage: pari(f).nfbasis(fa=[2,p])              # Equivalent with the above\n            [1, 1/10000000019*x]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_219nfbasis(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_fa = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfbasis (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_fa,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fa);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfbasis") < 0)) __PYX_ERR(6, 3497, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3497, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_fa = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfbasis", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3497, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.nfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_218nfbasis(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_flag, __pyx_v_fa);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_218nfbasis(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag, PyObject *__pyx_v_fa) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  GEN __pyx_v_g0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  GEN __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("nfbasis", 0);

  /* "cypari/gen.pyx":3548
 *         cdef Gen t0
 *         cdef GEN g0
 *         if fa is not None:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 */
  __pyx_t_1 = (__pyx_v_fa != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3549
 *         cdef GEN g0
 *         if fa is not None:
 *             t0 = objtogen(fa)             # <<<<<<<<<<<<<<
 *             g0 = t0.g
 *         elif flag:
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fa, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3549, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/gen.pyx":3550
 *         if fa is not None:
 *             t0 = objtogen(fa)
 *             g0 = t0.g             # <<<<<<<<<<<<<<
 *         elif flag:
 *             g0 = utoi(500000)
 */
    __pyx_t_4 = __pyx_v_t0->__pyx_base.g;
    __pyx_v_g0 = __pyx_t_4;

    /* "cypari/gen.pyx":3548
 *         cdef Gen t0
 *         cdef GEN g0
 *         if fa is not None:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":3551
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 *         elif flag:             # <<<<<<<<<<<<<<
 *             g0 = utoi(500000)
 *         else:
 */
  __pyx_t_2 = (__pyx_v_flag != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3552
 *             g0 = t0.g
 *         elif flag:
 *             g0 = utoi(500000)             # <<<<<<<<<<<<<<
 *         else:
 *             g0 = NULL
 */
    __pyx_v_g0 = utoi(0x7A120);

    /* "cypari/gen.pyx":3551
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 *         elif flag:             # <<<<<<<<<<<<<<
 *             g0 = utoi(500000)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":3554
 *             g0 = utoi(500000)
 *         else:
 *             g0 = NULL             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(nfbasis(self.g, NULL, g0))
 */
  /*else*/ {
    __pyx_v_g0 = NULL;
  }
  __pyx_L3:;

  /* "cypari/gen.pyx":3555
 *         else:
 *             g0 = NULL
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(nfbasis(self.g, NULL, g0))
 * 
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 3555, __pyx_L1_error)

  /* "cypari/gen.pyx":3556
 *             g0 = NULL
 *         sig_on()
 *         return new_gen(nfbasis(self.g, NULL, g0))             # <<<<<<<<<<<<<<
 * 
 *     def nfbasis_d(self, long flag=0, fa=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(nfbasis(__pyx_v_self->__pyx_base.g, NULL, __pyx_v_g0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3497
 *         return v
 * 
 *     def nfbasis(self, long flag=0, fa=None):             # <<<<<<<<<<<<<<
 *         """
 *         Integral basis of the field `\QQ[a]`, where ``a`` is a root of
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.nfbasis", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3558
 *         return new_gen(nfbasis(self.g, NULL, g0))
 * 
 *     def nfbasis_d(self, long flag=0, fa=None):             # <<<<<<<<<<<<<<
 *         """
 *         Like :meth:`nfbasis`, but return a tuple ``(B, D)`` where `B`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_221nfbasis_d(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_220nfbasis_d[] = "\n        Like :meth:`nfbasis`, but return a tuple ``(B, D)`` where `B`\n        is the integral basis and `D` the discriminant.\n\n        EXAMPLES::\n\n            sage: F = pari('x^3 - 2').nfinit()\n            sage: F[0].nfbasis_d()\n            ([1, x, x^2], -108)\n\n        ::\n\n            sage: G = pari('x^5 - 11').nfinit()\n            sage: G[0].nfbasis_d()\n            ([1, x, x^2, x^3, x^4], 45753125)\n\n        ::\n\n            sage: pari([-2,0,0,1]).Polrev().nfbasis_d()\n            ([1, x, x^2], -108)\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_221nfbasis_d(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_v_fa = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfbasis_d (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,&__pyx_n_s_fa,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fa);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nfbasis_d") < 0)) __PYX_ERR(6, 3558, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3558, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    __pyx_v_fa = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nfbasis_d", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3558, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.nfbasis_d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_220nfbasis_d(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_flag, __pyx_v_fa);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_220nfbasis_d(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag, PyObject *__pyx_v_fa) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  GEN __pyx_v_g0;
  GEN __pyx_v_disc;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_B = NULL;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_D = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  GEN __pyx_t_4;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("nfbasis_d", 0);

  /* "cypari/gen.pyx":3583
 *         cdef GEN g0
 *         cdef GEN disc
 *         if fa is not None:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 */
  __pyx_t_1 = (__pyx_v_fa != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3584
 *         cdef GEN disc
 *         if fa is not None:
 *             t0 = objtogen(fa)             # <<<<<<<<<<<<<<
 *             g0 = t0.g
 *         elif flag & 1:
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_fa, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/gen.pyx":3585
 *         if fa is not None:
 *             t0 = objtogen(fa)
 *             g0 = t0.g             # <<<<<<<<<<<<<<
 *         elif flag & 1:
 *             g0 = utoi(500000)
 */
    __pyx_t_4 = __pyx_v_t0->__pyx_base.g;
    __pyx_v_g0 = __pyx_t_4;

    /* "cypari/gen.pyx":3583
 *         cdef GEN g0
 *         cdef GEN disc
 *         if fa is not None:             # <<<<<<<<<<<<<<
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":3586
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 *         elif flag & 1:             # <<<<<<<<<<<<<<
 *             g0 = utoi(500000)
 *         else:
 */
  __pyx_t_2 = ((__pyx_v_flag & 1) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3587
 *             g0 = t0.g
 *         elif flag & 1:
 *             g0 = utoi(500000)             # <<<<<<<<<<<<<<
 *         else:
 *             g0 = NULL
 */
    __pyx_v_g0 = utoi(0x7A120);

    /* "cypari/gen.pyx":3586
 *             t0 = objtogen(fa)
 *             g0 = t0.g
 *         elif flag & 1:             # <<<<<<<<<<<<<<
 *             g0 = utoi(500000)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":3589
 *             g0 = utoi(500000)
 *         else:
 *             g0 = NULL             # <<<<<<<<<<<<<<
 *         sig_on()
 *         B = new_gen_noclear(nfbasis(self.g, &disc, g0))
 */
  /*else*/ {
    __pyx_v_g0 = NULL;
  }
  __pyx_L3:;

  /* "cypari/gen.pyx":3590
 *         else:
 *             g0 = NULL
 *         sig_on()             # <<<<<<<<<<<<<<
 *         B = new_gen_noclear(nfbasis(self.g, &disc, g0))
 *         D = new_gen(disc)
 */
  __pyx_t_5 = sig_on(); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(6, 3590, __pyx_L1_error)

  /* "cypari/gen.pyx":3591
 *             g0 = NULL
 *         sig_on()
 *         B = new_gen_noclear(nfbasis(self.g, &disc, g0))             # <<<<<<<<<<<<<<
 *         D = new_gen(disc)
 *         return B, D
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(nfbasis(__pyx_v_self->__pyx_base.g, (&__pyx_v_disc), __pyx_v_g0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_B = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cypari/gen.pyx":3592
 *         sig_on()
 *         B = new_gen_noclear(nfbasis(self.g, &disc, g0))
 *         D = new_gen(disc)             # <<<<<<<<<<<<<<
 *         return B, D
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_disc)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3592, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_D = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "cypari/gen.pyx":3593
 *         B = new_gen_noclear(nfbasis(self.g, &disc, g0))
 *         D = new_gen(disc)
 *         return B, D             # <<<<<<<<<<<<<<
 * 
 *     def nfbasistoalg_lift(nf, x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_B));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_B));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_B));
  __Pyx_INCREF(((PyObject *)__pyx_v_D));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_D));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_D));
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3558
 *         return new_gen(nfbasis(self.g, NULL, g0))
 * 
 *     def nfbasis_d(self, long flag=0, fa=None):             # <<<<<<<<<<<<<<
 *         """
 *         Like :meth:`nfbasis`, but return a tuple ``(B, D)`` where `B`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.nfbasis_d", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_B);
  __Pyx_XDECREF((PyObject *)__pyx_v_D);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3595
 *         return B, D
 * 
 *     def nfbasistoalg_lift(nf, x):             # <<<<<<<<<<<<<<
 *         r"""
 *         Transforms the column vector ``x`` on the integral basis into a
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_223nfbasistoalg_lift(PyObject *__pyx_v_nf, PyObject *__pyx_v_x); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_222nfbasistoalg_lift[] = "\n        Transforms the column vector ``x`` on the integral basis into a\n        polynomial representing the algebraic number.\n\n        INPUT:\n\n         - ``nf`` -- a number field\n         - ``x`` -- a column of rational numbers of length equal to the\n           degree of ``nf`` or a single rational number\n\n        OUTPUT:\n\n         - ``nf.nfbasistoalg(x).lift()``\n\n        EXAMPLES::\n\n            sage: K = pari('x^3 - 17').nfinit()\n            sage: K.nf_get_zk()\n            [1, 1/3*x^2 - 1/3*x + 1/3, x]\n            sage: K.nfbasistoalg_lift(42)\n            42\n            sage: K.nfbasistoalg_lift(\"[3/2, -5, 0]~\")\n            -5/3*x^2 + 5/3*x - 1/6\n            sage: K.nf_get_zk() * pari(\"[3/2, -5, 0]~\")\n            -5/3*x^2 + 5/3*x - 1/6\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_223nfbasistoalg_lift(PyObject *__pyx_v_nf, PyObject *__pyx_v_x) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfbasistoalg_lift (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_222nfbasistoalg_lift(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_nf), ((PyObject *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_222nfbasistoalg_lift(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_nf, PyObject *__pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("nfbasistoalg_lift", 0);

  /* "cypari/gen.pyx":3622
 *             -5/3*x^2 + 5/3*x - 1/6
 *         """
 *         cdef Gen t0 = objtogen(x)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gel(basistoalg(nf.g, t0.g), 2))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3623
 *         """
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gel(basistoalg(nf.g, t0.g), 2))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3623, __pyx_L1_error)

  /* "cypari/gen.pyx":3624
 *         cdef Gen t0 = objtogen(x)
 *         sig_on()
 *         return new_gen(gel(basistoalg(nf.g, t0.g), 2))             # <<<<<<<<<<<<<<
 * 
 *     def nfgenerator(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gel(basistoalg(__pyx_v_nf->__pyx_base.g, __pyx_v_t0->__pyx_base.g), 2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3624, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3595
 *         return B, D
 * 
 *     def nfbasistoalg_lift(nf, x):             # <<<<<<<<<<<<<<
 *         r"""
 *         Transforms the column vector ``x`` on the integral basis into a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.nfbasistoalg_lift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3626
 *         return new_gen(gel(basistoalg(nf.g, t0.g), 2))
 * 
 *     def nfgenerator(self):             # <<<<<<<<<<<<<<
 *         f = self[0]
 *         x = f.variable()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_225nfgenerator(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_225nfgenerator(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nfgenerator (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_224nfgenerator(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_224nfgenerator(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nfgenerator", 0);

  /* "cypari/gen.pyx":3627
 * 
 *     def nfgenerator(self):
 *         f = self[0]             # <<<<<<<<<<<<<<
 *         x = f.variable()
 *         return x.Mod(f)
 */
  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_f = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3628
 *     def nfgenerator(self):
 *         f = self[0]
 *         x = f.variable()             # <<<<<<<<<<<<<<
 *         return x.Mod(f)
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_variable); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_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_1)) __PYX_ERR(6, 3628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3629
 *         f = self[0]
 *         x = f.variable()
 *         return x.Mod(f)             # <<<<<<<<<<<<<<
 * 
 *     def _nf_rnfeq(self, relpol):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_Mod); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_f) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_f);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3626
 *         return new_gen(gel(basistoalg(nf.g, t0.g), 2))
 * 
 *     def nfgenerator(self):             # <<<<<<<<<<<<<<
 *         f = self[0]
 *         x = f.variable()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.nfgenerator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3631
 *         return x.Mod(f)
 * 
 *     def _nf_rnfeq(self, relpol):             # <<<<<<<<<<<<<<
 *         """
 *         Return data for converting number field elements between
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_227_nf_rnfeq(PyObject *__pyx_v_self, PyObject *__pyx_v_relpol); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_226_nf_rnfeq[] = "\n        Return data for converting number field elements between\n        absolute and relative representation.\n\n        .. NOTE::\n\n            The output of this method is suitable for the methods\n            :meth:`_eltabstorel`, :meth:`_eltabstorel_lift` and\n            :meth:`_eltreltoabs`.\n\n        TESTS::\n\n            sage: K = pari('y^2 + 1').nfinit()\n            sage: K._nf_rnfeq('x^2 + 2')\n            [x^4 + 6*x^2 + 1, 1/2*x^3 + 5/2*x, -1, y^2 + 1, x^2 + 2]\n\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_227_nf_rnfeq(PyObject *__pyx_v_self, PyObject *__pyx_v_relpol) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_nf_rnfeq (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_226_nf_rnfeq(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_relpol));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_226_nf_rnfeq(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_relpol) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("_nf_rnfeq", 0);

  /* "cypari/gen.pyx":3649
 * 
 *         """
 *         cdef Gen t0 = objtogen(relpol)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(nf_rnfeq(self.g, t0.g))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_relpol, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3649, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3650
 *         """
 *         cdef Gen t0 = objtogen(relpol)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(nf_rnfeq(self.g, t0.g))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3650, __pyx_L1_error)

  /* "cypari/gen.pyx":3651
 *         cdef Gen t0 = objtogen(relpol)
 *         sig_on()
 *         return new_gen(nf_rnfeq(self.g, t0.g))             # <<<<<<<<<<<<<<
 * 
 *     def eval(self, *args, **kwds):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(nf_rnfeq(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3651, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3631
 *         return x.Mod(f)
 * 
 *     def _nf_rnfeq(self, relpol):             # <<<<<<<<<<<<<<
 *         """
 *         Return data for converting number field elements between
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen._nf_rnfeq", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3653
 *         return new_gen(nf_rnfeq(self.g, t0.g))
 * 
 *     def eval(self, *args, **kwds):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluate ``self`` with the given arguments.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_229eval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_228eval[] = "\n        Evaluate ``self`` with the given arguments.\n\n        This is currently implemented in 3 cases:\n\n        - univariate polynomials, rational functions, power series and\n          Laurent series (using a single unnamed argument or keyword\n          arguments),\n        - any PARI object supporting the PARI function :pari:`substvec`\n          (in particular, multivariate polynomials) using keyword\n          arguments,\n        - objects of type ``t_CLOSURE`` (functions in GP bytecode form)\n          using unnamed arguments.\n\n        In no case is mixing unnamed and keyword arguments allowed.\n\n        EXAMPLES::\n\n            sage: f = pari('x^2 + 1')\n            sage: f.type()\n            't_POL'\n            sage: f.eval(pari('I'))\n            0\n            sage: f.eval(x=2)\n            5\n            sage: (1/f).eval(x=1)\n            1/2\n\n        The notation ``f(x)`` is an alternative for ``f.eval(x)``::\n\n            sage: f(3) == f.eval(3)\n            True\n\n        Evaluating power series::\n\n            sage: f = pari('1 + x + x^3 + O(x^7)')\n            sage: f(2*pari('y')**2)\n            1 + 2*y^2 + 8*y^6 + O(y^14)\n\n        Substituting zero is sometimes possible, and trying to do so\n        in illegal cases can raise various errors::\n\n            sage: pari('1 + O(x^3)').eval(0)\n            1\n            sage: pari('1/x').eval(0)\n            Traceback (most recent call last):\n            ...\n            PariError: impossible inverse in gdiv: 0\n            sage: pari('1/x + O(x^2)').eval(0)\n            Traceback (most recent call last):\n            ...\n            PariError: impossible inverse in gsubst: 0\n            sage: pari('1/x + O(x^2)').eval(pari('O(x^3)'))\n            Traceback (most recent call last):\n            ...\n            PariError: impossible inverse in gdiv: O(x^3)\n            sage: pari('O(x^0)').eval(0)\n            Traceback (most recent call last):\n            ...\n            PariE""rror: forbidden substitution t_SER , t_INT\n\n        Evaluating multivariate polynomials::\n\n            sage: f = pari('y^2 + x^3')\n            sage: f(1)    # Dangerous, depends on PARI variable ordering\n            y^2 + 1\n            sage: f(x=1)  # Safe\n            y^2 + 1\n            sage: f(y=1)\n            x^3 + 1\n            sage: f(1, 2)\n            Traceback (most recent call last):\n            ...\n            TypeError: evaluating PARI t_POL takes exactly 1 argument (2 given)\n            sage: f(y='x', x='2*y')\n            x^2 + 8*y^3\n            sage: f()\n            x^3 + y^2\n\n        It's not an error to substitute variables which do not appear::\n\n            sage: f.eval(z=37)\n            x^3 + y^2\n            sage: pari(42).eval(t=0)\n            42\n\n        We can define and evaluate closures as follows::\n\n            sage: T = pari('n -> n + 2')\n            sage: T.type()\n            't_CLOSURE'\n            sage: T.eval(3)\n            5\n\n            sage: T = pari('() -> 42')\n            sage: T()\n            42\n\n            sage: pr = pari('s -> print(s)')\n            sage: pr.eval('\"hello world\"')\n            hello world\n\n            sage: f = pari('myfunc(x,y) = x*y')\n            sage: f.eval(5, 6)\n            30\n\n        Default arguments work, missing arguments are treated as zero\n        (like in GP)::\n\n            sage: f = pari(\"(x, y, z=1.0) -> [x, y, z]\")\n            sage: f(1, 2, 3)\n            [1, 2, 3]\n            sage: f(1, 2)\n            [1, 2, 1.00000000000000]\n            sage: f(1)\n            [1, 0, 1.00000000000000]\n            sage: f()\n            [0, 0, 1.00000000000000]\n\n        Variadic closures are supported as well (:trac:`18623`)::\n\n            sage: f = pari(\"(v[..])->length(v)\")\n            sage: f('a', f)\n            2\n            sage: g = pari(\"(x,y,z[..])->[x,y,z]\")\n            sage: g(), g(1), g(1,2), g(1,2,3), g(1,2,3,4)\n            ([0, 0, ""[]], [1, 0, []], [1, 2, []], [1, 2, [3]], [1, 2, [3, 4]])\n\n        Using keyword arguments, we can substitute in more complicated\n        objects, for example a number field::\n\n            sage: nf = pari('x^2 + 1').nfinit()\n            sage: nf\n            [x^2 + 1, [0, 1], -4, 1, [Mat([1, 0.E-38 + 1.00000000000000*I]), [1, 1.00000000000000; 1, -1.00000000000000], [1, 1; 1, -1], [2, 0; 0, -2], [2, 0; 0, 2], [1, 0; 0, -1], [1, [0, -1; 1, 0]], [2]], [0.E-38 + 1.00000000000000*I], [1, x], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, 0]]\n            sage: nf(x='y')\n            [y^2 + 1, [0, 1], -4, 1, [Mat([1, 0.E-38 + 1.00000000000000*I]), [1, 1.00000000000000; 1, -1.00000000000000], [1, 1; 1, -1], [2, 0; 0, -2], [2, 0; 0, 2], [1, 0; 0, -1], [1, [0, -1; 1, 0]], [2]], [0.E-38 + 1.00000000000000*I], [1, y], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, 0]]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_229eval(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwds = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("eval (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "eval", 1))) return NULL;
  __pyx_v_kwds = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New(); if (unlikely(!__pyx_v_kwds)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwds);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_228eval(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_args, __pyx_v_kwds);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwds);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_228eval(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwds) {
  long __pyx_v_t;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  GEN __pyx_v_result;
  __pyx_t_6cypari_8paridecl_pari_longword __pyx_v_arity;
  Py_ssize_t __pyx_v_nargs;
  Py_ssize_t __pyx_v_nkwds;
  PyObject *__pyx_v_vstr = NULL;
  GEN __pyx_v_v;
  long __pyx_v_i;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  long __pyx_t_10;
  long __pyx_t_11;
  __Pyx_RefNannySetupContext("eval", 0);
  __Pyx_INCREF(__pyx_v_args);

  /* "cypari/gen.pyx":3791
 *             [y^2 + 1, [0, 1], -4, 1, [Mat([1, 0.E-38 + 1.00000000000000*I]), [1, 1.00000000000000; 1, -1.00000000000000], [1, 1; 1, -1], [2, 0; 0, -2], [2, 0; 0, 2], [1, 0; 0, -1], [1, [0, -1; 1, 0]], [2]], [0.E-38 + 1.00000000000000*I], [1, y], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, 0]]
 *         """
 *         cdef long t = typ(self.g)             # <<<<<<<<<<<<<<
 *         cdef Gen t0
 *         cdef GEN result
 */
  __pyx_v_t = typ(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":3795
 *         cdef GEN result
 *         cdef pari_longword arity
 *         cdef Py_ssize_t nargs = len(args)             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t nkwds = len(kwds)
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(6, 3795, __pyx_L1_error)
  __pyx_v_nargs = __pyx_t_1;

  /* "cypari/gen.pyx":3796
 *         cdef pari_longword arity
 *         cdef Py_ssize_t nargs = len(args)
 *         cdef Py_ssize_t nkwds = len(kwds)             # <<<<<<<<<<<<<<
 * 
 *         # Closure must be evaluated using *args
 */
  __pyx_t_1 = PyDict_Size(__pyx_v_kwds); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(6, 3796, __pyx_L1_error)
  __pyx_v_nkwds = __pyx_t_1;

  /* "cypari/gen.pyx":3799
 * 
 *         # Closure must be evaluated using *args
 *         if t == t_CLOSURE:             # <<<<<<<<<<<<<<
 *             if nkwds > 0:
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")
 */
  __pyx_t_2 = ((__pyx_v_t == t_CLOSURE) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3800
 *         # Closure must be evaluated using *args
 *         if t == t_CLOSURE:
 *             if nkwds > 0:             # <<<<<<<<<<<<<<
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")
 *             if closure_is_variadic(self.g):
 */
    __pyx_t_2 = ((__pyx_v_nkwds > 0) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "cypari/gen.pyx":3801
 *         if t == t_CLOSURE:
 *             if nkwds > 0:
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")             # <<<<<<<<<<<<<<
 *             if closure_is_variadic(self.g):
 *                 arity = closure_arity(self.g) - 1
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3801, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(6, 3801, __pyx_L1_error)

      /* "cypari/gen.pyx":3800
 *         # Closure must be evaluated using *args
 *         if t == t_CLOSURE:
 *             if nkwds > 0:             # <<<<<<<<<<<<<<
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")
 *             if closure_is_variadic(self.g):
 */
    }

    /* "cypari/gen.pyx":3802
 *             if nkwds > 0:
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")
 *             if closure_is_variadic(self.g):             # <<<<<<<<<<<<<<
 *                 arity = closure_arity(self.g) - 1
 *                 args = list(args[:arity]) + [0]*(arity-nargs) + [args[arity:]]
 */
    __pyx_t_2 = (closure_is_variadic(__pyx_v_self->__pyx_base.g) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":3803
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")
 *             if closure_is_variadic(self.g):
 *                 arity = closure_arity(self.g) - 1             # <<<<<<<<<<<<<<
 *                 args = list(args[:arity]) + [0]*(arity-nargs) + [args[arity:]]
 *             t0 = objtogen(args)
 */
      __pyx_v_arity = (closure_arity(__pyx_v_self->__pyx_base.g) - 1);

      /* "cypari/gen.pyx":3804
 *             if closure_is_variadic(self.g):
 *                 arity = closure_arity(self.g) - 1
 *                 args = list(args[:arity]) + [0]*(arity-nargs) + [args[arity:]]             # <<<<<<<<<<<<<<
 *             t0 = objtogen(args)
 *             sig_on()
 */
      __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_args, 0, __pyx_v_arity, NULL, NULL, NULL, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(1 * (((__pyx_v_arity - __pyx_v_nargs)<0) ? 0:(__pyx_v_arity - __pyx_v_nargs))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      { Py_ssize_t __pyx_temp;
        for (__pyx_temp=0; __pyx_temp < (__pyx_v_arity - __pyx_v_nargs); __pyx_temp++) {
          __Pyx_INCREF(__pyx_int_0);
          __Pyx_GIVEREF(__pyx_int_0);
          PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_int_0);
        }
      }
      __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_args, __pyx_v_arity, 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3804, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "cypari/gen.pyx":3802
 *             if nkwds > 0:
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")
 *             if closure_is_variadic(self.g):             # <<<<<<<<<<<<<<
 *                 arity = closure_arity(self.g) - 1
 *                 args = list(args[:arity]) + [0]*(arity-nargs) + [args[arity:]]
 */
    }

    /* "cypari/gen.pyx":3805
 *                 arity = closure_arity(self.g) - 1
 *                 args = list(args[:arity]) + [0]*(arity-nargs) + [args[arity:]]
 *             t0 = objtogen(args)             # <<<<<<<<<<<<<<
 *             sig_on()
 *             result = closure_callgenvec(self.g, t0.g)
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_args, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3805, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "cypari/gen.pyx":3806
 *                 args = list(args[:arity]) + [0]*(arity-nargs) + [args[arity:]]
 *             t0 = objtogen(args)
 *             sig_on()             # <<<<<<<<<<<<<<
 *             result = closure_callgenvec(self.g, t0.g)
 *             if result == gnil:
 */
    __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(6, 3806, __pyx_L1_error)

    /* "cypari/gen.pyx":3807
 *             t0 = objtogen(args)
 *             sig_on()
 *             result = closure_callgenvec(self.g, t0.g)             # <<<<<<<<<<<<<<
 *             if result == gnil:
 *                 clear_stack()
 */
    __pyx_v_result = closure_callgenvec(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g);

    /* "cypari/gen.pyx":3808
 *             sig_on()
 *             result = closure_callgenvec(self.g, t0.g)
 *             if result == gnil:             # <<<<<<<<<<<<<<
 *                 clear_stack()
 *                 return None
 */
    __pyx_t_2 = ((__pyx_v_result == gnil) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":3809
 *             result = closure_callgenvec(self.g, t0.g)
 *             if result == gnil:
 *                 clear_stack()             # <<<<<<<<<<<<<<
 *                 return None
 *             return new_gen(result)
 */
      __pyx_f_6cypari_5_pari_clear_stack();

      /* "cypari/gen.pyx":3810
 *             if result == gnil:
 *                 clear_stack()
 *                 return None             # <<<<<<<<<<<<<<
 *             return new_gen(result)
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "cypari/gen.pyx":3808
 *             sig_on()
 *             result = closure_callgenvec(self.g, t0.g)
 *             if result == gnil:             # <<<<<<<<<<<<<<
 *                 clear_stack()
 *                 return None
 */
    }

    /* "cypari/gen.pyx":3811
 *                 clear_stack()
 *                 return None
 *             return new_gen(result)             # <<<<<<<<<<<<<<
 * 
 *         # Evaluate univariate polynomials, rational functions and
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_result)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":3799
 * 
 *         # Closure must be evaluated using *args
 *         if t == t_CLOSURE:             # <<<<<<<<<<<<<<
 *             if nkwds > 0:
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")
 */
  }

  /* "cypari/gen.pyx":3815
 *         # Evaluate univariate polynomials, rational functions and
 *         # series using *args
 *         if nargs > 0:             # <<<<<<<<<<<<<<
 *             if nkwds > 0:
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")
 */
  __pyx_t_2 = ((__pyx_v_nargs > 0) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":3816
 *         # series using *args
 *         if nargs > 0:
 *             if nkwds > 0:             # <<<<<<<<<<<<<<
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):
 */
    __pyx_t_2 = ((__pyx_v_nkwds > 0) != 0);
    if (unlikely(__pyx_t_2)) {

      /* "cypari/gen.pyx":3817
 *         if nargs > 0:
 *             if nkwds > 0:
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")             # <<<<<<<<<<<<<<
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3817, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(6, 3817, __pyx_L1_error)

      /* "cypari/gen.pyx":3816
 *         # series using *args
 *         if nargs > 0:
 *             if nkwds > 0:             # <<<<<<<<<<<<<<
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):
 */
    }

    /* "cypari/gen.pyx":3818
 *             if nkwds > 0:
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):             # <<<<<<<<<<<<<<
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())
 *             if nargs != 1:
 */
    switch (__pyx_v_t) {
      case t_POL:
      case t_RFRAC:
      case t_SER:
      __pyx_t_2 = 1;
      break;
      default:
      __pyx_t_2 = 0;
      break;
    }
    __pyx_t_7 = ((!__pyx_t_2) != 0);
    if (unlikely(__pyx_t_7)) {

      /* "cypari/gen.pyx":3819
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())             # <<<<<<<<<<<<<<
 *             if nargs != 1:
 *                 raise TypeError("evaluating PARI %s takes exactly 1 argument (%d given)"
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3819, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3819, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_FormatSafe(__pyx_kp_s_cannot_evaluate_PARI_s_using_unn, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3819, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3819, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(6, 3819, __pyx_L1_error)

      /* "cypari/gen.pyx":3818
 *             if nkwds > 0:
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):             # <<<<<<<<<<<<<<
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())
 *             if nargs != 1:
 */
    }

    /* "cypari/gen.pyx":3820
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())
 *             if nargs != 1:             # <<<<<<<<<<<<<<
 *                 raise TypeError("evaluating PARI %s takes exactly 1 argument (%d given)"
 *                                 % (self.type(), nargs))
 */
    __pyx_t_7 = ((__pyx_v_nargs != 1) != 0);
    if (unlikely(__pyx_t_7)) {

      /* "cypari/gen.pyx":3822
 *             if nargs != 1:
 *                 raise TypeError("evaluating PARI %s takes exactly 1 argument (%d given)"
 *                                 % (self.type(), nargs))             # <<<<<<<<<<<<<<
 * 
 *             t0 = objtogen(args[0])
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3822, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3822, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3822, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3822, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_evaluating_PARI_s_takes_exactly, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3822, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "cypari/gen.pyx":3821
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())
 *             if nargs != 1:
 *                 raise TypeError("evaluating PARI %s takes exactly 1 argument (%d given)"             # <<<<<<<<<<<<<<
 *                                 % (self.type(), nargs))
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3821, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(6, 3821, __pyx_L1_error)

      /* "cypari/gen.pyx":3820
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())
 *             if nargs != 1:             # <<<<<<<<<<<<<<
 *                 raise TypeError("evaluating PARI %s takes exactly 1 argument (%d given)"
 *                                 % (self.type(), nargs))
 */
    }

    /* "cypari/gen.pyx":3824
 *                                 % (self.type(), nargs))
 * 
 *             t0 = objtogen(args[0])             # <<<<<<<<<<<<<<
 *             sig_on()
 *             if t == t_POL or t == t_RFRAC:
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_args, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3824, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_t_5, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3824, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "cypari/gen.pyx":3825
 * 
 *             t0 = objtogen(args[0])
 *             sig_on()             # <<<<<<<<<<<<<<
 *             if t == t_POL or t == t_RFRAC:
 *                 return new_gen(poleval(self.g, t0.g))
 */
    __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(6, 3825, __pyx_L1_error)

    /* "cypari/gen.pyx":3826
 *             t0 = objtogen(args[0])
 *             sig_on()
 *             if t == t_POL or t == t_RFRAC:             # <<<<<<<<<<<<<<
 *                 return new_gen(poleval(self.g, t0.g))
 *             else:  # t == t_SER
 */
    switch (__pyx_v_t) {
      case t_POL:
      case t_RFRAC:

      /* "cypari/gen.pyx":3827
 *             sig_on()
 *             if t == t_POL or t == t_RFRAC:
 *                 return new_gen(poleval(self.g, t0.g))             # <<<<<<<<<<<<<<
 *             else:  # t == t_SER
 *                 return new_gen(gsubst(self.g, varn(self.g), t0.g))
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(poleval(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

      /* "cypari/gen.pyx":3826
 *             t0 = objtogen(args[0])
 *             sig_on()
 *             if t == t_POL or t == t_RFRAC:             # <<<<<<<<<<<<<<
 *                 return new_gen(poleval(self.g, t0.g))
 *             else:  # t == t_SER
 */
      break;
      default:

      /* "cypari/gen.pyx":3829
 *                 return new_gen(poleval(self.g, t0.g))
 *             else:  # t == t_SER
 *                 return new_gen(gsubst(self.g, varn(self.g), t0.g))             # <<<<<<<<<<<<<<
 * 
 *         # Call substvec() using **kwds
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gsubst(__pyx_v_self->__pyx_base.g, varn(__pyx_v_self->__pyx_base.g), __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;
      break;
    }

    /* "cypari/gen.pyx":3815
 *         # Evaluate univariate polynomials, rational functions and
 *         # series using *args
 *         if nargs > 0:             # <<<<<<<<<<<<<<
 *             if nkwds > 0:
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")
 */
  }

  /* "cypari/gen.pyx":3832
 * 
 *         # Call substvec() using **kwds
 *         vstr = [k for k in kwds]               # Variables as Python strings             # <<<<<<<<<<<<<<
 *         t0 = objtogen([kwds[k] for k in kwds])  # Replacements
 * 
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_kwds, 1, ((PyObject *)NULL), (&__pyx_t_8), (&__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3832, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __pyx_t_5 = __pyx_t_3;
  __pyx_t_3 = 0;
  while (1) {
    __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_8, &__pyx_t_1, &__pyx_t_3, NULL, NULL, __pyx_t_6);
    if (unlikely(__pyx_t_9 == 0)) break;
    if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(6, 3832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
    __pyx_t_3 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_v_k))) __PYX_ERR(6, 3832, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_vstr = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cypari/gen.pyx":3833
 *         # Call substvec() using **kwds
 *         vstr = [k for k in kwds]               # Variables as Python strings
 *         t0 = objtogen([kwds[k] for k in kwds])  # Replacements             # <<<<<<<<<<<<<<
 * 
 *         sig_on()
 */
  __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = 0;
  __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_kwds, 1, ((PyObject *)NULL), (&__pyx_t_1), (&__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __pyx_t_5 = __pyx_t_3;
  __pyx_t_3 = 0;
  while (1) {
    __pyx_t_9 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_1, &__pyx_t_8, &__pyx_t_3, NULL, NULL, __pyx_t_6);
    if (unlikely(__pyx_t_9 == 0)) break;
    if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(6, 3833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_kwds, __pyx_v_k); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3833, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_3))) __PYX_ERR(6, 3833, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_t_4, 0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "cypari/gen.pyx":3835
 *         t0 = objtogen([kwds[k] for k in kwds])  # Replacements
 * 
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef GEN v = cgetg(nkwds+1, t_VEC)  # Variables as PARI polynomials
 *         cdef long i
 */
  __pyx_t_6 = sig_on(); if (unlikely(__pyx_t_6 == ((int)0))) __PYX_ERR(6, 3835, __pyx_L1_error)

  /* "cypari/gen.pyx":3836
 * 
 *         sig_on()
 *         cdef GEN v = cgetg(nkwds+1, t_VEC)  # Variables as PARI polynomials             # <<<<<<<<<<<<<<
 *         cdef long i
 *         for i in range(nkwds):
 */
  __pyx_v_v = cgetg((__pyx_v_nkwds + 1), t_VEC);

  /* "cypari/gen.pyx":3838
 *         cdef GEN v = cgetg(nkwds+1, t_VEC)  # Variables as PARI polynomials
 *         cdef long i
 *         for i in range(nkwds):             # <<<<<<<<<<<<<<
 *             set_gel(v, i+1, pol_x(get_var(vstr[i])))
 *         return new_gen(gsubstvec(self.g, v, t0.g))
 */
  __pyx_t_1 = __pyx_v_nkwds;
  __pyx_t_8 = __pyx_t_1;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_8; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "cypari/gen.pyx":3839
 *         cdef long i
 *         for i in range(nkwds):
 *             set_gel(v, i+1, pol_x(get_var(vstr[i])))             # <<<<<<<<<<<<<<
 *         return new_gen(gsubstvec(self.g, v, t0.g))
 * 
 */
    __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_vstr, __pyx_v_i, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3839, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __pyx_f_6cypari_5_pari_get_var(__pyx_t_5); if (unlikely(__pyx_t_11 == ((long)-2L))) __PYX_ERR(6, 3839, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    (void)(set_gel(__pyx_v_v, (__pyx_v_i + 1), pol_x(__pyx_t_11)));
  }

  /* "cypari/gen.pyx":3840
 *         for i in range(nkwds):
 *             set_gel(v, i+1, pol_x(get_var(vstr[i])))
 *         return new_gen(gsubstvec(self.g, v, t0.g))             # <<<<<<<<<<<<<<
 * 
 *     def __call__(self, *args, **kwds):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gsubstvec(__pyx_v_self->__pyx_base.g, __pyx_v_v, __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 3840, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3653
 *         return new_gen(nf_rnfeq(self.g, t0.g))
 * 
 *     def eval(self, *args, **kwds):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluate ``self`` with the given arguments.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.Gen.eval", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF(__pyx_v_vstr);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3842
 *         return new_gen(gsubstvec(self.g, v, t0.g))
 * 
 *     def __call__(self, *args, **kwds):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluate ``self`` with the given arguments.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_231__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_230__call__[] = "\n        Evaluate ``self`` with the given arguments.\n\n        This has the same effect as :meth:`eval`.\n\n        EXAMPLES::\n\n            sage: f = pari('Mod(x^2 + x + 1, 3)')\n            sage: f.type()\n            't_POL'\n            sage: f(2)\n            Mod(1, 3)\n\n        TESTS::\n\n            sage: T = pari('n -> 1/n')\n            sage: T.type()\n            't_CLOSURE'\n            sage: T(0)\n            Traceback (most recent call last):\n            ...\n            PariError: _/_: impossible inverse in gdiv: 0\n            sage: pari('() -> 42')(1,2,3)\n            Traceback (most recent call last):\n            ...\n            PariError: too many parameters in user-defined function call\n            sage: pari('n -> n')(n=2)\n            Traceback (most recent call last):\n            ...\n            TypeError: cannot evaluate a PARI closure using keyword arguments\n            sage: pari('x + y')(4, y=1)\n            Traceback (most recent call last):\n            ...\n            TypeError: mixing unnamed and keyword arguments not allowed when evaluating a PARI object\n            sage: pari(\"12345\")(4)\n            Traceback (most recent call last):\n            ...\n            TypeError: cannot evaluate PARI t_INT using unnamed arguments\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_6cypari_5_pari_3Gen_230__call__;
#endif
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_231__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwds = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__call__", 1))) return NULL;
  if (unlikely(__pyx_kwds)) {
    __pyx_v_kwds = PyDict_Copy(__pyx_kwds); if (unlikely(!__pyx_v_kwds)) return NULL;
    __Pyx_GOTREF(__pyx_v_kwds);
  } else {
    __pyx_v_kwds = NULL;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_230__call__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_args, __pyx_v_kwds);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwds);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_230__call__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwds) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__call__", 0);

  /* "cypari/gen.pyx":3882
 *             TypeError: cannot evaluate PARI t_INT using unnamed arguments
 *         """
 *         return self.eval(*args, **kwds)             # <<<<<<<<<<<<<<
 * 
 *     def factorpadic(self, p, long r=20):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_eval); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_v_kwds); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3842
 *         return new_gen(gsubstvec(self.g, v, t0.g))
 * 
 *     def __call__(self, *args, **kwds):             # <<<<<<<<<<<<<<
 *         """
 *         Evaluate ``self`` with the given arguments.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3884
 *         return self.eval(*args, **kwds)
 * 
 *     def factorpadic(self, p, long r=20):             # <<<<<<<<<<<<<<
 *         """
 *         p-adic factorization of the polynomial ``pol`` to precision ``r``.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_233factorpadic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_232factorpadic[] = "\n        p-adic factorization of the polynomial ``pol`` to precision ``r``.\n\n        EXAMPLES::\n\n            sage: pol = pari('x^2 - 1')**2\n            sage: pari(pol).factorpadic(5)\n            [(1 + O(5^20))*x + (1 + O(5^20)), 2; (1 + O(5^20))*x + (4 + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + 4*5^6 + 4*5^7 + 4*5^8 + 4*5^9 + 4*5^10 + 4*5^11 + 4*5^12 + 4*5^13 + 4*5^14 + 4*5^15 + 4*5^16 + 4*5^17 + 4*5^18 + 4*5^19 + O(5^20)), 2]\n            sage: pari(pol).factorpadic(5,3)\n            [(1 + O(5^3))*x + (1 + O(5^3)), 2; (1 + O(5^3))*x + (4 + 4*5 + 4*5^2 + O(5^3)), 2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_233factorpadic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_p = 0;
  long __pyx_v_r;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factorpadic (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_r,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_p)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_r);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factorpadic") < 0)) __PYX_ERR(6, 3884, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_p = values[0];
    if (values[1]) {
      __pyx_v_r = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_r == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3884, __pyx_L3_error)
    } else {
      __pyx_v_r = ((long)20);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factorpadic", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3884, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.factorpadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_232factorpadic(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_p, __pyx_v_r);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_232factorpadic(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_p, long __pyx_v_r) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("factorpadic", 0);

  /* "cypari/gen.pyx":3896
 *             [(1 + O(5^3))*x + (1 + O(5^3)), 2; (1 + O(5^3))*x + (4 + 4*5 + 4*5^2 + O(5^3)), 2]
 *         """
 *         cdef Gen t0 = objtogen(p)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(factorpadic(self.g, t0.g, r))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_p, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3896, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3897
 *         """
 *         cdef Gen t0 = objtogen(p)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(factorpadic(self.g, t0.g, r))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3897, __pyx_L1_error)

  /* "cypari/gen.pyx":3898
 *         cdef Gen t0 = objtogen(p)
 *         sig_on()
 *         return new_gen(factorpadic(self.g, t0.g, r))             # <<<<<<<<<<<<<<
 * 
 *     def poldegree(self, var=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(factorpadic(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g, __pyx_v_r))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3898, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3884
 *         return self.eval(*args, **kwds)
 * 
 *     def factorpadic(self, p, long r=20):             # <<<<<<<<<<<<<<
 *         """
 *         p-adic factorization of the polynomial ``pol`` to precision ``r``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.factorpadic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3900
 *         return new_gen(factorpadic(self.g, t0.g, r))
 * 
 *     def poldegree(self, var=-1):             # <<<<<<<<<<<<<<
 *         """
 *         Return the degree of this polynomial.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_235poldegree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_234poldegree[] = "\n        Return the degree of this polynomial.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_235poldegree(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_var = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("poldegree (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_var,0};
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_neg_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_var);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "poldegree") < 0)) __PYX_ERR(6, 3900, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_var = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poldegree", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3900, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.poldegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_234poldegree(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_var);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_234poldegree(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_var) {
  long __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("poldegree", 0);

  /* "cypari/gen.pyx":3904
 *         Return the degree of this polynomial.
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long n = <long>poldegree(self.g, get_var(var))
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3904, __pyx_L1_error)

  /* "cypari/gen.pyx":3905
 *         """
 *         sig_on()
 *         cdef long n = <long>poldegree(self.g, get_var(var))             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return n
 */
  __pyx_t_2 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_var); if (unlikely(__pyx_t_2 == ((long)-2L))) __PYX_ERR(6, 3905, __pyx_L1_error)
  __pyx_v_n = ((long)poldegree(__pyx_v_self->__pyx_base.g, __pyx_t_2));

  /* "cypari/gen.pyx":3906
 *         sig_on()
 *         cdef long n = <long>poldegree(self.g, get_var(var))
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return n
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":3907
 *         cdef long n = <long>poldegree(self.g, get_var(var))
 *         sig_off()
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def polisirreducible(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3907, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3900
 *         return new_gen(factorpadic(self.g, t0.g, r))
 * 
 *     def poldegree(self, var=-1):             # <<<<<<<<<<<<<<
 *         """
 *         Return the degree of this polynomial.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.poldegree", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3909
 *         return n
 * 
 *     def polisirreducible(self):             # <<<<<<<<<<<<<<
 *         """
 *         f.polisirreducible(): Returns True if f is an irreducible
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_237polisirreducible(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_236polisirreducible[] = "\n        f.polisirreducible(): Returns True if f is an irreducible\n        non-constant polynomial, or False if f is reducible or constant.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_237polisirreducible(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polisirreducible (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_236polisirreducible(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_236polisirreducible(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("polisirreducible", 0);

  /* "cypari/gen.pyx":3914
 *         non-constant polynomial, or False if f is reducible or constant.
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         cdef long t = <long>isirreducible(self.g)
 *         clear_stack()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3914, __pyx_L1_error)

  /* "cypari/gen.pyx":3915
 *         """
 *         sig_on()
 *         cdef long t = <long>isirreducible(self.g)             # <<<<<<<<<<<<<<
 *         clear_stack()
 *         return t != 0
 */
  __pyx_v_t = ((long)isirreducible(__pyx_v_self->__pyx_base.g));

  /* "cypari/gen.pyx":3916
 *         sig_on()
 *         cdef long t = <long>isirreducible(self.g)
 *         clear_stack()             # <<<<<<<<<<<<<<
 *         return t != 0
 * 
 */
  __pyx_f_6cypari_5_pari_clear_stack();

  /* "cypari/gen.pyx":3917
 *         cdef long t = <long>isirreducible(self.g)
 *         clear_stack()
 *         return t != 0             # <<<<<<<<<<<<<<
 * 
 *     def polroots(self, unsigned long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_t != 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3917, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3909
 *         return n
 * 
 *     def polisirreducible(self):             # <<<<<<<<<<<<<<
 *         """
 *         f.polisirreducible(): Returns True if f is an irreducible
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.polisirreducible", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3919
 *         return t != 0
 * 
 *     def polroots(self, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         Complex roots of the given polynomial using Schonhage's method,
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_239polroots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_238polroots[] = "\n        Complex roots of the given polynomial using Schonhage's method,\n        as modified by Gourdon.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_239polroots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polroots (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_precision,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_precision);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polroots") < 0)) __PYX_ERR(6, 3919, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3919, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polroots", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3919, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.polroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_238polroots(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_238polroots(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, unsigned long __pyx_v_precision) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("polroots", 0);

  /* "cypari/gen.pyx":3924
 *         as modified by Gourdon.
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(cleanroots(self.g, prec_bits_to_words(precision)))
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3924, __pyx_L1_error)

  /* "cypari/gen.pyx":3925
 *         """
 *         sig_on()
 *         return new_gen(cleanroots(self.g, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 * 
 *     def rnfisnorm(self, T, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(cleanroots(__pyx_v_self->__pyx_base.g, __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3925, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3919
 *         return t != 0
 * 
 *     def polroots(self, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         Complex roots of the given polynomial using Schonhage's method,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.polroots", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3927
 *         return new_gen(cleanroots(self.g, prec_bits_to_words(precision)))
 * 
 *     def rnfisnorm(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         cdef Gen t0 = objtogen(T)
 *         sig_on()
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_241rnfisnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_241rnfisnorm(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_T = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rnfisnorm (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_T,&__pyx_n_s_flag,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_T)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rnfisnorm") < 0)) __PYX_ERR(6, 3927, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_T = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3927, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rnfisnorm", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3927, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.rnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_240rnfisnorm(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_T, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_240rnfisnorm(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_T, long __pyx_v_flag) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("rnfisnorm", 0);

  /* "cypari/gen.pyx":3928
 * 
 *     def rnfisnorm(self, T, long flag=0):
 *         cdef Gen t0 = objtogen(T)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(rnfisnorm(t0.g, self.g, flag))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_T, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3928, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":3929
 *     def rnfisnorm(self, T, long flag=0):
 *         cdef Gen t0 = objtogen(T)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(rnfisnorm(t0.g, self.g, flag))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 3929, __pyx_L1_error)

  /* "cypari/gen.pyx":3930
 *         cdef Gen t0 = objtogen(T)
 *         sig_on()
 *         return new_gen(rnfisnorm(t0.g, self.g, flag))             # <<<<<<<<<<<<<<
 * 
 *     def ncols(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(rnfisnorm(__pyx_v_t0->__pyx_base.g, __pyx_v_self->__pyx_base.g, __pyx_v_flag))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3927
 *         return new_gen(cleanroots(self.g, prec_bits_to_words(precision)))
 * 
 *     def rnfisnorm(self, T, long flag=0):             # <<<<<<<<<<<<<<
 *         cdef Gen t0 = objtogen(T)
 *         sig_on()
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.rnfisnorm", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3932
 *         return new_gen(rnfisnorm(t0.g, self.g, flag))
 * 
 *     def ncols(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the number of columns of self.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_243ncols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_242ncols[] = "\n        Return the number of columns of self.\n\n        EXAMPLES::\n\n            sage: pari('matrix(19,8)').ncols()\n            8\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_243ncols(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ncols (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_242ncols(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_242ncols(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("ncols", 0);

  /* "cypari/gen.pyx":3942
 *         """
 *         cdef long n
 *         sig_on()             # <<<<<<<<<<<<<<
 *         n = <long>glength(self.g)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3942, __pyx_L1_error)

  /* "cypari/gen.pyx":3943
 *         cdef long n
 *         sig_on()
 *         n = <long>glength(self.g)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return n
 */
  __pyx_v_n = ((long)glength(__pyx_v_self->__pyx_base.g));

  /* "cypari/gen.pyx":3944
 *         sig_on()
 *         n = <long>glength(self.g)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return n
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":3945
 *         n = <long>glength(self.g)
 *         sig_off()
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def nrows(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3945, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3932
 *         return new_gen(rnfisnorm(t0.g, self.g, flag))
 * 
 *     def ncols(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the number of columns of self.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.ncols", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3947
 *         return n
 * 
 *     def nrows(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the number of rows of self.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_245nrows(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_244nrows[] = "\n        Return the number of rows of self.\n\n        EXAMPLES::\n\n            sage: pari('matrix(19,8)').nrows()\n            19\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_245nrows(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nrows (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_244nrows(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_244nrows(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("nrows", 0);

  /* "cypari/gen.pyx":3957
 *         """
 *         cdef long n
 *         sig_on()             # <<<<<<<<<<<<<<
 *         # if this matrix has no columns
 *         # then it has no rows.
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3957, __pyx_L1_error)

  /* "cypari/gen.pyx":3960
 *         # if this matrix has no columns
 *         # then it has no rows.
 *         if self.ncols() == 0:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             return 0
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_ncols); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3960, __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(6, 3960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(6, 3960, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "cypari/gen.pyx":3961
 *         # then it has no rows.
 *         if self.ncols() == 0:
 *             sig_off()             # <<<<<<<<<<<<<<
 *             return 0
 *         n = <long>glength(<GEN>(self.g[1]))
 */
    sig_off();

    /* "cypari/gen.pyx":3962
 *         if self.ncols() == 0:
 *             sig_off()
 *             return 0             # <<<<<<<<<<<<<<
 *         n = <long>glength(<GEN>(self.g[1]))
 *         sig_off()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":3960
 *         # if this matrix has no columns
 *         # then it has no rows.
 *         if self.ncols() == 0:             # <<<<<<<<<<<<<<
 *             sig_off()
 *             return 0
 */
  }

  /* "cypari/gen.pyx":3963
 *             sig_off()
 *             return 0
 *         n = <long>glength(<GEN>(self.g[1]))             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return n
 */
  __pyx_v_n = ((long)glength(((GEN)(__pyx_v_self->__pyx_base.g[1]))));

  /* "cypari/gen.pyx":3964
 *             return 0
 *         n = <long>glength(<GEN>(self.g[1]))
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return n
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":3965
 *         n = <long>glength(<GEN>(self.g[1]))
 *         sig_off()
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def mattranspose(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3965, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3947
 *         return n
 * 
 *     def nrows(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the number of rows of self.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.nrows", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3967
 *         return n
 * 
 *     def mattranspose(self):             # <<<<<<<<<<<<<<
 *         """
 *         Transpose of the matrix self.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_247mattranspose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_246mattranspose[] = "\n        Transpose of the matrix self.\n\n        EXAMPLES::\n\n            sage: pari('[1,2,3; 4,5,6; 7,8,9]').mattranspose()\n            [1, 4, 7; 2, 5, 8; 3, 6, 9]\n\n        Unlike PARI, this always returns a matrix::\n\n            sage: pari('[1,2,3]').mattranspose()\n            [1; 2; 3]\n            sage: pari('[1,2,3]~').mattranspose()\n            Mat([1, 2, 3])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_247mattranspose(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mattranspose (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_246mattranspose(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_246mattranspose(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mattranspose", 0);

  /* "cypari/gen.pyx":3983
 *             Mat([1, 2, 3])
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gtrans(self.g)).Mat()
 * 
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 3983, __pyx_L1_error)

  /* "cypari/gen.pyx":3984
 *         """
 *         sig_on()
 *         return new_gen(gtrans(self.g)).Mat()             # <<<<<<<<<<<<<<
 * 
 *     def lllgram(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gtrans(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 3984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Mat); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 3984, __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_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(6, 3984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3967
 *         return n
 * 
 *     def mattranspose(self):             # <<<<<<<<<<<<<<
 *         """
 *         Transpose of the matrix self.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.mattranspose", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3986
 *         return new_gen(gtrans(self.g)).Mat()
 * 
 *     def lllgram(self):             # <<<<<<<<<<<<<<
 *         return self.qflllgram(0)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_249lllgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_249lllgram(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lllgram (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_248lllgram(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_248lllgram(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lllgram", 0);

  /* "cypari/gen.pyx":3987
 * 
 *     def lllgram(self):
 *         return self.qflllgram(0)             # <<<<<<<<<<<<<<
 * 
 *     def lllgramint(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_qflllgram); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_0) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_0);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3987, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3986
 *         return new_gen(gtrans(self.g)).Mat()
 * 
 *     def lllgram(self):             # <<<<<<<<<<<<<<
 *         return self.qflllgram(0)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.lllgram", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3989
 *         return self.qflllgram(0)
 * 
 *     def lllgramint(self):             # <<<<<<<<<<<<<<
 *         return self.qflllgram(1)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_251lllgramint(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_251lllgramint(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lllgramint (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_250lllgramint(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_250lllgramint(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("lllgramint", 0);

  /* "cypari/gen.pyx":3990
 * 
 *     def lllgramint(self):
 *         return self.qflllgram(1)             # <<<<<<<<<<<<<<
 * 
 *     def qfrep(self, B, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_qflllgram); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 3990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_int_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_int_1);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 3990, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3989
 *         return self.qflllgram(0)
 * 
 *     def lllgramint(self):             # <<<<<<<<<<<<<<
 *         return self.qflllgram(1)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.lllgramint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":3992
 *         return self.qflllgram(1)
 * 
 *     def qfrep(self, B, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         Vector of (half) the number of vectors of norms from 1 to `B`
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_253qfrep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_252qfrep[] = "\n        Vector of (half) the number of vectors of norms from 1 to `B`\n        for the integral and definite quadratic form ``self``.\n        Binary digits of flag mean 1: count vectors of even norm from\n        1 to `2B`, 2: return a ``t_VECSMALL`` instead of a ``t_VEC``\n        (which is faster).\n\n        EXAMPLES::\n\n            sage: M = pari(\"[5,1,1;1,3,1;1,1,1]\")\n            sage: M.qfrep(20)\n            [1, 1, 2, 2, 2, 4, 4, 3, 3, 4, 2, 4, 6, 0, 4, 6, 4, 5, 6, 4]\n            sage: M.qfrep(20, flag=1)\n            [1, 2, 4, 3, 4, 4, 0, 6, 5, 4, 12, 4, 4, 8, 0, 3, 8, 6, 12, 12]\n            sage: M.qfrep(20, flag=2)\n            Vecsmall([1, 1, 2, 2, 2, 4, 4, 3, 3, 4, 2, 4, 6, 0, 4, 6, 4, 5, 6, 4])\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_253qfrep(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_B = 0;
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("qfrep (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_B,&__pyx_n_s_flag,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_B)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "qfrep") < 0)) __PYX_ERR(6, 3992, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_B = values[0];
    if (values[1]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 3992, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("qfrep", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 3992, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.qfrep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_252qfrep(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_B, __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_252qfrep(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_B, long __pyx_v_flag) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  GEN __pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("qfrep", 0);

  /* "cypari/gen.pyx":4012
 *         # PARI 2.7 always returns a t_VECSMALL, but for backwards
 *         # compatibility, we keep returning a t_VEC (unless flag & 2)
 *         cdef Gen t0 = objtogen(B)             # <<<<<<<<<<<<<<
 *         cdef GEN r
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_B, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4014
 *         cdef Gen t0 = objtogen(B)
 *         cdef GEN r
 *         sig_on()             # <<<<<<<<<<<<<<
 *         r = qfrep0(self.g, t0.g, flag & 1)
 *         if (flag & 2) == 0:
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 4014, __pyx_L1_error)

  /* "cypari/gen.pyx":4015
 *         cdef GEN r
 *         sig_on()
 *         r = qfrep0(self.g, t0.g, flag & 1)             # <<<<<<<<<<<<<<
 *         if (flag & 2) == 0:
 *             r = vecsmall_to_vec(r)
 */
  __pyx_v_r = qfrep0(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g, (__pyx_v_flag & 1));

  /* "cypari/gen.pyx":4016
 *         sig_on()
 *         r = qfrep0(self.g, t0.g, flag & 1)
 *         if (flag & 2) == 0:             # <<<<<<<<<<<<<<
 *             r = vecsmall_to_vec(r)
 *         return new_gen(r)
 */
  __pyx_t_3 = (((__pyx_v_flag & 2) == 0) != 0);
  if (__pyx_t_3) {

    /* "cypari/gen.pyx":4017
 *         r = qfrep0(self.g, t0.g, flag & 1)
 *         if (flag & 2) == 0:
 *             r = vecsmall_to_vec(r)             # <<<<<<<<<<<<<<
 *         return new_gen(r)
 * 
 */
    __pyx_v_r = vecsmall_to_vec(__pyx_v_r);

    /* "cypari/gen.pyx":4016
 *         sig_on()
 *         r = qfrep0(self.g, t0.g, flag & 1)
 *         if (flag & 2) == 0:             # <<<<<<<<<<<<<<
 *             r = vecsmall_to_vec(r)
 *         return new_gen(r)
 */
  }

  /* "cypari/gen.pyx":4018
 *         if (flag & 2) == 0:
 *             r = vecsmall_to_vec(r)
 *         return new_gen(r)             # <<<<<<<<<<<<<<
 * 
 *     def matkerint(self, long flag=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_r)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4018, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":3992
 *         return self.qflllgram(1)
 * 
 *     def qfrep(self, B, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         Vector of (half) the number of vectors of norms from 1 to `B`
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.qfrep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4020
 *         return new_gen(r)
 * 
 *     def matkerint(self, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         Return the integer kernel of a matrix.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_255matkerint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_254matkerint[] = "\n        Return the integer kernel of a matrix.\n\n        This is the LLL-reduced Z-basis of the kernel of the matrix x with\n        integral entries.\n\n        EXAMPLES::\n\n            sage: pari('[2,1;2,1]').matker()\n            [-1/2; 1]\n            sage: pari('[2,1;2,1]').matkerint()\n            [1; -2]\n            sage: pari('[2,1;2,1]').matkerint(1)\n            doctest:...: DeprecationWarning: the 'flag' argument of the PARI/GP function matkerint is obsolete\n            [1; -2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_255matkerint(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_flag;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matkerint (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flag,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matkerint") < 0)) __PYX_ERR(6, 4020, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 4020, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matkerint", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 4020, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.matkerint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_254matkerint(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_flag);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_254matkerint(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_flag) {
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("matkerint", 0);

  /* "cypari/gen.pyx":4037
 *             [1; -2]
 *         """
 *         if flag:             # <<<<<<<<<<<<<<
 *             # Keep this deprecation warning as long as PARI supports
 *             # this deprecated flag
 */
  __pyx_t_1 = (__pyx_v_flag != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":4040
 *             # Keep this deprecation warning as long as PARI supports
 *             # this deprecated flag
 *             from warnings import warn             # <<<<<<<<<<<<<<
 *             warn("the 'flag' argument of the PARI/GP function matkerint is obsolete", DeprecationWarning)
 *         sig_on()
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 4040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_warn);
    __Pyx_GIVEREF(__pyx_n_s_warn);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 4040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 4040, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v_warn = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cypari/gen.pyx":4041
 *             # this deprecated flag
 *             from warnings import warn
 *             warn("the 'flag' argument of the PARI/GP function matkerint is obsolete", DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(matkerint0(self.g, flag))
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__98, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 4041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "cypari/gen.pyx":4037
 *             [1; -2]
 *         """
 *         if flag:             # <<<<<<<<<<<<<<
 *             # Keep this deprecation warning as long as PARI supports
 *             # this deprecated flag
 */
  }

  /* "cypari/gen.pyx":4042
 *             from warnings import warn
 *             warn("the 'flag' argument of the PARI/GP function matkerint is obsolete", DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(matkerint0(self.g, flag))
 * 
 */
  __pyx_t_4 = sig_on(); if (unlikely(__pyx_t_4 == ((int)0))) __PYX_ERR(6, 4042, __pyx_L1_error)

  /* "cypari/gen.pyx":4043
 *             warn("the 'flag' argument of the PARI/GP function matkerint is obsolete", DeprecationWarning)
 *         sig_on()
 *         return new_gen(matkerint0(self.g, flag))             # <<<<<<<<<<<<<<
 * 
 *     def factor(self, long limit=-1, proof=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(matkerint0(__pyx_v_self->__pyx_base.g, __pyx_v_flag))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 4043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4020
 *         return new_gen(r)
 * 
 *     def matkerint(self, long flag=0):             # <<<<<<<<<<<<<<
 *         """
 *         Return the integer kernel of a matrix.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.matkerint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4045
 *         return new_gen(matkerint0(self.g, flag))
 * 
 *     def factor(self, long limit=-1, proof=None):             # <<<<<<<<<<<<<<
 *         """
 *         Return the factorization of x.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_257factor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_256factor[] = "\n        Return the factorization of x.\n\n        INPUT:\n\n        -  ``limit`` -- (default: -1) is optional and can be set\n           whenever x is of (possibly recursive) rational type. If limit is\n           set, return partial factorization, using primes up to limit.\n\n        - ``proof`` -- optional flag. If ``False`` (not the default),\n          returned factors larger than `2^{64}` may only be pseudoprimes.\n          If ``True``, always check primality. If not given, use the\n          global PARI default ``factor_proven`` which is ``True`` by\n          default in Sage.\n\n        EXAMPLES::\n\n            sage: pari('x^10-1').factor()\n            [x - 1, 1; x + 1, 1; x^4 - x^3 + x^2 - x + 1, 1; x^4 + x^3 + x^2 + x + 1, 1]\n            sage: pari(2**100-1).factor()\n            [3, 1; 5, 3; 11, 1; 31, 1; 41, 1; 101, 1; 251, 1; 601, 1; 1801, 1; 4051, 1; 8101, 1; 268501, 1]\n            sage: pari(2**100-1).factor(proof=True)\n            [3, 1; 5, 3; 11, 1; 31, 1; 41, 1; 101, 1; 251, 1; 601, 1; 1801, 1; 4051, 1; 8101, 1; 268501, 1]\n            sage: pari(2**100-1).factor(proof=False)\n            [3, 1; 5, 3; 11, 1; 31, 1; 41, 1; 101, 1; 251, 1; 601, 1; 1801, 1; 4051, 1; 8101, 1; 268501, 1]\n\n        We illustrate setting a limit::\n\n            sage: pari(pari(10**50).nextprime()*pari(10**60).nextprime()*pari(10**4).nextprime()).factor(10**5)\n            [10007, 1; 100000000000000000000000000000000000000000000000151000000000700000000000000000000000000000000000000000000001057, 1]\n\n        Setting a limit is invalid when factoring polynomials::\n\n            sage: pari('x^11 + 1').factor(limit=17)\n            Traceback (most recent call last):\n            ...\n            PariError: incorrect type in boundfact (t_POL)\n\n        PARI doesn't have an algorithm for factoring multivariate\n        polynomials::\n\n            sage: pari('x^3 - y^3').factor()\n            [x - y, 1; x^2 + y*x + y^2, 1]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_257factor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_limit;
  PyObject *__pyx_v_proof = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("factor (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_limit,&__pyx_n_s_proof,0};
    PyObject* values[2] = {0,0};
    values[1] = ((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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_limit);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_proof);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "factor") < 0)) __PYX_ERR(6, 4045, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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;
      }
    }
    if (values[0]) {
      __pyx_v_limit = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_limit == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 4045, __pyx_L3_error)
    } else {
      __pyx_v_limit = ((long)-1L);
    }
    __pyx_v_proof = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("factor", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 4045, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.factor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_256factor(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_limit, __pyx_v_proof);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_256factor(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_limit, PyObject *__pyx_v_proof) {
  GEN __pyx_v_g;
  int __pyx_v_saved_factor_proven;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("factor", 0);

  /* "cypari/gen.pyx":4092
 *         cdef GEN g
 *         global factor_proven
 *         cdef int saved_factor_proven = factor_proven             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_v_saved_factor_proven = factor_proven;

  /* "cypari/gen.pyx":4094
 *         cdef int saved_factor_proven = factor_proven
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if proof is not None:
 *                 factor_proven = 1 if proof else 0
 */
  /*try:*/ {

    /* "cypari/gen.pyx":4095
 * 
 *         try:
 *             if proof is not None:             # <<<<<<<<<<<<<<
 *                 factor_proven = 1 if proof else 0
 *             sig_on()
 */
    __pyx_t_1 = (__pyx_v_proof != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":4096
 *         try:
 *             if proof is not None:
 *                 factor_proven = 1 if proof else 0             # <<<<<<<<<<<<<<
 *             sig_on()
 *             if limit >= 0:
 */
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_proof); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(6, 4096, __pyx_L4_error)
      if (__pyx_t_2) {
        __pyx_t_3 = 1;
      } else {
        __pyx_t_3 = 0;
      }
      factor_proven = __pyx_t_3;

      /* "cypari/gen.pyx":4095
 * 
 *         try:
 *             if proof is not None:             # <<<<<<<<<<<<<<
 *                 factor_proven = 1 if proof else 0
 *             sig_on()
 */
    }

    /* "cypari/gen.pyx":4097
 *             if proof is not None:
 *                 factor_proven = 1 if proof else 0
 *             sig_on()             # <<<<<<<<<<<<<<
 *             if limit >= 0:
 *                 g = boundfact(self.g, limit)
 */
    __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(6, 4097, __pyx_L4_error)

    /* "cypari/gen.pyx":4098
 *                 factor_proven = 1 if proof else 0
 *             sig_on()
 *             if limit >= 0:             # <<<<<<<<<<<<<<
 *                 g = boundfact(self.g, limit)
 *             else:
 */
    __pyx_t_2 = ((__pyx_v_limit >= 0) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":4099
 *             sig_on()
 *             if limit >= 0:
 *                 g = boundfact(self.g, limit)             # <<<<<<<<<<<<<<
 *             else:
 *                 g = factor(self.g)
 */
      __pyx_v_g = boundfact(__pyx_v_self->__pyx_base.g, __pyx_v_limit);

      /* "cypari/gen.pyx":4098
 *                 factor_proven = 1 if proof else 0
 *             sig_on()
 *             if limit >= 0:             # <<<<<<<<<<<<<<
 *                 g = boundfact(self.g, limit)
 *             else:
 */
      goto __pyx_L7;
    }

    /* "cypari/gen.pyx":4101
 *                 g = boundfact(self.g, limit)
 *             else:
 *                 g = factor(self.g)             # <<<<<<<<<<<<<<
 *             return new_gen(g)
 *         finally:
 */
    /*else*/ {
      __pyx_v_g = factor(__pyx_v_self->__pyx_base.g);
    }
    __pyx_L7:;

    /* "cypari/gen.pyx":4102
 *             else:
 *                 g = factor(self.g)
 *             return new_gen(g)             # <<<<<<<<<<<<<<
 *         finally:
 *             factor_proven = saved_factor_proven
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 4102, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L3_return;
  }

  /* "cypari/gen.pyx":4104
 *             return new_gen(g)
 *         finally:
 *             factor_proven = saved_factor_proven             # <<<<<<<<<<<<<<
 * 
 *     # Standard name for SageMath
 */
  /*finally:*/ {
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_3 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {
        factor_proven = __pyx_v_saved_factor_proven;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_12 = __pyx_r;
      __pyx_r = 0;
      factor_proven = __pyx_v_saved_factor_proven;
      __pyx_r = __pyx_t_12;
      __pyx_t_12 = 0;
      goto __pyx_L0;
    }
  }

  /* "cypari/gen.pyx":4045
 *         return new_gen(matkerint0(self.g, flag))
 * 
 *     def factor(self, long limit=-1, proof=None):             # <<<<<<<<<<<<<<
 *         """
 *         Return the factorization of x.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.factor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4109
 *     multiplicative_order = Gen_base.znorder
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         return self.abs()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_259__abs__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_259__abs__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__abs__ (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_258__abs__(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_258__abs__(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__abs__", 0);

  /* "cypari/gen.pyx":4110
 * 
 *     def __abs__(self):
 *         return self.abs()             # <<<<<<<<<<<<<<
 * 
 *     def nextprime(self, bint add_one=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_abs); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 4110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_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_1)) __PYX_ERR(6, 4110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4109
 *     multiplicative_order = Gen_base.znorder
 * 
 *     def __abs__(self):             # <<<<<<<<<<<<<<
 *         return self.abs()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.__abs__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4112
 *         return self.abs()
 * 
 *     def nextprime(self, bint add_one=0):             # <<<<<<<<<<<<<<
 *         """
 *         nextprime(x): smallest pseudoprime greater than or equal to `x`.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_261nextprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_260nextprime[] = "\n        nextprime(x): smallest pseudoprime greater than or equal to `x`.\n        If ``add_one`` is non-zero, return the smallest pseudoprime\n        strictly greater than `x`.\n\n        EXAMPLES::\n\n            sage: pari(1).nextprime()\n            2\n            sage: pari(2).nextprime()\n            2\n            sage: pari(2).nextprime(add_one = 1)\n            3\n            sage: pari(2**100).nextprime()\n            1267650600228229401496703205653\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_261nextprime(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_add_one;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nextprime (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_add_one,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_add_one);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nextprime") < 0)) __PYX_ERR(6, 4112, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_add_one = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_add_one == (int)-1) && PyErr_Occurred())) __PYX_ERR(6, 4112, __pyx_L3_error)
    } else {
      __pyx_v_add_one = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("nextprime", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 4112, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.nextprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_260nextprime(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_add_one);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_260nextprime(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, int __pyx_v_add_one) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("nextprime", 0);

  /* "cypari/gen.pyx":4129
 *             1267650600228229401496703205653
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if add_one:
 *             return new_gen(nextprime(gaddsg(1, self.g)))
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 4129, __pyx_L1_error)

  /* "cypari/gen.pyx":4130
 *         """
 *         sig_on()
 *         if add_one:             # <<<<<<<<<<<<<<
 *             return new_gen(nextprime(gaddsg(1, self.g)))
 *         return new_gen(nextprime(self.g))
 */
  __pyx_t_2 = (__pyx_v_add_one != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":4131
 *         sig_on()
 *         if add_one:
 *             return new_gen(nextprime(gaddsg(1, self.g)))             # <<<<<<<<<<<<<<
 *         return new_gen(nextprime(self.g))
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(nextprime(gaddsg(1, __pyx_v_self->__pyx_base.g)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 4131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4130
 *         """
 *         sig_on()
 *         if add_one:             # <<<<<<<<<<<<<<
 *             return new_gen(nextprime(gaddsg(1, self.g)))
 *         return new_gen(nextprime(self.g))
 */
  }

  /* "cypari/gen.pyx":4132
 *         if add_one:
 *             return new_gen(nextprime(gaddsg(1, self.g)))
 *         return new_gen(nextprime(self.g))             # <<<<<<<<<<<<<<
 * 
 *     def change_variable_name(self, var):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(nextprime(__pyx_v_self->__pyx_base.g))); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 4132, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4112
 *         return self.abs()
 * 
 *     def nextprime(self, bint add_one=0):             # <<<<<<<<<<<<<<
 *         """
 *         nextprime(x): smallest pseudoprime greater than or equal to `x`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.nextprime", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4134
 *         return new_gen(nextprime(self.g))
 * 
 *     def change_variable_name(self, var):             # <<<<<<<<<<<<<<
 *         """
 *         In ``self``, which must be a ``t_POL`` or ``t_SER``, set the
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_263change_variable_name(PyObject *__pyx_v_self, PyObject *__pyx_v_var); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_262change_variable_name[] = "\n        In ``self``, which must be a ``t_POL`` or ``t_SER``, set the\n        variable to ``var``.  If the variable of ``self`` is already\n        ``var``, then return ``self``.\n\n        .. WARNING::\n\n            You should be careful with variable priorities when\n            applying this on a polynomial or series of which the\n            coefficients have polynomial components.  To be safe, only\n            use this function on polynomials with integer or rational\n            coefficients.  For a safer alternative, use :meth:`subst`.\n\n        EXAMPLES::\n\n            sage: f = pari('x^3 + 17*x + 3')\n            sage: f.change_variable_name(\"y\")\n            y^3 + 17*y + 3\n            sage: f = pari('1 + 2*y + O(y^10)')\n            sage: f.change_variable_name(\"q\")\n            1 + 2*q + O(q^10)\n            sage: f.change_variable_name(\"y\") is f\n            True\n\n        In PARI, ``I`` refers to the square root of -1, so it cannot be\n        used as variable name.  Note the difference with :meth:`subst`::\n\n            sage: f = pari('x^2 + 1')\n            sage: f.change_variable_name(\"I\")\n            Traceback (most recent call last):\n            ...\n            PariError: I already exists with incompatible valence\n            sage: f.subst(\"x\", \"I\")\n            0\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_263change_variable_name(PyObject *__pyx_v_self, PyObject *__pyx_v_var) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("change_variable_name (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_262change_variable_name(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_var));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_262change_variable_name(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_var) {
  long __pyx_v_n;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_newg = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("change_variable_name", 0);

  /* "cypari/gen.pyx":4170
 *             0
 *         """
 *         cdef long n = get_var(var)             # <<<<<<<<<<<<<<
 *         if varn(self.g) == n:
 *             return self
 */
  __pyx_t_1 = __pyx_f_6cypari_5_pari_get_var(__pyx_v_var); if (unlikely(__pyx_t_1 == ((long)-2L))) __PYX_ERR(6, 4170, __pyx_L1_error)
  __pyx_v_n = __pyx_t_1;

  /* "cypari/gen.pyx":4171
 *         """
 *         cdef long n = get_var(var)
 *         if varn(self.g) == n:             # <<<<<<<<<<<<<<
 *             return self
 *         if typ(self.g) != t_POL and typ(self.g) != t_SER:
 */
  __pyx_t_2 = ((varn(__pyx_v_self->__pyx_base.g) == __pyx_v_n) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":4172
 *         cdef long n = get_var(var)
 *         if varn(self.g) == n:
 *             return self             # <<<<<<<<<<<<<<
 *         if typ(self.g) != t_POL and typ(self.g) != t_SER:
 *             raise TypeError("set_variable() only works for polynomials or power series")
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "cypari/gen.pyx":4171
 *         """
 *         cdef long n = get_var(var)
 *         if varn(self.g) == n:             # <<<<<<<<<<<<<<
 *             return self
 *         if typ(self.g) != t_POL and typ(self.g) != t_SER:
 */
  }

  /* "cypari/gen.pyx":4173
 *         if varn(self.g) == n:
 *             return self
 *         if typ(self.g) != t_POL and typ(self.g) != t_SER:             # <<<<<<<<<<<<<<
 *             raise TypeError("set_variable() only works for polynomials or power series")
 *         # Copy self and then change the variable in place
 */
  __pyx_t_3 = ((typ(__pyx_v_self->__pyx_base.g) != t_POL) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = ((typ(__pyx_v_self->__pyx_base.g) != t_SER) != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "cypari/gen.pyx":4174
 *             return self
 *         if typ(self.g) != t_POL and typ(self.g) != t_SER:
 *             raise TypeError("set_variable() only works for polynomials or power series")             # <<<<<<<<<<<<<<
 *         # Copy self and then change the variable in place
 *         cdef Gen newg = new_gen_noclear(self.g)
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 4174, __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(6, 4174, __pyx_L1_error)

    /* "cypari/gen.pyx":4173
 *         if varn(self.g) == n:
 *             return self
 *         if typ(self.g) != t_POL and typ(self.g) != t_SER:             # <<<<<<<<<<<<<<
 *             raise TypeError("set_variable() only works for polynomials or power series")
 *         # Copy self and then change the variable in place
 */
  }

  /* "cypari/gen.pyx":4176
 *             raise TypeError("set_variable() only works for polynomials or power series")
 *         # Copy self and then change the variable in place
 *         cdef Gen newg = new_gen_noclear(self.g)             # <<<<<<<<<<<<<<
 *         setvarn(newg.g, n)
 *         return newg
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(__pyx_v_self->__pyx_base.g)); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 4176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_newg = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cypari/gen.pyx":4177
 *         # Copy self and then change the variable in place
 *         cdef Gen newg = new_gen_noclear(self.g)
 *         setvarn(newg.g, n)             # <<<<<<<<<<<<<<
 *         return newg
 * 
 */
  (void)(setvarn(__pyx_v_newg->__pyx_base.g, __pyx_v_n));

  /* "cypari/gen.pyx":4178
 *         cdef Gen newg = new_gen_noclear(self.g)
 *         setvarn(newg.g, n)
 *         return newg             # <<<<<<<<<<<<<<
 * 
 *     def nf_subst(self, z):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_newg));
  __pyx_r = ((PyObject *)__pyx_v_newg);
  goto __pyx_L0;

  /* "cypari/gen.pyx":4134
 *         return new_gen(nextprime(self.g))
 * 
 *     def change_variable_name(self, var):             # <<<<<<<<<<<<<<
 *         """
 *         In ``self``, which must be a ``t_POL`` or ``t_SER``, set the
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari._pari.Gen.change_variable_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_newg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4180
 *         return newg
 * 
 *     def nf_subst(self, z):             # <<<<<<<<<<<<<<
 *         """
 *         Given a PARI number field ``self``, return the same PARI
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_265nf_subst(PyObject *__pyx_v_self, PyObject *__pyx_v_z); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_264nf_subst[] = "\n        Given a PARI number field ``self``, return the same PARI\n        number field but in the variable ``z``.\n\n        INPUT:\n\n        - ``self`` -- A PARI number field being the output of ``nfinit()``,\n                      ``bnfinit()`` or ``bnrinit()``.\n\n        EXAMPLES::\n\n            sage: K = pari('y^2 + 5').nfinit()\n\n        We can substitute in a PARI ``nf`` structure::\n\n            sage: K.nf_get_pol()\n            y^2 + 5\n            sage: L = K.nf_subst('a')\n            sage: L.nf_get_pol()\n            a^2 + 5\n\n        We can also substitute in a PARI ``bnf`` structure::\n\n            sage: K = pari('y^2 + 5').bnfinit()\n            sage: K.nf_get_pol()\n            y^2 + 5\n            sage: K.bnf_get_cyc()  # Structure of class group\n            [2]\n            sage: L = K.nf_subst('a')\n            sage: L.nf_get_pol()\n            a^2 + 5\n            sage: L.bnf_get_cyc()  # We still have a bnf after substituting\n            [2]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_265nf_subst(PyObject *__pyx_v_self, PyObject *__pyx_v_z) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("nf_subst (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_264nf_subst(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), ((PyObject *)__pyx_v_z));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_264nf_subst(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_z) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("nf_subst", 0);

  /* "cypari/gen.pyx":4215
 *             [2]
 *         """
 *         cdef Gen t0 = objtogen(z)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(gsubst(self.g, gvar(self.g), t0.g))
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4216
 *         """
 *         cdef Gen t0 = objtogen(z)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(gsubst(self.g, gvar(self.g), t0.g))
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 4216, __pyx_L1_error)

  /* "cypari/gen.pyx":4217
 *         cdef Gen t0 = objtogen(z)
 *         sig_on()
 *         return new_gen(gsubst(self.g, gvar(self.g), t0.g))             # <<<<<<<<<<<<<<
 * 
 *     def type(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(gsubst(__pyx_v_self->__pyx_base.g, gvar(__pyx_v_self->__pyx_base.g), __pyx_v_t0->__pyx_base.g))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4217, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4180
 *         return newg
 * 
 *     def nf_subst(self, z):             # <<<<<<<<<<<<<<
 *         """
 *         Given a PARI number field ``self``, return the same PARI
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.nf_subst", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4219
 *         return new_gen(gsubst(self.g, gvar(self.g), t0.g))
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the PARI type of self as a string.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_267type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_266type[] = "\n        Return the PARI type of self as a string.\n\n        .. NOTE::\n\n           In Cython, it is much faster to simply use typ(self.g) for\n           checking PARI types.\n\n        EXAMPLES::\n\n            sage: pari(7).type()\n            't_INT'\n            sage: pari('x').type()\n            't_POL'\n            sage: pari('oo').type()\n            't_INFINITY'\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_267type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("type (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_266type(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_266type(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self) {
  long __pyx_v_t;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("type", 0);

  /* "cypari/gen.pyx":4252
 *         # need to be updated accordingly.
 *         #
 *         cdef long t = typ(self.g)             # <<<<<<<<<<<<<<
 * 
 *         if   t == t_INT:      return 't_INT'
 */
  __pyx_v_t = typ(__pyx_v_self->__pyx_base.g);

  /* "cypari/gen.pyx":4254
 *         cdef long t = typ(self.g)
 * 
 *         if   t == t_INT:      return 't_INT'             # <<<<<<<<<<<<<<
 *         elif t == t_REAL:     return 't_REAL'
 *         elif t == t_INTMOD:   return 't_INTMOD'
 */
  switch (__pyx_v_t) {
    case t_INT:
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_INT);
    __pyx_r = __pyx_n_s_t_INT;
    goto __pyx_L0;
    break;
    case t_REAL:

    /* "cypari/gen.pyx":4255
 * 
 *         if   t == t_INT:      return 't_INT'
 *         elif t == t_REAL:     return 't_REAL'             # <<<<<<<<<<<<<<
 *         elif t == t_INTMOD:   return 't_INTMOD'
 *         elif t == t_FRAC:     return 't_FRAC'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_REAL);
    __pyx_r = __pyx_n_s_t_REAL;
    goto __pyx_L0;
    break;
    case t_INTMOD:

    /* "cypari/gen.pyx":4256
 *         if   t == t_INT:      return 't_INT'
 *         elif t == t_REAL:     return 't_REAL'
 *         elif t == t_INTMOD:   return 't_INTMOD'             # <<<<<<<<<<<<<<
 *         elif t == t_FRAC:     return 't_FRAC'
 *         elif t == t_FFELT:    return 't_FFELT'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_INTMOD);
    __pyx_r = __pyx_n_s_t_INTMOD;
    goto __pyx_L0;
    break;
    case t_FRAC:

    /* "cypari/gen.pyx":4257
 *         elif t == t_REAL:     return 't_REAL'
 *         elif t == t_INTMOD:   return 't_INTMOD'
 *         elif t == t_FRAC:     return 't_FRAC'             # <<<<<<<<<<<<<<
 *         elif t == t_FFELT:    return 't_FFELT'
 *         elif t == t_COMPLEX:  return 't_COMPLEX'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_FRAC);
    __pyx_r = __pyx_n_s_t_FRAC;
    goto __pyx_L0;
    break;
    case t_FFELT:

    /* "cypari/gen.pyx":4258
 *         elif t == t_INTMOD:   return 't_INTMOD'
 *         elif t == t_FRAC:     return 't_FRAC'
 *         elif t == t_FFELT:    return 't_FFELT'             # <<<<<<<<<<<<<<
 *         elif t == t_COMPLEX:  return 't_COMPLEX'
 *         elif t == t_PADIC:    return 't_PADIC'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_FFELT);
    __pyx_r = __pyx_n_s_t_FFELT;
    goto __pyx_L0;
    break;
    case t_COMPLEX:

    /* "cypari/gen.pyx":4259
 *         elif t == t_FRAC:     return 't_FRAC'
 *         elif t == t_FFELT:    return 't_FFELT'
 *         elif t == t_COMPLEX:  return 't_COMPLEX'             # <<<<<<<<<<<<<<
 *         elif t == t_PADIC:    return 't_PADIC'
 *         elif t == t_QUAD:     return 't_QUAD'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_COMPLEX);
    __pyx_r = __pyx_n_s_t_COMPLEX;
    goto __pyx_L0;
    break;
    case t_PADIC:

    /* "cypari/gen.pyx":4260
 *         elif t == t_FFELT:    return 't_FFELT'
 *         elif t == t_COMPLEX:  return 't_COMPLEX'
 *         elif t == t_PADIC:    return 't_PADIC'             # <<<<<<<<<<<<<<
 *         elif t == t_QUAD:     return 't_QUAD'
 *         elif t == t_POLMOD:   return 't_POLMOD'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_PADIC);
    __pyx_r = __pyx_n_s_t_PADIC;
    goto __pyx_L0;
    break;
    case t_QUAD:

    /* "cypari/gen.pyx":4261
 *         elif t == t_COMPLEX:  return 't_COMPLEX'
 *         elif t == t_PADIC:    return 't_PADIC'
 *         elif t == t_QUAD:     return 't_QUAD'             # <<<<<<<<<<<<<<
 *         elif t == t_POLMOD:   return 't_POLMOD'
 *         elif t == t_POL:      return 't_POL'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_QUAD);
    __pyx_r = __pyx_n_s_t_QUAD;
    goto __pyx_L0;
    break;
    case t_POLMOD:

    /* "cypari/gen.pyx":4262
 *         elif t == t_PADIC:    return 't_PADIC'
 *         elif t == t_QUAD:     return 't_QUAD'
 *         elif t == t_POLMOD:   return 't_POLMOD'             # <<<<<<<<<<<<<<
 *         elif t == t_POL:      return 't_POL'
 *         elif t == t_SER:      return 't_SER'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_POLMOD);
    __pyx_r = __pyx_n_s_t_POLMOD;
    goto __pyx_L0;
    break;
    case t_POL:

    /* "cypari/gen.pyx":4263
 *         elif t == t_QUAD:     return 't_QUAD'
 *         elif t == t_POLMOD:   return 't_POLMOD'
 *         elif t == t_POL:      return 't_POL'             # <<<<<<<<<<<<<<
 *         elif t == t_SER:      return 't_SER'
 *         elif t == t_RFRAC:    return 't_RFRAC'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_POL);
    __pyx_r = __pyx_n_s_t_POL;
    goto __pyx_L0;
    break;
    case t_SER:

    /* "cypari/gen.pyx":4264
 *         elif t == t_POLMOD:   return 't_POLMOD'
 *         elif t == t_POL:      return 't_POL'
 *         elif t == t_SER:      return 't_SER'             # <<<<<<<<<<<<<<
 *         elif t == t_RFRAC:    return 't_RFRAC'
 *         elif t == t_QFR:      return 't_QFR'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_SER);
    __pyx_r = __pyx_n_s_t_SER;
    goto __pyx_L0;
    break;
    case t_RFRAC:

    /* "cypari/gen.pyx":4265
 *         elif t == t_POL:      return 't_POL'
 *         elif t == t_SER:      return 't_SER'
 *         elif t == t_RFRAC:    return 't_RFRAC'             # <<<<<<<<<<<<<<
 *         elif t == t_QFR:      return 't_QFR'
 *         elif t == t_QFI:      return 't_QFI'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_RFRAC);
    __pyx_r = __pyx_n_s_t_RFRAC;
    goto __pyx_L0;
    break;
    case t_QFR:

    /* "cypari/gen.pyx":4266
 *         elif t == t_SER:      return 't_SER'
 *         elif t == t_RFRAC:    return 't_RFRAC'
 *         elif t == t_QFR:      return 't_QFR'             # <<<<<<<<<<<<<<
 *         elif t == t_QFI:      return 't_QFI'
 *         elif t == t_VEC:      return 't_VEC'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_QFR);
    __pyx_r = __pyx_n_s_t_QFR;
    goto __pyx_L0;
    break;
    case t_QFI:

    /* "cypari/gen.pyx":4267
 *         elif t == t_RFRAC:    return 't_RFRAC'
 *         elif t == t_QFR:      return 't_QFR'
 *         elif t == t_QFI:      return 't_QFI'             # <<<<<<<<<<<<<<
 *         elif t == t_VEC:      return 't_VEC'
 *         elif t == t_COL:      return 't_COL'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_QFI);
    __pyx_r = __pyx_n_s_t_QFI;
    goto __pyx_L0;
    break;
    case t_VEC:

    /* "cypari/gen.pyx":4268
 *         elif t == t_QFR:      return 't_QFR'
 *         elif t == t_QFI:      return 't_QFI'
 *         elif t == t_VEC:      return 't_VEC'             # <<<<<<<<<<<<<<
 *         elif t == t_COL:      return 't_COL'
 *         elif t == t_MAT:      return 't_MAT'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_VEC);
    __pyx_r = __pyx_n_s_t_VEC;
    goto __pyx_L0;
    break;
    case t_COL:

    /* "cypari/gen.pyx":4269
 *         elif t == t_QFI:      return 't_QFI'
 *         elif t == t_VEC:      return 't_VEC'
 *         elif t == t_COL:      return 't_COL'             # <<<<<<<<<<<<<<
 *         elif t == t_MAT:      return 't_MAT'
 *         elif t == t_LIST:     return 't_LIST'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_COL);
    __pyx_r = __pyx_n_s_t_COL;
    goto __pyx_L0;
    break;
    case t_MAT:

    /* "cypari/gen.pyx":4270
 *         elif t == t_VEC:      return 't_VEC'
 *         elif t == t_COL:      return 't_COL'
 *         elif t == t_MAT:      return 't_MAT'             # <<<<<<<<<<<<<<
 *         elif t == t_LIST:     return 't_LIST'
 *         elif t == t_STR:      return 't_STR'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_MAT);
    __pyx_r = __pyx_n_s_t_MAT;
    goto __pyx_L0;
    break;
    case t_LIST:

    /* "cypari/gen.pyx":4271
 *         elif t == t_COL:      return 't_COL'
 *         elif t == t_MAT:      return 't_MAT'
 *         elif t == t_LIST:     return 't_LIST'             # <<<<<<<<<<<<<<
 *         elif t == t_STR:      return 't_STR'
 *         elif t == t_VECSMALL: return 't_VECSMALL'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_LIST);
    __pyx_r = __pyx_n_s_t_LIST;
    goto __pyx_L0;
    break;
    case t_STR:

    /* "cypari/gen.pyx":4272
 *         elif t == t_MAT:      return 't_MAT'
 *         elif t == t_LIST:     return 't_LIST'
 *         elif t == t_STR:      return 't_STR'             # <<<<<<<<<<<<<<
 *         elif t == t_VECSMALL: return 't_VECSMALL'
 *         elif t == t_CLOSURE:  return 't_CLOSURE'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_STR);
    __pyx_r = __pyx_n_s_t_STR;
    goto __pyx_L0;
    break;
    case t_VECSMALL:

    /* "cypari/gen.pyx":4273
 *         elif t == t_LIST:     return 't_LIST'
 *         elif t == t_STR:      return 't_STR'
 *         elif t == t_VECSMALL: return 't_VECSMALL'             # <<<<<<<<<<<<<<
 *         elif t == t_CLOSURE:  return 't_CLOSURE'
 *         elif t == t_INFINITY: return 't_INFINITY'
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_VECSMALL);
    __pyx_r = __pyx_n_s_t_VECSMALL;
    goto __pyx_L0;
    break;
    case t_CLOSURE:

    /* "cypari/gen.pyx":4274
 *         elif t == t_STR:      return 't_STR'
 *         elif t == t_VECSMALL: return 't_VECSMALL'
 *         elif t == t_CLOSURE:  return 't_CLOSURE'             # <<<<<<<<<<<<<<
 *         elif t == t_INFINITY: return 't_INFINITY'
 *         else:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_CLOSURE);
    __pyx_r = __pyx_n_s_t_CLOSURE;
    goto __pyx_L0;
    break;
    case t_INFINITY:

    /* "cypari/gen.pyx":4275
 *         elif t == t_VECSMALL: return 't_VECSMALL'
 *         elif t == t_CLOSURE:  return 't_CLOSURE'
 *         elif t == t_INFINITY: return 't_INFINITY'             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError("Unknown PARI type: %s" % t)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_n_s_t_INFINITY);
    __pyx_r = __pyx_n_s_t_INFINITY;
    goto __pyx_L0;
    break;
    default:

    /* "cypari/gen.pyx":4277
 *         elif t == t_INFINITY: return 't_INFINITY'
 *         else:
 *             raise TypeError("Unknown PARI type: %s" % t)             # <<<<<<<<<<<<<<
 * 
 *     def polinterpolate(self, ya, x):
 */
    __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unknown_PARI_type_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 4277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(6, 4277, __pyx_L1_error)
    break;
  }

  /* "cypari/gen.pyx":4219
 *         return new_gen(gsubst(self.g, gvar(self.g), t0.g))
 * 
 *     def type(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the PARI type of self as a string.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.type", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4279
 *             raise TypeError("Unknown PARI type: %s" % t)
 * 
 *     def polinterpolate(self, ya, x):             # <<<<<<<<<<<<<<
 *         """
 *         self.polinterpolate(ya,x,e): polynomial interpolation at x
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_269polinterpolate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_268polinterpolate[] = "\n        self.polinterpolate(ya,x,e): polynomial interpolation at x\n        according to data vectors self, ya (i.e. return P such that\n        P(self[i]) = ya[i] for all i). Also return an error estimate on the\n        returned value.\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_269polinterpolate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ya = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polinterpolate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ya,&__pyx_n_s_x,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_ya)) != 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_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polinterpolate", 1, 2, 2, 1); __PYX_ERR(6, 4279, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polinterpolate") < 0)) __PYX_ERR(6, 4279, __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_ya = values[0];
    __pyx_v_x = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polinterpolate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 4279, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.polinterpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_268polinterpolate(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_ya, __pyx_v_x);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_268polinterpolate(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_ya, PyObject *__pyx_v_x) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t1 = 0;
  GEN __pyx_v_dy;
  GEN __pyx_v_g;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_dif = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("polinterpolate", 0);

  /* "cypari/gen.pyx":4286
 *         returned value.
 *         """
 *         cdef Gen t0 = objtogen(ya)             # <<<<<<<<<<<<<<
 *         cdef Gen t1 = objtogen(x)
 *         cdef GEN dy, g
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_ya, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4287
 *         """
 *         cdef Gen t0 = objtogen(ya)
 *         cdef Gen t1 = objtogen(x)             # <<<<<<<<<<<<<<
 *         cdef GEN dy, g
 *         sig_on()
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t1 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4289
 *         cdef Gen t1 = objtogen(x)
 *         cdef GEN dy, g
 *         sig_on()             # <<<<<<<<<<<<<<
 *         g = polint(self.g, t0.g, t1.g, &dy)
 *         dif = new_gen_noclear(dy)
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 4289, __pyx_L1_error)

  /* "cypari/gen.pyx":4290
 *         cdef GEN dy, g
 *         sig_on()
 *         g = polint(self.g, t0.g, t1.g, &dy)             # <<<<<<<<<<<<<<
 *         dif = new_gen_noclear(dy)
 *         return new_gen(g), dif
 */
  __pyx_v_g = polint(__pyx_v_self->__pyx_base.g, __pyx_v_t0->__pyx_base.g, __pyx_v_t1->__pyx_base.g, (&__pyx_v_dy));

  /* "cypari/gen.pyx":4291
 *         sig_on()
 *         g = polint(self.g, t0.g, t1.g, &dy)
 *         dif = new_gen_noclear(dy)             # <<<<<<<<<<<<<<
 *         return new_gen(g), dif
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_noclear(__pyx_v_dy)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_dif = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4292
 *         g = polint(self.g, t0.g, t1.g, &dy)
 *         dif = new_gen_noclear(dy)
 *         return new_gen(g), dif             # <<<<<<<<<<<<<<
 * 
 *     def ellwp(self, z='z', long n=20, long flag=0, unsigned long precision=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 4292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_dif));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dif));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_dif));
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4279
 *             raise TypeError("Unknown PARI type: %s" % t)
 * 
 *     def polinterpolate(self, ya, x):             # <<<<<<<<<<<<<<
 *         """
 *         self.polinterpolate(ya,x,e): polynomial interpolation at x
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari._pari.Gen.polinterpolate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XDECREF((PyObject *)__pyx_v_t1);
  __Pyx_XDECREF((PyObject *)__pyx_v_dif);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4294
 *         return new_gen(g), dif
 * 
 *     def ellwp(self, z='z', long n=20, long flag=0, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         Return the value or the series expansion of the Weierstrass
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_271ellwp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_270ellwp[] = "\n        Return the value or the series expansion of the Weierstrass\n        `P`-function at `z` on the lattice `self` (or the lattice\n        defined by the elliptic curve `self`).\n\n        INPUT:\n\n        -  ``self`` -- an elliptic curve created using ``ellinit`` or a\n           list ``[om1, om2]`` representing generators for a lattice.\n\n        -  ``z`` -- (default: 'z') a complex number or a variable name\n           (as string or PARI variable).\n\n        -  ``n`` -- (default: 20) if 'z' is a variable, compute the\n           series expansion up to at least `O(z^n)`.\n\n        -  ``flag`` -- (default = 0): If ``flag`` is 0, compute only\n           `P(z)`.  If ``flag`` is 1, compute `[P(z), P'(z)]`.\n\n        OUTPUT:\n\n        - `P(z)` (if ``flag`` is 0) or `[P(z), P'(z)]` (if ``flag`` is 1).\n           numbers\n\n        EXAMPLES:\n\n        We first define the elliptic curve X_0(11)::\n\n            sage: E = pari([0,-1,1,-10,-20]).ellinit()\n\n        Compute P(1)::\n\n            sage: E.ellwp(1)\n            13.9658695257485\n\n        Compute P(1+i), where i = sqrt(-1)::\n\n            sage: E.ellwp(pari(complex(1, 1)))\n            -1.11510682565555 + 2.33419052307470*I\n            sage: E.ellwp(complex(1, 1))\n            -1.11510682565555 + 2.33419052307470*I\n\n        The series expansion, to the default `O(z^20)` precision::\n\n            sage: E.ellwp()\n            z^-2 + 31/15*z^2 + 2501/756*z^4 + 961/675*z^6 + 77531/41580*z^8 + 1202285717/928746000*z^10 + 2403461/2806650*z^12 + 30211462703/43418875500*z^14 + 3539374016033/7723451736000*z^16 + 413306031683977/1289540602350000*z^18 + O(z^20)\n\n        Compute the series for wp to lower precision::\n\n            sage: E.ellwp(n=4)\n            z^-2 + 31/15*z^2 + O(z^4)\n\n        Next we use the version where the input is generators for a\n        lattice::\n\n            sage: pari([1.2692, complex(0.63, 1.45)]).ellwp(1)\n            13.9656146936689 + 0.000644829272810...*I""\n\n        With flag=1, compute the pair P(z) and P'(z)::\n\n            sage: E.ellwp(1, flag=1)\n            [13.9658695257485, 101.123860176015]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_271ellwp(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_z = 0;
  long __pyx_v_n;
  long __pyx_v_flag;
  unsigned long __pyx_v_precision;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellwp (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_z,&__pyx_n_s_n,&__pyx_n_s_flag,&__pyx_n_s_precision,0};
    PyObject* values[4] = {0,0,0,0};
    values[0] = ((PyObject *)__pyx_n_s_z);
    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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_z);
          if (value) { values[0] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
          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_precision);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellwp") < 0)) __PYX_ERR(6, 4294, __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);
        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;
      }
    }
    __pyx_v_z = values[0];
    if (values[1]) {
      __pyx_v_n = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_n == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 4294, __pyx_L3_error)
    } else {
      __pyx_v_n = ((long)20);
    }
    if (values[2]) {
      __pyx_v_flag = __Pyx_PyInt_As_long(values[2]); if (unlikely((__pyx_v_flag == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 4294, __pyx_L3_error)
    } else {
      __pyx_v_flag = ((long)0);
    }
    if (values[3]) {
      __pyx_v_precision = __Pyx_PyInt_As_unsigned_long(values[3]); if (unlikely((__pyx_v_precision == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(6, 4294, __pyx_L3_error)
    } else {
      __pyx_v_precision = ((unsigned long)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellwp", 0, 0, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 4294, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.ellwp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_270ellwp(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_z, __pyx_v_n, __pyx_v_flag, __pyx_v_precision);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_270ellwp(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, PyObject *__pyx_v_z, long __pyx_v_n, long __pyx_v_flag, unsigned long __pyx_v_precision) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_t0 = 0;
  GEN __pyx_v_g0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  GEN __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("ellwp", 0);

  /* "cypari/gen.pyx":4358
 *             [13.9658695257485, 101.123860176015]
 *         """
 *         cdef Gen t0 = objtogen(z)             # <<<<<<<<<<<<<<
 *         cdef GEN g0 = t0.g
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_z, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_t0 = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4359
 *         """
 *         cdef Gen t0 = objtogen(z)
 *         cdef GEN g0 = t0.g             # <<<<<<<<<<<<<<
 * 
 *         # Emulate toser_i() but with given precision
 */
  __pyx_t_2 = __pyx_v_t0->__pyx_base.g;
  __pyx_v_g0 = __pyx_t_2;

  /* "cypari/gen.pyx":4362
 * 
 *         # Emulate toser_i() but with given precision
 *         sig_on()             # <<<<<<<<<<<<<<
 *         if typ(g0) == t_POL:
 *             g0 = RgX_to_ser(g0, n+4)
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(6, 4362, __pyx_L1_error)

  /* "cypari/gen.pyx":4363
 *         # Emulate toser_i() but with given precision
 *         sig_on()
 *         if typ(g0) == t_POL:             # <<<<<<<<<<<<<<
 *             g0 = RgX_to_ser(g0, n+4)
 *         elif typ(g0) == t_RFRAC:
 */
  __pyx_t_4 = ((typ(__pyx_v_g0) == t_POL) != 0);
  if (__pyx_t_4) {

    /* "cypari/gen.pyx":4364
 *         sig_on()
 *         if typ(g0) == t_POL:
 *             g0 = RgX_to_ser(g0, n+4)             # <<<<<<<<<<<<<<
 *         elif typ(g0) == t_RFRAC:
 *             g0 = rfrac_to_ser(g0, n+4)
 */
    __pyx_v_g0 = RgX_to_ser(__pyx_v_g0, (__pyx_v_n + 4));

    /* "cypari/gen.pyx":4363
 *         # Emulate toser_i() but with given precision
 *         sig_on()
 *         if typ(g0) == t_POL:             # <<<<<<<<<<<<<<
 *             g0 = RgX_to_ser(g0, n+4)
 *         elif typ(g0) == t_RFRAC:
 */
    goto __pyx_L3;
  }

  /* "cypari/gen.pyx":4365
 *         if typ(g0) == t_POL:
 *             g0 = RgX_to_ser(g0, n+4)
 *         elif typ(g0) == t_RFRAC:             # <<<<<<<<<<<<<<
 *             g0 = rfrac_to_ser(g0, n+4)
 *         return new_gen(ellwp0(self.g, g0, flag, prec_bits_to_words(precision)))
 */
  __pyx_t_4 = ((typ(__pyx_v_g0) == t_RFRAC) != 0);
  if (__pyx_t_4) {

    /* "cypari/gen.pyx":4366
 *             g0 = RgX_to_ser(g0, n+4)
 *         elif typ(g0) == t_RFRAC:
 *             g0 = rfrac_to_ser(g0, n+4)             # <<<<<<<<<<<<<<
 *         return new_gen(ellwp0(self.g, g0, flag, prec_bits_to_words(precision)))
 * 
 */
    __pyx_v_g0 = rfrac_to_ser(__pyx_v_g0, (__pyx_v_n + 4));

    /* "cypari/gen.pyx":4365
 *         if typ(g0) == t_POL:
 *             g0 = RgX_to_ser(g0, n+4)
 *         elif typ(g0) == t_RFRAC:             # <<<<<<<<<<<<<<
 *             g0 = rfrac_to_ser(g0, n+4)
 *         return new_gen(ellwp0(self.g, g0, flag, prec_bits_to_words(precision)))
 */
  }
  __pyx_L3:;

  /* "cypari/gen.pyx":4367
 *         elif typ(g0) == t_RFRAC:
 *             g0 = rfrac_to_ser(g0, n+4)
 *         return new_gen(ellwp0(self.g, g0, flag, prec_bits_to_words(precision)))             # <<<<<<<<<<<<<<
 * 
 *     def debug(self, long depth = -1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(ellwp0(__pyx_v_self->__pyx_base.g, __pyx_v_g0, __pyx_v_flag, __pyx_f_6cypari_5_pari_prec_bits_to_words(__pyx_v_precision, 0)))); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4367, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4294
 *         return new_gen(g), dif
 * 
 *     def ellwp(self, z='z', long n=20, long flag=0, unsigned long precision=0):             # <<<<<<<<<<<<<<
 *         """
 *         Return the value or the series expansion of the Weierstrass
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.ellwp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_t0);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4369
 *         return new_gen(ellwp0(self.g, g0, flag, prec_bits_to_words(precision)))
 * 
 *     def debug(self, long depth = -1):             # <<<<<<<<<<<<<<
 *         r"""
 *         Show the internal structure of self (like the ``\x`` command in gp).
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_273debug(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_272debug[] = "\n        Show the internal structure of self (like the ``\\x`` command in gp).\n\n        EXAMPLE::\n\n            sage: pari('[1/2, 1.0*I]').debug()  # random\n            [&=0000000004c5f010] VEC(lg=3):2200000000000003 0000000004c5eff8 0000000004c5efb0\n              1st component = [&=0000000004c5eff8] FRAC(lg=3):0800000000000003 0000000004c5efe0 0000000004c5efc8\n                num = [&=0000000004c5efe0] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001\n                den = [&=0000000004c5efc8] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000002\n              2nd component = [&=0000000004c5efb0] COMPLEX(lg=3):0c00000000000003 00007fae8a2eb840 0000000004c5ef90\n                real = gen_0\n                imag = [&=0000000004c5ef90] REAL(lg=4):0400000000000004 (+,expo=0):6000000000000000 8000000000000000 0000000000000000\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_273debug(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  long __pyx_v_depth;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("debug (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_depth,0};
    PyObject* values[1] = {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  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 (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_depth);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "debug") < 0)) __PYX_ERR(6, 4369, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_depth = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_depth == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 4369, __pyx_L3_error)
    } else {
      __pyx_v_depth = ((long)-1L);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("debug", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(6, 4369, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.debug", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_272debug(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_depth);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_272debug(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, long __pyx_v_depth) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("debug", 0);

  /* "cypari/gen.pyx":4384
 *                 imag = [&=0000000004c5ef90] REAL(lg=4):0400000000000004 (+,expo=0):6000000000000000 8000000000000000 0000000000000000
 *         """
 *         sig_on()             # <<<<<<<<<<<<<<
 *         dbgGEN(self.g, depth)
 *         sig_off()
 */
  __pyx_t_1 = sig_on(); if (unlikely(__pyx_t_1 == ((int)0))) __PYX_ERR(6, 4384, __pyx_L1_error)

  /* "cypari/gen.pyx":4385
 *         """
 *         sig_on()
 *         dbgGEN(self.g, depth)             # <<<<<<<<<<<<<<
 *         sig_off()
 *         return
 */
  dbgGEN(__pyx_v_self->__pyx_base.g, __pyx_v_depth);

  /* "cypari/gen.pyx":4386
 *         sig_on()
 *         dbgGEN(self.g, depth)
 *         sig_off()             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  sig_off();

  /* "cypari/gen.pyx":4387
 *         dbgGEN(self.g, depth)
 *         sig_off()
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def bernvec(x):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "cypari/gen.pyx":4369
 *         return new_gen(ellwp0(self.g, g0, flag, prec_bits_to_words(precision)))
 * 
 *     def debug(self, long depth = -1):             # <<<<<<<<<<<<<<
 *         r"""
 *         Show the internal structure of self (like the ``\x`` command in gp).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("cypari._pari.Gen.debug", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4389
 *         return
 * 
 *     def bernvec(x):             # <<<<<<<<<<<<<<
 *         r"""
 *         Creates a vector containing, as rational numbers, the Bernoulli
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_275bernvec(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_274bernvec[] = "\n        Creates a vector containing, as rational numbers, the Bernoulli\n        numbers `B_0, B_2,\\ldots, B_{2x}`. This routine is\n        obsolete. Use bernfrac instead each time you need a Bernoulli\n        number in exact form.\n\n        Note: this routine is implemented using repeated independent calls\n        to bernfrac, which is faster than the standard recursion in exact\n        arithmetic.\n\n        EXAMPLES::\n\n            sage: pari(8).bernvec()\n            doctest:...: DeprecationWarning: the PARI/GP function bernvec() is obsolete: use repeated calls to bernfrac() instead\n            [1, 1/6, -1/30, 1/42, -1/30, 5/66, -691/2730, 7/6, -3617/510]\n            sage: [pari(2*n).bernfrac() for n in range(9)]\n            [1, 1/6, -1/30, 1/42, -1/30, 5/66, -691/2730, 7/6, -3617/510]\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_275bernvec(PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bernvec (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_274bernvec(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_x));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_274bernvec(struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_x) {
  PyObject *__pyx_v_warn = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  long __pyx_t_4;
  __Pyx_RefNannySetupContext("bernvec", 0);

  /* "cypari/gen.pyx":4408
 *             [1, 1/6, -1/30, 1/42, -1/30, 5/66, -691/2730, 7/6, -3617/510]
 *         """
 *         from warnings import warn             # <<<<<<<<<<<<<<
 *         warn('the PARI/GP function bernvec() is obsolete: use repeated calls to bernfrac() instead', DeprecationWarning)
 *         sig_on()
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_warn);
  __Pyx_GIVEREF(__pyx_n_s_warn);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_warn);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 4408, __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_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_warn = __pyx_t_1;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/gen.pyx":4409
 *         """
 *         from warnings import warn
 *         warn('the PARI/GP function bernvec() is obsolete: use repeated calls to bernfrac() instead', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(bernvec(x))
 */
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_warn, __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 4409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/gen.pyx":4410
 *         from warnings import warn
 *         warn('the PARI/GP function bernvec() is obsolete: use repeated calls to bernfrac() instead', DeprecationWarning)
 *         sig_on()             # <<<<<<<<<<<<<<
 *         return new_gen(bernvec(x))
 * 
 */
  __pyx_t_3 = sig_on(); if (unlikely(__pyx_t_3 == ((int)0))) __PYX_ERR(6, 4410, __pyx_L1_error)

  /* "cypari/gen.pyx":4411
 *         warn('the PARI/GP function bernvec() is obsolete: use repeated calls to bernfrac() instead', DeprecationWarning)
 *         sig_on()
 *         return new_gen(bernvec(x))             # <<<<<<<<<<<<<<
 * 
 *     def allocatemem(self, *args):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyInt_As_long(((PyObject *)__pyx_v_x)); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(6, 4411, __pyx_L1_error)
  __pyx_t_2 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(bernvec(__pyx_t_4))); if (unlikely(!__pyx_t_2)) __PYX_ERR(6, 4411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4389
 *         return
 * 
 *     def bernvec(x):             # <<<<<<<<<<<<<<
 *         r"""
 *         Creates a vector containing, as rational numbers, the Bernoulli
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari._pari.Gen.bernvec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_warn);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4413
 *         return new_gen(bernvec(x))
 * 
 *     def allocatemem(self, *args):             # <<<<<<<<<<<<<<
 *         """
 *         Do not use this. Use ``pari.allocatemem()`` instead.
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_277allocatemem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cypari_5_pari_3Gen_276allocatemem[] = "\n        Do not use this. Use ``pari.allocatemem()`` instead.\n\n        TESTS::\n\n            sage: pari(2**10).allocatemem(2**20)\n            Traceback (most recent call last):\n            ...\n            NotImplementedError: the method allocatemem() should not be used; use pari.allocatemem() instead\n        ";
static PyObject *__pyx_pw_6cypari_5_pari_3Gen_277allocatemem(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allocatemem (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "allocatemem", 0))) return NULL;
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_6cypari_5_pari_3Gen_276allocatemem(((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_self), __pyx_v_args);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_3Gen_276allocatemem(CYTHON_UNUSED struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("allocatemem", 0);

  /* "cypari/gen.pyx":4424
 *             NotImplementedError: the method allocatemem() should not be used; use pari.allocatemem() instead
 *         """
 *         raise NotImplementedError("the method allocatemem() should not be used; use pari.allocatemem() instead")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__101, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(6, 4424, __pyx_L1_error)

  /* "cypari/gen.pyx":4413
 *         return new_gen(bernvec(x))
 * 
 *     def allocatemem(self, *args):             # <<<<<<<<<<<<<<
 *         """
 *         Do not use this. Use ``pari.allocatemem()`` instead.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.Gen.allocatemem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4427
 * 
 * 
 * cdef Gen new_ref(GEN g, Gen parent):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new ``Gen`` pointing to ``g``, which is allocated as a
 */

static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_new_ref(GEN __pyx_v_g, struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_parent) {
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_v_p = 0;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("new_ref", 0);

  /* "cypari/gen.pyx":4450
 *         2
 *     """
 *     cdef Gen p = Gen.__new__(Gen)             # <<<<<<<<<<<<<<
 *     p.g = g
 *     p.b = 0
 */
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_6cypari_5_pari_Gen(((PyTypeObject *)__pyx_ptype_6cypari_5_pari_Gen), __pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4450, __pyx_L1_error)
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_p = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4451
 *     """
 *     cdef Gen p = Gen.__new__(Gen)
 *     p.g = g             # <<<<<<<<<<<<<<
 *     p.b = 0
 *     p.refers_to = {-1: parent}
 */
  __pyx_v_p->__pyx_base.g = __pyx_v_g;

  /* "cypari/gen.pyx":4452
 *     cdef Gen p = Gen.__new__(Gen)
 *     p.g = g
 *     p.b = 0             # <<<<<<<<<<<<<<
 *     p.refers_to = {-1: parent}
 *     return p
 */
  __pyx_v_p->__pyx_base.b = 0;

  /* "cypari/gen.pyx":4453
 *     p.g = g
 *     p.b = 0
 *     p.refers_to = {-1: parent}             # <<<<<<<<<<<<<<
 *     return p
 * 
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_int_neg_1, ((PyObject *)__pyx_v_parent)) < 0) __PYX_ERR(6, 4453, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_p->__pyx_base.refers_to);
  __Pyx_DECREF(__pyx_v_p->__pyx_base.refers_to);
  __pyx_v_p->__pyx_base.refers_to = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "cypari/gen.pyx":4454
 *     p.b = 0
 *     p.refers_to = {-1: parent}
 *     return p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __pyx_r = __pyx_v_p;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4427
 * 
 * 
 * cdef Gen new_ref(GEN g, Gen parent):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new ``Gen`` pointing to ``g``, which is allocated as a
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cypari._pari.new_ref", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4459
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * cdef Gen list_of_Gens_to_Gen(list s):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a Python list whole elements are all :class:`Gen` objects
 */

static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_list_of_Gens_to_Gen(PyObject *__pyx_v_s) {
  Py_ssize_t __pyx_v_length;
  GEN __pyx_v_g;
  Py_ssize_t __pyx_v_i;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("list_of_Gens_to_Gen", 0);

  /* "cypari/gen.pyx":4479
 *         []
 *     """
 *     cdef Py_ssize_t length = len(s)             # <<<<<<<<<<<<<<
 * 
 *     sig_on()
 */
  if (unlikely(__pyx_v_s == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(6, 4479, __pyx_L1_error)
  }
  __pyx_t_1 = PyList_GET_SIZE(__pyx_v_s); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(6, 4479, __pyx_L1_error)
  __pyx_v_length = __pyx_t_1;

  /* "cypari/gen.pyx":4481
 *     cdef Py_ssize_t length = len(s)
 * 
 *     sig_on()             # <<<<<<<<<<<<<<
 *     cdef GEN g = cgetg(length+1, t_VEC)
 * 
 */
  __pyx_t_2 = sig_on(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(6, 4481, __pyx_L1_error)

  /* "cypari/gen.pyx":4482
 * 
 *     sig_on()
 *     cdef GEN g = cgetg(length+1, t_VEC)             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t i
 */
  __pyx_v_g = cgetg((__pyx_v_length + 1), t_VEC);

  /* "cypari/gen.pyx":4485
 * 
 *     cdef Py_ssize_t i
 *     for i in range(length):             # <<<<<<<<<<<<<<
 *         set_gel(g, i+1, (<Gen>s[i]).g)
 *     return new_gen(g)
 */
  __pyx_t_1 = __pyx_v_length;
  __pyx_t_3 = __pyx_t_1;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "cypari/gen.pyx":4486
 *     cdef Py_ssize_t i
 *     for i in range(length):
 *         set_gel(g, i+1, (<Gen>s[i]).g)             # <<<<<<<<<<<<<<
 *     return new_gen(g)
 * 
 */
    if (unlikely(__pyx_v_s == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(6, 4486, __pyx_L1_error)
    }
    (void)(set_gel(__pyx_v_g, (__pyx_v_i + 1), ((struct __pyx_obj_6cypari_5_pari_Gen *)PyList_GET_ITEM(__pyx_v_s, __pyx_v_i))->__pyx_base.g));
  }

  /* "cypari/gen.pyx":4487
 *     for i in range(length):
 *         set_gel(g, i+1, (<Gen>s[i]).g)
 *     return new_gen(g)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_5 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_5)) __PYX_ERR(6, 4487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4459
 * @cython.boundscheck(False)
 * @cython.wraparound(False)
 * cdef Gen list_of_Gens_to_Gen(list s):             # <<<<<<<<<<<<<<
 *     """
 *     Convert a Python list whole elements are all :class:`Gen` objects
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.list_of_Gens_to_Gen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4490
 * 
 * 
 * cpdef Gen objtogen(s):             # <<<<<<<<<<<<<<
 *     """
 *     Convert any Sage/Python object to a PARI :class:`Gen`.
 */

static PyObject *__pyx_pw_6cypari_5_pari_33objtogen(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static struct __pyx_obj_6cypari_5_pari_Gen *__pyx_f_6cypari_5_pari_objtogen(PyObject *__pyx_v_s, CYTHON_UNUSED int __pyx_skip_dispatch) {
  GEN __pyx_v_g;
  PyObject *__pyx_v_L = 0;
  PyObject *__pyx_v_x = NULL;
  struct __pyx_obj_6cypari_5_pari_Gen *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  char const *__pyx_t_10;
  double __pyx_t_11;
  double __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *(*__pyx_t_14)(PyObject *);
  __Pyx_RefNannySetupContext("objtogen", 0);

  /* "cypari/gen.pyx":4584
 *     cdef list L
 * 
 *     if isinstance(s, Gen):             # <<<<<<<<<<<<<<
 *         return s
 *     try:
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_s, __pyx_ptype_6cypari_5_pari_Gen); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":4585
 * 
 *     if isinstance(s, Gen):
 *         return s             # <<<<<<<<<<<<<<
 *     try:
 *         return s._pari_()
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    if (!(likely(((__pyx_v_s) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_s, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(6, 4585, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_s);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_v_s);
    goto __pyx_L0;

    /* "cypari/gen.pyx":4584
 *     cdef list L
 * 
 *     if isinstance(s, Gen):             # <<<<<<<<<<<<<<
 *         return s
 *     try:
 */
  }

  /* "cypari/gen.pyx":4586
 *     if isinstance(s, Gen):
 *         return s
 *     try:             # <<<<<<<<<<<<<<
 *         return s._pari_()
 *     except AttributeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "cypari/gen.pyx":4587
 *         return s
 *     try:
 *         return s._pari_()             # <<<<<<<<<<<<<<
 *     except AttributeError:
 *         pass
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_pari); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 4587, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(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_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4587, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(6, 4587, __pyx_L4_error)
      __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L8_try_return;

      /* "cypari/gen.pyx":4586
 *     if isinstance(s, Gen):
 *         return s
 *     try:             # <<<<<<<<<<<<<<
 *         return s._pari_()
 *     except AttributeError:
 */
    }
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "cypari/gen.pyx":4588
 *     try:
 *         return s._pari_()
 *     except AttributeError:             # <<<<<<<<<<<<<<
 *         pass
 * 
 */
    __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_9) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L5_exception_handled;
    }
    goto __pyx_L6_except_error;
    __pyx_L6_except_error:;

    /* "cypari/gen.pyx":4586
 *     if isinstance(s, Gen):
 *         return s
 *     try:             # <<<<<<<<<<<<<<
 *         return s._pari_()
 *     except AttributeError:
 */
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L8_try_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
  }

  /* "cypari/gen.pyx":4595
 *     # This generates slightly more efficient code than
 *     # isinstance(s, (unicode, bytes))
 *     if PyUnicode_Check(s) | PyBytes_Check(s):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         g = gp_read_str(s)
 */
  __pyx_t_2 = ((PyUnicode_Check(__pyx_v_s) | PyBytes_Check(__pyx_v_s)) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":4596
 *     # isinstance(s, (unicode, bytes))
 *     if PyUnicode_Check(s) | PyBytes_Check(s):
 *         sig_on()             # <<<<<<<<<<<<<<
 *         g = gp_read_str(s)
 *         if g == gnil:
 */
    __pyx_t_9 = sig_on(); if (unlikely(__pyx_t_9 == ((int)0))) __PYX_ERR(6, 4596, __pyx_L1_error)

    /* "cypari/gen.pyx":4597
 *     if PyUnicode_Check(s) | PyBytes_Check(s):
 *         sig_on()
 *         g = gp_read_str(s)             # <<<<<<<<<<<<<<
 *         if g == gnil:
 *             clear_stack()
 */
    __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_s); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(6, 4597, __pyx_L1_error)
    __pyx_v_g = gp_read_str(__pyx_t_10);

    /* "cypari/gen.pyx":4598
 *         sig_on()
 *         g = gp_read_str(s)
 *         if g == gnil:             # <<<<<<<<<<<<<<
 *             clear_stack()
 *             return None
 */
    __pyx_t_2 = ((__pyx_v_g == gnil) != 0);
    if (__pyx_t_2) {

      /* "cypari/gen.pyx":4599
 *         g = gp_read_str(s)
 *         if g == gnil:
 *             clear_stack()             # <<<<<<<<<<<<<<
 *             return None
 *         return new_gen(g)
 */
      __pyx_f_6cypari_5_pari_clear_stack();

      /* "cypari/gen.pyx":4600
 *         if g == gnil:
 *             clear_stack()
 *             return None             # <<<<<<<<<<<<<<
 *         return new_gen(g)
 *     if PyInt_Check(s) | PyLong_Check(s):
 */
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "cypari/gen.pyx":4598
 *         sig_on()
 *         g = gp_read_str(s)
 *         if g == gnil:             # <<<<<<<<<<<<<<
 *             clear_stack()
 *             return None
 */
    }

    /* "cypari/gen.pyx":4601
 *             clear_stack()
 *             return None
 *         return new_gen(g)             # <<<<<<<<<<<<<<
 *     if PyInt_Check(s) | PyLong_Check(s):
 *         return integer_to_gen(s)
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen(__pyx_v_g)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4601, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4595
 *     # This generates slightly more efficient code than
 *     # isinstance(s, (unicode, bytes))
 *     if PyUnicode_Check(s) | PyBytes_Check(s):             # <<<<<<<<<<<<<<
 *         sig_on()
 *         g = gp_read_str(s)
 */
  }

  /* "cypari/gen.pyx":4602
 *             return None
 *         return new_gen(g)
 *     if PyInt_Check(s) | PyLong_Check(s):             # <<<<<<<<<<<<<<
 *         return integer_to_gen(s)
 *     if isinstance(s, float):
 */
  __pyx_t_2 = ((PyInt_Check(__pyx_v_s) | PyLong_Check(__pyx_v_s)) != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":4603
 *         return new_gen(g)
 *     if PyInt_Check(s) | PyLong_Check(s):
 *         return integer_to_gen(s)             # <<<<<<<<<<<<<<
 *     if isinstance(s, float):
 *         return new_gen_from_double(PyFloat_AS_DOUBLE(s))
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_6 = __pyx_f_6cypari_5_pari_integer_to_gen(__pyx_v_s, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_6cypari_5_pari_Gen))))) __PYX_ERR(6, 4603, __pyx_L1_error)
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4602
 *             return None
 *         return new_gen(g)
 *     if PyInt_Check(s) | PyLong_Check(s):             # <<<<<<<<<<<<<<
 *         return integer_to_gen(s)
 *     if isinstance(s, float):
 */
  }

  /* "cypari/gen.pyx":4604
 *     if PyInt_Check(s) | PyLong_Check(s):
 *         return integer_to_gen(s)
 *     if isinstance(s, float):             # <<<<<<<<<<<<<<
 *         return new_gen_from_double(PyFloat_AS_DOUBLE(s))
 *     if isinstance(s, complex):
 */
  __pyx_t_2 = PyFloat_Check(__pyx_v_s); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":4605
 *         return integer_to_gen(s)
 *     if isinstance(s, float):
 *         return new_gen_from_double(PyFloat_AS_DOUBLE(s))             # <<<<<<<<<<<<<<
 *     if isinstance(s, complex):
 *         return new_t_COMPLEX_from_double(PyComplex_RealAsDouble(s), PyComplex_ImagAsDouble(s))
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_gen_from_double(PyFloat_AS_DOUBLE(__pyx_v_s))); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4605, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4604
 *     if PyInt_Check(s) | PyLong_Check(s):
 *         return integer_to_gen(s)
 *     if isinstance(s, float):             # <<<<<<<<<<<<<<
 *         return new_gen_from_double(PyFloat_AS_DOUBLE(s))
 *     if isinstance(s, complex):
 */
  }

  /* "cypari/gen.pyx":4606
 *     if isinstance(s, float):
 *         return new_gen_from_double(PyFloat_AS_DOUBLE(s))
 *     if isinstance(s, complex):             # <<<<<<<<<<<<<<
 *         return new_t_COMPLEX_from_double(PyComplex_RealAsDouble(s), PyComplex_ImagAsDouble(s))
 * 
 */
  __pyx_t_1 = PyComplex_Check(__pyx_v_s); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":4607
 *         return new_gen_from_double(PyFloat_AS_DOUBLE(s))
 *     if isinstance(s, complex):
 *         return new_t_COMPLEX_from_double(PyComplex_RealAsDouble(s), PyComplex_ImagAsDouble(s))             # <<<<<<<<<<<<<<
 * 
 *     # A list is iterable, but we handle the common case of a list
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_11 = PyComplex_RealAsDouble(__pyx_v_s); if (unlikely(__pyx_t_11 == ((double)-1.0) && PyErr_Occurred())) __PYX_ERR(6, 4607, __pyx_L1_error)
    __pyx_t_12 = PyComplex_ImagAsDouble(__pyx_v_s); if (unlikely(__pyx_t_12 == ((double)-1.0) && PyErr_Occurred())) __PYX_ERR(6, 4607, __pyx_L1_error)
    __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_new_t_COMPLEX_from_double(__pyx_t_11, __pyx_t_12)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4607, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4606
 *     if isinstance(s, float):
 *         return new_gen_from_double(PyFloat_AS_DOUBLE(s))
 *     if isinstance(s, complex):             # <<<<<<<<<<<<<<
 *         return new_t_COMPLEX_from_double(PyComplex_RealAsDouble(s), PyComplex_ImagAsDouble(s))
 * 
 */
  }

  /* "cypari/gen.pyx":4611
 *     # A list is iterable, but we handle the common case of a list
 *     # separately as an optimization
 *     if isinstance(s, list):             # <<<<<<<<<<<<<<
 *         L = [objtogen(x) for x in <list>s]
 *         return list_of_Gens_to_Gen(L)
 */
  __pyx_t_2 = PyList_Check(__pyx_v_s); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":4612
 *     # separately as an optimization
 *     if isinstance(s, list):
 *         L = [objtogen(x) for x in <list>s]             # <<<<<<<<<<<<<<
 *         return list_of_Gens_to_Gen(L)
 *     # Check for iterable object s
 */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__pyx_v_s == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(6, 4612, __pyx_L1_error)
    }
    __pyx_t_7 = ((PyObject*)__pyx_v_s); __Pyx_INCREF(__pyx_t_7); __pyx_t_13 = 0;
    for (;;) {
      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_7)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(6, 4612, __pyx_L1_error)
      #else
      __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 4612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 4612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_8))) __PYX_ERR(6, 4612, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_L = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "cypari/gen.pyx":4613
 *     if isinstance(s, list):
 *         L = [objtogen(x) for x in <list>s]
 *         return list_of_Gens_to_Gen(L)             # <<<<<<<<<<<<<<
 *     # Check for iterable object s
 *     try:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_list_of_Gens_to_Gen(__pyx_v_L)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4611
 *     # A list is iterable, but we handle the common case of a list
 *     # separately as an optimization
 *     if isinstance(s, list):             # <<<<<<<<<<<<<<
 *         L = [objtogen(x) for x in <list>s]
 *         return list_of_Gens_to_Gen(L)
 */
  }

  /* "cypari/gen.pyx":4615
 *         return list_of_Gens_to_Gen(L)
 *     # Check for iterable object s
 *     try:             # <<<<<<<<<<<<<<
 *         L = [objtogen(x) for x in s]
 *     except TypeError:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "cypari/gen.pyx":4616
 *     # Check for iterable object s
 *     try:
 *         L = [objtogen(x) for x in s]             # <<<<<<<<<<<<<<
 *     except TypeError:
 *         pass
 */
      __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4616, __pyx_L18_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (likely(PyList_CheckExact(__pyx_v_s)) || PyTuple_CheckExact(__pyx_v_s)) {
        __pyx_t_7 = __pyx_v_s; __Pyx_INCREF(__pyx_t_7); __pyx_t_13 = 0;
        __pyx_t_14 = NULL;
      } else {
        __pyx_t_13 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_s); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 4616, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_14 = Py_TYPE(__pyx_t_7)->tp_iternext; if (unlikely(!__pyx_t_14)) __PYX_ERR(6, 4616, __pyx_L18_error)
      }
      for (;;) {
        if (likely(!__pyx_t_14)) {
          if (likely(PyList_CheckExact(__pyx_t_7))) {
            if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_7)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(6, 4616, __pyx_L18_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 4616, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          } else {
            if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_13); __Pyx_INCREF(__pyx_t_8); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(6, 4616, __pyx_L18_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_7, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 4616, __pyx_L18_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          }
        } else {
          __pyx_t_8 = __pyx_t_14(__pyx_t_7);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(6, 4616, __pyx_L18_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_8 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_x, 0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(6, 4616, __pyx_L18_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_8))) __PYX_ERR(6, 4616, __pyx_L18_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_L = ((PyObject*)__pyx_t_6);
      __pyx_t_6 = 0;

      /* "cypari/gen.pyx":4615
 *         return list_of_Gens_to_Gen(L)
 *     # Check for iterable object s
 *     try:             # <<<<<<<<<<<<<<
 *         L = [objtogen(x) for x in s]
 *     except TypeError:
 */
    }

    /* "cypari/gen.pyx":4620
 *         pass
 *     else:
 *         return list_of_Gens_to_Gen(L)             # <<<<<<<<<<<<<<
 * 
 *     if callable(s):
 */
    /*else:*/ {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_list_of_Gens_to_Gen(__pyx_v_L)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4620, __pyx_L20_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
      __pyx_t_6 = 0;
      goto __pyx_L21_except_return;
    }
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "cypari/gen.pyx":4617
 *     try:
 *         L = [objtogen(x) for x in s]
 *     except TypeError:             # <<<<<<<<<<<<<<
 *         pass
 *     else:
 */
    __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_9) {
      __Pyx_ErrRestore(0,0,0);
      goto __pyx_L19_exception_handled;
    }
    goto __pyx_L20_except_error;
    __pyx_L20_except_error:;

    /* "cypari/gen.pyx":4615
 *         return list_of_Gens_to_Gen(L)
 *     # Check for iterable object s
 *     try:             # <<<<<<<<<<<<<<
 *         L = [objtogen(x) for x in s]
 *     except TypeError:
 */
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L21_except_return:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L19_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3);
  }

  /* "cypari/gen.pyx":4622
 *         return list_of_Gens_to_Gen(L)
 * 
 *     if callable(s):             # <<<<<<<<<<<<<<
 *         return objtoclosure(s)
 * 
 */
  __pyx_t_1 = __Pyx_PyCallable_Check(__pyx_v_s); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(6, 4622, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "cypari/gen.pyx":4623
 * 
 *     if callable(s):
 *         return objtoclosure(s)             # <<<<<<<<<<<<<<
 * 
 *     if s is None:
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));
    __pyx_t_6 = ((PyObject *)__pyx_f_6cypari_5_pari_objtoclosure(__pyx_v_s, 0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4623, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_6);
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4622
 *         return list_of_Gens_to_Gen(L)
 * 
 *     if callable(s):             # <<<<<<<<<<<<<<
 *         return objtoclosure(s)
 * 
 */
  }

  /* "cypari/gen.pyx":4625
 *         return objtoclosure(s)
 * 
 *     if s is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("Cannot convert None to pari")
 * 
 */
  __pyx_t_2 = (__pyx_v_s == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/gen.pyx":4626
 * 
 *     if s is None:
 *         raise ValueError("Cannot convert None to pari")             # <<<<<<<<<<<<<<
 * 
 *     # Simply use the string representation
 */
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__102, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4626, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_Raise(__pyx_t_6, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __PYX_ERR(6, 4626, __pyx_L1_error)

    /* "cypari/gen.pyx":4625
 *         return objtoclosure(s)
 * 
 *     if s is None:             # <<<<<<<<<<<<<<
 *         raise ValueError("Cannot convert None to pari")
 * 
 */
  }

  /* "cypari/gen.pyx":4629
 * 
 *     # Simply use the string representation
 *     return objtogen(str(s))             # <<<<<<<<<<<<<<
 * 
 * cdef GEN _Vec_append(GEN v, GEN a, long n):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_s); if (unlikely(!__pyx_t_6)) __PYX_ERR(6, 4629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_t_6, 0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(6, 4629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = ((struct __pyx_obj_6cypari_5_pari_Gen *)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "cypari/gen.pyx":4490
 * 
 * 
 * cpdef Gen objtogen(s):             # <<<<<<<<<<<<<<
 *     """
 *     Convert any Sage/Python object to a PARI :class:`Gen`.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cypari._pari.objtogen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_L);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_33objtogen(PyObject *__pyx_self, PyObject *__pyx_v_s); /*proto*/
static char __pyx_doc_6cypari_5_pari_32objtogen[] = "\n    Convert any Sage/Python object to a PARI :class:`Gen`.\n\n    For Sage types, this uses the ``_pari_()`` method on the object.\n    Basic Python types like ``int`` are converted directly. For other\n    types, the string representation is used.\n\n    EXAMPLES::\n\n        sage: pari(0)\n        0\n        sage: pari([2,3,5])\n        [2, 3, 5]\n\n    ::\n\n        sage: a = pari(1); a, a.type()\n        (1, 't_INT')\n        sage: from fractions import Fraction\n        sage: a = pari(Fraction('1/2')); a, a.type()\n        (1/2, 't_FRAC')\n\n    Conversion from reals uses the real's own precision::\n\n        sage: a = pari(1.2); a, a.type(), a.precision()\n        (1.20000000000000, 't_REAL', 4) # 32-bit\n        (1.20000000000000, 't_REAL', 3) # 64-bit\n\n    Conversion from strings uses the current PARI real precision.\n    By default, this is 64 bits::\n\n        sage: a = pari('1.2'); a, a.type(), a.precision()\n        (1.20000000000000, 't_REAL', 4)  # 32-bit\n        (1.20000000000000, 't_REAL', 3)  # 64-bit\n\n    Unicode and bytes work fine::\n\n        sage: pari(b\"zeta(3)\")\n        1.20205690315959\n        sage: pari(u\"zeta(3)\")\n        1.20205690315959\n\n    But we can change this precision::\n\n        sage: pari.set_real_precision(35)  # precision in decimal digits\n        15\n        sage: a = pari('1.2'); a, a.type(), a.precision()\n        (1.2000000000000000000000000000000000, 't_REAL', 6)  # 32-bit\n        (1.2000000000000000000000000000000000, 't_REAL', 4)  # 64-bit\n\n    Set the precision to 15 digits for the remaining tests::\n\n        sage: pari.set_real_precision(15)\n        35\n\n    Conversion from basic Python types::\n\n        sage: pari(int(-5))\n        -5\n        sage: pari(2**150)\n        1427247692705959881058285969449495136382746624\n        sage: one = pari(complex(1,0)); one == pari('1')\n        True\n        sage: one.type()\n        't_COMPLEX'\n        sage: pari(complex(0, 1)) == pari('I')\n        Tru""e\n        sage: from math import sin, cos, pi\n        sage: pari(float(pi))\n        3.14159265358979\n        sage: pari(complex(cos(pi/4), sin(pi/4)))\n        0.70710678118654... + 0.70710678118654...*I\n        sage: pari(False)\n        0\n        sage: pari(True)\n        1\n\n    Some commands are just executed without returning a value::\n\n        sage: pari(\"dummy = 0; kill(dummy)\")\n        sage: type(pari(\"dummy = 0; kill(dummy)\")) == type(None)\n        True\n\n    TESTS::\n\n        sage: pari(None)\n        Traceback (most recent call last):\n        ...\n        ValueError: Cannot convert None to pari\n    ";
static PyObject *__pyx_pw_6cypari_5_pari_33objtogen(PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("objtogen (wrapper)", 0);
  __pyx_r = __pyx_pf_6cypari_5_pari_32objtogen(__pyx_self, ((PyObject *)__pyx_v_s));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_32objtogen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("objtogen", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_6cypari_5_pari_objtogen(__pyx_v_s, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4490, __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("cypari._pari.objtogen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/gen.pyx":4631
 *     return objtogen(str(s))
 * 
 * cdef GEN _Vec_append(GEN v, GEN a, long n):             # <<<<<<<<<<<<<<
 *     """
 *     This implements appending zeros (or another constant GEN ``a``) to
 */

static GEN __pyx_f_6cypari_5_pari__Vec_append(GEN __pyx_v_v, GEN __pyx_v_a, long __pyx_v_n) {
  long __pyx_v_lenv;
  GEN __pyx_v_w;
  long __pyx_v_i;
  GEN __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  long __pyx_t_2;
  __Pyx_RefNannySetupContext("_Vec_append", 0);

  /* "cypari/gen.pyx":4653
 *     A GEN of the same type as ``v``.
 *     """
 *     cdef long lenv = lg(v)-1             # <<<<<<<<<<<<<<
 *     cdef GEN w
 *     cdef long i
 */
  __pyx_v_lenv = (lg(__pyx_v_v) - 1);

  /* "cypari/gen.pyx":4657
 *     cdef long i
 *     # Do we need to extend the vector with zeros?
 *     if n > lenv:             # <<<<<<<<<<<<<<
 *         w = cgetg(n+1, typ(v))
 *         for i from 1 <= i <= lenv:
 */
  __pyx_t_1 = ((__pyx_v_n > __pyx_v_lenv) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":4658
 *     # Do we need to extend the vector with zeros?
 *     if n > lenv:
 *         w = cgetg(n+1, typ(v))             # <<<<<<<<<<<<<<
 *         for i from 1 <= i <= lenv:
 *             set_gel(w, i, gel(v, i))
 */
    __pyx_v_w = cgetg((__pyx_v_n + 1), typ(__pyx_v_v));

    /* "cypari/gen.pyx":4659
 *     if n > lenv:
 *         w = cgetg(n+1, typ(v))
 *         for i from 1 <= i <= lenv:             # <<<<<<<<<<<<<<
 *             set_gel(w, i, gel(v, i))
 *         for i from 1 <= i <= n-lenv:
 */
    __pyx_t_2 = __pyx_v_lenv;
    for (__pyx_v_i = 1; __pyx_v_i <= __pyx_t_2; __pyx_v_i++) {

      /* "cypari/gen.pyx":4660
 *         w = cgetg(n+1, typ(v))
 *         for i from 1 <= i <= lenv:
 *             set_gel(w, i, gel(v, i))             # <<<<<<<<<<<<<<
 *         for i from 1 <= i <= n-lenv:
 *             set_gel(w, i+lenv, a)
 */
      (void)(set_gel(__pyx_v_w, __pyx_v_i, gel(__pyx_v_v, __pyx_v_i)));
    }

    /* "cypari/gen.pyx":4661
 *         for i from 1 <= i <= lenv:
 *             set_gel(w, i, gel(v, i))
 *         for i from 1 <= i <= n-lenv:             # <<<<<<<<<<<<<<
 *             set_gel(w, i+lenv, a)
 *         return w
 */
    __pyx_t_2 = (__pyx_v_n - __pyx_v_lenv);
    for (__pyx_v_i = 1; __pyx_v_i <= __pyx_t_2; __pyx_v_i++) {

      /* "cypari/gen.pyx":4662
 *             set_gel(w, i, gel(v, i))
 *         for i from 1 <= i <= n-lenv:
 *             set_gel(w, i+lenv, a)             # <<<<<<<<<<<<<<
 *         return w
 *     elif n < -lenv:
 */
      (void)(set_gel(__pyx_v_w, (__pyx_v_i + __pyx_v_lenv), __pyx_v_a));
    }

    /* "cypari/gen.pyx":4663
 *         for i from 1 <= i <= n-lenv:
 *             set_gel(w, i+lenv, a)
 *         return w             # <<<<<<<<<<<<<<
 *     elif n < -lenv:
 *         n = -n  # Make n positive
 */
    __pyx_r = __pyx_v_w;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4657
 *     cdef long i
 *     # Do we need to extend the vector with zeros?
 *     if n > lenv:             # <<<<<<<<<<<<<<
 *         w = cgetg(n+1, typ(v))
 *         for i from 1 <= i <= lenv:
 */
  }

  /* "cypari/gen.pyx":4664
 *             set_gel(w, i+lenv, a)
 *         return w
 *     elif n < -lenv:             # <<<<<<<<<<<<<<
 *         n = -n  # Make n positive
 *         w = cgetg(n+1, typ(v))
 */
  __pyx_t_1 = ((__pyx_v_n < (-__pyx_v_lenv)) != 0);
  if (__pyx_t_1) {

    /* "cypari/gen.pyx":4665
 *         return w
 *     elif n < -lenv:
 *         n = -n  # Make n positive             # <<<<<<<<<<<<<<
 *         w = cgetg(n+1, typ(v))
 *         for i from 1 <= i <= lenv:
 */
    __pyx_v_n = (-__pyx_v_n);

    /* "cypari/gen.pyx":4666
 *     elif n < -lenv:
 *         n = -n  # Make n positive
 *         w = cgetg(n+1, typ(v))             # <<<<<<<<<<<<<<
 *         for i from 1 <= i <= lenv:
 *             set_gel(w, i+(n-lenv), gel(v, i))
 */
    __pyx_v_w = cgetg((__pyx_v_n + 1), typ(__pyx_v_v));

    /* "cypari/gen.pyx":4667
 *         n = -n  # Make n positive
 *         w = cgetg(n+1, typ(v))
 *         for i from 1 <= i <= lenv:             # <<<<<<<<<<<<<<
 *             set_gel(w, i+(n-lenv), gel(v, i))
 *         for i from 1 <= i <= n-lenv:
 */
    __pyx_t_2 = __pyx_v_lenv;
    for (__pyx_v_i = 1; __pyx_v_i <= __pyx_t_2; __pyx_v_i++) {

      /* "cypari/gen.pyx":4668
 *         w = cgetg(n+1, typ(v))
 *         for i from 1 <= i <= lenv:
 *             set_gel(w, i+(n-lenv), gel(v, i))             # <<<<<<<<<<<<<<
 *         for i from 1 <= i <= n-lenv:
 *             set_gel(w, i, a)
 */
      (void)(set_gel(__pyx_v_w, (__pyx_v_i + (__pyx_v_n - __pyx_v_lenv)), gel(__pyx_v_v, __pyx_v_i)));
    }

    /* "cypari/gen.pyx":4669
 *         for i from 1 <= i <= lenv:
 *             set_gel(w, i+(n-lenv), gel(v, i))
 *         for i from 1 <= i <= n-lenv:             # <<<<<<<<<<<<<<
 *             set_gel(w, i, a)
 *         return w
 */
    __pyx_t_2 = (__pyx_v_n - __pyx_v_lenv);
    for (__pyx_v_i = 1; __pyx_v_i <= __pyx_t_2; __pyx_v_i++) {

      /* "cypari/gen.pyx":4670
 *             set_gel(w, i+(n-lenv), gel(v, i))
 *         for i from 1 <= i <= n-lenv:
 *             set_gel(w, i, a)             # <<<<<<<<<<<<<<
 *         return w
 *     else:
 */
      (void)(set_gel(__pyx_v_w, __pyx_v_i, __pyx_v_a));
    }

    /* "cypari/gen.pyx":4671
 *         for i from 1 <= i <= n-lenv:
 *             set_gel(w, i, a)
 *         return w             # <<<<<<<<<<<<<<
 *     else:
 *         return v
 */
    __pyx_r = __pyx_v_w;
    goto __pyx_L0;

    /* "cypari/gen.pyx":4664
 *             set_gel(w, i+lenv, a)
 *         return w
 *     elif n < -lenv:             # <<<<<<<<<<<<<<
 *         n = -n  # Make n positive
 *         w = cgetg(n+1, typ(v))
 */
  }

  /* "cypari/gen.pyx":4673
 *         return w
 *     else:
 *         return v             # <<<<<<<<<<<<<<
 */
  /*else*/ {
    __pyx_r = __pyx_v_v;
    goto __pyx_L0;
  }

  /* "cypari/gen.pyx":4631
 *     return objtogen(str(s))
 * 
 * cdef GEN _Vec_append(GEN v, GEN a, long n):             # <<<<<<<<<<<<<<
 *     """
 *     This implements appending zeros (or another constant GEN ``a``) to
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Pari_auto(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_6cypari_5_pari_35__pyx_unpickle_Pari_auto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6cypari_5_pari_35__pyx_unpickle_Pari_auto = {"__pyx_unpickle_Pari_auto", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_35__pyx_unpickle_Pari_auto, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_6cypari_5_pari_35__pyx_unpickle_Pari_auto(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Pari_auto (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 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_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Pari_auto", 1, 3, 3, 1); __PYX_ERR(8, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Pari_auto", 1, 3, 3, 2); __PYX_ERR(8, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Pari_auto") < 0)) __PYX_ERR(8, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(8, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Pari_auto", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(8, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("cypari._pari.__pyx_unpickle_Pari_auto", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_6cypari_5_pari_34__pyx_unpickle_Pari_auto(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_6cypari_5_pari_34__pyx_unpickle_Pari_auto(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Pari_auto", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Pari_auto.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum != 0xd41d8cd:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Pari_auto.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(8, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0xd41d8cd:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Pari_auto.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Pari_auto__set_state(<Pari_auto> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6cypari_5_pari_Pari_auto), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(8, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(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_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Pari_auto.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Pari_auto__set_state(<Pari_auto> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __pyx_result = Pari_auto.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Pari_auto__set_state(<Pari_auto> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Pari_auto__set_state(Pari_auto __pyx_result, tuple __pyx_state):
 */
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(8, 9, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_6cypari_5_pari___pyx_unpickle_Pari_auto__set_state(((struct __pyx_obj_6cypari_5_pari_Pari_auto *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(8, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum)
 *     __pyx_result = Pari_auto.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Pari_auto__set_state(<Pari_auto> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Pari_auto__set_state(<Pari_auto> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Pari_auto__set_state(Pari_auto __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Pari_auto(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("cypari._pari.__pyx_unpickle_Pari_auto", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_Pari_auto__set_state(<Pari_auto> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Pari_auto__set_state(Pari_auto __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

static PyObject *__pyx_f_6cypari_5_pari___pyx_unpickle_Pari_auto__set_state(struct __pyx_obj_6cypari_5_pari_Pari_auto *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Pari_auto__set_state", 0);

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Pari_auto__set_state(Pari_auto __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(8, 12, __pyx_L1_error)
  }
  __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_3 = ((__pyx_t_2 > 0) != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(8, 12, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_Pari_auto__set_state(Pari_auto __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(8, 13, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(8, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_Pari_auto__set_state(Pari_auto __pyx_result, tuple __pyx_state):
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_Pari_auto__set_state(<Pari_auto> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Pari_auto__set_state(Pari_auto __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[0])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("cypari._pari.__pyx_unpickle_Pari_auto__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/_pari.pxd":85
 * # (PyErr_Occurred() is non-NULL). To Cython, it will look like
 * # cython_check_exception() actually raised the exception.
 * cdef inline void cython_check_exception() nogil except *:             # <<<<<<<<<<<<<<
 *     pass
 * 
 */

static CYTHON_INLINE void __pyx_f_6cypari_5_pari_cython_check_exception(void) {

  /* function exit code */
}

/* "paridecl.pxd":5172
 * 
 * # Work around a bug in PARI's is_universal_constant()
 * cdef inline int is_universal_constant(GEN x):             # <<<<<<<<<<<<<<
 *     return _is_universal_constant(x) or (x is err_e_STACK)
 * 
 */

static CYTHON_INLINE int __pyx_f_6cypari_8paridecl_is_universal_constant(GEN __pyx_v_x) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("is_universal_constant", 0);

  /* "paridecl.pxd":5173
 * # Work around a bug in PARI's is_universal_constant()
 * cdef inline int is_universal_constant(GEN x):
 *     return _is_universal_constant(x) or (x is err_e_STACK)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = is_universal_constant(__pyx_v_x);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_x == err_e_STACK);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "paridecl.pxd":5172
 * 
 * # Work around a bug in PARI's is_universal_constant()
 * cdef inline int is_universal_constant(GEN x):             # <<<<<<<<<<<<<<
 *     return _is_universal_constant(x) or (x is err_e_STACK)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "paridecl.pxd":5182
 * 
 * 
 * cdef inline int is_on_stack(GEN x) except -1:             # <<<<<<<<<<<<<<
 *     """
 *     Is the GEN ``x`` stored on the PARI stack?
 */

static CYTHON_INLINE int __pyx_f_6cypari_8paridecl_is_on_stack(GEN __pyx_v_x) {
  pari_sp __pyx_v_s;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("is_on_stack", 0);

  /* "paridecl.pxd":5186
 *     Is the GEN ``x`` stored on the PARI stack?
 *     """
 *     s = <pari_sp>x             # <<<<<<<<<<<<<<
 *     if avma <= s:
 *         return s < pari_mainstack.top
 */
  __pyx_v_s = ((pari_sp)__pyx_v_x);

  /* "paridecl.pxd":5187
 *     """
 *     s = <pari_sp>x
 *     if avma <= s:             # <<<<<<<<<<<<<<
 *         return s < pari_mainstack.top
 *     if pari_mainstack.vbot <= s:
 */
  __pyx_t_1 = ((avma <= __pyx_v_s) != 0);
  if (__pyx_t_1) {

    /* "paridecl.pxd":5188
 *     s = <pari_sp>x
 *     if avma <= s:
 *         return s < pari_mainstack.top             # <<<<<<<<<<<<<<
 *     if pari_mainstack.vbot <= s:
 *         raise SystemError("PARI object in unused part of PARI stack")
 */
    __pyx_r = (__pyx_v_s < pari_mainstack->top);
    goto __pyx_L0;

    /* "paridecl.pxd":5187
 *     """
 *     s = <pari_sp>x
 *     if avma <= s:             # <<<<<<<<<<<<<<
 *         return s < pari_mainstack.top
 *     if pari_mainstack.vbot <= s:
 */
  }

  /* "paridecl.pxd":5189
 *     if avma <= s:
 *         return s < pari_mainstack.top
 *     if pari_mainstack.vbot <= s:             # <<<<<<<<<<<<<<
 *         raise SystemError("PARI object in unused part of PARI stack")
 *     return 0
 */
  __pyx_t_1 = ((pari_mainstack->vbot <= __pyx_v_s) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "paridecl.pxd":5190
 *         return s < pari_mainstack.top
 *     if pari_mainstack.vbot <= s:
 *         raise SystemError("PARI object in unused part of PARI stack")             # <<<<<<<<<<<<<<
 *     return 0
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_SystemError, __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(11, 5190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(11, 5190, __pyx_L1_error)

    /* "paridecl.pxd":5189
 *     if avma <= s:
 *         return s < pari_mainstack.top
 *     if pari_mainstack.vbot <= s:             # <<<<<<<<<<<<<<
 *         raise SystemError("PARI object in unused part of PARI stack")
 *     return 0
 */
  }

  /* "paridecl.pxd":5191
 *     if pari_mainstack.vbot <= s:
 *         raise SystemError("PARI object in unused part of PARI stack")
 *     return 0             # <<<<<<<<<<<<<<
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "paridecl.pxd":5182
 * 
 * 
 * cdef inline int is_on_stack(GEN x) except -1:             # <<<<<<<<<<<<<<
 *     """
 *     Is the GEN ``x`` stored on the PARI stack?
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cypari.paridecl.is_on_stack", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/memory.pxd":41
 * 
 * 
 * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     cdef void* ret = malloc(n)
 */

static CYTHON_INLINE void *sig_malloc(size_t __pyx_v_n) {
  void *__pyx_v_ret;
  void *__pyx_r;

  /* "cypari/memory.pxd":42
 * 
 * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
 *     sig_block()             # <<<<<<<<<<<<<<
 *     cdef void* ret = malloc(n)
 *     sig_unblock()
 */
  sig_block();

  /* "cypari/memory.pxd":43
 * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
 *     sig_block()
 *     cdef void* ret = malloc(n)             # <<<<<<<<<<<<<<
 *     sig_unblock()
 *     return ret
 */
  __pyx_v_ret = malloc(__pyx_v_n);

  /* "cypari/memory.pxd":44
 *     sig_block()
 *     cdef void* ret = malloc(n)
 *     sig_unblock()             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
  sig_unblock();

  /* "cypari/memory.pxd":45
 *     cdef void* ret = malloc(n)
 *     sig_unblock()
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":41
 * 
 * 
 * cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     cdef void* ret = malloc(n)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "cypari/memory.pxd":48
 * 
 * 
 * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     cdef void* ret = realloc(ptr, size)
 */

static CYTHON_INLINE void *sig_realloc(void *__pyx_v_ptr, size_t __pyx_v_size) {
  void *__pyx_v_ret;
  void *__pyx_r;

  /* "cypari/memory.pxd":49
 * 
 * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
 *     sig_block()             # <<<<<<<<<<<<<<
 *     cdef void* ret = realloc(ptr, size)
 *     sig_unblock()
 */
  sig_block();

  /* "cypari/memory.pxd":50
 * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
 *     sig_block()
 *     cdef void* ret = realloc(ptr, size)             # <<<<<<<<<<<<<<
 *     sig_unblock()
 *     return ret
 */
  __pyx_v_ret = realloc(__pyx_v_ptr, __pyx_v_size);

  /* "cypari/memory.pxd":51
 *     sig_block()
 *     cdef void* ret = realloc(ptr, size)
 *     sig_unblock()             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
  sig_unblock();

  /* "cypari/memory.pxd":52
 *     cdef void* ret = realloc(ptr, size)
 *     sig_unblock()
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":48
 * 
 * 
 * cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     cdef void* ret = realloc(ptr, size)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "cypari/memory.pxd":55
 * 
 * 
 * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     cdef void* ret = calloc(nmemb, size)
 */

static CYTHON_INLINE void *sig_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
  void *__pyx_v_ret;
  void *__pyx_r;

  /* "cypari/memory.pxd":56
 * 
 * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
 *     sig_block()             # <<<<<<<<<<<<<<
 *     cdef void* ret = calloc(nmemb, size)
 *     sig_unblock()
 */
  sig_block();

  /* "cypari/memory.pxd":57
 * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
 *     sig_block()
 *     cdef void* ret = calloc(nmemb, size)             # <<<<<<<<<<<<<<
 *     sig_unblock()
 *     return ret
 */
  __pyx_v_ret = calloc(__pyx_v_nmemb, __pyx_v_size);

  /* "cypari/memory.pxd":58
 *     sig_block()
 *     cdef void* ret = calloc(nmemb, size)
 *     sig_unblock()             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
  sig_unblock();

  /* "cypari/memory.pxd":59
 *     cdef void* ret = calloc(nmemb, size)
 *     sig_unblock()
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":55
 * 
 * 
 * cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     cdef void* ret = calloc(nmemb, size)
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "cypari/memory.pxd":62
 * 
 * 
 * cdef inline void sig_free "sig_free"(void* ptr) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     free(ptr)
 */

static CYTHON_INLINE void sig_free(void *__pyx_v_ptr) {

  /* "cypari/memory.pxd":63
 * 
 * cdef inline void sig_free "sig_free"(void* ptr) nogil:
 *     sig_block()             # <<<<<<<<<<<<<<
 *     free(ptr)
 *     sig_unblock()
 */
  sig_block();

  /* "cypari/memory.pxd":64
 * cdef inline void sig_free "sig_free"(void* ptr) nogil:
 *     sig_block()
 *     free(ptr)             # <<<<<<<<<<<<<<
 *     sig_unblock()
 * 
 */
  free(__pyx_v_ptr);

  /* "cypari/memory.pxd":65
 *     sig_block()
 *     free(ptr)
 *     sig_unblock()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  sig_unblock();

  /* "cypari/memory.pxd":62
 * 
 * 
 * cdef inline void sig_free "sig_free"(void* ptr) nogil:             # <<<<<<<<<<<<<<
 *     sig_block()
 *     free(ptr)
 */

  /* function exit code */
}

/* "cypari/memory.pxd":69
 * 
 * @cython.cdivision(True)
 * cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Return a*b, checking for overflow. Assume that a > 0.
 */

static CYTHON_INLINE size_t __pyx_f_6cypari_6memory_mul_overflowcheck(size_t __pyx_v_a, size_t __pyx_v_b) {
  size_t __pyx_v_MUL_NO_OVERFLOW;
  size_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "cypari/memory.pxd":76
 *     """
 *     # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
 *     cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))             # <<<<<<<<<<<<<<
 *     if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
 *         if unlikely(b > (<size_t>-1) // a):
 */
  __pyx_v_MUL_NO_OVERFLOW = (((size_t)1) << (4 * (sizeof(size_t))));

  /* "cypari/memory.pxd":77
 *     # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
 *     cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
 *     if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:             # <<<<<<<<<<<<<<
 *         if unlikely(b > (<size_t>-1) // a):
 *             return <size_t>(-1)
 */
  __pyx_t_2 = ((__pyx_v_a >= __pyx_v_MUL_NO_OVERFLOW) != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = ((__pyx_v_b >= __pyx_v_MUL_NO_OVERFLOW) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "cypari/memory.pxd":78
 *     cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
 *     if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
 *         if unlikely(b > (<size_t>-1) // a):             # <<<<<<<<<<<<<<
 *             return <size_t>(-1)
 *     return a*b
 */
    __pyx_t_1 = (unlikely((__pyx_v_b > (((size_t)-1L) / __pyx_v_a))) != 0);
    if (__pyx_t_1) {

      /* "cypari/memory.pxd":79
 *     if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
 *         if unlikely(b > (<size_t>-1) // a):
 *             return <size_t>(-1)             # <<<<<<<<<<<<<<
 *     return a*b
 * 
 */
      __pyx_r = ((size_t)-1L);
      goto __pyx_L0;

      /* "cypari/memory.pxd":78
 *     cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
 *     if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
 *         if unlikely(b > (<size_t>-1) // a):             # <<<<<<<<<<<<<<
 *             return <size_t>(-1)
 *     return a*b
 */
    }

    /* "cypari/memory.pxd":77
 *     # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
 *     cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
 *     if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:             # <<<<<<<<<<<<<<
 *         if unlikely(b > (<size_t>-1) // a):
 *             return <size_t>(-1)
 */
  }

  /* "cypari/memory.pxd":80
 *         if unlikely(b > (<size_t>-1) // a):
 *             return <size_t>(-1)
 *     return a*b             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = (__pyx_v_a * __pyx_v_b);
  goto __pyx_L0;

  /* "cypari/memory.pxd":69
 * 
 * @cython.cdivision(True)
 * cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Return a*b, checking for overflow. Assume that a > 0.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "cypari/memory.pxd":83
 * 
 * 
 * cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Allocate memory for ``nmemb`` elements of size ``size``.
 */

static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_allocarray(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
  size_t __pyx_v_n;
  void *__pyx_v_ret;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("check_allocarray", 0);

  /* "cypari/memory.pxd":87
 *     Allocate memory for ``nmemb`` elements of size ``size``.
 *     """
 *     if nmemb == 0:             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 */
  __pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/memory.pxd":88
 *     """
 *     if nmemb == 0:
 *         return NULL             # <<<<<<<<<<<<<<
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_malloc(n)
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "cypari/memory.pxd":87
 *     Allocate memory for ``nmemb`` elements of size ``size``.
 *     """
 *     if nmemb == 0:             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 */
  }

  /* "cypari/memory.pxd":89
 *     if nmemb == 0:
 *         return NULL
 *     cdef size_t n = mul_overflowcheck(nmemb, size)             # <<<<<<<<<<<<<<
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):
 */
  __pyx_v_n = __pyx_f_6cypari_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);

  /* "cypari/memory.pxd":90
 *         return NULL
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_malloc(n)             # <<<<<<<<<<<<<<
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 */
  __pyx_v_ret = sig_malloc(__pyx_v_n);

  /* "cypari/memory.pxd":91
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret
 */
  __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/memory.pxd":92
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_MemoryError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 92, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(12, 92, __pyx_L1_error)

    /* "cypari/memory.pxd":91
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret
 */
  }

  /* "cypari/memory.pxd":93
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":83
 * 
 * 
 * cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Allocate memory for ``nmemb`` elements of size ``size``.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari.memory.check_allocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/memory.pxd":96
 * 
 * 
 * cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
 */

static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_reallocarray(void *__pyx_v_ptr, size_t __pyx_v_nmemb, size_t __pyx_v_size) {
  size_t __pyx_v_n;
  void *__pyx_v_ret;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("check_reallocarray", 0);

  /* "cypari/memory.pxd":104
 *     When ``nmemb`` equals 0, then free the memory at ``ptr``.
 *     """
 *     if nmemb == 0:             # <<<<<<<<<<<<<<
 *         sig_free(ptr)
 *         return NULL
 */
  __pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/memory.pxd":105
 *     """
 *     if nmemb == 0:
 *         sig_free(ptr)             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 */
    sig_free(__pyx_v_ptr);

    /* "cypari/memory.pxd":106
 *     if nmemb == 0:
 *         sig_free(ptr)
 *         return NULL             # <<<<<<<<<<<<<<
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_realloc(ptr, n)
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "cypari/memory.pxd":104
 *     When ``nmemb`` equals 0, then free the memory at ``ptr``.
 *     """
 *     if nmemb == 0:             # <<<<<<<<<<<<<<
 *         sig_free(ptr)
 *         return NULL
 */
  }

  /* "cypari/memory.pxd":107
 *         sig_free(ptr)
 *         return NULL
 *     cdef size_t n = mul_overflowcheck(nmemb, size)             # <<<<<<<<<<<<<<
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):
 */
  __pyx_v_n = __pyx_f_6cypari_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);

  /* "cypari/memory.pxd":108
 *         return NULL
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_realloc(ptr, n)             # <<<<<<<<<<<<<<
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 */
  __pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);

  /* "cypari/memory.pxd":109
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret
 */
  __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/memory.pxd":110
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_MemoryError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(12, 110, __pyx_L1_error)

    /* "cypari/memory.pxd":109
 *     cdef size_t n = mul_overflowcheck(nmemb, size)
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret
 */
  }

  /* "cypari/memory.pxd":111
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":96
 * 
 * 
 * cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari.memory.check_reallocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/memory.pxd":114
 * 
 * 
 * cdef inline void* check_malloc(size_t n) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Allocate ``n`` bytes of memory.
 */

static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_malloc(size_t __pyx_v_n) {
  void *__pyx_v_ret;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("check_malloc", 0);

  /* "cypari/memory.pxd":118
 *     Allocate ``n`` bytes of memory.
 *     """
 *     if n == 0:             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef void* ret = sig_malloc(n)
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/memory.pxd":119
 *     """
 *     if n == 0:
 *         return NULL             # <<<<<<<<<<<<<<
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "cypari/memory.pxd":118
 *     Allocate ``n`` bytes of memory.
 *     """
 *     if n == 0:             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef void* ret = sig_malloc(n)
 */
  }

  /* "cypari/memory.pxd":120
 *     if n == 0:
 *         return NULL
 *     cdef void* ret = sig_malloc(n)             # <<<<<<<<<<<<<<
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s bytes" % n)
 */
  __pyx_v_ret = sig_malloc(__pyx_v_n);

  /* "cypari/memory.pxd":121
 *         return NULL
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s bytes" % n)
 *     return ret
 */
  __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/memory.pxd":122
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s bytes" % n)             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_MemoryError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 122, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(12, 122, __pyx_L1_error)

    /* "cypari/memory.pxd":121
 *         return NULL
 *     cdef void* ret = sig_malloc(n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s bytes" % n)
 *     return ret
 */
  }

  /* "cypari/memory.pxd":123
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s bytes" % n)
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":114
 * 
 * 
 * cdef inline void* check_malloc(size_t n) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Allocate ``n`` bytes of memory.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari.memory.check_malloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/memory.pxd":126
 * 
 * 
 * cdef inline void* check_realloc(void* ptr, size_t n) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Re-allocate memory at ``ptr`` to hold ``n`` bytes.
 */

static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_realloc(void *__pyx_v_ptr, size_t __pyx_v_n) {
  void *__pyx_v_ret;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("check_realloc", 0);

  /* "cypari/memory.pxd":131
 *     If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
 *     """
 *     if n == 0:             # <<<<<<<<<<<<<<
 *         sig_free(ptr)
 *         return NULL
 */
  __pyx_t_1 = ((__pyx_v_n == 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/memory.pxd":132
 *     """
 *     if n == 0:
 *         sig_free(ptr)             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef void* ret = sig_realloc(ptr, n)
 */
    sig_free(__pyx_v_ptr);

    /* "cypari/memory.pxd":133
 *     if n == 0:
 *         sig_free(ptr)
 *         return NULL             # <<<<<<<<<<<<<<
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "cypari/memory.pxd":131
 *     If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
 *     """
 *     if n == 0:             # <<<<<<<<<<<<<<
 *         sig_free(ptr)
 *         return NULL
 */
  }

  /* "cypari/memory.pxd":134
 *         sig_free(ptr)
 *         return NULL
 *     cdef void* ret = sig_realloc(ptr, n)             # <<<<<<<<<<<<<<
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s bytes" % n)
 */
  __pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);

  /* "cypari/memory.pxd":135
 *         return NULL
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s bytes" % n)
 *     return ret
 */
  __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/memory.pxd":136
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s bytes" % n)             # <<<<<<<<<<<<<<
 *     return ret
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_MemoryError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(12, 136, __pyx_L1_error)

    /* "cypari/memory.pxd":135
 *         return NULL
 *     cdef void* ret = sig_realloc(ptr, n)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s bytes" % n)
 *     return ret
 */
  }

  /* "cypari/memory.pxd":137
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s bytes" % n)
 *     return ret             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":126
 * 
 * 
 * cdef inline void* check_realloc(void* ptr, size_t n) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Re-allocate memory at ``ptr`` to hold ``n`` bytes.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cypari.memory.check_realloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "cypari/memory.pxd":140
 * 
 * 
 * cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Allocate memory for ``nmemb`` elements of size ``size``. The
 */

static CYTHON_INLINE void *__pyx_f_6cypari_6memory_check_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
  void *__pyx_v_ret;
  void *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("check_calloc", 0);

  /* "cypari/memory.pxd":145
 *     resulting memory is zeroed.
 *     """
 *     if nmemb == 0:             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef void* ret = sig_calloc(nmemb, size)
 */
  __pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
  if (__pyx_t_1) {

    /* "cypari/memory.pxd":146
 *     """
 *     if nmemb == 0:
 *         return NULL             # <<<<<<<<<<<<<<
 *     cdef void* ret = sig_calloc(nmemb, size)
 *     if unlikely(ret == NULL):
 */
    __pyx_r = NULL;
    goto __pyx_L0;

    /* "cypari/memory.pxd":145
 *     resulting memory is zeroed.
 *     """
 *     if nmemb == 0:             # <<<<<<<<<<<<<<
 *         return NULL
 *     cdef void* ret = sig_calloc(nmemb, size)
 */
  }

  /* "cypari/memory.pxd":147
 *     if nmemb == 0:
 *         return NULL
 *     cdef void* ret = sig_calloc(nmemb, size)             # <<<<<<<<<<<<<<
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 */
  __pyx_v_ret = sig_calloc(__pyx_v_nmemb, __pyx_v_size);

  /* "cypari/memory.pxd":148
 *         return NULL
 *     cdef void* ret = sig_calloc(nmemb, size)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret
 */
  __pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
  if (unlikely(__pyx_t_1)) {

    /* "cypari/memory.pxd":149
 *     cdef void* ret = sig_calloc(nmemb, size)
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))             # <<<<<<<<<<<<<<
 *     return ret
 */
    __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(12, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(12, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_MemoryError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(12, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(12, 149, __pyx_L1_error)

    /* "cypari/memory.pxd":148
 *         return NULL
 *     cdef void* ret = sig_calloc(nmemb, size)
 *     if unlikely(ret == NULL):             # <<<<<<<<<<<<<<
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret
 */
  }

  /* "cypari/memory.pxd":150
 *     if unlikely(ret == NULL):
 *         raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
 *     return ret             # <<<<<<<<<<<<<<
 */
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  /* "cypari/memory.pxd":140
 * 
 * 
 * cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Allocate memory for ``nmemb`` elements of size ``size``. The
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cypari.memory.check_calloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_6cypari_5_pari_RingElement(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari_RingElement(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyTypeObject __pyx_type_6cypari_5_pari_RingElement = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.RingElement", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari_RingElement), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari_RingElement, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari_RingElement, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyObject *__pyx_tp_new_6cypari_5_pari_Gen_base(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6cypari_5_pari_Gen_base *p;
  PyObject *o = __pyx_tp_new_6cypari_5_pari_RingElement(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6cypari_5_pari_Gen_base *)o);
  p->refers_to = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari_Gen_base(PyObject *o) {
  struct __pyx_obj_6cypari_5_pari_Gen_base *p = (struct __pyx_obj_6cypari_5_pari_Gen_base *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->refers_to);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6cypari_5_pari_RingElement(o);
}

static int __pyx_tp_traverse_6cypari_5_pari_Gen_base(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cypari_5_pari_Gen_base *p = (struct __pyx_obj_6cypari_5_pari_Gen_base *)o;
  e = ((likely(__pyx_ptype_6cypari_5_pari_RingElement)) ? ((__pyx_ptype_6cypari_5_pari_RingElement->tp_traverse) ? __pyx_ptype_6cypari_5_pari_RingElement->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6cypari_5_pari_Gen_base)); if (e) return e;
  if (p->refers_to) {
    e = (*v)(p->refers_to, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6cypari_5_pari_Gen_base(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6cypari_5_pari_Gen_base *p = (struct __pyx_obj_6cypari_5_pari_Gen_base *)o;
  if (likely(__pyx_ptype_6cypari_5_pari_RingElement)) { if (__pyx_ptype_6cypari_5_pari_RingElement->tp_clear) __pyx_ptype_6cypari_5_pari_RingElement->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6cypari_5_pari_Gen_base);
  tmp = ((PyObject*)p->refers_to);
  p->refers_to = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_6cypari_5_pari_Gen_base[] = {
  {"Col", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1Col, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_Col},
  {"Colrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_3Colrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_2Colrev},
  {"List", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_5List, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_4List},
  {"Map", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_7Map, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_6Map},
  {"Mat", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_9Mat, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_8Mat},
  {"Mod", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_11Mod, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_10Mod},
  {"Pol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_13Pol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_12Pol},
  {"Polrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_15Polrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_14Polrev},
  {"Qfb", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_17Qfb, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_16Qfb},
  {"Ser", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_19Ser, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_18Ser},
  {"Set", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_21Set, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_20Set},
  {"Strchr", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_23Strchr, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_22Strchr},
  {"Vec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_25Vec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_24Vec},
  {"Vecrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_27Vecrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_26Vecrev},
  {"Vecsmall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_29Vecsmall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_28Vecsmall},
  {"abs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_31abs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_30abs},
  {"acos", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_33acos, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_32acos},
  {"acosh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_35acosh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_34acosh},
  {"addprimes", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_37addprimes, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_36addprimes},
  {"agm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_39agm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_38agm},
  {"algadd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_41algadd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_40algadd},
  {"algalgtobasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_43algalgtobasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_42algalgtobasis},
  {"algaut", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_45algaut, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_44algaut},
  {"algb", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_47algb, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_46algb},
  {"algbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_49algbasis, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_48algbasis},
  {"algbasistoalg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_51algbasistoalg, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_50algbasistoalg},
  {"algcenter", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_53algcenter, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_52algcenter},
  {"algcentralproj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_55algcentralproj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_54algcentralproj},
  {"algchar", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_57algchar, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_56algchar},
  {"algcharpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_59algcharpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_58algcharpoly},
  {"algdegree", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_61algdegree, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_60algdegree},
  {"algdep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_63algdep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_62algdep},
  {"algdim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_65algdim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_64algdim},
  {"algdisc", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_67algdisc, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_66algdisc},
  {"algdivl", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_69algdivl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_68algdivl},
  {"algdivr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_71algdivr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_70algdivr},
  {"alggroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_73alggroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_72alggroup},
  {"alghasse", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_75alghasse, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_74alghasse},
  {"alghassef", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_77alghassef, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_76alghassef},
  {"alghassei", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_79alghassei, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_78alghassei},
  {"algindex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_81algindex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_80algindex},
  {"alginit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_83alginit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_82alginit},
  {"alginv", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_85alginv, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_84alginv},
  {"alginvbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_87alginvbasis, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_86alginvbasis},
  {"algisassociative", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_89algisassociative, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_88algisassociative},
  {"algiscommutative", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_91algiscommutative, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_90algiscommutative},
  {"algisdivision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_93algisdivision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_92algisdivision},
  {"algisramified", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_95algisramified, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_94algisramified},
  {"algissemisimple", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_97algissemisimple, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_96algissemisimple},
  {"algissimple", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_99algissimple, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_98algissimple},
  {"algissplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_101algissplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_100algissplit},
  {"alglatelement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_103alglatelement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_102alglatelement},
  {"alglathnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_105alglathnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_104alglathnf},
  {"alglatindex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_107alglatindex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_106alglatindex},
  {"alglatlefttransporter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_109alglatlefttransporter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_108alglatlefttransporter},
  {"alglatmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_111alglatmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_110alglatmul},
  {"alglatrighttransporter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_113alglatrighttransporter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_112alglatrighttransporter},
  {"algmakeintegral", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_115algmakeintegral, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_114algmakeintegral},
  {"algmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_117algmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_116algmul},
  {"algmultable", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_119algmultable, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_118algmultable},
  {"algneg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_121algneg, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_120algneg},
  {"algnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_123algnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_122algnorm},
  {"algpoleval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_125algpoleval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_124algpoleval},
  {"algpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_127algpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_126algpow},
  {"algprimesubalg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_129algprimesubalg, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_128algprimesubalg},
  {"algquotient", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_131algquotient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_130algquotient},
  {"algradical", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_133algradical, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_132algradical},
  {"algramifiedplaces", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_135algramifiedplaces, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_134algramifiedplaces},
  {"algrandom", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_137algrandom, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_136algrandom},
  {"algrelmultable", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_139algrelmultable, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_138algrelmultable},
  {"algsimpledec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_141algsimpledec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_140algsimpledec},
  {"algsplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_143algsplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_142algsplit},
  {"algsplittingdata", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_145algsplittingdata, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_144algsplittingdata},
  {"algsplittingfield", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_147algsplittingfield, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_146algsplittingfield},
  {"algsqr", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_149algsqr, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_148algsqr},
  {"algsub", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_151algsub, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_150algsub},
  {"algsubalg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_153algsubalg, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_152algsubalg},
  {"algtableinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_155algtableinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_154algtableinit},
  {"algtensor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_157algtensor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_156algtensor},
  {"algtomatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_159algtomatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_158algtomatrix},
  {"algtrace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_161algtrace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_160algtrace},
  {"algtype", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_163algtype, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_162algtype},
  {"apply", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_165apply, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_164apply},
  {"arg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_167arg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_166arg},
  {"asin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_169asin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_168asin},
  {"asinh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_171asinh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_170asinh},
  {"asympnum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_173asympnum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_172asympnum},
  {"atan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_175atan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_174atan},
  {"atanh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_177atanh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_176atanh},
  {"besselh1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_179besselh1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_178besselh1},
  {"besselh2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_181besselh2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_180besselh2},
  {"besseli", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_183besseli, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_182besseli},
  {"besselj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_185besselj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_184besselj},
  {"besseljh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_187besseljh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_186besseljh},
  {"besselk", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_189besselk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_188besselk},
  {"besseln", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_191besseln, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_190besseln},
  {"bestappr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_193bestappr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_192bestappr},
  {"bestapprPade", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_195bestapprPade, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_194bestapprPade},
  {"bestapprnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_197bestapprnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_196bestapprnf},
  {"bezout", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_199bezout, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_198bezout},
  {"bezoutres", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_201bezoutres, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_200bezoutres},
  {"bigomega", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_203bigomega, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_202bigomega},
  {"binary", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_205binary, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_204binary},
  {"binomial", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_207binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_206binomial},
  {"bitand", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_209bitand, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_208bitand},
  {"bitneg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_211bitneg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_210bitneg},
  {"bitnegimply", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_213bitnegimply, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_212bitnegimply},
  {"bitor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_215bitor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_214bitor},
  {"bitprecision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_217bitprecision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_216bitprecision},
  {"bittest", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_219bittest, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_218bittest},
  {"bitxor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_221bitxor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_220bitxor},
  {"bnfcertify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_223bnfcertify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_222bnfcertify},
  {"bnfcompress", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_225bnfcompress, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_224bnfcompress},
  {"bnfdecodemodule", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_227bnfdecodemodule, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_226bnfdecodemodule},
  {"bnfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_229bnfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_228bnfinit},
  {"bnfisintnorm", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_231bnfisintnorm, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_230bnfisintnorm},
  {"bnfisnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_233bnfisnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_232bnfisnorm},
  {"bnfisprincipal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_235bnfisprincipal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_234bnfisprincipal},
  {"bnfissunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_237bnfissunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_236bnfissunit},
  {"bnfisunit", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_239bnfisunit, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_238bnfisunit},
  {"bnflog", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_241bnflog, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_240bnflog},
  {"bnflogdegree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_243bnflogdegree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_242bnflogdegree},
  {"bnflogef", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_245bnflogef, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_244bnflogef},
  {"bnfnarrow", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_247bnfnarrow, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_246bnfnarrow},
  {"bnfsignunit", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_249bnfsignunit, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_248bnfsignunit},
  {"bnfsunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_251bnfsunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_250bnfsunit},
  {"bnrL1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_253bnrL1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_252bnrL1},
  {"bnrchar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_255bnrchar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_254bnrchar},
  {"bnrclassno", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_257bnrclassno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_256bnrclassno},
  {"bnrclassnolist", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_259bnrclassnolist, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_258bnrclassnolist},
  {"bnrconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_261bnrconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_260bnrconductor},
  {"bnrconductorofchar", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_263bnrconductorofchar, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_262bnrconductorofchar},
  {"bnrdisc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_265bnrdisc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_264bnrdisc},
  {"bnrdisclist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_267bnrdisclist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_266bnrdisclist},
  {"bnrgaloisapply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_269bnrgaloisapply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_268bnrgaloisapply},
  {"bnrgaloismatrix", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_271bnrgaloismatrix, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_270bnrgaloismatrix},
  {"bnrinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_273bnrinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_272bnrinit},
  {"bnrisconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_275bnrisconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_274bnrisconductor},
  {"bnrisgalois", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_277bnrisgalois, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_276bnrisgalois},
  {"bnrisprincipal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_279bnrisprincipal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_278bnrisprincipal},
  {"bnrrootnumber", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_281bnrrootnumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_280bnrrootnumber},
  {"bnrstark", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_283bnrstark, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_282bnrstark},
  {"call", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_285call, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_284call},
  {"ceil", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_287ceil, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_286ceil},
  {"centerlift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_289centerlift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_288centerlift},
  {"characteristic", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_291characteristic, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_290characteristic},
  {"charconj", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_293charconj, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_292charconj},
  {"chardiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_295chardiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_294chardiv},
  {"chareval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_297chareval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_296chareval},
  {"chargalois", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_299chargalois, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_298chargalois},
  {"charker", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_301charker, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_300charker},
  {"charmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_303charmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_302charmul},
  {"charorder", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_305charorder, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_304charorder},
  {"charpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_307charpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_306charpoly},
  {"charpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_309charpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_308charpow},
  {"chinese", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_311chinese, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_310chinese},
  {"cmp", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_313cmp, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_312cmp},
  {"component", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_315component, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_314component},
  {"concat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_317concat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_316concat},
  {"conj", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_319conj, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_318conj},
  {"conjvec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_321conjvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_320conjvec},
  {"content", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_323content, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_322content},
  {"contfrac", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_325contfrac, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_324contfrac},
  {"contfraceval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_327contfraceval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_326contfraceval},
  {"contfracinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_329contfracinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_328contfracinit},
  {"contfracpnqn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_331contfracpnqn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_330contfracpnqn},
  {"core", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_333core, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_332core},
  {"coredisc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_335coredisc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_334coredisc},
  {"cos", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_337cos, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_336cos},
  {"cosh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_339cosh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_338cosh},
  {"cotan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_341cotan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_340cotan},
  {"cotanh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_343cotanh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_342cotanh},
  {"denominator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_345denominator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_344denominator},
  {"deriv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_347deriv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_346deriv},
  {"diffop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_349diffop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_348diffop},
  {"digits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_351digits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_350digits},
  {"dilog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_353dilog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_352dilog},
  {"dirdiv", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_355dirdiv, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_354dirdiv},
  {"dirmul", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_357dirmul, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_356dirmul},
  {"dirzetak", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_359dirzetak, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_358dirzetak},
  {"divisors", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_361divisors, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_360divisors},
  {"divisorslenstra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_363divisorslenstra, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_362divisorslenstra},
  {"divrem", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_365divrem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_364divrem},
  {"eint1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_367eint1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_366eint1},
  {"ellL1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_369ellL1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_368ellL1},
  {"elladd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_371elladd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_370elladd},
  {"ellak", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_373ellak, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_372ellak},
  {"ellan", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_375ellan, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_374ellan},
  {"ellanalyticrank", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_377ellanalyticrank, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_376ellanalyticrank},
  {"ellap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_379ellap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_378ellap},
  {"ellbil", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_381ellbil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_380ellbil},
  {"ellbsd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_383ellbsd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_382ellbsd},
  {"ellcard", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_385ellcard, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_384ellcard},
  {"ellchangecurve", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_387ellchangecurve, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_386ellchangecurve},
  {"ellchangepoint", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_389ellchangepoint, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_388ellchangepoint},
  {"ellchangepointinv", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_391ellchangepointinv, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_390ellchangepointinv},
  {"ellconvertname", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_393ellconvertname, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_392ellconvertname},
  {"elldivpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_395elldivpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_394elldivpol},
  {"elleisnum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_397elleisnum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_396elleisnum},
  {"elleta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_399elleta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_398elleta},
  {"ellformaldifferential", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_401ellformaldifferential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_400ellformaldifferential},
  {"ellformalexp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_403ellformalexp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_402ellformalexp},
  {"ellformallog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_405ellformallog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_404ellformallog},
  {"ellformalpoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_407ellformalpoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_406ellformalpoint},
  {"ellformalw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_409ellformalw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_408ellformalw},
  {"ellfromeqn", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_411ellfromeqn, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_410ellfromeqn},
  {"ellfromj", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_413ellfromj, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_412ellfromj},
  {"ellgenerators", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_415ellgenerators, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_414ellgenerators},
  {"ellglobalred", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_417ellglobalred, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_416ellglobalred},
  {"ellgroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_419ellgroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_418ellgroup},
  {"ellheegner", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_421ellheegner, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_420ellheegner},
  {"ellheight", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_423ellheight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_422ellheight},
  {"ellheightmatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_425ellheightmatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_424ellheightmatrix},
  {"ellidentify", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_427ellidentify, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_426ellidentify},
  {"ellinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_429ellinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_428ellinit},
  {"ellisogeny", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_431ellisogeny, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_430ellisogeny},
  {"ellisogenyapply", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_433ellisogenyapply, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_432ellisogenyapply},
  {"ellisomat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_435ellisomat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_434ellisomat},
  {"ellisoncurve", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_437ellisoncurve, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_436ellisoncurve},
  {"ellisotree", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_439ellisotree, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_438ellisotree},
  {"ellissupersingular", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_441ellissupersingular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_440ellissupersingular},
  {"ellj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_443ellj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_442ellj},
  {"elllocalred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_445elllocalred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_444elllocalred},
  {"elllog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_447elllog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_446elllog},
  {"elllseries", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_449elllseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_448elllseries},
  {"ellminimaldisc", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_451ellminimaldisc, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_450ellminimaldisc},
  {"ellminimaltwist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_453ellminimaltwist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_452ellminimaltwist},
  {"ellmoddegree", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_455ellmoddegree, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_454ellmoddegree},
  {"ellmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_457ellmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_456ellmul},
  {"ellneg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_459ellneg, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_458ellneg},
  {"ellnonsingularmultiple", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_461ellnonsingularmultiple, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_460ellnonsingularmultiple},
  {"ellorder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_463ellorder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_462ellorder},
  {"ellordinate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_465ellordinate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_464ellordinate},
  {"ellpadicL", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_467ellpadicL, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_466ellpadicL},
  {"ellpadicbsd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_469ellpadicbsd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_468ellpadicbsd},
  {"ellpadicfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_471ellpadicfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_470ellpadicfrobenius},
  {"ellpadicheight", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_473ellpadicheight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_472ellpadicheight},
  {"ellpadicheightmatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_475ellpadicheightmatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_474ellpadicheightmatrix},
  {"ellpadiclog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_477ellpadiclog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_476ellpadiclog},
  {"ellpadicregulator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_479ellpadicregulator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_478ellpadicregulator},
  {"ellpadics2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_481ellpadics2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_480ellpadics2},
  {"ellperiods", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_483ellperiods, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_482ellperiods},
  {"ellpointtoz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_485ellpointtoz, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_484ellpointtoz},
  {"ellpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_487ellpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_486ellpow},
  {"ellratpoints", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_489ellratpoints, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_488ellratpoints},
  {"ellrootno", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_491ellrootno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_490ellrootno},
  {"ellsea", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_493ellsea, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_492ellsea},
  {"ellsearch", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_495ellsearch, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_494ellsearch},
  {"ellsigma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_497ellsigma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_496ellsigma},
  {"ellsub", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_499ellsub, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_498ellsub},
  {"elltamagawa", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_501elltamagawa, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_500elltamagawa},
  {"elltaniyama", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_503elltaniyama, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_502elltaniyama},
  {"elltatepairing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_505elltatepairing, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_504elltatepairing},
  {"elltors", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_507elltors, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_506elltors},
  {"elltwist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_509elltwist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_508elltwist},
  {"ellweilpairing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_511ellweilpairing, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_510ellweilpairing},
  {"ellwp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_513ellwp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_512ellwp},
  {"ellxn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_515ellxn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_514ellxn},
  {"ellzeta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_517ellzeta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_516ellzeta},
  {"ellztopoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_519ellztopoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_518ellztopoint},
  {"erfc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_521erfc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_520erfc},
  {"errname", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_523errname, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_522errname},
  {"eta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_525eta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_524eta},
  {"eulerphi", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_527eulerphi, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_526eulerphi},
  {"exp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_529exp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_528exp},
  {"expm1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_531expm1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_530expm1},
  {"exponent", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_533exponent, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_532exponent},
  {"factor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_535factor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_534factor},
  {"factorback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_537factorback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_536factorback},
  {"factorcantor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_539factorcantor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_538factorcantor},
  {"factorff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_541factorff, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_540factorff},
  {"factorint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_543factorint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_542factorint},
  {"factormod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_545factormod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_544factormod},
  {"factormodDDF", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_547factormodDDF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_546factormodDDF},
  {"factormodSQF", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_549factormodSQF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_548factormodSQF},
  {"factornf", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_551factornf, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_550factornf},
  {"factorpadic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_553factorpadic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_552factorpadic},
  {"ffcompomap", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_555ffcompomap, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_554ffcompomap},
  {"ffembed", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_557ffembed, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_556ffembed},
  {"ffextend", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_559ffextend, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_558ffextend},
  {"fffrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_561fffrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_560fffrobenius},
  {"ffgen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_563ffgen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_562ffgen},
  {"ffinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_565ffinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_564ffinit},
  {"ffinvmap", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_567ffinvmap, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_566ffinvmap},
  {"fflog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_569fflog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_568fflog},
  {"ffmap", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_571ffmap, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_570ffmap},
  {"ffnbirred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_573ffnbirred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_572ffnbirred},
  {"fforder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_575fforder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_574fforder},
  {"fileflush", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_577fileflush, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_576fileflush},
  {"floor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_579floor, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_578floor},
  {"fold", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_581fold, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_580fold},
  {"frac", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_583frac, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_582frac},
  {"fromdigits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_585fromdigits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_584fromdigits},
  {"galoischardet", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_587galoischardet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_586galoischardet},
  {"galoischarpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_589galoischarpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_588galoischarpoly},
  {"galoischartable", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_591galoischartable, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_590galoischartable},
  {"galoisconjclasses", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_593galoisconjclasses, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_592galoisconjclasses},
  {"galoisexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_595galoisexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_594galoisexport},
  {"galoisfixedfield", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_597galoisfixedfield, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_596galoisfixedfield},
  {"galoisidentify", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_599galoisidentify, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_598galoisidentify},
  {"galoisinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_601galoisinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_600galoisinit},
  {"galoisisabelian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_603galoisisabelian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_602galoisisabelian},
  {"galoisisnormal", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_605galoisisnormal, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_604galoisisnormal},
  {"galoispermtopol", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_607galoispermtopol, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_606galoispermtopol},
  {"galoissubcyclo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_609galoissubcyclo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_608galoissubcyclo},
  {"galoissubfields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_611galoissubfields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_610galoissubfields},
  {"galoissubgroups", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_613galoissubgroups, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_612galoissubgroups},
  {"gamma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_615gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_614gamma},
  {"gammah", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_617gammah, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_616gammah},
  {"gammamellininv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_619gammamellininv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_618gammamellininv},
  {"gammamellininvasymp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_621gammamellininvasymp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_620gammamellininvasymp},
  {"gammamellininvinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_623gammamellininvinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_622gammamellininvinit},
  {"gcd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_625gcd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_624gcd},
  {"gcdext", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_627gcdext, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_626gcdext},
  {"genus2red", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_629genus2red, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_628genus2red},
  {"hammingweight", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_631hammingweight, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_630hammingweight},
  {"hilbert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_633hilbert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_632hilbert},
  {"hyperellcharpoly", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_635hyperellcharpoly, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_634hyperellcharpoly},
  {"hyperellpadicfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_637hyperellpadicfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_636hyperellpadicfrobenius},
  {"hyperellratpoints", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_639hyperellratpoints, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_638hyperellratpoints},
  {"hyperu", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_641hyperu, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_640hyperu},
  {"idealadd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_643idealadd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_642idealadd},
  {"idealaddtoone", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_645idealaddtoone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_644idealaddtoone},
  {"idealappr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_647idealappr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_646idealappr},
  {"idealchinese", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_649idealchinese, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_648idealchinese},
  {"idealcoprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_651idealcoprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_650idealcoprime},
  {"idealdiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_653idealdiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_652idealdiv},
  {"idealfactor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_655idealfactor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_654idealfactor},
  {"idealfactorback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_657idealfactorback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_656idealfactorback},
  {"idealfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_659idealfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_658idealfrobenius},
  {"idealhnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_661idealhnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_660idealhnf},
  {"idealintersect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_663idealintersect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_662idealintersect},
  {"idealinv", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_665idealinv, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_664idealinv},
  {"ideallist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_667ideallist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_666ideallist},
  {"ideallistarch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_669ideallistarch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_668ideallistarch},
  {"ideallog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_671ideallog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_670ideallog},
  {"idealmin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_673idealmin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_672idealmin},
  {"idealmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_675idealmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_674idealmul},
  {"idealnorm", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_677idealnorm, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_676idealnorm},
  {"idealnumden", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_679idealnumden, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_678idealnumden},
  {"idealpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_681idealpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_680idealpow},
  {"idealprimedec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_683idealprimedec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_682idealprimedec},
  {"idealprincipalunits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_685idealprincipalunits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_684idealprincipalunits},
  {"idealramgroups", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_687idealramgroups, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_686idealramgroups},
  {"idealred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_689idealred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_688idealred},
  {"idealredmodpower", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_691idealredmodpower, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_690idealredmodpower},
  {"idealstar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_693idealstar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_692idealstar},
  {"idealtwoelt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_695idealtwoelt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_694idealtwoelt},
  {"idealval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_697idealval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_696idealval},
  {"imag", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_699imag, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_698imag},
  {"incgam", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_701incgam, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_700incgam},
  {"incgamc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_703incgamc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_702incgamc},
  {"intformal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_705intformal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_704intformal},
  {"intnuminit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_707intnuminit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_706intnuminit},
  {"isfundamental", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_709isfundamental, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_708isfundamental},
  {"ispowerful", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_711ispowerful, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_710ispowerful},
  {"isprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_713isprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_712isprime},
  {"ispseudoprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_715ispseudoprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_714ispseudoprime},
  {"issquarefree", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_717issquarefree, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_716issquarefree},
  {"kronecker", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_719kronecker, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_718kronecker},
  {"lambertw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_721lambertw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_720lambertw},
  {"laurentseries", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_723laurentseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_722laurentseries},
  {"lcm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_725lcm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_724lcm},
  {"length", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_727length, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_726length},
  {"lex", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_729lex, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_728lex},
  {"lfun", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_731lfun, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_730lfun},
  {"lfunabelianrelinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_733lfunabelianrelinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_732lfunabelianrelinit},
  {"lfunan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_735lfunan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_734lfunan},
  {"lfunartin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_737lfunartin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_736lfunartin},
  {"lfuncheckfeq", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_739lfuncheckfeq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_738lfuncheckfeq},
  {"lfunconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_741lfunconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_740lfunconductor},
  {"lfuncost", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_743lfuncost, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_742lfuncost},
  {"lfuncreate", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_745lfuncreate, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_744lfuncreate},
  {"lfundiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_747lfundiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_746lfundiv},
  {"lfunetaquo", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_749lfunetaquo, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_748lfunetaquo},
  {"lfungenus2", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_751lfungenus2, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_750lfungenus2},
  {"lfunhardy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_753lfunhardy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_752lfunhardy},
  {"lfuninit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_755lfuninit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_754lfuninit},
  {"lfunlambda", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_757lfunlambda, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_756lfunlambda},
  {"lfunmf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_759lfunmf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_758lfunmf},
  {"lfunmfspec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_761lfunmfspec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_760lfunmfspec},
  {"lfunmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_763lfunmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_762lfunmul},
  {"lfunorderzero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_765lfunorderzero, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_764lfunorderzero},
  {"lfunqf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_767lfunqf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_766lfunqf},
  {"lfunrootres", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_769lfunrootres, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_768lfunrootres},
  {"lfunsympow", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_771lfunsympow, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_770lfunsympow},
  {"lfuntheta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_773lfuntheta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_772lfuntheta},
  {"lfunthetacost", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_775lfunthetacost, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_774lfunthetacost},
  {"lfunthetainit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_777lfunthetainit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_776lfunthetainit},
  {"lfuntwist", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_779lfuntwist, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_778lfuntwist},
  {"lfunzeros", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_781lfunzeros, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_780lfunzeros},
  {"lift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_783lift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_782lift},
  {"liftall", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_785liftall, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_784liftall},
  {"liftint", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_787liftint, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_786liftint},
  {"liftpol", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_789liftpol, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_788liftpol},
  {"limitnum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_791limitnum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_790limitnum},
  {"lindep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_793lindep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_792lindep},
  {"listinsert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_795listinsert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_794listinsert},
  {"listkill", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_797listkill, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_796listkill},
  {"listpop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_799listpop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_798listpop},
  {"listput", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_801listput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_800listput},
  {"listsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_803listsort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_802listsort},
  {"lngamma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_805lngamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_804lngamma},
  {"log", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_807log, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_806log},
  {"log1p", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_809log1p, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_808log1p},
  {"mapdelete", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_811mapdelete, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_810mapdelete},
  {"mapget", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_813mapget, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_812mapget},
  {"mapput", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_815mapput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_814mapput},
  {"matadjoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_817matadjoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_816matadjoint},
  {"matalgtobasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_819matalgtobasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_818matalgtobasis},
  {"matbasistoalg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_821matbasistoalg, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_820matbasistoalg},
  {"matcompanion", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_823matcompanion, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_822matcompanion},
  {"matconcat", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_825matconcat, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_824matconcat},
  {"matdet", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_827matdet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_826matdet},
  {"matdetint", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_829matdetint, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_828matdetint},
  {"matdetmod", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_831matdetmod, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_830matdetmod},
  {"matdiagonal", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_833matdiagonal, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_832matdiagonal},
  {"mateigen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_835mateigen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_834mateigen},
  {"matfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_837matfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_836matfrobenius},
  {"mathess", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_839mathess, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_838mathess},
  {"mathnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_841mathnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_840mathnf},
  {"mathnfmod", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_843mathnfmod, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_842mathnfmod},
  {"mathnfmodid", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_845mathnfmodid, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_844mathnfmodid},
  {"mathouseholder", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_847mathouseholder, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_846mathouseholder},
  {"matimage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_849matimage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_848matimage},
  {"matimagecompl", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_851matimagecompl, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_850matimagecompl},
  {"matindexrank", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_853matindexrank, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_852matindexrank},
  {"matintersect", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_855matintersect, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_854matintersect},
  {"matinverseimage", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_857matinverseimage, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_856matinverseimage},
  {"matinvmod", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_859matinvmod, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_858matinvmod},
  {"matisdiagonal", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_861matisdiagonal, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_860matisdiagonal},
  {"matker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_863matker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_862matker},
  {"matkerint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_865matkerint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_864matkerint},
  {"matmuldiagonal", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_867matmuldiagonal, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_866matmuldiagonal},
  {"matmultodiagonal", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_869matmultodiagonal, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_868matmultodiagonal},
  {"matpermanent", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_871matpermanent, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_870matpermanent},
  {"matqr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_873matqr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_872matqr},
  {"matrank", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_875matrank, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_874matrank},
  {"matrixqz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_877matrixqz, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_876matrixqz},
  {"matsize", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_879matsize, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_878matsize},
  {"matsnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_881matsnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_880matsnf},
  {"matsolve", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_883matsolve, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_882matsolve},
  {"matsolvemod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_885matsolvemod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_884matsolvemod},
  {"matsupplement", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_887matsupplement, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_886matsupplement},
  {"mattranspose", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_889mattranspose, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_888mattranspose},
  {"max", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_891max, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_890max},
  {"mfEH", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_893mfEH, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_892mfEH},
  {"mfTheta", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_895mfTheta, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_894mfTheta},
  {"mfatkin", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_897mfatkin, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_896mfatkin},
  {"mfatkineigenvalues", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_899mfatkineigenvalues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_898mfatkineigenvalues},
  {"mfatkininit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_901mfatkininit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_900mfatkininit},
  {"mfbasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_903mfbasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_902mfbasis},
  {"mfbd", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_905mfbd, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_904mfbd},
  {"mfbracket", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_907mfbracket, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_906mfbracket},
  {"mfcoef", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_909mfcoef, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_908mfcoef},
  {"mfcoefs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_911mfcoefs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_910mfcoefs},
  {"mfconductor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_913mfconductor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_912mfconductor},
  {"mfcosets", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_915mfcosets, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_914mfcosets},
  {"mfcuspisregular", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_917mfcuspisregular, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_916mfcuspisregular},
  {"mfcusps", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_919mfcusps, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_918mfcusps},
  {"mfcuspval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_921mfcuspval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_920mfcuspval},
  {"mfcuspwidth", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_923mfcuspwidth, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_922mfcuspwidth},
  {"mfderiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_925mfderiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_924mfderiv},
  {"mfderivE2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_927mfderivE2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_926mfderivE2},
  {"mfdim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_929mfdim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_928mfdim},
  {"mfdiv", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_931mfdiv, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_930mfdiv},
  {"mfeigenbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_933mfeigenbasis, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_932mfeigenbasis},
  {"mfeigensearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_935mfeigensearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_934mfeigensearch},
  {"mfembed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_937mfembed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_936mfembed},
  {"mfeval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_939mfeval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_938mfeval},
  {"mffields", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_941mffields, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_940mffields},
  {"mffromell", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_943mffromell, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_942mffromell},
  {"mffrometaquo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_945mffrometaquo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_944mffrometaquo},
  {"mffromlfun", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_947mffromlfun, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_946mffromlfun},
  {"mffromqf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_949mffromqf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_948mffromqf},
  {"mfgaloistype", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_951mfgaloistype, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_950mfgaloistype},
  {"mfhecke", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_953mfhecke, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_952mfhecke},
  {"mfheckemat", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_955mfheckemat, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_954mfheckemat},
  {"mfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_957mfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_956mfinit},
  {"mfisCM", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_959mfisCM, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_958mfisCM},
  {"mfisequal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_961mfisequal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_960mfisequal},
  {"mfkohnenbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_963mfkohnenbasis, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_962mfkohnenbasis},
  {"mfkohnenbijection", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_965mfkohnenbijection, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_964mfkohnenbijection},
  {"mfkohneneigenbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_967mfkohneneigenbasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_966mfkohneneigenbasis},
  {"mflinear", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_969mflinear, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_968mflinear},
  {"mfmanin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_971mfmanin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_970mfmanin},
  {"mfmul", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_973mfmul, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_972mfmul},
  {"mfnumcusps", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_975mfnumcusps, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_974mfnumcusps},
  {"mfparams", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_977mfparams, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_976mfparams},
  {"mfperiodpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_979mfperiodpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_978mfperiodpol},
  {"mfpetersson", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_981mfpetersson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_980mfpetersson},
  {"mfpow", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_983mfpow, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_982mfpow},
  {"mfsearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_985mfsearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_984mfsearch},
  {"mfshift", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_987mfshift, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_986mfshift},
  {"mfshimura", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_989mfshimura, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_988mfshimura},
  {"mfspace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_991mfspace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_990mfspace},
  {"mfsplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_993mfsplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_992mfsplit},
  {"mfsturm", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_995mfsturm, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_994mfsturm},
  {"mfsymbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_997mfsymbol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_996mfsymbol},
  {"mfsymboleval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_999mfsymboleval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_998mfsymboleval},
  {"mftaylor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1001mftaylor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1000mftaylor},
  {"mftobasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1003mftobasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1002mftobasis},
  {"mftonew", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1005mftonew, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1004mftonew},
  {"mftraceform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1007mftraceform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1006mftraceform},
  {"mftwist", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1009mftwist, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1008mftwist},
  {"min", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1011min, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1010min},
  {"minpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1013minpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1012minpoly},
  {"modreverse", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1015modreverse, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1014modreverse},
  {"moebius", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1017moebius, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1016moebius},
  {"msatkinlehner", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1019msatkinlehner, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1018msatkinlehner},
  {"mscuspidal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1021mscuspidal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1020mscuspidal},
  {"msdim", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1023msdim, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1022msdim},
  {"mseisenstein", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1025mseisenstein, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1024mseisenstein},
  {"mseval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1027mseval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1026mseval},
  {"msfromcusp", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1029msfromcusp, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1028msfromcusp},
  {"msfromell", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1031msfromell, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1030msfromell},
  {"msfromhecke", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1033msfromhecke, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1032msfromhecke},
  {"msgetlevel", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1035msgetlevel, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1034msgetlevel},
  {"msgetsign", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1037msgetsign, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1036msgetsign},
  {"msgetweight", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1039msgetweight, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1038msgetweight},
  {"mshecke", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1041mshecke, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1040mshecke},
  {"msinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1043msinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1042msinit},
  {"msissymbol", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1045msissymbol, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1044msissymbol},
  {"mslattice", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1047mslattice, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1046mslattice},
  {"msnew", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1049msnew, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1048msnew},
  {"msomseval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1051msomseval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1050msomseval},
  {"mspadicL", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1053mspadicL, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1052mspadicL},
  {"mspadicinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1055mspadicinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1054mspadicinit},
  {"mspadicmoments", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1057mspadicmoments, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1056mspadicmoments},
  {"mspadicseries", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1059mspadicseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1058mspadicseries},
  {"mspathgens", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1061mspathgens, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1060mspathgens},
  {"mspathlog", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1063mspathlog, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1062mspathlog},
  {"mspetersson", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1065mspetersson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1064mspetersson},
  {"mspolygon", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1067mspolygon, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1066mspolygon},
  {"msqexpansion", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1069msqexpansion, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1068msqexpansion},
  {"mssplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1071mssplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1070mssplit},
  {"msstar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1073msstar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1072msstar},
  {"mstooms", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1075mstooms, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1074mstooms},
  {"newtonpoly", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1077newtonpoly, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1076newtonpoly},
  {"nextprime", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1079nextprime, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1078nextprime},
  {"nfalgtobasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1081nfalgtobasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1080nfalgtobasis},
  {"nfbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1083nfbasis, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1082nfbasis},
  {"nfbasistoalg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1085nfbasistoalg, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1084nfbasistoalg},
  {"nfcertify", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1087nfcertify, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1086nfcertify},
  {"nfcompositum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1089nfcompositum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1088nfcompositum},
  {"nfdetint", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1091nfdetint, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1090nfdetint},
  {"nfdisc", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1093nfdisc, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1092nfdisc},
  {"nfeltadd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1095nfeltadd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1094nfeltadd},
  {"nfeltdiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1097nfeltdiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1096nfeltdiv},
  {"nfeltdiveuc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1099nfeltdiveuc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1098nfeltdiveuc},
  {"nfeltdivmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1101nfeltdivmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1100nfeltdivmodpr},
  {"nfeltdivrem", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1103nfeltdivrem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1102nfeltdivrem},
  {"nfeltembed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1105nfeltembed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1104nfeltembed},
  {"nfeltmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1107nfeltmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1106nfeltmod},
  {"nfeltmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1109nfeltmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1108nfeltmul},
  {"nfeltmulmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1111nfeltmulmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1110nfeltmulmodpr},
  {"nfeltnorm", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1113nfeltnorm, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1112nfeltnorm},
  {"nfeltpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1115nfeltpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1114nfeltpow},
  {"nfeltpowmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1117nfeltpowmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1116nfeltpowmodpr},
  {"nfeltreduce", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1119nfeltreduce, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1118nfeltreduce},
  {"nfeltreducemodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1121nfeltreducemodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1120nfeltreducemodpr},
  {"nfeltsign", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1123nfeltsign, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1122nfeltsign},
  {"nfelttrace", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1125nfelttrace, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1124nfelttrace},
  {"nffactor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1127nffactor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1126nffactor},
  {"nffactorback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1129nffactorback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1128nffactorback},
  {"nffactormod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1131nffactormod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1130nffactormod},
  {"nfgaloisapply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1133nfgaloisapply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1132nfgaloisapply},
  {"nfgaloisconj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1135nfgaloisconj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1134nfgaloisconj},
  {"nfgrunwaldwang", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1137nfgrunwaldwang, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1136nfgrunwaldwang},
  {"nfhilbert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1139nfhilbert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1138nfhilbert},
  {"nfhnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1141nfhnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1140nfhnf},
  {"nfhnfmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1143nfhnfmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1142nfhnfmod},
  {"nfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1145nfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1144nfinit},
  {"nfisideal", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1147nfisideal, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1146nfisideal},
  {"nfisincl", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1149nfisincl, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1148nfisincl},
  {"nfisisom", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1151nfisisom, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1150nfisisom},
  {"nfislocalpower", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1153nfislocalpower, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1152nfislocalpower},
  {"nfkermodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1155nfkermodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1154nfkermodpr},
  {"nfmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1157nfmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1156nfmodpr},
  {"nfmodprinit", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1159nfmodprinit, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1158nfmodprinit},
  {"nfmodprlift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1161nfmodprlift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1160nfmodprlift},
  {"nfnewprec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1163nfnewprec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1162nfnewprec},
  {"nfpolsturm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1165nfpolsturm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1164nfpolsturm},
  {"nfroots", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1167nfroots, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1166nfroots},
  {"nfrootsof1", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1169nfrootsof1, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1168nfrootsof1},
  {"nfsnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1171nfsnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1170nfsnf},
  {"nfsolvemodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1173nfsolvemodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1172nfsolvemodpr},
  {"nfsplitting", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1175nfsplitting, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1174nfsplitting},
  {"nfsubfields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1177nfsubfields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1176nfsubfields},
  {"norm", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1179norm, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1178norm},
  {"norml2", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1181norml2, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1180norml2},
  {"normlp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1183normlp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1182normlp},
  {"numbpart", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1185numbpart, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1184numbpart},
  {"numdiv", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1187numdiv, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1186numdiv},
  {"numerator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1189numerator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1188numerator},
  {"omega", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1191omega, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1190omega},
  {"padicappr", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1193padicappr, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1192padicappr},
  {"padicfields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1195padicfields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1194padicfields},
  {"padicprec", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1197padicprec, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1196padicprec},
  {"parapply", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1199parapply, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1198parapply},
  {"pareval", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1201pareval, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1200pareval},
  {"parselect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1203parselect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1202parselect},
  {"permorder", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1205permorder, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1204permorder},
  {"permsign", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1207permsign, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1206permsign},
  {"permtonum", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1209permtonum, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1208permtonum},
  {"plotdraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1211plotdraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1210plotdraw},
  {"plotexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1213plotexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1212plotexport},
  {"plothraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1215plothraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1214plothraw},
  {"plothrawexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1217plothrawexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1216plothrawexport},
  {"polclass", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1219polclass, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1218polclass},
  {"polcoef", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1221polcoef, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1220polcoef},
  {"polcoeff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1223polcoeff, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1222polcoeff},
  {"polcompositum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1225polcompositum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1224polcompositum},
  {"polcyclofactors", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1227polcyclofactors, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1226polcyclofactors},
  {"poldegree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1229poldegree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1228poldegree},
  {"poldisc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1231poldisc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1230poldisc},
  {"poldiscfactors", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1233poldiscfactors, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1232poldiscfactors},
  {"poldiscreduced", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1235poldiscreduced, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1234poldiscreduced},
  {"polgalois", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1237polgalois, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1236polgalois},
  {"polgraeffe", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1239polgraeffe, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1238polgraeffe},
  {"polhensellift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1241polhensellift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1240polhensellift},
  {"poliscyclo", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1243poliscyclo, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1242poliscyclo},
  {"poliscycloprod", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1245poliscycloprod, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1244poliscycloprod},
  {"polisirreducible", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1247polisirreducible, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1246polisirreducible},
  {"pollead", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1249pollead, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1248pollead},
  {"polrecip", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1251polrecip, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1250polrecip},
  {"polred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1253polred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1252polred},
  {"polredabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1255polredabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1254polredabs},
  {"polredbest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1257polredbest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1256polredbest},
  {"polredord", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1259polredord, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1258polredord},
  {"polresultant", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1261polresultant, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1260polresultant},
  {"polresultantext", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1263polresultantext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1262polresultantext},
  {"polroots", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1265polroots, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1264polroots},
  {"polrootsbound", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1267polrootsbound, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1266polrootsbound},
  {"polrootsff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1269polrootsff, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1268polrootsff},
  {"polrootsmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1271polrootsmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1270polrootsmod},
  {"polrootspadic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1273polrootspadic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1272polrootspadic},
  {"polrootsreal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1275polrootsreal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1274polrootsreal},
  {"polsturm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1277polsturm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1276polsturm},
  {"polsylvestermatrix", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1279polsylvestermatrix, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1278polsylvestermatrix},
  {"polsym", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1281polsym, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1280polsym},
  {"poltschirnhaus", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1283poltschirnhaus, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1282poltschirnhaus},
  {"powers", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1285powers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1284powers},
  {"precision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1287precision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1286precision},
  {"precprime", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1289precprime, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1288precprime},
  {"primecert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1291primecert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1290primecert},
  {"primecertexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1293primecertexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1292primecertexport},
  {"primecertisvalid", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1295primecertisvalid, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1294primecertisvalid},
  {"primepi", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1297primepi, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1296primepi},
  {"primes", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1299primes, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1298primes},
  {"prodeulerrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1301prodeulerrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1300prodeulerrat},
  {"prodnumrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1303prodnumrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1302prodnumrat},
  {"psdraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1305psdraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1304psdraw},
  {"psi", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1307psi, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1306psi},
  {"psplothraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1309psplothraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1308psplothraw},
  {"qfauto", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1311qfauto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1310qfauto},
  {"qfautoexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1313qfautoexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1312qfautoexport},
  {"qfbclassno", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1315qfbclassno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1314qfbclassno},
  {"qfbcompraw", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1317qfbcompraw, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1316qfbcompraw},
  {"qfbhclassno", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1319qfbhclassno, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1318qfbhclassno},
  {"qfbil", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1321qfbil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1320qfbil},
  {"qfbnucomp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1323qfbnucomp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1322qfbnucomp},
  {"qfbnupow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1325qfbnupow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1324qfbnupow},
  {"qfbpowraw", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1327qfbpowraw, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1326qfbpowraw},
  {"qfbprimeform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1329qfbprimeform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1328qfbprimeform},
  {"qfbred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1331qfbred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1330qfbred},
  {"qfbredsl2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1333qfbredsl2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1332qfbredsl2},
  {"qfbsolve", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1335qfbsolve, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1334qfbsolve},
  {"qfeval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1337qfeval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1336qfeval},
  {"qfgaussred", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1339qfgaussred, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1338qfgaussred},
  {"qfisom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1341qfisom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1340qfisom},
  {"qfisominit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1343qfisominit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1342qfisominit},
  {"qfjacobi", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1345qfjacobi, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1344qfjacobi},
  {"qflll", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1347qflll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1346qflll},
  {"qflllgram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1349qflllgram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1348qflllgram},
  {"qfminim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1351qfminim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1350qfminim},
  {"qfnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1353qfnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1352qfnorm},
  {"qforbits", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1355qforbits, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1354qforbits},
  {"qfparam", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1357qfparam, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1356qfparam},
  {"qfperfection", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1359qfperfection, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1358qfperfection},
  {"qfrep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1361qfrep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1360qfrep},
  {"qfsign", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1363qfsign, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1362qfsign},
  {"qfsolve", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1365qfsolve, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1364qfsolve},
  {"quadclassunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1367quadclassunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1366quadclassunit},
  {"quaddisc", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1369quaddisc, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1368quaddisc},
  {"quadgen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1371quadgen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1370quadgen},
  {"quadhilbert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1373quadhilbert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1372quadhilbert},
  {"quadpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1375quadpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1374quadpoly},
  {"quadray", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1377quadray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1376quadray},
  {"quadregulator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1379quadregulator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1378quadregulator},
  {"quadunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1381quadunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1380quadunit},
  {"ramanujantau", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1383ramanujantau, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1382ramanujantau},
  {"random", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1385random, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1384random},
  {"randomprime", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1387randomprime, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1386randomprime},
  {"real", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1389real, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1388real},
  {"removeprimes", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1391removeprimes, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1390removeprimes},
  {"rnfalgtobasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1393rnfalgtobasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1392rnfalgtobasis},
  {"rnfbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1395rnfbasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1394rnfbasis},
  {"rnfbasistoalg", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1397rnfbasistoalg, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1396rnfbasistoalg},
  {"rnfcharpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1399rnfcharpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1398rnfcharpoly},
  {"rnfconductor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1401rnfconductor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1400rnfconductor},
  {"rnfdedekind", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1403rnfdedekind, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1402rnfdedekind},
  {"rnfdet", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1405rnfdet, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1404rnfdet},
  {"rnfdisc", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1407rnfdisc, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1406rnfdisc},
  {"rnfeltabstorel", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1409rnfeltabstorel, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1408rnfeltabstorel},
  {"rnfeltdown", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1411rnfeltdown, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1410rnfeltdown},
  {"rnfeltnorm", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1413rnfeltnorm, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1412rnfeltnorm},
  {"rnfeltreltoabs", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1415rnfeltreltoabs, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1414rnfeltreltoabs},
  {"rnfelttrace", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1417rnfelttrace, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1416rnfelttrace},
  {"rnfeltup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1419rnfeltup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1418rnfeltup},
  {"rnfequation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1421rnfequation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1420rnfequation},
  {"rnfhnfbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1423rnfhnfbasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1422rnfhnfbasis},
  {"rnfidealabstorel", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1425rnfidealabstorel, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1424rnfidealabstorel},
  {"rnfidealdown", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1427rnfidealdown, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1426rnfidealdown},
  {"rnfidealfactor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1429rnfidealfactor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1428rnfidealfactor},
  {"rnfidealhnf", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1431rnfidealhnf, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1430rnfidealhnf},
  {"rnfidealmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1433rnfidealmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1432rnfidealmul},
  {"rnfidealnormabs", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1435rnfidealnormabs, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1434rnfidealnormabs},
  {"rnfidealnormrel", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1437rnfidealnormrel, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1436rnfidealnormrel},
  {"rnfidealprimedec", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1439rnfidealprimedec, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1438rnfidealprimedec},
  {"rnfidealreltoabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1441rnfidealreltoabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1440rnfidealreltoabs},
  {"rnfidealtwoelt", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1443rnfidealtwoelt, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1442rnfidealtwoelt},
  {"rnfidealup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1445rnfidealup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1444rnfidealup},
  {"rnfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1447rnfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1446rnfinit},
  {"rnfisabelian", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1449rnfisabelian, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1448rnfisabelian},
  {"rnfisfree", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1451rnfisfree, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1450rnfisfree},
  {"rnfislocalcyclo", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1453rnfislocalcyclo, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1452rnfislocalcyclo},
  {"rnfisnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1455rnfisnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1454rnfisnorm},
  {"rnfisnorminit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1457rnfisnorminit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1456rnfisnorminit},
  {"rnfkummer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1459rnfkummer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1458rnfkummer},
  {"rnflllgram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1461rnflllgram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1460rnflllgram},
  {"rnfnormgroup", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1463rnfnormgroup, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1462rnfnormgroup},
  {"rnfpolred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1465rnfpolred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1464rnfpolred},
  {"rnfpolredabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1467rnfpolredabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1466rnfpolredabs},
  {"rnfpolredbest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1469rnfpolredbest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1468rnfpolredbest},
  {"rnfpseudobasis", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1471rnfpseudobasis, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1470rnfpseudobasis},
  {"rnfsteinitz", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1473rnfsteinitz, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1472rnfsteinitz},
  {"select", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1475select, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1474select},
  {"seralgdep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1477seralgdep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1476seralgdep},
  {"serchop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1479serchop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1478serchop},
  {"serconvol", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1481serconvol, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1480serconvol},
  {"serlaplace", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1483serlaplace, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1482serlaplace},
  {"serprec", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1485serprec, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1484serprec},
  {"serreverse", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1487serreverse, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1486serreverse},
  {"setbinop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1489setbinop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1488setbinop},
  {"setintersect", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1491setintersect, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1490setintersect},
  {"setisset", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1493setisset, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1492setisset},
  {"setminus", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1495setminus, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1494setminus},
  {"setrand", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1497setrand, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1496setrand},
  {"setsearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1499setsearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1498setsearch},
  {"setunion", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1501setunion, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1500setunion},
  {"shift", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1503shift, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1502shift},
  {"shiftmul", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1505shiftmul, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1504shiftmul},
  {"sigma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1507sigma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1506sigma},
  {"sign", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1509sign, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1508sign},
  {"simplify", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1511simplify, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1510simplify},
  {"sin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1513sin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1512sin},
  {"sinc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1515sinc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1514sinc},
  {"sinh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1517sinh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1516sinh},
  {"sizebyte", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1519sizebyte, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1518sizebyte},
  {"sizedigit", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1521sizedigit, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1520sizedigit},
  {"sqr", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1523sqr, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1522sqr},
  {"sqrt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1525sqrt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1524sqrt},
  {"sqrtint", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1527sqrtint, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1526sqrtint},
  {"sqrtnint", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1529sqrtnint, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1528sqrtnint},
  {"subgrouplist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1531subgrouplist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1530subgrouplist},
  {"subst", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1533subst, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1532subst},
  {"substpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1535substpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1534substpol},
  {"substvec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1537substvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1536substvec},
  {"sumdedekind", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1539sumdedekind, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1538sumdedekind},
  {"sumdigits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1541sumdigits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1540sumdigits},
  {"sumeulerrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1543sumeulerrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1542sumeulerrat},
  {"sumformal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1545sumformal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1544sumformal},
  {"sumnumapinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1547sumnumapinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1546sumnumapinit},
  {"sumnuminit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1549sumnuminit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1548sumnuminit},
  {"sumnumlagrangeinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1551sumnumlagrangeinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1550sumnumlagrangeinit},
  {"sumnummonieninit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1553sumnummonieninit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1552sumnummonieninit},
  {"sumnumrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1555sumnumrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1554sumnumrat},
  {"tan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1557tan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1556tan},
  {"tanh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1559tanh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1558tanh},
  {"taylor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1561taylor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1560taylor},
  {"teichmuller", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1563teichmuller, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1562teichmuller},
  {"theta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1565theta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1564theta},
  {"thetanullk", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1567thetanullk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1566thetanullk},
  {"thue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1569thue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1568thue},
  {"thueinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1571thueinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1570thueinit},
  {"trace", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1573trace, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1572trace},
  {"type", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1575type, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1574type},
  {"valuation", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1577valuation, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1576valuation},
  {"variable", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1579variable, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1578variable},
  {"variables", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1581variables, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1580variables},
  {"vecextract", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1583vecextract, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1582vecextract},
  {"vecprod", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1585vecprod, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1584vecprod},
  {"vecsearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1587vecsearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1586vecsearch},
  {"vecsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1589vecsort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1588vecsort},
  {"vecsum", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1591vecsum, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1590vecsum},
  {"weber", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1593weber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1592weber},
  {"zeta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1595zeta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1594zeta},
  {"zetahurwitz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1597zetahurwitz, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1596zetahurwitz},
  {"zetamult", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1599zetamult, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1598zetamult},
  {"zetamultconvert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1601zetamultconvert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1600zetamultconvert},
  {"znchar", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1603znchar, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1602znchar},
  {"zncharconductor", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1605zncharconductor, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1604zncharconductor},
  {"znchardecompose", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1607znchardecompose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1606znchardecompose},
  {"znchargauss", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1609znchargauss, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1608znchargauss},
  {"zncharinduce", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1611zncharinduce, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1610zncharinduce},
  {"zncharisodd", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1613zncharisodd, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1612zncharisodd},
  {"znchartokronecker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1615znchartokronecker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1614znchartokronecker},
  {"znchartoprimitive", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1617znchartoprimitive, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1616znchartoprimitive},
  {"znconreychar", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1619znconreychar, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1618znconreychar},
  {"znconreyexp", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1621znconreyexp, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1620znconreyexp},
  {"znconreylog", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1623znconreylog, METH_O, __pyx_doc_6cypari_5_pari_8Gen_base_1622znconreylog},
  {"zncoppersmith", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1625zncoppersmith, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1624zncoppersmith},
  {"znlog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1627znlog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1626znlog},
  {"znorder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1629znorder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1628znorder},
  {"znprimroot", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1631znprimroot, METH_NOARGS, __pyx_doc_6cypari_5_pari_8Gen_base_1630znprimroot},
  {"znstar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_8Gen_base_1633znstar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_8Gen_base_1632znstar},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1635__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6cypari_5_pari_8Gen_base_1637__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6cypari_5_pari_Gen_base = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.Gen_base", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari_Gen_base), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari_Gen_base, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Wrapper for a PARI ``GEN`` containing auto-generated methods.\n\n    This class does not manage the ``GEN`` inside in any way. It is just\n    a dumb wrapper. In particular, it might be invalid if the ``GEN`` is\n    on the PARI stack and the PARI stack has been garbage collected.\n\n    You almost certainly want to use one of the derived class\n    :class:`Gen`  instead. That being said, :class:`Gen_base` can be\n    used by itself to pass around a temporary ``GEN`` within Python\n    where we cannot use C calls.\n    ", /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari_Gen_base, /*tp_traverse*/
  __pyx_tp_clear_6cypari_5_pari_Gen_base, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cypari_5_pari_Gen_base, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari_Gen_base, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyObject *__pyx_tp_new_6cypari_5_pari_Gen(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_6cypari_5_pari_Gen_base(t, a, k);
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari_Gen(PyObject *o) {
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_6cypari_5_pari_3Gen_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6cypari_5_pari_Gen_base(o);
}
static PyObject *__pyx_sq_item_6cypari_5_pari_Gen(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_6cypari_5_pari_Gen(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_6cypari_5_pari_3Gen_79__setitem__(o, i, v);
  }
  else {
    if (__pyx_ptype_6cypari_5_pari_Gen_base->tp_as_mapping && __pyx_ptype_6cypari_5_pari_Gen_base->tp_as_mapping->mp_ass_subscript)
      return __pyx_ptype_6cypari_5_pari_Gen_base->tp_as_mapping->mp_ass_subscript(o, i, v);
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyMethodDef __pyx_methods_6cypari_5_pari_Gen[] = {
  {"list", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_13list, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_12list},
  {"__reduce__", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_15__reduce__, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_14__reduce__},
  {"_add_one", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_27_add_one, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_26_add_one},
  {"getattr", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_41getattr, METH_O, __pyx_doc_6cypari_5_pari_3Gen_40getattr},
  {"mod", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_43mod, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_42mod},
  {"polred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_45polred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_44polred},
  {"nf_get_pol", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_47nf_get_pol, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_46nf_get_pol},
  {"nf_get_diff", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_49nf_get_diff, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_48nf_get_diff},
  {"nf_get_sign", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_51nf_get_sign, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_50nf_get_sign},
  {"nf_get_zk", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_53nf_get_zk, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_52nf_get_zk},
  {"bnf_get_no", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_55bnf_get_no, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_54bnf_get_no},
  {"bnf_get_cyc", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_57bnf_get_cyc, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_56bnf_get_cyc},
  {"bnf_get_gen", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_59bnf_get_gen, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_58bnf_get_gen},
  {"bnf_get_reg", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_61bnf_get_reg, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_60bnf_get_reg},
  {"bnfunit", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_63bnfunit, METH_NOARGS, 0},
  {"pr_get_p", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_65pr_get_p, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_64pr_get_p},
  {"pr_get_e", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_67pr_get_e, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_66pr_get_e},
  {"pr_get_f", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_69pr_get_f, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_68pr_get_f},
  {"pr_get_gen", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_71pr_get_gen, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_70pr_get_gen},
  {"bid_get_cyc", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_73bid_get_cyc, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_72bid_get_cyc},
  {"bid_get_gen", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_75bid_get_gen, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_74bid_get_gen},
  {"cmp_universal", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_87cmp_universal, METH_O, __pyx_doc_6cypari_5_pari_3Gen_86cmp_universal},
  {"__copy__", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_89__copy__, METH_NOARGS, 0},
  {"python_list_small", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_97python_list_small, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_96python_list_small},
  {"python_list", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_99python_list, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_98python_list},
  {"python", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_101python, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_100python},
  {"__complex__", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_107__complex__, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_106__complex__},
  {"gequal", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_111gequal, METH_O, __pyx_doc_6cypari_5_pari_3Gen_110gequal},
  {"gequal0", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_113gequal0, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_112gequal0},
  {"gequal_long", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_115gequal_long, METH_O, __pyx_doc_6cypari_5_pari_3Gen_114gequal_long},
  {"isprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_117isprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_116isprime},
  {"ispseudoprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_119ispseudoprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_118ispseudoprime},
  {"ispower", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_121ispower, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_120ispower},
  {"isprimepower", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_123isprimepower, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_122isprimepower},
  {"ispseudoprimepower", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_125ispseudoprimepower, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_124ispseudoprimepower},
  {"vecmax", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_127vecmax, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_126vecmax},
  {"vecmin", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_129vecmin, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_128vecmin},
  {"Col", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_131Col, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_130Col},
  {"Colrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_133Colrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_132Colrev},
  {"Ser", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_135Ser, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_134Ser},
  {"Str", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_137Str, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_136Str},
  {"Strexpand", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_139Strexpand, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_138Strexpand},
  {"Strtex", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_141Strtex, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_140Strtex},
  {"Vec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_143Vec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_142Vec},
  {"Vecrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_145Vecrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_144Vecrev},
  {"Vecsmall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_147Vecsmall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_146Vecsmall},
  {"bittest", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_149bittest, METH_O, __pyx_doc_6cypari_5_pari_3Gen_148bittest},
  {"padicprime", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_151padicprime, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_150padicprime},
  {"precision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_153precision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_152precision},
  {"round", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_155round, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_154round},
  {"sizeword", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_157sizeword, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_156sizeword},
  {"sizebyte", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_159sizebyte, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_158sizebyte},
  {"truncate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_161truncate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_160truncate},
  {"_valp", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_163_valp, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_162_valp},
  {"bernfrac", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_165bernfrac, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_164bernfrac},
  {"bernreal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_167bernreal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_166bernreal},
  {"besselk", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_169besselk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_168besselk},
  {"eint1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_171eint1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_170eint1},
  {"polylog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_173polylog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_172polylog},
  {"sqrtn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_175sqrtn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_174sqrtn},
  {"ffprimroot", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_177ffprimroot, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_176ffprimroot},
  {"fibonacci", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_179fibonacci, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_178fibonacci},
  {"issquare", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_181issquare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_180issquare},
  {"issquarefree", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_183issquarefree, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_182issquarefree},
  {"sumdiv", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_185sumdiv, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_184sumdiv},
  {"sumdivk", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_187sumdivk, METH_O, __pyx_doc_6cypari_5_pari_3Gen_186sumdivk},
  {"Zn_issquare", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_189Zn_issquare, METH_O, __pyx_doc_6cypari_5_pari_3Gen_188Zn_issquare},
  {"Zn_sqrt", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_191Zn_sqrt, METH_O, __pyx_doc_6cypari_5_pari_3Gen_190Zn_sqrt},
  {"ellan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_193ellan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_192ellan},
  {"ellaplist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_195ellaplist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_194ellaplist},
  {"ellisoncurve", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_197ellisoncurve, METH_O, __pyx_doc_6cypari_5_pari_3Gen_196ellisoncurve},
  {"ellminimalmodel", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_199ellminimalmodel, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_198ellminimalmodel},
  {"elltors", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_201elltors, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_200elltors},
  {"omega", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_203omega, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_202omega},
  {"disc", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_205disc, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_204disc},
  {"j", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_207j, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_206j},
  {"_eltabstorel", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_209_eltabstorel, METH_O, __pyx_doc_6cypari_5_pari_3Gen_208_eltabstorel},
  {"_eltabstorel_lift", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_211_eltabstorel_lift, METH_O, __pyx_doc_6cypari_5_pari_3Gen_210_eltabstorel_lift},
  {"_eltreltoabs", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_213_eltreltoabs, METH_O, __pyx_doc_6cypari_5_pari_3Gen_212_eltreltoabs},
  {"galoissubfields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_215galoissubfields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_214galoissubfields},
  {"nfeltval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_217nfeltval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_216nfeltval},
  {"nfbasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_219nfbasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_218nfbasis},
  {"nfbasis_d", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_221nfbasis_d, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_220nfbasis_d},
  {"nfbasistoalg_lift", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_223nfbasistoalg_lift, METH_O, __pyx_doc_6cypari_5_pari_3Gen_222nfbasistoalg_lift},
  {"nfgenerator", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_225nfgenerator, METH_NOARGS, 0},
  {"_nf_rnfeq", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_227_nf_rnfeq, METH_O, __pyx_doc_6cypari_5_pari_3Gen_226_nf_rnfeq},
  {"eval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_229eval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_228eval},
  {"factorpadic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_233factorpadic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_232factorpadic},
  {"poldegree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_235poldegree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_234poldegree},
  {"polisirreducible", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_237polisirreducible, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_236polisirreducible},
  {"polroots", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_239polroots, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_238polroots},
  {"rnfisnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_241rnfisnorm, METH_VARARGS|METH_KEYWORDS, 0},
  {"ncols", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_243ncols, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_242ncols},
  {"nrows", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_245nrows, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_244nrows},
  {"mattranspose", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_247mattranspose, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_246mattranspose},
  {"lllgram", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_249lllgram, METH_NOARGS, 0},
  {"lllgramint", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_251lllgramint, METH_NOARGS, 0},
  {"qfrep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_253qfrep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_252qfrep},
  {"matkerint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_255matkerint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_254matkerint},
  {"factor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_257factor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_256factor},
  {"nextprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_261nextprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_260nextprime},
  {"change_variable_name", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_263change_variable_name, METH_O, __pyx_doc_6cypari_5_pari_3Gen_262change_variable_name},
  {"nf_subst", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_265nf_subst, METH_O, __pyx_doc_6cypari_5_pari_3Gen_264nf_subst},
  {"type", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_267type, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_266type},
  {"polinterpolate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_269polinterpolate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_268polinterpolate},
  {"ellwp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_271ellwp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_270ellwp},
  {"debug", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_273debug, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_272debug},
  {"bernvec", (PyCFunction)__pyx_pw_6cypari_5_pari_3Gen_275bernvec, METH_NOARGS, __pyx_doc_6cypari_5_pari_3Gen_274bernvec},
  {"allocatemem", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_3Gen_277allocatemem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_3Gen_276allocatemem},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Gen = {
  __pyx_pw_6cypari_5_pari_3Gen_17__add__, /*nb_add*/
  __pyx_pw_6cypari_5_pari_3Gen_19__sub__, /*nb_subtract*/
  __pyx_pw_6cypari_5_pari_3Gen_21__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  __pyx_pw_6cypari_5_pari_3Gen_23__div__, /*nb_divide*/
  #endif
  __pyx_pw_6cypari_5_pari_3Gen_29__mod__, /*nb_remainder*/
  0, /*nb_divmod*/
  __pyx_pw_6cypari_5_pari_3Gen_31__pow__, /*nb_power*/
  __pyx_pw_6cypari_5_pari_3Gen_33__neg__, /*nb_negative*/
  0, /*nb_positive*/
  __pyx_pw_6cypari_5_pari_3Gen_259__abs__, /*nb_absolute*/
  __pyx_pw_6cypari_5_pari_3Gen_109__nonzero__, /*nb_nonzero*/
  __pyx_pw_6cypari_5_pari_3Gen_39__invert__, /*nb_invert*/
  __pyx_pw_6cypari_5_pari_3Gen_37__lshift__, /*nb_lshift*/
  __pyx_pw_6cypari_5_pari_3Gen_35__rshift__, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  __pyx_pw_6cypari_5_pari_3Gen_93__int__, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_6cypari_5_pari_3Gen_103__long__, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pw_6cypari_5_pari_3Gen_105__float__, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  __pyx_pw_6cypari_5_pari_3Gen_91__hex__, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  __pyx_pw_6cypari_5_pari_3Gen_25__truediv__, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  __pyx_pw_6cypari_5_pari_3Gen_95__index__, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Gen = {
  __pyx_pw_6cypari_5_pari_3Gen_81__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_6cypari_5_pari_Gen, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Gen = {
  __pyx_pw_6cypari_5_pari_3Gen_81__len__, /*mp_length*/
  __pyx_pw_6cypari_5_pari_3Gen_77__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_6cypari_5_pari_Gen, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_6cypari_5_pari_Gen = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.Gen", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari_Gen), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari_Gen, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  __pyx_pw_6cypari_5_pari_3Gen_85__cmp__, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_6cypari_5_pari_3Gen_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Gen, /*tp_as_number*/
  &__pyx_tp_as_sequence_Gen, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Gen, /*tp_as_mapping*/
  __pyx_pw_6cypari_5_pari_3Gen_9__hash__, /*tp_hash*/
  __pyx_pw_6cypari_5_pari_3Gen_231__call__, /*tp_call*/
  __pyx_pw_6cypari_5_pari_3Gen_7__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Cython extension class that models the PARI GEN type.\n    ", /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari_Gen_base, /*tp_traverse*/
  __pyx_tp_clear_6cypari_5_pari_Gen_base, /*tp_clear*/
  __pyx_pw_6cypari_5_pari_3Gen_83__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_6cypari_5_pari_3Gen_11__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cypari_5_pari_Gen, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6cypari_5_pari_3Gen_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari_Gen, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyObject *__pyx_tp_new_6cypari_5_pari_Pari_auto(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari_Pari_auto(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_6cypari_5_pari_Pari_auto[] = {
  {"Catalan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1Catalan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_Catalan},
  {"Col", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_3Col, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_2Col},
  {"Colrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_5Colrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_4Colrev},
  {"Euler", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_7Euler, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_6Euler},
  {"I", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_9I, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_8I},
  {"List", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_11List, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_10List},
  {"Map", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_13Map, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_12Map},
  {"Mat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_15Mat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_14Mat},
  {"Mod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_17Mod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_16Mod},
  {"Pi", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_19Pi, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_18Pi},
  {"Pol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_21Pol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_20Pol},
  {"Polrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_23Polrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_22Polrev},
  {"Qfb", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_25Qfb, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_24Qfb},
  {"Ser", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_27Ser, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_26Ser},
  {"Set", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_29Set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_28Set},
  {"Strchr", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_31Strchr, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_30Strchr},
  {"Vec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_33Vec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_32Vec},
  {"Vecrev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_35Vecrev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_34Vecrev},
  {"Vecsmall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_37Vecsmall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_36Vecsmall},
  {"abs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_39abs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_38abs},
  {"acos", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_41acos, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_40acos},
  {"acosh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_43acosh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_42acosh},
  {"addhelp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_45addhelp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_44addhelp},
  {"addprimes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_47addprimes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_46addprimes},
  {"agm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_49agm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_48agm},
  {"algadd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_51algadd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_50algadd},
  {"algalgtobasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_53algalgtobasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_52algalgtobasis},
  {"algaut", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_55algaut, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_54algaut},
  {"algb", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_57algb, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_56algb},
  {"algbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_59algbasis, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_58algbasis},
  {"algbasistoalg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_61algbasistoalg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_60algbasistoalg},
  {"algcenter", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_63algcenter, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_62algcenter},
  {"algcentralproj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_65algcentralproj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_64algcentralproj},
  {"algchar", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_67algchar, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_66algchar},
  {"algcharpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_69algcharpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_68algcharpoly},
  {"algdegree", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_71algdegree, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_70algdegree},
  {"algdep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_73algdep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_72algdep},
  {"algdim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_75algdim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_74algdim},
  {"algdisc", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_77algdisc, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_76algdisc},
  {"algdivl", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_79algdivl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_78algdivl},
  {"algdivr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_81algdivr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_80algdivr},
  {"alggroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_83alggroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_82alggroup},
  {"alghasse", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_85alghasse, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_84alghasse},
  {"alghassef", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_87alghassef, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_86alghassef},
  {"alghassei", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_89alghassei, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_88alghassei},
  {"algindex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_91algindex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_90algindex},
  {"alginit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_93alginit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_92alginit},
  {"alginv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_95alginv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_94alginv},
  {"alginvbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_97alginvbasis, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_96alginvbasis},
  {"algisassociative", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_99algisassociative, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_98algisassociative},
  {"algiscommutative", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_101algiscommutative, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_100algiscommutative},
  {"algisdivision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_103algisdivision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_102algisdivision},
  {"algisramified", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_105algisramified, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_104algisramified},
  {"algissemisimple", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_107algissemisimple, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_106algissemisimple},
  {"algissimple", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_109algissimple, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_108algissimple},
  {"algissplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_111algissplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_110algissplit},
  {"alglatelement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_113alglatelement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_112alglatelement},
  {"alglathnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_115alglathnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_114alglathnf},
  {"alglatindex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_117alglatindex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_116alglatindex},
  {"alglatlefttransporter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_119alglatlefttransporter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_118alglatlefttransporter},
  {"alglatmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_121alglatmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_120alglatmul},
  {"alglatrighttransporter", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_123alglatrighttransporter, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_122alglatrighttransporter},
  {"algmakeintegral", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_125algmakeintegral, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_124algmakeintegral},
  {"algmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_127algmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_126algmul},
  {"algmultable", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_129algmultable, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_128algmultable},
  {"algneg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_131algneg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_130algneg},
  {"algnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_133algnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_132algnorm},
  {"algpoleval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_135algpoleval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_134algpoleval},
  {"algpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_137algpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_136algpow},
  {"algprimesubalg", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_139algprimesubalg, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_138algprimesubalg},
  {"algquotient", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_141algquotient, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_140algquotient},
  {"algradical", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_143algradical, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_142algradical},
  {"algramifiedplaces", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_145algramifiedplaces, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_144algramifiedplaces},
  {"algrandom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_147algrandom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_146algrandom},
  {"algrelmultable", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_149algrelmultable, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_148algrelmultable},
  {"algsimpledec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_151algsimpledec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_150algsimpledec},
  {"algsplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_153algsplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_152algsplit},
  {"algsplittingdata", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_155algsplittingdata, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_154algsplittingdata},
  {"algsplittingfield", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_157algsplittingfield, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_156algsplittingfield},
  {"algsqr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_159algsqr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_158algsqr},
  {"algsub", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_161algsub, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_160algsub},
  {"algsubalg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_163algsubalg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_162algsubalg},
  {"algtableinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_165algtableinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_164algtableinit},
  {"algtensor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_167algtensor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_166algtensor},
  {"algtomatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_169algtomatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_168algtomatrix},
  {"algtrace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_171algtrace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_170algtrace},
  {"algtype", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_173algtype, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_172algtype},
  {"apply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_175apply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_174apply},
  {"arg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_177arg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_176arg},
  {"asin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_179asin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_178asin},
  {"asinh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_181asinh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_180asinh},
  {"asympnum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_183asympnum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_182asympnum},
  {"atan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_185atan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_184atan},
  {"atanh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_187atanh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_186atanh},
  {"bernfrac", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_189bernfrac, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_188bernfrac},
  {"bernpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_191bernpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_190bernpol},
  {"bernreal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_193bernreal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_192bernreal},
  {"bernvec", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_195bernvec, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_194bernvec},
  {"besselh1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_197besselh1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_196besselh1},
  {"besselh2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_199besselh2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_198besselh2},
  {"besseli", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_201besseli, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_200besseli},
  {"besselj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_203besselj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_202besselj},
  {"besseljh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_205besseljh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_204besseljh},
  {"besselk", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_207besselk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_206besselk},
  {"besseln", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_209besseln, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_208besseln},
  {"bestappr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_211bestappr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_210bestappr},
  {"bestapprPade", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_213bestapprPade, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_212bestapprPade},
  {"bestapprnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_215bestapprnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_214bestapprnf},
  {"bezout", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_217bezout, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_216bezout},
  {"bezoutres", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_219bezoutres, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_218bezoutres},
  {"bigomega", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_221bigomega, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_220bigomega},
  {"binary", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_223binary, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_222binary},
  {"binomial", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_225binomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_224binomial},
  {"bitand", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_227bitand, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_226bitand},
  {"bitneg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_229bitneg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_228bitneg},
  {"bitnegimply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_231bitnegimply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_230bitnegimply},
  {"bitor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_233bitor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_232bitor},
  {"bitprecision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_235bitprecision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_234bitprecision},
  {"bittest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_237bittest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_236bittest},
  {"bitxor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_239bitxor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_238bitxor},
  {"bnfcertify", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_241bnfcertify, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_240bnfcertify},
  {"bnfcompress", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_243bnfcompress, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_242bnfcompress},
  {"bnfdecodemodule", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_245bnfdecodemodule, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_244bnfdecodemodule},
  {"bnfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_247bnfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_246bnfinit},
  {"bnfisintnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_249bnfisintnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_248bnfisintnorm},
  {"bnfisnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_251bnfisnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_250bnfisnorm},
  {"bnfisprincipal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_253bnfisprincipal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_252bnfisprincipal},
  {"bnfissunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_255bnfissunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_254bnfissunit},
  {"bnfisunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_257bnfisunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_256bnfisunit},
  {"bnflog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_259bnflog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_258bnflog},
  {"bnflogdegree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_261bnflogdegree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_260bnflogdegree},
  {"bnflogef", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_263bnflogef, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_262bnflogef},
  {"bnfnarrow", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_265bnfnarrow, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_264bnfnarrow},
  {"bnfsignunit", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_267bnfsignunit, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_266bnfsignunit},
  {"bnfsunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_269bnfsunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_268bnfsunit},
  {"bnrL1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_271bnrL1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_270bnrL1},
  {"bnrchar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_273bnrchar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_272bnrchar},
  {"bnrclassno", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_275bnrclassno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_274bnrclassno},
  {"bnrclassnolist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_277bnrclassnolist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_276bnrclassnolist},
  {"bnrconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_279bnrconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_278bnrconductor},
  {"bnrconductorofchar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_281bnrconductorofchar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_280bnrconductorofchar},
  {"bnrdisc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_283bnrdisc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_282bnrdisc},
  {"bnrdisclist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_285bnrdisclist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_284bnrdisclist},
  {"bnrgaloisapply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_287bnrgaloisapply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_286bnrgaloisapply},
  {"bnrgaloismatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_289bnrgaloismatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_288bnrgaloismatrix},
  {"bnrinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_291bnrinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_290bnrinit},
  {"bnrisconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_293bnrisconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_292bnrisconductor},
  {"bnrisgalois", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_295bnrisgalois, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_294bnrisgalois},
  {"bnrisprincipal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_297bnrisprincipal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_296bnrisprincipal},
  {"bnrrootnumber", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_299bnrrootnumber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_298bnrrootnumber},
  {"bnrstark", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_301bnrstark, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_300bnrstark},
  {"call", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_303call, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_302call},
  {"ceil", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_305ceil, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_304ceil},
  {"centerlift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_307centerlift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_306centerlift},
  {"characteristic", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_309characteristic, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_308characteristic},
  {"charconj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_311charconj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_310charconj},
  {"chardiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_313chardiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_312chardiv},
  {"chareval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_315chareval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_314chareval},
  {"chargalois", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_317chargalois, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_316chargalois},
  {"charker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_319charker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_318charker},
  {"charmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_321charmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_320charmul},
  {"charorder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_323charorder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_322charorder},
  {"charpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_325charpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_324charpoly},
  {"charpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_327charpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_326charpow},
  {"chinese", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_329chinese, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_328chinese},
  {"cmp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_331cmp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_330cmp},
  {"component", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_333component, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_332component},
  {"concat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_335concat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_334concat},
  {"conj", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_337conj, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_336conj},
  {"conjvec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_339conjvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_338conjvec},
  {"content", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_341content, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_340content},
  {"contfrac", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_343contfrac, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_342contfrac},
  {"contfraceval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_345contfraceval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_344contfraceval},
  {"contfracinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_347contfracinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_346contfracinit},
  {"contfracpnqn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_349contfracpnqn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_348contfracpnqn},
  {"core", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_351core, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_350core},
  {"coredisc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_353coredisc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_352coredisc},
  {"cos", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_355cos, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_354cos},
  {"cosh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_357cosh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_356cosh},
  {"cotan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_359cotan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_358cotan},
  {"cotanh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_361cotanh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_360cotanh},
  {"default", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_363default, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_362default},
  {"denominator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_365denominator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_364denominator},
  {"deriv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_367deriv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_366deriv},
  {"diffop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_369diffop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_368diffop},
  {"digits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_371digits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_370digits},
  {"dilog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_373dilog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_372dilog},
  {"dirdiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_375dirdiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_374dirdiv},
  {"dirmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_377dirmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_376dirmul},
  {"dirzetak", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_379dirzetak, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_378dirzetak},
  {"divisors", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_381divisors, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_380divisors},
  {"divisorslenstra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_383divisorslenstra, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_382divisorslenstra},
  {"divrem", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_385divrem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_384divrem},
  {"eint1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_387eint1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_386eint1},
  {"ellL1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_389ellL1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_388ellL1},
  {"elladd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_391elladd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_390elladd},
  {"ellak", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_393ellak, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_392ellak},
  {"ellan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_395ellan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_394ellan},
  {"ellanalyticrank", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_397ellanalyticrank, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_396ellanalyticrank},
  {"ellap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_399ellap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_398ellap},
  {"ellbil", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_401ellbil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_400ellbil},
  {"ellbsd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_403ellbsd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_402ellbsd},
  {"ellcard", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_405ellcard, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_404ellcard},
  {"ellchangecurve", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_407ellchangecurve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_406ellchangecurve},
  {"ellchangepoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_409ellchangepoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_408ellchangepoint},
  {"ellchangepointinv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_411ellchangepointinv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_410ellchangepointinv},
  {"ellconvertname", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_413ellconvertname, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_412ellconvertname},
  {"elldivpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_415elldivpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_414elldivpol},
  {"elleisnum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_417elleisnum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_416elleisnum},
  {"elleta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_419elleta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_418elleta},
  {"ellformaldifferential", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_421ellformaldifferential, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_420ellformaldifferential},
  {"ellformalexp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_423ellformalexp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_422ellformalexp},
  {"ellformallog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_425ellformallog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_424ellformallog},
  {"ellformalpoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_427ellformalpoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_426ellformalpoint},
  {"ellformalw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_429ellformalw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_428ellformalw},
  {"ellfromeqn", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_431ellfromeqn, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_430ellfromeqn},
  {"ellfromj", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_433ellfromj, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_432ellfromj},
  {"ellgenerators", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_435ellgenerators, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_434ellgenerators},
  {"ellglobalred", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_437ellglobalred, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_436ellglobalred},
  {"ellgroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_439ellgroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_438ellgroup},
  {"ellheegner", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_441ellheegner, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_440ellheegner},
  {"ellheight", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_443ellheight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_442ellheight},
  {"ellheightmatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_445ellheightmatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_444ellheightmatrix},
  {"ellidentify", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_447ellidentify, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_446ellidentify},
  {"ellinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_449ellinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_448ellinit},
  {"ellisogeny", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_451ellisogeny, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_450ellisogeny},
  {"ellisogenyapply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_453ellisogenyapply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_452ellisogenyapply},
  {"ellisomat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_455ellisomat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_454ellisomat},
  {"ellisoncurve", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_457ellisoncurve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_456ellisoncurve},
  {"ellisotree", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_459ellisotree, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_458ellisotree},
  {"ellissupersingular", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_461ellissupersingular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_460ellissupersingular},
  {"ellj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_463ellj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_462ellj},
  {"elllocalred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_465elllocalred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_464elllocalred},
  {"elllog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_467elllog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_466elllog},
  {"elllseries", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_469elllseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_468elllseries},
  {"ellminimaldisc", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_471ellminimaldisc, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_470ellminimaldisc},
  {"ellminimaltwist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_473ellminimaltwist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_472ellminimaltwist},
  {"ellmoddegree", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_475ellmoddegree, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_474ellmoddegree},
  {"ellmodulareqn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_477ellmodulareqn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_476ellmodulareqn},
  {"ellmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_479ellmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_478ellmul},
  {"ellneg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_481ellneg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_480ellneg},
  {"ellnonsingularmultiple", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_483ellnonsingularmultiple, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_482ellnonsingularmultiple},
  {"ellorder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_485ellorder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_484ellorder},
  {"ellordinate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_487ellordinate, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_486ellordinate},
  {"ellpadicL", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_489ellpadicL, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_488ellpadicL},
  {"ellpadicbsd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_491ellpadicbsd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_490ellpadicbsd},
  {"ellpadicfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_493ellpadicfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_492ellpadicfrobenius},
  {"ellpadicheight", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_495ellpadicheight, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_494ellpadicheight},
  {"ellpadicheightmatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_497ellpadicheightmatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_496ellpadicheightmatrix},
  {"ellpadiclog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_499ellpadiclog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_498ellpadiclog},
  {"ellpadicregulator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_501ellpadicregulator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_500ellpadicregulator},
  {"ellpadics2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_503ellpadics2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_502ellpadics2},
  {"ellperiods", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_505ellperiods, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_504ellperiods},
  {"ellpointtoz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_507ellpointtoz, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_506ellpointtoz},
  {"ellpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_509ellpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_508ellpow},
  {"ellratpoints", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_511ellratpoints, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_510ellratpoints},
  {"ellrootno", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_513ellrootno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_512ellrootno},
  {"ellsea", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_515ellsea, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_514ellsea},
  {"ellsearch", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_517ellsearch, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_516ellsearch},
  {"ellsigma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_519ellsigma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_518ellsigma},
  {"ellsub", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_521ellsub, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_520ellsub},
  {"elltamagawa", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_523elltamagawa, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_522elltamagawa},
  {"elltaniyama", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_525elltaniyama, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_524elltaniyama},
  {"elltatepairing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_527elltatepairing, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_526elltatepairing},
  {"elltors", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_529elltors, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_528elltors},
  {"elltwist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_531elltwist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_530elltwist},
  {"ellweilpairing", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_533ellweilpairing, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_532ellweilpairing},
  {"ellwp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_535ellwp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_534ellwp},
  {"ellxn", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_537ellxn, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_536ellxn},
  {"ellzeta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_539ellzeta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_538ellzeta},
  {"ellztopoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_541ellztopoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_540ellztopoint},
  {"erfc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_543erfc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_542erfc},
  {"errname", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_545errname, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_544errname},
  {"eta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_547eta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_546eta},
  {"eulerphi", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_549eulerphi, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_548eulerphi},
  {"exp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_551exp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_550exp},
  {"expm1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_553expm1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_552expm1},
  {"exponent", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_555exponent, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_554exponent},
  {"extern", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_557extern, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_556extern},
  {"externstr", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_559externstr, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_558externstr},
  {"factor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_561factor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_560factor},
  {"factorback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_563factorback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_562factorback},
  {"factorcantor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_565factorcantor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_564factorcantor},
  {"factorff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_567factorff, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_566factorff},
  {"factorial", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_569factorial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_568factorial},
  {"factorint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_571factorint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_570factorint},
  {"factormod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_573factormod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_572factormod},
  {"factormodDDF", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_575factormodDDF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_574factormodDDF},
  {"factormodSQF", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_577factormodSQF, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_576factormodSQF},
  {"factornf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_579factornf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_578factornf},
  {"factorpadic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_581factorpadic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_580factorpadic},
  {"ffcompomap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_583ffcompomap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_582ffcompomap},
  {"ffembed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_585ffembed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_584ffembed},
  {"ffextend", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_587ffextend, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_586ffextend},
  {"fffrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_589fffrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_588fffrobenius},
  {"ffgen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_591ffgen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_590ffgen},
  {"ffinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_593ffinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_592ffinit},
  {"ffinvmap", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_595ffinvmap, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_594ffinvmap},
  {"fflog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_597fflog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_596fflog},
  {"ffmap", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_599ffmap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_598ffmap},
  {"ffnbirred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_601ffnbirred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_600ffnbirred},
  {"fforder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_603fforder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_602fforder},
  {"fibonacci", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_605fibonacci, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_604fibonacci},
  {"fileclose", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_607fileclose, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_606fileclose},
  {"fileextern", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_609fileextern, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_608fileextern},
  {"fileflush", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_611fileflush, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_610fileflush},
  {"fileopen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_613fileopen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_612fileopen},
  {"fileread", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_615fileread, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_614fileread},
  {"filereadstr", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_617filereadstr, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_616filereadstr},
  {"filewrite", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_619filewrite, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_618filewrite},
  {"filewrite1", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_621filewrite1, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_620filewrite1},
  {"floor", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_623floor, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_622floor},
  {"fold", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_625fold, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_624fold},
  {"frac", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_627frac, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_626frac},
  {"fromdigits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_629fromdigits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_628fromdigits},
  {"galoischardet", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_631galoischardet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_630galoischardet},
  {"galoischarpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_633galoischarpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_632galoischarpoly},
  {"galoischartable", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_635galoischartable, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_634galoischartable},
  {"galoisconjclasses", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_637galoisconjclasses, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_636galoisconjclasses},
  {"galoisexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_639galoisexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_638galoisexport},
  {"galoisfixedfield", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_641galoisfixedfield, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_640galoisfixedfield},
  {"galoisgetgroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_643galoisgetgroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_642galoisgetgroup},
  {"galoisgetname", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_645galoisgetname, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_644galoisgetname},
  {"galoisgetpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_647galoisgetpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_646galoisgetpol},
  {"galoisidentify", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_649galoisidentify, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_648galoisidentify},
  {"galoisinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_651galoisinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_650galoisinit},
  {"galoisisabelian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_653galoisisabelian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_652galoisisabelian},
  {"galoisisnormal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_655galoisisnormal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_654galoisisnormal},
  {"galoispermtopol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_657galoispermtopol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_656galoispermtopol},
  {"galoissubcyclo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_659galoissubcyclo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_658galoissubcyclo},
  {"galoissubfields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_661galoissubfields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_660galoissubfields},
  {"galoissubgroups", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_663galoissubgroups, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_662galoissubgroups},
  {"gamma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_665gamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_664gamma},
  {"gammah", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_667gammah, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_666gammah},
  {"gammamellininv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_669gammamellininv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_668gammamellininv},
  {"gammamellininvasymp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_671gammamellininvasymp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_670gammamellininvasymp},
  {"gammamellininvinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_673gammamellininvinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_672gammamellininvinit},
  {"gcd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_675gcd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_674gcd},
  {"gcdext", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_677gcdext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_676gcdext},
  {"genus2red", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_679genus2red, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_678genus2red},
  {"getabstime", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_681getabstime, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_680getabstime},
  {"getcache", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_683getcache, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_682getcache},
  {"getenv", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_685getenv, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_684getenv},
  {"getheap", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_687getheap, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_686getheap},
  {"getrand", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_689getrand, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_688getrand},
  {"getstack", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_691getstack, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_690getstack},
  {"gettime", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_693gettime, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_692gettime},
  {"getwalltime", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_695getwalltime, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_694getwalltime},
  {"hammingweight", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_697hammingweight, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_696hammingweight},
  {"hilbert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_699hilbert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_698hilbert},
  {"hyperellcharpoly", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_701hyperellcharpoly, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_700hyperellcharpoly},
  {"hyperellpadicfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_703hyperellpadicfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_702hyperellpadicfrobenius},
  {"hyperellratpoints", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_705hyperellratpoints, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_704hyperellratpoints},
  {"hyperu", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_707hyperu, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_706hyperu},
  {"idealadd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_709idealadd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_708idealadd},
  {"idealaddtoone", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_711idealaddtoone, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_710idealaddtoone},
  {"idealappr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_713idealappr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_712idealappr},
  {"idealchinese", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_715idealchinese, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_714idealchinese},
  {"idealcoprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_717idealcoprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_716idealcoprime},
  {"idealdiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_719idealdiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_718idealdiv},
  {"idealfactor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_721idealfactor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_720idealfactor},
  {"idealfactorback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_723idealfactorback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_722idealfactorback},
  {"idealfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_725idealfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_724idealfrobenius},
  {"idealhnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_727idealhnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_726idealhnf},
  {"idealintersect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_729idealintersect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_728idealintersect},
  {"idealinv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_731idealinv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_730idealinv},
  {"ideallist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_733ideallist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_732ideallist},
  {"ideallistarch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_735ideallistarch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_734ideallistarch},
  {"ideallog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_737ideallog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_736ideallog},
  {"idealmin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_739idealmin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_738idealmin},
  {"idealmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_741idealmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_740idealmul},
  {"idealnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_743idealnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_742idealnorm},
  {"idealnumden", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_745idealnumden, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_744idealnumden},
  {"idealpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_747idealpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_746idealpow},
  {"idealprimedec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_749idealprimedec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_748idealprimedec},
  {"idealprincipalunits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_751idealprincipalunits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_750idealprincipalunits},
  {"idealramgroups", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_753idealramgroups, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_752idealramgroups},
  {"idealred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_755idealred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_754idealred},
  {"idealredmodpower", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_757idealredmodpower, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_756idealredmodpower},
  {"idealstar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_759idealstar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_758idealstar},
  {"idealtwoelt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_761idealtwoelt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_760idealtwoelt},
  {"idealval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_763idealval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_762idealval},
  {"imag", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_765imag, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_764imag},
  {"incgam", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_767incgam, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_766incgam},
  {"incgamc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_769incgamc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_768incgamc},
  {"input", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_771input, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_770input},
  {"install", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_773install, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_772install},
  {"intformal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_775intformal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_774intformal},
  {"intnumgaussinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_777intnumgaussinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_776intnumgaussinit},
  {"intnuminit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_779intnuminit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_778intnuminit},
  {"isfundamental", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_781isfundamental, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_780isfundamental},
  {"ispowerful", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_783ispowerful, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_782ispowerful},
  {"isprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_785isprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_784isprime},
  {"ispseudoprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_787ispseudoprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_786ispseudoprime},
  {"issquarefree", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_789issquarefree, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_788issquarefree},
  {"kill", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_791kill, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_790kill},
  {"kronecker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_793kronecker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_792kronecker},
  {"lambertw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_795lambertw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_794lambertw},
  {"laurentseries", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_797laurentseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_796laurentseries},
  {"lcm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_799lcm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_798lcm},
  {"length", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_801length, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_800length},
  {"lex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_803lex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_802lex},
  {"lfun", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_805lfun, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_804lfun},
  {"lfunabelianrelinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_807lfunabelianrelinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_806lfunabelianrelinit},
  {"lfunan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_809lfunan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_808lfunan},
  {"lfunartin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_811lfunartin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_810lfunartin},
  {"lfuncheckfeq", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_813lfuncheckfeq, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_812lfuncheckfeq},
  {"lfunconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_815lfunconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_814lfunconductor},
  {"lfuncost", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_817lfuncost, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_816lfuncost},
  {"lfuncreate", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_819lfuncreate, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_818lfuncreate},
  {"lfundiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_821lfundiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_820lfundiv},
  {"lfunetaquo", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_823lfunetaquo, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_822lfunetaquo},
  {"lfungenus2", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_825lfungenus2, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_824lfungenus2},
  {"lfunhardy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_827lfunhardy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_826lfunhardy},
  {"lfuninit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_829lfuninit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_828lfuninit},
  {"lfunlambda", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_831lfunlambda, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_830lfunlambda},
  {"lfunmf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_833lfunmf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_832lfunmf},
  {"lfunmfspec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_835lfunmfspec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_834lfunmfspec},
  {"lfunmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_837lfunmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_836lfunmul},
  {"lfunorderzero", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_839lfunorderzero, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_838lfunorderzero},
  {"lfunqf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_841lfunqf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_840lfunqf},
  {"lfunrootres", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_843lfunrootres, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_842lfunrootres},
  {"lfunsympow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_845lfunsympow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_844lfunsympow},
  {"lfuntheta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_847lfuntheta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_846lfuntheta},
  {"lfunthetacost", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_849lfunthetacost, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_848lfunthetacost},
  {"lfunthetainit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_851lfunthetainit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_850lfunthetainit},
  {"lfuntwist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_853lfuntwist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_852lfuntwist},
  {"lfunzeros", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_855lfunzeros, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_854lfunzeros},
  {"lift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_857lift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_856lift},
  {"liftall", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_859liftall, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_858liftall},
  {"liftint", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_861liftint, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_860liftint},
  {"liftpol", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_863liftpol, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_862liftpol},
  {"limitnum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_865limitnum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_864limitnum},
  {"lindep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_867lindep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_866lindep},
  {"listinsert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_869listinsert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_868listinsert},
  {"listkill", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_871listkill, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_870listkill},
  {"listpop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_873listpop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_872listpop},
  {"listput", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_875listput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_874listput},
  {"listsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_877listsort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_876listsort},
  {"lngamma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_879lngamma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_878lngamma},
  {"localbitprec", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_881localbitprec, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_880localbitprec},
  {"localprec", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_883localprec, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_882localprec},
  {"log", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_885log, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_884log},
  {"log1p", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_887log1p, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_886log1p},
  {"mapdelete", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_889mapdelete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_888mapdelete},
  {"mapget", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_891mapget, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_890mapget},
  {"mapput", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_893mapput, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_892mapput},
  {"matadjoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_895matadjoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_894matadjoint},
  {"matalgtobasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_897matalgtobasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_896matalgtobasis},
  {"matbasistoalg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_899matbasistoalg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_898matbasistoalg},
  {"matcompanion", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_901matcompanion, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_900matcompanion},
  {"matconcat", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_903matconcat, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_902matconcat},
  {"matdet", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_905matdet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_904matdet},
  {"matdetint", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_907matdetint, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_906matdetint},
  {"matdetmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_909matdetmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_908matdetmod},
  {"matdiagonal", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_911matdiagonal, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_910matdiagonal},
  {"mateigen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_913mateigen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_912mateigen},
  {"matfrobenius", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_915matfrobenius, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_914matfrobenius},
  {"mathess", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_917mathess, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_916mathess},
  {"mathilbert", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_919mathilbert, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_918mathilbert},
  {"mathnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_921mathnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_920mathnf},
  {"mathnfmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_923mathnfmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_922mathnfmod},
  {"mathnfmodid", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_925mathnfmodid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_924mathnfmodid},
  {"mathouseholder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_927mathouseholder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_926mathouseholder},
  {"matid", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_929matid, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_928matid},
  {"matimage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_931matimage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_930matimage},
  {"matimagecompl", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_933matimagecompl, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_932matimagecompl},
  {"matindexrank", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_935matindexrank, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_934matindexrank},
  {"matintersect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_937matintersect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_936matintersect},
  {"matinverseimage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_939matinverseimage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_938matinverseimage},
  {"matinvmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_941matinvmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_940matinvmod},
  {"matisdiagonal", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_943matisdiagonal, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_942matisdiagonal},
  {"matker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_945matker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_944matker},
  {"matkerint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_947matkerint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_946matkerint},
  {"matmuldiagonal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_949matmuldiagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_948matmuldiagonal},
  {"matmultodiagonal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_951matmultodiagonal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_950matmultodiagonal},
  {"matpascal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_953matpascal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_952matpascal},
  {"matpermanent", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_955matpermanent, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_954matpermanent},
  {"matqr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_957matqr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_956matqr},
  {"matrank", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_959matrank, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_958matrank},
  {"matrixqz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_961matrixqz, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_960matrixqz},
  {"matsize", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_963matsize, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_962matsize},
  {"matsnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_965matsnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_964matsnf},
  {"matsolve", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_967matsolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_966matsolve},
  {"matsolvemod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_969matsolvemod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_968matsolvemod},
  {"matsupplement", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_971matsupplement, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_970matsupplement},
  {"mattranspose", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_973mattranspose, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_972mattranspose},
  {"max", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_975max, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_974max},
  {"mfDelta", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_977mfDelta, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_976mfDelta},
  {"mfEH", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_979mfEH, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_978mfEH},
  {"mfEk", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_981mfEk, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_980mfEk},
  {"mfTheta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_983mfTheta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_982mfTheta},
  {"mfatkin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_985mfatkin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_984mfatkin},
  {"mfatkineigenvalues", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_987mfatkineigenvalues, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_986mfatkineigenvalues},
  {"mfatkininit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_989mfatkininit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_988mfatkininit},
  {"mfbasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_991mfbasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_990mfbasis},
  {"mfbd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_993mfbd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_992mfbd},
  {"mfbracket", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_995mfbracket, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_994mfbracket},
  {"mfcoef", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_997mfcoef, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_996mfcoef},
  {"mfcoefs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_999mfcoefs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_998mfcoefs},
  {"mfconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1001mfconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1000mfconductor},
  {"mfcosets", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1003mfcosets, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1002mfcosets},
  {"mfcuspisregular", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1005mfcuspisregular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1004mfcuspisregular},
  {"mfcusps", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1007mfcusps, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1006mfcusps},
  {"mfcuspval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1009mfcuspval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1008mfcuspval},
  {"mfcuspwidth", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1011mfcuspwidth, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1010mfcuspwidth},
  {"mfderiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1013mfderiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1012mfderiv},
  {"mfderivE2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1015mfderivE2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1014mfderivE2},
  {"mfdim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1017mfdim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1016mfdim},
  {"mfdiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1019mfdiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1018mfdiv},
  {"mfeigenbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1021mfeigenbasis, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1020mfeigenbasis},
  {"mfeigensearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1023mfeigensearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1022mfeigensearch},
  {"mfeisenstein", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1025mfeisenstein, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1024mfeisenstein},
  {"mfembed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1027mfembed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1026mfembed},
  {"mfeval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1029mfeval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1028mfeval},
  {"mffields", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1031mffields, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1030mffields},
  {"mffromell", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1033mffromell, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1032mffromell},
  {"mffrometaquo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1035mffrometaquo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1034mffrometaquo},
  {"mffromlfun", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1037mffromlfun, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1036mffromlfun},
  {"mffromqf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1039mffromqf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1038mffromqf},
  {"mfgaloistype", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1041mfgaloistype, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1040mfgaloistype},
  {"mfhecke", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1043mfhecke, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1042mfhecke},
  {"mfheckemat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1045mfheckemat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1044mfheckemat},
  {"mfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1047mfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1046mfinit},
  {"mfisCM", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1049mfisCM, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1048mfisCM},
  {"mfisequal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1051mfisequal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1050mfisequal},
  {"mfkohnenbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1053mfkohnenbasis, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1052mfkohnenbasis},
  {"mfkohnenbijection", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1055mfkohnenbijection, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1054mfkohnenbijection},
  {"mfkohneneigenbasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1057mfkohneneigenbasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1056mfkohneneigenbasis},
  {"mflinear", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1059mflinear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1058mflinear},
  {"mfmanin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1061mfmanin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1060mfmanin},
  {"mfmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1063mfmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1062mfmul},
  {"mfnumcusps", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1065mfnumcusps, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1064mfnumcusps},
  {"mfparams", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1067mfparams, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1066mfparams},
  {"mfperiodpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1069mfperiodpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1068mfperiodpol},
  {"mfperiodpolbasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1071mfperiodpolbasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1070mfperiodpolbasis},
  {"mfpetersson", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1073mfpetersson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1072mfpetersson},
  {"mfpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1075mfpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1074mfpow},
  {"mfsearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1077mfsearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1076mfsearch},
  {"mfshift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1079mfshift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1078mfshift},
  {"mfshimura", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1081mfshimura, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1080mfshimura},
  {"mfspace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1083mfspace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1082mfspace},
  {"mfsplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1085mfsplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1084mfsplit},
  {"mfsturm", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1087mfsturm, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1086mfsturm},
  {"mfsymbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1089mfsymbol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1088mfsymbol},
  {"mfsymboleval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1091mfsymboleval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1090mfsymboleval},
  {"mftaylor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1093mftaylor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1092mftaylor},
  {"mftobasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1095mftobasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1094mftobasis},
  {"mftocoset", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1097mftocoset, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1096mftocoset},
  {"mftonew", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1099mftonew, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1098mftonew},
  {"mftraceform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1101mftraceform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1100mftraceform},
  {"mftwist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1103mftwist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1102mftwist},
  {"min", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1105min, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1104min},
  {"minpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1107minpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1106minpoly},
  {"modreverse", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1109modreverse, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1108modreverse},
  {"moebius", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1111moebius, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1110moebius},
  {"msatkinlehner", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1113msatkinlehner, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1112msatkinlehner},
  {"mscuspidal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1115mscuspidal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1114mscuspidal},
  {"msdim", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1117msdim, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1116msdim},
  {"mseisenstein", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1119mseisenstein, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1118mseisenstein},
  {"mseval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1121mseval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1120mseval},
  {"msfromcusp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1123msfromcusp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1122msfromcusp},
  {"msfromell", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1125msfromell, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1124msfromell},
  {"msfromhecke", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1127msfromhecke, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1126msfromhecke},
  {"msgetlevel", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1129msgetlevel, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1128msgetlevel},
  {"msgetsign", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1131msgetsign, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1130msgetsign},
  {"msgetweight", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1133msgetweight, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1132msgetweight},
  {"mshecke", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1135mshecke, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1134mshecke},
  {"msinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1137msinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1136msinit},
  {"msissymbol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1139msissymbol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1138msissymbol},
  {"mslattice", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1141mslattice, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1140mslattice},
  {"msnew", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1143msnew, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1142msnew},
  {"msomseval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1145msomseval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1144msomseval},
  {"mspadicL", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1147mspadicL, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1146mspadicL},
  {"mspadicinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1149mspadicinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1148mspadicinit},
  {"mspadicmoments", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1151mspadicmoments, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1150mspadicmoments},
  {"mspadicseries", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1153mspadicseries, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1152mspadicseries},
  {"mspathgens", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1155mspathgens, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1154mspathgens},
  {"mspathlog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1157mspathlog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1156mspathlog},
  {"mspetersson", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1159mspetersson, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1158mspetersson},
  {"mspolygon", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1161mspolygon, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1160mspolygon},
  {"msqexpansion", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1163msqexpansion, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1162msqexpansion},
  {"mssplit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1165mssplit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1164mssplit},
  {"msstar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1167msstar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1166msstar},
  {"mstooms", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1169mstooms, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1168mstooms},
  {"newtonpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1171newtonpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1170newtonpoly},
  {"nextprime", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1173nextprime, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1172nextprime},
  {"nfalgtobasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1175nfalgtobasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1174nfalgtobasis},
  {"nfbasis", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1177nfbasis, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1176nfbasis},
  {"nfbasistoalg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1179nfbasistoalg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1178nfbasistoalg},
  {"nfcertify", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1181nfcertify, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1180nfcertify},
  {"nfcompositum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1183nfcompositum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1182nfcompositum},
  {"nfdetint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1185nfdetint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1184nfdetint},
  {"nfdisc", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1187nfdisc, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1186nfdisc},
  {"nfeltadd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1189nfeltadd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1188nfeltadd},
  {"nfeltdiv", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1191nfeltdiv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1190nfeltdiv},
  {"nfeltdiveuc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1193nfeltdiveuc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1192nfeltdiveuc},
  {"nfeltdivmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1195nfeltdivmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1194nfeltdivmodpr},
  {"nfeltdivrem", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1197nfeltdivrem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1196nfeltdivrem},
  {"nfeltembed", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1199nfeltembed, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1198nfeltembed},
  {"nfeltmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1201nfeltmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1200nfeltmod},
  {"nfeltmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1203nfeltmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1202nfeltmul},
  {"nfeltmulmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1205nfeltmulmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1204nfeltmulmodpr},
  {"nfeltnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1207nfeltnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1206nfeltnorm},
  {"nfeltpow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1209nfeltpow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1208nfeltpow},
  {"nfeltpowmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1211nfeltpowmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1210nfeltpowmodpr},
  {"nfeltreduce", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1213nfeltreduce, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1212nfeltreduce},
  {"nfeltreducemodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1215nfeltreducemodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1214nfeltreducemodpr},
  {"nfeltsign", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1217nfeltsign, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1216nfeltsign},
  {"nfelttrace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1219nfelttrace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1218nfelttrace},
  {"nffactor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1221nffactor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1220nffactor},
  {"nffactorback", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1223nffactorback, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1222nffactorback},
  {"nffactormod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1225nffactormod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1224nffactormod},
  {"nfgaloisapply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1227nfgaloisapply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1226nfgaloisapply},
  {"nfgaloisconj", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1229nfgaloisconj, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1228nfgaloisconj},
  {"nfgrunwaldwang", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1231nfgrunwaldwang, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1230nfgrunwaldwang},
  {"nfhilbert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1233nfhilbert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1232nfhilbert},
  {"nfhnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1235nfhnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1234nfhnf},
  {"nfhnfmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1237nfhnfmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1236nfhnfmod},
  {"nfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1239nfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1238nfinit},
  {"nfisideal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1241nfisideal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1240nfisideal},
  {"nfisincl", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1243nfisincl, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1242nfisincl},
  {"nfisisom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1245nfisisom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1244nfisisom},
  {"nfislocalpower", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1247nfislocalpower, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1246nfislocalpower},
  {"nfkermodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1249nfkermodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1248nfkermodpr},
  {"nfmodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1251nfmodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1250nfmodpr},
  {"nfmodprinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1253nfmodprinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1252nfmodprinit},
  {"nfmodprlift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1255nfmodprlift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1254nfmodprlift},
  {"nfnewprec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1257nfnewprec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1256nfnewprec},
  {"nfpolsturm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1259nfpolsturm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1258nfpolsturm},
  {"nfroots", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1261nfroots, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1260nfroots},
  {"nfrootsof1", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1263nfrootsof1, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1262nfrootsof1},
  {"nfsnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1265nfsnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1264nfsnf},
  {"nfsolvemodpr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1267nfsolvemodpr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1266nfsolvemodpr},
  {"nfsplitting", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1269nfsplitting, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1268nfsplitting},
  {"nfsubfields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1271nfsubfields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1270nfsubfields},
  {"norm", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1273norm, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1272norm},
  {"norml2", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1275norml2, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1274norml2},
  {"normlp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1277normlp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1276normlp},
  {"numbpart", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1279numbpart, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1278numbpart},
  {"numdiv", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1281numdiv, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1280numdiv},
  {"numerator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1283numerator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1282numerator},
  {"numtoperm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1285numtoperm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1284numtoperm},
  {"omega", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1287omega, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1286omega},
  {"oo", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1289oo, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_1288oo},
  {"padicappr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1291padicappr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1290padicappr},
  {"padicfields", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1293padicfields, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1292padicfields},
  {"padicprec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1295padicprec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1294padicprec},
  {"parapply", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1297parapply, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1296parapply},
  {"pareval", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1299pareval, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1298pareval},
  {"parselect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1301parselect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1300parselect},
  {"partitions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1303partitions, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1302partitions},
  {"permorder", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1305permorder, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1304permorder},
  {"permsign", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1307permsign, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1306permsign},
  {"permtonum", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1309permtonum, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1308permtonum},
  {"plotbox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1311plotbox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1310plotbox},
  {"plotclip", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1313plotclip, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1312plotclip},
  {"plotcolor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1315plotcolor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1314plotcolor},
  {"plotcopy", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1317plotcopy, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1316plotcopy},
  {"plotcursor", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1319plotcursor, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1318plotcursor},
  {"plotdraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1321plotdraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1320plotdraw},
  {"plotexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1323plotexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1322plotexport},
  {"plothraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1325plothraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1324plothraw},
  {"plothrawexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1327plothrawexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1326plothrawexport},
  {"plothsizes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1329plothsizes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1328plothsizes},
  {"plotinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1331plotinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1330plotinit},
  {"plotkill", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1333plotkill, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1332plotkill},
  {"plotlines", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1335plotlines, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1334plotlines},
  {"plotlinetype", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1337plotlinetype, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1336plotlinetype},
  {"plotmove", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1339plotmove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1338plotmove},
  {"plotpoints", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1341plotpoints, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1340plotpoints},
  {"plotpointsize", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1343plotpointsize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1342plotpointsize},
  {"plotpointtype", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1345plotpointtype, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1344plotpointtype},
  {"plotrbox", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1347plotrbox, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1346plotrbox},
  {"plotrecthraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1349plotrecthraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1348plotrecthraw},
  {"plotrline", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1351plotrline, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1350plotrline},
  {"plotrmove", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1353plotrmove, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1352plotrmove},
  {"plotrpoint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1355plotrpoint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1354plotrpoint},
  {"plotscale", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1357plotscale, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1356plotscale},
  {"plotstring", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1359plotstring, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1358plotstring},
  {"polchebyshev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1361polchebyshev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1360polchebyshev},
  {"polclass", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1363polclass, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1362polclass},
  {"polcoef", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1365polcoef, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1364polcoef},
  {"polcoeff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1367polcoeff, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1366polcoeff},
  {"polcompositum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1369polcompositum, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1368polcompositum},
  {"polcyclo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1371polcyclo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1370polcyclo},
  {"polcyclofactors", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1373polcyclofactors, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1372polcyclofactors},
  {"poldegree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1375poldegree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1374poldegree},
  {"poldisc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1377poldisc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1376poldisc},
  {"poldiscfactors", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1379poldiscfactors, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1378poldiscfactors},
  {"poldiscreduced", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1381poldiscreduced, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1380poldiscreduced},
  {"polgalois", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1383polgalois, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1382polgalois},
  {"polgraeffe", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1385polgraeffe, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1384polgraeffe},
  {"polhensellift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1387polhensellift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1386polhensellift},
  {"polhermite", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1389polhermite, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1388polhermite},
  {"poliscyclo", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1391poliscyclo, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1390poliscyclo},
  {"poliscycloprod", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1393poliscycloprod, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1392poliscycloprod},
  {"polisirreducible", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1395polisirreducible, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1394polisirreducible},
  {"pollead", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1397pollead, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1396pollead},
  {"pollegendre", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1399pollegendre, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1398pollegendre},
  {"polmodular", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1401polmodular, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1400polmodular},
  {"polrecip", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1403polrecip, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1402polrecip},
  {"polred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1405polred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1404polred},
  {"polredabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1407polredabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1406polredabs},
  {"polredbest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1409polredbest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1408polredbest},
  {"polredord", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1411polredord, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1410polredord},
  {"polresultant", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1413polresultant, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1412polresultant},
  {"polresultantext", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1415polresultantext, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1414polresultantext},
  {"polroots", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1417polroots, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1416polroots},
  {"polrootsbound", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1419polrootsbound, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1418polrootsbound},
  {"polrootsff", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1421polrootsff, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1420polrootsff},
  {"polrootsmod", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1423polrootsmod, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1422polrootsmod},
  {"polrootspadic", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1425polrootspadic, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1424polrootspadic},
  {"polrootsreal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1427polrootsreal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1426polrootsreal},
  {"polsturm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1429polsturm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1428polsturm},
  {"polsubcyclo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1431polsubcyclo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1430polsubcyclo},
  {"polsylvestermatrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1433polsylvestermatrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1432polsylvestermatrix},
  {"polsym", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1435polsym, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1434polsym},
  {"poltchebi", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1437poltchebi, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1436poltchebi},
  {"poltschirnhaus", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1439poltschirnhaus, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1438poltschirnhaus},
  {"polylog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1441polylog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1440polylog},
  {"polzagier", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1443polzagier, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1442polzagier},
  {"powers", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1445powers, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1444powers},
  {"precision", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1447precision, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1446precision},
  {"precprime", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1449precprime, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1448precprime},
  {"prime", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1451prime, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1450prime},
  {"primecert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1453primecert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1452primecert},
  {"primecertexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1455primecertexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1454primecertexport},
  {"primecertisvalid", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1457primecertisvalid, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1456primecertisvalid},
  {"primepi", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1459primepi, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1458primepi},
  {"primes", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1461primes, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1460primes},
  {"prodeulerrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1463prodeulerrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1462prodeulerrat},
  {"prodnumrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1465prodnumrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1464prodnumrat},
  {"psdraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1467psdraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1466psdraw},
  {"psi", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1469psi, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1468psi},
  {"psplothraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1471psplothraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1470psplothraw},
  {"qfauto", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1473qfauto, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1472qfauto},
  {"qfautoexport", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1475qfautoexport, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1474qfautoexport},
  {"qfbclassno", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1477qfbclassno, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1476qfbclassno},
  {"qfbcompraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1479qfbcompraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1478qfbcompraw},
  {"qfbhclassno", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1481qfbhclassno, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1480qfbhclassno},
  {"qfbil", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1483qfbil, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1482qfbil},
  {"qfbnucomp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1485qfbnucomp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1484qfbnucomp},
  {"qfbnupow", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1487qfbnupow, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1486qfbnupow},
  {"qfbpowraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1489qfbpowraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1488qfbpowraw},
  {"qfbprimeform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1491qfbprimeform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1490qfbprimeform},
  {"qfbred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1493qfbred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1492qfbred},
  {"qfbredsl2", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1495qfbredsl2, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1494qfbredsl2},
  {"qfbsolve", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1497qfbsolve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1496qfbsolve},
  {"qfeval", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1499qfeval, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1498qfeval},
  {"qfgaussred", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1501qfgaussred, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1500qfgaussred},
  {"qfisom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1503qfisom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1502qfisom},
  {"qfisominit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1505qfisominit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1504qfisominit},
  {"qfjacobi", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1507qfjacobi, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1506qfjacobi},
  {"qflll", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1509qflll, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1508qflll},
  {"qflllgram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1511qflllgram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1510qflllgram},
  {"qfminim", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1513qfminim, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1512qfminim},
  {"qfnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1515qfnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1514qfnorm},
  {"qforbits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1517qforbits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1516qforbits},
  {"qfparam", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1519qfparam, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1518qfparam},
  {"qfperfection", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1521qfperfection, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1520qfperfection},
  {"qfrep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1523qfrep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1522qfrep},
  {"qfsign", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1525qfsign, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1524qfsign},
  {"qfsolve", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1527qfsolve, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1526qfsolve},
  {"quadclassunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1529quadclassunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1528quadclassunit},
  {"quaddisc", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1531quaddisc, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1530quaddisc},
  {"quadgen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1533quadgen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1532quadgen},
  {"quadhilbert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1535quadhilbert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1534quadhilbert},
  {"quadpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1537quadpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1536quadpoly},
  {"quadray", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1539quadray, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1538quadray},
  {"quadregulator", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1541quadregulator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1540quadregulator},
  {"quadunit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1543quadunit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1542quadunit},
  {"ramanujantau", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1545ramanujantau, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1544ramanujantau},
  {"random", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1547random, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1546random},
  {"randomprime", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1549randomprime, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1548randomprime},
  {"read", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1551read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1550read},
  {"readstr", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1553readstr, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1552readstr},
  {"readvec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1555readvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1554readvec},
  {"real", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1557real, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1556real},
  {"removeprimes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1559removeprimes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1558removeprimes},
  {"rnfalgtobasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1561rnfalgtobasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1560rnfalgtobasis},
  {"rnfbasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1563rnfbasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1562rnfbasis},
  {"rnfbasistoalg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1565rnfbasistoalg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1564rnfbasistoalg},
  {"rnfcharpoly", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1567rnfcharpoly, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1566rnfcharpoly},
  {"rnfconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1569rnfconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1568rnfconductor},
  {"rnfdedekind", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1571rnfdedekind, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1570rnfdedekind},
  {"rnfdet", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1573rnfdet, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1572rnfdet},
  {"rnfdisc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1575rnfdisc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1574rnfdisc},
  {"rnfeltabstorel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1577rnfeltabstorel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1576rnfeltabstorel},
  {"rnfeltdown", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1579rnfeltdown, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1578rnfeltdown},
  {"rnfeltnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1581rnfeltnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1580rnfeltnorm},
  {"rnfeltreltoabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1583rnfeltreltoabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1582rnfeltreltoabs},
  {"rnfelttrace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1585rnfelttrace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1584rnfelttrace},
  {"rnfeltup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1587rnfeltup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1586rnfeltup},
  {"rnfequation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1589rnfequation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1588rnfequation},
  {"rnfhnfbasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1591rnfhnfbasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1590rnfhnfbasis},
  {"rnfidealabstorel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1593rnfidealabstorel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1592rnfidealabstorel},
  {"rnfidealdown", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1595rnfidealdown, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1594rnfidealdown},
  {"rnfidealfactor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1597rnfidealfactor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1596rnfidealfactor},
  {"rnfidealhnf", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1599rnfidealhnf, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1598rnfidealhnf},
  {"rnfidealmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1601rnfidealmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1600rnfidealmul},
  {"rnfidealnormabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1603rnfidealnormabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1602rnfidealnormabs},
  {"rnfidealnormrel", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1605rnfidealnormrel, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1604rnfidealnormrel},
  {"rnfidealprimedec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1607rnfidealprimedec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1606rnfidealprimedec},
  {"rnfidealreltoabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1609rnfidealreltoabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1608rnfidealreltoabs},
  {"rnfidealtwoelt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1611rnfidealtwoelt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1610rnfidealtwoelt},
  {"rnfidealup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1613rnfidealup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1612rnfidealup},
  {"rnfinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1615rnfinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1614rnfinit},
  {"rnfisabelian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1617rnfisabelian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1616rnfisabelian},
  {"rnfisfree", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1619rnfisfree, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1618rnfisfree},
  {"rnfislocalcyclo", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1621rnfislocalcyclo, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1620rnfislocalcyclo},
  {"rnfisnorm", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1623rnfisnorm, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1622rnfisnorm},
  {"rnfisnorminit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1625rnfisnorminit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1624rnfisnorminit},
  {"rnfkummer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1627rnfkummer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1626rnfkummer},
  {"rnflllgram", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1629rnflllgram, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1628rnflllgram},
  {"rnfnormgroup", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1631rnfnormgroup, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1630rnfnormgroup},
  {"rnfpolred", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1633rnfpolred, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1632rnfpolred},
  {"rnfpolredabs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1635rnfpolredabs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1634rnfpolredabs},
  {"rnfpolredbest", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1637rnfpolredbest, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1636rnfpolredbest},
  {"rnfpseudobasis", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1639rnfpseudobasis, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1638rnfpseudobasis},
  {"rnfsteinitz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1641rnfsteinitz, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1640rnfsteinitz},
  {"select", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1643select, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1642select},
  {"self", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1645self, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_1644self},
  {"seralgdep", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1647seralgdep, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1646seralgdep},
  {"serchop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1649serchop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1648serchop},
  {"serconvol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1651serconvol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1650serconvol},
  {"serlaplace", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1653serlaplace, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1652serlaplace},
  {"serprec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1655serprec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1654serprec},
  {"serreverse", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1657serreverse, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1656serreverse},
  {"setbinop", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1659setbinop, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1658setbinop},
  {"setintersect", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1661setintersect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1660setintersect},
  {"setisset", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1663setisset, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1662setisset},
  {"setminus", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1665setminus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1664setminus},
  {"setrand", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1667setrand, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1666setrand},
  {"setsearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1669setsearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1668setsearch},
  {"setunion", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1671setunion, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1670setunion},
  {"shift", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1673shift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1672shift},
  {"shiftmul", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1675shiftmul, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1674shiftmul},
  {"sigma", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1677sigma, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1676sigma},
  {"sign", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1679sign, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1678sign},
  {"simplify", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1681simplify, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1680simplify},
  {"sin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1683sin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1682sin},
  {"sinc", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1685sinc, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1684sinc},
  {"sinh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1687sinh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1686sinh},
  {"sizebyte", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1689sizebyte, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1688sizebyte},
  {"sizedigit", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1691sizedigit, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1690sizedigit},
  {"sqr", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1693sqr, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1692sqr},
  {"sqrt", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1695sqrt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1694sqrt},
  {"sqrtint", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1697sqrtint, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1696sqrtint},
  {"sqrtnint", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1699sqrtnint, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1698sqrtnint},
  {"stirling", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1701stirling, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1700stirling},
  {"subgrouplist", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1703subgrouplist, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1702subgrouplist},
  {"subst", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1705subst, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1704subst},
  {"substpol", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1707substpol, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1706substpol},
  {"substvec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1709substvec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1708substvec},
  {"sumdedekind", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1711sumdedekind, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1710sumdedekind},
  {"sumdigits", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1713sumdigits, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1712sumdigits},
  {"sumeulerrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1715sumeulerrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1714sumeulerrat},
  {"sumformal", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1717sumformal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1716sumformal},
  {"sumnumapinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1719sumnumapinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1718sumnumapinit},
  {"sumnuminit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1721sumnuminit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1720sumnuminit},
  {"sumnumlagrangeinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1723sumnumlagrangeinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1722sumnumlagrangeinit},
  {"sumnummonieninit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1725sumnummonieninit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1724sumnummonieninit},
  {"sumnumrat", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1727sumnumrat, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1726sumnumrat},
  {"system", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1729system, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1728system},
  {"tan", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1731tan, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1730tan},
  {"tanh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1733tanh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1732tanh},
  {"taylor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1735taylor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1734taylor},
  {"teichmuller", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1737teichmuller, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1736teichmuller},
  {"theta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1739theta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1738theta},
  {"thetanullk", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1741thetanullk, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1740thetanullk},
  {"thue", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1743thue, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1742thue},
  {"thueinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1745thueinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1744thueinit},
  {"trace", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1747trace, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1746trace},
  {"type", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1749type, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1748type},
  {"valuation", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1751valuation, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1750valuation},
  {"varhigher", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1753varhigher, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1752varhigher},
  {"variable", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1755variable, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1754variable},
  {"variables", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1757variables, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1756variables},
  {"varlower", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1759varlower, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1758varlower},
  {"vecextract", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1761vecextract, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1760vecextract},
  {"vecprod", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1763vecprod, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1762vecprod},
  {"vecsearch", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1765vecsearch, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1764vecsearch},
  {"vecsort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1767vecsort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1766vecsort},
  {"vecsum", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1769vecsum, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1768vecsum},
  {"version", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1771version, METH_NOARGS, __pyx_doc_6cypari_5_pari_9Pari_auto_1770version},
  {"weber", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1773weber, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1772weber},
  {"writebin", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1775writebin, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1774writebin},
  {"zeta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1777zeta, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1776zeta},
  {"zetahurwitz", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1779zetahurwitz, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1778zetahurwitz},
  {"zetamult", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1781zetamult, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1780zetamult},
  {"zetamultall", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1783zetamultall, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1782zetamultall},
  {"zetamultconvert", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1785zetamultconvert, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1784zetamultconvert},
  {"zetamultinit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1787zetamultinit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1786zetamultinit},
  {"znchar", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1789znchar, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1788znchar},
  {"zncharconductor", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1791zncharconductor, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1790zncharconductor},
  {"znchardecompose", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1793znchardecompose, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1792znchardecompose},
  {"znchargauss", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1795znchargauss, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1794znchargauss},
  {"zncharinduce", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1797zncharinduce, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1796zncharinduce},
  {"zncharisodd", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1799zncharisodd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1798zncharisodd},
  {"znchartokronecker", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1801znchartokronecker, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1800znchartokronecker},
  {"znchartoprimitive", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1803znchartoprimitive, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1802znchartoprimitive},
  {"znconreychar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1805znconreychar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1804znconreychar},
  {"znconreyexp", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1807znconreyexp, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1806znconreyexp},
  {"znconreylog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1809znconreylog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1808znconreylog},
  {"zncoppersmith", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1811zncoppersmith, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1810zncoppersmith},
  {"znlog", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1813znlog, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1812znlog},
  {"znorder", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1815znorder, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1814znorder},
  {"znprimroot", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1817znprimroot, METH_O, __pyx_doc_6cypari_5_pari_9Pari_auto_1816znprimroot},
  {"znstar", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_9Pari_auto_1819znstar, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_9Pari_auto_1818znstar},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1821__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6cypari_5_pari_9Pari_auto_1823__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6cypari_5_pari_Pari_auto = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.Pari_auto", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari_Pari_auto), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari_Pari_auto, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "\n    Part of the :class:`Pari` class containing auto-generated functions.\n\n    You must never use this class directly (in fact, Python may crash\n    if you do), use the derived class :class:`Pari` instead.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cypari_5_pari_Pari_auto, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari_Pari_auto, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};
static struct __pyx_vtabstruct_6cypari_5_pari_Pari __pyx_vtable_6cypari_5_pari_Pari;

static PyObject *__pyx_tp_new_6cypari_5_pari_Pari(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6cypari_5_pari_Pari *p;
  PyObject *o = __pyx_tp_new_6cypari_5_pari_Pari_auto(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_6cypari_5_pari_Pari *)o);
  p->__pyx_vtab = __pyx_vtabptr_6cypari_5_pari_Pari;
  p->PARI_ZERO = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  p->PARI_ONE = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  p->PARI_TWO = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  p->_UI_callback = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_6cypari_5_pari_4Pari_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_6cypari_5_pari_Pari(PyObject *o) {
  struct __pyx_obj_6cypari_5_pari_Pari *p = (struct __pyx_obj_6cypari_5_pari_Pari *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->PARI_ZERO);
  Py_CLEAR(p->PARI_ONE);
  Py_CLEAR(p->PARI_TWO);
  Py_CLEAR(p->_UI_callback);
  #if CYTHON_USE_TYPE_SLOTS
  if (PyType_IS_GC(Py_TYPE(o)->tp_base))
  #endif
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_6cypari_5_pari_Pari_auto(o);
}

static int __pyx_tp_traverse_6cypari_5_pari_Pari(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cypari_5_pari_Pari *p = (struct __pyx_obj_6cypari_5_pari_Pari *)o;
  e = ((likely(__pyx_ptype_6cypari_5_pari_Pari_auto)) ? ((__pyx_ptype_6cypari_5_pari_Pari_auto->tp_traverse) ? __pyx_ptype_6cypari_5_pari_Pari_auto->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_6cypari_5_pari_Pari)); if (e) return e;
  if (p->PARI_ZERO) {
    e = (*v)(((PyObject *)p->PARI_ZERO), a); if (e) return e;
  }
  if (p->PARI_ONE) {
    e = (*v)(((PyObject *)p->PARI_ONE), a); if (e) return e;
  }
  if (p->PARI_TWO) {
    e = (*v)(((PyObject *)p->PARI_TWO), a); if (e) return e;
  }
  if (p->_UI_callback) {
    e = (*v)(p->_UI_callback, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6cypari_5_pari_Pari(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6cypari_5_pari_Pari *p = (struct __pyx_obj_6cypari_5_pari_Pari *)o;
  if (likely(__pyx_ptype_6cypari_5_pari_Pari_auto)) { if (__pyx_ptype_6cypari_5_pari_Pari_auto->tp_clear) __pyx_ptype_6cypari_5_pari_Pari_auto->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_6cypari_5_pari_Pari);
  tmp = ((PyObject*)p->PARI_ZERO);
  p->PARI_ZERO = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->PARI_ONE);
  p->PARI_ONE = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->PARI_TWO);
  p->PARI_TWO = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_UI_callback);
  p->_UI_callback = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6cypari_5_pari_4Pari_UI_callback(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6cypari_5_pari_4Pari_11UI_callback_1__get__(o);
}

static int __pyx_setprop_6cypari_5_pari_4Pari_UI_callback(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_6cypari_5_pari_4Pari_11UI_callback_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_6cypari_5_pari_4Pari_PARI_ZERO(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6cypari_5_pari_4Pari_9PARI_ZERO_1__get__(o);
}

static PyObject *__pyx_getprop_6cypari_5_pari_4Pari_PARI_ONE(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6cypari_5_pari_4Pari_8PARI_ONE_1__get__(o);
}

static PyObject *__pyx_getprop_6cypari_5_pari_4Pari_PARI_TWO(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_6cypari_5_pari_4Pari_8PARI_TWO_1__get__(o);
}

static PyMethodDef __pyx_methods_6cypari_5_pari_Pari[] = {
  {"_close", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_5_close, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_4_close},
  {"shut_up", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_7shut_up, METH_NOARGS, 0},
  {"speak_up", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_9speak_up, METH_NOARGS, 0},
  {"debugstack", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_11debugstack, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_10debugstack},
  {"set_debug_level", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_17set_debug_level, METH_O, __pyx_doc_6cypari_5_pari_4Pari_16set_debug_level},
  {"get_debug_level", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_19get_debug_level, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_18get_debug_level},
  {"set_real_precision_bits", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_21set_real_precision_bits, METH_O, __pyx_doc_6cypari_5_pari_4Pari_20set_real_precision_bits},
  {"get_real_precision_bits", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_23get_real_precision_bits, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_22get_real_precision_bits},
  {"set_real_precision", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_25set_real_precision, METH_O, __pyx_doc_6cypari_5_pari_4Pari_24set_real_precision},
  {"get_real_precision", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_27get_real_precision, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_26get_real_precision},
  {"set_series_precision", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_29set_series_precision, METH_O, 0},
  {"get_default_bit_precision", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_31get_default_bit_precision, METH_NOARGS, 0},
  {"set_default_bit_precision", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_33set_default_bit_precision, METH_O, __pyx_doc_6cypari_5_pari_4Pari_32set_default_bit_precision},
  {"get_series_precision", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_35get_series_precision, METH_NOARGS, 0},
  {"double_to_gen", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_37double_to_gen, METH_O, __pyx_doc_6cypari_5_pari_4Pari_36double_to_gen},
  {"_real_coerced_to_bits_prec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_39_real_coerced_to_bits_prec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_38_real_coerced_to_bits_prec},
  {"complex", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_41complex, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_40complex},
  {"zero", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_45zero, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_44zero},
  {"one", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_47one, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_46one},
  {"new_with_bits_prec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_49new_with_bits_prec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_48new_with_bits_prec},
  {"stacksize", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_51stacksize, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_50stacksize},
  {"stacksizemax", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_53stacksizemax, METH_NOARGS, __pyx_doc_6cypari_5_pari_4Pari_52stacksizemax},
  {"allocatemem", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_55allocatemem, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_54allocatemem},
  {"pari_version", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_57pari_version, METH_NOARGS, 0},
  {"init_primes", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_59init_primes, METH_O, __pyx_doc_6cypari_5_pari_4Pari_58init_primes},
  {"primes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_61primes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_60primes},
  {"polchebyshev", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_63polchebyshev, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_62polchebyshev},
  {"factorial", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_65factorial, METH_O, __pyx_doc_6cypari_5_pari_4Pari_64factorial},
  {"polsubcyclo", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_67polsubcyclo, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_66polsubcyclo},
  {"setrand", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_69setrand, METH_O, __pyx_doc_6cypari_5_pari_4Pari_68setrand},
  {"vector", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_71vector, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_70vector},
  {"matrix", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_73matrix, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_72matrix},
  {"genus2red", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_75genus2red, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_74genus2red},
  {"List", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_4Pari_77List, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_4Pari_76List},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_79__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_6cypari_5_pari_4Pari_81__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6cypari_5_pari_Pari[] = {
  {(char *)"UI_callback", __pyx_getprop_6cypari_5_pari_4Pari_UI_callback, __pyx_setprop_6cypari_5_pari_4Pari_UI_callback, (char *)0, 0},
  {(char *)"PARI_ZERO", __pyx_getprop_6cypari_5_pari_4Pari_PARI_ZERO, 0, (char *)0, 0},
  {(char *)"PARI_ONE", __pyx_getprop_6cypari_5_pari_4Pari_PARI_ONE, 0, (char *)0, 0},
  {(char *)"PARI_TWO", __pyx_getprop_6cypari_5_pari_4Pari_PARI_TWO, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_6cypari_5_pari_Pari = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.Pari", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari_Pari), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari_Pari, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_pw_6cypari_5_pari_4Pari_13__repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  __pyx_pw_6cypari_5_pari_4Pari_15__hash__, /*tp_hash*/
  __pyx_pw_6cypari_5_pari_4Pari_43__call__, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari_Pari, /*tp_traverse*/
  __pyx_tp_clear_6cypari_5_pari_Pari, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6cypari_5_pari_Pari, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6cypari_5_pari_Pari, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_6cypari_5_pari_4Pari_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari_Pari, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *__pyx_freelist_6cypari_5_pari___pyx_scope_struct____iter__[8];
static int __pyx_freecount_6cypari_5_pari___pyx_scope_struct____iter__ = 0;

static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6cypari_5_pari___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__)))) {
    o = (PyObject*)__pyx_freelist_6cypari_5_pari___pyx_scope_struct____iter__[--__pyx_freecount_6cypari_5_pari___pyx_scope_struct____iter__];
    memset(o, 0, sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct____iter__(PyObject *o) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_v);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6cypari_5_pari___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__)))) {
    __pyx_freelist_6cypari_5_pari___pyx_scope_struct____iter__[__pyx_freecount_6cypari_5_pari___pyx_scope_struct____iter__++] = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *)o;
  if (p->__pyx_v_v) {
    e = (*v)(((PyObject *)p->__pyx_v_v), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6cypari_5_pari___pyx_scope_struct____iter__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__ *)o;
  tmp = ((PyObject*)p->__pyx_v_v);
  p->__pyx_v_v = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6cypari_5_pari___pyx_scope_struct____iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.__pyx_scope_struct____iter__", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct____iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct____iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct____iter__, /*tp_traverse*/
  __pyx_tp_clear_6cypari_5_pari___pyx_scope_struct____iter__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari___pyx_scope_struct____iter__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *__pyx_freelist_6cypari_5_pari___pyx_scope_struct_1_genexpr[8];
static int __pyx_freecount_6cypari_5_pari___pyx_scope_struct_1_genexpr = 0;

static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_freelist_6cypari_5_pari___pyx_scope_struct_1_genexpr[--__pyx_freecount_6cypari_5_pari___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr)))) {
    __pyx_freelist_6cypari_5_pari___pyx_scope_struct_1_genexpr[__pyx_freecount_6cypari_5_pari___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_6cypari_5_pari___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari___pyx_scope_struct_1_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *__pyx_freelist_6cypari_5_pari___pyx_scope_struct_2_genexpr[8];
static int __pyx_freecount_6cypari_5_pari___pyx_scope_struct_2_genexpr = 0;

static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr)))) {
    o = (PyObject*)__pyx_freelist_6cypari_5_pari___pyx_scope_struct_2_genexpr[--__pyx_freecount_6cypari_5_pari___pyx_scope_struct_2_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr)))) {
    __pyx_freelist_6cypari_5_pari___pyx_scope_struct_2_genexpr[__pyx_freecount_6cypari_5_pari___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_6cypari_5_pari___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_2_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari___pyx_scope_struct_2_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *__pyx_freelist_6cypari_5_pari___pyx_scope_struct_3___getitem__[8];
static int __pyx_freecount_6cypari_5_pari___pyx_scope_struct_3___getitem__ = 0;

static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_3___getitem__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_3___getitem__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__)))) {
    o = (PyObject*)__pyx_freelist_6cypari_5_pari___pyx_scope_struct_3___getitem__[--__pyx_freecount_6cypari_5_pari___pyx_scope_struct_3___getitem__];
    memset(o, 0, sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_3___getitem__(PyObject *o) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_inds);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_3___getitem__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__)))) {
    __pyx_freelist_6cypari_5_pari___pyx_scope_struct_3___getitem__[__pyx_freecount_6cypari_5_pari___pyx_scope_struct_3___getitem__++] = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_3___getitem__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *)o;
  if (p->__pyx_v_inds) {
    e = (*v)(p->__pyx_v_inds, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6cypari_5_pari___pyx_scope_struct_3___getitem__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__ *)o;
  tmp = ((PyObject*)p->__pyx_v_inds);
  p->__pyx_v_inds = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_6cypari_5_pari_Gen *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_6cypari_5_pari___pyx_scope_struct_3___getitem__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.__pyx_scope_struct_3___getitem__", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_3___getitem__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_3___getitem__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_3___getitem__, /*tp_traverse*/
  __pyx_tp_clear_6cypari_5_pari___pyx_scope_struct_3___getitem__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari___pyx_scope_struct_3___getitem__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *__pyx_freelist_6cypari_5_pari___pyx_scope_struct_4_genexpr[8];
static int __pyx_freecount_6cypari_5_pari___pyx_scope_struct_4_genexpr = 0;

static PyObject *__pyx_tp_new_6cypari_5_pari___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_4_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_freelist_6cypari_5_pari___pyx_scope_struct_4_genexpr[--__pyx_freecount_6cypari_5_pari___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_v_i);
  Py_CLEAR(p->__pyx_t_0);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6cypari_5_pari___pyx_scope_struct_4_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr)))) {
    __pyx_freelist_6cypari_5_pari___pyx_scope_struct_4_genexpr[__pyx_freecount_6cypari_5_pari___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr *)o;
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  if (p->__pyx_t_0) {
    e = (*v)(p->__pyx_t_0, a); if (e) return e;
  }
  return 0;
}

static PyTypeObject __pyx_type_6cypari_5_pari___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "cypari._pari.__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_6cypari_5_pari___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6cypari_5_pari___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6cypari_5_pari___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6cypari_5_pari___pyx_scope_struct_4_genexpr, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"prec_bits_to_words", (PyCFunction)__pyx_pw_6cypari_5_pari_15prec_bits_to_words, METH_O, __pyx_doc_6cypari_5_pari_14prec_bits_to_words},
  {"prec_words_to_bits", (PyCFunction)__pyx_pw_6cypari_5_pari_17prec_words_to_bits, METH_O, __pyx_doc_6cypari_5_pari_16prec_words_to_bits},
  {"default_bitprec", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6cypari_5_pari_19default_bitprec, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cypari_5_pari_18default_bitprec},
  {"integer_to_gen", (PyCFunction)__pyx_pw_6cypari_5_pari_25integer_to_gen, METH_O, __pyx_doc_6cypari_5_pari_24integer_to_gen},
  {"gen_to_integer", (PyCFunction)__pyx_pw_6cypari_5_pari_27gen_to_integer, METH_O, __pyx_doc_6cypari_5_pari_26gen_to_integer},
  {"gen_to_python", (PyCFunction)__pyx_pw_6cypari_5_pari_29gen_to_python, METH_O, __pyx_doc_6cypari_5_pari_28gen_to_python},
  {"objtoclosure", (PyCFunction)__pyx_pw_6cypari_5_pari_31objtoclosure, METH_O, __pyx_doc_6cypari_5_pari_30objtoclosure},
  {"objtogen", (PyCFunction)__pyx_pw_6cypari_5_pari_33objtogen, METH_O, __pyx_doc_6cypari_5_pari_32objtogen},
  {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__pari(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__pari},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "_pari",
    __pyx_k_Sage_class_for_PARI_s_GEN_type, /* 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_s_0, __pyx_k_0, sizeof(__pyx_k_0), 0, 0, 1, 0},
  {&__pyx_kp_s_32bit, __pyx_k_32bit, sizeof(__pyx_k_32bit), 0, 0, 1, 0},
  {&__pyx_kp_s_64bit, __pyx_k_64bit, sizeof(__pyx_k_64bit), 0, 0, 1, 0},
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_AP, __pyx_k_AP, sizeof(__pyx_k_AP), 0, 0, 1, 1},
  {&__pyx_n_s_Aborted, __pyx_k_Aborted, sizeof(__pyx_k_Aborted), 0, 0, 1, 1},
  {&__pyx_n_s_AlarmInterrupt, __pyx_k_AlarmInterrupt, sizeof(__pyx_k_AlarmInterrupt), 0, 0, 1, 1},
  {&__pyx_n_s_AssertionError, __pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 0, 1, 1},
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
  {&__pyx_n_s_BaseException, __pyx_k_BaseException, sizeof(__pyx_k_BaseException), 0, 0, 1, 1},
  {&__pyx_kp_s_Bus_error, __pyx_k_Bus_error, sizeof(__pyx_k_Bus_error), 0, 0, 1, 0},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_CF, __pyx_k_CF, sizeof(__pyx_k_CF), 0, 0, 1, 1},
  {&__pyx_n_s_CHI1, __pyx_k_CHI1, sizeof(__pyx_k_CHI1), 0, 0, 1, 1},
  {&__pyx_n_s_CHI2, __pyx_k_CHI2, sizeof(__pyx_k_CHI2), 0, 0, 1, 1},
  {&__pyx_kp_s_Cannot_compute_primes_beyond_436, __pyx_k_Cannot_compute_primes_beyond_436, sizeof(__pyx_k_Cannot_compute_primes_beyond_436), 0, 0, 1, 0},
  {&__pyx_kp_s_Cannot_convert_None_to_pari, __pyx_k_Cannot_convert_None_to_pari, sizeof(__pyx_k_Cannot_convert_None_to_pari), 0, 0, 1, 0},
  {&__pyx_kp_u_Coerce_self_which_must_be_a_cla, __pyx_k_Coerce_self_which_must_be_a_cla, sizeof(__pyx_k_Coerce_self_which_must_be_a_cla), 0, 1, 0, 0},
  {&__pyx_kp_u_Creates_a_PARI_t_REAL_with_valu, __pyx_k_Creates_a_PARI_t_REAL_with_valu, sizeof(__pyx_k_Creates_a_PARI_t_REAL_with_valu), 0, 1, 0, 0},
  {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1},
  {&__pyx_n_s_DeprecationWarning, __pyx_k_DeprecationWarning, sizeof(__pyx_k_DeprecationWarning), 0, 0, 1, 1},
  {&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1},
  {&__pyx_kp_s_Error_raised_by_PARI, __pyx_k_Error_raised_by_PARI, sizeof(__pyx_k_Error_raised_by_PARI), 0, 0, 1, 0},
  {&__pyx_n_s_Euler, __pyx_k_Euler, sizeof(__pyx_k_Euler), 0, 0, 1, 1},
  {&__pyx_kp_s_Exception_class_for_critical_si, __pyx_k_Exception_class_for_critical_si, sizeof(__pyx_k_Exception_class_for_critical_si), 0, 0, 1, 0},
  {&__pyx_kp_s_Exception_class_for_func_alarm, __pyx_k_Exception_class_for_func_alarm, sizeof(__pyx_k_Exception_class_for_func_alarm), 0, 0, 1, 0},
  {&__pyx_n_s_F, __pyx_k_F, sizeof(__pyx_k_F), 0, 0, 1, 1},
  {&__pyx_n_s_FS, __pyx_k_FS, sizeof(__pyx_k_FS), 0, 0, 1, 1},
  {&__pyx_n_s_FloatingPointError, __pyx_k_FloatingPointError, sizeof(__pyx_k_FloatingPointError), 0, 0, 1, 1},
  {&__pyx_kp_s_Floating_point_exception, __pyx_k_Floating_point_exception, sizeof(__pyx_k_Floating_point_exception), 0, 0, 1, 0},
  {&__pyx_n_s_Fraction, __pyx_k_Fraction, sizeof(__pyx_k_Fraction), 0, 0, 1, 1},
  {&__pyx_n_s_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 0, 1, 1},
  {&__pyx_n_s_Gen, __pyx_k_Gen, sizeof(__pyx_k_Gen), 0, 0, 1, 1},
  {&__pyx_kp_u_Gen___index___line_1551, __pyx_k_Gen___index___line_1551, sizeof(__pyx_k_Gen___index___line_1551), 0, 1, 0, 0},
  {&__pyx_n_s_Gen_base, __pyx_k_Gen_base, sizeof(__pyx_k_Gen_base), 0, 0, 1, 1},
  {&__pyx_kp_s_Gen_must_be_of_PARI_type_t_INT, __pyx_k_Gen_must_be_of_PARI_type_t_INT, sizeof(__pyx_k_Gen_must_be_of_PARI_type_t_INT), 0, 0, 1, 0},
  {&__pyx_n_s_GeneratorType, __pyx_k_GeneratorType, sizeof(__pyx_k_GeneratorType), 0, 0, 1, 1},
  {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1},
  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
  {&__pyx_kp_s_Illegal_instruction, __pyx_k_Illegal_instruction, sizeof(__pyx_k_Illegal_instruction), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_kp_u_Initialize_cysignals_This_is_no, __pyx_k_Initialize_cysignals_This_is_no, sizeof(__pyx_k_Initialize_cysignals_This_is_no), 0, 1, 0, 0},
  {&__pyx_kp_s_Interface_to_the_PARI_C_library, __pyx_k_Interface_to_the_PARI_C_library, sizeof(__pyx_k_Interface_to_the_PARI_C_library), 0, 0, 1, 0},
  {&__pyx_n_s_KeyboardInterrupt, __pyx_k_KeyboardInterrupt, sizeof(__pyx_k_KeyboardInterrupt), 0, 0, 1, 1},
  {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
  {&__pyx_n_s_L1, __pyx_k_L1, sizeof(__pyx_k_L1), 0, 0, 1, 1},
  {&__pyx_n_s_L2, __pyx_k_L2, sizeof(__pyx_k_L2), 0, 0, 1, 1},
  {&__pyx_n_s_Lcosets, __pyx_k_Lcosets, sizeof(__pyx_k_Lcosets), 0, 0, 1, 1},
  {&__pyx_n_s_Ld, __pyx_k_Ld, sizeof(__pyx_k_Ld), 0, 0, 1, 1},
  {&__pyx_n_s_Lpr, __pyx_k_Lpr, sizeof(__pyx_k_Lpr), 0, 0, 1, 1},
  {&__pyx_n_s_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 0, 1, 1},
  {&__pyx_n_s_Mat, __pyx_k_Mat, sizeof(__pyx_k_Mat), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s_Mod, __pyx_k_Mod, sizeof(__pyx_k_Mod), 0, 0, 1, 1},
  {&__pyx_n_s_Mp, __pyx_k_Mp, sizeof(__pyx_k_Mp), 0, 0, 1, 1},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_n_s_NK, __pyx_k_NK, sizeof(__pyx_k_NK), 0, 0, 1, 1},
  {&__pyx_kp_s_Neither_a_str_nor_a_bytes_object, __pyx_k_Neither_a_str_nor_a_bytes_object, sizeof(__pyx_k_Neither_a_str_nor_a_bytes_object), 0, 0, 1, 0},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
  {&__pyx_kp_s_Not_an_INTMOD_or_POLMOD_in_mod, __pyx_k_Not_an_INTMOD_or_POLMOD_in_mod, sizeof(__pyx_k_Not_an_INTMOD_or_POLMOD_in_mod), 0, 0, 1, 0},
  {&__pyx_n_s_ORD, __pyx_k_ORD, sizeof(__pyx_k_ORD), 0, 0, 1, 1},
  {&__pyx_kp_s_Object_s_must_be_of_type_t_VECSM, __pyx_k_Object_s_must_be_of_type_t_VECSM, sizeof(__pyx_k_Object_s_must_be_of_type_t_VECSM), 0, 0, 1, 0},
  {&__pyx_kp_s_Object_s_must_be_of_type_t_VEC_o, __pyx_k_Object_s_must_be_of_type_t_VEC_o, sizeof(__pyx_k_Object_s_must_be_of_type_t_VEC_o), 0, 0, 1, 0},
  {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
  {&__pyx_n_s_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 0, 1, 1},
  {&__pyx_n_s_P0, __pyx_k_P0, sizeof(__pyx_k_P0), 0, 0, 1, 1},
  {&__pyx_kp_s_PARI_object_in_unused_part_of_PA, __pyx_k_PARI_object_in_unused_part_of_PA, sizeof(__pyx_k_PARI_object_in_unused_part_of_PA), 0, 0, 1, 0},
  {&__pyx_kp_u_PARI_object_of_type, __pyx_k_PARI_object_of_type, sizeof(__pyx_k_PARI_object_of_type), 0, 1, 0, 0},
  {&__pyx_kp_s_PARI_object_of_type_r_cannot_be, __pyx_k_PARI_object_of_type_r_cannot_be, sizeof(__pyx_k_PARI_object_of_type_r_cannot_be), 0, 0, 1, 0},
  {&__pyx_kp_s_PARI_objects_cannot_be_instantia, __pyx_k_PARI_objects_cannot_be_instantia, sizeof(__pyx_k_PARI_objects_cannot_be_instantia), 0, 0, 1, 0},
  {&__pyx_kp_s_PARI_stack_size_set_to_bytes_max, __pyx_k_PARI_stack_size_set_to_bytes_max, sizeof(__pyx_k_PARI_stack_size_set_to_bytes_max), 0, 0, 1, 0},
  {&__pyx_n_s_PHI, __pyx_k_PHI, sizeof(__pyx_k_PHI), 0, 0, 1, 1},
  {&__pyx_n_s_PQ, __pyx_k_PQ, sizeof(__pyx_k_PQ), 0, 0, 1, 1},
  {&__pyx_n_s_Pari, __pyx_k_Pari, sizeof(__pyx_k_Pari), 0, 0, 1, 1},
  {&__pyx_n_s_PariError, __pyx_k_PariError, sizeof(__pyx_k_PariError), 0, 0, 1, 1},
  {&__pyx_n_s_PariError___repr, __pyx_k_PariError___repr, sizeof(__pyx_k_PariError___repr), 0, 0, 1, 1},
  {&__pyx_n_s_PariError___str, __pyx_k_PariError___str, sizeof(__pyx_k_PariError___str), 0, 0, 1, 1},
  {&__pyx_kp_s_PariError_d, __pyx_k_PariError_d, sizeof(__pyx_k_PariError_d), 0, 0, 1, 0},
  {&__pyx_n_s_PariError_errdata, __pyx_k_PariError_errdata, sizeof(__pyx_k_PariError_errdata), 0, 0, 1, 1},
  {&__pyx_n_s_PariError_errnum, __pyx_k_PariError_errnum, sizeof(__pyx_k_PariError_errnum), 0, 0, 1, 1},
  {&__pyx_n_s_PariError_errtext, __pyx_k_PariError_errtext, sizeof(__pyx_k_PariError_errtext), 0, 0, 1, 1},
  {&__pyx_kp_u_Pari__real_coerced_to_bits_prec, __pyx_k_Pari__real_coerced_to_bits_prec, sizeof(__pyx_k_Pari__real_coerced_to_bits_prec), 0, 1, 0, 0},
  {&__pyx_n_s_Pari_auto, __pyx_k_Pari_auto, sizeof(__pyx_k_Pari_auto), 0, 0, 1, 1},
  {&__pyx_kp_u_Pari_set_default_bit_precision_l, __pyx_k_Pari_set_default_bit_precision_l, sizeof(__pyx_k_Pari_set_default_bit_precision_l), 0, 1, 0, 0},
  {&__pyx_n_s_Pi, __pyx_k_Pi, sizeof(__pyx_k_Pi), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_kp_u_Python_version_of_func_sig_rais, __pyx_k_Python_version_of_func_sig_rais, sizeof(__pyx_k_Python_version_of_func_sig_rais), 0, 1, 0, 0},
  {&__pyx_n_s_Q, __pyx_k_Q, sizeof(__pyx_k_Q), 0, 0, 1, 1},
  {&__pyx_n_s_RingElement, __pyx_k_RingElement, sizeof(__pyx_k_RingElement), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1},
  {&__pyx_n_s_SIGINT, __pyx_k_SIGINT, sizeof(__pyx_k_SIGINT), 0, 0, 1, 1},
  {&__pyx_n_s_SIGSEGV, __pyx_k_SIGSEGV, sizeof(__pyx_k_SIGSEGV), 0, 0, 1, 1},
  {&__pyx_kp_s_Segmentation_fault, __pyx_k_Segmentation_fault, sizeof(__pyx_k_Segmentation_fault), 0, 0, 1, 0},
  {&__pyx_kp_u_Set_the_default_bit_precision_f, __pyx_k_Set_the_default_bit_precision_f, sizeof(__pyx_k_Set_the_default_bit_precision_f), 0, 1, 0, 0},
  {&__pyx_n_s_SignalError, __pyx_k_SignalError, sizeof(__pyx_k_SignalError), 0, 0, 1, 1},
  {&__pyx_n_s_SystemError, __pyx_k_SystemError, sizeof(__pyx_k_SystemError), 0, 0, 1, 1},
  {&__pyx_n_s_SystemExit, __pyx_k_SystemExit, sizeof(__pyx_k_SystemExit), 0, 0, 1, 1},
  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
  {&__pyx_kp_u_Test_whether_critical_signals_c, __pyx_k_Test_whether_critical_signals_c, sizeof(__pyx_k_Test_whether_critical_signals_c), 0, 1, 0, 0},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__pyx_kp_s_Unknown_PARI_type_s, __pyx_k_Unknown_PARI_type_s, sizeof(__pyx_k_Unknown_PARI_type_s), 0, 0, 1, 0},
  {&__pyx_n_s_V, __pyx_k_V, sizeof(__pyx_k_V), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_Vec, __pyx_k_Vec, sizeof(__pyx_k_Vec), 0, 0, 1, 1},
  {&__pyx_n_s_Vecrev, __pyx_k_Vecrev, sizeof(__pyx_k_Vecrev), 0, 0, 1, 1},
  {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1},
  {&__pyx_n_s_XRangeType, __pyx_k_XRangeType, sizeof(__pyx_k_XRangeType), 0, 0, 1, 1},
  {&__pyx_n_s_Y, __pyx_k_Y, sizeof(__pyx_k_Y), 0, 0, 1, 1},
  {&__pyx_kp_s_You_can_use_pari_allocatemem_to, __pyx_k_You_can_use_pari_allocatemem_to, sizeof(__pyx_k_You_can_use_pari_allocatemem_to), 0, 0, 1, 0},
  {&__pyx_kp_s__46, __pyx_k__46, sizeof(__pyx_k__46), 0, 0, 1, 0},
  {&__pyx_kp_s__47, __pyx_k__47, sizeof(__pyx_k__47), 0, 0, 1, 0},
  {&__pyx_kp_s__83, __pyx_k__83, sizeof(__pyx_k__83), 0, 0, 1, 0},
  {&__pyx_kp_s__90, __pyx_k__90, sizeof(__pyx_k__90), 0, 0, 1, 0},
  {&__pyx_kp_s__91, __pyx_k__91, sizeof(__pyx_k__91), 0, 0, 1, 0},
  {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
  {&__pyx_n_s_ab, __pyx_k_ab, sizeof(__pyx_k_ab), 0, 0, 1, 1},
  {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
  {&__pyx_n_s_add_one, __pyx_k_add_one, sizeof(__pyx_k_add_one), 0, 0, 1, 1},
  {&__pyx_n_s_al, __pyx_k_al, sizeof(__pyx_k_al), 0, 0, 1, 1},
  {&__pyx_n_s_al1, __pyx_k_al1, sizeof(__pyx_k_al1), 0, 0, 1, 1},
  {&__pyx_n_s_al2, __pyx_k_al2, sizeof(__pyx_k_al2), 0, 0, 1, 1},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_arch, __pyx_k_arch, sizeof(__pyx_k_arch), 0, 0, 1, 1},
  {&__pyx_n_s_arg2, __pyx_k_arg2, sizeof(__pyx_k_arg2), 0, 0, 1, 1},
  {&__pyx_n_s_arg3, __pyx_k_arg3, sizeof(__pyx_k_arg3), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_kp_s_argument_2_of_the_PARI_GP_functi, __pyx_k_argument_2_of_the_PARI_GP_functi, sizeof(__pyx_k_argument_2_of_the_PARI_GP_functi), 0, 0, 1, 0},
  {&__pyx_kp_s_argument_2_of_the_PARI_GP_functi_2, __pyx_k_argument_2_of_the_PARI_GP_functi_2, sizeof(__pyx_k_argument_2_of_the_PARI_GP_functi_2), 0, 0, 1, 0},
  {&__pyx_kp_s_argument_3_of_the_PARI_GP_functi, __pyx_k_argument_3_of_the_PARI_GP_functi, sizeof(__pyx_k_argument_3_of_the_PARI_GP_functi), 0, 0, 1, 0},
  {&__pyx_kp_s_argument_3_of_the_PARI_GP_functi_2, __pyx_k_argument_3_of_the_PARI_GP_functi_2, sizeof(__pyx_k_argument_3_of_the_PARI_GP_functi_2), 0, 0, 1, 0},
  {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1},
  {&__pyx_n_s_asymp, __pyx_k_asymp, sizeof(__pyx_k_asymp), 0, 0, 1, 1},
  {&__pyx_kp_s_attempt_to_assign_sequence_of_si, __pyx_k_attempt_to_assign_sequence_of_si, sizeof(__pyx_k_attempt_to_assign_sequence_of_si), 0, 0, 1, 0},
  {&__pyx_n_s_aut, __pyx_k_aut, sizeof(__pyx_k_aut), 0, 0, 1, 1},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_bid, __pyx_k_bid, sizeof(__pyx_k_bid), 0, 0, 1, 1},
  {&__pyx_n_s_bij, __pyx_k_bij, sizeof(__pyx_k_bij), 0, 0, 1, 1},
  {&__pyx_n_s_bitprec, __pyx_k_bitprec, sizeof(__pyx_k_bitprec), 0, 0, 1, 1},
  {&__pyx_n_s_bits, __pyx_k_bits, sizeof(__pyx_k_bits), 0, 0, 1, 1},
  {&__pyx_n_s_bnf, __pyx_k_bnf, sizeof(__pyx_k_bnf), 0, 0, 1, 1},
  {&__pyx_n_s_bnfK, __pyx_k_bnfK, sizeof(__pyx_k_bnfK), 0, 0, 1, 1},
  {&__pyx_n_s_bnfL, __pyx_k_bnfL, sizeof(__pyx_k_bnfL), 0, 0, 1, 1},
  {&__pyx_n_s_bnr, __pyx_k_bnr, sizeof(__pyx_k_bnr), 0, 0, 1, 1},
  {&__pyx_n_s_bound, __pyx_k_bound, sizeof(__pyx_k_bound), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_s_c1, __pyx_k_c1, sizeof(__pyx_k_c1), 0, 0, 1, 1},
  {&__pyx_kp_s_calling_list_on_scalar_PARI_type, __pyx_k_calling_list_on_scalar_PARI_type, sizeof(__pyx_k_calling_list_on_scalar_PARI_type), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_coerce_0_r_type_1_to_inte, __pyx_k_cannot_coerce_0_r_type_1_to_inte, sizeof(__pyx_k_cannot_coerce_0_r_type_1_to_inte), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_double_stack_size, __pyx_k_cannot_double_stack_size, sizeof(__pyx_k_cannot_double_stack_size), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_evaluate_PARI_s_using_unn, __pyx_k_cannot_evaluate_PARI_s_using_unn, sizeof(__pyx_k_cannot_evaluate_PARI_s_using_unn), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_evaluate_a_PARI_closure_u, __pyx_k_cannot_evaluate_a_PARI_closure_u, sizeof(__pyx_k_cannot_evaluate_a_PARI_closure_u), 0, 0, 1, 0},
  {&__pyx_kp_s_cannot_index_PARI_type_s_by_tupl, __pyx_k_cannot_index_PARI_type_s_by_tupl, sizeof(__pyx_k_cannot_index_PARI_type_s_by_tupl), 0, 0, 1, 0},
  {&__pyx_n_s_catch_warnings, __pyx_k_catch_warnings, sizeof(__pyx_k_catch_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_centerlift, __pyx_k_centerlift, sizeof(__pyx_k_centerlift), 0, 0, 1, 1},
  {&__pyx_n_s_cert, __pyx_k_cert, sizeof(__pyx_k_cert), 0, 0, 1, 1},
  {&__pyx_n_s_chain, __pyx_k_chain, sizeof(__pyx_k_chain), 0, 0, 1, 1},
  {&__pyx_n_s_chi, __pyx_k_chi, sizeof(__pyx_k_chi), 0, 0, 1, 1},
  {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 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_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_cmpf, __pyx_k_cmpf, sizeof(__pyx_k_cmpf), 0, 0, 1, 1},
  {&__pyx_n_s_code, __pyx_k_code, sizeof(__pyx_k_code), 0, 0, 1, 1},
  {&__pyx_kp_s_column_index_out_of_range, __pyx_k_column_index_out_of_range, sizeof(__pyx_k_column_index_out_of_range), 0, 0, 1, 0},
  {&__pyx_kp_s_column_j_s_must_be_between_0_and, __pyx_k_column_j_s_must_be_between_0_and, sizeof(__pyx_k_column_j_s_must_be_between_0_and), 0, 0, 1, 0},
  {&__pyx_n_s_component, __pyx_k_component, sizeof(__pyx_k_component), 0, 0, 1, 1},
  {&__pyx_kp_u_conversion_not_implemented_for, __pyx_k_conversion_not_implemented_for, sizeof(__pyx_k_conversion_not_implemented_for), 0, 1, 0, 0},
  {&__pyx_n_s_cpu_width, __pyx_k_cpu_width, sizeof(__pyx_k_cpu_width), 0, 0, 1, 1},
  {&__pyx_n_s_cusp, __pyx_k_cusp, sizeof(__pyx_k_cusp), 0, 0, 1, 1},
  {&__pyx_n_s_cyc, __pyx_k_cyc, sizeof(__pyx_k_cyc), 0, 0, 1, 1},
  {&__pyx_n_s_cypari__pari, __pyx_k_cypari__pari, sizeof(__pyx_k_cypari__pari), 0, 0, 1, 1},
  {&__pyx_kp_s_cypari_handle_error_pyx, __pyx_k_cypari_handle_error_pyx, sizeof(__pyx_k_cypari_handle_error_pyx), 0, 0, 1, 0},
  {&__pyx_kp_s_cypari_pari_instance_pyx, __pyx_k_cypari_pari_instance_pyx, sizeof(__pyx_k_cypari_pari_instance_pyx), 0, 0, 1, 0},
  {&__pyx_kp_s_cypari_signals_pyx, __pyx_k_cypari_signals_pyx, sizeof(__pyx_k_cypari_signals_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_n_s_den, __pyx_k_den, sizeof(__pyx_k_den), 0, 0, 1, 1},
  {&__pyx_n_s_denominator, __pyx_k_denominator, sizeof(__pyx_k_denominator), 0, 0, 1, 1},
  {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1},
  {&__pyx_n_s_der, __pyx_k_der, sizeof(__pyx_k_der), 0, 0, 1, 1},
  {&__pyx_n_s_derivs, __pyx_k_derivs, sizeof(__pyx_k_derivs), 0, 0, 1, 1},
  {&__pyx_n_s_destw, __pyx_k_destw, sizeof(__pyx_k_destw), 0, 0, 1, 1},
  {&__pyx_n_s_detx, __pyx_k_detx, sizeof(__pyx_k_detx), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_dimlim, __pyx_k_dimlim, sizeof(__pyx_k_dimlim), 0, 0, 1, 1},
  {&__pyx_n_s_divz, __pyx_k_divz, sizeof(__pyx_k_divz), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
  {&__pyx_n_s_dy, __pyx_k_dy, sizeof(__pyx_k_dy), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_ellaplist, __pyx_k_ellaplist, sizeof(__pyx_k_ellaplist), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encoding, __pyx_k_encoding, sizeof(__pyx_k_encoding), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
  {&__pyx_n_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_eps, __pyx_k_eps, sizeof(__pyx_k_eps), 0, 0, 1, 1},
  {&__pyx_n_s_errdata, __pyx_k_errdata, sizeof(__pyx_k_errdata), 0, 0, 1, 1},
  {&__pyx_n_s_errnum, __pyx_k_errnum, sizeof(__pyx_k_errnum), 0, 0, 1, 1},
  {&__pyx_n_s_errtext, __pyx_k_errtext, sizeof(__pyx_k_errtext), 0, 0, 1, 1},
  {&__pyx_n_s_estimate, __pyx_k_estimate, sizeof(__pyx_k_estimate), 0, 0, 1, 1},
  {&__pyx_n_s_eta, __pyx_k_eta, sizeof(__pyx_k_eta), 0, 0, 1, 1},
  {&__pyx_n_s_euler, __pyx_k_euler, sizeof(__pyx_k_euler), 0, 0, 1, 1},
  {&__pyx_n_s_eval, __pyx_k_eval, sizeof(__pyx_k_eval), 0, 0, 1, 1},
  {&__pyx_kp_s_evaluating_PARI_s_takes_exactly, __pyx_k_evaluating_PARI_s_takes_exactly, sizeof(__pyx_k_evaluating_PARI_s_takes_exactly), 0, 0, 1, 0},
  {&__pyx_n_s_exc_info, __pyx_k_exc_info, sizeof(__pyx_k_exc_info), 0, 0, 1, 1},
  {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
  {&__pyx_n_s_expr, __pyx_k_expr, sizeof(__pyx_k_expr), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_fa, __pyx_k_fa, sizeof(__pyx_k_fa), 0, 0, 1, 1},
  {&__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_k_failed_to_allocate_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_bytes), 0, 0, 1, 0},
  {&__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_k_failed_to_allocate_s_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_s_bytes), 0, 0, 1, 0},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_n_s_filename, __pyx_k_filename, sizeof(__pyx_k_filename), 0, 0, 1, 1},
  {&__pyx_n_s_filled, __pyx_k_filled, sizeof(__pyx_k_filled), 0, 0, 1, 1},
  {&__pyx_n_s_find_root, __pyx_k_find_root, sizeof(__pyx_k_find_root), 0, 0, 1, 1},
  {&__pyx_n_s_fl, __pyx_k_fl, sizeof(__pyx_k_fl), 0, 0, 1, 1},
  {&__pyx_n_s_flag, __pyx_k_flag, sizeof(__pyx_k_flag), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_flreal, __pyx_k_flreal, sizeof(__pyx_k_flreal), 0, 0, 1, 1},
  {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
  {&__pyx_n_s_fmt, __pyx_k_fmt, sizeof(__pyx_k_fmt), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fractions, __pyx_k_fractions, sizeof(__pyx_k_fractions), 0, 0, 1, 1},
  {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1},
  {&__pyx_n_s_fs, __pyx_k_fs, sizeof(__pyx_k_fs), 0, 0, 1, 1},
  {&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1},
  {&__pyx_n_s_ga, __pyx_k_ga, sizeof(__pyx_k_ga), 0, 0, 1, 1},
  {&__pyx_n_s_gal, __pyx_k_gal, sizeof(__pyx_k_gal), 0, 0, 1, 1},
  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_get_real_precision, __pyx_k_get_real_precision, sizeof(__pyx_k_get_real_precision), 0, 0, 1, 1},
  {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
  {&__pyx_n_s_getitem___locals_genexpr, __pyx_k_getitem___locals_genexpr, sizeof(__pyx_k_getitem___locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_gpname, __pyx_k_gpname, sizeof(__pyx_k_gpname), 0, 0, 1, 1},
  {&__pyx_n_s_grp, __pyx_k_grp, sizeof(__pyx_k_grp), 0, 0, 1, 1},
  {&__pyx_n_s_gs, __pyx_k_gs, sizeof(__pyx_k_gs), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_ignore, __pyx_k_ignore, sizeof(__pyx_k_ignore), 0, 0, 1, 1},
  {&__pyx_n_s_im, __pyx_k_im, sizeof(__pyx_k_im), 0, 0, 1, 1},
  {&__pyx_n_s_imag, __pyx_k_imag, sizeof(__pyx_k_imag), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_kp_s_index_must_be_an_integer_or_a_2, __pyx_k_index_must_be_an_integer_or_a_2, sizeof(__pyx_k_index_must_be_an_integer_or_a_2), 0, 0, 1, 0},
  {&__pyx_kp_s_index_out_of_range, __pyx_k_index_out_of_range, sizeof(__pyx_k_index_out_of_range), 0, 0, 1, 0},
  {&__pyx_kp_s_index_s_must_be_between_0_and_s, __pyx_k_index_s_must_be_between_0_and_s, sizeof(__pyx_k_index_s_must_be_between_0_and_s), 0, 0, 1, 0},
  {&__pyx_n_s_indices, __pyx_k_indices, sizeof(__pyx_k_indices), 0, 0, 1, 1},
  {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1},
  {&__pyx_n_s_init_cysignals, __pyx_k_init_cysignals, sizeof(__pyx_k_init_cysignals), 0, 0, 1, 1},
  {&__pyx_kp_u_init_cysignals_line_172, __pyx_k_init_cysignals_line_172, sizeof(__pyx_k_init_cysignals_line_172), 0, 1, 0, 0},
  {&__pyx_n_s_init_primes, __pyx_k_init_primes, sizeof(__pyx_k_init_primes), 0, 0, 1, 1},
  {&__pyx_kp_u_integer_to_gen_needs_an_int_or_l, __pyx_k_integer_to_gen_needs_an_int_or_l, sizeof(__pyx_k_integer_to_gen_needs_an_int_or_l), 0, 1, 0, 0},
  {&__pyx_n_s_inv, __pyx_k_inv, sizeof(__pyx_k_inv), 0, 0, 1, 1},
  {&__pyx_kp_u_is_deprecated, __pyx_k_is_deprecated, sizeof(__pyx_k_is_deprecated), 0, 1, 0, 0},
  {&__pyx_kp_u_is_not_iterable, __pyx_k_is_not_iterable, sizeof(__pyx_k_is_not_iterable), 0, 1, 0, 0},
  {&__pyx_n_s_isd, __pyx_k_isd, sizeof(__pyx_k_isd), 0, 0, 1, 1},
  {&__pyx_n_s_iter___locals_genexpr, __pyx_k_iter___locals_genexpr, sizeof(__pyx_k_iter___locals_genexpr), 0, 0, 1, 1},
  {&__pyx_n_s_iterable_types, __pyx_k_iterable_types, sizeof(__pyx_k_iterable_types), 0, 0, 1, 1},
  {&__pyx_kp_u_iterating_a_PARI, __pyx_k_iterating_a_PARI, sizeof(__pyx_k_iterating_a_PARI), 0, 1, 0, 0},
  {&__pyx_n_s_ix, __pyx_k_ix, sizeof(__pyx_k_ix), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_key, __pyx_k_key, sizeof(__pyx_k_key), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_lat, __pyx_k_lat, sizeof(__pyx_k_lat), 0, 0, 1, 1},
  {&__pyx_n_s_lat1, __pyx_k_lat1, sizeof(__pyx_k_lat1), 0, 0, 1, 1},
  {&__pyx_n_s_lat2, __pyx_k_lat2, sizeof(__pyx_k_lat2), 0, 0, 1, 1},
  {&__pyx_kp_s_len_of_entries_s_must_be_s_s_s, __pyx_k_len_of_entries_s_must_be_s_s_s, sizeof(__pyx_k_len_of_entries_s_must_be_s_s_s), 0, 0, 1, 0},
  {&__pyx_kp_s_length_of_entries_s_must_equal_n, __pyx_k_length_of_entries_s_must_equal_n, sizeof(__pyx_k_length_of_entries_s_must_equal_n), 0, 0, 1, 0},
  {&__pyx_n_s_lib, __pyx_k_lib, sizeof(__pyx_k_lib), 0, 0, 1, 1},
  {&__pyx_n_s_lift_centered, __pyx_k_lift_centered, sizeof(__pyx_k_lift_centered), 0, 0, 1, 1},
  {&__pyx_n_s_lim, __pyx_k_lim, sizeof(__pyx_k_lim), 0, 0, 1, 1},
  {&__pyx_n_s_limit, __pyx_k_limit, sizeof(__pyx_k_limit), 0, 0, 1, 1},
  {&__pyx_n_s_list, __pyx_k_list, sizeof(__pyx_k_list), 0, 0, 1, 1},
  {&__pyx_n_s_listx, __pyx_k_listx, sizeof(__pyx_k_listx), 0, 0, 1, 1},
  {&__pyx_n_s_listy, __pyx_k_listy, sizeof(__pyx_k_listy), 0, 0, 1, 1},
  {&__pyx_n_s_lngamma, __pyx_k_lngamma, sizeof(__pyx_k_lngamma), 0, 0, 1, 1},
  {&__pyx_n_s_log_10, __pyx_k_log_10, sizeof(__pyx_k_log_10), 0, 0, 1, 1},
  {&__pyx_n_s_log_gamma, __pyx_k_log_gamma, sizeof(__pyx_k_log_gamma), 0, 0, 1, 1},
  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_major, __pyx_k_major, sizeof(__pyx_k_major), 0, 0, 1, 1},
  {&__pyx_n_s_maps, __pyx_k_maps, sizeof(__pyx_k_maps), 0, 0, 1, 1},
  {&__pyx_n_s_mat, __pyx_k_mat, sizeof(__pyx_k_mat), 0, 0, 1, 1},
  {&__pyx_kp_s_matrix_index_must_be_of_the_form, __pyx_k_matrix_index_must_be_of_the_form, sizeof(__pyx_k_matrix_index_must_be_of_the_form), 0, 0, 1, 0},
  {&__pyx_n_s_maxord, __pyx_k_maxord, sizeof(__pyx_k_maxord), 0, 0, 1, 1},
  {&__pyx_n_s_maxprime, __pyx_k_maxprime, sizeof(__pyx_k_maxprime), 0, 0, 1, 1},
  {&__pyx_n_s_maxsize, __pyx_k_maxsize, sizeof(__pyx_k_maxsize), 0, 0, 1, 1},
  {&__pyx_n_s_maxw, __pyx_k_maxw, sizeof(__pyx_k_maxw), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_mf, __pyx_k_mf, sizeof(__pyx_k_mf), 0, 0, 1, 1},
  {&__pyx_n_s_mfatk, __pyx_k_mfatk, sizeof(__pyx_k_mfatk), 0, 0, 1, 1},
  {&__pyx_kp_s_missing_required_argument_N, __pyx_k_missing_required_argument_N, sizeof(__pyx_k_missing_required_argument_N), 0, 0, 1, 0},
  {&__pyx_kp_s_missing_required_argument_bid, __pyx_k_missing_required_argument_bid, sizeof(__pyx_k_missing_required_argument_bid), 0, 0, 1, 0},
  {&__pyx_kp_s_missing_required_argument_x, __pyx_k_missing_required_argument_x, sizeof(__pyx_k_missing_required_argument_x), 0, 0, 1, 0},
  {&__pyx_kp_s_mixing_unnamed_and_keyword_argum, __pyx_k_mixing_unnamed_and_keyword_argum, sizeof(__pyx_k_mixing_unnamed_and_keyword_argum), 0, 0, 1, 0},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
  {&__pyx_n_s_mu, __pyx_k_mu, sizeof(__pyx_k_mu), 0, 0, 1, 1},
  {&__pyx_n_s_multiplicative_order, __pyx_k_multiplicative_order, sizeof(__pyx_k_multiplicative_order), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_n0, __pyx_k_n0, sizeof(__pyx_k_n0), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_ncols, __pyx_k_ncols, sizeof(__pyx_k_ncols), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_nf, __pyx_k_nf, sizeof(__pyx_k_nf), 0, 0, 1, 1},
  {&__pyx_n_s_nmax, __pyx_k_nmax, sizeof(__pyx_k_nmax), 0, 0, 1, 1},
  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
  {&__pyx_n_s_nrows, __pyx_k_nrows, sizeof(__pyx_k_nrows), 0, 0, 1, 1},
  {&__pyx_n_s_nu, __pyx_k_nu, sizeof(__pyx_k_nu), 0, 0, 1, 1},
  {&__pyx_n_s_numerator, __pyx_k_numerator, sizeof(__pyx_k_numerator), 0, 0, 1, 1},
  {&__pyx_n_s_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 0, 1, 1},
  {&__pyx_n_s_objtogen, __pyx_k_objtogen, sizeof(__pyx_k_objtogen), 0, 0, 1, 1},
  {&__pyx_n_s_old, __pyx_k_old, sizeof(__pyx_k_old), 0, 0, 1, 1},
  {&__pyx_n_s_only_image, __pyx_k_only_image, sizeof(__pyx_k_only_image), 0, 0, 1, 1},
  {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_pari, __pyx_k_pari, sizeof(__pyx_k_pari), 0, 0, 1, 1},
  {&__pyx_n_s_pari_2, __pyx_k_pari_2, sizeof(__pyx_k_pari_2), 0, 0, 1, 1},
  {&__pyx_kp_s_pari_double_to_gen_x_is_deprecat, __pyx_k_pari_double_to_gen_x_is_deprecat, sizeof(__pyx_k_pari_double_to_gen_x_is_deprecat), 0, 0, 1, 0},
  {&__pyx_n_s_pari_instance, __pyx_k_pari_instance, sizeof(__pyx_k_pari_instance), 0, 0, 1, 1},
  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  {&__pyx_n_s_perm, __pyx_k_perm, sizeof(__pyx_k_perm), 0, 0, 1, 1},
  {&__pyx_n_s_phi, __pyx_k_phi, sizeof(__pyx_k_phi), 0, 0, 1, 1},
  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_pl, __pyx_k_pl, sizeof(__pyx_k_pl), 0, 0, 1, 1},
  {&__pyx_n_s_pol, __pyx_k_pol, sizeof(__pyx_k_pol), 0, 0, 1, 1},
  {&__pyx_n_s_polcoeff, __pyx_k_polcoeff, sizeof(__pyx_k_polcoeff), 0, 0, 1, 1},
  {&__pyx_n_s_polred, __pyx_k_polred, sizeof(__pyx_k_polred), 0, 0, 1, 1},
  {&__pyx_n_s_polrel, __pyx_k_polrel, sizeof(__pyx_k_polrel), 0, 0, 1, 1},
  {&__pyx_n_s_pr, __pyx_k_pr, sizeof(__pyx_k_pr), 0, 0, 1, 1},
  {&__pyx_n_s_prec_bits_to_dec, __pyx_k_prec_bits_to_dec, sizeof(__pyx_k_prec_bits_to_dec), 0, 0, 1, 1},
  {&__pyx_n_s_prec_dec_to_bits, __pyx_k_prec_dec_to_bits, sizeof(__pyx_k_prec_dec_to_bits), 0, 0, 1, 1},
  {&__pyx_n_s_prec_dec_to_words, __pyx_k_prec_dec_to_words, sizeof(__pyx_k_prec_dec_to_words), 0, 0, 1, 1},
  {&__pyx_n_s_prec_in_bits, __pyx_k_prec_in_bits, sizeof(__pyx_k_prec_in_bits), 0, 0, 1, 1},
  {&__pyx_n_s_prec_in_dec, __pyx_k_prec_in_dec, sizeof(__pyx_k_prec_in_dec), 0, 0, 1, 1},
  {&__pyx_n_s_prec_in_words, __pyx_k_prec_in_words, sizeof(__pyx_k_prec_in_words), 0, 0, 1, 1},
  {&__pyx_n_s_prec_words_to_dec, __pyx_k_prec_words_to_dec, sizeof(__pyx_k_prec_words_to_dec), 0, 0, 1, 1},
  {&__pyx_n_s_precision, __pyx_k_precision, sizeof(__pyx_k_precision), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  {&__pyx_n_s_print_exception, __pyx_k_print_exception, sizeof(__pyx_k_print_exception), 0, 0, 1, 1},
  {&__pyx_n_s_projH, __pyx_k_projH, sizeof(__pyx_k_projH), 0, 0, 1, 1},
  {&__pyx_n_s_proof, __pyx_k_proof, sizeof(__pyx_k_proof), 0, 0, 1, 1},
  {&__pyx_n_s_psi, __pyx_k_psi, sizeof(__pyx_k_psi), 0, 0, 1, 1},
  {&__pyx_n_s_python_check_interrupt, __pyx_k_python_check_interrupt, sizeof(__pyx_k_python_check_interrupt), 0, 0, 1, 1},
  {&__pyx_n_s_python_ints, __pyx_k_python_ints, sizeof(__pyx_k_python_ints), 0, 0, 1, 1},
  {&__pyx_n_s_python_list, __pyx_k_python_list, sizeof(__pyx_k_python_list), 0, 0, 1, 1},
  {&__pyx_n_s_python_list_small, __pyx_k_python_list_small, sizeof(__pyx_k_python_list_small), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_capi, __pyx_k_pyx_capi, sizeof(__pyx_k_pyx_capi), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Pari_auto, __pyx_k_pyx_unpickle_Pari_auto, sizeof(__pyx_k_pyx_unpickle_Pari_auto), 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_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
  {&__pyx_n_s_qfa, __pyx_k_qfa, sizeof(__pyx_k_qfa), 0, 0, 1, 1},
  {&__pyx_n_s_qflllgram, __pyx_k_qflllgram, sizeof(__pyx_k_qflllgram), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 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_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
  {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1},
  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
  {&__pyx_n_s_rnf, __pyx_k_rnf, sizeof(__pyx_k_rnf), 0, 0, 1, 1},
  {&__pyx_n_s_rootT, __pyx_k_rootT, sizeof(__pyx_k_rootT), 0, 0, 1, 1},
  {&__pyx_kp_s_row_i_s_must_be_between_0_and_s, __pyx_k_row_i_s_must_be_between_0_and_s, sizeof(__pyx_k_row_i_s_must_be_between_0_and_s), 0, 0, 1, 0},
  {&__pyx_kp_s_row_index_out_of_range, __pyx_k_row_index_out_of_range, sizeof(__pyx_k_row_index_out_of_range), 0, 0, 1, 0},
  {&__pyx_n_s_rstrip, __pyx_k_rstrip, sizeof(__pyx_k_rstrip), 0, 0, 1, 1},
  {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1},
  {&__pyx_kp_s_s_is_not_a_square_modulo_s, __pyx_k_s_is_not_a_square_modulo_s, sizeof(__pyx_k_s_is_not_a_square_modulo_s), 0, 0, 1, 0},
  {&__pyx_n_s_sd, __pyx_k_sd, sizeof(__pyx_k_sd), 0, 0, 1, 1},
  {&__pyx_n_s_sdom, __pyx_k_sdom, sizeof(__pyx_k_sdom), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_kp_s_self_g_cannot_be_converted_to_a, __pyx_k_self_g_cannot_be_converted_to_a, sizeof(__pyx_k_self_g_cannot_be_converted_to_a), 0, 0, 1, 0},
  {&__pyx_kp_s_self_must_be_of_pari_type_t_MAT, __pyx_k_self_must_be_of_pari_type_t_MAT, sizeof(__pyx_k_self_must_be_of_pari_type_t_MAT), 0, 0, 1, 0},
  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
  {&__pyx_n_s_serprec, __pyx_k_serprec, sizeof(__pyx_k_serprec), 0, 0, 1, 1},
  {&__pyx_n_s_set_real_precision, __pyx_k_set_real_precision, sizeof(__pyx_k_set_real_precision), 0, 0, 1, 1},
  {&__pyx_n_s_set_real_precision_bits, __pyx_k_set_real_precision_bits, sizeof(__pyx_k_set_real_precision_bits), 0, 0, 1, 1},
  {&__pyx_kp_s_set_variable_only_works_for_poly, __pyx_k_set_variable_only_works_for_poly, sizeof(__pyx_k_set_variable_only_works_for_poly), 0, 0, 1, 0},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_sfu, __pyx_k_sfu, sizeof(__pyx_k_sfu), 0, 0, 1, 1},
  {&__pyx_n_s_sig, __pyx_k_sig, sizeof(__pyx_k_sig), 0, 0, 1, 1},
  {&__pyx_n_s_sig_on_reset, __pyx_k_sig_on_reset, sizeof(__pyx_k_sig_on_reset), 0, 0, 1, 1},
  {&__pyx_n_s_sig_print_exception, __pyx_k_sig_print_exception, sizeof(__pyx_k_sig_print_exception), 0, 0, 1, 1},
  {&__pyx_kp_u_sig_print_exception_line_117, __pyx_k_sig_print_exception_line_117, sizeof(__pyx_k_sig_print_exception_line_117), 0, 1, 0, 0},
  {&__pyx_n_s_sign, __pyx_k_sign, sizeof(__pyx_k_sign), 0, 0, 1, 1},
  {&__pyx_n_s_signal, __pyx_k_signal, sizeof(__pyx_k_signal), 0, 0, 1, 1},
  {&__pyx_n_s_silent, __pyx_k_silent, sizeof(__pyx_k_silent), 0, 0, 1, 1},
  {&__pyx_n_s_simplefilter, __pyx_k_simplefilter, sizeof(__pyx_k_simplefilter), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_sizemax, __pyx_k_sizemax, sizeof(__pyx_k_sizemax), 0, 0, 1, 1},
  {&__pyx_n_s_sol, __pyx_k_sol, sizeof(__pyx_k_sol), 0, 0, 1, 1},
  {&__pyx_n_s_sourcew, __pyx_k_sourcew, sizeof(__pyx_k_sourcew), 0, 0, 1, 1},
  {&__pyx_n_s_space, __pyx_k_space, sizeof(__pyx_k_space), 0, 0, 1, 1},
  {&__pyx_n_s_ss, __pyx_k_ss, sizeof(__pyx_k_ss), 0, 0, 1, 1},
  {&__pyx_n_s_stacksize, __pyx_k_stacksize, sizeof(__pyx_k_stacksize), 0, 0, 1, 1},
  {&__pyx_n_s_stacksizemax, __pyx_k_stacksizemax, sizeof(__pyx_k_stacksizemax), 0, 0, 1, 1},
  {&__pyx_n_s_stdout, __pyx_k_stdout, sizeof(__pyx_k_stdout), 0, 0, 1, 1},
  {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1},
  {&__pyx_n_s_str_2, __pyx_k_str_2, sizeof(__pyx_k_str_2), 0, 0, 1, 1},
  {&__pyx_kp_u_str_returned, __pyx_k_str_returned, sizeof(__pyx_k_str_returned), 0, 1, 0, 0},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_subgp, __pyx_k_subgp, sizeof(__pyx_k_subgp), 0, 0, 1, 1},
  {&__pyx_n_s_subgroup, __pyx_k_subgroup, sizeof(__pyx_k_subgroup), 0, 0, 1, 1},
  {&__pyx_n_s_subgrp, __pyx_k_subgrp, sizeof(__pyx_k_subgrp), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_sym, __pyx_k_sym, sizeof(__pyx_k_sym), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_t_CLOSURE, __pyx_k_t_CLOSURE, sizeof(__pyx_k_t_CLOSURE), 0, 0, 1, 1},
  {&__pyx_n_s_t_COL, __pyx_k_t_COL, sizeof(__pyx_k_t_COL), 0, 0, 1, 1},
  {&__pyx_n_s_t_COMPLEX, __pyx_k_t_COMPLEX, sizeof(__pyx_k_t_COMPLEX), 0, 0, 1, 1},
  {&__pyx_n_s_t_FFELT, __pyx_k_t_FFELT, sizeof(__pyx_k_t_FFELT), 0, 0, 1, 1},
  {&__pyx_n_s_t_FRAC, __pyx_k_t_FRAC, sizeof(__pyx_k_t_FRAC), 0, 0, 1, 1},
  {&__pyx_n_s_t_INFINITY, __pyx_k_t_INFINITY, sizeof(__pyx_k_t_INFINITY), 0, 0, 1, 1},
  {&__pyx_n_s_t_INT, __pyx_k_t_INT, sizeof(__pyx_k_t_INT), 0, 0, 1, 1},
  {&__pyx_n_s_t_INTMOD, __pyx_k_t_INTMOD, sizeof(__pyx_k_t_INTMOD), 0, 0, 1, 1},
  {&__pyx_n_s_t_LIST, __pyx_k_t_LIST, sizeof(__pyx_k_t_LIST), 0, 0, 1, 1},
  {&__pyx_n_s_t_MAT, __pyx_k_t_MAT, sizeof(__pyx_k_t_MAT), 0, 0, 1, 1},
  {&__pyx_n_s_t_PADIC, __pyx_k_t_PADIC, sizeof(__pyx_k_t_PADIC), 0, 0, 1, 1},
  {&__pyx_n_s_t_POL, __pyx_k_t_POL, sizeof(__pyx_k_t_POL), 0, 0, 1, 1},
  {&__pyx_n_s_t_POLMOD, __pyx_k_t_POLMOD, sizeof(__pyx_k_t_POLMOD), 0, 0, 1, 1},
  {&__pyx_n_s_t_QFI, __pyx_k_t_QFI, sizeof(__pyx_k_t_QFI), 0, 0, 1, 1},
  {&__pyx_n_s_t_QFR, __pyx_k_t_QFR, sizeof(__pyx_k_t_QFR), 0, 0, 1, 1},
  {&__pyx_n_s_t_QUAD, __pyx_k_t_QUAD, sizeof(__pyx_k_t_QUAD), 0, 0, 1, 1},
  {&__pyx_n_s_t_REAL, __pyx_k_t_REAL, sizeof(__pyx_k_t_REAL), 0, 0, 1, 1},
  {&__pyx_n_s_t_RFRAC, __pyx_k_t_RFRAC, sizeof(__pyx_k_t_RFRAC), 0, 0, 1, 1},
  {&__pyx_n_s_t_SER, __pyx_k_t_SER, sizeof(__pyx_k_t_SER), 0, 0, 1, 1},
  {&__pyx_n_s_t_STR, __pyx_k_t_STR, sizeof(__pyx_k_t_STR), 0, 0, 1, 1},
  {&__pyx_n_s_t_VEC, __pyx_k_t_VEC, sizeof(__pyx_k_t_VEC), 0, 0, 1, 1},
  {&__pyx_n_s_t_VECSMALL, __pyx_k_t_VECSMALL, sizeof(__pyx_k_t_VECSMALL), 0, 0, 1, 1},
  {&__pyx_n_s_tab, __pyx_k_tab, sizeof(__pyx_k_tab), 0, 0, 1, 1},
  {&__pyx_n_s_tau, __pyx_k_tau, sizeof(__pyx_k_tau), 0, 0, 1, 1},
  {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
  {&__pyx_n_s_tdom, __pyx_k_tdom, sizeof(__pyx_k_tdom), 0, 0, 1, 1},
  {&__pyx_n_s_tech, __pyx_k_tech, sizeof(__pyx_k_tech), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_test_signal, __pyx_k_test_signal, sizeof(__pyx_k_test_signal), 0, 0, 1, 1},
  {&__pyx_kp_u_test_signal_line_232, __pyx_k_test_signal_line_232, sizeof(__pyx_k_test_signal_line_232), 0, 1, 0, 0},
  {&__pyx_kp_s_the_PARI_GP_function_bernvec_is, __pyx_k_the_PARI_GP_function_bernvec_is, sizeof(__pyx_k_the_PARI_GP_function_bernvec_is), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_bernvec_is_2, __pyx_k_the_PARI_GP_function_bernvec_is_2, sizeof(__pyx_k_the_PARI_GP_function_bernvec_is_2), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_bezout_is_o, __pyx_k_the_PARI_GP_function_bezout_is_o, sizeof(__pyx_k_the_PARI_GP_function_bezout_is_o), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_bezoutres_i, __pyx_k_the_PARI_GP_function_bezoutres_i, sizeof(__pyx_k_the_PARI_GP_function_bezoutres_i), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_bnrconducto, __pyx_k_the_PARI_GP_function_bnrconducto, sizeof(__pyx_k_the_PARI_GP_function_bnrconducto), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_ellbil_is_o, __pyx_k_the_PARI_GP_function_ellbil_is_o, sizeof(__pyx_k_the_PARI_GP_function_ellbil_is_o), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_elllseries, __pyx_k_the_PARI_GP_function_elllseries, sizeof(__pyx_k_the_PARI_GP_function_elllseries), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_ellpow_is_o, __pyx_k_the_PARI_GP_function_ellpow_is_o, sizeof(__pyx_k_the_PARI_GP_function_ellpow_is_o), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_factorcanto, __pyx_k_the_PARI_GP_function_factorcanto, sizeof(__pyx_k_the_PARI_GP_function_factorcanto), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_factorff_is, __pyx_k_the_PARI_GP_function_factorff_is, sizeof(__pyx_k_the_PARI_GP_function_factorff_is), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_factornf_is, __pyx_k_the_PARI_GP_function_factornf_is, sizeof(__pyx_k_the_PARI_GP_function_factornf_is), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_listkill_is, __pyx_k_the_PARI_GP_function_listkill_is, sizeof(__pyx_k_the_PARI_GP_function_listkill_is), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_matalgtobas, __pyx_k_the_PARI_GP_function_matalgtobas, sizeof(__pyx_k_the_PARI_GP_function_matalgtobas), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_matbasistoa, __pyx_k_the_PARI_GP_function_matbasistoa, sizeof(__pyx_k_the_PARI_GP_function_matbasistoa), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_nfeltdivmod, __pyx_k_the_PARI_GP_function_nfeltdivmod, sizeof(__pyx_k_the_PARI_GP_function_nfeltdivmod), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_nfeltmulmod, __pyx_k_the_PARI_GP_function_nfeltmulmod, sizeof(__pyx_k_the_PARI_GP_function_nfeltmulmod), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_nfeltpowmod, __pyx_k_the_PARI_GP_function_nfeltpowmod, sizeof(__pyx_k_the_PARI_GP_function_nfeltpowmod), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_nfeltreduce, __pyx_k_the_PARI_GP_function_nfeltreduce, sizeof(__pyx_k_the_PARI_GP_function_nfeltreduce), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_nffactormod, __pyx_k_the_PARI_GP_function_nffactormod, sizeof(__pyx_k_the_PARI_GP_function_nffactormod), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_nfkermodpr, __pyx_k_the_PARI_GP_function_nfkermodpr, sizeof(__pyx_k_the_PARI_GP_function_nfkermodpr), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_nfsolvemodp, __pyx_k_the_PARI_GP_function_nfsolvemodp, sizeof(__pyx_k_the_PARI_GP_function_nfsolvemodp), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_plotlinetyp, __pyx_k_the_PARI_GP_function_plotlinetyp, sizeof(__pyx_k_the_PARI_GP_function_plotlinetyp), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_plotpointsi, __pyx_k_the_PARI_GP_function_plotpointsi, sizeof(__pyx_k_the_PARI_GP_function_plotpointsi), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_plotpointty, __pyx_k_the_PARI_GP_function_plotpointty, sizeof(__pyx_k_the_PARI_GP_function_plotpointty), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_polcoeff_is, __pyx_k_the_PARI_GP_function_polcoeff_is, sizeof(__pyx_k_the_PARI_GP_function_polcoeff_is), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_polred_is_o, __pyx_k_the_PARI_GP_function_polred_is_o, sizeof(__pyx_k_the_PARI_GP_function_polred_is_o), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_polredord_i, __pyx_k_the_PARI_GP_function_polredord_i, sizeof(__pyx_k_the_PARI_GP_function_polredord_i), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_polrootsff, __pyx_k_the_PARI_GP_function_polrootsff, sizeof(__pyx_k_the_PARI_GP_function_polrootsff), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_poltchebi_i, __pyx_k_the_PARI_GP_function_poltchebi_i, sizeof(__pyx_k_the_PARI_GP_function_poltchebi_i), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_psdraw_is_o, __pyx_k_the_PARI_GP_function_psdraw_is_o, sizeof(__pyx_k_the_PARI_GP_function_psdraw_is_o), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_psplothraw, __pyx_k_the_PARI_GP_function_psplothraw, sizeof(__pyx_k_the_PARI_GP_function_psplothraw), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_qfbil_is_ob, __pyx_k_the_PARI_GP_function_qfbil_is_ob, sizeof(__pyx_k_the_PARI_GP_function_qfbil_is_ob), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_qfnorm_is_o, __pyx_k_the_PARI_GP_function_qfnorm_is_o, sizeof(__pyx_k_the_PARI_GP_function_qfnorm_is_o), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_rnfpolred_i, __pyx_k_the_PARI_GP_function_rnfpolred_i, sizeof(__pyx_k_the_PARI_GP_function_rnfpolred_i), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_GP_function_sizedigit_i, __pyx_k_the_PARI_GP_function_sizedigit_i, sizeof(__pyx_k_the_PARI_GP_function_sizedigit_i), 0, 0, 1, 0},
  {&__pyx_kp_s_the_PARI_stack_overflows_current, __pyx_k_the_PARI_stack_overflows_current, sizeof(__pyx_k_the_PARI_stack_overflows_current), 0, 0, 1, 0},
  {&__pyx_kp_s_the_flag_argument_of_the_PARI_GP, __pyx_k_the_flag_argument_of_the_PARI_GP, sizeof(__pyx_k_the_flag_argument_of_the_PARI_GP), 0, 0, 1, 0},
  {&__pyx_kp_s_the_maximum_size_should_be_at_le, __pyx_k_the_maximum_size_should_be_at_le, sizeof(__pyx_k_the_maximum_size_should_be_at_le), 0, 0, 1, 0},
  {&__pyx_kp_s_the_method_allocatemem_should_no, __pyx_k_the_method_allocatemem_should_no, sizeof(__pyx_k_the_method_allocatemem_should_no), 0, 0, 1, 0},
  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
  {&__pyx_n_s_tnf, __pyx_k_tnf, sizeof(__pyx_k_tnf), 0, 0, 1, 1},
  {&__pyx_n_s_tors, __pyx_k_tors, sizeof(__pyx_k_tors), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_typ, __pyx_k_typ, sizeof(__pyx_k_typ), 0, 0, 1, 1},
  {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
  {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1},
  {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
  {&__pyx_kp_s_unknown_signal_number_s, __pyx_k_unknown_signal_number_s, sizeof(__pyx_k_unknown_signal_number_s), 0, 0, 1, 0},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_vF, __pyx_k_vF, sizeof(__pyx_k_vF), 0, 0, 1, 1},
  {&__pyx_n_s_val, __pyx_k_val, sizeof(__pyx_k_val), 0, 0, 1, 1},
  {&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1},
  {&__pyx_n_s_variable, __pyx_k_variable, sizeof(__pyx_k_variable), 0, 0, 1, 1},
  {&__pyx_n_s_vdir, __pyx_k_vdir, sizeof(__pyx_k_vdir), 0, 0, 1, 1},
  {&__pyx_n_s_vecextract, __pyx_k_vecextract, sizeof(__pyx_k_vecextract), 0, 0, 1, 1},
  {&__pyx_n_s_vecn, __pyx_k_vecn, sizeof(__pyx_k_vecn), 0, 0, 1, 1},
  {&__pyx_n_s_vector, __pyx_k_vector, sizeof(__pyx_k_vector), 0, 0, 1, 1},
  {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
  {&__pyx_n_s_vtau, __pyx_k_vtau, sizeof(__pyx_k_vtau), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
  {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_x0, __pyx_k_x0, sizeof(__pyx_k_x0), 0, 0, 1, 1},
  {&__pyx_n_s_x1, __pyx_k_x1, sizeof(__pyx_k_x1), 0, 0, 1, 1},
  {&__pyx_n_s_x2, __pyx_k_x2, sizeof(__pyx_k_x2), 0, 0, 1, 1},
  {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_y1, __pyx_k_y1, sizeof(__pyx_k_y1), 0, 0, 1, 1},
  {&__pyx_n_s_y2, __pyx_k_y2, sizeof(__pyx_k_y2), 0, 0, 1, 1},
  {&__pyx_n_s_ya, __pyx_k_ya, sizeof(__pyx_k_ya), 0, 0, 1, 1},
  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
  {&__pyx_n_s_z1, __pyx_k_z1, sizeof(__pyx_k_z1), 0, 0, 1, 1},
  {&__pyx_n_s_z2, __pyx_k_z2, sizeof(__pyx_k_z2), 0, 0, 1, 1},
  {&__pyx_n_s_znorder, __pyx_k_znorder, sizeof(__pyx_k_znorder), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_KeyboardInterrupt = __Pyx_GetBuiltinName(__pyx_n_s_KeyboardInterrupt); if (!__pyx_builtin_KeyboardInterrupt) __PYX_ERR(0, 38, __pyx_L1_error)
  __pyx_builtin_BaseException = __Pyx_GetBuiltinName(__pyx_n_s_BaseException); if (!__pyx_builtin_BaseException) __PYX_ERR(0, 61, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 32, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 91, __pyx_L1_error)
  __pyx_builtin_SystemExit = __Pyx_GetBuiltinName(__pyx_n_s_SystemExit); if (!__pyx_builtin_SystemExit) __PYX_ERR(0, 92, __pyx_L1_error)
  __pyx_builtin_FloatingPointError = __Pyx_GetBuiltinName(__pyx_n_s_FloatingPointError); if (!__pyx_builtin_FloatingPointError) __PYX_ERR(0, 100, __pyx_L1_error)
  __pyx_builtin_SystemError = __Pyx_GetBuiltinName(__pyx_n_s_SystemError); if (!__pyx_builtin_SystemError) __PYX_ERR(0, 114, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 161, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(3, 307, __pyx_L1_error)
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_n_s_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(3, 314, __pyx_L1_error)
  __pyx_builtin_DeprecationWarning = __Pyx_GetBuiltinName(__pyx_n_s_DeprecationWarning); if (!__pyx_builtin_DeprecationWarning) __PYX_ERR(4, 2981, __pyx_L1_error)
  __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(3, 1121, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(3, 1357, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(3, 1359, __pyx_L1_error)
  __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(5, 625, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(6, 380, __pyx_L1_error)
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(6, 623, __pyx_L1_error)
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(6, 1066, __pyx_L1_error)
  #else
  __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(6, 1066, __pyx_L1_error)
  #endif
  __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(6, 1121, __pyx_L1_error)
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(6, 4588, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(12, 92, __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);

  /* "cypari/_pari.pyx":91
 *         return x.decode('ascii')
 *     else:
 *         raise ValueError('Neither a str nor a bytes object.')             # <<<<<<<<<<<<<<
 * 
 * cpu_width = '64bit' if sys.maxsize > 2**32 else '32bit'
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Neither_a_str_nor_a_bytes_object); if (unlikely(!__pyx_tuple_)) __PYX_ERR(2, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "cypari/auto_instance.pxi":2981
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bernvec is obsolete (2007-03-30)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _ret = bernvec(x)
 */
  __pyx_tuple__2 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bernvec_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(4, 2981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "cypari/auto_instance.pxi":3262
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_tuple__3 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bezout_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(4, 3262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "cypari/auto_instance.pxi":3276
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         A = objtogen(A)
 *         B = objtogen(B)
 */
  __pyx_tuple__4 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bezoutres_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(4, 3276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "cypari/auto_instance.pxi":4349
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         bnr = objtogen(bnr)
 *         chi = objtogen(chi)
 */
  __pyx_tuple__5 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bnrconducto, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(4, 4349, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "cypari/auto_instance.pxi":6574
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         E = objtogen(E)
 *         z1 = objtogen(z1)
 */
  __pyx_tuple__6 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_ellbil_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(4, 6574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "cypari/auto_instance.pxi":7798
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         E = objtogen(E)
 *         s = objtogen(s)
 */
  __pyx_tuple__7 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_elllseries, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(4, 7798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "cypari/auto_instance.pxi":8797
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         E = objtogen(E)
 *         z = objtogen(z)
 */
  __pyx_tuple__8 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_ellpow_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(4, 8797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "cypari/auto_instance.pxi":9983
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         p = objtogen(p)
 */
  __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_factorcanto, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(4, 9983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "cypari/auto_instance.pxi":9997
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_tuple__10 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_factorff_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(4, 9997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "cypari/auto_instance.pxi":10311
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         t = objtogen(t)
 */
  __pyx_tuple__11 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_factornf_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(4, 10311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "cypari/auto_instance.pxi":12983
 *             nf = objtogen(nf)
 *         if x is None:
 *             raise TypeError("missing required argument: 'x'")             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         if bid is None:
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_missing_required_argument_x); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(4, 12983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "cypari/auto_instance.pxi":12986
 *         x = objtogen(x)
 *         if bid is None:
 *             raise TypeError("missing required argument: 'bid'")             # <<<<<<<<<<<<<<
 *         bid = objtogen(bid)
 *         sig_on()
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_missing_required_argument_bid); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(4, 12986, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "cypari/auto_instance.pxi":13408
 *             nf = objtogen(nf)
 *         if N is None:
 *             raise TypeError("missing required argument: 'N'")             # <<<<<<<<<<<<<<
 *         N = objtogen(N)
 *         sig_on()
 */
  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_missing_required_argument_N); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(4, 13408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);

  /* "cypari/auto_instance.pxi":15637
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         L = objtogen(L)
 *         sig_on()
 */
  __pyx_tuple__15 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_listkill_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(4, 15637, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "cypari/auto_instance.pxi":16081
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_tuple__16 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_matalgtobas, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(4, 16081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "cypari/auto_instance.pxi":16099
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_tuple__17 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_matbasistoa, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(4, 16099, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "cypari/auto_instance.pxi":21516
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_tuple__18 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltdivmod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(4, 21516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "cypari/auto_instance.pxi":21638
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_tuple__19 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltmulmod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(4, 21638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "cypari/auto_instance.pxi":21687
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_tuple__20 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltpowmod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(4, 21687, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "cypari/auto_instance.pxi":21726
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_tuple__21 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltreduce, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(4, 21726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "cypari/auto_instance.pxi":21908
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         Q = objtogen(Q)
 */
  __pyx_tuple__22 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nffactormod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(4, 21908, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "cypari/auto_instance.pxi":22474
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         x = objtogen(x)
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfkermodpr, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(4, 22474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "cypari/auto_instance.pxi":22759
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         a = objtogen(a)
 */
  __pyx_tuple__24 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfsolvemodp, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(4, 22759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "cypari/auto_instance.pxi":23587
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function plotlinetype is obsolete (2007-05-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         plotlinetype(w, type)
 */
  __pyx_tuple__25 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_plotlinetyp, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(4, 23587, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "cypari/auto_instance.pxi":23643
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function plotpointsize is obsolete (2007-05-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         size = objtogen(size)
 *         sig_on()
 */
  __pyx_tuple__26 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_plotpointsi, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(4, 23643, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "cypari/auto_instance.pxi":23659
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function plotpointtype is obsolete (2007-05-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         plotpointtype(w, type)
 */
  __pyx_tuple__27 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_plotpointty, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(4, 23659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "cypari/auto_instance.pxi":23957
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef long _v = -1
 */
  __pyx_tuple__28 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polcoeff_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(4, 23957, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "cypari/auto_instance.pxi":24551
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         if _arg3 is not None:
 *             from warnings import warn
 */
  __pyx_tuple__29 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polred_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(4, 24551, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "cypari/auto_instance.pxi":24554
 *         if _arg3 is not None:
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         cdef bint _have__arg3 = (_arg3 is not None)
 */
  __pyx_tuple__30 = PyTuple_Pack(2, __pyx_kp_s_argument_3_of_the_PARI_GP_functi, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(4, 24554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "cypari/auto_instance.pxi":24726
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_tuple__31 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polredord_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(4, 24726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "cypari/auto_instance.pxi":24879
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_p = (p is not None)
 */
  __pyx_tuple__32 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polrootsff, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(4, 24879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "cypari/auto_instance.pxi":25058
 *         if _arg3 is not None:
 *             from warnings import warn
 *             warn('argument 3 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         T = objtogen(T)
 *         cdef bint _have_ab = (ab is not None)
 */
  __pyx_tuple__33 = PyTuple_Pack(2, __pyx_kp_s_argument_3_of_the_PARI_GP_functi_2, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(4, 25058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "cypari/auto_instance.pxi":25130
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function poltchebi is obsolete (2013-04-03)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_tuple__34 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_poltchebi_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(4, 25130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "cypari/auto_instance.pxi":25594
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         list = objtogen(list)
 *         sig_on()
 */
  __pyx_tuple__35 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_psdraw_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(4, 25594, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "cypari/auto_instance.pxi":25618
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         listx = objtogen(listx)
 *         listy = objtogen(listy)
 */
  __pyx_tuple__36 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_psplothraw, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(4, 25618, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "cypari/auto_instance.pxi":25790
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_tuple__37 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_qfbil_is_ob, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(4, 25790, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "cypari/auto_instance.pxi":26434
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         cdef bint _have_q = (q is not None)
 */
  __pyx_tuple__38 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_qfnorm_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(4, 26434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "cypari/auto_instance.pxi":28181
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         nf = objtogen(nf)
 *         pol = objtogen(pol)
 */
  __pyx_tuple__39 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_rnfpolred_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(4, 28181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "cypari/auto_instance.pxi":28935
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_tuple__40 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_sizedigit_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(4, 28935, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "cypari/pari_instance.pyx":892
 *         # Deprecated in https://trac.sagemath.org/ticket/20241
 *         from warnings import warn
 *         warn("pari.double_to_gen(x) is deprecated, use pari(x) instead", DeprecationWarning)             # <<<<<<<<<<<<<<
 *         return new_gen_from_double(x)
 * 
 */
  __pyx_tuple__41 = PyTuple_Pack(2, __pyx_kp_s_pari_double_to_gen_x_is_deprecat, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(3, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);

  /* "cypari/pari_instance.pyx":1121
 *             s = pari_mainstack.size * 2
 *             if s < pari_mainstack.size:
 *                 raise OverflowError("cannot double stack size")             # <<<<<<<<<<<<<<
 *         elif s < 1024:
 *             s = 1024  # arbitrary minimum size
 */
  __pyx_tuple__42 = PyTuple_Pack(1, __pyx_kp_s_cannot_double_stack_size); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(3, 1121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "cypari/pari_instance.pyx":1161
 *         # Hardcoded bound in PARI sources
 *         if M > 436273290:
 *             raise ValueError("Cannot compute primes beyond 436273290")             # <<<<<<<<<<<<<<
 * 
 *         if M <= maxprime():
 */
  __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_s_Cannot_compute_primes_beyond_436); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(3, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(8, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "cypari/auto_gen.pxi":3016
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezout is obsolete (2013-04-03)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         sig_on()
 */
  __pyx_tuple__48 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bezout_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(10, 3016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "cypari/auto_gen.pxi":3029
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bezoutres is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         B = objtogen(B)
 *         cdef long _v = -1
 */
  __pyx_tuple__49 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bezoutres_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(10, 3029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "cypari/auto_gen.pxi":4071
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function bnrconductorofchar is obsolete (2015-11-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         chi = objtogen(chi)
 *         sig_on()
 */
  __pyx_tuple__50 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bnrconducto, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(10, 4071, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "cypari/auto_gen.pxi":6210
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellbil is obsolete (2014-05-21)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         z1 = objtogen(z1)
 *         z2 = objtogen(z2)
 */
  __pyx_tuple__51 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_ellbil_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(10, 6210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "cypari/auto_gen.pxi":7400
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function elllseries is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         s = objtogen(s)
 *         cdef bint _have_A = (A is not None)
 */
  __pyx_tuple__52 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_elllseries, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(10, 7400, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "cypari/auto_gen.pxi":8319
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function ellpow is obsolete (2012-06-06)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         z = objtogen(z)
 *         n = objtogen(n)
 */
  __pyx_tuple__53 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_ellpow_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(10, 8319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "cypari/auto_gen.pxi":9454
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorcantor is obsolete (2018-02-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         p = objtogen(p)
 *         sig_on()
 */
  __pyx_tuple__54 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_factorcanto, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(10, 9454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "cypari/auto_gen.pxi":9467
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factorff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_tuple__55 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_factorff_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(10, 9467, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "cypari/auto_gen.pxi":9766
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function factornf is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         t = objtogen(t)
 *         sig_on()
 */
  __pyx_tuple__56 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_factornf_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(10, 9766, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "cypari/auto_gen.pxi":14263
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function listkill is obsolete (2007-08-10)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _L = (<Gen>L).g
 */
  __pyx_tuple__57 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_listkill_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(10, 14263, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "cypari/auto_gen.pxi":14568
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matalgtobasis is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_tuple__58 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_matalgtobas, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(10, 14568, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);

  /* "cypari/auto_gen.pxi":14585
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function matbasistoalg is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         sig_on()
 */
  __pyx_tuple__59 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_matbasistoa, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(10, 14585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "cypari/auto_gen.pxi":19714
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltdivmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_tuple__60 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltdivmod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(10, 19714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "cypari/auto_gen.pxi":19831
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltmulmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         y = objtogen(y)
 */
  __pyx_tuple__61 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltmulmod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(10, 19831, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);

  /* "cypari/auto_gen.pxi":19877
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltpowmodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         k = objtogen(k)
 */
  __pyx_tuple__62 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltpowmod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(10, 19877, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "cypari/auto_gen.pxi":19914
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfeltreducemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_tuple__63 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfeltreduce, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(10, 19914, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "cypari/auto_gen.pxi":20091
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nffactormod is obsolete (2016-09-18)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         Q = objtogen(Q)
 *         pr = objtogen(pr)
 */
  __pyx_tuple__64 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nffactormod, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(10, 20091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);

  /* "cypari/auto_gen.pxi":20645
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfkermodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         x = objtogen(x)
 *         pr = objtogen(pr)
 */
  __pyx_tuple__65 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfkermodpr, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(10, 20645, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "cypari/auto_gen.pxi":20915
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function nfsolvemodpr is obsolete (2016-08-09)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         a = objtogen(a)
 *         b = objtogen(b)
 */
  __pyx_tuple__66 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_nfsolvemodp, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(10, 20915, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "cypari/auto_gen.pxi":21567
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polcoeff is obsolete (2018-05-14)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef long _v = -1
 *         if v is not None:
 */
  __pyx_tuple__67 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polcoeff_is, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(10, 21567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);

  /* "cypari/auto_gen.pxi":22041
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polred is obsolete (2013-03-27)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         if _arg2 is not None:
 *             from warnings import warn
 */
  __pyx_tuple__68 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polred_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(10, 22041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "cypari/auto_gen.pxi":22044
 *         if _arg2 is not None:
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polred is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have__arg2 = (_arg2 is not None)
 *         if _have__arg2:
 */
  __pyx_tuple__69 = PyTuple_Pack(2, __pyx_kp_s_argument_2_of_the_PARI_GP_functi, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(10, 22044, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);

  /* "cypari/auto_gen.pxi":22213
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polredord is obsolete (2008-07-20)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_tuple__70 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polredord_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(10, 22213, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);

  /* "cypari/auto_gen.pxi":22361
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function polrootsff is obsolete (2018-03-11)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_p = (p is not None)
 *         if _have_p:
 */
  __pyx_tuple__71 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_polrootsff, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(10, 22361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "cypari/auto_gen.pxi":22536
 *         if _arg2 is not None:
 *             from warnings import warn
 *             warn('argument 2 of the PARI/GP function polsturm is undocumented and deprecated', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_ab = (ab is not None)
 *         if _have_ab:
 */
  __pyx_tuple__72 = PyTuple_Pack(2, __pyx_kp_s_argument_2_of_the_PARI_GP_functi_2, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(10, 22536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);

  /* "cypari/auto_gen.pxi":22942
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psdraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _list = (<Gen>list).g
 */
  __pyx_tuple__73 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_psdraw_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(10, 22942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);

  /* "cypari/auto_gen.pxi":22964
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function psplothraw is obsolete (2018-02-01)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         listy = objtogen(listy)
 *         sig_on()
 */
  __pyx_tuple__74 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_psplothraw, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(10, 22964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);

  /* "cypari/auto_gen.pxi":23130
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfbil is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         y = objtogen(y)
 *         cdef bint _have_q = (q is not None)
 */
  __pyx_tuple__75 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_qfbil_is_ob, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(10, 23130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "cypari/auto_gen.pxi":23752
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function qfnorm is obsolete (2016-08-08)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         cdef bint _have_q = (q is not None)
 *         if _have_q:
 */
  __pyx_tuple__76 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_qfnorm_is_o, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(10, 23752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);

  /* "cypari/auto_gen.pxi":25345
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function rnfpolred is obsolete (2013-12-28)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         pol = objtogen(pol)
 *         sig_on()
 */
  __pyx_tuple__77 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_rnfpolred_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(10, 25345, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);

  /* "cypari/auto_gen.pxi":26057
 *         '''
 *         from warnings import warn
 *         warn('the PARI/GP function sizedigit is obsolete (2015-01-13)', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         cdef GEN _x = (<Gen>x).g
 */
  __pyx_tuple__78 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_sizedigit_i, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(10, 26057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 */
  __pyx_tuple__79 = PyTuple_Pack(1, __pyx_kp_s_self_g_cannot_be_converted_to_a); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(8, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);

  /* "(tree fragment)":4
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("self.g cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__80 = PyTuple_Pack(1, __pyx_kp_s_self_g_cannot_be_converted_to_a); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(8, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);

  /* "cypari/gen.pyx":99
 *     """
 *     def __init__(self):
 *         raise RuntimeError("PARI objects cannot be instantiated directly; use pari(x) to convert x to PARI")             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_tuple__81 = PyTuple_Pack(1, __pyx_kp_s_PARI_objects_cannot_be_instantia); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(6, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);

  /* "cypari/gen.pyx":341
 *             # Deprecated, make this an error in the future
 *             from warnings import warn
 *             warn("calling list() on scalar PARI types is deprecated", DeprecationWarning)             # <<<<<<<<<<<<<<
 *             return [self]
 *         return [x for x in self]
 */
  __pyx_tuple__82 = PyTuple_Pack(2, __pyx_kp_s_calling_list_on_scalar_PARI_type, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(6, 341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);

  /* "cypari/gen.pyx":602
 *         """
 *         if typ(self.g) != t_INTMOD and typ(self.g) != t_POLMOD:
 *             raise TypeError("Not an INTMOD or POLMOD in mod()")             # <<<<<<<<<<<<<<
 *         sig_on()
 *         # The hardcoded 1 below refers to the position in the internal
 */
  __pyx_tuple__84 = PyTuple_Pack(1, __pyx_kp_s_Not_an_INTMOD_or_POLMOD_in_mod); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(6, 602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);

  /* "cypari/gen.pyx":621
 *         '''
 *         import warnings
 *         with warnings.catch_warnings():             # <<<<<<<<<<<<<<
 *             warnings.simplefilter("ignore")
 *             return super(Gen, self).polred(*args, **kwds)
 */
  __pyx_tuple__85 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(6, 621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);

  /* "cypari/gen.pyx":1036
 *         if isinstance(n, tuple):
 *             if pari_type != t_MAT:
 *                 raise TypeError("self must be of pari type t_MAT")             # <<<<<<<<<<<<<<
 *             if len(n) != 2:
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")
 */
  __pyx_tuple__86 = PyTuple_Pack(1, __pyx_kp_s_self_must_be_of_pari_type_t_MAT); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(6, 1036, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__86);
  __Pyx_GIVEREF(__pyx_tuple__86);

  /* "cypari/gen.pyx":1038
 *                 raise TypeError("self must be of pari type t_MAT")
 *             if len(n) != 2:
 *                 raise IndexError("index must be an integer or a 2-tuple (i,j)")             # <<<<<<<<<<<<<<
 *             i = int(n[0])
 *             j = int(n[1])
 */
  __pyx_tuple__87 = PyTuple_Pack(1, __pyx_kp_s_index_must_be_an_integer_or_a_2); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(6, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "cypari/gen.pyx":1043
 * 
 *             if i < 0 or i >= glength(<GEN>(self.g[1])):
 *                 raise IndexError("row index out of range")             # <<<<<<<<<<<<<<
 *             if j < 0 or j >= glength(self.g):
 *                 raise IndexError("column index out of range")
 */
  __pyx_tuple__88 = PyTuple_Pack(1, __pyx_kp_s_row_index_out_of_range); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(6, 1043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__88);
  __Pyx_GIVEREF(__pyx_tuple__88);

  /* "cypari/gen.pyx":1045
 *                 raise IndexError("row index out of range")
 *             if j < 0 or j >= glength(self.g):
 *                 raise IndexError("column index out of range")             # <<<<<<<<<<<<<<
 * 
 *             ind = (i,j)
 */
  __pyx_tuple__89 = PyTuple_Pack(1, __pyx_kp_s_column_index_out_of_range); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(6, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);

  /* "cypari/gen.pyx":1087
 *             bound = valp(self.g) + lg(self.g) - 2
 *             if n >= bound:
 *                 raise IndexError("index out of range")             # <<<<<<<<<<<<<<
 *             return self.polcoeff(n)
 * 
 */
  __pyx_tuple__92 = PyTuple_Pack(1, __pyx_kp_s_index_out_of_range); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(6, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__92);
  __Pyx_GIVEREF(__pyx_tuple__92);

  /* "cypari/gen.pyx":1242
 * 
 *                 if len(n) != 2:
 *                     raise ValueError("matrix index must be of the form [row, column]")             # <<<<<<<<<<<<<<
 * 
 *                 i = n[0]
 */
  __pyx_tuple__93 = PyTuple_Pack(1, __pyx_kp_s_matrix_index_must_be_of_the_form); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(6, 1242, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);

  /* "cypari/gen.pyx":1491
 *         x = self.g
 *         if typ(x) != t_INT:
 *             raise TypeError("Gen must be of PARI type t_INT")             # <<<<<<<<<<<<<<
 *         if not signe(x):
 *             return "0"
 */
  __pyx_tuple__94 = PyTuple_Pack(1, __pyx_kp_s_Gen_must_be_of_PARI_type_t_INT); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(6, 1491, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);

  /* "cypari/gen.pyx":1951
 *             if n == 0:
 *                 sig_off()
 *                 return False, None             # <<<<<<<<<<<<<<
 *             else:
 *                 return k, new_gen(x)
 */
  __pyx_tuple__95 = PyTuple_Pack(2, Py_False, Py_None); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(6, 1951, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);

  /* "cypari/gen.pyx":3801
 *         if t == t_CLOSURE:
 *             if nkwds > 0:
 *                 raise TypeError("cannot evaluate a PARI closure using keyword arguments")             # <<<<<<<<<<<<<<
 *             if closure_is_variadic(self.g):
 *                 arity = closure_arity(self.g) - 1
 */
  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_kp_s_cannot_evaluate_a_PARI_closure_u); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(6, 3801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "cypari/gen.pyx":3817
 *         if nargs > 0:
 *             if nkwds > 0:
 *                 raise TypeError("mixing unnamed and keyword arguments not allowed when evaluating a PARI object")             # <<<<<<<<<<<<<<
 *             if not (t == t_POL or t == t_RFRAC or t == t_SER):
 *                 raise TypeError("cannot evaluate PARI %s using unnamed arguments" % self.type())
 */
  __pyx_tuple__97 = PyTuple_Pack(1, __pyx_kp_s_mixing_unnamed_and_keyword_argum); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(6, 3817, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "cypari/gen.pyx":4041
 *             # this deprecated flag
 *             from warnings import warn
 *             warn("the 'flag' argument of the PARI/GP function matkerint is obsolete", DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(matkerint0(self.g, flag))
 */
  __pyx_tuple__98 = PyTuple_Pack(2, __pyx_kp_s_the_flag_argument_of_the_PARI_GP, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(6, 4041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);

  /* "cypari/gen.pyx":4174
 *             return self
 *         if typ(self.g) != t_POL and typ(self.g) != t_SER:
 *             raise TypeError("set_variable() only works for polynomials or power series")             # <<<<<<<<<<<<<<
 *         # Copy self and then change the variable in place
 *         cdef Gen newg = new_gen_noclear(self.g)
 */
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_kp_s_set_variable_only_works_for_poly); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(6, 4174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "cypari/gen.pyx":4409
 *         """
 *         from warnings import warn
 *         warn('the PARI/GP function bernvec() is obsolete: use repeated calls to bernfrac() instead', DeprecationWarning)             # <<<<<<<<<<<<<<
 *         sig_on()
 *         return new_gen(bernvec(x))
 */
  __pyx_tuple__100 = PyTuple_Pack(2, __pyx_kp_s_the_PARI_GP_function_bernvec_is_2, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(6, 4409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);

  /* "cypari/gen.pyx":4424
 *             NotImplementedError: the method allocatemem() should not be used; use pari.allocatemem() instead
 *         """
 *         raise NotImplementedError("the method allocatemem() should not be used; use pari.allocatemem() instead")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__101 = PyTuple_Pack(1, __pyx_kp_s_the_method_allocatemem_should_no); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(6, 4424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__101);
  __Pyx_GIVEREF(__pyx_tuple__101);

  /* "cypari/gen.pyx":4626
 * 
 *     if s is None:
 *         raise ValueError("Cannot convert None to pari")             # <<<<<<<<<<<<<<
 * 
 *     # Simply use the string representation
 */
  __pyx_tuple__102 = PyTuple_Pack(1, __pyx_kp_s_Cannot_convert_None_to_pari); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(6, 4626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);

  /* "paridecl.pxd":5190
 *         return s < pari_mainstack.top
 *     if pari_mainstack.vbot <= s:
 *         raise SystemError("PARI object in unused part of PARI stack")             # <<<<<<<<<<<<<<
 *     return 0
 */
  __pyx_tuple__103 = PyTuple_Pack(1, __pyx_kp_s_PARI_object_in_unused_part_of_PA); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(11, 5190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);

  /* "cypari/signals.pyx":38
 * 
 * 
 * class AlarmInterrupt(KeyboardInterrupt):             # <<<<<<<<<<<<<<
 *     """
 *     Exception class for :func:`alarm` timeouts.
 */
  __pyx_tuple__104 = PyTuple_Pack(1, __pyx_builtin_KeyboardInterrupt); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "cypari/signals.pyx":61
 *     pass
 * 
 * class SignalError(BaseException):             # <<<<<<<<<<<<<<
 *     """
 *     Exception class for critical signals such as ``SIGSEGV``. Inherits
 */
  __pyx_tuple__105 = PyTuple_Pack(1, __pyx_builtin_BaseException); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);

  /* "cypari/signals.pyx":117
 * 
 * 
 * def sig_print_exception(sig, msg=None):             # <<<<<<<<<<<<<<
 *     """
 *     Python version of :func:`sig_raise_exception` which prints the
 */
  __pyx_tuple__106 = PyTuple_Pack(9, __pyx_n_s_sig, __pyx_n_s_msg, __pyx_n_s_m, __pyx_n_s_e, __pyx_n_s_sys, __pyx_n_s_traceback, __pyx_n_s_typ, __pyx_n_s_val, __pyx_n_s_tb); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__106);
  __Pyx_GIVEREF(__pyx_tuple__106);
  __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_signals_pyx, __pyx_n_s_sig_print_exception, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 117, __pyx_L1_error)

  /* "cypari/signals.pyx":172
 * cdef cysigs_t cysigs
 * 
 * def init_cysignals():             # <<<<<<<<<<<<<<
 *     """
 *     Initialize ``cysignals``.
 */
  __pyx_tuple__108 = PyTuple_Pack(2, __pyx_n_s_signal, __pyx_n_s_old); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__108);
  __Pyx_GIVEREF(__pyx_tuple__108);
  __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_signals_pyx, __pyx_n_s_init_cysignals, 172, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 172, __pyx_L1_error)

  /* "cypari/signals.pyx":204
 *     return old
 * 
 * def sig_on_reset():             # <<<<<<<<<<<<<<
 *     """
 *     Return the current value of ``cysigs.sig_on_count`` and set its
 */
  __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_s); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__110);
  __Pyx_GIVEREF(__pyx_tuple__110);
  __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_signals_pyx, __pyx_n_s_sig_on_reset, 204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 204, __pyx_L1_error)

  /* "cypari/signals.pyx":224
 * 
 * 
 * def python_check_interrupt(sig, frame):             # <<<<<<<<<<<<<<
 *     """
 *     Python-level interrupt handler for interrupts raised in Python
 */
  __pyx_tuple__112 = PyTuple_Pack(2, __pyx_n_s_sig, __pyx_n_s_frame); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__112);
  __Pyx_GIVEREF(__pyx_tuple__112);
  __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_signals_pyx, __pyx_n_s_python_check_interrupt, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 224, __pyx_L1_error)

  /* "cypari/signals.pyx":232
 *     sig_check()
 * 
 * def test_signal(int sig):             # <<<<<<<<<<<<<<
 *     """
 *     Test whether critical signals can be handled within a sig_on-sig_off
 */
  __pyx_tuple__114 = PyTuple_Pack(3, __pyx_n_s_sig, __pyx_n_s_sig, __pyx_n_s_signal); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);
  __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_signals_pyx, __pyx_n_s_test_signal, 232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 232, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":327
 * #################################################################
 * 
 * def prec_bits_to_dec(long prec_in_bits):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in bits to precision expressed in
 */
  __pyx_tuple__116 = PyTuple_Pack(2, __pyx_n_s_prec_in_bits, __pyx_n_s_prec_in_bits); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(3, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);
  __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_pari_instance_pyx, __pyx_n_s_prec_bits_to_dec, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(3, 327, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":342
 *     return <long>nbits2ndec(prec_in_bits)
 * 
 * def prec_dec_to_bits(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */
  __pyx_tuple__118 = PyTuple_Pack(3, __pyx_n_s_prec_in_dec, __pyx_n_s_prec_in_dec, __pyx_n_s_log_10); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(3, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);
  __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_pari_instance_pyx, __pyx_n_s_prec_dec_to_bits, 342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(3, 342, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":422
 *     return (old_prec - 2) * BITS_IN_LONG
 * 
 * def prec_dec_to_words(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */
  __pyx_tuple__120 = PyTuple_Pack(2, __pyx_n_s_prec_in_dec, __pyx_n_s_prec_in_dec); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(3, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_pari_instance_pyx, __pyx_n_s_prec_dec_to_words, 422, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(3, 422, __pyx_L1_error)

  /* "cypari/pari_instance.pyx":440
 *     return prec_bits_to_words(prec_dec_to_bits(prec_in_dec))
 * 
 * def prec_words_to_dec(long prec_in_words):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in words to precision expressed in
 */
  __pyx_tuple__122 = PyTuple_Pack(2, __pyx_n_s_prec_in_words, __pyx_n_s_prec_in_words); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(3, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_pari_instance_pyx, __pyx_n_s_prec_words_to_dec, 440, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(3, 440, __pyx_L1_error)

  /* "cypari/handle_error.pyx":32
 * # We derive PariError from RuntimeError, for backward compatibility with
 * # code that catches the latter.
 * class PariError(RuntimeError):             # <<<<<<<<<<<<<<
 *     """
 *     Error raised by PARI
 */
  __pyx_tuple__124 = PyTuple_Pack(1, __pyx_builtin_RuntimeError); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);

  /* "cypari/handle_error.pyx":36
 *     Error raised by PARI
 *     """
 *     def errnum(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the PARI error number corresponding to this exception.
 */
  __pyx_tuple__125 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__125)) __PYX_ERR(1, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__125);
  __Pyx_GIVEREF(__pyx_tuple__125);
  __pyx_codeobj__126 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__125, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_handle_error_pyx, __pyx_n_s_errnum, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__126)) __PYX_ERR(1, 36, __pyx_L1_error)

  /* "cypari/handle_error.pyx":50
 *         return self.args[0]
 * 
 *     def errtext(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the message output by PARI when this error occurred.
 */
  __pyx_tuple__127 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__127)) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__127);
  __Pyx_GIVEREF(__pyx_tuple__127);
  __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__127, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_handle_error_pyx, __pyx_n_s_errtext, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(1, 50, __pyx_L1_error)

  /* "cypari/handle_error.pyx":65
 *         return String(self.args[1])
 * 
 *     def errdata(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the error data (a ``t_ERROR`` gen) corresponding to this
 */
  __pyx_tuple__129 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(1, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__129);
  __Pyx_GIVEREF(__pyx_tuple__129);
  __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_handle_error_pyx, __pyx_n_s_errdata, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(1, 65, __pyx_L1_error)

  /* "cypari/handle_error.pyx":84
 *         return self.args[2]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         TESTS::
 */
  __pyx_tuple__131 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(1, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_handle_error_pyx, __pyx_n_s_repr, 84, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(1, 84, __pyx_L1_error)

  /* "cypari/handle_error.pyx":93
 *         return "PariError(%d)"%self.errnum()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return a suitable message for displaying this exception.
 */
  __pyx_tuple__133 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(1, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);
  __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_cypari_handle_error_pyx, __pyx_n_s_str_2, 93, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(1, 93, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_Pari_auto(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__135 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__135);
  __Pyx_GIVEREF(__pyx_tuple__135);
  __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Pari_auto, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(2, 1, __pyx_L1_error);
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_int_53 = PyInt_FromLong(53); if (unlikely(!__pyx_int_53)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_int_4294967296 = PyInt_FromString((char *)"4294967296", 0, 0); if (unlikely(!__pyx_int_4294967296)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(2, 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_v_6cypari_5_pari_pari_instance = ((struct __pyx_obj_6cypari_5_pari_Pari *)Py_None); Py_INCREF(Py_None);
  __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 ---*/
  if (__Pyx_ExportVoidPtr(__pyx_n_s_pari_instance, (void *)&__pyx_v_6cypari_5_pari_pari_instance, "struct __pyx_obj_6cypari_5_pari_Pari *") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("objtogen", (void (*)(void))__pyx_f_6cypari_5_pari_objtogen, "struct __pyx_obj_6cypari_5_pari_Gen *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("new_gen_from_double", (void (*)(void))__pyx_f_6cypari_5_pari_new_gen_from_double, "struct __pyx_obj_6cypari_5_pari_Gen *(double)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("new_t_POL_from_int_star", (void (*)(void))__pyx_f_6cypari_5_pari_new_t_POL_from_int_star, "struct __pyx_obj_6cypari_5_pari_Gen *(int *, unsigned long, long)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("prec_bits_to_words", (void (*)(void))__pyx_f_6cypari_5_pari_prec_bits_to_words, "long (unsigned long, int __pyx_skip_dispatch)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("prec_words_to_bits", (void (*)(void))__pyx_f_6cypari_5_pari_prec_words_to_bits, "long (long, int __pyx_skip_dispatch)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("default_bitprec", (void (*)(void))__pyx_f_6cypari_5_pari_default_bitprec, "long (int __pyx_skip_dispatch, struct __pyx_opt_args_6cypari_5_pari_default_bitprec *__pyx_optional_args)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("get_var", (void (*)(void))__pyx_f_6cypari_5_pari_get_var, "long (PyObject *)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("deepcopy_to_python_heap", (void (*)(void))__pyx_f_6cypari_5_pari_deepcopy_to_python_heap, "GEN (GEN, pari_sp *)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("new_gen", (void (*)(void))__pyx_f_6cypari_5_pari_new_gen, "struct __pyx_obj_6cypari_5_pari_Gen *(GEN)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("new_gen_noclear", (void (*)(void))__pyx_f_6cypari_5_pari_new_gen_noclear, "struct __pyx_obj_6cypari_5_pari_Gen *(GEN)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("clear_stack", (void (*)(void))__pyx_f_6cypari_5_pari_clear_stack, "void (void)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("_pari_init_error_handling", (void (*)(void))__pyx_f_6cypari_5_pari__pari_init_error_handling, "void (void)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("_pari_err_handle", (void (*)(void))__pyx_f_6cypari_5_pari__pari_err_handle, "int (GEN)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (__Pyx_ExportFunction("_pari_err_recover", (void (*)(void))__pyx_f_6cypari_5_pari__pari_err_recover, "void (long)") < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_6cypari_5_pari_RingElement) < 0) __PYX_ERR(13, 6, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari_RingElement.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari_RingElement.tp_dictoffset && __pyx_type_6cypari_5_pari_RingElement.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari_RingElement.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_RingElement, (PyObject *)&__pyx_type_6cypari_5_pari_RingElement) < 0) __PYX_ERR(13, 6, __pyx_L1_error)
  __pyx_ptype_6cypari_5_pari_RingElement = &__pyx_type_6cypari_5_pari_RingElement;
  __pyx_type_6cypari_5_pari_Gen_base.tp_base = __pyx_ptype_6cypari_5_pari_RingElement;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari_Gen_base) < 0) __PYX_ERR(10, 3, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari_Gen_base.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari_Gen_base.tp_dictoffset && __pyx_type_6cypari_5_pari_Gen_base.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari_Gen_base.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Gen_base, (PyObject *)&__pyx_type_6cypari_5_pari_Gen_base) < 0) __PYX_ERR(10, 3, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6cypari_5_pari_Gen_base) < 0) __PYX_ERR(10, 3, __pyx_L1_error)
  __pyx_ptype_6cypari_5_pari_Gen_base = &__pyx_type_6cypari_5_pari_Gen_base;
  __pyx_type_6cypari_5_pari_Gen.tp_base = __pyx_ptype_6cypari_5_pari_Gen_base;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari_Gen) < 0) __PYX_ERR(6, 94, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari_Gen.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari_Gen.tp_dictoffset && __pyx_type_6cypari_5_pari_Gen.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari_Gen.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_4__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_4__repr__.doc = __pyx_doc_6cypari_5_pari_3Gen_4__repr__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_4__repr__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__str__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_6__str__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_6__str__.doc = __pyx_doc_6cypari_5_pari_3Gen_6__str__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_6__str__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__hash__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_8__hash__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_8__hash__.doc = __pyx_doc_6cypari_5_pari_3Gen_8__hash__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_8__hash__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__iter__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_10__iter__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_10__iter__.doc = __pyx_doc_6cypari_5_pari_3Gen_10__iter__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_10__iter__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__add__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_16__add__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_16__add__.doc = __pyx_doc_6cypari_5_pari_3Gen_16__add__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_16__add__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__sub__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_18__sub__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_18__sub__.doc = __pyx_doc_6cypari_5_pari_3Gen_18__sub__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_18__sub__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__mod__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_28__mod__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_28__mod__.doc = __pyx_doc_6cypari_5_pari_3Gen_28__mod__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_28__mod__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__pow__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_30__pow__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_30__pow__.doc = __pyx_doc_6cypari_5_pari_3Gen_30__pow__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_30__pow__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__rshift__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_34__rshift__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_34__rshift__.doc = __pyx_doc_6cypari_5_pari_3Gen_34__rshift__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_34__rshift__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__lshift__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_36__lshift__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_36__lshift__.doc = __pyx_doc_6cypari_5_pari_3Gen_36__lshift__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_36__lshift__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_76__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_76__getitem__.doc = __pyx_doc_6cypari_5_pari_3Gen_76__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_76__getitem__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__setitem__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_78__setitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_78__setitem__.doc = __pyx_doc_6cypari_5_pari_3Gen_78__setitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_78__setitem__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__cmp__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_84__cmp__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_84__cmp__.doc = __pyx_doc_6cypari_5_pari_3Gen_84__cmp__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_84__cmp__;
    }
  }
  #endif
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__hex__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_90__hex__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_90__hex__.doc = __pyx_doc_6cypari_5_pari_3Gen_90__hex__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_90__hex__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__int__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_92__int__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_92__int__.doc = __pyx_doc_6cypari_5_pari_3Gen_92__int__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_92__int__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__index__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_94__index__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_94__index__.doc = __pyx_doc_6cypari_5_pari_3Gen_94__index__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_94__index__;
    }
  }
  #endif
  #if PY_MAJOR_VERSION < 3
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__long__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_102__long__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_102__long__.doc = __pyx_doc_6cypari_5_pari_3Gen_102__long__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_102__long__;
    }
  }
  #endif
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__float__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_104__float__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_104__float__.doc = __pyx_doc_6cypari_5_pari_3Gen_104__float__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_104__float__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Gen, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(6, 94, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_3Gen_230__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_3Gen_230__call__.doc = __pyx_doc_6cypari_5_pari_3Gen_230__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_3Gen_230__call__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Gen, (PyObject *)&__pyx_type_6cypari_5_pari_Gen) < 0) __PYX_ERR(6, 94, __pyx_L1_error)
  __pyx_ptype_6cypari_5_pari_Gen = &__pyx_type_6cypari_5_pari_Gen;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari_Pari_auto) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari_Pari_auto.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari_Pari_auto.tp_dictoffset && __pyx_type_6cypari_5_pari_Pari_auto.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari_Pari_auto.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Pari_auto, (PyObject *)&__pyx_type_6cypari_5_pari_Pari_auto) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6cypari_5_pari_Pari_auto) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __pyx_ptype_6cypari_5_pari_Pari_auto = &__pyx_type_6cypari_5_pari_Pari_auto;
  __pyx_vtabptr_6cypari_5_pari_Pari = &__pyx_vtable_6cypari_5_pari_Pari;
  __pyx_vtable_6cypari_5_pari_Pari.zero = (struct __pyx_obj_6cypari_5_pari_Gen *(*)(struct __pyx_obj_6cypari_5_pari_Pari *, int __pyx_skip_dispatch))__pyx_f_6cypari_5_pari_4Pari_zero;
  __pyx_vtable_6cypari_5_pari_Pari.one = (struct __pyx_obj_6cypari_5_pari_Gen *(*)(struct __pyx_obj_6cypari_5_pari_Pari *, int __pyx_skip_dispatch))__pyx_f_6cypari_5_pari_4Pari_one;
  __pyx_vtable_6cypari_5_pari_Pari._empty_vector = (struct __pyx_obj_6cypari_5_pari_Gen *(*)(struct __pyx_obj_6cypari_5_pari_Pari *, long))__pyx_f_6cypari_5_pari_4Pari__empty_vector;
  __pyx_vtable_6cypari_5_pari_Pari._real_coerced_to_bits_prec = (PyObject *(*)(struct __pyx_obj_6cypari_5_pari_Pari *, double, long, int __pyx_skip_dispatch))__pyx_f_6cypari_5_pari_4Pari__real_coerced_to_bits_prec;
  __pyx_type_6cypari_5_pari_Pari.tp_base = __pyx_ptype_6cypari_5_pari_Pari_auto;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari_Pari) < 0) __PYX_ERR(3, 488, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari_Pari.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari_Pari.tp_dictoffset && __pyx_type_6cypari_5_pari_Pari.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari_Pari.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Pari, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(3, 488, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_4Pari_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_4Pari_2__init__.doc = __pyx_doc_6cypari_5_pari_4Pari_2__init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_4Pari_2__init__;
    }
  }
  #endif
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6cypari_5_pari_Pari, "__call__"); if (unlikely(!wrapper)) __PYX_ERR(3, 488, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_6cypari_5_pari_4Pari_42__call__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_6cypari_5_pari_4Pari_42__call__.doc = __pyx_doc_6cypari_5_pari_4Pari_42__call__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6cypari_5_pari_4Pari_42__call__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_6cypari_5_pari_Pari.tp_dict, __pyx_vtabptr_6cypari_5_pari_Pari) < 0) __PYX_ERR(3, 488, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Pari, (PyObject *)&__pyx_type_6cypari_5_pari_Pari) < 0) __PYX_ERR(3, 488, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6cypari_5_pari_Pari) < 0) __PYX_ERR(3, 488, __pyx_L1_error)
  __pyx_ptype_6cypari_5_pari_Pari = &__pyx_type_6cypari_5_pari_Pari;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari___pyx_scope_struct____iter__) < 0) __PYX_ERR(6, 170, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari___pyx_scope_struct____iter__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari___pyx_scope_struct____iter__.tp_dictoffset && __pyx_type_6cypari_5_pari___pyx_scope_struct____iter__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari___pyx_scope_struct____iter__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6cypari_5_pari___pyx_scope_struct____iter__ = &__pyx_type_6cypari_5_pari___pyx_scope_struct____iter__;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(6, 282, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari___pyx_scope_struct_1_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_6cypari_5_pari___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6cypari_5_pari___pyx_scope_struct_1_genexpr = &__pyx_type_6cypari_5_pari___pyx_scope_struct_1_genexpr;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(6, 291, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari___pyx_scope_struct_2_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari___pyx_scope_struct_2_genexpr.tp_dictoffset && __pyx_type_6cypari_5_pari___pyx_scope_struct_2_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari___pyx_scope_struct_2_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6cypari_5_pari___pyx_scope_struct_2_genexpr = &__pyx_type_6cypari_5_pari___pyx_scope_struct_2_genexpr;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari___pyx_scope_struct_3___getitem__) < 0) __PYX_ERR(6, 937, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari___pyx_scope_struct_3___getitem__.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari___pyx_scope_struct_3___getitem__.tp_dictoffset && __pyx_type_6cypari_5_pari___pyx_scope_struct_3___getitem__.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari___pyx_scope_struct_3___getitem__.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6cypari_5_pari___pyx_scope_struct_3___getitem__ = &__pyx_type_6cypari_5_pari___pyx_scope_struct_3___getitem__;
  if (PyType_Ready(&__pyx_type_6cypari_5_pari___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(6, 1079, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_6cypari_5_pari___pyx_scope_struct_4_genexpr.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6cypari_5_pari___pyx_scope_struct_4_genexpr.tp_dictoffset && __pyx_type_6cypari_5_pari___pyx_scope_struct_4_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_6cypari_5_pari___pyx_scope_struct_4_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
  }
  __pyx_ptype_6cypari_5_pari___pyx_scope_struct_4_genexpr = &__pyx_type_6cypari_5_pari___pyx_scope_struct_4_genexpr;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 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(14, 9, __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(15, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(15, 8, __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(16, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(16, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_ptype_7cpython_11longintrepr_py_long = &PyLong_Type;
  __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;
}


#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC init_pari(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC init_pari(void)
#else
__Pyx_PyMODINIT_FUNC PyInit__pari(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit__pari(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__pari(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module '_pari' 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__pari(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(2, 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(2, 1, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(2, 1, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(2, 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("_pari", __pyx_methods, __pyx_k_Sage_class_for_PARI_s_GEN_type, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(2, 1, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(2, 1, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(2, 1, __pyx_L1_error)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(2, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(2, 1, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(2, 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(2, 1, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_cypari___pari) {
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(2, 1, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "cypari._pari")) {
      if (unlikely(PyDict_SetItemString(modules, "cypari._pari", __pyx_m) < 0)) __PYX_ERR(2, 1, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
  /*--- Global type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  if (unlikely(__Pyx_modinit_variable_export_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_function_export_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __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(2, 1, __pyx_L1_error)
  #endif

  /* "cypari/_pari.pyx":61
 * include "sage.pxi"
 * 
 * import sys, types             # <<<<<<<<<<<<<<
 * if sys.version_info.major > 2:
 *     iterable_types = (list, tuple, types.GeneratorType)
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_types, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_types, __pyx_t_1) < 0) __PYX_ERR(2, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/_pari.pyx":62
 * 
 * import sys, types
 * if sys.version_info.major > 2:             # <<<<<<<<<<<<<<
 *     iterable_types = (list, tuple, types.GeneratorType)
 * else:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_major); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_2, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 62, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "cypari/_pari.pyx":63
 * import sys, types
 * if sys.version_info.major > 2:
 *     iterable_types = (list, tuple, types.GeneratorType)             # <<<<<<<<<<<<<<
 * else:
 *     iterable_types = (list, tuple, types.XRangeType, types.GeneratorType)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_GeneratorType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)(&PyList_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&PyList_Type)));
    __Pyx_INCREF(((PyObject *)(&PyTuple_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyTuple_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)(&PyTuple_Type)));
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
    __pyx_t_1 = 0;
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_iterable_types, __pyx_t_2) < 0) __PYX_ERR(2, 63, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "cypari/_pari.pyx":62
 * 
 * import sys, types
 * if sys.version_info.major > 2:             # <<<<<<<<<<<<<<
 *     iterable_types = (list, tuple, types.GeneratorType)
 * else:
 */
    goto __pyx_L2;
  }

  /* "cypari/_pari.pyx":65
 *     iterable_types = (list, tuple, types.GeneratorType)
 * else:
 *     iterable_types = (list, tuple, types.XRangeType, types.GeneratorType)             # <<<<<<<<<<<<<<
 * 
 * cimport cython
 */
  /*else*/ {
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_XRangeType); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_types); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_GeneratorType); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)(&PyList_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyList_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&PyList_Type)));
    __Pyx_INCREF(((PyObject *)(&PyTuple_Type)));
    __Pyx_GIVEREF(((PyObject *)(&PyTuple_Type)));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)(&PyTuple_Type)));
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_4);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_iterable_types, __pyx_t_2) < 0) __PYX_ERR(2, 65, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L2:;

  /* "cypari/_pari.pyx":93
 *         raise ValueError('Neither a str nor a bytes object.')
 * 
 * cpu_width = '64bit' if sys.maxsize > 2**32 else '32bit'             # <<<<<<<<<<<<<<
 * 
 * include "memory.pxi"
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_maxsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_int_4294967296, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(2, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_kp_s_64bit);
    __pyx_t_2 = __pyx_kp_s_64bit;
  } else {
    __Pyx_INCREF(__pyx_kp_s_32bit);
    __pyx_t_2 = __pyx_kp_s_32bit;
  }
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_cpu_width, __pyx_t_2) < 0) __PYX_ERR(2, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/signals.pyx":38
 * 
 * 
 * class AlarmInterrupt(KeyboardInterrupt):             # <<<<<<<<<<<<<<
 *     """
 *     Exception class for :func:`alarm` timeouts.
 */
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__104); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__104, __pyx_n_s_AlarmInterrupt, __pyx_n_s_AlarmInterrupt, (PyObject *) NULL, __pyx_n_s_cypari__pari, __pyx_kp_s_Exception_class_for_func_alarm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_AlarmInterrupt, __pyx_tuple__104, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_AlarmInterrupt, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/signals.pyx":61
 *     pass
 * 
 * class SignalError(BaseException):             # <<<<<<<<<<<<<<
 *     """
 *     Exception class for critical signals such as ``SIGSEGV``. Inherits
 */
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__105); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__105, __pyx_n_s_SignalError, __pyx_n_s_SignalError, (PyObject *) NULL, __pyx_n_s_cypari__pari, __pyx_kp_s_Exception_class_for_critical_si); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_SignalError, __pyx_tuple__105, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_SignalError, __pyx_t_1) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/signals.pyx":117
 * 
 * 
 * def sig_print_exception(sig, msg=None):             # <<<<<<<<<<<<<<
 *     """
 *     Python version of :func:`sig_raise_exception` which prints the
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_1sig_print_exception, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sig_print_exception, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/signals.pyx":172
 * cdef cysigs_t cysigs
 * 
 * def init_cysignals():             # <<<<<<<<<<<<<<
 *     """
 *     Initialize ``cysignals``.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_3init_cysignals, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_cysignals, __pyx_t_2) < 0) __PYX_ERR(0, 172, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/signals.pyx":204
 *     return old
 * 
 * def sig_on_reset():             # <<<<<<<<<<<<<<
 *     """
 *     Return the current value of ``cysigs.sig_on_count`` and set its
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_5sig_on_reset, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sig_on_reset, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/signals.pyx":224
 * 
 * 
 * def python_check_interrupt(sig, frame):             # <<<<<<<<<<<<<<
 *     """
 *     Python-level interrupt handler for interrupts raised in Python
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_7python_check_interrupt, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_python_check_interrupt, __pyx_t_2) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/signals.pyx":232
 *     sig_check()
 * 
 * def test_signal(int sig):             # <<<<<<<<<<<<<<
 *     """
 *     Test whether critical signals can be handled within a sig_on-sig_off
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_9test_signal, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_signal, __pyx_t_2) < 0) __PYX_ERR(0, 232, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "cypari/_pari.pyx":97
 * include "memory.pxi"
 * include "signals.pyx"
 * init_cysignals()             # <<<<<<<<<<<<<<
 * include "stack.pyx"
 * include "pari_instance.pyx"
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_init_cysignals); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":299
 * include "sage.pxi"
 * 
 * import sys             # <<<<<<<<<<<<<<
 * encoding = sys.getfilesystemencoding()
 * 
 */
  __pyx_t_4 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_4) < 0) __PYX_ERR(3, 299, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":300
 * 
 * import sys
 * encoding = sys.getfilesystemencoding()             # <<<<<<<<<<<<<<
 * 
 * cdef bytes to_bytes(s):
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(3, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 300, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_encoding, __pyx_t_4) < 0) __PYX_ERR(3, 300, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":321
 * # Default precision (in PARI words) for the PARI library interface,
 * # when no explicit precision is given and the inputs are exact.
 * cdef long prec = prec_bits_to_words(53)             # <<<<<<<<<<<<<<
 * 
 * #################################################################
 */
  __pyx_v_6cypari_5_pari_prec = __pyx_f_6cypari_5_pari_prec_bits_to_words(53, 0);

  /* "cypari/pari_instance.pyx":327
 * #################################################################
 * 
 * def prec_bits_to_dec(long prec_in_bits):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in bits to precision expressed in
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_11prec_bits_to_dec, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 327, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_prec_bits_to_dec, __pyx_t_4) < 0) __PYX_ERR(3, 327, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":342
 *     return <long>nbits2ndec(prec_in_bits)
 * 
 * def prec_dec_to_bits(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_13prec_dec_to_bits, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_prec_dec_to_bits, __pyx_t_4) < 0) __PYX_ERR(3, 342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":422
 *     return (old_prec - 2) * BITS_IN_LONG
 * 
 * def prec_dec_to_words(long prec_in_dec):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in decimal to precision expressed
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_21prec_dec_to_words, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_prec_dec_to_words, __pyx_t_4) < 0) __PYX_ERR(3, 422, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":440
 *     return prec_bits_to_words(prec_dec_to_bits(prec_in_dec))
 * 
 * def prec_words_to_dec(long prec_in_words):             # <<<<<<<<<<<<<<
 *     r"""
 *     Convert from precision expressed in words to precision expressed in
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_23prec_words_to_dec, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_prec_words_to_dec, __pyx_t_4) < 0) __PYX_ERR(3, 440, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/pari_instance.pyx":1239
 *         return new_gen(primes_interval(t0.g, t1.g))
 * 
 *     euler = Pari_auto.Euler             # <<<<<<<<<<<<<<
 *     pi = Pari_auto.Pi
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6cypari_5_pari_Pari_auto), __pyx_n_s_Euler); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6cypari_5_pari_Pari->tp_dict, __pyx_n_s_euler, __pyx_t_4) < 0) __PYX_ERR(3, 1239, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  PyType_Modified(__pyx_ptype_6cypari_5_pari_Pari);

  /* "cypari/pari_instance.pyx":1240
 * 
 *     euler = Pari_auto.Euler
 *     pi = Pari_auto.Pi             # <<<<<<<<<<<<<<
 * 
 *     def polchebyshev(self, long n, v=None):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6cypari_5_pari_Pari_auto), __pyx_n_s_Pi); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6cypari_5_pari_Pari->tp_dict, __pyx_n_s_pi, __pyx_t_4) < 0) __PYX_ERR(3, 1240, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  PyType_Modified(__pyx_ptype_6cypari_5_pari_Pari);

  /* "cypari/_pari.pyx":101
 * include "pari_instance.pyx"
 * # Instantiate an instance of the Pari class
 * cdef Pari pari_instance = Pari()             # <<<<<<<<<<<<<<
 * # and make it accessible from python as `pari`.
 * pari = pari_instance
 */
  __pyx_t_4 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_6cypari_5_pari_Pari)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_XGOTREF(((PyObject *)__pyx_v_6cypari_5_pari_pari_instance));
  __Pyx_DECREF_SET(__pyx_v_6cypari_5_pari_pari_instance, ((struct __pyx_obj_6cypari_5_pari_Pari *)__pyx_t_4));
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "cypari/_pari.pyx":103
 * cdef Pari pari_instance = Pari()
 * # and make it accessible from python as `pari`.
 * pari = pari_instance             # <<<<<<<<<<<<<<
 * include "convert.pyx"
 * include "handle_error.pyx"
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pari_2, ((PyObject *)__pyx_v_6cypari_5_pari_pari_instance)) < 0) __PYX_ERR(2, 103, __pyx_L1_error)

  /* "cypari/handle_error.pyx":28
 * from cpython cimport PyErr_Occurred
 * 
 * import sys             # <<<<<<<<<<<<<<
 * 
 * # We derive PariError from RuntimeError, for backward compatibility with
 */
  __pyx_t_4 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_4) < 0) __PYX_ERR(1, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/handle_error.pyx":32
 * # We derive PariError from RuntimeError, for backward compatibility with
 * # code that catches the latter.
 * class PariError(RuntimeError):             # <<<<<<<<<<<<<<
 *     """
 *     Error raised by PARI
 */
  __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__124); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_tuple__124, __pyx_n_s_PariError, __pyx_n_s_PariError, (PyObject *) NULL, __pyx_n_s_cypari__pari, __pyx_kp_s_Error_raised_by_PARI); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "cypari/handle_error.pyx":36
 *     Error raised by PARI
 *     """
 *     def errnum(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return the PARI error number corresponding to this exception.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6cypari_5_pari_9PariError_1errnum, 0, __pyx_n_s_PariError_errnum, NULL, __pyx_n_s_cypari__pari, __pyx_d, ((PyObject *)__pyx_codeobj__126)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_errnum, __pyx_t_1) < 0) __PYX_ERR(1, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/handle_error.pyx":50
 *         return self.args[0]
 * 
 *     def errtext(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the message output by PARI when this error occurred.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6cypari_5_pari_9PariError_3errtext, 0, __pyx_n_s_PariError_errtext, NULL, __pyx_n_s_cypari__pari, __pyx_d, ((PyObject *)__pyx_codeobj__128)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_errtext, __pyx_t_1) < 0) __PYX_ERR(1, 50, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/handle_error.pyx":65
 *         return String(self.args[1])
 * 
 *     def errdata(self):             # <<<<<<<<<<<<<<
 *         """
 *         Return the error data (a ``t_ERROR`` gen) corresponding to this
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6cypari_5_pari_9PariError_5errdata, 0, __pyx_n_s_PariError_errdata, NULL, __pyx_n_s_cypari__pari, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_errdata, __pyx_t_1) < 0) __PYX_ERR(1, 65, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/handle_error.pyx":84
 *         return self.args[2]
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         TESTS::
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6cypari_5_pari_9PariError_7__repr__, 0, __pyx_n_s_PariError___repr, NULL, __pyx_n_s_cypari__pari, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_repr, __pyx_t_1) < 0) __PYX_ERR(1, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/handle_error.pyx":93
 *         return "PariError(%d)"%self.errnum()
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         r"""
 *         Return a suitable message for displaying this exception.
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6cypari_5_pari_9PariError_9__str__, 0, __pyx_n_s_PariError___str, NULL, __pyx_n_s_cypari__pari, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 93, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_str_2, __pyx_t_1) < 0) __PYX_ERR(1, 93, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "cypari/handle_error.pyx":32
 * # We derive PariError from RuntimeError, for backward compatibility with
 * # code that catches the latter.
 * class PariError(RuntimeError):             # <<<<<<<<<<<<<<
 *     """
 *     Error raised by PARI
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_PariError, __pyx_tuple__124, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PariError, __pyx_t_1) < 0) __PYX_ERR(1, 32, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/gen.pyx":2524
 *         return b != 0
 * 
 *     lift_centered = Gen_base.centerlift             # <<<<<<<<<<<<<<
 * 
 *     def padicprime(x):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6cypari_5_pari_Gen_base), __pyx_n_s_centerlift); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2524, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6cypari_5_pari_Gen->tp_dict, __pyx_n_s_lift_centered, __pyx_t_4) < 0) __PYX_ERR(6, 2524, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  PyType_Modified(__pyx_ptype_6cypari_5_pari_Gen);

  /* "cypari/gen.pyx":2869
 *             return new_gen(veceint1(x.g, stoi(n), prec_bits_to_words(precision)))
 * 
 *     log_gamma = Gen_base.lngamma             # <<<<<<<<<<<<<<
 * 
 *     def polylog(x, long m, long flag=0, unsigned long precision=0):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6cypari_5_pari_Gen_base), __pyx_n_s_lngamma); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 2869, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6cypari_5_pari_Gen->tp_dict, __pyx_n_s_log_gamma, __pyx_t_4) < 0) __PYX_ERR(6, 2869, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  PyType_Modified(__pyx_ptype_6cypari_5_pari_Gen);

  /* "cypari/gen.pyx":4107
 * 
 *     # Standard name for SageMath
 *     multiplicative_order = Gen_base.znorder             # <<<<<<<<<<<<<<
 * 
 *     def __abs__(self):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_6cypari_5_pari_Gen_base), __pyx_n_s_znorder); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 4107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_6cypari_5_pari_Gen->tp_dict, __pyx_n_s_multiplicative_order, __pyx_t_4) < 0) __PYX_ERR(6, 4107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  PyType_Modified(__pyx_ptype_6cypari_5_pari_Gen);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Pari_auto(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_6cypari_5_pari_35__pyx_unpickle_Pari_auto, NULL, __pyx_n_s_cypari__pari); if (unlikely(!__pyx_t_4)) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Pari_auto, __pyx_t_4) < 0) __PYX_ERR(8, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/_pari.pyx":1
 * # Use sys.getdefaultencoding() to convert Unicode strings to <char*>             # <<<<<<<<<<<<<<
 * #
 * # cython: c_string_encoding=default
 */
  __pyx_t_4 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_sig_print_exception_line_117, __pyx_kp_u_Python_version_of_func_sig_rais) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_init_cysignals_line_172, __pyx_kp_u_Initialize_cysignals_This_is_no) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_test_signal_line_232, __pyx_kp_u_Test_whether_critical_signals_c) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Pari_set_default_bit_precision_l, __pyx_kp_u_Set_the_default_bit_precision_f) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Pari__real_coerced_to_bits_prec, __pyx_kp_u_Creates_a_PARI_t_REAL_with_valu) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_kp_u_Gen___index___line_1551, __pyx_kp_u_Coerce_self_which_must_be_a_cla) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "cypari/memory.pxd":140
 * 
 * 
 * cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL:             # <<<<<<<<<<<<<<
 *     """
 *     Allocate memory for ``nmemb`` elements of size ``size``. The
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init cypari._pari", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init cypari._pari");
  }
  __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;
}

/* 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

/* 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

/* 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

/* decode_c_string */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* 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);
}

/* 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_CheckExact(key)) || 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
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(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
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(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;
}

/* 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);
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    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++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
#if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
#endif
{
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->exc_traceback = local_tb;
    }
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* 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 (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;
}

/* 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

/* 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;
}

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#endif

/* PyIntFromDouble */
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) {
    if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) {
        return PyInt_FromLong((long)value);
    }
    return PyLong_FromDouble(value);
}
#endif

/* WriteUnraisableException */
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* 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;
}

/* GetAttr */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* GetAttr3 */
static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* KeywordStringCheck */
static int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
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
    return 0;
}

/* 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_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

/* 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));
}

/* 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));
}

/* 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;
}

/* None */
static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* 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

/* pyobject_as_double */
static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
#if !CYTHON_USE_TYPE_SLOTS
    float_value = PyNumber_Float(obj);  if ((0)) goto bad;
#else
    PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
    if (likely(nb) && likely(nb->nb_float)) {
        float_value = nb->nb_float(obj);
        if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
            PyErr_Format(PyExc_TypeError,
                "__float__ returned non-float (type %.200s)",
                Py_TYPE(float_value)->tp_name);
            Py_DECREF(float_value);
            goto bad;
        }
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
#endif
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

/* SwapException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* None */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

/* JoinPyUnicode */
static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
                                      CYTHON_UNUSED Py_UCS4 max_char) {
#if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    PyObject *result_uval;
    int result_ukind;
    Py_ssize_t i, char_pos;
    void *result_udata;
#if CYTHON_PEP393_ENABLED
    result_uval = PyUnicode_New(result_ulength, max_char);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
    result_udata = PyUnicode_DATA(result_uval);
#else
    result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
    if (unlikely(!result_uval)) return NULL;
    result_ukind = sizeof(Py_UNICODE);
    result_udata = PyUnicode_AS_UNICODE(result_uval);
#endif
    char_pos = 0;
    for (i=0; i < value_count; i++) {
        int ukind;
        Py_ssize_t ulength;
        void *udata;
        PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
        if (unlikely(__Pyx_PyUnicode_READY(uval)))
            goto bad;
        ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
        if (unlikely(!ulength))
            continue;
        if (unlikely(char_pos + ulength < 0))
            goto overflow;
        ukind = __Pyx_PyUnicode_KIND(uval);
        udata = __Pyx_PyUnicode_DATA(uval);
        if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
            memcpy((char *)result_udata + char_pos * result_ukind, udata, (size_t) (ulength * result_ukind));
        } else {
            #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
            _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
            #else
            Py_ssize_t j;
            for (j=0; j < ulength; j++) {
                Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
                __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
            }
            #endif
        }
        char_pos += ulength;
    }
    return result_uval;
overflow:
    PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
bad:
    Py_DECREF(result_uval);
    return NULL;
#else
    result_ulength++;
    value_count++;
    return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
#endif
}

/* 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

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                    CYTHON_FALLTHROUGH;
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* SetItemInt */
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, 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) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_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 -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
#else
    if (is_list || PySequence_Check(o))
#endif
    {
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* 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;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* HasAttr */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* CallNextTpTraverse */
static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_traverse != current_tp_traverse)
        type = type->tp_base;
    while (type && type->tp_traverse == current_tp_traverse)
        type = type->tp_base;
    if (type && type->tp_traverse)
        return type->tp_traverse(obj, v, a);
    return 0;
}

/* CallNextTpClear */
static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
    PyTypeObject* type = Py_TYPE(obj);
    while (type && type->tp_clear != current_tp_clear)
        type = type->tp_base;
    while (type && type->tp_clear == current_tp_clear)
        type = type->tp_base;
    if (type && type->tp_clear)
        type->tp_clear(obj);
}

/* PyObject_GenericGetAttrNoDict */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

/* SetupReduce */
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* SetVTable */
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* 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

/* CalculateMetaclass */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

/* Py3ClassCreate */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

/* FetchCommonType */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

/* CythonFunction */
#include <structmember.h>
static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyObject_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    __Pyx__CyFunction_dealloc(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = f->m_ml->ml_meth;
    Py_ssize_t size;
    switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
    case METH_VARARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0))
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 0))
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
            size = PyTuple_GET_SIZE(arg);
            if (likely(size == 1)) {
                PyObject *result, *arg0;
                #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                arg0 = PyTuple_GET_ITEM(arg, 0);
                #else
                arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
                #endif
                result = (*meth)(self, arg0);
                #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
                Py_DECREF(arg0);
                #endif
                return result;
            }
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
}
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
    PyObject *result;
    __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
    if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
        Py_ssize_t argc;
        PyObject *new_args;
        PyObject *self;
        argc = PyTuple_GET_SIZE(args);
        new_args = PyTuple_GetSlice(args, 1, argc);
        if (unlikely(!new_args))
            return NULL;
        self = PyTuple_GetItem(args, 0);
        if (unlikely(!self)) {
            Py_DECREF(new_args);
            return NULL;
        }
        result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
        Py_DECREF(new_args);
    } else {
        result = __Pyx_CyFunction_Call(func, args, kw);
    }
    return result;
}
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_CallAsMethod,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_CyFunction_init(void) {
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (unlikely(__pyx_CyFunctionType == NULL)) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyObject_Malloc(size);
    if (unlikely(!m->defaults))
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

/* CLineInTraceback */
#ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(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);
}

/* 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;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* 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);
    }
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
    const unsigned long neg_one = (unsigned long) ((unsigned long) 0 - (unsigned long) 1), const_zero = (unsigned long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned 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(unsigned long),
                                     little, !is_unsigned);
    }
}

/* Print */
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    int i;
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        PyObject* v;
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                goto error;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            goto error;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0) {
                switch (s[len-1]) {
                    case ' ': break;
                    case '\f': case '\r': case '\n': case '\t': case '\v':
                        PyFile_SoftSpace(f, 0);
                        break;
                    default:  break;
                }
            }
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            goto error;
        PyFile_SoftSpace(f, 0);
    }
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
}
#else
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}
#endif

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) {
    const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(char) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(char) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(char) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(char) <= 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(char),
                                     little, !is_unsigned);
    }
}

/* 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;
}

/* 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 unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) {
    const unsigned long neg_one = (unsigned long) ((unsigned long) 0 - (unsigned long) 1), const_zero = (unsigned long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned 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 (unsigned long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT) {
                            return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT) {
                            return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) >= 4 * PyLong_SHIFT) {
                            return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned 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 (unsigned long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned 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 (unsigned long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned long) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned 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
            unsigned 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 (unsigned long) -1;
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned long) -1;
        val = __Pyx_PyInt_As_unsigned_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned long");
    return (unsigned long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned long");
    return (unsigned long) -1;
}

/* CIntFromPy */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) ((size_t) 0 - (size_t) 1), const_zero = (size_t) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) 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 (size_t) 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
                            return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
                            return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) >= 4 * PyLong_SHIFT) {
                            return (size_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
#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 (size_t) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, 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 (size_t) 0;
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                            return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                            return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_t) (((size_t)-1)*(((((((((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(size_t) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(size_t, 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(size_t) - 1 > 4 * PyLong_SHIFT) {
                            return (size_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
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(size_t, 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
            size_t 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 (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

/* PrintOne */
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            goto error;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        goto error;
    if (PyFile_WriteString("\n", f) < 0)
        goto error;
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
    /* the line below is just to avoid C compiler
     * warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}
#else
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_Pack(1, o);
    if (unlikely(!arg_tuple))
        return -1;
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}
#endif

/* 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

/* 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);
}

/* CoroutineBase */
#include <structmember.h>
#include <frameobject.h>
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
    PyObject *et, *ev, *tb;
    PyObject *value = NULL;
    __Pyx_ErrFetch(&et, &ev, &tb);
    if (!et) {
        Py_XDECREF(tb);
        Py_XDECREF(ev);
        Py_INCREF(Py_None);
        *pvalue = Py_None;
        return 0;
    }
    if (likely(et == PyExc_StopIteration)) {
        if (!ev) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#if PY_VERSION_HEX >= 0x030300A0
        else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
            value = ((PyStopIterationObject *)ev)->value;
            Py_INCREF(value);
            Py_DECREF(ev);
        }
#endif
        else if (unlikely(PyTuple_Check(ev))) {
            if (PyTuple_GET_SIZE(ev) >= 1) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
                value = PyTuple_GET_ITEM(ev, 0);
                Py_INCREF(value);
#else
                value = PySequence_ITEM(ev, 0);
#endif
            } else {
                Py_INCREF(Py_None);
                value = Py_None;
            }
            Py_DECREF(ev);
        }
        else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
            value = ev;
        }
        if (likely(value)) {
            Py_XDECREF(tb);
            Py_DECREF(et);
            *pvalue = value;
            return 0;
        }
    } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    PyErr_NormalizeException(&et, &ev, &tb);
    if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
        __Pyx_ErrRestore(et, ev, tb);
        return -1;
    }
    Py_XDECREF(tb);
    Py_DECREF(et);
#if PY_VERSION_HEX >= 0x030300A0
    value = ((PyStopIterationObject *)ev)->value;
    Py_INCREF(value);
    Py_DECREF(ev);
#else
    {
        PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args);
        Py_DECREF(ev);
        if (likely(args)) {
            value = PySequence_GetItem(args, 0);
            Py_DECREF(args);
        }
        if (unlikely(!value)) {
            __Pyx_ErrRestore(NULL, NULL, NULL);
            Py_INCREF(Py_None);
            value = Py_None;
        }
    }
#endif
    *pvalue = value;
    return 0;
}
static CYTHON_INLINE
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *t, *v, *tb;
    t = exc_state->exc_type;
    v = exc_state->exc_value;
    tb = exc_state->exc_traceback;
    exc_state->exc_type = NULL;
    exc_state->exc_value = NULL;
    exc_state->exc_traceback = NULL;
    Py_XDECREF(t);
    Py_XDECREF(v);
    Py_XDECREF(tb);
}
#define __Pyx_Coroutine_AlreadyRunningError(gen)  (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
        msg = "coroutine already executing";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
        msg = "async generator already executing";
    #endif
    } else {
        msg = "generator already executing";
    }
    PyErr_SetString(PyExc_ValueError, msg);
}
#define __Pyx_Coroutine_NotStartedError(gen)  (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
    const char *msg;
    if ((0)) {
    #ifdef __Pyx_Coroutine_USED
    } else if (__Pyx_Coroutine_Check(gen)) {
        msg = "can't send non-None value to a just-started coroutine";
    #endif
    #ifdef __Pyx_AsyncGen_USED
    } else if (__Pyx_AsyncGen_CheckExact(gen)) {
        msg = "can't send non-None value to a just-started async generator";
    #endif
    } else {
        msg = "can't send non-None value to a just-started generator";
    }
    PyErr_SetString(PyExc_TypeError, msg);
}
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing)  (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
    #ifdef __Pyx_Coroutine_USED
    if (!closing && __Pyx_Coroutine_Check(gen)) {
        PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
    } else
    #endif
    if (value) {
        #ifdef __Pyx_AsyncGen_USED
        if (__Pyx_AsyncGen_CheckExact(gen))
            PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
        else
        #endif
        PyErr_SetNone(PyExc_StopIteration);
    }
}
static
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
    __Pyx_PyThreadState_declare
    PyThreadState *tstate;
    __Pyx_ExcInfoStruct *exc_state;
    PyObject *retval;
    assert(!self->is_running);
    if (unlikely(self->resume_label == 0)) {
        if (unlikely(value && value != Py_None)) {
            return __Pyx_Coroutine_NotStartedError((PyObject*)self);
        }
    }
    if (unlikely(self->resume_label == -1)) {
        return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
    }
#if CYTHON_FAST_THREAD_STATE
    __Pyx_PyThreadState_assign
    tstate = __pyx_tstate;
#else
    tstate = __Pyx_PyThreadState_Current;
#endif
    exc_state = &self->gi_exc_state;
    if (exc_state->exc_type) {
        #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
        #else
        if (exc_state->exc_traceback) {
            PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
            PyFrameObject *f = tb->tb_frame;
            Py_XINCREF(tstate->frame);
            assert(f->f_back == NULL);
            f->f_back = tstate->frame;
        }
        #endif
    }
#if CYTHON_USE_EXC_INFO_STACK
    exc_state->previous_item = tstate->exc_info;
    tstate->exc_info = exc_state;
#else
    if (exc_state->exc_type) {
        __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    } else {
        __Pyx_Coroutine_ExceptionClear(exc_state);
        __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
    }
#endif
    self->is_running = 1;
    retval = self->body((PyObject *) self, tstate, value);
    self->is_running = 0;
#if CYTHON_USE_EXC_INFO_STACK
    exc_state = &self->gi_exc_state;
    tstate->exc_info = exc_state->previous_item;
    exc_state->previous_item = NULL;
    __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
#endif
    return retval;
}
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
    PyObject *exc_tb = exc_state->exc_traceback;
    if (likely(exc_tb)) {
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
#else
        PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
        PyFrameObject *f = tb->tb_frame;
        Py_CLEAR(f->f_back);
#endif
    }
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
    if (unlikely(!retval)) {
        __Pyx_PyThreadState_declare
        __Pyx_PyThreadState_assign
        if (!__Pyx_PyErr_Occurred()) {
            PyObject *exc = PyExc_StopIteration;
            #ifdef __Pyx_AsyncGen_USED
            if (__Pyx_AsyncGen_CheckExact(gen))
                exc = __Pyx_PyExc_StopAsyncIteration;
            #endif
            __Pyx_PyErr_SetNone(exc);
        }
    }
    return retval;
}
static CYTHON_INLINE
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
    PyObject *ret;
    PyObject *val = NULL;
    __Pyx_Coroutine_Undelegate(gen);
    __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
    ret = __Pyx_Coroutine_SendEx(gen, val, 0);
    Py_XDECREF(val);
    return ret;
}
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
    PyObject *retval;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, value);
        } else
        #endif
        #ifdef __Pyx_AsyncGen_USED
        if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
            ret = __Pyx_async_gen_asend_send(yf, value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyCoro_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
        } else
        #endif
        {
            if (value == Py_None)
                ret = Py_TYPE(yf)->tp_iternext(yf);
            else
                ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
        }
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        retval = __Pyx_Coroutine_FinishDelegation(gen);
    } else {
        retval = __Pyx_Coroutine_SendEx(gen, value, 0);
    }
    return __Pyx_Coroutine_MethodReturn(self, retval);
}
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
    PyObject *retval = NULL;
    int err = 0;
    #ifdef __Pyx_Generator_USED
    if (__Pyx_Generator_CheckExact(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_Coroutine_USED
    if (__Pyx_Coroutine_Check(yf)) {
        retval = __Pyx_Coroutine_Close(yf);
        if (!retval)
            return -1;
    } else
    if (__Pyx_CoroutineAwait_CheckExact(yf)) {
        retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
        if (!retval)
            return -1;
    } else
    #endif
    #ifdef __Pyx_AsyncGen_USED
    if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
        retval = __Pyx_async_gen_asend_close(yf, NULL);
    } else
    if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
        retval = __Pyx_async_gen_athrow_close(yf, NULL);
    } else
    #endif
    {
        PyObject *meth;
        gen->is_running = 1;
        meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
        if (unlikely(!meth)) {
            if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                PyErr_WriteUnraisable(yf);
            }
            PyErr_Clear();
        } else {
            retval = PyObject_CallFunction(meth, NULL);
            Py_DECREF(meth);
            if (!retval)
                err = -1;
        }
        gen->is_running = 0;
    }
    Py_XDECREF(retval);
    return err;
}
static PyObject *__Pyx_Generator_Next(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        gen->is_running = 1;
        #ifdef __Pyx_Generator_USED
        if (__Pyx_Generator_CheckExact(yf)) {
            ret = __Pyx_Generator_Next(yf);
        } else
        #endif
        #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
        if (PyGen_CheckExact(yf)) {
            ret = _PyGen_Send((PyGenObject*)yf, NULL);
        } else
        #endif
        #ifdef __Pyx_Coroutine_USED
        if (__Pyx_Coroutine_Check(yf)) {
            ret = __Pyx_Coroutine_Send(yf, Py_None);
        } else
        #endif
            ret = Py_TYPE(yf)->tp_iternext(yf);
        gen->is_running = 0;
        if (likely(ret)) {
            return ret;
        }
        return __Pyx_Coroutine_FinishDelegation(gen);
    }
    return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
}
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
    return __Pyx_Coroutine_Close(self);
}
static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *retval, *raised_exception;
    PyObject *yf = gen->yieldfrom;
    int err = 0;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        Py_INCREF(yf);
        err = __Pyx_Coroutine_CloseIter(gen, yf);
        __Pyx_Coroutine_Undelegate(gen);
        Py_DECREF(yf);
    }
    if (err == 0)
        PyErr_SetNone(PyExc_GeneratorExit);
    retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
    if (unlikely(retval)) {
        const char *msg;
        Py_DECREF(retval);
        if ((0)) {
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_Coroutine_Check(self)) {
            msg = "coroutine ignored GeneratorExit";
        #endif
        #ifdef __Pyx_AsyncGen_USED
        } else if (__Pyx_AsyncGen_CheckExact(self)) {
#if PY_VERSION_HEX < 0x03060000
            msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
#else
            msg = "async generator ignored GeneratorExit";
#endif
        #endif
        } else {
            msg = "generator ignored GeneratorExit";
        }
        PyErr_SetString(PyExc_RuntimeError, msg);
        return NULL;
    }
    raised_exception = PyErr_Occurred();
    if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
        if (raised_exception) PyErr_Clear();
        Py_INCREF(Py_None);
        return Py_None;
    }
    return NULL;
}
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
                                        PyObject *args, int close_on_genexit) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject *yf = gen->yieldfrom;
    if (unlikely(gen->is_running))
        return __Pyx_Coroutine_AlreadyRunningError(gen);
    if (yf) {
        PyObject *ret;
        Py_INCREF(yf);
        if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
            int err = __Pyx_Coroutine_CloseIter(gen, yf);
            Py_DECREF(yf);
            __Pyx_Coroutine_Undelegate(gen);
            if (err < 0)
                return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
            goto throw_here;
        }
        gen->is_running = 1;
        if (0
        #ifdef __Pyx_Generator_USED
            || __Pyx_Generator_CheckExact(yf)
        #endif
        #ifdef __Pyx_Coroutine_USED
            || __Pyx_Coroutine_Check(yf)
        #endif
            ) {
            ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
        #ifdef __Pyx_Coroutine_USED
        } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
            ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
        #endif
        } else {
            PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
            if (unlikely(!meth)) {
                Py_DECREF(yf);
                if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
                    gen->is_running = 0;
                    return NULL;
                }
                PyErr_Clear();
                __Pyx_Coroutine_Undelegate(gen);
                gen->is_running = 0;
                goto throw_here;
            }
            if (likely(args)) {
                ret = PyObject_CallObject(meth, args);
            } else {
                ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
            }
            Py_DECREF(meth);
        }
        gen->is_running = 0;
        Py_DECREF(yf);
        if (!ret) {
            ret = __Pyx_Coroutine_FinishDelegation(gen);
        }
        return __Pyx_Coroutine_MethodReturn(self, ret);
    }
throw_here:
    __Pyx_Raise(typ, val, tb, NULL);
    return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
}
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
    PyObject *typ;
    PyObject *val = NULL;
    PyObject *tb = NULL;
    if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
        return NULL;
    return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
}
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
    Py_VISIT(exc_state->exc_type);
    Py_VISIT(exc_state->exc_value);
    Py_VISIT(exc_state->exc_traceback);
    return 0;
}
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
    Py_VISIT(gen->closure);
    Py_VISIT(gen->classobj);
    Py_VISIT(gen->yieldfrom);
    return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
}
static int __Pyx_Coroutine_clear(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    Py_CLEAR(gen->closure);
    Py_CLEAR(gen->classobj);
    Py_CLEAR(gen->yieldfrom);
    __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
    }
#endif
    Py_CLEAR(gen->gi_code);
    Py_CLEAR(gen->gi_name);
    Py_CLEAR(gen->gi_qualname);
    Py_CLEAR(gen->gi_modulename);
    return 0;
}
static void __Pyx_Coroutine_dealloc(PyObject *self) {
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    PyObject_GC_UnTrack(gen);
    if (gen->gi_weakreflist != NULL)
        PyObject_ClearWeakRefs(self);
    if (gen->resume_label >= 0) {
        PyObject_GC_Track(self);
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
        if (PyObject_CallFinalizerFromDealloc(self))
#else
        Py_TYPE(gen)->tp_del(self);
        if (self->ob_refcnt > 0)
#endif
        {
            return;
        }
        PyObject_GC_UnTrack(self);
    }
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        /* We have to handle this case for asynchronous generators
           right here, because this code has to be between UNTRACK
           and GC_Del. */
        Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
    }
#endif
    __Pyx_Coroutine_clear(self);
    PyObject_GC_Del(gen);
}
static void __Pyx_Coroutine_del(PyObject *self) {
    PyObject *error_type, *error_value, *error_traceback;
    __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
    __Pyx_PyThreadState_declare
    if (gen->resume_label < 0) {
        return;
    }
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt == 0);
    self->ob_refcnt = 1;
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
#ifdef __Pyx_AsyncGen_USED
    if (__Pyx_AsyncGen_CheckExact(self)) {
        __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
        PyObject *finalizer = agen->ag_finalizer;
        if (finalizer && !agen->ag_closed) {
            PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
            if (unlikely(!res)) {
                PyErr_WriteUnraisable(self);
            } else {
                Py_DECREF(res);
            }
            __Pyx_ErrRestore(error_type, error_value, error_traceback);
            return;
        }
    }
#endif
    if (unlikely(gen->resume_label == 0 && !error_value)) {
#ifdef __Pyx_Coroutine_USED
#ifdef __Pyx_Generator_USED
    if (!__Pyx_Generator_CheckExact(self))
#endif
        {
        PyObject_GC_UnTrack(self);
#if PY_MAJOR_VERSION >= 3  || defined(PyErr_WarnFormat)
        if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
            PyErr_WriteUnraisable(self);
#else
        {PyObject *msg;
        char *cmsg;
        #if CYTHON_COMPILING_IN_PYPY
        msg = NULL;
        cmsg = (char*) "coroutine was never awaited";
        #else
        char *cname;
        PyObject *qualname;
        qualname = gen->gi_qualname;
        cname = PyString_AS_STRING(qualname);
        msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
        if (unlikely(!msg)) {
            PyErr_Clear();
            cmsg = (char*) "coroutine was never awaited";
        } else {
            cmsg = PyString_AS_STRING(msg);
        }
        #endif
        if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
            PyErr_WriteUnraisable(self);
        Py_XDECREF(msg);}
#endif
        PyObject_GC_Track(self);
        }
#endif
    } else {
        PyObject *res = __Pyx_Coroutine_Close(self);
        if (unlikely(!res)) {
            if (PyErr_Occurred())
                PyErr_WriteUnraisable(self);
        } else {
            Py_DECREF(res);
        }
    }
    __Pyx_ErrRestore(error_type, error_value, error_traceback);
#if !CYTHON_USE_TP_FINALIZE
    assert(self->ob_refcnt > 0);
    if (--self->ob_refcnt == 0) {
        return;
    }
    {
        Py_ssize_t refcnt = self->ob_refcnt;
        _Py_NewReference(self);
        self->ob_refcnt = refcnt;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    assert(PyType_IS_GC(self->ob_type) &&
           _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
    _Py_DEC_REFTOTAL;
#endif
#ifdef COUNT_ALLOCS
    --Py_TYPE(self)->tp_frees;
    --Py_TYPE(self)->tp_allocs;
#endif
#endif
}
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_name;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_name;
    Py_INCREF(value);
    self->gi_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
{
    PyObject *name = self->gi_qualname;
    if (unlikely(!name)) name = Py_None;
    Py_INCREF(name);
    return name;
}
static int
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value)))
#else
    if (unlikely(value == NULL || !PyString_Check(value)))
#endif
    {
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = self->gi_qualname;
    Py_INCREF(value);
    self->gi_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
            PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
    if (unlikely(!gen))
        return NULL;
    return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
}
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
            __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
            PyObject *name, PyObject *qualname, PyObject *module_name) {
    gen->body = body;
    gen->closure = closure;
    Py_XINCREF(closure);
    gen->is_running = 0;
    gen->resume_label = 0;
    gen->classobj = NULL;
    gen->yieldfrom = NULL;
    gen->gi_exc_state.exc_type = NULL;
    gen->gi_exc_state.exc_value = NULL;
    gen->gi_exc_state.exc_traceback = NULL;
#if CYTHON_USE_EXC_INFO_STACK
    gen->gi_exc_state.previous_item = NULL;
#endif
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    PyObject_GC_Track(gen);
    return gen;
}

/* PatchModuleWithCoroutine */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchGeneratorABC */
#ifndef CYTHON_REGISTER_ABCS
#define CYTHON_REGISTER_ABCS 1
#endif
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
static PyObject* __Pyx_patch_abc_module(PyObject *module);
static PyObject* __Pyx_patch_abc_module(PyObject *module) {
    module = __Pyx_Coroutine_patch_module(
        module, ""
"if _cython_generator_type is not None:\n"
"    try: Generator = _module.Generator\n"
"    except AttributeError: pass\n"
"    else: Generator.register(_cython_generator_type)\n"
"if _cython_coroutine_type is not None:\n"
"    try: Coroutine = _module.Coroutine\n"
"    except AttributeError: pass\n"
"    else: Coroutine.register(_cython_coroutine_type)\n"
    );
    return module;
}
#endif
static int __Pyx_patch_abc(void) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    static int abc_patched = 0;
    if (CYTHON_REGISTER_ABCS && !abc_patched) {
        PyObject *module;
        module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
        if (!module) {
            PyErr_WriteUnraisable(NULL);
            if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
                    ((PY_MAJOR_VERSION >= 3) ?
                        "Cython module failed to register with collections.abc module" :
                        "Cython module failed to register with collections module"), 1) < 0)) {
                return -1;
            }
        } else {
            module = __Pyx_patch_abc_module(module);
            abc_patched = 1;
            if (unlikely(!module))
                return -1;
            Py_DECREF(module);
        }
        module = PyImport_ImportModule("backports_abc");
        if (module) {
            module = __Pyx_patch_abc_module(module);
            Py_XDECREF(module);
        }
        if (!module) {
            PyErr_Clear();
        }
    }
#else
    if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
#endif
    return 0;
}

/* Generator */
static PyMethodDef __pyx_Generator_methods[] = {
    {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
     (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
    {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
     (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
    {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
     (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
    {0, 0, 0, 0}
};
static PyMemberDef __pyx_Generator_memberlist[] = {
    {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
    {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
     (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
    {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
    {0, 0, 0, 0, 0}
};
static PyGetSetDef __pyx_Generator_getsets[] = {
    {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
     (char*) PyDoc_STR("name of the generator"), 0},
    {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
     (char*) PyDoc_STR("qualified name of the generator"), 0},
    {0, 0, 0, 0, 0}
};
static PyTypeObject __pyx_GeneratorType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "generator",
    sizeof(__pyx_CoroutineObject),
    0,
    (destructor) __Pyx_Coroutine_dealloc,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
    0,
    (traverseproc) __Pyx_Coroutine_traverse,
    0,
    0,
    offsetof(__pyx_CoroutineObject, gi_weakreflist),
    0,
    (iternextfunc) __Pyx_Generator_Next,
    __pyx_Generator_methods,
    __pyx_Generator_memberlist,
    __pyx_Generator_getsets,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if CYTHON_USE_TP_FINALIZE
    0,
#else
    __Pyx_Coroutine_del,
#endif
    0,
#if CYTHON_USE_TP_FINALIZE
    __Pyx_Coroutine_del,
#elif PY_VERSION_HEX >= 0x030400a1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    0,
#endif
};
static int __pyx_Generator_init(void) {
    __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
    __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
    __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
    if (unlikely(!__pyx_GeneratorType)) {
        return -1;
    }
    return 0;
}

/* 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;
}

/* VoidPtrExport */
static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) {
    PyObject *d;
    PyObject *cobj = 0;
    d = PyDict_GetItem(__pyx_d, __pyx_n_s_pyx_capi);
    Py_XINCREF(d);
    if (!d) {
        d = PyDict_New();
        if (!d)
            goto bad;
        if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s_pyx_capi, d) < 0)
            goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItem(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* FunctionExport */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* 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 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 */
